DriverVerify VS IoGetDeviceProperty

I want attach only USB storage device.
I add this code in sfilter driver from IFS kit 2003 into
SfAttachToMountedDevice
/* begin code */
// Check USB Storage

#define USB_ENUMERATOR_NAME L"USBSTOR"

ULONG SizeEnumeratorName = 512L;
EnumeratorName = ExAllocatePool( NonPagedPool, SizeEnumeratorName );
if( NULL == EnumeratorName ) {
return STATUS_INSUFFICIENT_RESOURCES;
}

status = IoGetDeviceProperty(newDevExt->StorageStackDeviceObject,
DevicePropertyEnumeratorName,
SizeEnumeratorName,
EnumeratorName,
&SizeEnumeratorName);

if ( RtlCompareMemory(EnumeratorName,
USB_ENUMERATOR_NAME,
sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR)) == (
sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR) ) ) {
USBStorage = TRUE;
}
ExFreePool( EnumeratorName );

/* end code */

It work good on checked version and give me bug check 0x4c with DriverVerify
and say that function IoGetDeviceProperty will work only with PDO driver
object, but I known that newDevExt->StorageStackDeviceObject is a real
device object, what is my problem ?

Thank for concern.

You are using an FDO, not a PDO. Try using IoGetDeviceAttachmentBaseRef
to obtain the PDO for a stack of device objects. That should return to
you the PDO of the device. It *works* because the device object of the
FDO is inheriting the specific attribute from the PDO, but if verifier
says you have to use the PDO, use the PDO…

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of unintruder
Sent: Wednesday, July 07, 2004 6:41 AM
To: ntfsd redirect
Subject: [ntfsd] DriverVerify VS IoGetDeviceProperty

I want attach only USB storage device.
I add this code in sfilter driver from IFS kit 2003 into
SfAttachToMountedDevice
/* begin code */
// Check USB Storage

#define USB_ENUMERATOR_NAME L"USBSTOR"

ULONG SizeEnumeratorName = 512L;
EnumeratorName = ExAllocatePool( NonPagedPool, SizeEnumeratorName );
if( NULL == EnumeratorName ) {
return STATUS_INSUFFICIENT_RESOURCES;
}

status = IoGetDeviceProperty(newDevExt->StorageStackDeviceObject,
DevicePropertyEnumeratorName,
SizeEnumeratorName,
EnumeratorName,
&SizeEnumeratorName);

if ( RtlCompareMemory(EnumeratorName,
USB_ENUMERATOR_NAME,
sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR)) == (
sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR) ) ) {
USBStorage = TRUE;
}
ExFreePool( EnumeratorName );

/* end code */

It work good on checked version and give me bug check 0x4c with
DriverVerify and say that function IoGetDeviceProperty will work only
with PDO driver object, but I known that
newDevExt->StorageStackDeviceObject is a real device object, what is my
problem ?

Thank for concern.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
send a blank email to xxxxx@lists.osr.com

OK,
1)
I make over

PDEVICE_OBJECT newPDO =
IoGetDeviceAttachmentBaseRef(newDevExt->StorageStackDeviceObject);

status = IoGetDeviceProperty(newPDO,
DevicePropertyEnumeratorName,
SizeEnumeratorName,
EnumeratorName,
&SizeEnumeratorName);

and name contain “STORAGE”, I expect “USBSTOR”.
How can I determine that a newDevice is a USB storage stack ? First version
with FDO *work* , but driver verify think else :slight_smile:

  • IoGetDeviceAttachmentBaseRef allow get PDO, but only XP and later
  • I/O Manager supplies PDO to AddDevice, but it only PNP driver
    How can I get PDO on w2k, if my driver isn’t pnp (particularly sfilter
    sample)

thank

////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////

“Tony Mason” ???/??? ? ??? ???:
news:xxxxx@ntfsd…
You are using an FDO, not a PDO. Try using IoGetDeviceAttachmentBaseRef
to obtain the PDO for a stack of device objects. That should return to
you the PDO of the device. It works because the device object of the
FDO is inheriting the specific attribute from the PDO, but if verifier
says you have to use the PDO, use the PDO…

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of unintruder
Sent: Wednesday, July 07, 2004 6:41 AM
To: ntfsd redirect
Subject: [ntfsd] DriverVerify VS IoGetDeviceProperty

