Exception "Incorrect Function (0x80070001)" for function "IOCTL_SCSI_GET_CAPABILITIES" on Windows 8

Dec 23, 2013 at 11:23 PM
Edited Dec 23, 2013 at 11:26 PM
First, thanks a lot for the author/contributor of this awesome library and it solved a big problem for me. You guys really did a great job.

I notice one particular pinvoke function call in Win32Spti.cs will fail on Windows 8. I figure out it is the one below:

In getter function of "Capabilities" attritbute
DeviceIoControl(this.deviceHandle, IOCTL_SCSI_GET_CAPABILITIES, IntPtr.Zero, 0, (IntPtr)(&result), Marshaler.DefaultSizeOf<IOScsiCapabilities>(), out temp, IntPtr.Zero)
The exception is:
[System.Runtime.InteropServices.COMException]   {"Incorrect function. (Exception from HRESULT: 0x80070001)"}
Anyone get any idea regarding this problem? Thanks in advance.
Coordinator
Dec 23, 2013 at 11:32 PM
I'm not sure to be honest, I'm not aware what changes in Windows 8 might have caused this.
It seems like the driver is failing the request, but as far as I can imagine there's really nothing that can be done about it from user-mode. :(
Dec 23, 2013 at 11:40 PM
Thanks for your quick reply. It is really lucky that it does not break any other function in SCSI class so my application still runs correctly. I do need to remove the "ThrowExceptionForHR". So far I have tested on XP, Win7 and Win8. Interestingly, it will have this issue after install VS2012 on win7 and Win 8 will fail completely.
Coordinator
Dec 23, 2013 at 11:47 PM
Yeah, that's bizarre. I don't have a chance to test it myself now but it's really weird for this to happen after installing VS2012... I can't think of any logical explanation.
Try running it without a debugger attached? But even then, it shouldn't make a difference.