Is this XP or Vista? Prior to Vista you used to be able to do this for disks
that reported themselves as removable since the volume manager didn’t get in
the way of those. For disks that don’t report themselves as removable or on
Vista and later you’re going to have to work harder to map the volume to the
disk. The issue that you have is that in this case disks and storage volumes
exist in different branches of the device tree, so you need some way to
bridge the two starting at the volume.
I haven’t actually tried to do exactly this yet. If you can get away with it
in user mode then you might be better off or maybe there’s a new API that’s
been added to help with this and someone else can chime in. If not, a
starting point might be IoGetDeviceInterfaces and IOCTL_SCSI_GET_ADDRESS,
you’d be looking for the same address to come back from the disk path as you
would the volume. I’ve used this trick in the past from user mode to do
something similar. It’s a bit overkill, but a starting point to get the
creative juices flowing in case no one has a better idea…
Good luck,
-scott
–
Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com
“Dennis Scott” wrote in message
news:xxxxx@ntfsd…
Don,
this is returning “STORAGE\Volume”
the code follows
case FILE_DEVICE_DISK_FILE_SYSTEM:
if (NT_SUCCESS(FltGetDiskDeviceObject(FltObjects->Volume,
&DiskDeviceObject)))
{
DbgPrint(“FltGetDiskDeviceObject succeded\n”);
status =
IoGetDeviceProperty(DiskDeviceObject,DevicePropertyHardwareID,sizeof(name),
name, &junk);
if (NT_SUCCESS(status))
DbgPrint(“succeeded for ‘%ws’ device\n”, name);
else
DbgPrint(“IoGetDeviceProperty failed - %X\n”, status);
}
thanks
dennis scott
On Thu, Mar 18, 2010 at 6:19 PM, Don Burn wrote:
That should do it, you may get back more than one ID. You will have to
resolve that.
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
From: Dennis Scott [mailto:xxxxx@allaboutif.com]
Posted At: Thursday, March 18, 2010 8:34 AM
Posted To: ntfsd
Conversation: how to get USB busid from minifilter driver
Subject: Re: how to get USB busid from minifilter driver
Thanks Don,
should i use IoGetDeviceProperty with DeviceProperty as
DevicePropertyHardwareID?
is this the correct way to get busid.
On Thu, Mar 18, 2010 at 5:51 PM, Don Burn wrote:
In the InstanceSetupCallback use FltGetDiskDeviceObject to get the
device, then use that to get the bus-id and store it in the context for
the instance. You do not want to get it for every create, it will stay
the same for a volume.
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
From: Dennis Scott [mailto:xxxxx@allaboutif.com]
Posted At: Thursday, March 18, 2010 8:12 AM
Posted To: ntfsd
Conversation: how to get USB busid from minifilter driver
Subject: how to get USB busid from minifilter driver
Hi all,
How can i get the usb drive bus-id in an minifilter driver during
IRP_MJ_CREATE.
Thanks and Regards
dennis scott
Information from ESET Smart Security, version of virus
signature database 4954 (20100318)
The message was checked by ESET Smart Security.
http://www.eset.com
—
NTFSD is sponsored by OSR
For our schedule of debugging and file system seminars
(including our new fs mini-filter seminar) 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
Information from ESET Smart Security, version of virus
signature database 4954 (20100318)
The message was checked by ESET Smart Security.
http://www.eset.com
—
NTFSD is sponsored by OSR
For our schedule of debugging and file system seminars
(including our new fs mini-filter seminar) 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