Wb-FreeKill Posted January 11, 2005 Share Posted January 11, 2005 I need a script that converts the code on the cd case, to hex(?), just as in regedit. So you can input the cd-key, and replace it with the one in the regedit! Link to comment Share on other sites More sharing options...
buzz44 Posted January 11, 2005 Share Posted January 11, 2005 a cd key on a bought windows disk?? qq Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted January 11, 2005 Author Share Posted January 11, 2005 It is a original windows key, ive got a script that converts the key from the registry to "normal" letters, but i cant fugure how to do it backwords Link to comment Share on other sites More sharing options...
buzz44 Posted January 11, 2005 Share Posted January 11, 2005 Hex ( number, length ) ? qq Link to comment Share on other sites More sharing options...
SlimShady Posted January 11, 2005 Share Posted January 11, 2005 (edited) Ofcourse not. The Hex function converts a number/integer. Not regular text like a CD-key. Do you want to write to the registry? Then you don't have to convert the string yourself. (I'm talking about RegWrite) I was wondering: what does RegRead return when you read the key? Edited January 11, 2005 by SlimShady Link to comment Share on other sites More sharing options...
JSThePatriot Posted January 11, 2005 Share Posted January 11, 2005 (edited) It is a original windows key, ive got a script that converts the key from the registry to "normal" letters, but i cant fugure how to do it backwords<{POST_SNAPBACK}>I have just created this UDF so I hope you find it useful...JS;=============================================================================== ; ; Function Name: _StrToHex() ; Description: Convert a string of characters to hexidecimal. ; Parameter(s): $strChar is the string you want to convert. ; Requirement(s): String Input. ; Return Value(s): On Success - Returns the converted string in hexidecimal. ; On Failure - -1 and sets @ERROR = 1 ; Author(s): Jarvis Stubblefield ; ;=============================================================================== Func _StrToHex($strChar) Local $aryChar, $i, $iDec, $hChar, $file $aryChar = StringSplit($strChar, "") For $i = 1 To $aryChar[0] $iDec = Asc($aryChar[$i]) $hChar = Hex($iDec, 2) $strHex = $strHex & $hChar Next If Not($strHex) Then SetError(1) Return -1 Else Return $strHex EndIf EndFuncEdit: Modified code as specified below. Edited January 11, 2005 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
SlimShady Posted January 11, 2005 Share Posted January 11, 2005 It's not @error = 1.This is correct:SetError(1) Link to comment Share on other sites More sharing options...
JSThePatriot Posted January 11, 2005 Share Posted January 11, 2005 It's not @error = 1.This is correct:SetError(1)<{POST_SNAPBACK}>Thanks.. hehe I forgot to go back and check that against my last UDF .Appreciate it.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted January 11, 2005 Author Share Posted January 11, 2005 (edited) Ive tried your script, but it gives me an od number? ;=============================================================================== ; ; Function Name: _StrToHex() ; Description: Convert a string of characters to hexidecimal. ; Parameter(s): $strChar is the string you want to convert. ; Requirement(s): String Input. ; Return Value(s): On Success - Returns the converted string in hexidecimal. ; On Failure - -1 and sets @ERROR = 1 ; Author(s): Jarvis Stubblefield ; ;=============================================================================== Dim $Bin $Bin = "?????????????????????????????????" InputBox("Product Key", "Your " & @OSVERSION & " product key is:", _StrToHex($Bin), "", -1, 100, -1, -1) Func _StrToHex($strChar) Local $aryChar, $i, $iDec, $hChar, $file $aryChar = StringSplit($strChar, "") For $i = 1 To $aryChar[0] $iDec = Asc($aryChar[$i]) $hChar = Hex($iDec, 2) $strHex = $strHex & $hChar Next If Not($strHex) Then SetError(1) Return -1 Else Return $strHex EndIf EndFunc Have i done everything correct, or? Edited January 11, 2005 by Wb-FreeKill Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted January 11, 2005 Author Share Posted January 11, 2005 In regedit, it starts with a4 00 00 00 03 and so on Link to comment Share on other sites More sharing options...
JSThePatriot Posted January 11, 2005 Share Posted January 11, 2005 (edited) Ive tried your script, but it gives me an od number?;=============================================================================== ; ; Function Name: _StrToHex() ; Description: Convert a string of characters to hexidecimal. ; Parameter(s): $strChar is the string you want to convert. ; Requirement(s): String Input. ; Return Value(s): On Success - Returns the converted string in hexidecimal. ; On Failure - -1 and sets @ERROR = 1 ; Author(s): Jarvis Stubblefield ; ;=============================================================================== Dim $Bin $Bin = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" InputBox("Product Key", "Your " & @OSVERSION & " product key is:", _StrToHex($Bin), "", -1, 100, -1, -1) Func _StrToHex($strChar) Local $aryChar, $i, $iDec, $hChar, $file $aryChar = StringSplit($strChar, "") For $i = 1 To $aryChar[0] $iDec = Asc($aryChar[$i]) $hChar = Hex($iDec, 2) $strHex = $strHex & $hChar Next If Not($strHex) Then SetError(1) Return -1 Else Return $strHex EndIf EndFuncHave i done everything correct, or?<{POST_SNAPBACK}>Okay couple of things. 1. Do you want it converting the -'s to Hex? If not I suggest you use string functions to remove those.2. Remove the actual number... so people dont steal it. (I am X'ing it out).3. PM me with what the actual Hex is in RegEdit. They may have done something else. I have made a simple string to hex converter.4. They may have it encrypted or something.I also noticed 00's and spaces in what you showed that they have in RegEdit. Those would have to be added. 00's are null characters.Edit:BTWA4 = ¤03 = End of Text (ETX)Let me know anything else you find out.JS Edited January 11, 2005 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted January 11, 2005 Author Share Posted January 11, 2005 Ive sent a PM to you 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