# How does GPU-Z obtain data?



## alex8 (Oct 20, 2009)

I'm currently writing a very primitive program that displays in console window some info about the computer it's running on, like CPU and GPU model. I'm currenetly using WMI, and I have a problem identifying GPU. I can get a string saying "ATI Radeon HD 4800 Series", so I can't even tell 4850/70 from 4890.
Can someone tell me how does GPU-Z obtain this info? 

Sorry if I posted in wrong subforum...


----------



## W1zzard (Oct 20, 2009)

get the pci device id of the device, that lets you identify the gpu (if you build a large list of device id vs. gpu)


----------



## alex8 (Oct 20, 2009)

Thanks for a hint.
Can you give me an idea of what API or library can I use to get the ID?
Thanks again.

Hm. Can I use IN asm instruction to access the PCI address space?..


----------



## W1zzard (Oct 20, 2009)

WMI should give you the device id, it's the second number after 1002 in device id in gpuz

no you can't use IN (PCI config space doesnt live on a IO port anyway), need a kernel mode driver that accesses the data and passes it on to your app in userspace, or a kernel mode driver that maps the physical memory into kernel space and then maps it into user space, or kernel mode functions halgetbusdata*

there might even be a copy of pci config space accessible from usermode somewhere, but no idea.


----------



## alex8 (Oct 20, 2009)

You're right! PnPDeviceID parameter provides a string containing vendor and device IDs. I must have overlooked this when I discovered WMI properties.


----------



## alex8 (Oct 20, 2009)

W1zzard said:


> WMI should give you the device id


I'm stuck again. That won't neccessarily give me what I want: I have radeon 4850 with 0x9442 ID, and http://www.pcidatabase.com/search.php?device_search_str=hd along with some other sources indicates it to be a "ATI Radeon HD 4800 Series" adapter


----------



## W1zzard (Oct 20, 2009)

that's up to you to figure out which device id corresponds to which product(s) and how to treat them, internally gpuz has a loooong list of device ids


----------



## alex8 (Oct 20, 2009)

That's not a problem to determine videoprocessor's ID. The problem is this ID may be common for several different GPUs. My GPU's ID is 9442h, and by this ID I can't tel whether it is 4850 or 4870...


----------



## W1zzard (Oct 20, 2009)

that may be the case, then you can't tell them apart


----------



## alex8 (Oct 20, 2009)

But GPU-Z can! Don't you know how?


----------

