Changeset 206 for trunk/include


Ignore:
Timestamp:
08/25/10 11:20:32 (14 years ago)
Author:
tim
Message:

simplified part of regfi API to move string encoding to the REGFI_FILE object

additional pyregfi implementation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/regfi.h

    r203 r206  
    359359typedef struct _regfi_value_list
    360360{
     361  /* Real offset of this record's cell in the file */
     362  uint32_t offset;
     363
     364  uint32_t cell_size;
     365
    361366  /* Actual number of values referenced by this list. 
    362367   * May differ from parent key's num_values if there were parsing errors.
     
    373378typedef struct _regfi_classname
    374379{
     380  /** Real offset of this record's cell in the file */
     381  uint32_t offset;
     382
    375383  /** As converted to requested REGFI_ENCODING */
    376384  char* interpreted;
     
    497505 * @ingroup regfiBase
    498506 */
    499 typedef struct
     507typedef struct _regfi_vk
    500508{
    501509  /** Real offset of this record's cell in the file */
     
    504512  /** ((start_offset - end_offset) & 0xfffffff8) */
    505513  uint32_t cell_size;
    506 
    507   /* XXX: deprecated */
    508   REGFI_DATA* data;
    509514
    510515  /** The name of this value converted to desired REGFI_ENCODING. 
     
    513518   * settings.  String is NUL terminated.
    514519   */
    515   char*    valuename;
     520  char* name;
    516521
    517522  /** The raw value name
     
    519524   * Length of the buffer is stored in name_length.
    520525   */
    521   uint8_t* valuename_raw;
    522 
    523   /** Length of valuename_raw */
     526  uint8_t* name_raw;
     527
     528  /** Length of name_raw */
    524529  uint16_t name_length;
    525530
     
    553558   */
    554559  bool     data_in_offset;
     560
     561  /* XXX: deprecated */
     562  REGFI_DATA* data;
     563
    555564} REGFI_VK;
    556565
    557566
    558567/* Key Security */
    559 struct _regfi_sk_rec;
     568struct _regfi_sk;
    560569
    561570/** Security structure
    562571 * @ingroup regfiBase
    563572 */
    564 typedef struct _regfi_sk_rec
     573typedef struct _regfi_sk
    565574{
    566575  /** Real file offset of this record */
     
    599608 * @ingroup regfiBase
    600609 */
    601 typedef struct _regfi_nk_rec
     610typedef struct _regfi_nk
    602611{
    603612  /** Real offset of this record's cell in the file */
     
    642651   * settings.  String is NUL terminated.
    643652   */
    644   char* keyname;
     653  char* name;
    645654
    646655  /** The raw key name
     
    648657   * Length of the buffer is stored in name_length.
    649658   */
    650   uint8_t* keyname_raw;
     659  uint8_t* name_raw;
    651660
    652661  /** Virutal offset of parent key */
     
    662671  uint32_t max_bytes_subkeyclassname;
    663672
    664   /* XXX: max valuename * 2 */
     673  /* XXX: max value name * 2 */
    665674  uint32_t max_bytes_valuename;
    666675
     
    772781  /* Run-time information */
    773782  /************************/
     783  /* For sanity checking (not part of the registry header) */
     784  uint32_t file_length;
     785
     786  /** The encoding that all strings are converted to during interpretation.
     787   */
     788  REGFI_ENCODING string_encoding;
     789
    774790  /* Functions for accessing the file */
    775791  REGFI_RAW_FILE* cb;
     
    780796  pthread_mutex_t cb_lock;
    781797
    782   /* For sanity checking (not part of the registry header) */
    783   uint32_t file_length;
    784 
    785798  /* Metadata about hbins */
    786799  range_list* hbins;
     
    811824  /** The current key */
    812825  REGFI_NK* cur_key;
    813 
    814   /** The encoding that all strings are converted to as set during iterator
    815    *  creation.
    816    */
    817   REGFI_ENCODING string_encoding;
    818826
    819827  /** Index of the current subkey */
     
    866874 */
    867875_EXPORT
    868 REGFI_FILE* regfi_alloc(int fd);
     876REGFI_FILE* regfi_alloc(int fd, REGFI_ENCODING output_encoding);
    869877
    870878
     
    882890 */
    883891_EXPORT
    884 REGFI_FILE* regfi_alloc_cb(REGFI_RAW_FILE* file_cb);
     892REGFI_FILE* regfi_alloc_cb(REGFI_RAW_FILE* file_cb,
     893                           REGFI_ENCODING output_encoding);
    885894
    886895
     
    952961_EXPORT
    953962void regfi_free_record(const void* record);
     963
     964
     965/** Retrieves classname for a given key.
     966 *
     967 * @param file the file from which key is derived
     968 * @param key the key whose classname is desired
     969 *
     970 * @return Returns a newly allocated classname structure, or NULL on failure.
     971 *         Classname structures must be freed with @ref regfi_free_record.
     972 *
     973 * @ingroup regfiBase
     974 */
     975_EXPORT
     976const REGFI_CLASSNAME* regfi_fetch_classname(REGFI_FILE* file,
     977                                             const REGFI_NK* key);
     978
     979
     980/** Returns the SK (security) record referenced by the supplied key.
     981 *
     982 * @param file the file from which key is derived
     983 * @param key  the key whose SK record is desired
     984 *
     985 * @return A read-only SK structure, or NULL on failure.
     986 *
     987 * @ingroup regfiBase
     988 */
     989_EXPORT
     990const REGFI_SK* regfi_fetch_sk(REGFI_FILE* file, const REGFI_NK* key);
     991
     992
     993/** Retrieves data for a given value.
     994 *
     995 * @param file the file from which value is derived
     996 * @param value the value whose data is desired
     997 *
     998 * @return Returns a newly allocated data structure, or NULL on failure.
     999 *         Data structures must be freed with @ref regfi_free_record.
     1000 *
     1001 * @ingroup regfiBase
     1002 */
     1003_EXPORT
     1004const REGFI_DATA* regfi_fetch_data(REGFI_FILE* file,
     1005                                   const REGFI_VK* value);
    9541006
    9551007
     
    9821034 */
    9831035_EXPORT
    984 REGFI_ITERATOR* regfi_iterator_new(REGFI_FILE* file,
    985                                          REGFI_ENCODING output_encoding);
     1036REGFI_ITERATOR* regfi_iterator_new(REGFI_FILE* file);
    9861037
    9871038
     
    10741125
    10751126
    1076 /** Returns the SK (security) record referenced by the current key.
    1077  *
    1078  * @param i the iterator
    1079  *
    1080  * @return A read-only SK structure, or NULL on failure.
    1081  *
    1082  * @ingroup regfiIteratorLayer
    1083  */
    1084 _EXPORT
    1085 const REGFI_SK* regfi_iterator_cur_sk(REGFI_ITERATOR* i);
    1086 
    1087 
    10881127/** Sets the internal subkey index to the first subkey referenced by the current
    10891128 *  key.
     
    11931232bool regfi_iterator_find_value(REGFI_ITERATOR* i,
    11941233                               const char* value_name);
    1195 
    1196 /** Retrieves classname for a given key.
    1197  *
    1198  * @param i   the iterator
    1199  * @param key the key whose classname is desired
    1200  *
    1201  * @return Returns a newly allocated classname structure, or NULL on failure.
    1202  *         Classname structures must be freed with @ref regfi_free_record.
    1203  *
    1204  * @ingroup regfiIteratorLayer
    1205  */
    1206 _EXPORT
    1207 const REGFI_CLASSNAME* regfi_iterator_fetch_classname(REGFI_ITERATOR* i,
    1208                                                       const REGFI_NK* key);
    1209 
    1210 
    1211 /** Retrieves data for a given value.
    1212  *
    1213  * @param i     the iterator
    1214  * @param value the value whose data is desired
    1215  *
    1216  * @return Returns a newly allocated data structure, or NULL on failure.
    1217  *         Data structures must be freed with @ref regfi_free_record.
    1218  *
    1219  * @ingroup regfiIteratorLayer
    1220  */
    1221 _EXPORT
    1222 const REGFI_DATA* regfi_iterator_fetch_data(REGFI_ITERATOR* i,
    1223                                             const REGFI_VK* value);
    1224 
    12251234
    12261235
     
    13301339const REGFI_SK* regfi_load_sk(REGFI_FILE* file, uint32_t offset,
    13311340                                  bool strict);
     1341
     1342
    13321343
    13331344
     
    14701481/*    Private Functions                                                       */
    14711482/******************************************************************************/
    1472 REGFI_NK*         regfi_rootkey(REGFI_FILE* file,
    1473                                     REGFI_ENCODING output_encoding);
     1483REGFI_NK*             regfi_rootkey(REGFI_FILE* file);
    14741484
    14751485off_t                 regfi_raw_seek(REGFI_RAW_FILE* self,
     
    15061516void                  regfi_add_message(REGFI_FILE* file, uint16_t msg_type,
    15071517                                        const char* fmt, ...);
    1508 REGFI_NK*         regfi_copy_nk(const REGFI_NK* nk);
    1509 REGFI_VK*         regfi_copy_vk(const REGFI_VK* vk);
     1518REGFI_NK*             regfi_copy_nk(const REGFI_NK* nk);
     1519REGFI_VK*             regfi_copy_vk(const REGFI_VK* vk);
    15101520_EXPORT
    15111521int32_t               regfi_calc_maxsize(REGFI_FILE* file, uint32_t offset);
Note: See TracChangeset for help on using the changeset viewer.