@@ -449,22 +449,25 @@ private static (GPU, int) GetDriverMetadata()
449449 foreach ( ManagementObject gpu in gpuSearch ) {
450450 string rawName = gpu [ "Name" ] . ToString ( ) ;
451451 string rawVersion = gpu [ "DriverVersion" ] . ToString ( ) . Replace ( "." , string . Empty ) ;
452-
453- // Vendor and Device ID
454452 string pnp = gpu [ "PNPDeviceID" ] . ToString ( ) ;
455- string [ ] split = pnp . Split ( "&DEV_" ) ;
456- string vendorID = split [ 0 ] [ ^ 4 ..] ;
457- string deviceID = split [ 1 ] [ ..4 ] ;
458453
459- if ( Regex . IsMatch ( rawName , @"^NVIDIA" ) && nameRegex . IsMatch ( rawName ) ) {
460- string gpuName = nameRegex . Match ( rawName ) . Value . Trim ( ) . Replace ( "Super" , "SUPER" ) ;
461- string cleanVersion = rawVersion . Substring ( rawVersion . Length - 5 , 5 ) . Insert ( 3 , "." ) ;
454+ // Is it a GPU?
455+ if ( pnp . Contains ( "&DEV_" ) ) {
456+ string [ ] split = pnp . Split ( "&DEV_" ) ;
457+ string vendorID = split [ 0 ] [ ^ 4 ..] ;
458+ string deviceID = split [ 1 ] [ ..4 ] ;
459+
460+ // Are drivers installed for this GPU? If not Windows reports a generic GPU name which is not sufficient
461+ if ( Regex . IsMatch ( rawName , @"^NVIDIA" ) && nameRegex . IsMatch ( rawName ) ) {
462+ string gpuName = nameRegex . Match ( rawName ) . Value . Trim ( ) . Replace ( "Super" , "SUPER" ) ;
463+ string cleanVersion = rawVersion . Substring ( rawVersion . Length - 5 , 5 ) . Insert ( 3 , "." ) ;
462464
463- gpuList . Add ( new GPU ( gpuName , cleanVersion , vendorID , deviceID , true , isNotebook , isDchDriver ) ) ;
465+ gpuList . Add ( new GPU ( gpuName , cleanVersion , vendorID , deviceID , true , isNotebook , isDchDriver ) ) ;
464466
465- // Name does not match but the vendor is NVIDIA, use API to lookup it's name
466- } else if ( vendorID == "10de" ) {
467- gpuList . Add ( new GPU ( rawName , rawVersion , vendorID , deviceID , false , isNotebook , isDchDriver ) ) ;
467+ // Name does not match but the vendor is NVIDIA, use API to lookup its name
468+ } else if ( vendorID == "10de" ) {
469+ gpuList . Add ( new GPU ( rawName , rawVersion , vendorID , deviceID , false , isNotebook , isDchDriver ) ) ;
470+ }
468471 }
469472 }
470473
@@ -482,10 +485,9 @@ private static (GPU, int) GetDriverMetadata()
482485
483486 if ( apiResponse != null && apiResponse . Count > 0 ) {
484487 string rawName = apiResponse [ 0 ] . desc ;
485- string rawVendorName = apiResponse [ 0 ] . venDesc . ToUpper ( ) ;
486488 string rawVersion = gpu . version ;
487489
488- if ( rawVendorName . Contains ( "NVIDIA" ) && apiRegex . IsMatch ( rawName ) ) {
490+ if ( apiRegex . IsMatch ( rawName ) ) {
489491 gpu . name = apiRegex . Match ( rawName ) . Value . Trim ( ) ;
490492 gpu . version = rawVersion . Substring ( rawVersion . Length - 5 , 5 ) . Insert ( 3 , "." ) ;
491493 gpu . isValidated = true ;
0 commit comments