[AutoIt]Get Windows Product Key 10-29-2011, 08:06 AM
#1
Code:
Func _CompGetProductKey()
Local $binaryDPID = _
RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", _
"DigitalProductID"), _
$bKey[15],$sKey[29], _
$Digits[24],$Value, _
$hi,$n,$dlen=29, _
$slen=15,$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
EndFuncCredits go completely to bcording. I tried to translate Coder-San's VB.Net one to Au3 but the VB.Net one the Registry.GetValue returns some sort of a array since names can be declared as Object but in Au3 they can't be declared as Object so... In the end i just thought i share it
Pierce the life fibers with your drill.




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)