Get processor ID or Motherboard ID

How can I get one of them?

Motaz
LVL 7
MotazAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gmayoCommented:
http://www.torry.net/cpu.htm has what you want, most with source.

Geoff M.
0
snehanshuCommented:
From:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_11054364.html

HTH,
...Shu

Comment from Olympus
Date: 08/21/2000 06:05AM IST
 Author Comment  

im sure theres an assembly function that returns something you can convert to the specific processor type string..


 
Comment from ckaneta
Date: 08/21/2000 08:20AM IST
 Comment  

well, that code I mentioned uses an awful lot of assembly
here it is
------------------------------------
/////////////////////////////////////////////////////////////////////////////
// (c) NPS, 1997                  - Idea, realisation, adoptation IsCPUID_Available) //
//                        kvk@estpak.ee                                    //
// (c) Alex Abreu, 1997 - IsCPUID_Available source and idea                //
//                        simonet@bhnet.com.br                             //
/////////////////////////////////////////////////////////////////////////////

interface

uses
  Windows,
  Messages,
  SysUtils,
  Classes,
  Graphics,
  Controls,
  Forms,
  Dialogs,
  ExtCtrls,
  StdCtrls,
  Buttons;

type
  TDemoForm = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    GetButton: TBitBtn;
    CloseButton: TBitBtn;
    Bevel1: TBevel;
    Label5: TLabel;
    FLabel: TLabel;
    MLabel: TLabel;
    PLabel: TLabel;
    SLabel: TLabel;
    PValue: TLabel;
    FValue: TLabel;
    MValue: TLabel;
    SValue: TLabel;
    procedure GetButtonClick(Sender: TObject);
  end;

var
  DemoForm: TDemoForm;

implementation

{$R *.DFM}

const
     ID_BIT     =     $200000;               // EFLAGS ID bit
type
     TCPUID     = array[1..4] of Longint;
     TVendor     = array [0..11] of char;

function IsCPUID_Available : Boolean; register;
asm
     PUSHFD                                   {direct access to flags no possible, only via stack}
  POP     EAX                         {flags to EAX}
  MOV     EDX,EAX               {save current flags}
  XOR     EAX,ID_BIT     {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}
  JZ      @exit                    {no, CPUID not availavle}
  MOV     AL,True               {Result=True}
@exit:
end;

