Changeset 210 for trunk


Ignore:
Timestamp:
10/22/10 18:46:49 (14 years ago)
Author:
tim
Message:

beginnings of pyregfi documentation build script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/pyregfi/__init__.py

    r209 r210  
    11#!/usr/bin/env python
     2
     3## @package pyregfi
     4# Python interface to the regfi library.
     5#
    26
    37import sys
     
    106110
    107111
    108 
    109 regfi.regfi_get_value
    110 
    111112regfi.regfi_init.argtypes = []
    112113regfi.regfi_init.restype = None
     
    114115
    115116
     117## Retrieves messages produced by regfi during parsing and interpretation
     118#
    116119def GetLogMessages():
    117120    msgs = regfi.regfi_log_get_str()
     
    142145
    143146    return ret_val
    144                
    145 
     147
     148
     149## Abstract class which Handles memory management and proxies attribute
     150#  access to base structures 
    146151class _StructureWrapper():
    147     "Handles memory management and proxies attribute access to base structures"
     152
    148153    hive = None
    149154    base = None
     
    166171        return (not self.__eq__(other))
    167172
    168 
     173## Registry key
    169174class Key(_StructureWrapper):
    170175    pass
     
    173178    pass
    174179
     180## Registry value data
    175181class Data(_StructureWrapper):
    176182    pass
    177183
     184## Registry security record/permissions
    178185class Security(_StructureWrapper):
    179186    pass
     
    277284
    278285
     286## Registry value (metadata)
     287#
     288# These represent registry values (@ref REGFI_VK records) and provide
     289# access to their associated data.
     290#
    279291class Value(_StructureWrapper):
    280292    def __getattr__(self, name):
     
    343355
    344356
    345 class Hive():   
     357## Represents a single registry hive (file)
     358#
     359class Hive():
    346360    file = None
    347361    raw_file = None
     
    366380        return getattr(self.file.contents, name)
    367381   
    368     def __del__(self):   
     382    def __del__(self):
    369383        regfi.regfi_free(self.file)
    370384        if self.raw_file != None:
     
    375389        return HiveIterator(self)
    376390
     391    ## Creates a @ref HiveIterator initialized at the specified path in
     392    #  the hive.
     393    #
     394    # Raises an Exception if the path could not be found/traversed.
    377395    def subtree(self, path):
    378396        hi = HiveIterator(self)
     
    381399
    382400
     401## A special purpose iterator for registry hives
     402#
     403# Iterating over an object of this type causes all keys in a specific
     404# hive subtree to be returned in a depth-first manner. These iterators
     405# are typically created using the @ref Hive.subtree() function on a @ref Hive
     406# object.
     407#
     408# HiveIterators can also be used to manually traverse up and down a
     409# registry hive as they retain information about the current position in
     410# the hive, along with which iteration state for subkeys and values for
     411# every parent key.  See the @ref up and @ref down methods for more
     412# information.
    383413class HiveIterator():
    384414    hive = None
     
    419449                raise StopIteration('')
    420450           
     451            # XXX: Use non-generic exception
    421452            if not regfi.regfi_iterator_down(self.iter):
    422453                raise Exception('Error traversing iterator downward.'+
     
    439470        apath = (c_char_p*len(path))(*cpath)
    440471
     472        # XXX: Use non-generic exception
    441473        if not regfi.regfi_iterator_walk_path(self.iter,apath):
    442474            raise Exception('Could not locate path.\n'+GetLogMessages())
     
    444476    def current_key(self):
    445477        return Key(self.hive, regfi.regfi_iterator_cur_key(self.iter))
     478
     479    #XXX Add subkey/value search accessor functions (?)
Note: See TracChangeset for help on using the changeset viewer.