When did 'driver key of active device' quit working?

So I was looking for a simplification on a method that I’m currently using for PnP device-to-driver matching that I’m using in some driver update scripts, when I came across an inspector with which I wasn’t familiar - ‘active device’.

As I started to dig into it, I was happy to find that several things I’m doing in a convoluted way are readily available - like ‘hardware id of it’, ‘driver key value name of it’, etc.
One property that is giving me no results however is the one I need most - ‘driver key of it’. According to https://developer.bigfix.com/relevance/reference/registry-key.html this should give a Registry Key result mapping to the driver instance; I need this key to retrieve driver version information. But for me it gives no results at all -

q: driver keys of active devices
T: 24.146 ms

I’ve tried this in Fixlet Debugger 9.5.8 and 9.5.1.9.

The Inspector Reference states this should give “The key identified by adding the value of ‘driver key value name of active device’ to HKLM\System\CurrentControlSet\Control\Class.”

Did this inspector ever work, and if so, in which version did it stop? Am I calling it incorrectly, any better workarounds I haven’t seen yet?

Like you, I get no results from the driver keys of active devices. It appears this property is not returning anything.

Q: driver key of active device whose (description of it is “System timer”)
E: Singular expression refers to nonexistent object.

However, if you take the description from the Inspector Reference literally - then this property should return the registry key which is the concatenation of the string "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class" and the results of property

driver key value name of active device

So what about this workaround:

Q: (it, values “DriverDate” of it, values “DriverDesc” of it, values “DriverVersion” of it) of keys ((item 0 of it & item 1 of it) of ( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class",(driver key value names of active devices))) of registry

A: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4d36e97d-e325-11ce-bfc1-08002be10318}\0051, 6-21-2006, System timer, 6.3.9600.17238
A: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4d36e97d-e325-11ce-bfc1-08002be10318}\0012, 6-21-2006, PCI Express standard Root Port, 6.3.9600.17238

Thanks, that looks very hopeful, let me digest it a bit.

Hmm I think that one’s going to be a dead-end for me. The “active devices” inspector won’t give me CompatibleIDs, which I’m using in some of the driver matching. I also really need a new creation class for Registry so I can substitute in key names, equivalent to file '<string>'.

Ok, so here’s where I’m at now. This works for all the cases I’ve come across, anyway.

My root problem is detecting whether to update hardware drivers, in this case for an NVidia card. I attack this by traversing the HKLM\system\CurrentControlSet\Control\Enum key, finding devices with a HardwareID or CompatibleIDs entry matching one of the PnP Device IDs retrieved from the driver’s INF. Then, I check the corresponding keys beneath HKLM\System\CurrentlSet\Control\Class[ClassGUID] to see whether the matching device exists, has the correct ProviderName, and has a version equal to or higher than the one I propose to install.

I had working relevance for this some time ago, but had a whammy thrown at me – systems with multiple NVidia cards installed, of different models; where one model is supported by the new driver, but the old model is not supported by the new driver, installing the driver leaves the machine in an unbootable state. So now my logic has to be “there’s a matching card AND there’s not another NVidia card that doesn’t match the driver’s PnP Device List”.

Here’s what I’ve come up with. In reality the PnP device list for this one is 413 items long, I’ve snipped the list here but kept the evalution times for the full set:

Test 1 - NVidia Geforce driver is already up-to-date

