Avoiding "Unsafe Removal" dialog box.

When I unplug my usb dvd-rom device windows 2000 shows the ‘Unsafe
Removal’ message. I need to surpress this message. I use some default
driver, and therefore cannot set the surpriseremovalok flag (I think). Is
there any way to stop a usb device, the same way windows does when you go
to the ‘unplug or eject hardware’ dialog and select a device and stop it?

Don’t know anyway programmatically to do this without setting that
SurpriseRemovalOk bit. Maybe a filter driver to set the bit?


Bill McKenzie
Compuware Corporation
http://www.compuware.com/products/driverstudio/

“Brian van der Beek” wrote in message
news:xxxxx@ntdev…
>
> When I unplug my usb dvd-rom device windows 2000 shows the ‘Unsafe
> Removal’ message. I need to surpress this message. I use some default
> driver, and therefore cannot set the surpriseremovalok flag (I think). Is
> there any way to stop a usb device, the same way windows does when you go
> to the ‘unplug or eject hardware’ dialog and select a device and stop it?
>
>

Thanx for yor reply. I still think it must be possible to do this. If
windows can stop a device, shouldn’t I be able to do the same? I quess my
question is: does windows send a command to the device or is it just
settings some internal state?

I believe it’s setting some internal state and it has nothing whatsoever to
do with the driver.


Bill McKenzie
Compuware Corporation
http://www.compuware.com/products/driverstudio/

“Brian van der Beek” wrote in message
news:xxxxx@ntdev…
>
> Thanx for yor reply. I still think it must be possible to do this. If
> windows can stop a device, shouldn’t I be able to do the same? I quess my
> question is: does windows send a command to the device or is it just
> settings some internal state?
>
>

It’s possible to disable the device if you know the GUID of the device
which you want to stop see setup examples(enable) in DDK source.

DEVCON is a better example.

----- Original Message -----
From: “AR”
To: “NT Developers Interest List”
Sent: Thursday, February 27, 2003 8:28 AM
Subject: [ntdev] Re: Avoiding “Unsafe Removal” dialog box.

> It’s possible to disable the device if you know the GUID of the
device
> which you want to stop see setup examples(enable) in DDK source.
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com
>

Thanx, I downloaded the devcon.exe and the disable commandline option
seems to do the job! Now I just have to get my hands one the sources.

The source to Devcon is in the XP and later DDKs. I misunderstood earlier
what you were asking. I didn’t realize that stopping the device before
removing prevents the unsafe removal dialog. Nice hack :slight_smile:


Bill McKenzie
Compuware Corporation
http://www.compuware.com/products/driverstudio/

“Brian van der Beek” wrote in message
news:xxxxx@ntdev…
>
> Thanx, I downloaded the devcon.exe and the disable commandline option
> seems to do the job! Now I just have to get my hands one the sources.
>
>

Sources are in the DDK samples.

----- Original Message -----
From: “Brian van der Beek”
To: “NT Developers Interest List”
Sent: Thursday, February 27, 2003 3:55 PM
Subject: [ntdev] Re: Avoiding “Unsafe Removal” dialog box.

> Thanx, I downloaded the devcon.exe and the disable commandline
option
> seems to do the job! Now I just have to get my hands one the
sources.
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com
>