I want attach only USB storage device.
I add this code in sfilter driver from IFS kit 2003 into
SfAttachToMountedDevice
/* begin code /
// Check USB Storage

#define USB_ENUMERATOR_NAME L"USBSTOR"

ULONG SizeEnumeratorName = 512L;
EnumeratorName = ExAllocatePool( NonPagedPool, SizeEnumeratorName );
if( NULL == EnumeratorName ) {
return STATUS_INSUFFICIENT_RESOURCES;
}

status = IoGetDeviceProperty(newDevExt->StorageStackDeviceObject,
DevicePropertyEnumeratorName,
SizeEnumeratorName,
EnumeratorName,
&SizeEnumeratorName);

if ( RtlCompareMemory(EnumeratorName,
USB_ENUMERATOR_NAME,
sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR)) == (
sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR) ) ) {
USBStorage = TRUE;
}
ExFreePool( EnumeratorName );

/
end code */

It work good on checked version and give me bug check 0x4c with
DriverVerify and say that function IoGetDeviceProperty will work only
with PDO driver object, but I known that
newDevExt->StorageStackDeviceObject is a real device object, what is my
problem ?

Thank for concern.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
send a blank email to xxxxx@lists.osr.com

Any idea ?

“unintruder” ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:xxxxx@ntfsd…
> OK,
> 1)
> I make over
>
> PDEVICE_OBJECT newPDO =
> IoGetDeviceAttachmentBaseRef(newDevExt->StorageStackDeviceObject);
>
> status = IoGetDeviceProperty(newPDO,
> DevicePropertyEnumeratorName,
> SizeEnumeratorName,
> EnumeratorName,
> &SizeEnumeratorName);
>
> and name contain “STORAGE”, I expect “USBSTOR”.
> How can I determine that a newDevice is a USB storage stack ? First
version
> with FDO work , but driver verify think else :slight_smile:
>
> 2)
> - IoGetDeviceAttachmentBaseRef allow get PDO, but only XP and later
> - I/O Manager supplies PDO to AddDevice, but it only PNP driver
> How can I get PDO on w2k, if my driver isn’t pnp (particularly sfilter
> sample)
>
> thank
>
>
////////////////////////////////////////////////////////////////////////////
>
////////////////////////////////////////////////////////////////////////////
> ////////////////////////////
>
> “Tony Mason” ???/??? ? ??? ???:
> news:xxxxx@ntfsd…
> You are using an FDO, not a PDO. Try using IoGetDeviceAttachmentBaseRef
> to obtain the PDO for a stack of device objects. That should return to
> you the PDO of the device. It works because the device object of the
> FDO is inheriting the specific attribute from the PDO, but if verifier
> says you have to use the PDO, use the PDO…
>
> Regards,
>
> Tony
>
> Tony Mason
> Consulting Partner
> OSR Open Systems Resources, Inc.
> http://www.osr.com
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of unintruder
> Sent: Wednesday, July 07, 2004 6:41 AM
> To: ntfsd redirect
> Subject: [ntfsd] DriverVerify VS IoGetDeviceProperty
>
> I want attach only USB storage device.
> I add this code in sfilter driver from IFS kit 2003 into
> SfAttachToMountedDevice
> /* begin code /
> // Check USB Storage
>
> #define USB_ENUMERATOR_NAME L"USBSTOR"
>
> ULONG SizeEnumeratorName = 512L;
> EnumeratorName = ExAllocatePool( NonPagedPool, SizeEnumeratorName );
> if( NULL == EnumeratorName ) {
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> status = IoGetDeviceProperty(newDevExt->StorageStackDeviceObject,
> DevicePropertyEnumeratorName,
> SizeEnumeratorName,
> EnumeratorName,
> &SizeEnumeratorName);
>
> if ( RtlCompareMemory(EnumeratorName,
> USB_ENUMERATOR_NAME,
> sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR)) == (
> sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR) ) ) {
> USBStorage = TRUE;
> }
> ExFreePool( EnumeratorName );
>
> /
end code */
>
> It work good on checked version and give me bug check 0x4c with
> DriverVerify and say that function IoGetDeviceProperty will work only
> with PDO driver object, but I known that
> newDevExt->StorageStackDeviceObject is a real device object, what is my
> problem ?
>
> Thank for concern.
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
> send a blank email to xxxxx@lists.osr.com
>
>
>
>
>

