IOCTL_HID_ATTACH

Notifies the HID class driver that an application needs to use a device.

Parameters

hDevice
Handle to the HID class device.
dwIoControlCode
IOCTL_HID_ATTACH
lpInBuffer
Pointer to an input buffer containing a SHiddiAttach structure.
nInBufferSize
The length of the input buffer.
lpOutBuffer
Pointer to an output buffer containing a SHiddiAttach structure. Must be equal to lpInBuffer.
nOutBufferSize
Length of the output buffer; must be the same as nInBufferSize.
lpBytesReturned
A count of the total bytes returned.
lpOverlapped
NULL

Remarks

The input and output buffer pointers and lengths must be identical. The buffer must contain a SHiddiAttach structure which is used for both input and output. The device to attach may be specified by ID or by type. If the structure's dwId member is zero, then the device is being specified by type. Otherwise, the dwId member contains the device's ID. If the device is being specified by type, then the actual device attached will be the first one that the HID class driver finds of the correct type. Before returning, the HID class driver must modify the SHiddiAttach structure to reflect the actual ID and type of the attached device.

This I/O control code is also used to detach an attached device, when the bAttaching field of the SHiddiAttach structure is set to FALSE. Devices can only be detached by ID; the dwDevType field is ignored when detaching. After a successful detach, the HID class driver shouldn't modify the SHiddiAttach structure and should return a zero-byte output length.