QUERY_DEVICE_RELATIONS

I changed the deviceRelation->Count to 0, and dereferenced all the device objects in my disk class upper filter driver on the way up to partmgr of QUERY_DEVICE_RELATIONS. This made my disk device hidden in disk management but in device tree I see the partmgr still creates a FDO/FiDO attached on top of my filter driver. Is this correct? I was expecting that since partmgr will see Count=0, it will not create any FDO for my disk device and my disk upper Filter driver will be the topmost driver for my device (above class driver) but this didn’t happen. Please help.

Thanks.

Partmgr attaches to the physical disk FDO - so a typical stack looks like
this:3: kd> !devstack 0x850a6678
!DevObj !DrvObj !DevExt ObjectName
8574f218 \Driver\partmgr 8574f2d0
8574f5d0 \Driver\disk 8574f688 DR0

850a6678 \Driver\atapi 850a6730 IdeDeviceP1T0L0-1

Mark Roddy

On Thu, Feb 12, 2009 at 5:30 AM, wrote:

> I changed the deviceRelation->Count to 0, and dereferenced all the device
> objects in my disk class upper filter driver on the way up to partmgr of
> QUERY_DEVICE_RELATIONS. This made my disk device hidden in disk management
> but in device tree I see the partmgr still creates a FDO/FiDO attached on
> top of my filter driver. Is this correct? I was expecting that since partmgr
> will see Count=0, it will not create any FDO for my disk device and my disk
> upper Filter driver will be the topmost driver for my device (above class
> driver) but this didn’t happen. Please help.
>
> 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
>

By the way, mucking with reported device objects directly in a QDR request
is not a great way to hide devices from a filter driver. Consider changing
the PnP enumeration name instead.
Mark Roddy

On Thu, Feb 12, 2009 at 7:27 AM, Mark Roddy wrote:

> Partmgr attaches to the physical disk FDO - so a typical stack looks like
> this:3: kd> !devstack 0x850a6678
> !DevObj !DrvObj !DevExt ObjectName
> 8574f218 \Driver\partmgr 8574f2d0
> 8574f5d0 \Driver\disk 8574f688 DR0
> > 850a6678 \Driver\atapi 850a6730 IdeDeviceP1T0L0-1
>
>
>
> Mark Roddy
>
>
>
> On Thu, Feb 12, 2009 at 5:30 AM, wrote:
>
>> I changed the deviceRelation->Count to 0, and dereferenced all the device
>> objects in my disk class upper filter driver on the way up to partmgr of
>> QUERY_DEVICE_RELATIONS. This made my disk device hidden in disk management
>> but in device tree I see the partmgr still creates a FDO/FiDO attached on
>> top of my filter driver. Is this correct? I was expecting that since partmgr
>> will see Count=0, it will not create any FDO for my disk device and my disk
>> upper Filter driver will be the topmost driver for my device (above class
>> driver) but this didn’t happen. Please help.
>>
>> 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
>>
>
>

> Consider changing the PnP enumeration name instead.

How did you do that? Very interested in that.

Thanks
Wayne

IRP_MN_QUERY_ID
Mark Roddy

On Thu, Feb 12, 2009 at 10:14 AM, Wayne Gong wrote:

> Consider changing the PnP enumeration name instead.
>>
>
> How did you do that? Very interested in that.
>
> Thanks
> Wayne
>
>
> —
> 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
>

Thanks Mark. I’m not just trying to hide the devices. I’m trying to limit the device stack of a my disk device to just upto my disk upper filter driver.

Well without either changing the enumeration name or using some error
insertion mechanism to keep the unwanted out I don’t see how that is going
to work.
Mark Roddy

On Thu, Feb 12, 2009 at 12:44 PM, wrote:

> Thanks Mark. I’m not just trying to hide the devices. I’m trying to limit
> the device stack of a my disk device to just upto my disk upper filter
> driver.
>
> —
> 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
>

It is possible to do either of these in the disk upper filter driver? Any hint. Thanks.

I tried to intercept IRP_MN_QUERY_ID in disk upper filter driver but looks like it is either sent through some different path or before my filter driver gets loaded. :frowning:

I looked at the archives/msdn and found that IOCTL_DISK_UPDATE_PROPERTIES invalidates the cached partition table and re-enumerates the device. Does that mean re-enumeration of the partitions?

Thinking that it may re-enumerate partitions, from my disk upper filter driver I sent this IOCTL (in DispatchPnp on the way up of IRP_MN_START_DEVICE) to the disk class driver but IoCallDriver returned STATUS_NOT_IMPLEMENTED :frowning:

What I’m doing wrong here?

My idea is to force this re-enumeration and may be then I can intercept the IRP_MN_QUERY_ID in my filter driver and on the way up I can remove the “GenDisk” from DeviceId/HardwareId/CompatibleID as I think “GenDisk” is the matching id which causes partmgr to get attached on top of my filter driver object.

Please provide your suggestion. May be I’m totally off the track.
Thanks.