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)