How to prevent a USB device from being listed in Safely Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure. Only the
devices with SurpriseRemovalOk = FALSE are listed in “Safely Remove Hardware
dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely Remove
Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Note that this doesn’t prevent physical removal nor query removal (let’s
say disable in device manager). This just prevents the UI (which is
essentially a shortcut to the device manager functionality) from
appearing. Furthermore, you need a filter driver to be able to clear
this field, something which I don’t think the OP was intending on
writing.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure.
Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Am I wrong that failing IRP_MN_QUERY_REMOVE_DEVICE will prevent Disable in
the Device Manager? or Device Manager will ask for reboot, and the next boot
will be with this device disabled?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, August 04, 2006 1:25 AM
Subject: RE: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Note that this doesn’t prevent physical removal nor query removal (let’s
say disable in device manager). This just prevents the UI (which is
essentially a shortcut to the device manager functionality) from
appearing. Furthermore, you need a filter driver to be able to clear
this field, something which I don’t think the OP was intending on
writing.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure.
Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Failing q.r. will prevent disable. It’s late here and I can’t remember
if failing q.r. makes the device disabled on reboot w/a prompt for
reboot, but I think that is what happens.

Again, my point here is that you need a driver to do this. I think the
OP wants to affect stacks which he didn’t write the driver for.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 10:55 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Am I wrong that failing IRP_MN_QUERY_REMOVE_DEVICE will prevent
Disable in
the Device Manager? or Device Manager will ask for reboot, and the next
boot
will be with this device disabled?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, August 04, 2006 1:25 AM
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely
Remove Hardware dialog?

Note that this doesn’t prevent physical removal nor query removal (let’s
say disable in device manager). This just prevents the UI (which is
essentially a shortcut to the device manager functionality) from
appearing. Furthermore, you need a filter driver to be able to clear
this field, something which I don’t think the OP was intending on
writing.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure.
Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks Maxim and Doron:

I do write the driver for the USB device, therefore, it’s not a problem
to make changes in the drive.

I probably don’t want to disable IRP_MN_QUERY_REMOVE_DEVICE because that
will make my driver update painful.

If the customer goes to device manager and remove the device, that’s his
fault. In the other hand, if he knows how to do that, he should be able
to get it back.

I just don’t want my USB devices to be shown in Safely Remove Hardware
dialog. I did set SurpriseRemovalOk = TRUE in my driver, but my
technician said she still see the device in Safely Remove Hardware
dialog sometimes. Is there any document about how to unregister a device
from Safely Remove Hardware dialog?

I understand Safely Remove Hardware dialog is a good thing, but it would
be nice to give more control to the user. Currently, what we can do is
to hide or show the dialog.

Zs

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, August 03, 2006 11:02 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Failing q.r. will prevent disable. It’s late here and I can’t remember
if failing q.r. makes the device disabled on reboot w/a prompt for
reboot, but I think that is what happens.

Again, my point here is that you need a driver to do this. I think the
OP wants to affect stacks which he didn’t write the driver for.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 10:55 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Am I wrong that failing IRP_MN_QUERY_REMOVE_DEVICE will prevent
Disable in
the Device Manager? or Device Manager will ask for reboot, and the next
boot
will be with this device disabled?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, August 04, 2006 1:25 AM
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely
Remove Hardware dialog?

Note that this doesn’t prevent physical removal nor query removal (let’s
say disable in device manager). This just prevents the UI (which is
essentially a shortcut to the device manager functionality) from
appearing. Furthermore, you need a filter driver to be able to clear
this field, something which I don’t think the OP was intending on
writing.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure.
Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

You will show up in the “Safely Remove Hardware” dialog if you say that
you support SurpriseRemovalOK.

You need to be setting this to FALSE.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@exgate.tek.com
Sent: Friday, August 04, 2006 9:30 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Thanks Maxim and Doron:

I do write the driver for the USB device, therefore, it’s not a problem
to make changes in the drive.

I probably don’t want to disable IRP_MN_QUERY_REMOVE_DEVICE because that
will make my driver update painful.

