Getting the System Hardware Fingerprint (XP/2003/Vista)

Share your advanced PureBasic knowledge/code with the community.
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by idle »

maybe this one is ok not sure if it's unique though or present on every platform

Code: Select all

Procedure.s RegGetValue(topKey, sKeyName.s, sValueName.s, ComputerName.s = "")
  Protected lpData.s=Space(255), GetValue.s
  Protected GetHandle.l, hKey.l, lReturnCode.l, lhRemoteRegistry.l, lpcbData.l, lType.l, lpType.l
  Protected lpDataDWORD.l

  If Left(sKeyName, 1) = "\"
    sKeyName = Right(sKeyName, Len(sKeyName) - 1)
  EndIf

  If ComputerName = ""
    GetHandle = RegOpenKeyEx_(topKey, sKeyName, 0, #KEY_ALL_ACCESS, @hKey)
  Else
    lReturnCode = RegConnectRegistry_(ComputerName, topKey, @lhRemoteRegistry)
    GetHandle = RegOpenKeyEx_(lhRemoteRegistry, sKeyName, 0, #KEY_ALL_ACCESS, @hKey)
  EndIf

  If GetHandle = #ERROR_SUCCESS
    lpcbData = 255
    
    GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lType, @lpData, @lpcbData)

    If GetHandle = #ERROR_SUCCESS
      Select lType
        Case #REG_SZ
          GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lType, @lpData, @lpcbData)

          If GetHandle = 0
            GetValue = Left(lpData, lpcbData - 1)
          Else
            GetValue = ""
          EndIf

        Case #REG_DWORD
          GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lpType, @lpDataDWORD, @lpcbData)

          If GetHandle = 0
            GetValue = Str(lpDataDWORD)
          Else
            GetValue = "0"
          EndIf
        Case #REG_BINARY 
           
          *bdat=AllocateMemory(lpcbdata)           
          GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lpType, *bdat, @lpcbData)
          If GetHandle = 0
            While a = < lpcbData -1
              GetValue + RSet(Hex(PeekB(*bdat+a) & $FF,1),2,"0") 
              a+1
            Wend 
          Else
            GetValue = ""
          EndIf
          FreeMemory(*bdat) 
      EndSelect
    EndIf
  EndIf
  RegCloseKey_(hKey)
  ProcedureReturn GetValue
EndProcedure


