[Libguestfs] [PATCH] hivexml: Add root attribute to the root node

Alex‎ Nelson ajnelson at cs.ucsc.edu
Tue Aug 16 04:50:28 UTC 2011


New feature:  If the root node of the XML root is the hive root node,
denote with attribute/value root="1".

Signed-off-by: Alex Nelson <ajnelson at cs.ucsc.edu>
---
 xml/hivexml.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/xml/hivexml.c b/xml/hivexml.c
index 2967ac9..f29c80c 100644
--- a/xml/hivexml.c
+++ b/xml/hivexml.c
@@ -204,6 +204,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);
-- 
1.7.6






More information about the Libguestfs mailing list