On Tue Jan 23 10:02:40 2024 +0000, Krzysztof Bogacki wrote:
I'm trying to follow the suggestion to read SetupAPI registry data but I'm having some difficulties, with the major one being: I'm not actually sure where that data is. Your sample code doesn't seem to read the registry and just returns/enumerates an empty device set. What am I missing here? On the other hand, I had a look at where win32u writes stores information when `add_gpu` is called and figured that I can (probably) use whatever this function writes. This gives me two possible leads:
`HKML\System\CurrentControlSet\Control\Class{4D36E968-E325-11CE-BFC1-08002BE10318}${gpu_id}`. Although easier to enumerate, this doesn't have the most important piece of data: GPU LUID, which I'd have to retrieve from the second key anyway and it doesn't have any links to second keys I could use to open it directly, so it's not very viable for my purposes here. 2. `HKML\System\CurrentControlSet\Enum\PCI${pci_id}${gpu_idx}`. This does have GPU LUID I can easily retrieve but some of the other data is kept only as wide strings which I'd need to parse if I wanted to use them (if only for bookkeeping purposes). E.g. the only way I see to retrieve PCI vendor and device IDs would be parsing `${pci_id}` but as far as I can tell, I can't just use `snwscanf` to process 2-byte wide strings in Unixlibs. Of course, I could pick the second version and read only the LUID while ignoring PCI IDs and GPU ID/index completely, but I'd like to ask first if it's correct thing to do before I commit to that.
HKML\System\CurrentControlSet\Enum\PCI is the correct key to enumerate GPUs.
the only way I see to retrieve PCI vendor and device IDs would be parsing ${pci_id} but as far as I can tell, I can't just use snwscanf to process 2-byte wide strings in Unixlibs.
Do you really need PCI IDs for D3DKMTEnumAdapters2? If you do, I am sure there is a way to parse them.