Procedure.s HardwareFingerprint1()
  tstr$ = RegGetValue(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\MSLicensing\HardwareID","ClientHWID")
  debug tstr$ 
ProcedureReturn MD5Fingerprint(@tstr$,Len(tstr$))
EndProcedure

Debug HardwareFingerprint1()
XP SP3
7773087479b68830054da9c45a61b398
Last edited by idle on Wed Sep 23, 2009 10:37 am, edited 1 time in total.
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by dell_jockey »

XP-Prof, SP2:
b1a71c8505aa6326fd595b0b7cbdb4db
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by SFSxOI »

"SOFTWARE\Microsoft\MSLicensing\HardwareID\" key is suppose to be unique for each and every system. Sometimes in non-networked computers you find it to be the same when the OS is installed via VLK install, in this case the solution is to simply delete the ClientHWID and reboot and a new unique one will be generated. I'll check this out a little later on my home networked machines, but it seems to be giving unique ID's here at work right now. However, this is still software based and will change with a reformat and/or re-install.

You can also use WMI in the Win32_WindowsProductActivation by getting the ProductID which is unique to each system but thats software based and not hardware based.

For hardware ID thats based on hardware you really have to generate your own in some respects or use something thats hardware like the MAC Address, HDD Serial number (not the volume serial number because volume serial numbers is a 32-bit number determined by the date on the current computer at the time of a disk's formatting, so if the hard drive is formatted the volume serial number will change.) , etc.....something in hardware that can't be changed.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by idle »

Another attempt enums through the pnp manager, even though these keys a volitile the majority of them will remain fixed
I don't know how the results will stack up on identical machines.

Code: Select all

; Idle 
; Hardware fingerprints enums through the pnpmanager keys, data should be unique for each machine
; Note the pnpmanager keys are volatile so a couple may change after a reboot, though majority will remain fixed.
; Grabs the Terminal services license key (this can be manually deleted by a user and it will generate another one) 
; Grab the mac address of the default adapter 


; GetAdapterInfo()   
; ABBKlaus Mon May 17, 2004 20:16 
; http://msdn2.microsoft.com/en-us/library/aa365917.aspx
; with the help of IPHlpAPI.inc from the Powerbasic include-file for the structures
; Microsoft isn´t quite a help here :-)
; modified by PSW Wed Sep 06, 2006 07:49
; PB4.02 compatible since 29.05.2007 19:48
; PB4.10 compatible on 23.12.2007 21:03
; added more commands 31.12.2007 17:09
 

ImportC "msvcrt.lib"
  asctime.l(a.l)
  localtime.l(a.l)
  strftime.l(a.l,b.l,c.p-ascii,d.l)
EndImport

Structure IP_ADDR_STRING
  pNext.l
  IpAddress.b[16]
  IpMask.b[16]
  Context.l
EndStructure

Structure TM
  tm_sec.l
  tm_min.l
  tm_hour.l
  tm_mday.l
  tm_mon.l
  tm_year.l
  tm_wday.l
  tm_yday.l
  tm_isdst.l
EndStructure

#MAX_ADAPTER_NAME=128
#MAX_ADAPTER_NAME_LENGTH=256
#MAX_ADAPTER_DESCRIPTION_LENGTH=128
#MAX_ADAPTER_ADDRESS_LENGTH=8

#MIB_IF_TYPE_OTHER     = 0
#MIB_IF_TYPE_ETHERNET  = 1
#MIB_IF_TYPE_TOKENRING = 2
#MIB_IF_TYPE_FDDI      = 3
#MIB_IF_TYPE_PPP       = 4
#MIB_IF_TYPE_LOOPBACK  = 5
#MIB_IF_TYPE_SLIP      = 6

Structure IP_ADAPTER_INFO
  pNext.l
  ComboIndex.l
  AdapterName.b[#MAX_ADAPTER_NAME_LENGTH+4]
  Description.b[#MAX_ADAPTER_DESCRIPTION_LENGTH+4]
  AddressLength.l
  Address.b[#MAX_ADAPTER_ADDRESS_LENGTH]
  Index.l
  Type.l
  DhcpEnabled.l
  CurrentIpAddressPTR.l
  IpAddressList.IP_ADDR_STRING
  GatewayList.IP_ADDR_STRING
  DhcpServer.IP_ADDR_STRING
  HaveWins.l
  PrimaryWinsServer.IP_ADDR_STRING
  SecondaryWinsServer.IP_ADDR_STRING
  LeaseObtained.l
  LeaseExpires.l
EndStructure

Structure IP_ADAPTER_INDEX_MAP
  Index.l
  Name.w[#MAX_ADAPTER_NAME]
EndStructure

Structure IP_INTERFACE_INFO
  NumAdapters.l
  Adapter.IP_ADAPTER_INDEX_MAP[1]
EndStructure

Structure MyIP_ADAPTER_INFO
  Index.l
  AdapterName.s
  Description.s
  MACAddress.s
  IPAdress.s
  GateWayAdress.s
  IPMask.s
EndStructure

Structure MyIP_INTERFACE_INFO
  Index.l
  Name.s
EndStructure

Procedure GetAdaptersInfo()
  Protected length.l=0,Result.l,*Buffer,*Buffer2,*ipinfo.IP_ADAPTER_INFO,*iplist.IP_ADDR_STRING
  Protected mac$,i.l,byte.b
 
  Result=GetAdaptersInfo_(0,@length) ; Get the length for Buffer
  If Result=#ERROR_BUFFER_OVERFLOW And length
    *Buffer=AllocateMemory(length)
    If *Buffer And GetAdaptersInfo_(*Buffer,@length)=#ERROR_SUCCESS
      *ipinfo.IP_ADAPTER_INFO=*Buffer
      Global NewList MyIPAdapterList.MyIP_ADAPTER_INFO() ; declare list here
      While *ipinfo
        AddElement(MyIPAdapterList()) ; add one element
        ;Debug "Index : "+Str(*ipinfo\Index)
        MyIPAdapterList()\Index=*ipinfo\Index
        Select *ipinfo\Type
          Case #MIB_IF_TYPE_OTHER
            ;Debug "Type : #MIB_IF_TYPE_OTHER"
          Case #MIB_IF_TYPE_ETHERNET
            ;Debug "Type : #MIB_IF_TYPE_ETHERNET"
          Case #MIB_IF_TYPE_TOKENRING
            ;Debug "Type : #MIB_IF_TYPE_TOKENRING"
          Case #MIB_IF_TYPE_FDDI
            ;Debug "Type : #MIB_IF_TYPE_FDDI"
          Case #MIB_IF_TYPE_PPP
            ;Debug "Type : #MIB_IF_TYPE_PPP"
          Case #MIB_IF_TYPE_LOOPBACK
            ;Debug "Type : #MIB_IF_TYPE_LOOPBACK"
          Case #MIB_IF_TYPE_SLIP
            ;Debug "Type : #MIB_IF_TYPE_SLIP"
          Default
            ;Debug "Type : unknown"
        EndSelect
         
        MyIPAdapterList()\AdapterName=PeekS(@*ipinfo\AdapterName,-1,#PB_Ascii)
        MyIPAdapterList()\Description=PeekS(@*ipinfo\Description,-1,#PB_Ascii)
         
        ;IP-Adress
        *iplist.IP_ADDR_STRING=*ipinfo\IpAddressList
        While *iplist
           
          MyIPAdapterList()\IPAdress+PeekS(@*iplist\IpAddress,-1,#PB_Ascii) 
          MyIPAdapterList()\IPMask+PeekS(@*iplist\Ipmask,-1,#PB_Ascii) 
          *iplist.IP_ADDR_STRING=*iplist\pNext
              
        Wend
              
        ;Gateway
        *iplist.IP_ADDR_STRING=*ipinfo\GatewayList
        While *iplist
           
          MyIPAdapterList()\GateWayAdress+PeekS(@*iplist\IpAddress,-1,#PB_Ascii)  
          *iplist.IP_ADDR_STRING=*iplist\pNext
        Wend
        ;Wins
        If *ipinfo\HaveWins
          ;PrimaryWinsServer
          *iplist.IP_ADDR_STRING=*ipinfo\PrimaryWinsServer
          While *iplist
             
            *iplist.IP_ADDR_STRING=*iplist\pNext
          Wend
          ;SecondaryWinsServer
          *iplist.IP_ADDR_STRING=*ipinfo\SecondaryWinsServer
          While *iplist
             
            *iplist.IP_ADDR_STRING=*iplist\pNext
          Wend
        EndIf
        ;DHCP
        If *ipinfo\DhcpEnabled
          ;DhcpServer
          *iplist.IP_ADDR_STRING=*ipinfo\DhcpServer
          While *iplist
             
            *iplist.IP_ADDR_STRING=*iplist\pNext
          Wend
          ;LeaseObtained
          *Buffer2=AllocateMemory(#MAXCHAR)
          If *Buffer2
            strftime(*Buffer2,#MAXCHAR,"%d.%m.%Y %H:%M:%S",localtime(@*ipinfo\LeaseObtained))
             
            FreeMemory(*Buffer2)
            *Buffer2=0
          EndIf
          ;LeaseExpires
          *Buffer2=AllocateMemory(#MAXCHAR)
          If *Buffer2
            strftime(*Buffer2,#MAXCHAR,"%d.%m.%Y %H:%M:%S",localtime(@*ipinfo\LeaseExpires))
             
            FreeMemory(*Buffer2)
            *Buffer2=0
          EndIf
        Else
           
        EndIf
         
        If *ipinfo\AddressLength
          mac$=""
          For i=0 To *ipinfo\AddressLength-1
            If i
              mac$+":"
            EndIf
            byte.b=PeekB(@*ipinfo\Address+i)
            If byte>=0
              mac$+RSet(Hex(byte),2,"0")
            Else
              mac$+RSet(Hex(byte+256),2,"0")
            EndIf
          Next
           
          MyIPAdapterList()\MACAddress=mac$
        EndIf
        *ipinfo.IP_ADAPTER_INFO=*ipinfo\pNext
      Wend
    EndIf
    If *Buffer
      FreeMemory(*Buffer)
      *Buffer=0
    EndIf
  EndIf
EndProcedure

;##################################################################################

;Hardware fingerprints enums through the pnpmanager, hopefully data will be unique for each machine
;the keys are volitile and a couple may change on reboot.
;Grabs the terminal serivces licnese key (this can be manually deleted by a user and it will generate another) 
;grab the mac address of the default addaptor   

Procedure.s RegGetValue(topKey, sKeyName.s, sValueName.s, ComputerName.s = "")
  Protected lpData.s=Space(255), GetValue.s
  Protected GetHandle.l, hKey.l, lReturnCode.l, lhRemoteRegistry.l, lpcbData.l, lType.l, lpType.l
  Protected lpDataDWORD.l

  If Left(sKeyName, 1) = "\"
    sKeyName = Right(sKeyName, Len(sKeyName) - 1)
  EndIf

  If ComputerName = ""
    GetHandle = RegOpenKeyEx_(topKey, sKeyName, 0, #KEY_READ	, @hKey)
  Else
    lReturnCode = RegConnectRegistry_(ComputerName, topKey, @lhRemoteRegistry)
    GetHandle = RegOpenKeyEx_(lhRemoteRegistry, sKeyName, 0, #KEY_READ	, @hKey)
  EndIf

  If GetHandle = #ERROR_SUCCESS
    lpcbData = 255
   
    GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lType, @lpData, @lpcbData)

    If GetHandle = #ERROR_SUCCESS
      Select lType
        Case #REG_SZ
          GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lType, @lpData, @lpcbData)

          If GetHandle = 0
            GetValue = Left(lpData, lpcbData - 1)
          Else
            GetValue = ""
          EndIf

        Case #REG_DWORD
          GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lpType, @lpDataDWORD, @lpcbData)

          If GetHandle = 0
            GetValue = Str(lpDataDWORD)
          Else
            GetValue = "0"
          EndIf
        Case #REG_BINARY
           
          *bdat=AllocateMemory(lpcbdata)           
          GetHandle = RegQueryValueEx_(hKey, sValueName, 0, @lpType, *bdat, @lpcbData)
          If GetHandle = 0
            While a = < lpcbData -1
              GetValue + RSet(Hex(PeekB(*bdat+a) & $FF,1),2,"0")
              a+1
            Wend
          Else
            GetValue = ""
          EndIf
          FreeMemory(*bdat)
      EndSelect
    EndIf
  EndIf
  RegCloseKey_(hKey)
  ProcedureReturn GetValue
EndProcedure

;Note the keys are volitile and a couple of keys may change on reboot 
Procedure.s RegListValue(topkey, key$, index)
Protected result$="", valuename$, valuesize, error, hKey=0,lpcbData.l
Protected lpData.s=Space(2048)

If RegOpenKeyEx_(topkey,@key$,0,#KEY_READ	,@hKey)=#ERROR_SUCCESS
  valuename$ = Space(2048)
  valuesize = Len(valuename$)+1
  lpcbData = 2048
  error = RegEnumValue_(hKey,index,@valuename$,@valuesize,0,@lType, @lpData, @lpcbData)
  If error=#ERROR_SUCCESS
    If lType = 8 
       *bdat=AllocateMemory(lpcbdata)
       tres.s            
       GetHandle = RegQueryValueEx_(hKey,valuename$, 0, @lpType, *bdat, @lpcbData)
       If FindString(valuename$,"Raw",1) And (FindString(valuename$,"NTPNP",1) Or FindString(valuename$,"Ide",1));only look at the keys that match 
          If GetHandle = 0
              While a = < lpcbData -1
                tres + RSet(Hex(PeekB(*bdat+a) & $FF,1),2,"0")
                a+1
              Wend
          EndIf   
          If tres <> "" 
            result$ = MD5Fingerprint(@tres,Len(tres)) 
             
          EndIf 
       EndIf  
       FreeMemory(*bdat)
    EndIf 
  Else 
    result$ = "-1" 
  EndIf
  RegCloseKey_(hKey)
EndIf
ProcedureReturn result$
EndProcedure

Procedure.s HardwareFingerprint()
  tstr$ = RegGetValue(#HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\MSLicensing\HardwareID","ClientHWID")
   
ProcedureReturn MD5Fingerprint(@tstr$,Len(tstr$))
EndProcedure

Procedure.s GetMachineFingerPrints()
Protected index=0, ct,value$, result$
Repeat
  value$ = RegListValue(#HKEY_LOCAL_MACHINE,"HARDWARE\RESOURCEMAP\PnP Manager\PnpManager",index)
  If value$ <> "" And value$ <> "-1"  
    result$ + RSet(Str(ct),2,"0") + " " + value$  + #CRLF$ 
    Debug RSet(Str(ct),2,"0") + " " + value$
    ct+1 
  EndIf
  index+1
Until value$="-1"

ProcedureReturn result$

EndProcedure 

Procedure.s GetMacAdress()
 GetAdaptersInfo()
 ForEach MyIPAdapterList()
    gateway.s = MyIPAdapterList()\GatewayAdress
    If gateway <> "" And gateway <> "0.0.0.0"
      Mac.s = MyIPAdapterList()\MACAddress
    EndIf 
 Next
 
 ProcedureReturn Mac
 
EndProcedure

;Test 

res.s = GetMachineFingerPrints(); 
Debug HardwareFingerprint()
Debug GetMacAdress()
res + HardwareFingerprint() + #CRLF$ 
res + GetMacAdress()
MessageRequester("Finger Prints",res)

IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by IdeasVacuum »

Looking for only the MAC address, the code below works fine on WinXP 32bit but has a memory access failure on Win7 64bit?

Code: Select all

Structure IP_ADDR_STRING
  pNext.l
  IpAddress.b[16]
  IpMask.b[16]
  Context.l
EndStructure

#MAX_ADAPTER_NAME=128
#MAX_ADAPTER_NAME_LENGTH=256
#MAX_ADAPTER_DESCRIPTION_LENGTH=128
#MAX_ADAPTER_ADDRESS_LENGTH=8

#MIB_IF_TYPE_OTHER     = 0
#MIB_IF_TYPE_ETHERNET  = 1
#MIB_IF_TYPE_TOKENRING = 2
#MIB_IF_TYPE_FDDI      = 3
#MIB_IF_TYPE_PPP       = 4
#MIB_IF_TYPE_LOOPBACK  = 5
#MIB_IF_TYPE_SLIP      = 6

Structure IP_ADAPTER_INFO
  pNext.l
  ComboIndex.l
  AdapterName.b[#MAX_ADAPTER_NAME_LENGTH + 4]
  Description.b[#MAX_ADAPTER_DESCRIPTION_LENGTH + 4]
  AddressLength.l
  Address.b[#MAX_ADAPTER_ADDRESS_LENGTH]
  Index.l
  Type.l
  DhcpEnabled.l
  CurrentIpAddressPTR.l
  IpAddressList.IP_ADDR_STRING
  GatewayList.IP_ADDR_STRING
  DhcpServer.IP_ADDR_STRING
  HaveWins.l
  PrimaryWinsServer.IP_ADDR_STRING
  SecondaryWinsServer.IP_ADDR_STRING
  LeaseObtained.l
  LeaseExpires.l
EndStructure

Structure IP_ADAPTER_INDEX_MAP
  Index.l
  Name.w[#MAX_ADAPTER_NAME]
EndStructure

Structure IP_INTERFACE_INFO
  NumAdapters.l
  Adapter.IP_ADAPTER_INDEX_MAP[1]
EndStructure

Structure MyIP_ADAPTER_INFO
  Index.l
  AdapterName.s
  Description.s
  MACAddress.s
  IPAdress.s
  GateWayAdress.s
  IPMask.s
EndStructure

Structure MyIP_INTERFACE_INFO
  Index.l
  Name.s
EndStructure

Procedure GetAdaptersInfo()
;--------------------------

        Protected length.l=0,Result.l,*Buffer,*Buffer2,*ipinfo.IP_ADAPTER_INFO,*iplist.IP_ADDR_STRING
        Protected mac$,i.l,byte.b
        
        Result = GetAdaptersInfo_(0,@length) ; Get the length for Buffer
        
        If Result = #ERROR_BUFFER_OVERFLOW And length
          *Buffer = AllocateMemory(length)
        
                      If *Buffer And GetAdaptersInfo_(*Buffer,@length) = #ERROR_SUCCESS

                              *ipinfo.IP_ADAPTER_INFO=*Buffer
                              Global NewList MyIPAdapterList.MyIP_ADAPTER_INFO() ; declare list here
                              
                              While *ipinfo
                              
                                     AddElement(MyIPAdapterList()) ; add one element
                                     
                                     MyIPAdapterList()\Index=*ipinfo\Index
                                     MyIPAdapterList()\AdapterName=PeekS(@*ipinfo\AdapterName,-1,#PB_Ascii)
                                     MyIPAdapterList()\Description=PeekS(@*ipinfo\Description,-1,#PB_Ascii)
                                      
                                     ;IP-Adress
                                     *iplist.IP_ADDR_STRING=*ipinfo\IpAddressList
                                     
                                     While *iplist
                                        
                                       MyIPAdapterList()\IPAdress+PeekS(@*iplist\IpAddress,-1,#PB_Ascii) ; <--------- fails: invalid memory access (read error)
                                       MyIPAdapterList()\IPMask+PeekS(@*iplist\Ipmask,-1,#PB_Ascii)
                                       *iplist.IP_ADDR_STRING=*iplist\pNext
                                          
                                     Wend
                                          
                                     ;Gateway
                                     *iplist.IP_ADDR_STRING=*ipinfo\GatewayList
                                     
                                     While *iplist
                                        
                                       MyIPAdapterList()\GateWayAdress+PeekS(@*iplist\IpAddress,-1,#PB_Ascii) 
                                       *iplist.IP_ADDR_STRING=*iplist\pNext
                                     Wend
                                     
                                     If *ipinfo\AddressLength
                                          mac$=""
                              
                                          For i = 0 To *ipinfo\AddressLength-1
                              
                                                 If i
                                                        mac$ + ":"
                                                 EndIf
                              
                                                 byte.b=PeekB(@*ipinfo\Address+i)
                                                 
                                                 If byte >= 0
                                                         mac$ + RSet(Hex(byte),2,"0")
                                                 Else
                                                         mac$ + RSet(Hex(byte+256),2,"0")
                                                 EndIf
                              
                                          Next
                                           
                                          MyIPAdapterList()\MACAddress = mac$ 
                              
                                     EndIf
                              
                                     *ipinfo.IP_ADAPTER_INFO = *ipinfo\pNext
                              Wend

                      EndIf 

                      If *Buffer
                             FreeMemory(*Buffer)
                             *Buffer = 0
                      EndIf
        EndIf
EndProcedure

Procedure.s GetMacAddress()
;--------------------------

        GetAdaptersInfo()
        ForEach MyIPAdapterList()
        
            gateway.s = MyIPAdapterList()\GatewayAdress
        
            If gateway <> "" And gateway <> "0.0.0.0"
                   Mac.s = MyIPAdapterList()\MACAddress
            EndIf
        
        Next
        
        ProcedureReturn Mac

EndProcedure

sMac.s = GetMacAddress()
MessageRequester("Mac Address",sMac)

End
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by idle »

it's probably a padding issue with a structure but I can't help don't have 64bit system
Windows 11, Manjaro, Raspberry Pi OS
Image
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by IdeasVacuum »

...Hi Idle. Yeah, I think it is. I have tried tweaking the values but then get issues earlier or further down the line. That's because I don't understand the code. For example, in the IP_ADAPTER_INFO structure:

Code: Select all

AdapterName.b[#MAX_ADAPTER_NAME_LENGTH + 4]
  Description.b[#MAX_ADAPTER_DESCRIPTION_LENGTH + 4]
Tweaking the value (4) certainly does make a difference, but why does the code add 4 to a 'MAX' value in the first place?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
sphinx
Enthusiast
Enthusiast
Posts: 120
Joined: Thu Oct 26, 2006 6:34 pm
Contact:

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by sphinx »

I wrote a DLL in C++ which return the firmware serial number of the hard disk drive and I am using it with my LIS (Lab Information System) to protect and manage licenses of my clients.

I am giving my client the LIS installation file along with a registration file (Inno setup file) which installs a encrypted file of the firmware serial of the client HDD on his system, so he has no worries if he needs to format and reinstall the OS over and over again.

I am thinking of selling it as a shareware soon (for as little as $10 - $20, what do you think?) and it features :
- No Admin rights are required on Windows NT/2000/XP/Vista/7
- Very lightweight, only 40Kb
- Windows 9X/Me should be supported without problems (I did not test it but I will if I found good interest)
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by idle »

IdeasVacuum wrote:...Hi Idle. Yeah, I think it is. I have tried tweaking the values but then get issues earlier or further down the line. That's because I don't understand the code. For example, in the IP_ADAPTER_INFO structure:

Code: Select all

AdapterName.b[#MAX_ADAPTER_NAME_LENGTH + 4]
  Description.b[#MAX_ADAPTER_DESCRIPTION_LENGTH + 4]
Tweaking the value (4) certainly does make a difference, but why does the code add 4 to a 'MAX' value in the first place?
I don't know, maybe you could pm ABBKlaus and ask, it's his code.
Windows 11, Manjaro, Raspberry Pi OS
Image
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by IdeasVacuum »

Hello Sphinx

If the DLL needs to be distributed with the application to be protected, it could be spoofed.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
sphinx
Enthusiast
Enthusiast
Posts: 120
Joined: Thu Oct 26, 2006 6:34 pm
Contact:

Re: Getting the System Hardware Fingerprint (XP/2003/Vista)

Post by sphinx »

Hello Sphinx

If the DLL needs to be distributed with the application to be protected, it could be spoofed.
You are right, there is no absolute protection but you make it harder at least for the casual user to copy your software.
Also, if it is not a DLL and you link it directly with your executable, IS IT ANY MORE SAFER? I guess not!

For my LIS, The DLL is encrypted and I encrypt my EXE too but again anything can be cracked, you only make it difficult to some point if you know what I mean!
Post Reply