How to diffrentiate external and internal storage device

Hi,

I am writing a volume upper filter where separate logic has to be put for
internal hard disk volumes and removable device volumes.

I have tried two ways

  1. IoGetDeviceProperty
    I call this function in AddDevice of the driver to retrieve
    DevicePropertyBusTypeGuid, but I always get error
    STATUS_OBJECT_NAME_NOT_FOUND. The device object passed to the function is
    the physical device object received in AddDevice

  2. IOCTL_STORAGE_QUERY_PROPERTY

I send this device IO control request in driver’s start device
completion routine.The device object used to send IOCTL is the one returned
by IoAttachDeviceToDeviceStack while attaching the volume device to stack.
In this case I am getting error STATUS_NO_SUCH_DEVICE

I don’t understand where I am going wrong. Can you please help me to find
correct way?

Thanks

Hi,

for a removable device you can always check DevObj->Characteristics &
FILE_REMOVABLE_MEDIA in your AddDeviceRoutine.
If your definition of “external” storage device includes hot pluggable hard
disks (like USB disks), you can help
yourself with IOCTL_STORAGE_GET_HOTPLUG_INFO (starting with XP).
IOCTL_STORAGE_QUERY_PROPERTY is another option to find out about the bus
type.
(I’m sending this to the physical DiskObject, not sure about the
VolumeObject.)

Regards
Else

|---------±-------------------------------->
| | devesh mittal |
| | | | om> |
| | Sent by: |
| | bounce-351328-16691@li|
| | sts.osr.com |
| | |
| | |
| | 19.01.2009 10:54 |
| | Please respond to |
| | “Windows System |
| | Software Devs Interest|
| | List” |
|---------±-------------------------------->
>-------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| To: “Windows System Software Devs Interest List” |
| cc: |
| Subject: [ntdev] How to diffrentiate external and internal storage device |
>-------------------------------------------------------------------------------------------------------------------------------------------------|

Hi,

I am writing a volume upper filter where separate logic has to be put for
internal hard disk volumes and removable device volumes.

I have tried two ways
1. IoGetDeviceProperty
I call this function in AddDevice of the driver to retrieve
DevicePropertyBusTypeGuid, but I always get error
STATUS_OBJECT_NAME_NOT_FOUND. The device object passed to the function is
the physical device object received in AddDevice

2. IOCTL_STORAGE_QUERY_PROPERTY

I send this device IO control request in driver’s start device
completion routine.The device object used to send IOCTL is the one returned
by IoAttachDeviceToDeviceStack while attaching the volume device to stack.
In this case I am getting error STATUS_NO_SUCH_DEVICE

I don’t understand where I am going wrong. Can you please help me to find
correct way?

Thanks
— 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

Hi
Else thanks for your reply. Its not working in my case may be because I am using VolumeObject. Is there any way to get physical DiskObject using Volume object?

Thanks

> Else thanks for your reply. Its not working in my case may be because I am using VolumeObject. Is

there any way to get physical DiskObject using Volume object?

What is the need in this? IOCTL_STORAGE_xxx calls are passed down to the physical disk object anyway.


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

The problem is I am always getting STATUS_NO_SUCH_DEVICE when I am passing IOCTL_STORAGE_xxx to volume object. I am not sure why this error is happening. The reason may be volume object doesn’t support the IRP and returing the error without passing it lower device objects.