开发者

DeviceIoControl returning false

开发者 https://www.devze.com 2022-12-16 18:20 出处:网络
In my C# code,DeviceIoControl is returning false,the handle is correct 开发者_运维百科 DeviceIoControl(deviceHandle,

In my C# code,DeviceIoControl is returning false,the handle is correct

开发者_运维百科
DeviceIoControl(deviceHandle,
  IOCTL_STORAGE_GET_DEVICE_NUMBER,
  IntPtr.Zero,
  0,
  OutBuffPtr,//&psdn,
  OutBuffSize,
  ref dwBytesReturned,
   IntPtr.Zero);


There is not a lot of data here to go on, but Marshal.GetLastWin32Error() should give you more specific error information.


I did try to use Marshal.GetLastWin32Error() which returned 1, according to MSDN it means incorrect function. In the code I am trying to get the device number passing Intptr to buffer of size STORAGE_DEVICE_NUMBER (which is 12 bytes) from function DeviceIoControl in kernel32.dll.

I've hit a dead end.

0

精彩评论

暂无评论...
验证码 换一张
取 消