Skip to content

Instantly share code, notes, and snippets.

@drojf
Last active September 3, 2016 00:34
Show Gist options
  • Save drojf/ac923314ba3bf11e4de0c92b045453a5 to your computer and use it in GitHub Desktop.
Save drojf/ac923314ba3bf11e4de0c92b045453a5 to your computer and use it in GitHub Desktop.
/* Make sure this device is of Setup Class "HIDClass" and has a driver bound to it. */
i = device_index
char driver_name[256];
/* Populate devinfo_data. This function will return failure
when there are no more interfaces left. */
res = SetupDiEnumDeviceInfo(device_info_set, i, &devinfo_data);
if (!res)
goto cont;
res = SetupDiGetDeviceRegistryPropertyA(device_info_set, &devinfo_data,
SPDRP_CLASS, NULL, (PBYTE)driver_name, sizeof(driver_name), NULL);
if (!res)
goto cont;
if (strcmp(driver_name, "HIDClass") != 0) {
goto cont;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment