Setting a binary registry value to 1 results in value of 31. Setting the value to 0 results in a value of 30. I found that the unicode value for 1 is u0031 and unicode value for 0 is u0030 so I think there is a connection.

Here is what I am doing.

<registrySet> <key>HKEY_LOCAL_MACHINE\SOFTWARE\TEST\KEYNAME</key> <name>TestBinaryValue</name> <type>REG_BINARY</type> <value>1</value> </registrySet>

The value name is created correctly as a binary (also tried with type "none" - same result). How can I set the binary value to 1?

asked 11 Sep '12, 09:31

HJM's gravatar image

HJM
11446
accept rate: 0%


The value for REG_BINARY is expected to be in binary form already.

In general, it is recommended to simply ship a .reg file and simply run reg import command. For example it is possible to ship registry.reg as one of the files - such as:

Windows Registry Editor Version 5.00

[HHKEY_LOCAL_MACHINE\SOFTWARE\TEST\KEYNAME] "TestBinaryValue"=hex:01

And then run reg command:

<runProgram>
    <program>reg</program>
    <programArguments>import "${installdir.dos}\registry.reg"</programArguments>
</runProgram>

However, in this case it is also possible to use <decodeBase64> action to decode a binary 1 value (binary 0 value is AA== when base64-encoded):

<decodeBase64>
    <text>AQ==</text>
    <variable>regvalue</variable>
</decodeBase64>
<registrySet>
    <key>HKEY_LOCAL_MACHINE\SOFTWARE\TEST\KEYNAME</key>
    <name>TestBinaryValue</name>
    <type>REG_BINARY</type>
    <value>${regvalue}</value>
    <wowMode>64</wowMode>
</registrySet>
link

answered 11 Sep '12, 09:46

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×28
×2

Asked: 11 Sep '12, 09:31

Seen: 3,254 times

Last updated: 11 Sep '12, 09:46