谁有BCB获取CPU标识、网卡MAC和硬盘序列号的可用代码?
请给出可以正常运行的代码
1. 获取CPU标识
2. 网卡MAC地址
3. 硬盘序列号
要求高效简洁可用的
[解决办法]
//获取CUP序列号String __fastcall CPU_ID(){ String ID; unsigned long s1,s2; unsigned char vendor_id[]="------------"; char sel; sel='1'; String VernderID; String MyCpuID,CPUID1,CPUID2; switch(sel) { case '1': __asm { xor eax,eax cpuid mov dword ptr vendor_id,ebx mov dword ptr vendor_id[+4],edx mov dword ptr vendor_id[+8],ecx } VernderID.sprintf("%s-",vendor_id); __asm { mov eax,01h xor edx,edx cpuid mov s1,edx mov s2,eax } CPUID1.sprintf("%08X%08X",s1,s2); __asm { mov eax,03h xor ecx,ecx xor edx,edx cpuid mov s1,edx mov s2,ecx } CPUID2.sprintf("%08X%08X",s1,s2); break; case '2': { asm { mov ecx,119h rdmsr or eax,00200000h wrmsr } } ShowMessage("CPU id is disabled."); break; } MyCpuID = CPUID1+CPUID2; ID = MyCpuID; return ID;}void __fastcall TForm1::Button3Click(TObject *Sender){ ShowMessage( CPU_ID()) ;}