Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to stop the Unsafe Removal dialog being displayed ?

0 views
Skip to first unread message

dom

unread,
Nov 20, 2001, 4:47:53 PM11/20/01
to

Hi

1) I have a USB device.
2) I plug it in and PnP loads my FWLoader driver.
3) The FWLoader driver proceeds to send a firmware binary file to my device.
4) The device stores the firmware off and performs a USB disconnect. It
then uses the
new firmware to appear as a different device (different PID) on the USB bus.
That all works fine.

BUT...
When Windows 2000 see the USB disconnect it pops up the "Unsafe Removal of
Device" dialog as if I had manually disconnected the device from the bus.

So basically whenever I plug the device in Windows shows me the "Unsafe
Removal" dialog, which isn't going to make much sense to my users.

Does anyone know of a way to tell Windows not to pop up this dialog for the
removal of this particular device.
I'm thinking that perhaps there is a registry setting I could set in my
FWLoader INF to tell windows I don't want this removal warning.

Any ideas welcome.
thanks
dom

Brian Catlin

unread,
Nov 20, 2001, 5:00:42 PM11/20/01
to
"dom" <dcu...@ti.com> wrote in message news:9tej5h$5dp$1...@tilde.csc.ti.com...

>
> Hi
>
> 1) I have a USB device.
> 2) I plug it in and PnP loads my FWLoader driver.
> 3) The FWLoader driver proceeds to send a firmware binary file to my device.
> 4) The device stores the firmware off and performs a USB disconnect. It
> then uses the
> new firmware to appear as a different device (different PID) on the USB bus.
> That all works fine.
>
> BUT...
> When Windows 2000 see the USB disconnect it pops up the "Unsafe Removal of
> Device" dialog as if I had manually disconnected the device from the bus.

As far as the hub is concerned, there is no difference between a
"physical/manual" disconnect and an electrical disconnect.

> So basically whenever I plug the device in Windows shows me the "Unsafe
> Removal" dialog, which isn't going to make much sense to my users.
>
> Does anyone know of a way to tell Windows not to pop up this dialog for the
> removal of this particular device.
> I'm thinking that perhaps there is a registry setting I could set in my
> FWLoader INF to tell windows I don't want this removal warning.

To prevent this "bitch box" for showing up, set the SurpriseRemovalOK flag in
the DEVICE_CAPABILITIES structure (pointed to by the PNP QUERY_CAPABILITIES
IRP), on the IRP's way *up* the DevNode. The normal paradigm of adding
capabilities on the IRP's way down, and removing/modifying capabilities on the
IRP's way up the DevNode won't work in this case, because of a bug in the USB
driver. Thankfully, this particular "bitch box" doesn't show up in XP - it was
universally despised (except by the developer), and was removed

-Brian

--
Brian Catlin, Sannas Consulting 310-798-8930
Windows NT/2000 Internals, WDM Device Driver Training & Consulting
See WWW.AZIUS.COM for courses and scheduling


Mark Roddy

unread,
Nov 20, 2001, 5:10:00 PM11/20/01
to
If you searched msdn and the microsoft knowledge base you would find:

HOWTO: Avoid Unsafe Removal Dialog Box

Q298504

You have to set
IRP_MN_QUERY_CAPABILITIES/Parameters.DeviceCapabilities.Capabilities->SurpriseRemovalOK
to TRUE, and if you are on a usb bus you have to do this on the
completion side as there is a bug in the usb hub driver that will
squish your settings on the dispatch side.

=
Mark Roddy
WindowsNT Windows2000 Consultant
Hollis Technology Solutions
http://www.hollistech.com
ma...@hollistech.com
603-321 1032

0 new messages