I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi News / Other Topic   Print This     

Getting the CPU serial number

Getting the CPU serial number in Delphi News / Other topic (part of our Pascal and Delphi Coding group).

Quick Search: Getting   Getting CPU   Getting CPU serial  
andyhud
 (Inactive)
Fleet, Surrey, England
Does anyone know how to do this with Delphi?
 Posted 18 years ago (Thread Starter)
Comment Quote
About andyhud -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #2183, 3 replies
Thread Started 5/17/2001 2:37:00 AM
View Counter=19745
Last Reply Posted 5/23/2001 11:54:00 AM)
Location=Fleet, Surrey, England  
Joined=18 years ago   MB Posts=14  
Most Recent Post
Larry J. Rutledge
Prestwood IT
Citrus Heights, CA USA
The problem with trying to obtain the CPU serial number is that this only exists with the P-III processor. In addition, people were so upset about "Big Brother" watching them, that Intel had to make this an option that could be turned off at will.

As a result, it is not possible to get a serial number from most CPUs that your program would run on.

There is a suite of products available for Delphi that makes it simple to obtain what information is available. The suite of components is called OmniTools and the specific component is called TASCpuInfo. You can get more information and download the component from the following address:


Old UBB Archived Link: [URL=http://www.bhnet.com.br/~simonet/omnitools.htm]http://www.bhnet.com.br/~simonet/omnitools.htm[/URL]


I hope this helps,
Larry J. Rutledge
Larry J. Rutledge

Analyst

Prestwood Software

www.prestwood.com
 Posted 18 years ago
Comment Quote
About Larry J. Rutledge -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Larry J. Rutledge
I worked for Prestwood Software as a Delphi developer from 1997 through 2002. During that time I enjoyed working with Mike Prestwood and the other developers at Prestwood.

Post ID #2262 (Level 1.1)  Reply to 2183
Thread Started 5/23/2001 11:54:00 AM
View Counter=2
Location=Citrus Heights, CA USA 
Joined=19 years ago   MB Posts=73   KB Posts=9  
andyhud
 (Inactive)
Fleet, Surrey, England
Thanks for that snippet of code, it works.. Just one thing - this tells you if the serial number is present. How do I get the actual number (id) from this?
I need to determine unqiue PCs connecting to our database, using the CPU serial number would allow this.
 Posted 18 years ago (Thread Starter)
Comment Quote
About andyhud -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #2253 (Level 1.2)  Reply to 2183
Reply Posted 5/23/2001 12:24:00 AM
Location=Fleet, Surrey, England  
Joined=18 years ago   MB Posts=14  
Len
 (Inactive)
seattle
Hi,
Here is some source code I found on the internet once.You may try it and see if it works for you. I found this code on:

Old UBB Archived Link: [URL=http://www.buraks.com/p3uns/]http://www.buraks.com/p3uns/[/URL]


DELPHI
Below is the source code for the Delphi unit CPUID (cpuid.pas). ShouldIRun function returns a boolean value.
Note: GetCpuId function does not get the CPU ID or serial, it just returns a result code
Note: This code does not attempt to check if it's running on anything less than a Pentium class processor.
Note: Hey, i'd be glad to publish your optimizations to the below code on this page! I don't have the time for optimizations, it works and at the moment that's enough for me... The reason for all non-optimal code and misleading function names is that this code is actually a crippled version of another unit Big Grin!


//By Burak KALAYCI, released to Public Domain
unit cpuid;

interface

var
VendorId:ShortString;
SerialNumber:longbool;

function GetCpuId:integer;
function ShouldIrun:boolean;

implementation

function ShouldIrun:boolean;
begin
result:=true;
GetCpuId;
if Vendorid='GenuineIntel' then
begin
if SerialNumber then result:=false;
end;
end;

function GetCpuId:integer;
begin
asm
push eax
push ebx
push ecx
push edx
push esi

//check if cpuid is supported
pushfd
pop eax
mov ecx,eax //eax=ecx=eflags
xor eax,$200000
push eax
popfd
pushfd
pop eax
xor eax,ecx//can not toggle bit 21
jz @nocpuid
push ecx
popfd //restore eflags

mov eax,0h
db $0f;db $a2 //CPUID

lea esi,VendorId
mov byte ptr esi[0],12
mov dword ptr esi[1],ebx
mov dword ptr esi[5],edx
mov dword ptr esi[9],ecx

mov eax,1h
db $0f;db $a2 //CPUID

and edx,$40000 //test bit 18 serial number enabled/supported
jz @nonum
mov SerialNumber,1
mov result,1
jmp @exit

@nocpuid:
mov result,-1
jmp @exit

@nonum:
mov SerialNumber,0
mov result,0

@exit:
pop esi
pop edx
pop ecx
pop ebx
pop eax
end;
end;

end.
 Posted 18 years ago
Comment Quote
About Len -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #2247 (Level 1.3)  Reply to 2183
Reply Posted 5/22/2001 6:43:00 AM
Location=seattle  
Joined=17 years ago   MB Posts=13  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1103A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #2183 Counter
19745
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech