|This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.|
The HKEY_LOCAL_MACHINE\Drivers\USB\LoadClientskey must be set up correctly so that the USBD module can load the appropriate driver for a device when a device is attached to the bus. Each installed USB device driver must have a subkey within the LoadClientskey for the USBD module to load it.
For a USB device driver that is supplied by an OEM, the OEM should configure the LoadClientskey in a platform's .REG file to include subkeys for the driver. For third-party peripherals, however, the driver does not have appropriate subkeys when it is first connected to the platform. In this case, the USBD module fails to locate an appropriate USB device driver when the peripheral is attached to the bus. The USBD module instead displays a dialog box prompting a user to enter the name of the appropriate USB device driver DLL. The USBD then loads the specified driver to control the peripheral and calls the driver's USBInstallDriverfunction.
The USB device driver's USBInstallDriverfunction sets up the driver's subkey correctly within the LoadClientskey so that the USBD module can load the driver the next time that the peripheral is attached to the bus. The driver does this by creating a USB_DRIVER_SETTINGSstructure and passing it to the RegisterClientSettingsfunction. The format of the USB_DRIVER_SETTINGS structure parallels that of the LoadClientskey. If all the fields in a group have USB_NO_INFOvalue, the corresponding Group X_IDis set to Defaultin the registry. For example, the following example shows the USB_DRIVER_SETTINGSfor the HID class sample driver.
USB_DRIVER_SETTINGS DriverSettings; DriverSettings->dwVendorId = USB_NO_INFO; DriverSettings->dwProductId = USB_NO_INFO; DriverSettings->dwReleaseNumber = USB_NO_INFO; DriverSettings->dwDeviceClass = USB_NO_INFO; DriverSettings->dwDeviceSubClass = USB_NO_INFO; DriverSettings->dwDeviceProtocol = USB_NO_INFO; DriverSettings->dwInterfaceClass = USB_DEVICE_CLASS_HUMAN_INTERFACE; DriverSettings->dwInterfaceSubClass = USB_NO_INFO; DriverSettings->dwInterfaceProtocol = USB_NO_INFO;
The following example shows how calling RegisterClientSettingswith this USB_Driver_Settingsstructure is equivalent to having set up this registry key.
[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients] [Default] [Default]  [Generic_Sample_Hid_Class_Driver] "DLL"="USBHID.dll"
In general, the client driver performs the following operations in USBInstallDriver:
This location for driver-specific keys may change in future versions of Windows CE, so USB device drivers should always use OpenClientRegistryKeyto manipulate the settings, rather than opening the registry key directly.
After USBInstallDrivercompletes these actions, it returns control to the USBD module. The USBD module once again attempts to load a driver for the device, using the algorithm described in USB Device Driver Load Process. At this time, the USBD module calls the USB device driver's attach routine.
Last updated on Tuesday, July 13, 2004