function GetCPUID : TCPUID; assembler; register;
asm
  PUSH    EBX         {Save affected register}
  PUSH    EDI
  MOV     EDI,EAX     {@Resukt}
  MOV     EAX,1
  DW      $A20F       {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
end;

function GetCPUVendor : TVendor; assembler; register;
asm
  PUSH    EBX                         {Save affected register}
  PUSH    EDI
  MOV     EDI,EAX               {@Result (TVendor)}
  MOV     EAX,0
  DW      $A20F                    {CPUID Command}
  MOV     EAX,EBX
  XCHG          EBX,ECX     {save ECX result}
  MOV               ECX,4
@1:
  STOSB
  SHR     EAX,8
  LOOP    @1
  MOV     EAX,EDX
  MOV               ECX,4
@2:
  STOSB
  SHR     EAX,8
  LOOP    @2
  MOV     EAX,EBX
  MOV               ECX,4
@3:
  STOSB
  SHR     EAX,8
  LOOP    @3
  POP     EDI                         {Restore registers}
  POP     EBX
end;

procedure TDemoForm.GetButtonClick(Sender: TObject);
var
  CPUID : TCPUID;
  I     : Integer;
  S               : TVendor;
begin
     for I := Low(CPUID) to High(CPUID)  do CPUID[I] := -1;
  if IsCPUID_Available then begin
       CPUID     := GetCPUID;
       Label1.Caption := 'CPUID[1] = ' + IntToHex(CPUID[1],8);
       Label2.Caption := 'CPUID[2] = ' + IntToHex(CPUID[2],8);
       Label3.Caption := 'CPUID[3] = ' + IntToHex(CPUID[3],8);
       Label4.Caption := 'CPUID[4] = ' + IntToHex(CPUID[4],8);
       PValue.Caption := IntToStr(CPUID[1] shr 12 and 3);
       FValue.Caption := IntToStr(CPUID[1] shr 8 and $f);
       MValue.Caption := IntToStr(CPUID[1] shr 4 and $f);
       SValue.Caption := IntToStr(CPUID[1] and $f);
       S := GetCPUVendor;
       Label5.Caption := 'Vendor: ' + S; end
  else begin
       Label5.Caption := 'CPUID not available';
  end;
end;

end.
 
0
MotazAuthor Commented:
It seems that I miss-ask the question:

It should be:

How can I get CPU Serial number, or motherboard serial number

I need an idetification of a computer

Motaz
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

snehanshuCommented:
Motaz,
  Has your premium service expired?
:-P
  Most of the threads suggest it is not a very good idea to use these any way!
...Snehanshu

Unique indentifiers like MAC address, CPU serial number
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20671536.html

Accepted Answer from geobul
Date: 07/08/2003 03:59PM IST
 Accepted Answer  

Hi,

MAC Address example (works on Win2000 and XP for sure):

uses NB30;

function GetAdapterInfo(Lana: Char): String;
var
 Adapter: TAdapterStatus;
 NCB: TNCB;
begin
 FillChar(NCB, SizeOf(NCB), 0);
 NCB.ncb_command := Char(NCBRESET);
 NCB.ncb_lana_num := Lana;
 if Netbios(@NCB) <> Char(NRC_GOODRET) then
 begin
   Result := 'mac not found';
   Exit;
 end;

 FillChar(NCB, SizeOf(NCB), 0);
 NCB.ncb_command := Char(NCBASTAT);
 NCB.ncb_lana_num := Lana;
 NCB.ncb_callname := '*';

 FillChar(Adapter, SizeOf(Adapter), 0);
 NCB.ncb_buffer := @Adapter;
 NCB.ncb_length := SizeOf(Adapter);
 if Netbios(@NCB) <> Char(NRC_GOODRET) then
 begin
   Result := 'mac not found';
   Exit;
 end;
 Result :=
   IntToHex(Byte(Adapter.adapter_address[0]), 2) + '-' +
   IntToHex(Byte(Adapter.adapter_address[1]), 2) + '-' +
   IntToHex(Byte(Adapter.adapter_address[2]), 2) + '-' +
   IntToHex(Byte(Adapter.adapter_address[3]), 2) + '-' +
   IntToHex(Byte(Adapter.adapter_address[4]), 2) + '-' +
   IntToHex(Byte(Adapter.adapter_address[5]), 2);
end;

function GetMACAddress: string;
var
 AdapterList: TLanaEnum;
 NCB: TNCB;
begin
 FillChar(NCB, SizeOf(NCB), 0);
 NCB.ncb_command := Char(NCBENUM);
 NCB.ncb_buffer := @AdapterList;
 NCB.ncb_length := SizeOf(AdapterList);
 Netbios(@NCB);
 if Byte(AdapterList.length) > 0 then
   Result := GetAdapterInfo(AdapterList.lana[0])
 else
   Result := 'mac not found';
end;

// usage
procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(GetMACAddress);
end;

Regards, Geo  
0
gmayoCommented:
Well, just glancing at the page I suggested (http://www.torry.net/cpu.htm), at least 1 of the components DOES give you the serial number:

"By  AA. CPUID asm instruction wrapper component, reveals CPU's Serial Number, Cache Descriptor and available features (FPU, VME, DE, PSE, TSC, MSR, PAE, MCE, CX8, APIC, SEP, MTRR, PGE, MCA, CMOV, PAT, PSE-36, PSN/PPN, CLFlush, DTES, ACPI, MMX, FXSR, ISSE/XMM, ISSE2, SSNOOP, ACC, JMPE), retrieves Windows Global Info (Hardware Profile, System, OS Version and Memory Status). Calls CPUID for virtually any specified level and get all of the results.
You may even see it's capabilities in design mode, just right-click and pick one of 4 samples on the menu items. "

Geoff M.
0
snehanshuCommented:
And,
  Why not use Hard disk serial number? I used that for my software at my previous job.
GetVolumeInformation
...Shu

The code from EXEX:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_10181822.html

Accepted Answer from simonet
Date: 07/13/1999 07:24AM IST
 Accepted Answer  

CPUs have no serial numbers. Only very few P-III were released with this feature, and Intel didn't make the code public available.

For HD's you can use this routine:

function GetVolSN(Volumn:String):string;
var
   sVolName, sFName: Array[0..20] of Char;
   dwVolSN, dwMaxFNameLen, dwFlag: DWORD;
begin
  result:='';
  if GetVolumeInformation(PChar(Volumn), sVolName, 20,
@dwVolSN,dwMaxFNameLen, dwFlag, sFName, 20) then
    result := IntToHex(dwVolSN, 8);
end;


Usage: GetVolSN('C:');

YOurs,

Alex
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MotazAuthor Commented:
I cann't user Harddisk serial number, because it can be replaced with another one (actually that should be the last solution if I fail to get another ID)

MAC!!
isn't for network cards
I want to deploy my applications in computers that has not network card nor modem

Motaz
0
gmayoCommented:
So... have you looked at this page yet? The page that has exactly what you are looking for?

Geoff M.
0
snehanshuCommented:
Motaz
  #1) I don't understand how does one determine whether there is more probability that a user would replace his hard disk and not the motherboard: Somebody could just as well upgrade the motherboard :-) And I have observed that in commercial organizations, people most probably get new systems: very few upgrades, so nither CPU nor harddisk works.
  #2) Not all CPUs have a serial number (only P3 onwards) and it seems serial numbers of BIOS are not unique.

Any way, check this:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_10327192.html

Cheers!
...Snehanshu
0
MotazAuthor Commented:
I want to give my customers a cd, containing a valid version only can run on thier computer by using unique serial number, and most of them solve thier windows problems by formatting thier hard disk, so that they need another copy of the application,

I cann't determine wither they replace the hard disk with another one (and run this application in another computer), and gave me a new hard disk, or they are really format it

anyway, as I was said, it is the last solution (althought it is my first thinking on protecting my application)
Motaz

0
snehanshuCommented:
Well,
  The choice is yours: either use CPU/Bios serial numbers which you are not guaranteed to find on all systems (My P3 doesn't have a serial no.) or use HDD serial number: I think all hard disks have a unique s/no.
  For CPU, you could use the links gmayo suggested. Or use simonet's BIOS serial number, again not guaranteed to be unique. Or use HDD serial no.
  Cheers!
...Shu
0
snehanshuCommented:
Motaz,
  Thank you for the points!
>>I cann't determine wither they replace the hard disk with another one (and run this application in another computer), and gave me a new hard disk, or they are really format it
  Well, you could copy the serial number to a floppy and take it with you for your reference so that next time you are required to install the S/W, you could cross-check. perhaps you could use a combination of HDD S/No and BIOS Serial Number.
  Just a suggestion. (We also had all these issues discussed when we finalized on HDD serial number security!)
:-)
...Snehanshu
0
odissey1Commented:
Hi All,

I've used SW protection before. That was a specific one which comes with a hardware (so the price was in 4-digit range anyway). The final solution was to use USB dong with SN burned (Alladin or Rainbow - I do not remember which company it was), with price per key ~$15. But SW protection brought us nothing but a headacke. This is not technical issue but a human perception. People just do not like it. So think twice. Thinking back I would rather loose 1/2 sales.

Regards,
odissey1  

 
0
MotazAuthor Commented:
BIOS serial number!
how can I get that, because I found that I can not rely only on HD serial number

0
snehanshuCommented:
From:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_10327192.html
:-)
HTH,
...Snehanshu

Accepted Answer from simonet
Date: 05/25/2000 10:54AM IST
 Accepted Answer  

>is really this number UNIQUE to each PC?

No. The BIOS serial number identifies the motherboard: manufacturer, model, bios, Bios date, etc.

>How can I get the BIOS Serial No. of the machine running my Delphi 5.0 programs?

I've written a component, TASCpuInfo, that does that. It's freeware and can be downloaded from:

http://www.bhnet.com.br/~simonet/omnitools.htm

It also gives you other very useful information on the CPU and BIOS.

Yours,

Alex
0
MotazAuthor Commented:
Thanks Alex, but I'll use the combination of CPUID and HD Serial number

Motaz
0
snehanshuCommented:
It was me, snehanshu, pasting a previously provided solution from Alex.
You could use his tools to get the BIOS serial number.
:-)
Cheers
...Snehanshu
0
MotazAuthor Commented:
Yeah, I know Alex, I mean I'll use your first answer about CPUID, because I don't like to use third-party components, because of portability.