IIRC, ‘STORAGE’ is the Bus Driver for a Volume device, ‘USBSTOR’ is the
Bus Driver for a USB Mass Storage device (the disk itself). You might
be attaching to the wrong device. DeviceTree from OSR Online
(http://www.osronline.com/article.cfm?article=97) will help you see how
all the driver stacks are built.

  • Cliff

On 11-Jul-04, at 3:02 AM, unintruder wrote:

Any idea ?

“unintruder” ???/??? ? ???
> ???:
> news:xxxxx@ntfsd…
>> OK,
>> 1)
>> I make over
>>
>> PDEVICE_OBJECT newPDO =
>> IoGetDeviceAttachmentBaseRef(newDevExt->StorageStackDeviceObject);
>>
>> status = IoGetDeviceProperty(newPDO,
>> DevicePropertyEnumeratorName,
>> SizeEnumeratorName,
>> EnumeratorName,
>> &SizeEnumeratorName);
>>
>> and name contain “STORAGE”, I expect “USBSTOR”.
>> How can I determine that a newDevice is a USB storage stack ? First
> version
>> with FDO work , but driver verify think else :slight_smile:
>>
>> 2)
>> - IoGetDeviceAttachmentBaseRef allow get PDO, but only XP and later
>> - I/O Manager supplies PDO to AddDevice, but it only PNP driver
>> How can I get PDO on w2k, if my driver isn’t pnp (particularly sfilter
>> sample)
>>
>> thank
>>
>>
> //////////////////////////////////////////////////////////////////////
> //////
>>
> //////////////////////////////////////////////////////////////////////
> //////
>> ////////////////////////////
>>
>> “Tony Mason” ???/??? ? ??? ???:
>> news:xxxxx@ntfsd…
>> You are using an FDO, not a PDO. Try using
>> IoGetDeviceAttachmentBaseRef
>> to obtain the PDO for a stack of device objects. That should return to
>> you the PDO of the device. It works because the device object of
>> the
>> FDO is inheriting the specific attribute from the PDO, but if verifier
>> says you have to use the PDO, use the PDO…
>>
>> Regards,
>>
>> Tony
>>
>> Tony Mason
>> Consulting Partner
>> OSR Open Systems Resources, Inc.
>> http://www.osr.com
>>
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of unintruder
>> Sent: Wednesday, July 07, 2004 6:41 AM
>> To: ntfsd redirect
>> Subject: [ntfsd] DriverVerify VS IoGetDeviceProperty
>>
>> I want attach only USB storage device.
>> I add this code in sfilter driver from IFS kit 2003 into
>> SfAttachToMountedDevice
>> /* begin code /
>> // Check USB Storage
>>
>> #define USB_ENUMERATOR_NAME L"USBSTOR"
>>
>> ULONG SizeEnumeratorName = 512L;
>> EnumeratorName = ExAllocatePool( NonPagedPool, SizeEnumeratorName );
>> if( NULL == EnumeratorName ) {
>> return STATUS_INSUFFICIENT_RESOURCES;
>> }
>>
>> status = IoGetDeviceProperty(newDevExt->StorageStackDeviceObject,
>> DevicePropertyEnumeratorName,
>> SizeEnumeratorName,
>> EnumeratorName,
>> &SizeEnumeratorName);
>>
>> if ( RtlCompareMemory(EnumeratorName,
>> USB_ENUMERATOR_NAME,
>> sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR)) == (
>> sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR) ) ) {
>> USBStorage = TRUE;
>> }
>> ExFreePool( EnumeratorName );
>>
>> /
end code */
>>
>> It work good on checked version and give me bug check 0x4c with
>> DriverVerify and say that function IoGetDeviceProperty will work only
>> with PDO driver object, but I known that
>> newDevExt->StorageStackDeviceObject is a real device object, what is
>> my
>> problem ?
>>
>> Thank for concern.
>>
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
>> send a blank email to xxxxx@lists.osr.com
>>
>>
>>
>>
>>
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@telus.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>

No, if I use IoGetDeviceProperty with FDO, i get USBSTOR (it’s not ok for
Driver Verify), if I use IoGetDeviceProperty with PDO of this FDO I get
STORAGE.

