Changeset 166 for trunk/include


Ignore:
Timestamp:
12/15/09 22:18:05 (15 years ago)
Author:
tim
Message:

fixed a bug in big data parsing
broke up some of REGFI_FILE initialization
started added more regfi API documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/regfi.h

    r165 r166  
    519519/*                         Main iterator API                                  */
    520520/******************************************************************************/
     521
     522/* regfi_open: Attempts to open a registry hive and allocate related data
     523 *             structures.
     524 *
     525 * Arguments:
     526 *   filename -- A string containing the relative or absolute path of the
     527 *               registry hive to be opened.
     528 *
     529 * Returns:
     530 *   A reference to a newly allocated REGFI_FILE structure, if successful.
     531 *   NULL on error.
     532 */
    521533REGFI_FILE*           regfi_open(const char* filename);
    522 int                   regfi_close(REGFI_FILE* r);
     534
     535
     536/* regfi_alloc: Parses file headers of an already open registry hive file and
     537 *              allocates related structures for further parsing.
     538 *
     539 * Arguments:
     540 *   fd       -- A file descriptor of an already open file.  Must be seekable.
     541 *
     542 * Returns:
     543 *   A reference to a newly allocated REGFI_FILE structure, if successful.
     544 *   NULL on error.
     545 */
     546REGFI_FILE*           regfi_alloc(int fd);
     547
     548
     549/* regfi_close: Closes and frees an open registry hive.
     550 *
     551 * Arguments:
     552 *   file     -- The registry structure to close.
     553 *
     554 * Returns:
     555 *   0 on success, -1 on failure with errno set. 
     556 *   errno codes are similar to those of close(2).
     557 */
     558int                   regfi_close(REGFI_FILE* file);
     559
     560
     561/* regfi_free: Frees a hive's data structures without closing the underlying
     562 *             file.
     563 *
     564 * Arguments:
     565 *   file     -- The registry structure to free.
     566 */
     567void                  regfi_free(REGFI_FILE* file);
     568
    523569
    524570/* regfi_get_messages: Get errors, warnings, and/or verbose information
     
    533579char*                 regfi_get_messages(REGFI_FILE* file);
    534580
     581
     582/* regfi_set_message_mask: Set the verbosity level of errors and warnings
     583 *                         generated by the library
     584 *                         (as accessible via regfi_get_messages).
     585 *
     586 * Arguments:
     587 *   file     -- the structure for the registry file
     588 *   mask     -- an integer representing the types of messages desired.
     589 *               Acceptable values are created through bitwise ORs of
     590 *               REGFI_MSG_* values.  For instance, if only errors and
     591 *               informational messages were desired (but not warnings),
     592 *               then one would specify: REGFI_MSG_ERROR|REGFI_MSG_INFO
     593 *               New REGFI_FILE structures are created with:
     594 *                REGFI_MSG_ERROR|REGFI_MSG_WARN
     595 *               Note that error and warning messages will continue to
     596 *               accumulate in memory if they are not fetched using
     597 *               regfi_get_messages and then freed by the caller.
     598 *               To disable error messages entirely, supply 0, which
     599 *               will prevent message accumulation. 
     600 *
     601 * This may be called at any time and will take effect immediately.
     602 */
    535603void                  regfi_set_message_mask(REGFI_FILE* file, uint16 mask);
    536604
     
    549617 *                      REGFI_ENCODING_UTF8
    550618 *
    551  *                      XXX: This encoding only applies to specific data
    552  *                           strings currently, but should apply to key
    553  *                           names and value names in the future.
    554  *
    555619 * Returns:
    556620 *   A newly allocated REGFI_ITERATOR. Must be free()d with regfi_iterator_free.
     
    558622REGFI_ITERATOR*       regfi_iterator_new(REGFI_FILE* file,
    559623                                         REGFI_ENCODING output_encoding);
     624
     625
     626/* regfi_iterator_free: Frees a registry file iterator previously created by
     627 *                      regfi_iterator_new.
     628 *
     629 * This does not affect the underlying registry file's allocation status.
     630 *
     631 * Arguments:
     632 *   file            -- the iterator to be freed
     633 */
    560634void                  regfi_iterator_free(REGFI_ITERATOR* i);
     635
     636
     637/* regfi_iterator_down: Traverse deeper into the registry tree at the
     638 *                      current subkey.
     639 *
     640 * Arguments:
     641 *   i            -- the iterator
     642 *
     643 * Returns:
     644 *   true on success, false on failure.  Note that subkey and value indexes
     645 *   are preserved.  That is, if a regfi_iterator_up call occurs later
     646 *   (reversing the effect of this call) then the subkey and value referenced
     647 *   prior to the regfi_iterator_down call will still be referenced.  This
     648 *   makes depth-first iteration particularly easy.
     649 */
    561650bool                  regfi_iterator_down(REGFI_ITERATOR* i);
     651
     652
     653/* regfi_iterator_up: Traverse up to the current key's parent key.
     654 *
     655 * Arguments:
     656 *   i            -- the iterator
     657 *
     658 * Returns:
     659 *   true on success, false on failure.  Any subkey or value state
     660 *   associated with the current key is lost.
     661 */
    562662bool                  regfi_iterator_up(REGFI_ITERATOR* i);
     663
     664
     665/* regfi_iterator_to_root: Traverse up to the root key of the hive.
     666 *
     667 * Arguments:
     668 *   i            -- the iterator
     669 *
     670 * Returns:
     671 *   true on success, false on failure.
     672 */
    563673bool                  regfi_iterator_to_root(REGFI_ITERATOR* i);
    564674
     675
     676/* regfi_iterator_walk_path: Traverse down multiple levels in the registry hive.
     677 *
     678 * Arguments:
     679 *   i            -- the iterator
     680 *   path         -- a list of key names representing the path.  This list must
     681 *                   contain NUL terminated strings.  The list itself is
     682 *                   terminated with a NULL pointer.  All path elements must be
     683 *                   keys; value names are not accepted (even as the last
     684 *                   element).
     685 *
     686 * XXX: This currently only accepts ASCII key names.  Need to look into
     687 *      accepting other encodings.
     688 *
     689 * Returns:
     690 *   true on success, false on failure.  If any element of path is not found,
     691 *   false will be returned and the iterator will remain in its original
     692 *   position.
     693 */
    565694bool                  regfi_iterator_walk_path(REGFI_ITERATOR* i,
    566695                                               const char** path);
     696
     697
     698/* regfi_iterator_cur_key: Returns the currently referenced key.
     699 *
     700 * Arguments:
     701 *   i            -- the iterator
     702 *
     703 * Returns:
     704 *   A read-only key structure for the current key, or NULL on failure.
     705 */
    567706const REGFI_NK_REC*   regfi_iterator_cur_key(REGFI_ITERATOR* i);
     707
     708
     709/* regfi_iterator_cur_sk: Returns the SK (security) record referenced by the
     710 *                        current key.
     711 *
     712 * Arguments:
     713 *   i            -- the iterator
     714 *
     715 * Returns:
     716 *   A read-only SK structure, or NULL on failure.
     717 */
    568718const REGFI_SK_REC*   regfi_iterator_cur_sk(REGFI_ITERATOR* i);
    569719
     720
     721/* regfi_iterator_first_subkey: Sets the internal subkey index to the first
     722 *                              subkey referenced by the current key.
     723 *
     724 * Arguments:
     725 *   i            -- the iterator
     726 *
     727 * Returns:
     728 *   A read-only key structure for the newly referenced first subkey,
     729 *   or NULL on failure.  Failure may be due to a lack of any subkeys or other
     730 *   errors.
     731 */
    570732REGFI_NK_REC*         regfi_iterator_first_subkey(REGFI_ITERATOR* i);
     733
     734
     735/* regfi_iterator_cur_subkey: Returns the currently indexed subkey.
     736 *
     737 * Arguments:
     738 *   i            -- the iterator
     739 *
     740 * Returns:
     741 *   A newly allocated key structure for the currently referenced subkey,
     742 *   or NULL on failure.  Newly allocated keys must be freed with
     743 *   regfi_free_key.
     744 */
    571745REGFI_NK_REC*         regfi_iterator_cur_subkey(REGFI_ITERATOR* i);
    572746REGFI_NK_REC*         regfi_iterator_next_subkey(REGFI_ITERATOR* i);
Note: See TracChangeset for help on using the changeset viewer.