Click here to Skip to main content
Licence GPL3
First Posted 6 Mar 2004
Views 83,692
Bookmarked 15 times

Get the PIII processor serial number (psn) in Intel format

By | 6 Mar 2004 | Article
How to get the PIII processor serial number (psn) in Intel format

Sample Image - maximum width is 600 pixels

Introduction

Many programmers always ask how to make their program run on a single computer. This code is one way for that and it gets the serial number in Intel format.

Background

To understand the code you need to know some assembly and the cpuid instruction and how it works. You can get more information from www.intel.com

Using the code

To use the code simply paste this function to your class dialog

/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
this code is written by:
Programmer:haitham hamed housin
description: get the PIII processor serial number (psn) like intel format
USE:to restrict your programs to run on single computer
classification: security 
demand: i need information about P4 PSN i can't belive that they ignore it

need more information contact me 

e-mail: haitham_hamed@yahoo.com
icq#148814438

or 
get the PIII PSN .pdf file for more understanding from intel

www.intel.com
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
void CPiiisnDlg::GetProcessorSeialNumbet(bool withSeparator)
{
DWORD  t,m,b; //top,middle,botttom
DWORD* serial;
  _asm
  {
    mov   eax,1 //programmer: I need a Service ?
         //processor: what type baby?
      //eax = 3 --> 
       //eax: top 32 bits are the processor signature bits
         

       //programmer:this
    cpuid     //_emit 0x0f |cpuid mean this tow instruction
          //_emit 0xa2 |instead of writing them 
       //       
    //mean:the sevice i want the processor serial number

 mov   t,eax // top 32 bits are the processor signature bits
           /* 
          eax = 3 --> 
        ecx: middle 32 bits are the processor signature bits
         edx: bottom 32 bits are the processor signature bits
      */
    mov   eax,3
    cpuid
    mov   m,edx// middle 32 bits are the processor signature bits
    mov   b,ecx// bottom 32 bits are the processor signature bits
  }

  // copy the locals into the pointer variables passed in
  serial[0] = b;
  serial[1] = m;
  serial[2] = t;


CString temp;
m_SN.Empty();
static char hex_chars[16] = {'0','1','2','3','4','5','6','7',
                 '8','9','A','B','C','D','E','F'};
for (int dw_count = 2; dw_count>=0; dw_count--)
  {
    for (int bp=28; bp>=0; bp-=4)
    {
      DWORD nibble = (serial[dw_count] >> bp) & 0x0f;
      temp.Format("%c", hex_chars[nibble]);
   m_SN+=temp;
      if ((bp == 16) || ((bp == 0) && (dw_count!=0)) )
    if(withSeparator)m_SN+="-";
    }
  }
UpdateData(FALSE);
}

Points of Interest

I can't believe that P4 has no sn and if any one knows any thing on that please contact me.

History

  • 3-5-2004 first version

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

About the Author

haitham hamed housin

Web Developer

Egypt Egypt

Member

my name haitham hamed housin (egypt)
i like programming and hardware interface
in controling things to make it think
 
www.enghaithamhamed.4t.com

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralThanks ! PinmemberETA21:14 8 Jul '07  
Generalprocessor serial number is not supported for P4 Pinmemberlaoda laoda22:50 4 Oct '06  
GeneralPlay Nice PinmemberPolymorpher15:45 8 Jun '06  
JokeRe: Play Nice Pinmemberhaitham hamed housin21:47 11 Jun '06  
GeneralRe: Play Nice PinmemberPolymorpher2:45 12 Jun '06  
Generalp4... Pinmembertoxcct2:07 9 Feb '06  
"I can't believe that P4 has no sn and if any one knows any thing on that please contact me"
 
why don't you read the Intel P4 documentation book, as anyone that code for microprocessors does ?
 
Unsure | :~
 

TOXCCT >>> GEII power
[toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
GeneralRe: p4... Pinmemberhaitham hamed housin3:09 9 Feb '06  
GeneralRe: p4... Pinmembertoxcct3:14 9 Feb '06  
GeneralRe: p4... Pinmemberhaitham hamed housin3:33 9 Feb '06  
GeneralP4 doesn't support serial number Pinmembermichalvalny15:27 6 May '05  
Questionget the p4 processor serial nuber? Pinmemberyounghoyu16:58 10 Jun '04  
GeneralCode Pinmemberrenato czar tome21:24 12 Mar '04  
GeneralRe: Code Pinmemberzero_code19:49 17 Mar '04  
GeneralGurkan is a programmer Pinmemberzero_code10:30 10 Mar '04  
GeneralFor Programmers Only Pinmemberzero_code10:18 10 Mar '04  
GeneralGetProcessorSeialNumbet() PinmemberDavidCrow2:06 9 Mar '04  
GeneralRe: GetProcessorSeialNumbet() Pinmemberzero_code10:07 10 Mar '04  
GeneralRe: GetProcessorSeialNumbet() PinmemberDavidCrow3:39 11 Mar '04  
GeneralI'm puzzle Pinsusssuper xsc16:37 19 Aug '04  
GeneralNot a lot of point, unfortunately... PinmemberJulian Nicholls0:25 9 Mar '04  
GeneralRe: Not a lot of point, unfortunately... Pinmemberzero_code10:27 10 Mar '04  
GeneralRe: Not a lot of point, unfortunately... PinmemberJulian Nicholls21:47 10 Mar '04  
GeneralRe: Not a lot of point, unfortunately... Pinmemberzero_code2:02 12 Mar '04  
Generalcrashing PinmemberAtif Mushtaq23:35 7 Mar '04  
GeneralRe: crashing PinmemberGurkan1:36 8 Mar '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 7 Mar 2004
Article Copyright 2004 by haitham hamed housin
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid