Index: trunk/include/regfi.h
===================================================================
--- trunk/include/regfi.h	(revision 158)
+++ trunk/include/regfi.h	(revision 159)
@@ -45,4 +45,5 @@
 #include <unistd.h>
 #include <assert.h>
+#include <iconv.h>
 
 #include "talloc.h"
@@ -250,4 +251,43 @@
 
 
+typedef struct _regfi_data
+{
+  uint32 type;
+
+  /* Length of the raw data. */
+  uint32 size;
+
+  /* This is always present, representing the raw data cell contents. */
+  uint8* raw;
+
+  /* Represents the length of the interpreted value. Meaning is type-specific.*/
+  uint32 interpreted_size;
+
+  /* These items represent interpreted versions of the raw attribute above. 
+   * Only use the appropriate member according to the type field.  
+   * In the event of an unknown type, use only the raw field.
+   */
+  union _regfi_data_interpreted
+  {
+    uint8* none; /* */
+    uint8* string;
+    uint8* expand_string;
+    uint8* binary; /* */
+    uint32 dword;
+    uint32 dword_be;
+    uint8* link;
+    uint8** multiple_string;
+    uint64 qword;
+
+    /* The following are treated as binary currently, but this may change in
+     * the future as the formats become better understood.
+     */
+    uint8* resource_list;
+    uint8* full_resource_descriptor;
+    uint8* resource_requirements_list;
+  } interpreted;
+} REGFI_DATA;
+
+
 /* Value record */
 typedef struct 
@@ -256,11 +296,13 @@
   uint32 cell_size;	/* ((start_offset - end_offset) & 0xfffffff8) */
 
-  uint8* data;
+  REGFI_DATA* data;     /* XXX: deprecated */
+
   char*  valuename;
   uint16 name_length;
   uint32 hbin_off;	/* offset from beginning of this hbin block */
   
-  uint32 data_size;
-  uint32 data_off;      /* offset of data cell (virtual) */
+  uint32 data_size;     /* As reported in the VK record.  May be different than
+			 * That obtained while parsing the data cell itself. */
+  uint32 data_off;      /* Offset of data cell (virtual) */
   uint32 type;
   uint8  magic[REGFI_CELL_MAGIC_SIZE];
@@ -423,4 +465,5 @@
   void_stack* key_positions;
   REGFI_NK_REC* cur_key;
+  const char* string_encoding;
   uint32 cur_subkey;
   uint32 cur_value;
@@ -446,4 +489,5 @@
 
 
+
 /******************************************************************************/
 /*                         Main iterator API                                  */
@@ -462,7 +506,30 @@
  */
 char*                 regfi_get_messages(REGFI_FILE* file);
+
 void                  regfi_set_message_mask(REGFI_FILE* file, uint16 mask);
 
-REGFI_ITERATOR*       regfi_iterator_new(REGFI_FILE* fh);
+
+/* regfi_iterator_new: Creates a new iterator for the provided registry file.
+ *
+ * Arguments:
+ *   file            -- The opened registry file the iterator should be
+ *                      created for.
+ *   output_encoding -- An integer representing the output string encoding.
+ *                      These integers currently map to a specific set of 
+ *                      iconv(3) encodings.
+ *                      The following values are currently accepted:
+ *                      0 - default (currently US-ASCII//TRANSLIT)
+ *                      1 - US-ASCII//TRANSLIT
+ *                      2 - UTF-8//TRANSLIT
+ *
+ *                      XXX: This encoding only applies to specific data 
+ *                           strings currently, but should apply to key 
+ *                           names and value names in the future.
+ *
+ * Returns:
+ *   A newly allocated REGFI_ITERATOR. Must be free()d with regfi_iterator_free.
+ */
+REGFI_ITERATOR*       regfi_iterator_new(REGFI_FILE* file,
+					 uint32 output_encoding);
 void                  regfi_iterator_free(REGFI_ITERATOR* i);
 bool                  regfi_iterator_down(REGFI_ITERATOR* i);
@@ -487,5 +554,6 @@
 						const char* value_name);
 
-REGFI_DATA*           regfi_iterator_cur_data(REGFI_ITERATOR* i);
+REGFI_DATA*           regfi_iterator_fetch_data(REGFI_ITERATOR* i, 
+						const REGFI_VK_REC* value);
 
 
@@ -512,4 +580,8 @@
 					  range_list* used_ranges,
 					  bool strict);
+bool                  regfi_interpret_data(REGFI_FILE* file, 
+					   const char* string_encoding,
+					   uint32 type, REGFI_DATA* data);
+void                  regfi_free_data(REGFI_DATA* data);
 
 /* These are cached so return values don't need to be freed. */
@@ -599,4 +671,8 @@
 REGFI_VK_REC*         regfi_copy_vk(const REGFI_VK_REC* vk);
 int32                 regfi_calc_maxsize(REGFI_FILE* file, uint32 offset);
+int32                 regfi_conv_charset(const char* output_charset, 
+					 uint8* input, char* output, 
+					 uint32 input_len, uint32 output_max);
+REGFI_DATA*           regfi_buffer_to_data(REGFI_BUFFER raw_data);
 
 #endif	/* _REGFI_H */
