Click here to Skip to main content
11,435,407 members (50,538 online)
Click here to Skip to main content

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

, 6 Mar 2004 GPL3
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

Haitham Khedre
Software Developer (Senior)
United States United States
No Biography provided

Comments and Discussions

 
GeneralMessage Removed Pin
Michael Haephrati מיכאל האפרתי20-Feb-13 4:50
mvpMichael Haephrati מיכאל האפרתי20-Feb-13 4:50 
GeneralThanks ! Pin
ETA8-Jul-07 22:14
memberETA8-Jul-07 22:14 
Generalprocessor serial number is not supported for P4 Pin
laoda laoda4-Oct-06 23:50
memberlaoda laoda4-Oct-06 23:50 
GeneralPlay Nice Pin
Polymorpher8-Jun-06 16:45
memberPolymorpher8-Jun-06 16:45 
JokeRe: Play Nice Pin
haitham hamed housin11-Jun-06 22:47
memberhaitham hamed housin11-Jun-06 22:47 
GeneralRe: Play Nice Pin
Polymorpher12-Jun-06 3:45
memberPolymorpher12-Jun-06 3:45 
Generalp4... Pin
toxcct9-Feb-06 3:07
membertoxcct9-Feb-06 3:07 
GeneralRe: p4... Pin
haitham hamed housin9-Feb-06 4:09
memberhaitham hamed housin9-Feb-06 4:09 
GeneralRe: p4... Pin
toxcct9-Feb-06 4:14
membertoxcct9-Feb-06 4:14 
GeneralRe: p4... Pin
haitham hamed housin9-Feb-06 4:33
memberhaitham hamed housin9-Feb-06 4:33 
GeneralP4 doesn't support serial number Pin
michalvalny6-May-05 16:27
membermichalvalny6-May-05 16:27 
Questionget the p4 processor serial nuber? Pin
younghoyu10-Jun-04 17:58
memberyounghoyu10-Jun-04 17:58 
GeneralCode Pin
renato czar tome12-Mar-04 22:24
memberrenato czar tome12-Mar-04 22:24 
GeneralRe: Code Pin
zero_code17-Mar-04 20:49
memberzero_code17-Mar-04 20:49 
GeneralGurkan is a programmer Pin
zero_code10-Mar-04 11:30
memberzero_code10-Mar-04 11:30 
GeneralFor Programmers Only Pin
zero_code10-Mar-04 11:18
memberzero_code10-Mar-04 11:18 
GeneralGetProcessorSeialNumbet() Pin
DavidCrow9-Mar-04 3:06
memberDavidCrow9-Mar-04 3:06 
GeneralRe: GetProcessorSeialNumbet() Pin
zero_code10-Mar-04 11:07
memberzero_code10-Mar-04 11:07 
GeneralRe: GetProcessorSeialNumbet() Pin
DavidCrow11-Mar-04 4:39
memberDavidCrow11-Mar-04 4:39 
GeneralI'm puzzle Pin
super xsc19-Aug-04 17:37
susssuper xsc19-Aug-04 17:37 
GeneralNot a lot of point, unfortunately... Pin
Julian Nicholls9-Mar-04 1:25
memberJulian Nicholls9-Mar-04 1:25 
GeneralRe: Not a lot of point, unfortunately... Pin
zero_code10-Mar-04 11:27
memberzero_code10-Mar-04 11:27 
GeneralRe: Not a lot of point, unfortunately... Pin
Julian Nicholls10-Mar-04 22:47
memberJulian Nicholls10-Mar-04 22:47 
GeneralRe: Not a lot of point, unfortunately... Pin
zero_code12-Mar-04 3:02
memberzero_code12-Mar-04 3:02 
Generalcrashing Pin
Atif Mushtaq8-Mar-04 0:35
memberAtif Mushtaq8-Mar-04 0:35 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150428.2 | Last Updated 7 Mar 2004
Article Copyright 2004 by Haitham Khedre
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid