Getting wrong CPU Processor ID with __cpuid() in Win 11 systems

Bhanodaya 0 Reputation points
2024-07-19T10:06:54.6066667+00:00

 

Hello Friends,

 

I am facing an issue in getting CPU Processor ID with C++ code.

I used __cpuid() function as below:

 


#include <iostream>

#include <intrin.h>

 

int main()

{

                unsigned __int32  regs[4];

               

                __cpuid((int *)regs, 1);

               

                std::cout << "Processor ID: " << std::hex << regs[3] << " 000 " << regs[0];

}


 

This code is working in all the Win 10 systems.

But some Win 11 systems are providing EDX data (regs[3] in above code) as BFCBFBFF.

When I use "wmic cpu get processorid" at command prompt, I got BFEBFBFF.

 

Is it issue with Win 11 system or __cpuid function or any mistake in my code?

 

Please guide me.

Thanks in advance.

 

Regards

Udaya

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,755 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,847 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jacen Wang 960 Reputation points Microsoft Vendor
    2024-07-21T22:08:41.9166667+00:00

    Hello,

    The "__cpuid ()" function works on x86 and x64 architectures. Please check the Windows 11 system architecture.

    The information obtained by this function (especially the processor ID) is actually a set of functional identifiers and does not represent a unique serial number or ID of the processor. When "__cpuid" is called with 1, the values in EDX and EAX provide function flags and other processor information. If you need a serial number or a unique processor ID, look it up at the operating system level (for example, using WMIC).

    For more information see: __cpuid, __cpuidex | Microsoft Learn

    ———————————————————————————————————————

    If the Answer is helpful, please click "Accept Answer" and upvote it.


  2. Gary Nebbett 6,081 Reputation points
    2024-07-22T08:41:43.1766667+00:00

    Hello Udaya,

    The __cpuid() intrinsic reads the value from the CPU, whereas the "wmic cpu get processorid" command obtains the information from the SMBIOS.

    I don't know why there is a difference in the Debug Store (DS) feature flag; what use do you want to make of this information (the ProcessorId in its entirety or the Debug Store support flag in particular)?

    Gary

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.