static void hivex_finalize (void) { if (h) { hivex_close (h); h = NULL; } }
int do_hivex_close (void) { NEED_HANDLE (-1); hivex_close (h); h = NULL; return 0; }
static PyObject * py_hivex_close (PyObject *self, PyObject *args) { PyObject *py_r; int r; hive_h *h; PyObject *py_h; if (!PyArg_ParseTuple (args, (char *) "O:hivex_close", &py_h)) return NULL; h = get_handle (py_h); r = hivex_close (h); if (r == -1) { PyErr_SetString (PyExc_RuntimeError, strerror (errno)); return NULL; } Py_INCREF (Py_None); py_r = Py_None; return py_r; }
/* Takes optional arguments, consult optargs_bitmask. */ int do_hivex_open (const char *filename, int verbose, int debug, int write) { CLEANUP_FREE char *buf = NULL; int flags = 0; if (h) { hivex_close (h); h = NULL; } buf = sysroot_path (filename); if (!buf) { reply_with_perror ("malloc"); return -1; } if (optargs_bitmask & GUESTFS_HIVEX_OPEN_VERBOSE_BITMASK) { if (verbose) flags |= HIVEX_OPEN_VERBOSE; } if (optargs_bitmask & GUESTFS_HIVEX_OPEN_DEBUG_BITMASK) { if (debug) flags |= HIVEX_OPEN_DEBUG; } if (optargs_bitmask & GUESTFS_HIVEX_OPEN_WRITE_BITMASK) { if (write) flags |= HIVEX_OPEN_WRITE; } h = hivex_open (buf, flags); if (!h) { reply_with_perror ("hivex failed to open %s", filename); return -1; } return 0; }