[Libguestfs] Hivex3: Saving values - always string

Richard W.M. Jones rjones at redhat.com
Wed Mar 5 16:24:26 UTC 2014


On Wed, Mar 05, 2014 at 04:16:24PM +0100, Martin Klíma wrote:
> Hello,
> 
> I attach example what I'm trying to do. In short I want to save
> binary values and I don't know how to encode them for hivex.

> { "key": "TEST_BINARY(ABC)", "t": Type.BINARY, "value": "ABC" }, # How transform this to save it as Binary value?

The question here doesn't really make any sense.  You can store
anything you want in the value field (regardless of the type, although
it's well-behaved to set it to Type.BINARY).  No transformation is
needed, just put raw data in the string.  In particular, "ABC" is
perfectly reasonable.

> { "key": "TEST_BINARY(A5)", "t": Type.BINARY, "value": "a5" }, # How transform this to save it as Binary value?

The same thing, but I guess perhaps you mean "how do I store the byte
0xa5 here?" in which case you can write "\xa5", using a standard
Python escape sequence:
http://docs.python.org/release/2.5.2/ref/strings.html

Basically you need to investigate what Windows is expecting in each
field (and it differs by field and by context) and generate whatever
happens to work on Windows.  Which is hard for a general-purpose
graphical registry editor, but the registry is a huge technical mess,
news at 11.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list