Jump to content

Search the Community

Showing results for tags 'id unique system guid'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. This function is based on _WinAPI_UniqueHardwareID() in WinAPIDiag.au3. The flags which can be used in this function are exactly the same flags as in _WinAPI_UniqueHardwareID(). Any problems please post below. Thanks. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetHardwareID ; Description ...: Generates a unique hardware identifier (ID) for the local computer. ; Syntax ........: _GetHardwareID([$iFlags = Default]) ; Parameters ....: $iFlags - [optional] The flags that specifies what information would be used to generate ID. ; This parameter can be one or more of the following values. ; ; $UHID_MB (0) ; Uses information about your motherboard. This flag is used by default regardless of whether specified or not. ; ; $UHID_BIOS (1) ; Uses information about the BIOS. ; ; $UHID_CPU (2) ; Uses information about the processor(s). ; ; $UHID_HDD (4) ; Uses information about the installed hard drives. Any change in the configuration disks will change ID ; returned by this function. Taken into account only non-removable disks. ; ; $UHID_All (7) ; The sum of all the previous flags. Default is $UHID_MB (0). ; ; $bIs64Bit - [optional] Search the 64-bit section of the registry. Default is dependant on AutoIt bit version. ; Note: 64-bit can't be searched when running the 32-bit version of AutoIt. ; Return values..: Success - The string representation of the ID. @extended returns the value that contains a combination of flags ; specified in the $iFlags parameter. If flag is set, appropriate information is received successfully, ; otherwise fails. The function checks only flags that were specified in the $iFlags parameter. ; Failure - Null and sets @error to non-zero. ; Author.........: guinness with the idea by Yashied (_WinAPI_UniqueHardwareID() - WinAPIDiag.au3) ; Modified ......: Additional suggestions by SmOke_N. ; Remarks .......: The constants above can be found in APIDiagConstant.au3. It also requires StringConstants.au3 and Crypt.au3 to be included. ; Example........: Yes ; =============================================================================================================================== Func _GetHardwareID($iFlags = Default, $bIs64Bit = Default) Local $sBit = @AutoItX64 ? '64' : '' If IsBool($bIs64Bit) Then ; Use 64-bit if $bIs64Bit is true and AutoIt is a 64-bit process; otherwise 32-bit $sBit = $bIs64Bit And @AutoItX64 ? '64' : '' EndIf If $iFlags == Default Then $iFlags = $UHID_MB EndIf Local $aSystem = ['Identifier', 'VideoBiosDate', 'VideoBiosVersion'], _ $iResult = 0, _ $sHKLM = 'HKEY_LOCAL_MACHINE' & $sBit, $sOutput = '', $sText = '' For $i = 0 To UBound($aSystem) - 1 $sOutput &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\', $aSystem[$i]) Next $sOutput &= @CPUArch $sOutput = StringStripWS($sOutput, $STR_STRIPALL) If BitAND($iFlags, $UHID_BIOS) Then Local $aBIOS = ['BaseBoardManufacturer', 'BaseBoardProduct', 'BaseBoardVersion', 'BIOSVendor', 'BIOSReleaseDate'] $sText = '' For $i = 0 To UBound($aBIOS) - 1 $sText &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\BIOS\', $aBIOS[$i]) Next $sText = StringStripWS($sText, $STR_STRIPALL) If $sText Then $iResult += $UHID_BIOS $sOutput &= $sText EndIf EndIf If BitAND($iFlags, $UHID_CPU) Then Local $aProcessor = ['ProcessorNameString', '~MHz', 'Identifier', 'VendorIdentifier'] $sText = '' For $i = 0 To UBound($aProcessor) - 1 $sText &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\CentralProcessor\0\', $aProcessor[$i]) Next For $i = 0 To UBound($aProcessor) - 1 $sText &= RegRead($sHKLM & '\HARDWARE\DESCRIPTION\System\CentralProcessor\1\', $aProcessor[$i]) Next $sText = StringStripWS($sText, $STR_STRIPALL) If $sText Then $iResult += $UHID_CPU $sOutput &= $sText EndIf EndIf If BitAND($iFlags, $UHID_HDD) Then Local $aDrives = DriveGetDrive('FIXED') $sText = '' For $i = 1 To UBound($aDrives) - 1 $sText &= DriveGetSerial($aDrives[$i]) Next $sText = StringStripWS($sText, $STR_STRIPALL) If $sText Then $iResult += $UHID_HDD $sOutput &= $sText EndIf EndIf Local $sHash = StringTrimLeft(_Crypt_HashData($sOutput, $CALG_MD5), StringLen('0x')) If Not $sHash Then Return SetError(1, 0, Null) EndIf Return SetExtended($iResult, StringRegExpReplace($sHash, '([[:xdigit:]]{8})([[:xdigit:]]{4})([[:xdigit:]]{4})([[:xdigit:]]{4})([[:xdigit:]]{12})', '{\1-\2-\3-\4-\5}')) EndFunc ;==>_GetHardwareID Example use of Function: #include <APIDiagConstants.au3> #include <Crypt.au3> #include <StringConstants.au3> Local $sUniqueID = _GetHardwareID($UHID_All) ConsoleWrite('UniqueID: ' & $sUniqueID & @CRLF & _ 'Flags used: ' & @extended & @CRLF)
×
×
  • Create New...