to clarify, failure codes from filter drivers do not fail the start of the
stack because filters are deemed non essential to get the device up and
running.
d
"Don Burn" wrote in message
news:7AFF476955BE485F8CD5DC031F041B75@Destiny...
YOU DO NOT FAIL THE AddDevice. In AddDevice you attach you FDO with a
unique type and return success if it is a USB device, if it is not a usb
device you do not attach a FDO and return success.
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website:
http://www.windrvr.com
Blog:
http://msmvps.com/blogs/WinDrvr
> -----Original Message-----
> From: unclepauly [private.php?do=newpm&u=]
> Posted At: Tuesday, May 25, 2010 8:15 AM
> Posted To: microsoft.public.development.device.drivers
> Conversation: returning STATUS_FAILED from AddDevice...doesnt make a
> difference
> Subject: returning STATUS_FAILED from AddDevice...doesnt make a
> difference
>
> hello,
>
> you may or may not have read my other post about needing to
> enable/disable usb
> sticks. one suggestion was to write a filter for the DiskDrive class
> that
> detects usb sticks in the AddDevice function, and when it is usb, change
> the
> device type to something other than storage. can i just say at this
> point that
> disabling usbstor reg key does not always work, hence my need for a
> different
> approach.
>
> i have used the diskperf sample from the WDK, and modified the AddDevice
> function as follows:
>
> first i do IoGetDeviceProperty on DevicePropertyHardwareID, and if this
> is usb
> the return value will be "USBSTOR\xxxxxx", so i do a check on this. if
> it is
> usb, i do:
>
> PhysicalDeviceObject->DeviceType = 0;
> PhysicalDeviceObject->Characteristics = 0; Flags = 0;
>
> where PhysicalDeviceObject is the DEVICE_OBJECT passed to AddDevice.
> then i
> just return STATUS_NO_SUCH_DEVICE. i have tried other error codes too,
> and I
> have also tried calling IoCreateDevice, passing in null/wrong values for
> the
> device type and other arguments.
>
> i installed the filter by setting the UpperFilters reg key of the disk
> drive
> class to be diskperf/PartMgr.
>
> with this code, when i insert a usb stick, i can see my filter being hit
> in
> debugview. the usb stick is detected and AddDevice is forced to 'fail'.
> the
> problem is that it does not have any effect ! in windows explorer i can
> still
> see the device and i can still read/write to it. with my code removed,
> debugview shows many more functions being hit after AddDevice, such as
> SendToNextDriver, StartDevice, RegisterDevice, etc. With my code,
> nothing gets
> called after AddDevice, which is what i would expect, but like i say
> this
> doesnt actually make any difference to anything....
>
> can anyone offer an explaination ?
> any help appreciated.
>
>
> __________ Information from ESET Smart Security, version of virus
> signature
> database 5143 (20100525) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>