Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to generate a unique hardware ID / fingerprint


  • Please log in to reply
37 replies to this topic
tic
  • Members
  • 1934 posts
  • Last active: May 30 2018 08:13 PM
  • Joined: 22 Apr 2007

The processor ID, description info is better (and you can get it in AHK without any external tool)


where is there an explanation of how to get this? do you mean with dllcalls? and if so could you give me an example?

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
You gave the link: http://grafi.ii.pw.e.../x86/cpuid.html. Write a few lines of C code, with the inlined assembler instruction 0fh 0a2h, compile it and include in your AHK script its hex version, as described here. (I will be traveling for the next two weeks, so I can only do it after I return, if nobody does it before.)

tic
  • Members
  • 1934 posts
  • Last active: May 30 2018 08:13 PM
  • Joined: 22 Apr 2007
I'm confused. I got that disassembler, and got geared up, but then which dllcall should i be using from that link? in order to get the machine code?

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
This is what I meant (written just before takeoff):
MCode(ByRef code, hex) { ; allocate memory and write Machine Code there
   VarSetCapacity(code,StrLen(hex)//2)
   Loop % StrLen(hex)//2
      NumPut("0x" . SubStr(hex,2*A_Index-1,2), code, A_Index-1, "Char")
}

MCode(CPUID,"538b4424080fa2508b44241489188b44241889088b44241c89105b8b44240c89185bc3")

VarSetCapacity(a,4,0), VarSetCapacity(b,4,0), VarSetCapacity(c,4,0), VarSetCapacity(d,4,0)
dllcall(&CPUID,"UInt",0, "Str",a, "Str",b, "Str",c, "Str",d, "CDECL")
s = A = 0: %b%%d%%c%`n

SetFormat Integer, Hex
VarSetCapacity(a,4,0), VarSetCapacity(b,4,0), VarSetCapacity(c,4,0), VarSetCapacity(d,4,0)
dllcall(&CPUID,"UInt",1, "Uint*",a, "UInt*",b, "UInt*",c, "UInt*",d, "CDECL")
s = %s%A = 1: %a% %b% %c% %d%`n

VarSetCapacity(a,4,0), VarSetCapacity(b,4,0), VarSetCapacity(c,4,0), VarSetCapacity(d,4,0)
dllcall(&CPUID,"UInt",2, "Uint*",a, "UInt*",b, "UInt*",c, "UInt*",d, "CDECL")
s = %s%A = 2: %a% %b% %c% %d%`n

VarSetCapacity(a,4,0), VarSetCapacity(b,4,0), VarSetCapacity(c,4,0), VarSetCapacity(d,4,0)
dllcall(&CPUID,"UInt",3, "Uint*",a, "UInt*",b, "UInt*",c, "UInt*",d, "CDECL")
s = %s%A = 3: %a% %b% %c% %d%`n

MsgBox %s%

The CPUID machine code function was compiled by VS'05 and converted to hex stream. Its source code is (with the appropriate typedef for uint):
typedef unsigned long uint;

void CPUID(uint x, uint* a, uint* b, uint* c, uint* d) { // x=select, [a,b,c,d]=result
   __asm {
      mov eax, x
      cpuid
      push eax
      mov eax, DWORD PTR [b]
      mov DWORD PTR [eax], ebx
      mov eax, DWORD PTR [c]
      mov DWORD PTR [eax], ecx
      mov eax, DWORD PTR [d]
      mov DWORD PTR [eax], edx
      pop ebx
      mov eax, DWORD PTR [a]
      mov DWORD PTR [eax], ebx
   }
}
If the result is not string, use "UInt32*" in place of "Str" in the dllcall, which, in fact, does not call any dll, but the machine code function put in the CPUID AHK variable by the MCode function.

See the cited http://grafi.ii.pw.e.../x86/cpuid.html for other information returned by CPUID at different first parameters.

Edit 20071023: The above url seems to be dead. Use http://en.wikipedia.org/wiki/CPUID instead.
Edit 20071030: The register EAX is also returned (before EBX, ECX and EDX)

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Most of the information on your CPU you can also be found in the registry (HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0), see Mustang's post but that could be edited or the access to the registry be intercepted. Using the CPUID command directly is more secure.

rookies
  • Guests
  • Last active:
  • Joined: --
what is unique hardware id ??

Icarus
  • Members
  • 851 posts
  • Last active: Jan 02 2012 11:17 AM
  • Joined: 24 Nov 2005

what is unique hardware id ??

Some software providers generate a registration key for their software that will only work on your specific computer.
If you take this registration key to another computer it will not work.

They way do it, is to generate the key not only based on your username / email address, but to also use some parameters that identify your computer.

It can be anything really - serial numbers of specific hardware pieces, volume serial numbers of your hard drives, environment variables that are different from one computer to another (although not really considered "hardware" id) and so on.

They mix it all together plus your name and emil address, and generate akey based on this.

tic
  • Members
  • 1934 posts
  • Last active: May 30 2018 08:13 PM
  • Joined: 22 Apr 2007
I dont understand it Laszlo. I want to try to gain more useful information about the cpu, but I just cant understand how to do it

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Set the first parameter to:
0: Get vendor ID 
1: Processor Info and Feature Bits 
2: Cache and TLB Descriptor Info 
3: Processor Serial Number 
0x80000000: Get Highest Extended Function Supported 
0x80000001: Extended Processor Info and Feature Bits 
0x80000002,0x80000003,0x80000004: Processor Brand String
For eaxample, Feature Bits
SetFormat Integer, Hex
dllcall(&CPUID,"UInt",1, "UInt*",a, "UInt*",b, "UInt*",c, "UInt*",d, "CDECL")
MsgBox %a%  %b%  %c%  %d%

Edit 20071030: added extra parameter "a", to match the last version of CPUID

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Updated CPUID, such that the register EAX is also returned (before EBX, ECX and EDX).

hingman
  • Guests
  • Last active:
  • Joined: --
HardwareID DLL is reliable API to generate unique simplified ID to identify each computer. You can use this ID to lock each license just by machine with your existing license copy protection. Now you can prevent unauthorized installation or coping and increase your sales.

Key Features of AzSDK HardwareID:
*Support .NET and Win32 application.
*Support generate unique simplified ID to identify each computer and yours each programs.
*support many development languages, such as Delphi, C++Builder, VC, C#, VB, VB.NET, PowerBuilder, Visual Foxpro, Clarion ect.
*Hardware ID is affordable and reliable API than dongle price and easy to use.
*Hardware ID is a simplified ID so that anyone can communicate by phone, fax or email.
*No delay time to delivery your software, no need to send anything by post.
*Supports Windows 9x/Me/NT/2000/XP/2003/Vista 32bit.

For more information, Please visit http://www.azsdk.com/hardwareid.html

Oberon
  • Members
  • 442 posts
  • Last active: Jul 03 2008 11:34 PM
  • Joined: 18 Feb 2008
It reads like you are advertising hingman, are you the author of the tool you have just described? Nearly every type of hardware ID mentioned is easily available in the registry or via other system commands/API i.e. run ipconfig /all to get local MAC address. Users on this forum have also posted 100% AutoHotkey script code for UUIDs so you don't need to resort to risky machine code or third party shareware.

Sarah
  • Members
  • 103 posts
  • Last active: Oct 12 2009 05:42 PM
  • Joined: 12 Jul 2007

Updated CPUID, such that the register EAX is also returned (before EBX, ECX and EDX).


Laszlo, I am wondering if you know how to adapt this, so it works on newer 64-bit machines?

<!-- m -->http://www.autohotke... ... highlight=<!-- m -->

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
I don’t have access to 64-bit Windows. The CPU instructions should still work, but Windows might prevent the function from running properly.

Sarah
  • Members
  • 103 posts
  • Last active: Oct 12 2009 05:42 PM
  • Joined: 12 Jul 2007
I am wondering, does anyone get data back from

3: Processor Serial Number

Tested on 32-Bit Intel: Nothing :|
Tested on 64-Bit AMD: Nothing :|

... just curious what this result is supposed to look like, or supposed to be some kinda hybrid cpu that would carry this information :?