“Cliff Russell” ???/??? ? ???
???: news:xxxxx@ntfsd…
IIRC, ‘STORAGE’ is the Bus Driver for a Volume device, ‘USBSTOR’ is the
Bus Driver for a USB Mass Storage device (the disk itself). You might
be attaching to the wrong device. DeviceTree from OSR Online
(http://www.osronline.com/article.cfm?article=97) will help you see how
all the driver stacks are built.

- Cliff

On 11-Jul-04, at 3:02 AM, unintruder wrote:

> Any idea ?
>
> “unintruder” ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
> ÓÌÅÄÕÀÝÅÅ:
> news:xxxxx@ntfsd…
>> OK,
>> 1)
>> I make over
>>
>> PDEVICE_OBJECT newPDO =
>> IoGetDeviceAttachmentBaseRef(newDevExt->StorageStackDeviceObject);
>>
>> status = IoGetDeviceProperty(newPDO,
>> DevicePropertyEnumeratorName,
>> SizeEnumeratorName,
>> EnumeratorName,
>> &SizeEnumeratorName);
>>
>> and name contain “STORAGE”, I expect “USBSTOR”.
>> How can I determine that a newDevice is a USB storage stack ? First
> version
>> with FDO work , but driver verify think else :slight_smile:
>>
>> 2)
>> - IoGetDeviceAttachmentBaseRef allow get PDO, but only XP and later
>> - I/O Manager supplies PDO to AddDevice, but it only PNP driver
>> How can I get PDO on w2k, if my driver isn’t pnp (particularly sfilter
>> sample)
>>
>> thank
>>
>>
> //////////////////////////////////////////////////////////////////////
> //////
>>
> //////////////////////////////////////////////////////////////////////
> //////
>> ////////////////////////////
>>
>> “Tony Mason” ???/??? ? ??? ???:
>> news:xxxxx@ntfsd…
>> You are using an FDO, not a PDO. Try using
>> IoGetDeviceAttachmentBaseRef
>> to obtain the PDO for a stack of device objects. That should return to
>> you the PDO of the device. It works because the device object of
>> the
>> FDO is inheriting the specific attribute from the PDO, but if verifier
>> says you have to use the PDO, use the PDO…
>>
>> Regards,
>>
>> Tony
>>
>> Tony Mason
>> Consulting Partner
>> OSR Open Systems Resources, Inc.
>> http://www.osr.com
>>
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of unintruder
>> Sent: Wednesday, July 07, 2004 6:41 AM
>> To: ntfsd redirect
>> Subject: [ntfsd] DriverVerify VS IoGetDeviceProperty
>>
>> I want attach only USB storage device.
>> I add this code in sfilter driver from IFS kit 2003 into
>> SfAttachToMountedDevice
>> /* begin code /
>> // Check USB Storage
>>
>> #define USB_ENUMERATOR_NAME L"USBSTOR"
>>
>> ULONG SizeEnumeratorName = 512L;
>> EnumeratorName = ExAllocatePool( NonPagedPool, SizeEnumeratorName );
>> if( NULL == EnumeratorName ) {
>> return STATUS_INSUFFICIENT_RESOURCES;
>> }
>>
>> status = IoGetDeviceProperty(newDevExt->StorageStackDeviceObject,
>> DevicePropertyEnumeratorName,
>> SizeEnumeratorName,
>> EnumeratorName,
>> &SizeEnumeratorName);
>>
>> if ( RtlCompareMemory(EnumeratorName,
>> USB_ENUMERATOR_NAME,
>> sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR)) == (
>> sizeof(USB_ENUMERATOR_NAME) - sizeof(WCHAR) ) ) {
>> USBStorage = TRUE;
>> }
>> ExFreePool( EnumeratorName );
>>
>> /
end code */
>>
>> It work good on checked version and give me bug check 0x4c with
>> DriverVerify and say that function IoGetDeviceProperty will work only
>> with PDO driver object, but I known that
>> newDevExt->StorageStackDeviceObject is a real device object, what is
>> my
>> problem ?
>>
>> Thank for concern.
>>
>>
>>
>> —
>> Questions? First check the IFS FAQ at
>> https://www.osronline.com/article.cfm?id=17
>>
>> You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
>> send a blank email to xxxxx@lists.osr.com
>>
>>
>>
>>
>>
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as: xxxxx@telus.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>