Index: trunk/include/regfi.h
===================================================================
--- trunk/include/regfi.h	(revision 203)
+++ trunk/include/regfi.h	(revision 206)
@@ -359,4 +359,9 @@
 typedef struct _regfi_value_list
 {
+  /* Real offset of this record's cell in the file */
+  uint32_t offset;
+
+  uint32_t cell_size;
+
   /* Actual number of values referenced by this list.  
    * May differ from parent key's num_values if there were parsing errors. 
@@ -373,4 +378,7 @@
 typedef struct _regfi_classname
 {
+  /** Real offset of this record's cell in the file */
+  uint32_t offset;
+
   /** As converted to requested REGFI_ENCODING */
   char* interpreted;
@@ -497,5 +505,5 @@
  * @ingroup regfiBase
  */
-typedef struct
+typedef struct _regfi_vk
 {
   /** Real offset of this record's cell in the file */
@@ -504,7 +512,4 @@
   /** ((start_offset - end_offset) & 0xfffffff8) */
   uint32_t cell_size;
-
-  /* XXX: deprecated */
-  REGFI_DATA* data;
 
   /** The name of this value converted to desired REGFI_ENCODING.  
@@ -513,5 +518,5 @@
    * settings.  String is NUL terminated.
    */
-  char*    valuename;
+  char* name;
 
   /** The raw value name
@@ -519,7 +524,7 @@
    * Length of the buffer is stored in name_length.
    */
-  uint8_t* valuename_raw;
-
-  /** Length of valuename_raw */
+  uint8_t* name_raw;
+
+  /** Length of name_raw */
   uint16_t name_length;
 
@@ -553,14 +558,18 @@
    */
   bool     data_in_offset;
+
+  /* XXX: deprecated */
+  REGFI_DATA* data;
+
 } REGFI_VK;
 
 
 /* Key Security */
-struct _regfi_sk_rec;
+struct _regfi_sk;
 
 /** Security structure
  * @ingroup regfiBase
  */
-typedef struct _regfi_sk_rec 
+typedef struct _regfi_sk 
 {
   /** Real file offset of this record */
@@ -599,5 +608,5 @@
  * @ingroup regfiBase
  */
-typedef struct _regfi_nk_rec
+typedef struct _regfi_nk
 {
   /** Real offset of this record's cell in the file */
@@ -642,5 +651,5 @@
    * settings.  String is NUL terminated.
    */
-  char* keyname;
+  char* name;
 
   /** The raw key name
@@ -648,5 +657,5 @@
    * Length of the buffer is stored in name_length.
    */
-  uint8_t* keyname_raw;
+  uint8_t* name_raw;
 
   /** Virutal offset of parent key */
@@ -662,5 +671,5 @@
   uint32_t max_bytes_subkeyclassname;
 
-  /* XXX: max valuename * 2 */
+  /* XXX: max value name * 2 */
   uint32_t max_bytes_valuename;
 
@@ -772,4 +781,11 @@
   /* Run-time information */
   /************************/
+  /* For sanity checking (not part of the registry header) */
+  uint32_t file_length;
+
+  /** The encoding that all strings are converted to during interpretation.
+   */
+  REGFI_ENCODING string_encoding;
+
   /* Functions for accessing the file */
   REGFI_RAW_FILE* cb;
@@ -780,7 +796,4 @@
   pthread_mutex_t cb_lock;
 
-  /* For sanity checking (not part of the registry header) */
-  uint32_t file_length;
-
   /* Metadata about hbins */
   range_list* hbins;
@@ -811,9 +824,4 @@
   /** The current key */
   REGFI_NK* cur_key;
-
-  /** The encoding that all strings are converted to as set during iterator
-   *  creation.
-   */
-  REGFI_ENCODING string_encoding;
 
   /** Index of the current subkey */
@@ -866,5 +874,5 @@
  */
 _EXPORT
-REGFI_FILE* regfi_alloc(int fd);
+REGFI_FILE* regfi_alloc(int fd, REGFI_ENCODING output_encoding);
 
 
@@ -882,5 +890,6 @@
  */
 _EXPORT
-REGFI_FILE* regfi_alloc_cb(REGFI_RAW_FILE* file_cb);
+REGFI_FILE* regfi_alloc_cb(REGFI_RAW_FILE* file_cb,
+			   REGFI_ENCODING output_encoding);
 
 
@@ -952,4 +961,47 @@
 _EXPORT
 void regfi_free_record(const void* record);
+
+
+/** Retrieves classname for a given key.
+ *
+ * @param file the file from which key is derived
+ * @param key the key whose classname is desired
+ *
+ * @return Returns a newly allocated classname structure, or NULL on failure.
+ *         Classname structures must be freed with @ref regfi_free_record.
+ *
+ * @ingroup regfiBase
+ */
+_EXPORT
+const REGFI_CLASSNAME* regfi_fetch_classname(REGFI_FILE* file, 
+					     const REGFI_NK* key);
+
+
+/** Returns the SK (security) record referenced by the supplied key.
+ *
+ * @param file the file from which key is derived
+ * @param key  the key whose SK record is desired
+ * 
+ * @return A read-only SK structure, or NULL on failure.
+ *
+ * @ingroup regfiBase
+ */
+_EXPORT
+const REGFI_SK* regfi_fetch_sk(REGFI_FILE* file, const REGFI_NK* key);
+
+
+/** Retrieves data for a given value.
+ *
+ * @param file the file from which value is derived
+ * @param value the value whose data is desired
+ *
+ * @return Returns a newly allocated data structure, or NULL on failure.
+ *         Data structures must be freed with @ref regfi_free_record.
+ *
+ * @ingroup regfiBase
+ */
+_EXPORT
+const REGFI_DATA* regfi_fetch_data(REGFI_FILE* file,
+				   const REGFI_VK* value);
 
 
@@ -982,6 +1034,5 @@
  */
 _EXPORT
-REGFI_ITERATOR* regfi_iterator_new(REGFI_FILE* file,
-					 REGFI_ENCODING output_encoding);
+REGFI_ITERATOR* regfi_iterator_new(REGFI_FILE* file);
 
 
@@ -1074,16 +1125,4 @@
 
 
-/** Returns the SK (security) record referenced by the current key.
- *
- * @param i the iterator
- *
- * @return A read-only SK structure, or NULL on failure.
- *
- * @ingroup regfiIteratorLayer
- */
-_EXPORT
-const REGFI_SK* regfi_iterator_cur_sk(REGFI_ITERATOR* i);
-
-
 /** Sets the internal subkey index to the first subkey referenced by the current
  *  key.
@@ -1193,34 +1232,4 @@
 bool regfi_iterator_find_value(REGFI_ITERATOR* i, 
 			       const char* value_name);
-
-/** Retrieves classname for a given key.
- *
- * @param i   the iterator
- * @param key the key whose classname is desired
- *
- * @return Returns a newly allocated classname structure, or NULL on failure.
- *         Classname structures must be freed with @ref regfi_free_record.
- *
- * @ingroup regfiIteratorLayer
- */
-_EXPORT
-const REGFI_CLASSNAME* regfi_iterator_fetch_classname(REGFI_ITERATOR* i, 
-						      const REGFI_NK* key);
-
-
-/** Retrieves data for a given value.
- *
- * @param i     the iterator
- * @param value the value whose data is desired
- *
- * @return Returns a newly allocated data structure, or NULL on failure.
- *         Data structures must be freed with @ref regfi_free_record.
- *
- * @ingroup regfiIteratorLayer
- */
-_EXPORT
-const REGFI_DATA* regfi_iterator_fetch_data(REGFI_ITERATOR* i,
-					    const REGFI_VK* value);
-
 
 
@@ -1330,4 +1339,6 @@
 const REGFI_SK* regfi_load_sk(REGFI_FILE* file, uint32_t offset,
 				  bool strict);
+
+
 
 
@@ -1470,6 +1481,5 @@
 /*    Private Functions                                                       */
 /******************************************************************************/
-REGFI_NK*         regfi_rootkey(REGFI_FILE* file, 
-				    REGFI_ENCODING output_encoding);
+REGFI_NK*             regfi_rootkey(REGFI_FILE* file);
 
 off_t                 regfi_raw_seek(REGFI_RAW_FILE* self, 
@@ -1506,6 +1516,6 @@
 void                  regfi_add_message(REGFI_FILE* file, uint16_t msg_type, 
 					const char* fmt, ...);
-REGFI_NK*         regfi_copy_nk(const REGFI_NK* nk);
-REGFI_VK*         regfi_copy_vk(const REGFI_VK* vk);
+REGFI_NK*             regfi_copy_nk(const REGFI_NK* nk);
+REGFI_VK*             regfi_copy_vk(const REGFI_VK* vk);
 _EXPORT
 int32_t               regfi_calc_maxsize(REGFI_FILE* file, uint32_t offset);
