pyregfi
Loading...
Searching...
No Matches
Public Member Functions | List of all members
pyregfi.HiveIterator Class Reference

A special purpose iterator for registry hives. More...

Public Member Functions

 down (self, subkey_name=None)
 Descends the iterator to a subkey.
 
 up (self)
 Causes the iterator to ascend to the current Key's parent.
 
 first_subkey (self)
 Selects first subkey of current key.
 
 first_value (self)
 Selects first value of current Key.
 
 next_subkey (self)
 Selects the next subkey in the current Key's list.
 
 next_value (self)
 Selects the next value in the current Key's list.
 
 find_subkey (self, name)
 Selects the first subkey which has the specified name.
 
 find_value (self, name)
 Selects the first value which has the specified name.
 
 current_subkey (self)
 Retrieves the currently selected subkey.
 
 current_value (self)
 Retrieves the currently selected value.
 
 current_key (self)
 Retrieves the current key.
 
 descend (self, path)
 Traverse downward multiple levels.
 
 ancestry (self)
 Obtains a list of the current key's ancestry.
 
 current_path (self)
 Obtains the current path of the iterator.
 

Detailed Description

A special purpose iterator for registry hives.

Iterating over an object of this type causes all keys in a specific hive subtree to be returned in a depth-first manner. These iterators are typically created using the Hive.subtree() function on a Hive object.

HiveIterators can also be used to manually traverse up and down a registry hive as they retain information about the current position in the hive, along with which iteration state for subkeys and values for every parent key. See the up and down methods for more information.

Member Function Documentation

◆ down()

pyregfi.HiveIterator.down (   self,
  subkey_name = None 
)

Descends the iterator to a subkey.

Descends the iterator one level to the current subkey, or a subkey specified by name.

Parameters
subkey_nameIf specified, locates specified subkey by name (via find_subkey()) and descends to it.
Returns
True if successful, False otherwise

References pyregfi.HiveIterator._iter, and pyregfi.HiveIterator._lock.

◆ up()

pyregfi.HiveIterator.up (   self)

Causes the iterator to ascend to the current Key's parent.

Returns
True if successful, False otherwise
Note
The state of current subkeys and values at this level in the tree is lost as a side effect. That is, if you go up() and then back down() again, current_subkey() and current_value() will return default selections.

References pyregfi.HiveIterator._iter, and pyregfi.HiveIterator._lock.

◆ first_subkey()

pyregfi.HiveIterator.first_subkey (   self)

Selects first subkey of current key.

Returns
A Key instance for the first subkey.
None on error or if the current key has no subkeys.

References pyregfi.HiveIterator._iter, pyregfi.HiveIterator._lock, and pyregfi.HiveIterator.current_subkey().

◆ first_value()

pyregfi.HiveIterator.first_value (   self)

Selects first value of current Key.

Returns
A Value instance for the first value.
None on error or if the current key has no values.

References pyregfi.HiveIterator._iter, pyregfi.HiveIterator._lock, and pyregfi.HiveIterator.current_value().

◆ next_subkey()

pyregfi.HiveIterator.next_subkey (   self)

Selects the next subkey in the current Key's list.

Returns
A Key instance for the next subkey. None if there are no remaining subkeys or an error occurred.

References pyregfi.HiveIterator._iter, pyregfi.HiveIterator._lock, and pyregfi.HiveIterator.current_subkey().

◆ next_value()

pyregfi.HiveIterator.next_value (   self)

Selects the next value in the current Key's list.

Returns
A Value instance for the next value. None if there are no remaining values or an error occurred.

References pyregfi.HiveIterator._iter, pyregfi.HiveIterator._lock, and pyregfi.HiveIterator.current_value().

◆ find_subkey()

pyregfi.HiveIterator.find_subkey (   self,
  name 
)

Selects the first subkey which has the specified name.

Returns
A Key instance for the selected key. None if it could not be located or an error occurred.

References pyregfi.HiveIterator._iter, pyregfi.HiveIterator._lock, and pyregfi.HiveIterator.current_subkey().

◆ find_value()

pyregfi.HiveIterator.find_value (   self,
  name 
)

Selects the first value which has the specified name.

Returns
A Value instance for the selected value. None if it could not be located or an error occurred.

References pyregfi.HiveIterator._iter, pyregfi.HiveIterator._lock, and pyregfi.HiveIterator.current_value().

◆ current_subkey()

pyregfi.HiveIterator.current_subkey (   self)

Retrieves the currently selected subkey.

Returns
A Key instance of the current subkey

References pyregfi._StructureWrapper._hive, pyregfi.Security._hive, pyregfi._GenericList._hive, pyregfi.Key._hive, pyregfi.HiveIterator._hive, pyregfi.HiveIterator._iter, and pyregfi.HiveIterator._lock.

Referenced by pyregfi.HiveIterator.find_subkey(), pyregfi.HiveIterator.first_subkey(), and pyregfi.HiveIterator.next_subkey().

◆ current_value()

pyregfi.HiveIterator.current_value (   self)

Retrieves the currently selected value.

Returns
A Value instance of the current value

References pyregfi._StructureWrapper._hive, pyregfi.Security._hive, pyregfi._GenericList._hive, pyregfi.Key._hive, pyregfi.HiveIterator._hive, pyregfi.HiveIterator._iter, and pyregfi.HiveIterator._lock.

Referenced by pyregfi.HiveIterator.find_value(), pyregfi.HiveIterator.first_value(), and pyregfi.HiveIterator.next_value().

◆ current_key()

pyregfi.HiveIterator.current_key (   self)

Retrieves the current key.

Returns
A Key instance of the current position of the iterator

References pyregfi._StructureWrapper._hive, pyregfi.Security._hive, pyregfi._GenericList._hive, pyregfi.Key._hive, pyregfi.HiveIterator._hive, pyregfi.HiveIterator._iter, and pyregfi.HiveIterator._lock.

◆ descend()

pyregfi.HiveIterator.descend (   self,
  path 
)

Traverse downward multiple levels.

This is more efficient than calling down() multiple times

Parameters
pathA list of Key names which represent the path to descend
Exceptions
ExceptionIf path could not be located

References pyregfi.HiveIterator._iter, pyregfi.HiveIterator._lock, and pyregfi.getLogMessages().

◆ ancestry()

pyregfi.HiveIterator.ancestry (   self)

Obtains a list of the current key's ancestry.

Returns
A list of all parent keys starting with the root Key and ending with the current Key

References pyregfi._StructureWrapper._hive, pyregfi.Security._hive, pyregfi._GenericList._hive, pyregfi.Key._hive, pyregfi.HiveIterator._hive, pyregfi.HiveIterator._iter, and pyregfi.HiveIterator._lock.

Referenced by pyregfi.HiveIterator.current_path().

◆ current_path()

pyregfi.HiveIterator.current_path (   self)

Obtains the current path of the iterator.

Returns
A list of key names starting with the root up to and including the current key

References pyregfi.HiveIterator.ancestry().


The documentation for this class was generated from the following file: