开发者

DeviceIoControl returning false

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