Enumerate all non-plug and play drivers

Home Forums Discussions General Enumerate all non-plug and play drivers

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4816
    MindCracker
    Participant

      Hi,

      Could you explain how to enumerate all non-plug and play drivers appearing in Windows Device Manager?

      #5430
      Anton
      Participant

        Use setupapi functions. Something like this:


        unsigned devIndex;
        SP_DEVINFO_DATA devInfo;
        ULONG ulStatus, ulProblemNumber;
        CONFIGRET crRet;

        HDEVINFO devs;
        devs = SetupDiGetClassDevsEx(NULL,NULL,NULL,DIGCF_ALLCLASSES,NULL,NULL,NULL);

        devInfo.cbSize = sizeof(devInfo);
        for(devIndex=0;SetupDiEnumDeviceInfo(devs,devIndex,&devInfo);devIndex++)
        {
        crRet=CM_Get_DevNode_Status(&ulStatus,&ulProblemNumber,devInfo.DevInst,0);
        if ( ( crRet == CR_SUCCESS ) && (ulStatus & DN_LEGACY_DRIVER ) )
        {
        if ( SetupDiGetDeviceRegistryProperty(devs,&devInfo,SPDRP_DEVICEDESC,NULL,(PBYTE)Buffer,sizeof Buffer,ULL) )
        _tprintf(TEXT("%sn"),Buffer );
        }
        }

        SetupDiDestroyDeviceInfoList ( devs );
      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.