The HID driver stack in Windows is built on the class driver named hidclass.sys.Clients and transport minidrivers access the class driver from user-mode or kernel-mode.
The following is a simplified stack diagram of a generic HID client and transport.
The following is a more comprehensive stack diagram of the entire HID stack with Microsoft provided drivers for the various clients and transport minidrivers.
The diagram above includes the following:
- HID Clients – Identifies the Windows and 3rd party clients and their interfaces
- HIDClass driver
- HID Transport Minidriver - Identifies the Windows and 3rd party transports and their interfaces.
The system-supplied HID class driver is the WDM function driver and bus driver for the HIDClass device setup class. The executable image of the HID class driver is hidclass.sys. The HID Class driver is the glue between HID clients and various transports. This allows a HID Client to be written in an independent way from transports. This level of abstraction allows clients to work (with little to no modifications) when a new standard or 3rd party transport is introduced
The HID Clients are drivers, services or applications that communicate with HIDClass.sys and often represent a specific type of device (E.g. sensor, keyboard, mouse, etc). They identify the device via a hardware ID or a specific HID Collection and communicate with the HID Collection via the following guidance.
User-mode drivers and applications, and kernel-mode drivers, do the following to operate HID collections:
- User-mode drivers and applications use HidD_Xxx HIDClass support routines to obtain information about a HID collection.
- Kernel-mode drivers, and user-mode drivers and applications, use HidP_Xxx HID support routines and kernel-mode drivers use HID class driver IOCTLs to handle HID reports.
The following table is a simplification of the information listed above.
|Kernel Mode||HidD_Xxx OR IOCTL_HID_xxx||N/A|
For more information, see Operating HID Collections.
For a list of all supported HID Clients, please review the content in the “Clients Supported in Windows” section.
The HID class driver is designed to use HID minidrivers to access a hardware input device. A HID minidriver abstracts the device-specific operation of the input devices that it supports. The HID minidriver binds its operation to the HID class driver by registering with the HID class driver. The HID class driver communicates with a HID minidriver by calling the minidriver's support routines. The HID minidriver, in turn, sends communications down the driver stack to an underlying bus or port driver.
For a list of the HID Transports provided in Windows, please review the content in the “HID Transports Supported in Windows” section.