c#如何使用CreateFile和DeviceIoControl
想先打开一个sys,然后与其通信。
用C++使用这2个函数。但是c#该如何使用呢?
[解决办法]
[DllImport("kernel32.dll", EntryPoint="CreateFile")]
public static extern int CreateFile (
string lpFileName,
int dwDesiredAccess,
int dwShareMode,
ref SECURITY_ATTRIBUTES lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
int hTemplateFile
);
[DllImport("kernel32.dll", EntryPoint="DeviceIoControl")]
public static extern int DeviceIoControl (
int hDevice,
int dwIoControlCode,
ref int lpInBuffer,
int nInBufferSize,
ref int lpOutBuffer,
int nOutBufferSize,
ref int lpBytesReturned,
ref OVERLAPPED lpOverlapped
);