BlueScreen Posted January 25, 2004 Share Posted January 25, 2004 Hey, I was wondering, is REG_BINARY registry type supported when using RegRead? If not, when it will be supported? 10x Link to comment Share on other sites More sharing options...
redndahead Posted January 25, 2004 Share Posted January 25, 2004 No it's not. I put it in as a request and people seem to want it but unfortunately unless you know how to code in C or C++ you will have to wait until somebody that does has the time to code it. But don't worry I think by the final release this will be in it. =) red Link to comment Share on other sites More sharing options...
CyberSlug Posted January 25, 2004 Share Posted January 25, 2004 (edited) Here's a scripted version tested on Windows XP sp1:It works by using regedit to export the regkey to a file.(Actually, the resulting file is badly formatted if you look at it with a hex editor; consequently, the type tmp1 > tmp2 is required so FileReadLine will work.)The regedit dump splits really long binary keys are split into lines using the "\" continutation character. This script has been modified to work for such long keys....There may be bugs; Valik or Larry could probably suggest improvements.expandcollapse popup; Example usage $var = _RegReadBin("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network", "Config") MsgBox(4096,"Config", $var) Exit ;----------------------------------------------------- ; Read a REG_BINARY value type from the registry ; It uses the export command-line param of regedit ; ; _RegReadBin ( "keyname", "valuename" ) ; ; Success: Returns the requested registry value value. ; Failure: Returns "" and sets the @error flag ; 1 = Unable to open requested key ; -1 = Unable to open requested value ; ;----------------------------------------------------- Func _RegReadBin($keyName, $valueName) Local $tmp0 Local $tmp1 Local $errorValue Local $returnValue $errorValue = 0 $returnValue = "" $tmp0 = @TempDir & '\readBinZero.txt' $tmp1 = @TempDir & '\readBinOne.txt' _RunCmd('regedit /e ' & $tmp0 & ' ' & $keyName) _RunCmd('type "' & $tmp0 & '" > "' & $tmp1 & '"') $file = FileOpen($tmp1, 0) If $file = -1 Then ;Unable to open file, thus: $errorValue = -1; Unable to open requested key EndIf Local $isFound $isFound =0 ; Read in lines of text until the EOF is reached While $errorValue = 0 $line = FileReadLine($file) If @error = -1 Then;Reached end-of-file, thus: $errorValue = 1 ; Unable to open requested value ExitLoop EndIf $line = StringStripWS($line, 3) Local $pos If (Not $isFound) AND StringInStr($line, $valueName) Then $pos = StringInStr($line, "=hex:") $returnValue = StringTrimLeft($line, $pos + 4) $isFound = 1 EndIf If $isFound AND StringInStr($line, "\") Then While StringInStr($line, "\") $line = StringStripWS( FileReadLine($file) , 3) $returnValue = $returnValue & @LF & $line WEnd $line = StringStripWS( FileReadLine($file) , 3) $returnValue = $returnValue & @LF & $line ExitLoop EndIf Wend If $file <> -1 Then FileClose($file) FileDelete($tmp0) FileDelete($tmp1) SetError($errorValue) Return $returnValue EndFunc ;----------------------------------------------------- ; Helper function to run console commands ;----------------------------------------------------- Func _RunCmd($command) Return RunWait(@ComSpec & ' /c ' & $command, "", @SW_HIDE) EndFunc Edited January 25, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! 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