Question

I can't get the CPU ID or motherboard serial number in all operating system (cross platform Qt)

On Windows I'm using WMI and on Mac another. I want use a cross-platform library.

Was it helpful?

Solution

Although Qt detects at runtime the CPU feature set (cf. src/corelib/tools/qsimd.cpp), it does not export any function to access that (nor any other CPUID information). Write your small piece of assembly code to gather that information. - source

You will have to write some platform dependent code to retrieve this information.

For the CPU id you should probably look into the function __cpuid() for Windows and this answer can help you out on getting it for Linux.

Doing this you might want to consider reading up on motherboard serial numbers as not all of them provide this information at the same place (most do not provide it at all).

OTHER TIPS

You can execute this command : "wmic cpu get ProcessorId"

Qt 5.11 introduced this function: QSysInfo::machineUniqueId

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top