Board index » off-topic » Re: Why CPUID is not working?

Re: Why CPUID is not working?


2007-11-16 05:21:33 PM
off-topic3
LearnJoo pretended :
Quote
hi
I wrote this software to make a Lock for my softwares but its not working to
get CPUID
First , always it give me some same number in any computer that I try.
Second I ot crazy to read it over and over !!!
:-) Hope to recieve a help
Thanks everybody here


First let me say that there is no more CPUID that is unique per
processor. Intel stoped adding this ID in to their chips for at least a
year now.
Now what makes you thing that any of us will ever download and execute
a program from any newsgroup. If you need help you must
1) find the apropriate group to ask the questiong B.P.D.Win32 would be
my selection.
2) show us the code.
Regards
Yannis.
 
 

Re:Re: Why CPUID is not working?

Thanks for your answer
:-)
first ! because I do, then OK I'll do
I asked in borland.public.cppbuilder.nativeapi just because I think its a
true place and I am using BCB5
here and there this is my code (Plus ! this exe file is compressed of my
project)
take care
typedef long TCPUID[4];
typedef char TVendor[12];
#pragma option push
#pragma option -w-
bool IsCPUID_Available(void) {
__asm{
PUSHFD // direct access to flags no possible, only via stack
POP EAX // flags to EAX
MOV EDX,EAX // save current flags
XOR EAX,0x00200000 // not ID bit
PUSH EAX // onto stack
POPFD // from stack to flags, with not ID bit
PUSHFD // back to stack
POP EAX // get back to EAX
XOR EAX,EDX // check if ID bit affected
SHR EAX,21 // Result=Bit #21
}
} // IsCPUID_Avialable
//========================================================================
void __fastcall GetCPUID(TCPUID* cpuID) {
__asm{
PUSH EBX // Save affected register
PUSH EDI
MOV EDI,EAX // cpuID
MOV EAX,1
DW 0xA20F // CPUID Command}
STOSD // CPUID[1]
MOV EAX,EBX
STOSD // CPUID[2]
MOV EAX,ECX
STOSD // CPUID[3]
MOV EAX,EDX
STOSD // CPUID[4]
POP EDI // Restore registers
POP EBX
}
} // GetCPUID
//========================================================================
void __fastcall GetCPUVendor(TVendor* vendor) {
__asm {
PUSH EBX // Save affected register
PUSH EDI
MOV EDI,EAX // vendor
MOV EAX,0
DW 0xA20F // CPUID Command
MOV EAX,EBX
STOSD
MOV EAX,EDX
STOSD
MOV EAX,ECX
STOSD
POP EDI // Restore registers
POP EBX
}
} // GetCPUVendor
//========================================================================
#pragma option pop
/*
Usage :
TCPUID cpuID;
GetCPUID(&cpuID);
*/
and :
long X=0,a=0,b=0,c=0,d=0;
TCPUID cpuID;
GetCPUID(&cpuID);
a=cpuID[0];
b=cpuID[1];
c=cpuID[2];
d=cpuID[3];
Edit1->Text=IntToStr(a);
Edit2->Text=IntToStr(b);
Edit3->Text=IntToStr(c);
Edit4->Text=IntToStr(d);
"yannis" < XXXX@XXXXX.COM >wrote in message
Quote
LearnJoo pretended :
>hi
>I wrote this software to make a Lock for my softwares but its not working
>to get CPUID
>First , always it give me some same number in any computer that I try.
>Second I ot crazy to read it over and over !!!
>:-) Hope to recieve a help
>Thanks everybody here
>
>

First let me say that there is no more CPUID that is unique per processor.
Intel stoped adding this ID in to their chips for at least a year now.
Now what makes you thing that any of us will ever download and execute a
program from any newsgroup. If you need help you must

1) find the apropriate group to ask the questiong B.P.D.Win32 would be my
selection.
2) show us the code.


Regards
Yannis.