I have a SCSI HBA (ATTO 348) installed on my machine. I plugged a RAID expander into the HBA controller. My goal is to obtain a device path / MS DOS path that I can use with CreateFile, so that I can then call DeviceIOControl.
I am working with C#.Net. I started off with WMI, but then migrated to using the Windows DDK install library (SetupDi*). I got most of the way, but am stuck at the last part. Let me explain.
As a first step, I want to open a channel to the ATTO controller, but the expander has the same problem and that is the concern, as the HBA was merely a stepping point. There are two basic ways to go about the task. The first is call SetupDiGetClassDev and then enumerate the devices using SetupDiEnumDeviceInfo, while the second method is to enumerate all GUID_DEVINTERFACE_STORAGEPORT interfaces. The latter method does not yield the expander, while the first one does.
I am able to call SetupDiGetDeviceInterfaceDetail and get the device path, which in theory should be what I pass to CreateFile, but the device path returned is not CreateFile friendly. That just gives an error message of no file/device found. I did some research and the problem is the interface GUID used in the path.
The device path returned by the DDK is:
\?\PCI#VEN_117C&DEV_002C&SUBSYS_002D117C&REV_00#4&f051ea2&0&0008#{4d36e97b-e325-11ce-bfc1-08002be10318}
The correct device path should be:
\?\PCI#VEN_117C&DEV_002C&SUBSYS_002D117C&REV_00#4&F051EA2&0&0008#{2accfe60-c130-11d2-b082-00a0c91efb8b}
The difference is the GUID. The GUID of {2accfe60-c130-11d2-b082-00a0c91efb8b} is of course GUID_DEVINTERFACE_STORAGEPORT. Now, I figured that out by searching the registry and going to the HKLM\SYSTEM\CurrentControlSet\DeviceClasses. Under the STORAGEPORT hive, there is the HBA card. That has a symbolic link entry, which CreateFile likes.
So far I have seen NO method either using WMI or SetupDi that gives me the correct path. I see no way to obtain {2accfe60-c130-11d2-b082-00a0c91efb8b} from the device info enumeration list.
Why is that important, when I do not want to talk to the HBA card? The answer is that knowing how to talk to one device allows me to talk to my device of interest. Sadly, okay VERY SADLY, there is no entry in HLM\SYSTEM\CurrentControlSet\DeviceClasses for the expander. Windows does enumerate the device: HKLM\SYSTEM\CurrentControlSet\Enum\SCSI, but there is nothing there that yields the magic interface GUID that I need. I already have the base part. That is easy. The hard part is the last GUID.
The expander uses Microsoft’s default driver. Microsoft lists the expander as a system device, although in the registry I see the device under SCSI.
After my rambling, the question is how can I get the device path, MS DOS Name, whatever, programmatically so that I can use that with a call to CreateFile(). I hesitate to say “device name”, “device path”, “MS DOS Name”. Many web documents, not to mention Microsoft documents, do indicate that the path returned by SetupDiGetInterfaceDetail, the so called device path, can be passed to CreateFile, but as my experiment shows, the claim is not true and at best only works for some devices. The SCSI HBA card is an example. My goal is to get a method that will allow me to talk to the expander box attached. I want to use SCSI Pass Through, passthrough, to talk to the expander.
Thanks in advance,
Sarah