Jump to content

Recommended Posts

Posted

I need to read a binary registry value, search for the 8th byte and change it and write it back.  I'm headed down this trail.  Any suggestions would be appreciated:

RegRead
StringInStr xxx
edit
RegWrite
 
Thanks
  • Solution
Posted

You can use RegRead, BinaryMid and RegWrite to do what you want. Read more of their usage in the help file.

For _BinaryReplace, you can get the UDF from >here

Example

#include <Binary.au3>

;Read the registry
$vRegistry = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", "DefaultConnectionSettings")

;Extract a number of bytes from the binary
$Temp1 = BinaryMid($vRegistry , 8, 1)

;Replace the Binary
$Temp2 = _BinaryReplace($vRegistry, $Temp1, "0x09", 1)

;Write registry
RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\", "DefaultConnectionSettings", REG_BINARY", $Temp2)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...