Signed-off-by: Alex Nelson <ajnelson(a)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",
+ "\
+Return hive file name stored in the hive header, null on error. Caller
+is responsible for freeing returned string.";
+
"major_version", (RInt32, [AHive]),
"return the major version of the hive",
"\
diff --git a/lib/hivex.c b/lib/hivex.c
index 455202f..11468f9 100644
--- a/lib/hivex.c
+++ b/lib/hivex.c
@@ -634,6 +634,12 @@ hivex_last_modified (hive_h *h)
return timestamp_check (h, 0, h->last_modified);
}
+char *
+hivex_name (hive_h *h)
+{
+ return (h && h->hdr) ? windows_utf16_to_utf8 (h->hdr->name, 64) :
NULL;
+}
+
int32_t
hivex_major_version (hive_h *h)
{
diff --git a/xml/hivexml.c b/xml/hivexml.c
index 3a4d9b7..059da56 100644
--- a/xml/hivexml.c
+++ b/xml/hivexml.c
@@ -160,6 +160,15 @@ main (int argc, char *argv[])
}
}
+ char *hive_name = hivex_name (h);
+ if (hive_name) {
+ XML_CHECK (xmlTextWriterStartAttribute, (writer, BAD_CAST "name"));
+ XML_CHECK (xmlTextWriterWriteString, (writer, BAD_CAST hive_name));
+ XML_CHECK (xmlTextWriterEndAttribute, (writer));
+ free (hive_name);
+ hive_name = NULL;
+ }
+
int64_t hive_mtime = hivex_last_modified (h);
if (hive_mtime >= 0) {
char *timebuf = filetime_to_8601 (hive_mtime);
--
1.7.6.4