Intel P3 chips have a built in id! That sucks!

P3 Serial Un-Support Page

Update
Intel dropped the serial feature with P4 1.5 GHz; at least this was their announcement to public.
 
Introduction
I personally don't like Intel PIII processors having a serial number embedded. I believe this would lead to a worse 'big brother' situation than we are already experiencing, if this serial thing gets used more and more by computer users.
 
Thank god, and privacy groups, Intels CPU serial disabling app is distributed with WIN98 and new BIOS setups include options for disabling the number. Though all these disabling mechanisms has security holes, they are better than nothing.
 
As a programmer and author of misc. freeware applications, i decided to disable my applications (and mind you they're free) if CPU is Intel, serial number exists and enabled. [All my future free apps will have this feature and won't work if CPU is Intel, serial exists and enabled]. IMHO, this will increase user awareness of the serial number and its possible implications...
 
In this page i'll provide source code i've written for the purpose stated above. Additions, corrections are welcome.
 
Have fun!
Burak KALAYCI
burakk@buraks.com(preferred)
burakk@eastandwest.net
Note: burakk@usa.net was one of my old emails. I don't have access to it anymore.
 
Index
Borland Delphi
Microsoft Visual C++
Macromedia Director

 
DELPHI
Below is the source code for the Delphi unit CPUID (cpuid.pas). ShouldIRun function returns a boolean value.
Note: GetCpuId function does not get the CPU ID or serial, it just returns a result code
Note: This code does not attempt to check if it's running on anything less than a Pentium class processor.
Note: Hey, i'd be glad to publish your optimizations to the below code on this page! I don't have the time for optimizations, it works and at the moment that's enough for me... The reason for all non-optimal code and misleading function names is that this code is actually a crippled version of another unit :(

 
//By Burak KALAYCI, released to Public Domain
unit cpuid;
 
interface
 
var
 VendorId:ShortString;
 SerialNumber:longbool;
 
 function GetCpuId:integer;
 function ShouldIrun:boolean;
 
implementation
 
function ShouldIrun:boolean;
begin
 result:=true;
 GetCpuId;
 if Vendorid='GenuineIntel' then
 begin
  if SerialNumber then result:=false;
 end;
end;
 
function GetCpuId:integer;
begin
 asm
  push eax
  push ebx
  push ecx
  push edx
  push esi
 
  //check if cpuid is supported
  pushfd
  pop eax
  mov ecx,eax //eax=ecx=eflags
  xor eax,$200000
  push eax
  popfd
  pushfd
  pop eax
  xor eax,ecx//can not toggle bit 21
  jz @nocpuid
  push ecx
  popfd //restore eflags
 
  mov eax,0h
  db $0f;db $a2 //CPUID
 
  lea esi,VendorId
  mov byte ptr esi[0],12
  mov dword ptr esi[1],ebx
  mov dword ptr esi[5],edx
  mov dword ptr esi[9],ecx
 
  mov eax,1h
  db $0f;db $a2 //CPUID
 
  and edx,$40000 //test bit 18 serial number enabled/supported
  jz @nonum
  mov SerialNumber,1
  mov result,1
  jmp @exit
 
@nocpuid:
  mov result,-1
  jmp @exit
 
@nonum:
  mov SerialNumber,0
  mov result,0
 
@exit:
  pop esi
  pop edx
  pop ecx
  pop ebx
  pop eax
 end;
end;
 
end.

 
C++ (Compiles with MS Visual C++, tested with version 5)
Below is a code sniplet that loads SerialNumber with 1 if CPU is Intel, has serial and it's enabled. Else SerialNumber will be 0.
Note: This code does not attempt to check if it's running on anything less than a Pentium class processor.
Note: This version is more compact than the Delphi version.

 
 ...
//By Burak KALAYCI, released to Public Domain
 int SerialNumber;
 
  __asm
  {
   //check if cpuid is supported
   pushfd
   pop eax
   mov ecx,eax //eax=ecx=eflags
   xor eax,0x200000
   push eax
   popfd
   pushfd
   pop eax
   xor eax,ecx//can we toggle bit 21
   jz _nocpuid
   push ecx
   popfd
 
   mov eax,0h
   _emit 0x0f
   _emit 0xa2 //CPUID
 
   mov eax,0x756e6547
   cmp ebx,eax
   jnz _notintel
   mov eax,0x49656e69
   cmp edx,eax
   jnz _notintel
   mov eax,0x6c65746e
   cmp ecx,eax
   jnz _notintel
 
   mov eax,1h
   _emit 0x0f
   _emit 0xa2 //CPUID
 
   and edx,0x40000 //test bit 18 serial number enabled/supported
   jz _nonum
 
   mov SerialNumber,1
   jmp _exithere
 
 _nocpuid:
 _notintel:
 _nonum:
   mov SerialNumber,0
 _exithere:
 }
 //Check SerialNumber here!
 ...

 
Lingo
Macromedia Directors scripting language Lingo is not powerful enough to support serial checking natively, but with Xtras it is possible. You can download free Xtra (which uses the C++ code snipplet above) and use the following Lingo code snipplet:

 
if CpuSerialPresent() then
   quit -- or whatever
end
 
Download the Xtra (bkCpuId.zip for WIN D6+ No documentation ~12k)
(This Xtra, bkCpuId.X32 is freeware and there is no limits on usage at your own risk!)

 

Code last updated: 07 December 1999
Document Last Modified:
Copyright © 1999-2002 Burak KALAYCI
All trademarks and registered trademarks acknowledged.