During the USB Device Driver Attach Processing operation, the device driver registers a callback function. When a user detaches a peripheral from the bus, the USBD module calls the callback function within that device driver. This function is called with the USB_CLOSE_DEVICE code, which is the only device notification code defined in Windows CE 2.10.
The callback function also has the option of calling other functions in the USB device driver, such as USBUnInstallDriver. USBUnInstallDriver removes all registry keys created by the driver’s USBInstallDriver function and releases any other resources held by the driver. In this way the user can remove any old registry settings for a particular device when a new or updated driver for that device is available. In Windows CE 2.10, the USBD module never calls USBUnInstallDriver.