Solved

serial number

Posted on 2006-11-21
8
370 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
Independent Software Vendors: 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
drawing animated level bar based on numbers 3 111
firemonkey keyboard covers the controls 1 51
MS Access from Delphi 31 79
Firemonkey Listview item popup menu ? 1 29
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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