def _load_hive(self, fname): # because hivex craps out with a bad file, but still tries to release in the # __del__ method, we first check here to see if it can all be loaded. try: h = libhivexmod.open(fname, 0) libhivexmod.close(h) except RuntimeError: raise IOError('Unable to load the registry hive "%s"!' % fname) sys.exit(2) return hivex.Hivex(fname)
def __init__ (self, filename, verbose = False, debug = False, write = False): """Create a new hivex handle.""" flags = 0 # Verbose messages if verbose: flags += 1 # Debug messages if debug: flags += 2 # Enable writes to the hive if write: flags += 4 self._o = libhivexmod.open (filename, flags)