Retreiving disk number through IRP

Hi everyone,

I wrote a driver which works in a way that it redirects all the requests of one or more drives (in a hard disk) which I have selected for this purpose in a mentioned drive that is created in a the same hard disk, which means all the requests for the selected drives (by giving starting offset and length of that drives)in the same hard disk will be transferred to a particular drive. The problem is that the driver is not working when I attach more hard disks in the system and select drives of other hard disks for protection cz my driver differentiate all the protected drives through their starting offset and length and it can possible that one drive in the hard disk have same starting offset and length as the drive in the other hard disk. So I want to check first the disk number and then the other parameters of every IRP in order to protect a particular drive of any hard disk attached with the system. I used ‘IOCTL_STORAGE_GET_DEVICE_NUMBER’ which gives the disk number but I want to find find it through the IRP
???

You cannot just get it from an IRP. What you can do is use
IOCTL_STORAGE_GET_DEVICE_NUMBER to get it and store it in the device object
extension in your filter. Since each filtered device has a unique device
object you then have ready access to the data. If the driver is KMDF use a
device context for the value.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

wrote in message news:xxxxx@ntdev…
Hi everyone,

I wrote a driver which works in a way that it redirects all the requests of
one or more drives (in a hard disk) which I have selected for this purpose
in a mentioned drive that is created in a the same hard disk, which means
all the requests for the selected drives (by giving starting offset and
length of that drives)in the same hard disk will be transferred to a
particular drive. The problem is that the driver is not working when I
attach more hard disks in the system and select drives of other hard disks
for protection cz my driver differentiate all the protected drives through
their starting offset and length and it can possible that one drive in the
hard disk have same starting offset and length as the drive in the other
hard disk. So I want to check first the disk number and then the other
parameters of every IRP in order to protect a particular drive of any hard
disk attached with the system. I used ‘IOCTL_STORAGE_GET_DEVICE_NUMBER’
which gives the disk number but I want to find find it through the IRP
???

Information from ESET NOD32 Antivirus, version of virus signature
database 4870 (20100216)


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Information from ESET NOD32 Antivirus, version of virus signature database 4870 (20100216)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

>‘IOCTL_STORAGE_GET_DEVICE_NUMBER’

These numbers are not persistent across boots. I would use the MBR signature instead, or the mountdev ID of the volume (it contains the MBR signature for non-DynDisk volumes).


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