GEOSoft Posted April 5, 2011 Share Posted April 5, 2011 I've used it for a couple of years now but have intentionally not made a big splash about it; instead only bringing it up when I see someone post what you posted above. The reason for the policy should be obvious but if not you can PM me and I'll tell you. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
engjcowi Posted April 10, 2011 Share Posted April 10, 2011 Thanks This is very helpful Jamie Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
Ghost21 Posted April 11, 2011 Share Posted April 11, 2011 Would still love to see somone to a re-encode version... Link to comment Share on other sites More sharing options...
engjcowi Posted April 17, 2011 Share Posted April 17, 2011 Hi, This is my Modified version, will also check 32bits office versions on 64bits OS expandcollapse popup#include-once $HKLM = "HKEY_LOCAL_MACHINE" $Architecture = "32 Bits" If @OSArch = "X64" Then $HKLM &= "64" $Architecture = "64 Bits" EndIf ;=============================================================================== ; ; Function Name: _GetOfficeKey() ; Description: gets the Office DigitalProductID from the registry ; Parameter(s): none ; Requirement(s): none ; Return Value(s): Returns the binary 2000/XP/2003/2007/2010 Office DigitalProductID ; Author(s): Danny35d ; Modification: Emiel Wieldraaijer ; ;=============================================================================== ; TBD: Error checking and SetError Func _GetOfficeKey($sRemoteComputer = '') Dim $aKeys[1][8] If $sRemoteComputer <> '' Then $sRemoteComputer = '\\' & StringReplace($sRemoteComputer, '\', '') & '\' Local $sRegKey1 = $sRemoteComputer & $HKLM & '\SOFTWARE\Microsoft\Office' Local $sRegKey2 = $sRemoteComputer & $HKLM & '\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' Local $iCount1 = 1, $iCount2 = 1 While 1 $sKey1 = RegEnumKey($sRegKey1, $iCount1) If @error <> 0 Then ExitLoop While 1 $ProductID = '' $ProductName = '' $DigitalProductID = '' $sKey2 = RegEnumKey($sRegKey1 & '\' & $sKey1 & '\Registration', $iCount2) If @error <> 0 Then ExitLoop $ProductID = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductID') $ProductName = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName') $DigitalProductID = Hex(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'DigitalProductID')) $InstallPath = StringTrimRight((RegRead ($sRegKey1 & '\' & $sKey1 & '\Common\InstallRoot', 'Path')),1) $ProductVersion = RegRead($sRegKey1 & '\' & $sKey1 & '\Common\Productversion', 'Lastproduct') $OfficeLanguage = StringRight(Hex(RegRead($sRegKey1 & '\' & $sKey1 & '\Common\LanguageResources', 'SKULanguage')),4) If StringInStr(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName'), "2000") Then $SPLevel = "N/A" ElseIf StringInStr(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName'), "XP") Then $SPLevel = "N/A" ElseIf StringInStr(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName'), "2003") Then $SPLevel = "N/A" Else $SPLevel = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'SPLevel') EndIf If $ProductName = '' Then $ProductName = RegRead($sRegKey2 & '\' & $sKey2, 'DisplayName') $DigitalProductID = _DecodeProductKey($DigitalProductID) If $DigitalProductID <> 'BBBBB-BBBBB-BBBBB-BBBBB-BBBBB' Then ReDim $aKeys[UBound($aKeys) + 1][8] $aKeys[0][0] = UBound($aKeys) - 1 $aKeys[UBound($aKeys) - 1][0] = $ProductName $aKeys[UBound($aKeys) - 1][1] = $ProductID $aKeys[UBound($aKeys) - 1][2] = $DigitalProductID $aKeys[UBound($aKeys) - 1][3] = $InstallPath $aKeys[UBound($aKeys) - 1][4] = $ProductVersion $aKeys[UBound($aKeys) - 1][5] = $OfficeLanguage $aKeys[UBound($aKeys) - 1][6] = $Architecture $aKeys[UBound($aKeys) - 1][7] = $SPLevel EndIf $iCount2 += 1 WEnd $iCount1 += 1 WEnd Return($aKeys) EndFunc ;==>_GetOfficeKey Func _GetOfficeKey6432($sRemoteComputer = '') Dim $aKeys6432[1][8] If $sRemoteComputer <> '' Then $sRemoteComputer = '\\' & StringReplace($sRemoteComputer, '\', '') & '\' Local $sRegKey1 = $sRemoteComputer & $HKLM & '\SOFTWARE\Wow6432Node\Microsoft\Office' Local $sRegKey2 = $sRemoteComputer & $HKLM & '\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' Local $iCount1 = 1, $iCount2 = 1 While 1 $sKey1 = RegEnumKey($sRegKey1, $iCount1) If @error <> 0 Then ExitLoop While 1 $ProductID = '' $ProductName = '' $DigitalProductID = '' $sKey2 = RegEnumKey($sRegKey1 & '\' & $sKey1 & '\Registration', $iCount2) If @error <> 0 Then ExitLoop $ProductID = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductID') $ProductName = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName') $DigitalProductID = Hex(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'DigitalProductID')) $InstallPath = StringTrimRight((RegRead ($sRegKey1 & '\' & $sKey1 & '\Common\InstallRoot', 'Path')),1) $ProductVersion = RegRead($sRegKey1 & '\' & $sKey1 & '\Common\Productversion', 'Lastproduct') $OfficeLanguage = StringRight(Hex(RegRead($sRegKey1 & '\' & $sKey1 & '\Common\LanguageResources', 'SKULanguage')),4) $SPLevel = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'SPLevel') $Architecture = "32 Bits" If StringInStr(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName'), "2000") Then $SPLevel = "N/A" ElseIf StringInStr(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName'), "XP") Then $SPLevel = "N/A" ElseIf StringInStr(RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'ProductName'), "2003") Then $SPLevel = "N/A" Else $SPLevel = RegRead($sRegKey1 & '\' & $sKey1 & '\Registration\' & $sKey2, 'SPLevel') EndIf If $ProductName = '' Then $ProductName = RegRead($sRegKey2 & '\' & $sKey2, 'DisplayName') $DigitalProductID = _DecodeProductKey($DigitalProductID) If $DigitalProductID <> 'BBBBB-BBBBB-BBBBB-BBBBB-BBBBB' Then ReDim $aKeys6432[UBound($aKeys6432) + 1][8] $aKeys6432[0][0] = UBound($aKeys6432) - 1 $aKeys6432[UBound($aKeys6432) - 1][0] = $ProductName $aKeys6432[UBound($aKeys6432) - 1][1] = $ProductID $aKeys6432[UBound($aKeys6432) - 1][2] = $DigitalProductID $aKeys6432[UBound($aKeys6432) - 1][3] = $InstallPath $aKeys6432[UBound($aKeys6432) - 1][4] = $ProductVersion $aKeys6432[UBound($aKeys6432) - 1][5] = $OfficeLanguage $aKeys6432[UBound($aKeys6432) - 1][6] = $Architecture $aKeys6432[UBound($aKeys6432) - 1][7] = $SPLevel EndIf $iCount2 += 1 WEnd $iCount1 += 1 WEnd Return($aKeys6432) EndFunc ;==>_GetOfficeKey6432 ;=============================================================================== ; ; Function Name: _DecodeProductKey() ; Description: decodes the PID to get the product key ; Parameter(s): $BinaryDPID - the PID as stored in registry ; Requirement(s): none ; Return Value(s): Returns the decoded Windows/Office/Visual studio/etc. product key ; Author(s): found this in the Forum, who made it?! ; ;=============================================================================== Func _DecodeProductKey($BinaryDPID) 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 ;==>_DecodeProductKey Hi I've tried using this to get an output to a msg box. But each time the msg box is blank. ive used _GetOfficeKey() MsgBox(4096,"t",$aKeys) and $key = _GetOfficeKey() MsgBox(4096,"CD Key is",$Key) Am i being dense and missing something really simple? Drunken Frat-Boy Monkey Garbage Link to comment Share on other sites More sharing options...
GEOSoft Posted April 17, 2011 Share Posted April 17, 2011 That function returns an array. So try this to see what is happening #include<array.au3>;; For display only $aProd = _GetOfficeKey() _ArrayDisplay($aProd) You can't just pull a single function from that and have it return the product key. That info has to be retrieved through _DecodeProductKey() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now