hivex: Add metadata length functions for nodes and values
[hivex.git] / xml / hivexml.c
index 2967ac9..903c4b7 100644 (file)
 #include <unistd.h>
 #include <errno.h>
 #include <time.h>
+#include <locale.h>
+
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h>
+#endif
 
 #include <libxml/xmlwriter.h>
 
@@ -79,8 +84,10 @@ int
 main (int argc, char *argv[])
 {
   setlocale (LC_ALL, "");
+#ifdef HAVE_BINDTEXTDOMAIN
   bindtextdomain (PACKAGE, LOCALEBASEDIR);
   textdomain (PACKAGE);
+#endif
 
   int c;
   int open_flags = 0;
@@ -204,6 +211,10 @@ node_start (hive_h *h, void *writer_v, hive_node_h node, const char *name)
   XML_CHECK (xmlTextWriterStartElement, (writer, BAD_CAST "node"));
   XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "name", BAD_CAST name));
 
+  if (node == hivex_root (h)) {
+    XML_CHECK (xmlTextWriterWriteAttribute, (writer, BAD_CAST "root", BAD_CAST "1"));
+  }
+
   last_modified = hivex_node_timestamp (h, node);
   if (last_modified >= 0) {
     timebuf = filetime_to_8601 (last_modified);