If the customer goes to device manager and remove the device, that’s his
fault. In the other hand, if he knows how to do that, he should be able
to get it back.

I just don’t want my USB devices to be shown in Safely Remove Hardware
dialog. I did set SurpriseRemovalOk = TRUE in my driver, but my
technician said she still see the device in Safely Remove Hardware
dialog sometimes. Is there any document about how to unregister a device
from Safely Remove Hardware dialog?

I understand Safely Remove Hardware dialog is a good thing, but it would
be nice to give more control to the user. Currently, what we can do is
to hide or show the dialog.

Zs

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, August 03, 2006 11:02 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Failing q.r. will prevent disable. It’s late here and I can’t remember
if failing q.r. makes the device disabled on reboot w/a prompt for
reboot, but I think that is what happens.

Again, my point here is that you need a driver to do this. I think the
OP wants to affect stacks which he didn’t write the driver for.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 10:55 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Am I wrong that failing IRP_MN_QUERY_REMOVE_DEVICE will prevent
Disable in the Device Manager? or Device Manager will ask for reboot,
and the next boot will be with this device disabled?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, August 04, 2006 1:25 AM
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Note that this doesn’t prevent physical removal nor query removal (let’s
say disable in device manager). This just prevents the UI (which is
essentially a shortcut to the device manager functionality) from
appearing. Furthermore, you need a filter driver to be able to clear
this field, something which I don’t think the OP was intending on
writing.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure.
Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

So, which one of you are correct?

Maxim:

Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Peter:

You will show up in the “Safely Remove Hardware” dialog if you say that
you support SurpriseRemovalOK.

You need to be setting this to FALSE.

Thanks,

zhongsheng

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Friday, August 04, 2006 9:47 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

You will show up in the “Safely Remove Hardware” dialog if you say that
you support SurpriseRemovalOK.

You need to be setting this to FALSE.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@exgate.tek.com
Sent: Friday, August 04, 2006 9:30 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Thanks Maxim and Doron:

I do write the driver for the USB device, therefore, it’s not a problem
to make changes in the drive.

I probably don’t want to disable IRP_MN_QUERY_REMOVE_DEVICE because that
will make my driver update painful.

If the customer goes to device manager and remove the device, that’s his
fault. In the other hand, if he knows how to do that, he should be able
to get it back.

I just don’t want my USB devices to be shown in Safely Remove Hardware
dialog. I did set SurpriseRemovalOk = TRUE in my driver, but my
technician said she still see the device in Safely Remove Hardware
dialog sometimes. Is there any document about how to unregister a device
from Safely Remove Hardware dialog?

I understand Safely Remove Hardware dialog is a good thing, but it would
be nice to give more control to the user. Currently, what we can do is
to hide or show the dialog.

Zs

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, August 03, 2006 11:02 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Failing q.r. will prevent disable. It’s late here and I can’t remember
if failing q.r. makes the device disabled on reboot w/a prompt for
reboot, but I think that is what happens.

Again, my point here is that you need a driver to do this. I think the
OP wants to affect stacks which he didn’t write the driver for.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 10:55 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Am I wrong that failing IRP_MN_QUERY_REMOVE_DEVICE will prevent
Disable in the Device Manager? or Device Manager will ask for reboot,
and the next boot will be with this device disabled?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, August 04, 2006 1:25 AM
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Note that this doesn’t prevent physical removal nor query removal (let’s
say disable in device manager). This just prevents the UI (which is
essentially a shortcut to the device manager functionality) from
appearing. Furthermore, you need a filter driver to be able to clear
this field, something which I don’t think the OP was intending on
writing.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure.
Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Sorry about that. Maxim’s right.

A quick search of the MSDN documentation might help address this. Let’s
look at the page for the DEVICE_CAPABILITES structure to see what it
says about SurpriseRemovalOK:

***
SurpriseRemovalOK
Specifies whether the device can be safely removed without use of the
Unplug or Eject Hardware program. If both Removable and
SurpriseRemovalOK are set, the device can be removed without using the
program.
(Drivers for USB devices that support surprise removal must set this to
TRUE only when the IRP is being passed back up the driver stack.)
***