Motaz
0
olasCommented:
Hi!
I would think fingerprint.......combining bios id/version features, hd serial, maybe some timing info and then produce a fingerprint that allows for some deviation. If no timings are involved you can probably rely on that two computers wont get EXACTLY the same fingerprint.

Fingerprints(read checksums) can be combined with other bits of info to identify
a system with (i am guessing) more than 90% probability. That would be ok would it not?

Would be fairly simple to gather components that does the job.

//Olas
 
0
oygCommented:
Hi Motaz, And Hi To All,

For software  protection I face the same problem, but I want to mention some points:

1- The Hard Disk Serial no that you all talk about it , it is not a Serial No. , but it is a Volume Serial No That becomes when you make a format to the Hard Disk. So it must be Unique, but it is not. because by some software you can copy this volume serial no and also you can change it, because it is a Logical Serial No, Not Physical.

2- So The Physical Hard Disk Serial No. it is  a number that fixed on external Hard Disk cover and It is very Difficult to depend on that because the component that I test is worked only with Win98, And Also The BIOS Component only worked with Win2000 / XP, So we don't have a component that worked with Poth Operating System.

3- So What I do with my software I make the protection with Hard Disk Volume Serial Number and I store it Encrypted in the Database.

that is the last solution that I find it for four years of searching.

Best Regards To all

Osama
0
oygCommented:
Hi Again,

I Also make the hard disk two partitions and make the protection for hard disk C and D, so If he format the C the protection still on D.

Best Regards,

Osama
0
MotazAuthor Commented:
That's good idea, I may apply it in my future software in sha allah
Motaz
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.