13 Years of Service
24%
Code:
>$sX64 = ''
If @OSArch 'X86' Then $sX64 = '64'
$sDigitalProductID = RegRead('HKEY_LOCAL_MACHINE' & $sX64 & '\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'DigitalProductID')
$Key = _DecodeProductKey($sDigitalProductID)
$input = InputBox("Copy", $Key, $Key)
Func _DecodeProductKey($BinaryDPID)
If IsBinary($BinaryDPID) Then $BinaryDPID = StringMid($BinaryDPID, 3)
Local $bKey[15]
Local $sKey[29]
Local $Digits[24]
Local $Value = 0
Local $hi = 0
Local $n = 0
Local $i = 0
Local $dlen = 29
Local $slen = 15
Local $Result
$Digits = StringSplit('BCDFGHJKMPQRTVWXY2346789', '')
$BinaryDPID = StringMid($BinaryDPID, 105, 30)
For $i = 1 To 29 Step 2
$bKey[int($i / 2)] = Dec(StringMid($BinaryDPID, $i, 2))
Next
For $i = $dlen - 1 To 0 Step -1
If Mod(($i + 1), 6) = 0 Then
$sKey[$i] = '-'
Else
$hi = 0
For $n = $slen - 1 To 0 Step -1
$Value = BitOR(BitShift($hi, -8), $bKey[$n])
$bKey[$n] = Int($Value / 24)
$hi = Mod($Value, 24)
Next
$sKey[$i] = $Digits[$hi + 1]
EndIf
Next
For $i = 0 To 28
$Result = $Result & $sKey[$i]
Next
Return $Result
EndFunc