Solved

serial number

Posted on 2006-11-21
8
374 Views
Last Modified: 2010-04-05
How to take the serial number computer or motherboard
0
Comment
Question by:ProgsX
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 17987999
0
 
LVL 18

Expert Comment

by:Johnjces
ID: 17988058
CPU Serial NUmber:

type
TCPUID = array[1..4] of Longint;

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;

Not sure you can get the graphics serial number as it is probably not coded into the GPU BIOS.

JJ
0
 
LVL 16

Accepted Solution

by:
CodedK earned 125 total points
ID: 17994672
This is for the motherboar Serial number id.
First download and save to your folder this pas file :
http://www.workshop-alex.org/sources/WbemScripting_TLB/WbemScripting_TLB.pas 



uses
  ActiveX, WbemScripting_TLB;

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
function GetSerialNumber: string;
const
  sQuery = 'select SerialNumber from CIM_BIOSElement';
var
  Item: SWbemObject;
  NumProp: LongWord;
  ObjectSet: ISWbemObjectSet;
  OleProperty: OleVariant;
begin
  ObjectSet := CoSWbemLocator.Create.ConnectServer( '', 'root\cimv2', '', '', '', '', 0, nil ).ExecQuery( sQuery, 'WQL', wbemFlagBidirectional, nil );
  if Succeeded( (ObjectSet._NewEnum as IEnumVariant).Next( 1, OleProperty, NumProp ) ) and ( NumProp > 0 ) and Succeeded( IDispatch( OleProperty ).QueryInterface( SWBemObject, Item ) ) then begin
    Result := VarToStr( Item.Properties_.Item( 'SerialNumber', 0 ) );
  end else begin
    Result := '<Not found>';
  end;
end;
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
OR USE THIS FOR FULL INFO :

function SerialNumber: string;
const
  sQuery = 'select SerialNumber from Win32_BIOS';
var
  Item: SWbemObject;
  NumProp: LongWord;
  ObjectSet: ISWbemObjectSet;
  OleProperty: OleVariant;
begin
  ObjectSet := CoSWbemLocator.Create.ConnectServer( '', 'root\cimv2', '', '', '', '', 0, nil ).ExecQuery( sQuery, 'WQL', wbemFlagBidirectional, nil );
  if Succeeded( ( ObjectSet._NewEnum as IEnumVariant ).Next( 1, OleProperty, NumProp ) ) and ( NumProp > 0 ) and Succeeded( IDispatch( OleProperty ).QueryInterface( SWBemObject, Item ) ) then begin
    Result := Item.Path_.RelPath;
  end
  else begin
    Result := '<Unknown>';
  end;
end;
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-

Hope this helps :)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ProgsX
ID: 17998849
0
 
LVL 16

Expert Comment

by:CodedK
ID: 17999780
Strange... i can download it from my browser.

Try from here :
http://www.geocities.com/kalatz_gr_fisher/TheFiles/WbemScripting_TLB.pas
0
 
LVL 4

Expert Comment

by:David_Ward
ID: 18006661
CPU serial number?

Available on -some- PentiumIIIs not available on anything pre P3 and NOT available on anything after P3 either :(
0
 
LVL 4

Expert Comment

by:David_Ward
ID: 18006665
@CodeK: Nice one! WMI is the -only- way to fly.
0
 
LVL 16

Expert Comment

by:CodedK
ID: 18006667
:)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
When I am typing into a TEdit last word repeats 7 175
find a node in VST 2 91
tvirtualstringtree freeze when load too manny images 10 90
Delphi android app hide keyboard 3 80
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question