C#中用CreateFile返回0xffffffff,GetLastError()返回0
[DllImport("kernel32.dll", SetLastError = false, CharSet = CharSet.Auto)]
private static extern IntPtr CreateFile(string fileName, uint desiredAccess, uint shareMode, uint securityAttributes, uint creationDisposition, uint flagsAndAttributes, uint templateFile);
device = CreateFile(deviceList[i],
DESIREDACCESS.GENERIC_READ | DESIREDACCESS.GENERIC_WRITE,
SHAREMODE.FILE_SHARE_READ | SHAREMODE.FILE_SHARE_WRITE,
0,
CREATIONDISPOSITION.OPEN_EXISTING,
FLAGSANDATTRIBUTES.FILE_FLAG_OVERLAPPED,
0);
int errCode = Marshal.GetLastWin32Error();
//errCode 返回0,device 返回0xffffffff
errCode 返回0,device 返回0xffffffff
######有什么解决的办法吗?