[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] Problem with hivex_commit (was: Re: [PATCH] Add debug output to hivex_close)

17:00 < mdbooth>     $h->node_set_values($node, \ new);
17:00 < mdbooth> print Dumper (\ new);

I don't think you posted the output of this statement.

17:00 < mdbooth> foreach ($h->node_values($node)) {
17:00 < mdbooth>     my $key = $h->value_key($_);
17:00 < mdbooth>     my (undef, $value) = $h->value_value($_);
17:01 < mdbooth>     print STDERR "$key: $value\n"
17:01 < mdbooth> }
17:01 < mdbooth>     $h->commit(undef);
17:01 < mdbooth>     undef $node;
17:01 < mdbooth>     undef $h;
17:01 < mdbooth>     # Upload the new registry.
17:01 < mdbooth>     $g->upload($sw_local, $sw_guest);

Merely doing $h->commit (undef) should be sufficient.  The rest
is just gravy.

Did you open the file with the correct flags?

   $h = Win::Hivex->open ($filename, write => 1);

I believe that commit is supposed to give an error if the handle
wasn't opened with this flag, but possibly that might be broken.

Anyway, it is totally possible to write to hivex from Perl, because
all the tools like hivexregedit and virt-win-reg are written in Perl.
There must be some other problem such as downloading or uploading an
incorrect file.

17:02 < mdbooth> I've also tried putting everything from the definition of $h to the commit in its own code 
17:02 < mdbooth> And copying the file outside the code block
17:02 < mdbooth> That should hopefully clear any possibility of dangling references to $h
17:03  * mdbooth notes that there is no explicit close...
17:16 < mdbooth> Hmm, hivex_close doesn't have any debug output either
17:24 < mdbooth> Ok, added debug output to hivex_close. It's definitely being called
17:27 < mdbooth> So, node_set_values() is being called with the correct data
17:27 < mdbooth> commit() is being called

You don't need to call close.  Just calling commit is sufficient to
save the file to disk.

17:27 < mdbooth> and the handle is closed
17:28 < mdbooth> But the result is incorrect
17:28 < mdbooth> I give up on this one for today

Can you summarise a bit more what is happening and/or send me the


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]