How does Windows categorize devices in "Device Manager"?

Solution 1:

It's basically the device driver's responsibility. Windows represents devices by device objects. Each device object has a device type, which is stored in the DeviceType member of its DEVICE_OBJECT structure. The device type represents the type of underlying hardware for the driver. See the source page below as well as related MSDN documentation about kernel and user-mode drivers, the Windows Driver Model (WDM) architecture etc.

Source

Solution 2:

Your understanding is incorrect - INF files do define the category where a device will go in Device Manager. Windows categorizes devices based on the Class and ClassGuid entries in the INF file used to install the device.

For example, go to Device Manager -> Keyboards -> HID Keyboard Device (assumed) -> right-click -> Properties -> Details tab -> Property dropdown -> Device class guid. You should see {4d36e96b-e325-11ce-bfc1-08002be10318} for the device class GUID. This matches the GUID for Keyboard in the MSDN link "System-Defined Device Setup Classes Available to Vendors" http://msdn.microsoft.com/en-us/library/ff553426%28v=vs.85%29.aspx

You can even create your own Device Manager categories. "Creating a New Device Setup Class" http://msdn.microsoft.com/en-us/library/ff540189%28VS.85%29.aspx But this is generally frowned upon, and you should use existing Class GUIDs where appropriate. For example, if you chose to use a different Class GUID for a keyboard, (I think) the OS would not recognize the keys that were pressed, even though the OS recognizes the device itself (i.e. it enumerated, it sends data, but the data doesn't go into the system's keyboard buffers)