Displaying 20 results from an estimated 26 matches for "block_id_eq".
2014 Aug 07
4
[PATCH 0/2] Fix errors found by Clang static analyzer
Hi,
Here is one trivial initialization fix and another patch to convert a huge macro
to an inline function. The result of the expansion would show up in an assertion
which triggered a -Woverlength-strings warning.
Peter Wu (2):
Fix garbage return value on error
Fix overly long assertion string
lib/hivex-internal.h | 28 ++++++++++++++++------------
lib/node.c | 18
2010 Feb 05
1
-Woverlength-strings / assert unhelpful interaction
...----- next part --------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
struct hive_h {
void *addr;
};
struct ntreg_hbin_block {
char id[2];
};
typedef size_t hive_node_h;
#define STREQLEN(a,b,n) (strncmp((a),(b),(n)) == 0)
#define BLOCK_ID_EQ(h,offs,eqid) \
(STREQLEN (((struct ntreg_hbin_block *)((h)->addr + (offs)))->id, (eqid), 2))
static size_t
insert_lf_record (struct hive_h *h, size_t old_offs, size_t posn,
const char *name, hive_node_h node)
{
assert (BLOCK_ID_EQ (h, old_offs, "lf") || BLOCK_...
2013 Jul 25
19
[PATCH hivex 00/19] Fix read/write handling of li-records.
This is, hopefully, a full fix for handling of li-records.
See:
https://bugzilla.redhat.com/show_bug.cgi?id=717583
https://bugzilla.redhat.com/show_bug.cgi?id=987463
Rich.
2010 Feb 05
13
[PATCH 01/14] hivexsh: Document some peculiarities of the "cd" command.
---
hivex/hivexsh.pod | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/hivex/hivexsh.pod b/hivex/hivexsh.pod
index 277e3ae..9336798 100644
--- a/hivex/hivexsh.pod
+++ b/hivex/hivexsh.pod
@@ -100,7 +100,14 @@ or even:
Path elements (node names) are matched case insensitively, and
characters like space, C<*>, and C<?> have I<no> special
2011 Sep 02
1
[PATCH 4/7] hivex: Add metadata length functions for nodes and values
...value",
"\
diff --git a/lib/hivex.c b/lib/hivex.c
index 61177d3..d8ffa63 100644
--- a/lib/hivex.c
+++ b/lib/hivex.c
@@ -585,6 +585,30 @@ hivex_root (hive_h *h)
return ret;
}
+size_t
+hivex_node_struct_length (hive_h *h, hive_node_h node)
+{
+ if (!IS_VALID_BLOCK (h, node) || !BLOCK_ID_EQ (h, node, "nk")) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ struct ntreg_nk_record *nk = (struct ntreg_nk_record *) (h->addr + node);
+ size_t name_len = le16toh (nk->name_len);
+ /* -1 to avoid double-counting the first name character */
+ size_t ret = name_len + sizeof (st...
2011 Apr 13
1
[PATCH hivex] maint: split long lines
...because ri-offset is not a valid block (0x%zx)\n",
+ fprintf (stderr, "hivex_node_children: returning EFAULT"
+ " because ri-offset is not a valid block (0x%zx)\n",
offset);
errno = EFAULT;
goto error;
}
if (!BLOCK_ID_EQ (h, offset, "lf") && !BLOCK_ID_EQ (h, offset, "lh")) {
if (h->msglvl >= 2)
- fprintf (stderr, "get_children: returning ENOTSUP because ri-record offset does not point to lf/lh (0x%zx)\n",
+ fprintf (stderr, "get_children: r...
2011 Sep 02
1
[PATCH 2/7] hivex: Split value_key function into value_key and value_key_len
.../lib/hivex.c
+++ b/lib/hivex.c
@@ -1189,8 +1189,8 @@ hivex_node_get_value (hive_h *h, hive_node_h node, const char *key)
return ret;
}
-char *
-hivex_value_key (hive_h *h, hive_value_h value)
+size_t
+hivex_value_key_len (hive_h *h, hive_value_h value)
{
if (!IS_VALID_BLOCK (h, value) || !BLOCK_ID_EQ (h, value, "vk")) {
errno = EINVAL;
@@ -1199,23 +1199,38 @@ hivex_value_key (hive_h *h, hive_value_h value)
struct ntreg_vk_record *vk = (struct ntreg_vk_record *) (h->addr + value);
- /* AFAIK the key is always plain ASCII, so no conversion to UTF-8 is
- * necessary. H...
2016 Feb 14
2
hivex lib: Add function hivex_node_num_children
...diff --git a/lib/node.c b/lib/node.c
index 1fb48cf..fc3ca71 100644
--- a/lib/node.c
+++ b/lib/node.c
@@ -513,6 +513,22 @@ hivex_node_children (hive_h *h, hive_node_h node)
return children;
}
+size_t
+hivex_node_num_children (hive_h *h, hive_node_h node)
+{
+ if (!IS_VALID_BLOCK (h, node) || !block_id_eq(h, node, "nk")) {
+ SET_ERRNO( EINVAL, "invalid block or not an 'nk' block");
+ return 0;
+ }
+
+ struct ntreg_nk_record *nk =
+ (struct ntreg_nk_record *) ((char *) h->addr + node);
+
+ size_t nr_subkeys_in_nk = le32toh(nk->nr_subkeys);
+
+ return nr_...
2013 Jun 23
3
[PATCH] Add read support for "big data" blocks to hivex
...ller length to the caller too. */
- if (len_rtn)
- *len_rtn = len;
+ if (len <= blen - 4 /* subtract 4 for block header */) {
+ char *data = (char *) h->addr + data_offset + 4;
+ memcpy (ret, data, len);
+ return ret;
+ } else {
+ if (!IS_VALID_BLOCK (h, data_offset) || !BLOCK_ID_EQ (h, data_offset, "db")) {
+ if (h->msglvl >= 2)
+ fprintf (stderr, "hivex_value_value: warning: declared data length "
+ "is longer than the amount of data found in big-data blocks "
+ "(data 0x%zx, data len %zu)\n...
2013 Jun 25
2
Re: [PATCH] Add read support for "big data" blocks to hivex
* Richard W.M. Jones:
> diff --git a/lib/hivex.c b/lib/hivex.c
> index e3c1e05..9351ac5 100644
> --- a/lib/hivex.c
> +++ b/lib/hivex.c
> @@ -1471,7 +1471,7 @@ hivex_value_value (hive_h *h, hive_value_h value,
> if (h->msglvl >= 2)
> fprintf (stderr, "hivex_value_value: warning: big data block is not "
> "valid
2011 Aug 31
1
[PATCH] hivex: Add byte runs for nodes and values
..., INT2NUM (len));\n";
diff --git a/lib/hivex.c b/lib/hivex.c
index 4b9fcf0..04ceed3 100644
--- a/lib/hivex.c
+++ b/lib/hivex.c
@@ -585,6 +585,30 @@ hivex_root (hive_h *h)
return ret;
}
+size_t
+hivex_node_struct_length (hive_h *h, hive_node_h node)
+{
+ if (!IS_VALID_BLOCK (h, node) || !BLOCK_ID_EQ (h, node, "nk")) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ struct ntreg_nk_record *nk = (struct ntreg_nk_record *) (h->addr + node);
+ size_t name_len = le16toh (nk->name_len);
+ /* -1 to avoid double-counting the first name character */
+ size_t ret = name_len + sizeof (st...
2016 Feb 15
1
New API: node_nr_values
...\
diff --git a/lib/value.c b/lib/value.c
index 43e89f9..2dfe006 100644
--- a/lib/value.c
+++ b/lib/value.c
@@ -159,6 +159,22 @@ hivex_node_get_value (hive_h *h, hive_node_h
node, const char *key)
}
size_t
+hivex_node_nr_values (hive_h *h, hive_node_h node)
+{
+ if (!IS_VALID_BLOCK (h, node) || !block_id_eq (h, node, "nk")) {
+ SET_ERRNO (EINVAL, "invalid block or not an 'nk' block");
+ return 0;
+ }
+
+ struct ntreg_nk_record *nk =
+ (struct ntreg_nk_record *) ((char *) h->addr + node);
+
+ size_t nr_values = le32toh (nk->nr_values);
+
+ return nr_values...
2011 Oct 19
0
[hivex][PATCH 3/8] hivex: Add offset-&-length function for long value data
.....df313bf 100644
--- a/lib/hivex.c
+++ b/lib/hivex.c
@@ -1257,6 +1257,66 @@ hivex_value_type (hive_h *h, hive_value_h value, hive_type *t, size_t *len)
return 0;
}
+hive_value_h
+hivex_value_data_cell_offset (hive_h *h, hive_value_h value, size_t *len)
+{
+ if (!IS_VALID_BLOCK (h, value) || !BLOCK_ID_EQ (h, value, "vk")) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ if (h->msglvl >= 2)
+ fprintf (stderr, "hivex_value_data_cell_offset: value=0x%zx\n", value);
+ struct ntreg_vk_record *vk = (struct ntreg_vk_record *) (h->addr + value);
+
+ size_t data_len;
+ int...
2011 Dec 08
0
[hivex] [PATCH 3/8] hivex: Add offset-&-length function for long value data
.....df313bf 100644
--- a/lib/hivex.c
+++ b/lib/hivex.c
@@ -1257,6 +1257,66 @@ hivex_value_type (hive_h *h, hive_value_h value, hive_type *t, size_t *len)
return 0;
}
+hive_value_h
+hivex_value_data_cell_offset (hive_h *h, hive_value_h value, size_t *len)
+{
+ if (!IS_VALID_BLOCK (h, value) || !BLOCK_ID_EQ (h, value, "vk")) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ if (h->msglvl >= 2)
+ fprintf (stderr, "hivex_value_data_cell_offset: value=0x%zx\n", value);
+ struct ntreg_vk_record *vk = (struct ntreg_vk_record *) (h->addr + value);
+
+ size_t data_len;
+ int...
2011 Sep 02
1
[PATCH 5/7] hivex: Add offset-&-length function for long value data
.....04ceed3 100644
--- a/lib/hivex.c
+++ b/lib/hivex.c
@@ -1294,6 +1294,51 @@ hivex_value_type (hive_h *h, hive_value_h value, hive_type *t, size_t *len)
return 0;
}
+hive_value_h
+hivex_value_data_cell_offset (hive_h *h, hive_value_h value, size_t *len)
+{
+ if (!IS_VALID_BLOCK (h, value) || !BLOCK_ID_EQ (h, value, "vk")) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ struct ntreg_vk_record *vk = (struct ntreg_vk_record *) (h->addr + value);
+
+ size_t data_len;
+ int is_inline;
+
+ data_len = le32toh (vk->data_len);
+ is_inline = !!(data_len & 0x80000000);
+ data_len &...
2013 Jun 25
0
Re: [PATCH] Add read support for "big data" blocks to hivex
...if (len_rtn)
> - *len_rtn = len;
> + if (len <= blen - 4 /* subtract 4 for block header */) {
> + char *data = (char *) h->addr + data_offset + 4;
> + memcpy (ret, data, len);
> + return ret;
> + } else {
> + if (!IS_VALID_BLOCK (h, data_offset) || !BLOCK_ID_EQ (h, data_offset, "db")) {
> + if (h->msglvl >= 2)
> + fprintf (stderr, "hivex_value_value: warning: declared data length "
> + "is longer than the amount of data found in big-data blocks "
> + "(data 0x...
2013 Jun 25
0
[PATCH] Add read support for "big data" blocks to hivex
...ller length to the caller too. */
- if (len_rtn)
- *len_rtn = len;
+ if (len <= blen - 4 /* subtract 4 for block header */) {
+ char *data = (char *) h->addr + data_offset + 4;
+ memcpy (ret, data, len);
+ return ret;
+ } else {
+ if (!IS_VALID_BLOCK (h, data_offset) || !BLOCK_ID_EQ (h, data_offset, "db")) {
+ if (h->msglvl >= 2)
+ fprintf (stderr, "hivex_value_value: warning: declared data length "
+ "is longer than the block and block is not a db block "
+ "(data 0x%zx, data len %zu)\n"...
2010 Jul 07
1
[PATCH] hivex: add hivex_set_value api call and ocaml/perl bindings, tests
...+2606,93 @@ hivex_node_set_values (hive_h *h, hive_node_h node,
return 0;
}
+
+
+int
+hivex_node_set_value (hive_h *h, hive_node_h node,
+ const hive_set_value *val, int flags)
+{
+ if (!h->writable) {
+ errno = EROFS;
+ return -1;
+ }
+
+ if (!IS_VALID_BLOCK (h, node) || !BLOCK_ID_EQ (h, node, "nk")) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ hive_value_h *prev_values = hivex_node_values (h, node);
+ if (prev_values == NULL)
+ return -1;
+
+ int retval = -1;
+
+ size_t nr_values = 0;
+ for (hive_value_h *itr = prev_values; *itr != 0; ++itr)
+ ++nr_valu...
2010 Jul 22
0
Fwd: [PATCH hivex] non-ASCII characters in node names
..., len);
+ } else {
+ ret = windows_utf16_to_utf8(nk->name, len);
+ }
return ret;
}
@@ -1113,6 +1111,7 @@ hivex_node_get_value (hive_h *h, hive_node_h node, const char *key)
char *
hivex_value_key (hive_h *h, hive_value_h value)
{
+ iconv_t ic;
if (!IS_VALID_BLOCK (h, value) || !BLOCK_ID_EQ (h, value, "vk")) {
errno = EINVAL;
return 0;
@@ -1120,10 +1119,6 @@ hivex_value_key (hive_h *h, hive_value_h value)
struct ntreg_vk_record *vk = (struct ntreg_vk_record *) (h->addr + value);
- /* AFAIK the key is always plain ASCII, so no conversion to UTF-8 is
- *...
2010 Jul 03
1
[PATCH] hivex: add hivex_set_value api call
...+2606,93 @@ hivex_node_set_values (hive_h *h, hive_node_h node,
return 0;
}
+
+
+int
+hivex_node_set_value (hive_h *h, hive_node_h node,
+ const hive_set_value *val, int flags)
+{
+ if (!h->writable) {
+ errno = EROFS;
+ return -1;
+ }
+
+ if (!IS_VALID_BLOCK (h, node) || !BLOCK_ID_EQ (h, node, "nk")) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ hive_value_h *prev_values = hivex_node_values (h, node);
+ if (prev_values == NULL)
+ return -1;
+
+ int retval = -1;
+
+ size_t nr_values = 0;
+ for (hive_value_h *itr = prev_values; *itr != 0; ++itr)
+ ++nr_valu...