Sign in to follow this  
Followers 0
auger282

Big RegWrite binary to write... no idea...

3 posts in this topic

#1 ·  Posted (edited)

***

Edited by auger282

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You didn't need to do it this way like an ants work ;]:

Assuming the entire string is in the variable $sValue.

$sValue = StringReplace($sValue, ',', '')
$sValue = StringReplace($sValue, '\' & @CRLF, '') ; or @LF if this is the case.

RegWrite('HKEY_CURRENT_USER\Printers\Connections\,,SERVERNAME,PRINTERNAME', _
   'DefaultDevMode', 'REG_BINARY', $sValue)
Edited by Authenticity

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I was quite vague. You can use the "Search and Replace" (Ctrl+H) feature of SciTE editor to replace the ',' or '\' with nothing, I've used it to replace ',' with nothing just to reduce the string size:

Dim $sValue ="0x4c004f005700500054005200490043004f0048\" & @CRLF & _ 
             "00310000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "000000000000000000000000000000000000000001040001dc\" & @CRLF & _ 
             "001c0f0fff800301000100ea0a6f0864000100010458020200\" & @CRLF & _ 
             "01005802020000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000010000000200\" & @CRLF & _ 
             "00000001000000000000000000000000000000000000000000\" & @CRLF & _ 
             "000100caca000000003000000043006f007500720069006500\" & @CRLF & _ 
             "72000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "0000480065006c007600650074006900630061000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "000000000000000000000000000000000a0000000000000030\" & @CRLF & _ 
             "00000000000000000000005802000000000000000064000000\" & @CRLF & _ 
             "00000000000001000000000000000000000000000000000000\" & @CRLF
$sValue &=   "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "0000000000000104ffff000000000100010000000104ffff00\" & @CRLF & _ 
             "00000000000104ffff00000000000051545900000000000000\" & @CRLF & _ 
             "000052504a4c2c57494e323030302c50434c35432c312e302e\" & @CRLF & _ 
             "302e302c434f4c4f5200000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "000000000040504a4c205345542047554953544152544a4f42\" & @CRLF & _ 
             "3d310d0a000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF
$sValue &=   "00000000000000000000000000000000000000000000000000\" & @CRLF & _ 
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "000000000000000000000000000000000000000040504a4c20\" & @CRLF & _
             "53455420475549454e444a4f423d310d0a0000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF
$sValue &=   "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00010000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000096006400\" & @CRLF & _
             "96006400000000000000000001000000000000000000000000\" & @CRLF & _
             "000000000083007f0000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000005802010400000000\" & @CRLF & _
             "00000000000000000000000000000000ffff00000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000001402\" & @CRLF & _
             "07000000010000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000001000000\" & @CRLF & _
             "960200006a05000043003a005c00570049004e0044004f0057\" & @CRLF & _
             "0053005c00530059005300540045004d00330032005c005300\" & @CRLF & _
             "50004f004f004c005c0044005200490056004500520053005c\" & @CRLF
$sValue &=   "005700330032005800380036005c0033005c00520049004300\" & @CRLF & _
             "35003400410042002e00580050004900000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000008000880300005801800084035000540100008203500\" & @CRLF & _
             "05203a00080000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000100010001000000000002\" & @CRLF & _
             "00000000000000030000000000000001000000000000000000\" & @CRLF & _
             "000000000000000001000100000000000000000000006f08ea\" & @CRLF & _
             "0a010001000000000001040001080102000000000008010000\" & @CRLF & _
             "00000801000000000801000001000000010000000000010001\" & @CRLF
$sValue &=   "00020003000100000000000000010000000000000000000000\" & @CRLF & _
             "0100ffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffff0100ffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffff0100ffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffff0100ffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffff0100ffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffff0100ffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffff0100ffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffffff\" & @CRLF & _
             "ffffffffffffffffffffffffffffffffffffffffffffffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffff00\" & @CRLF & _
             "0000ffff000000ffff000000ffff000000ffff000000ffffff\" & @CRLF & _
             "ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff000100\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000000000000000\" & @CRLF & _
             "00000000000000000000000000000000000000"
             
Dim $sKey = "HKLM\SOFTWARE\AAAA"
$sValue = StringReplace($sValue, "\" & @CRLF, "")
RegWrite($sKey, "NewValue", "REG_BINARY", BinaryToString($sValue))

Then, I hope everything is clear. ;]

Edit: Meh, nevermind, codebox is not working.

Edited by Authenticity

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0