Code:
;*************************************************************************
; Script Name: Learning Round 2
; Author: Gargoyle
; Date: 9/25/2006
; Description: Change a binary string in the registry
;*************************************************************************
Dim $SO,$ValRead,$Count,$Element,$valarray[],$ValWrite
;Script Options
$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
$SO=SETOPTION("WrapAtEOL", "ON")
If NOT @LOGONMODE
Break On
EndIf
; For use in creating an array to allow for changes to said array
$Element = 0
; Read in the Value we want to work with
$ValRead = ReadValue("HKCU\Software\KiXtart-Learning","Round02")
; Build an array with each element = to a binary group
For $Count = 1 to Len($ValRead) step 2
redim preserve $Valarray[$Element]
$ValArray[$Element] = SubStr($ValRead,$Count,2)
$Element = $Element + 1
Next
;Now we can change the element we want
$Valarray[2] = "bc"
;And now to put it all back together so that we can write it
For $Count = 0 to Ubound($Valarray)
$ValWrite = $Valwrite + $ValArray[$Count]
Next
;Finally we write it back to the registry
$SO = Writevalue("HKCU\Software\KiXtart-Learning","Round02",$ValWrite,"Reg_Binary")
?$valRead
?$ValWrite