Jump to content
Sign in to follow this  
Shadowpp

Help with Binary value edit in Registry

Recommended Posts

Shadowpp

How would I change multiple specific values in the registry entry below? Specifically, only the ones in bold?

[HKEY_USERS\S-1-5-21-64564757-1305693117-1901743163-33671\Printers\DevModePerUser]

"\\\\ipp://10.96.14.12\\PHXBZ11"=hex:5c,00,5c,00,69,00,70,00,70,00,3a,00,2f,00,\

2f,00,31,00,30,00,2e,00,39,00,36,00,2e,00,31,00,34,00,2e,00,31,00,32,00,5c,\

00,50,00,48,00,58,00,42,00,5a,00,31,00,31,00,00,00,00,00,00,00,00,00,00,00,\

01,04,01,82,dc,00,14,0c,03,3f,00,00,01,00,01,00,ea,0a,6f,08,64,00,01,00,07,\

00,58,02,02,00,02,00,58,02,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,5c,00,5c,00,69,00,70,00,70,00,3a,00,2f,00,2f,00,31,00,30,\

00,2e,00,39,00,36,00,2e,00,31,00,34,00,2e,00,31,00,32,00,5c,00,50,00,48,00,\

58,00,42,00,5a,00,31,00,31,00,00,00,00,00,00,00,00,00,00,00,01,04,01,82,dc,\

00,14,0c,03,3f,00,00,01,00,01,00,ea,0a,6f,08,64,00,01,00,07,00,58,02,02,00,\

01,00,58,02,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

Thank you in advance...

Share this post


Link to post
Share on other sites
trancexx

Read->change->write.

What exactly is the problem?


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Shadowpp

My problem is that I cannot figure out how to Read->change->write the specific values in the key. There are 6 values contained within the key of over 6000 characters that I wish to change. While I know exactly which ones I want to modify I cannot determine how.

It doesnt seem that I can use a stringsplit or search for a pattern as the other values (the ones I am not interested in changing) can be anything. The values I wish to change are in a fixed position, so using this code I can find the 95th value (0x01) and I can set the value of the variable $result but I cannot determine how to write that value back.

$sHexTextStr= RegRead ("HKEY_CURRENT_USER\Printers\DevModePerUser", "ipp://10.96.14.12/ipp/PHXBZ11")
$bBinary= Binary('0x'&$sHexTextStr)
$result = BinaryMid($bBinary, [b]95[/b],1)
ConsoleWrite($result&@CRLF)
set $result = "0x02"

Once changed, I think to write it all back to registry would be:

RegWrite("HKEY_CURRENT_USER\Printers\DevModePerUser","ipp://10.96.14.12/ipp/PHXBZ11","REG_BINARY",Binary('0x'&$sHexTextStr))

I am not even sure if any of this is close....actual help would be appreciated.

Edited by Shadowpp

Share this post


Link to post
Share on other sites
PsaltyDS

Demo of REG_BINARY read/modify/write/verify:

Global $binData = Binary("0xFEDCBA9876543210FEDCBA9876543210FEDCBA9876543210")
Global $binRead, $binWrite

; Initial conditions
ConsoleWrite("$binData = " & $binData & @LF)
RegWrite("HKLM\SOFTWARE\AutoIt v3\Test", "Bin_Test", "REG_BINARY", $binData)

; Read
$binRead = RegRead("HKLM\SOFTWARE\AutoIt v3\Test", "Bin_Test")
ConsoleWrite("$binRead = " & $binRead & @LF)

; Modify 8th byte (15th/16th char in Hex)
$binWrite = BinaryMid($binRead, 1, 7) & Binary("0xCC") & BinaryMid($binRead, 9)
ConsoleWrite("$binWrite = " & $binWrite & @LF)
RegWrite("HKLM\SOFTWARE\AutoIt v3\Test", "Bin_Test", "REG_BINARY", $binWrite)

; Re-read
$binRead = RegRead("HKLM\SOFTWARE\AutoIt v3\Test", "Bin_Test")
ConsoleWrite("$binRead = " & $binRead & @LF)

:(

  • Like 1

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Shadowpp

Thank you very much!

Share this post


Link to post
Share on other sites
darkjohn20

StringReplace()?

Nevermind, just realized that he only wants those specific values changed.

Edited by darkjohn20

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  

×