MiniblinkNet/FileSystem.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Kyozy.MiniblinkNet
{
    public class FileSystem
    {
        #region API声明
        [DllImport("shlwapi.dll", EntryPoint = "PathIsRelativeW", CharSet = CharSet.Unicode)]
        private static extern int PathIsRelative(string pszPath);
        [DllImport("shlwapi.dll", EntryPoint = "PathRemoveFileSpecW", CharSet = CharSet.Unicode)]
        private static extern int PathRemoveFileSpec(StringBuilder pszPath);
        [DllImport("shlwapi.dll", EntryPoint = "PathCombineW", CharSet = CharSet.Unicode)]
        private static extern int PathCombine(StringBuilder szDest, string lpszDir, string lpszFile);
        [DllImport("kernel32.dll", EntryPoint = "CreateFileW", CharSet = CharSet.Unicode)]
        private static extern IntPtr CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
        [DllImport("kernel32.dll", EntryPoint = "CloseHandle")]
        private static extern int CloseHandle(IntPtr hObject);
        [DllImport("kernel32.dll", EntryPoint = "GetFileSize")]
        private static extern int GetFileSize(IntPtr hFile, int lpFileSizeHigh);
        [DllImport("kernel32.dll", EntryPoint = "ReadFile")]
        private static extern int ReadFile(IntPtr hFile, IntPtr lpBuffer, int nNumberOfBytesToRead, ref int lpNumberOfBytesRead, int lpOverlapped);
        [DllImport("kernel32.dll", EntryPoint = "SetFilePointer")]
        private static extern int SetFilePointer(IntPtr hFile, int lDistanceToMove, int lpDistanceToMoveHigh, int dwMoveMethod);

        #endregion

        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        internal delegate IntPtr FILE_OPEN(IntPtr path);

        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        internal delegate void FILE_CLOSE(IntPtr handle);

        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        internal delegate int FILE_SIZE(IntPtr handle);

        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        internal delegate int FILE_READ(IntPtr handle, IntPtr buffer, int size);

        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        internal delegate int FILE_SEEK(IntPtr handle, int offset, int origin);

        private const int GENERIC_READ = -2147483648;
        private const int OPEN_EXISTING = 3;
        private const int FILE_SHARE_READ = 1;
        private const int FILE_SHARE_WRITE = 2;
        private const int FILE_ATTRIBUTE_NORMAL = 128;

        internal FILE_OPEN m_fileOpen;
        internal FILE_CLOSE m_fileClose;
        internal FILE_SIZE m_fileSize;
        internal FILE_READ m_fileRead;
        internal FILE_SEEK m_fileSeek;

        public FileSystem()
        {
            m_fileOpen = new FILE_OPEN(FileOpen);
后面还有 40 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。