Get Storport handle ???

Hi,

I’ve a storport driver for a controller which has removable devices. I wanted to get the handle for the storport to send IOCTL_SCSI_MINIPORT ioctl to my driver when no devices are connected. If the device is there from the drive letter, i’ll be able to get SCSI Port Number using IOCTL_SCSI_GET_ADDRESS. Then i’ll get handle to storport using \.\Scsi#.

Now without device there is no drive letter, i dont have any idea what is my port number, so i’m stuck in opening handle. I just know my PCI Vendor and Device Id of the controller. There is no IOCTL for storage which provides the detailed adapter information like vendor id and device id, so i cant query each port no for identifying my controller.

I’ve googled for this and i’m not able to get the exact information.

Expecting experts help.

One way is to use SetupApi to enumerate devices of the type using the GUID for SCSI and Raid controllers. Eventually you will wind up with a handle for your controller.

Gary G. Little

----- Original Message -----
From: xxxxx@gmail.com
To: “Windows System Software Devs Interest List”
Sent: Wednesday, February 23, 2011 4:58:28 AM
Subject: [ntdev] Get Storport handle ???

Hi,

I’ve a storport driver for a controller which has removable devices. I wanted to get the handle for the storport to send IOCTL_SCSI_MINIPORT ioctl to my driver when no devices are connected. If the device is there from the drive letter, i’ll be able to get SCSI Port Number using IOCTL_SCSI_GET_ADDRESS. Then i’ll get handle to storport using \.\Scsi#.

Now without device there is no drive letter, i dont have any idea what is my port number, so i’m stuck in opening handle. I just know my PCI Vendor and Device Id of the controller. There is no IOCTL for storage which provides the detailed adapter information like vendor id and device id, so i cant query each port no for identifying my controller.

I’ve googled for this and i’m not able to get the exact information.

Expecting experts help.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

You can create a fake processor-class LUN hanging off your device, with all requests for this LUN processed by the software driver itself.

Then send IOCTL_SCSI_PASS_THROUGH to this LUN.

This is how, I think, Promise and HighPoint work.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Hi,
>
> I’ve a storport driver for a controller which has removable devices. I wanted to get the handle for the storport to send IOCTL_SCSI_MINIPORT ioctl to my driver when no devices are connected. If the device is there from the drive letter, i’ll be able to get SCSI Port Number using IOCTL_SCSI_GET_ADDRESS. Then i’ll get handle to storport using \.\Scsi#.
>
> Now without device there is no drive letter, i dont have any idea what is my port number, so i’m stuck in opening handle. I just know my PCI Vendor and Device Id of the controller. There is no IOCTL for storage which provides the detailed adapter information like vendor id and device id, so i cant query each port no for identifying my controller.
>
> I’ve googled for this and i’m not able to get the exact information.
>
> Expecting experts help.
>

Hi,

Thanks for the comments. I’ve used GUID_DEVINTERFACE_STORAGEPORT with SetUpDi API’s and able retrieve the device path. And with SetupDiGetDeviceRegistryProperty, i get the hardware id which identifies my controller. With these information, i’m able to locate my controller and able open the handle to Storport driver and able to send IOCTL’s.

Out of curiosity, if i have two same controllers and two storport drivers are getting loaded. In this case, how can my application distinguish both the controller and identify them.

Generally there is no fool proof way to identify individual
controllers that are identical hardware other than ‘blink the led on
the device of interest’. If the controller has a unique firmware id
then you can use that. For storage controllers it is usually what is
attached to the controller rather than the controller itself that is
of interest.

Mark Roddy

On Fri, Feb 25, 2011 at 4:42 AM, wrote:
> Hi,
>
> Thanks for the comments. I’ve used GUID_DEVINTERFACE_STORAGEPORT with SetUpDi API’s and able retrieve the device path. And with SetupDiGetDeviceRegistryProperty, i get the hardware id which identifies my controller. With these information, i’m able to locate my controller and able open the handle to Storport driver and able to send IOCTL’s.
>
> Out of curiosity, if i have two same controllers and two storport drivers are getting loaded. In this case, how can my application distinguish both the controller and identify them.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>