SynchronizeCache

May 26, 2010 at 7:29 AM
Edited May 26, 2010 at 11:45 AM

Hi,

I got a new error. ;-)

At:
cd.SynchronizeCache(new SynchronizeCache10Command());

There Visual Studio Crashs. On the command line I got:
Unhandled Exception: System.IO.IOException: The logical unit is not accessible.
Operator intervention may be required to correct this condition.
Details: Medium not present ---> Scsi.ScsiException: Current Error: Not Ready Medium not present
--- End of inner exception stack trace ---

If I use your SCSITest project I got another error at the same line:
{System.Runtime.InteropServices.COMException (0x8007051A): Dies zeigt an, dass zwei Revisionsstufen nicht kompatibel sind. (Ausnahme von HRESULT: 0x8007051A)
bei Scsi.Win32Spti.ThrowExceptionForHR(Int32 hr) in ...\SCSITest\Scsi\Scsi\Win32Spti.cs:Zeile 180.

bei Scsi.Win32Spti.ExecuteCommand(BufferWithSize cdb, DataTransferDirection direction, Byte pathId, Byte targetId, Byte logicalUnitNumber, BufferWithSize data, UInt32 timeout, Boolean autoSense, SenseData& senseData) in ...\SCSITest\Scsi\Scsi\Win32Spti.cs:Zeile 257.

Means: Indicates two revision levels are incompatible.

I tried "\\.\CdRom0", "\\.\CdRom1" and "\\.\F:" (F is my DVD-RW drive), but without success. I also tried to run the program with administrator rights...but no effect.

Thanks again.

OK, I got it.

SOLUTION: I used "\\.\F:" like some times before and now it works. Don't know why, but it works.

Coordinator
May 26, 2010 at 2:19 PM
Well, the part about Visual Studio crashing is funny; it doesn't seem to have to do anything with my program. Notice the error details: Medium not present ---> Scsi.ScsiException: Current Error: Not Ready Medium not present That means there's no disc in the drive. As such, you can't flush the cache since there's nothing to write it to, even if it's empty. So place a disc in the drive and see if that works. (I'm not sure why using \\.\F: works, but I highly recommend that you don't do it since, again, there's a lot of potential for dangerous errors.) Tell me if that works!
May 27, 2010 at 6:19 AM

CdRom0 and CdRom1 won't work. Maybe it's CdRom3-N? Can I see this name somewhere in Windows?

And to "Medium not present": There was a blank CDRom in the drive. As I uses \\.\F: it worked and I don't touched the cdrom inside. ;-)

Coordinator
May 28, 2010 at 1:20 AM
That's very interesting; I'm not sure why that would happen -- how many optical drives do you have? All the N drives are numbered from zero to N - 1, and if you want to see where the name \\.\CdRomN comes from, take a look at: 1. WinObjEx (download from http://four-f.webs.com/Tools/WinObjEx.zip). Then go to the \Global??\ directory and you'll see a lot of objects, including CdRom0, CdRom1, etc. 2. This page: http://msdn.microsoft.com/en-us/library/cc249553%28PROT.13%29.aspx (then search for "CdRomN") To find out why this happens, could you please do the following? - Run WinObjEx. - Go to the \Global??\ directory. - Find the F: entry and see what it maps to (it's a link to a target, so see what the target is) - Try to find a CdRomN entry that maps to the same thing as your F: drive does, and please let me know what it is. Hopefully I can find why this is happening; thanks for the feedback!
May 28, 2010 at 6:11 AM

Ok, my Device is CDRom1. The Path in WinObjEx is "\Device\CdRom1".

I tried "\\.\Device\CdRom1", "\\Device\CdRom1" and "\Device\CdRom1" without success.

But there are two names for CdRom1:

CdRom1 - SymbolicLink - \Device\CdRom1
F: - SymbolicLink - \Device\CdRom1

So if I use \\.\F: ... \\.\CdRom1 should work also. Don't why it does not.

Coordinator
May 29, 2010 at 3:46 AM
That's funny... I really didn't expect this to happen and I don't know why it's happening. If \\.\CdRom1 and \\.\F: both map to \Device\CdRom1, then they should both work; I don't know what to say. (By the way, \Device\CdRom1 is the full NT path name for your device, \??\CdRom1 and \??\F: are the two NT path names for the links to that device, and \\.\CdRom1 and \\.\F: are the DOS-style names for \??\CdRom1 and \??\F:, respectively. That's why something like \\.\Device\CdRom1 doesn't exist.) This is bizarre and I don't know how to solve it, but thank you for letting me know about this problem!