c++ - SetupDiEnumDriverInfo returns different results on Windows 7 and Windows 8 / 10 -


i debugging application should retrieve information smart card reader drivers installed on windows system.

the code below works on windows 7 (64 bit):

qset<qstring> getsmartcarddrivermodulenames() {     qset<qstring> modulenames;      // guid smart card reader device setup class     wchar_t deviceclassguidstring[] = l"{50dd5230-ba8a-11d1-bf5d-0000f805f530}";     guid deviceclass;     clsidfromstring(deviceclassguidstring, &deviceclass);      hdevinfo deviceinfoset = setupdigetclassdevs(&deviceclass, null, null, 0);     if (deviceinfoset == invalid_handle_value)     {         return modulenames;     }      sp_devinfo_data deviceinfodata;     deviceinfodata.cbsize = sizeof(deviceinfodata);      (dword deviceindex = 0;          setupdienumdeviceinfo(deviceinfoset, deviceindex,                                &deviceinfodata);          deviceindex++)     {         if (setupdibuilddriverinfolist(deviceinfoset, &deviceinfodata,                                        spdit_compatdriver))         {             sp_drvinfo_data_w driverinfodata;             driverinfodata.cbsize = sizeof(driverinfodata);             (dword driverindex = 0;                  setupdienumdriverinfo(deviceinfoset, &deviceinfodata,                                        spdit_compatdriver, driverindex,                                        &driverinfodata);                  driverindex++)             {                 // omitted: service name , add modulenames.             }              setupdidestroydriverinfolist(deviceinfoset, &deviceinfodata,                                          spdit_compatdriver);         }     }      setupdidestroydeviceinfolist(deviceinfoset);     return modulenames; } 

this code correctly finds installed drivers when run on windows 7, finds no driver @ on windows 8 or windows 10 (both 64 bit), though drivers installed.

it turns out (by adding logging , debug code) under windows 8 , 10 first call setupdienumdriverinfo fails. in case, adding call getlasterror() error_no_more_items, normal behaviour expected when end of list reached (see the documentation).

so, no errors detected, result empty.

in documentation of windows api have found no changes windows 7 windows 8, 10, no adaptation above code should needed.

have overlooked something? have hint should check next?


Comments