This piece of C++ code helps to get CPU (Processor) Id
#include <array>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include<conio.h>
std::string GetProcessorId() {
std::array<int, 4> cpuInfo;
__cpuid(cpuInfo.data(), 1);
std::ostringstream buffer;
buffer
<< std::uppercase << std::hex << std::setfill('0')
<< std::setw(8) << cpuInfo.at(3)
<< std::setw(8) << cpuInfo.at(0);
return buffer.str();
}
int main(void) {
std::cout << "Processor Serial number is: ";
std::cout<<GetProcessorId() << std::endl;
_getch();
return 0;
}