[Libguestfs] sample code for guestfs_hivex_node_set_value

Richard W.M. Jones rjones at redhat.com
Tue Dec 4 17:01:50 UTC 2012

On Mon, Dec 03, 2012 at 03:35:49PM -0500, Skippy VonDrake wrote:
> Is there any sample code available to demonstrate the use of the
> guestfs_hivex_node_set_value API?
> I have no problem traversing and reading keys using libguestfs hivex
> wrappers - but continue to fail on any write attempts.
> The return is always -1 and errno is unchanged.
> I've set the environment variable HIVEX_DEBUG to 1 on a chance that
> this may help - but it doesn't.
> The only sample I can find in the sources that use hivex is the
> "virt-dhcp-address.c" sample.
> But it does not write to the registry.

Just to close this issue for other readers, the problem was not
supplying the 'write' flag when calling guestfs_hivex_open.  If you
don't supply this flag, then writes will fail with
guestfs_last_errno(g) => EROFS.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.

More information about the Libguestfs mailing list