1
Vote

Win32Spti throws exceptions

description

Hi,
I am not sure if this is the correct place to post this but I think there is a bug in the latest source code. When I run the solution on Visual Studio 2008, I see that Win32Spti has trouble accessing my 2 of my cd-roms. I tried to run just binary version and everything worked fine. I could not figure out the problem with the source code.

file attachments

comments

OccumsRazor wrote Feb 7, 2011 at 6:13 PM

That's really weird... both the binary and the source run correctly on my computer. Would you mind helping me debug this? After the debugger gets to the line "var buffer = new BufferWithSize(pBuffer, bytesReturned);", would you mind stepping through it and getting to "ScsiAdapterBusInfo.MarshalFrom", and noting down whether the statement "this._BusData = new ScsiBusData[this.NumberOfBuses];" is executed? And if so, what is the array length?

Also, what is your OS and platform?

Thank you for reporting this!

xtrecoolx wrote Feb 7, 2011 at 7:54 PM

I can't debug it write now but this._BusData = new ScsiBusData[this.NumberOfBuses] line throws exception if I remember correctly. I am using Windows Server 2003 and Visual Studio 2008. As I said earlier, when I run the binary I don't get any errors. I tried to link the dll in the binary zip but it throws the same exception. This exception seems to occur for my virtual devices not the real cd-writer. However, your binary version has no problems detecting my virtual drives.

OccumsRazor wrote Feb 7, 2011 at 10:12 PM

Ah, it seems like I've forgotten to do an error check. Before the line saying "var buffer = new BufferWithSize(pBuffer, bytesReturned);", can you add this line?
if (lastError != 0) { ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); }
It should still throw an exception, but it should give a more meaningful error. Would you mind posting it here? (Or, if you don't get an error, then what happens?)

I think the reason you're getting the error is that you're getting an exception is that your debugger is breaking on all exceptions, rather than just uncaught ones. Try passing the exception on to the program (either by just telling Visual Studio to Continue, or by running the program in "Start without Debugging" mode), and seeing if it crashes. If it doesn't, then the program probably recovered correctly from the error.

wrote Feb 8, 2011 at 8:36 AM

xtrecoolx wrote Feb 8, 2011 at 8:36 AM

Well, I added that line and the exception I get is : System.Runtime.InteropServices.COMException (0x80070001): Incorrect function.

When I try to run the program instead of debugging, it still crashes on that line and but I can continue with the execution. However, it seems to detect only one of my cd-roms and I can't get any information about that cd-rom either. Take a look at the following attachment, which contains one screenshot of the binary and two of the executed source.

As I mentioned earlier on my post, even when I link the binary's dll, which is created by you, I still get exceptions when I hit the two other cdroms. I don't understand why this does not happen on your binary executable. Maybe I have to change some compiler settings on my machine but I don't know how you set that up. The good thing is that your binary version seems to work just fine.

OccumsRazor wrote Feb 8, 2011 at 2:13 PM

Well, that definitely is funny... there's no compiler setting difference, aside from the fact that I set it to Release mode before I make the binaries. What happens if you make the Release binaries yourself? Do they work like my version?

I have no idea why this is happening... I'll think about it and I'll let you know if I think of anything, but I can't think of any reason why my binaries would work when my source code wouldn't, they're the same thing.

wrote Feb 13, 2013 at 10:45 PM