Recently, I have been engaged in obtaining information about CPU, video card, and other hardware. This is a bit too big. To obtain hardware information, you can use the setupdixxxx function to obtain the relevant email information or directly read the data in the relevant registry, in addition, WMI is used for retrieval (as mentioned in the previous article, we will not discuss it here .). Almost all data can be obtained from the Registry. However, this method is cumbersome. There are many functions in setupapi. H, and there are many APIs that are not described in DDK or msdn. If you are interested, you can study them.
Next I will talk about the CPU and video card information I recently encountered. There are many powerful hardware detection tools, among which the most NX is the number of cpuz and gpuz on obtaining the CPU and video card (maybe better ). Why. Not only are these two small software professional, but the data obtained from the CPU and video card information from the same other checking tools is very accurate and detailed. So how are they implemented? We will discuss this matter over time.
The CPU information displayed by cpuz is obtained by the cpuid command. You can not only obtain information such as CPU family, model, stepping, cpuid Sn, Cache Information, acpiid, number of cores, number of threads, CPU features, and so on. Obtained by using this command. Memory information, motherboard information, and chip information. Here, the motherboard name, which can be obtained in many ways, cpuz reads DMI information. Getting DMI information is described in my post smbios. The memory and chip information are completely driven by the driver, mainly the Read and Write ports. You can obtain the information on the bus by enumerating the PCI bus.
Gpuz is a headache, because the video memory information obtained by other methods is different from the data obtained by gpuz, because the video memory information obtained at the system layer is actually allocated to the video card, this includes dividing the memory into a video card, that is, the size of the shared video memory. Check other hardware detection tools and find that the size of the obtained video memory is the same as that of the shared video memory, rather than the size of the hardware independent video memory. In order to obtain the independent video memory information, this makes me very difficult. Similarly, by analyzing the working principle of gpuz, it first uses the setupdixxx function to obtain the model of the video card for analysis. Here we can guess that gpuz and cpuz both have their own libraries. In fact, other hardware detection tools all carry a library, which is used to store various hardware models and parameters.