Now I want to install a lower filter driver on a keyboard device. The keyboard device is one interface of a composite device. My INF's hardware ID matches the keyboard's hardware ID such as USB\VID_XXXX&PID_XXXX&MI_00. After installing the driver, the "LowerFilters" key is added to the registry "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\VID_XXXX&PID_XXXX\1DD5F3D" and its value is right. But my filter driver is not in the device stack of the keyboard device. Anyone knows why?
If you want to attach to the stack which has kbdhid and kbdclas you need to filter the HID\xxx hw id
What are you planning to have your driver do, exactly? A lower filter to a USB\VID_xxxx device will be seeing URBs via IRP_MJ_INTERNAL_DEVICE_CONTROL.