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.