Why does SetupDiEnumDriverInfo give two version numbers for my driver

后端 未结 2 589
北海茫月
北海茫月 2021-01-05 12:09

I\'m trying to get the version number of a driver programmatically. The seems to be done by using SetupDiEnumDriverInfo to get a SP_DRVINFO_DATA st

2条回答
  •  时光说笑
    2021-01-05 12:29

    As your code is written, all the possible drivers will be output. Try doing the following to filter on only the installed driver:

    SP_DEVINSTALL_PARAMS InstallParams;
    if ( !SetupDiGetDeviceInstallParams( devInfoSet, &devInfo, &InstallParams ) )
    {
       //Error
    }
    else
    {
       InstallParams.FlagsEx |= DI_FLAGSEX_INSTALLEDDRIVER;
       if ( !SetupDiSetDeviceInstallParams( devInfoSet, &devInfo, &InstallParams) )
       {
          //Errror
       }
    }
    

    I found this at http://doxygen.reactos.org/df/db2/dll_2win32_2devmgr_2misc_8c_a1cd0b33c1785392a37689433dc99e482.html

提交回复
热议问题