Skip to content

Commit

Permalink
Fix incorrect SetupDiGetClassDevs error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnada authored and icex2 committed Nov 13, 2023
1 parent f8b2f5f commit 09b3a6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/geninput/dev-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void dev_list_init(struct dev_list *devs, const GUID *class_guid)
devs->infolist = SetupDiGetClassDevs(
devs->class_guid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);

if (devs->infolist == NULL) {
if (devs->infolist == INVALID_HANDLE_VALUE) {
log_fatal(
"SetupDiGetClassDevs failed: %08x", (unsigned int) GetLastError());
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/mm/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static HANDLE mm_open_device(void)
dev_info = SetupDiGetClassDevsW(
&hid_guid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);

if (dev_info == NULL) {
if (dev_info == INVALID_HANDLE_VALUE) {
log_fatal("SetupDiGetClassDevs failed");
}

Expand Down

0 comments on commit 09b3a6c

Please sign in to comment.