static PyObject * py_hivex_node_name (PyObject *self, PyObject *args) { PyObject *py_r; char *r; hive_h *h; PyObject *py_h; long node; if (!PyArg_ParseTuple (args, (char *) "Ol:hivex_node_name", &py_h, &node)) return NULL; h = get_handle (py_h); r = hivex_node_name (h, node); if (r == NULL) { PyErr_SetString (PyExc_RuntimeError, strerror (errno)); return NULL; } #ifdef HAVE_PYSTRING_ASSTRING py_r = PyString_FromString (r); #else py_r = PyUnicode_FromString (r); #endif free (r); return py_r; }
char * do_hivex_node_name (int64_t nodeh) { char *r; NEED_HANDLE (NULL); r = hivex_node_name (h, nodeh); if (r == NULL) { reply_with_perror ("failed"); return NULL; } return r; }
/* Compare name with name in nk-record. */ static int compare_name_with_nk_name (hive_h *h, const char *name, hive_node_h nk_offs) { assert (IS_VALID_BLOCK (h, nk_offs)); assert (block_id_eq (h, nk_offs, "nk")); /* Name in nk is not necessarily nul-terminated. */ char *nname = hivex_node_name (h, nk_offs); /* Unfortunately we don't have a way to return errors here. */ if (!nname) { perror ("compare_name_with_nk_name"); return 0; } int r = strcasecmp (name, nname); free (nname); return r; }