q: exists (/* 0 = bus */ "PCI", /* 1 = ClassGUID */ "{4D36E968-E325-11CE-BFC1-08002BE10318}" as uppercase, /* 2 = Provider */ "NVIDIA" , /* 3 = Service */ "nvlddmkm", /* 4 = Version */ "23.21.13.9103", /* 5 = PnP list */ set of ((/* DEVICE LIST HERE */ "pci\ven_10de&dev_06d1";"pci\ven_10de&dev_06d1&subsys_077110de";"pci\ven_10de&dev_06d1&subsys_077210de") as lowercase ), /* 6 = Enum */ keys of keys of keys of key ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum") of native registry ) whose (( pathname of item 6 of it as string as lowercase starts with ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" as lowercase & item 0 of it as lowercase) AND  /* if class is defined then class matches expectation (in this case, "Display"); if no class is listed then its an unknown device and may still be relevant */(not exists (values "ClassGUID" of item 6 of it, item 1 of it) whose (item 0 of it as string as uppercase != item 1 of it)) AND ( /* exists a hardware ID matching our expected list from INF*/ size of intersection of (set of (substrings separated by "%00" whose (it !="" ) of (values ("HardwareID";"CompatibleIDs") of item 6 of it as string as lowercase as trimmed string)) ; item 5 of it) >  0) AND /* if there is no "Driver" key then true, else check the driver present in the "Driver" key */ (if not exists value "Driver" of item 6 of it then true else (not exists (/* 0 = ENUM */ item 6 of it, /* 1 = Class key */ keys of keys of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class" of native registry, /* 2 = Version */ item 4 of it, /* 3 = Provider */ item 2 of it) whose (pathname of item 1 of it as lowercase ends with value "Driver" of item 0 of it as string as lowercase AND ( /* wrong Provider */ value "ProviderName" of item 1 of it = item 3 of it and value "DriverVersion" of item 1 of it as string as version >= version /* VERSION HERE */ (item 2 of it))))) ) AND (not exists (keys of keys of keys of key ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum") of native registry, item 3 of it, item 5 of it) whose (value "Service" of item 0 of it as string as lowercase = item 1 of it as lowercase and size of intersection of (set of (substrings separated by "%00" whose (it !="" ) of (values ("HardwareID";"CompatibleIDs") of item 0 of it as string as lowercase as trimmed string)) ; item 2 of it) =  0) ))
A: False
T: 21.650 ms
I: singular boolean

Test 2 - coerce the driver version number to make it relevant

q: exists (/* 0 = bus */ "PCI", /* 1 = ClassGUID */ "{4D36E968-E325-11CE-BFC1-08002BE10318}" as uppercase, /* 2 = Provider */ "NVIDIA" , /* 3 = Service */ "nvlddmkm", /* 4 = Version */ "923.21.13.9103", /* 5 = PnP list */ set of ((/* DEVICE LIST HERE */ "pci\ven_10de&dev_06d1";"pci\ven_10de&dev_06d1&subsys_077110de";"pci\ven_10de&dev_06d1&subsys_077210de") as lowercase ), /* 6 = Enum */ keys of keys of keys of key ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum") of native registry ) whose (( pathname of item 6 of it as string as lowercase starts with ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\" as lowercase & item 0 of it as lowercase) AND  /* if class is defined then class matches expectation (in this case, "Display"); if no class is listed then its an unknown device and may still be relevant */(not exists (values "ClassGUID" of item 6 of it, item 1 of it) whose (item 0 of it as string as uppercase != item 1 of it)) AND ( /* exists a hardware ID matching our expected list from INF*/ size of intersection of (set of (substrings separated by "%00" whose (it !="" ) of (values ("HardwareID";"CompatibleIDs") of item 6 of it as string as lowercase as trimmed string)) ; item 5 of it) >  0) AND /* if there is no "Driver" key then true, else check the driver present in the "Driver" key */ (if not exists value "Driver" of item 6 of it then true else (not exists (/* 0 = ENUM */ item 6 of it, /* 1 = Class key */ keys of keys of key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class" of native registry, /* 2 = Version */ item 4 of it, /* 3 = Provider */ item 2 of it) whose (pathname of item 1 of it as lowercase ends with value "Driver" of item 0 of it as string as lowercase AND ( /* wrong Provider */ value "ProviderName" of item 1 of it = item 3 of it and value "DriverVersion" of item 1 of it as string as version >= version /* VERSION HERE */ (item 2 of it))))) ) AND (not exists (keys of keys of keys of key ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum") of native registry, item 3 of it, item 5 of it) whose (value "Service" of item 0 of it as string as lowercase = item 1 of it as lowercase and size of intersection of (set of (substrings separated by "%00" whose (it !="" ) of (values ("HardwareID";"CompatibleIDs") of item 0 of it as string as lowercase as trimmed string)) ; item 2 of it) =  0) ))
A: True
T: 30.507 ms
I: singular boolean