Article ID: 298504 - Last Review: August 22, 2005 - Revision: 4.1 How to avoid the "Unsafe Removal" dialog boxThis article was previously published under Q298504 SUMMARY
This article describes how a function or a filter driver for a device can report if the device can tolerate surprise removal. Even if the bus driver indicates that the device can tolerate surprise removal, NDIS always clears the SurpriseRemoval field.
MORE INFORMATION
In Microsoft Windows 2000, you can avoid the Unsafe Removal dialog box. To do this, stop the device by selecting clicking Unplug/Eject icon in the task bar notification area. Then, unplug the hardware. However, if you have a device that can be surprise-removed, this process is unnecessary. Instead, drivers for hot plug-in/unplug devices that do not maintain a persistent state should inform the operating systems that they can tolerate a surprise removal by setting the SurpriseRemovalOK field in the DeviceCapabilities structure to TRUE in response to the IRP_MN_QUERY_CAPABILITIES Plug and Play IRP. According to the Plug and Play rule, drivers should set the SurpriseRemovalOK field in the IRP_MN_QUERY_CAPABILITIES IRP before the drivers pass the IRP to the lower drivers in the device stack. Because the Windows 2000 USB hub driver incorrectly resets this field to FALSE, Windows 2000 drivers for USB devices must set the SurpriseRemovalOK field on the way up. This behavior is demonstrated in the following code example. This code example is adapted for the toaster function driver sample in the DDK (Src\General\Toaster\Func\Toaster.c). NDIS miniport drivers cannot avoid the surprise removal dialog box by using the code example in this section because the following conditions are true:
APPLIES TO
| Article Translations
|
Back to the top
