[Libguestfs] [hivex] [PATCH 2/2] hivex: Expose embedded hive file name

Richard W.M. Jones rjones at redhat.com
Thu Jan 5 14:02:49 UTC 2012


On Mon, Dec 12, 2011 at 09:59:20PM -0800, Alex Nelson wrote:
> Signed-off-by: Alex Nelson <ajnelson at cs.ucsc.edu>
> ---
>  generator/generator.ml |    6 ++++++
>  lib/hivex.c            |    6 ++++++
>  xml/hivexml.c          |    9 +++++++++
>  3 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/generator/generator.ml b/generator/generator.ml
> index fc7b483..9e53f4e 100755
> --- a/generator/generator.ml
> +++ b/generator/generator.ml
> @@ -159,6 +159,12 @@ but instead are lost.  See L<hivex(3)/WRITING TO HIVE FILES>.";
>      "\
>  Return root node of the hive.  All valid hives must contain a root node.";
>  
> +  "name", (RString, [AHive]),
> +    "return the name stored in the hive header",

I thought that calling hivex_node_name (h, hivex_root (h)) would
return this string already?  Or is it a different string we're talking
about here?

> +    "\
> +Return hive file name stored in the hive header, null on error.  Caller
> +is responsible for freeing returned string.";

You don't need to print the stuff about errors and freeing the string.
The generator does it for you.

> +char *
> +hivex_name (hive_h *h)
> +{
> +  return (h && h->hdr) ? windows_utf16_to_utf8 (h->hdr->name, 64) : NULL;
> +}

This probably needs to be setting errno ...

Rich.

-- 
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.
http://et.redhat.com/~rjones/virt-p2v




More information about the Libguestfs mailing list