Interesting. It mentions the Removable flag. Let’s look at that one:

***
Removable
Specifies whether the device can be dynamically removed from the system.
If TRUE, the device is displayed in the Unplug or Eject Hardware
program, unless SurpriseRemovalOK is also set to TRUE.
***

That says you should clear the Removable capability from the device.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@exgate.tek.com
Sent: Friday, August 04, 2006 10:06 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

So, which one of you are correct?

Maxim:

Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Peter:

You will show up in the “Safely Remove Hardware” dialog if you say that
you support SurpriseRemovalOK.

You need to be setting this to FALSE.

Thanks,

zhongsheng

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Peter Wieland
Sent: Friday, August 04, 2006 9:47 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

You will show up in the “Safely Remove Hardware” dialog if you say that
you support SurpriseRemovalOK.

You need to be setting this to FALSE.

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@exgate.tek.com
Sent: Friday, August 04, 2006 9:30 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Thanks Maxim and Doron:

I do write the driver for the USB device, therefore, it’s not a problem
to make changes in the drive.

I probably don’t want to disable IRP_MN_QUERY_REMOVE_DEVICE because that
will make my driver update painful.

If the customer goes to device manager and remove the device, that’s his
fault. In the other hand, if he knows how to do that, he should be able
to get it back.

I just don’t want my USB devices to be shown in Safely Remove Hardware
dialog. I did set SurpriseRemovalOk = TRUE in my driver, but my
technician said she still see the device in Safely Remove Hardware
dialog sometimes. Is there any document about how to unregister a device
from Safely Remove Hardware dialog?

I understand Safely Remove Hardware dialog is a good thing, but it would
be nice to give more control to the user. Currently, what we can do is
to hide or show the dialog.

Zs

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, August 03, 2006 11:02 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Failing q.r. will prevent disable. It’s late here and I can’t remember
if failing q.r. makes the device disabled on reboot w/a prompt for
reboot, but I think that is what happens.

Again, my point here is that you need a driver to do this. I think the
OP wants to affect stacks which he didn’t write the driver for.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 10:55 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Am I wrong that failing IRP_MN_QUERY_REMOVE_DEVICE will prevent
Disable in the Device Manager? or Device Manager will ask for reboot,
and the next boot will be with this device disabled?

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Doron Holan”
To: “Windows System Software Devs Interest List”
Sent: Friday, August 04, 2006 1:25 AM
Subject: RE: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Note that this doesn’t prevent physical removal nor query removal (let’s
say disable in device manager). This just prevents the UI (which is
essentially a shortcut to the device manager functionality) from
appearing. Furthermore, you need a filter driver to be able to clear
this field, something which I don’t think the OP was intending on
writing.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, August 03, 2006 12:46 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to prevent a USB device from being listed in
Safely Remove Hardware dialog?

Fail IRP_MN_QUERY_REMOVE_DEVICE in the driver.

Look at MN_QUERY_CAPABILITIES and DEVICE_CAPABILITIES structure.
Only the devices with SurpriseRemovalOk = FALSE are listed in “Safely
Remove Hardware dialog”.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Thursday, August 03, 2006 11:30 PM
Subject: [ntdev] How to prevent a USB device from being listed in Safely
Remove Hardware dialog?

Hi,

I am developing a system with several dedicated USB devices. Normally,
these USB devices are required to keep the system to work. Therefore, we
must prevent the user from stopping them, especially from the Safely
Remove Hardware dialog.

I can hide the Safely Remove Hardware dialog from the taskbar, but it
will come back if the user plugs in a flash drive or USB mouse.

Is there any way that I can register my USB device not to be listed in
Safely Remove Hardware dialog?

Thanks,

Zhongsheng Wang
Software Design Engineer
Phone: (503)627-5260
Fax: (503)627-5622
Email: xxxxx@tek.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I searched KB and found the article named “How to avoid the “Unsafe
Removal” dialog box” which probably helps:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q298504

Regards,
MichaelG.