-- v2: winedump: Support REG_QWORD values in regf files. winedump: Support dumping UTF16 value names in regf files. winedump: Don't dump volatile keys from regf file. winedump: Enlarge buffer in dump_want_n helper. winedump: Skip data blocks when dumping regf files. winedump: Support REG_MULTI_SZ values in regf files. winedump: Support REG_BINARY values in regf files. winedump: Support REG_NONE values in regf files. winedump: Support REG_EXPAND_SZ values in regf files. winedump: Fix empty string handling in regf files. winedump: Support dumping default values without VAL_COMP_NAME flag. winedump: Support REG_DWORD values in regf files. winedump: Add support for decoding data stored in offset in regf files. winedump: Fix non null terminated strings printing in regf files.
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 1c6c6293415..338e37133e0 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -212,7 +212,7 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) if (!name) return FALSE;
- printf(""%*s"=", val->name_size, name); + printf(""%.*s"=", val->name_size, name); } else { @@ -315,7 +315,7 @@ void reg_dump(void) return;
printf("File Header\n"); - printf(" %-20s %4s\n", "signature:", (char*)&hdr->signature); + printf(" %-20s %.4s\n", "signature:", (char*)&hdr->signature); printf(" %-20s %u\n", "primary sequence:", hdr->seq_prim); printf(" %-20s %u\n", "secondary sequence:", hdr->seq_sec); printf(" %-20s %s\n", "modification time:", filetime_str(hdr->modif_time));
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 338e37133e0..92ab3839de8 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -193,6 +193,7 @@ static BOOL dump_subkeys(unsigned int hive_off, unsigned int off) static BOOL dump_value(unsigned int hive_off, unsigned int off) { const void *data = NULL; + unsigned int data_size; const value_key *val; const char *name;
@@ -219,9 +220,15 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) printf("@="); }
- if (val->data_size) + data_size = val->data_size; + if (data_size & 0x80000000) + { + data = &val->data_off; + data_size &= ~0x80000000; + } + else if (data_size) { - data = PRD(hive_off + val->data_off + sizeof(unsigned int), val->data_size); + data = PRD(hive_off + val->data_off + sizeof(unsigned int), data_size); if (!data) return FALSE; } @@ -230,7 +237,7 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) { case REG_SZ: printf("%s", !data ? "" : - get_unicode_str((const WCHAR *)data, val->data_size / sizeof(WCHAR))); + get_unicode_str((const WCHAR *)data, data_size / sizeof(WCHAR))); break; default: printf("unhandled data type %d", val->data_type);
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 92ab3839de8..52036452990 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -239,6 +239,10 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) printf("%s", !data ? "" : get_unicode_str((const WCHAR *)data, data_size / sizeof(WCHAR))); break; + case REG_DWORD: + assert(data_size == sizeof(DWORD)); + printf("dword:%08x", *(unsigned int *)data); + break; default: printf("unhandled data type %d", val->data_type); }
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 52036452990..573c2dc7f1c 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -201,7 +201,7 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) if (!val || memcmp(&val->signature, "vk", 2)) return FALSE;
- if (!(val->flags & VAL_COMP_NAME)) + if (!(val->flags & VAL_COMP_NAME) && val->name_size) { printf("unsupported value flags: %x\n", val->flags); return FALSE;
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 573c2dc7f1c..65bede34987 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -236,7 +236,7 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) switch (val->data_type) { case REG_SZ: - printf("%s", !data ? "" : + printf("%s", !data ? """" : get_unicode_str((const WCHAR *)data, data_size / sizeof(WCHAR))); break; case REG_DWORD: @@ -299,7 +299,7 @@ static BOOL dump_key(unsigned int hive_off, unsigned int off) } else { - printf("@=""\n"); + printf("@=""\n"); } if (!ret) return FALSE;
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 65bede34987..28b6160e9cd 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -235,6 +235,9 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off)
switch (val->data_type) { + case REG_EXPAND_SZ: + printf("str(2):"); + /* fall through */ case REG_SZ: printf("%s", !data ? """" : get_unicode_str((const WCHAR *)data, data_size / sizeof(WCHAR)));
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 28b6160e9cd..46841a9d342 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -235,6 +235,10 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off)
switch (val->data_type) { + case REG_NONE: + /* TODO: dump as REG_NONE value. */ + printf("hex:"); + break; case REG_EXPAND_SZ: printf("str(2):"); /* fall through */
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 46841a9d342..65426f540c0 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -192,8 +192,8 @@ static BOOL dump_subkeys(unsigned int hive_off, unsigned int off)
static BOOL dump_value(unsigned int hive_off, unsigned int off) { + unsigned int i, len, data_size; const void *data = NULL; - unsigned int data_size; const value_key *val; const char *name;
@@ -246,6 +246,25 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) printf("%s", !data ? """" : get_unicode_str((const WCHAR *)data, data_size / sizeof(WCHAR))); break; + case REG_BINARY: + printf("hex:"); + len = val->name_size + 7; /* strlen("""=hex:") */ + for (i = 0; i < data_size; i++) + { + if (i) + { + printf(","); + len += 1; + } + if (len > 76) + { + printf("\\n "); + len = 2; + } + printf("%02x", ((BYTE *)data)[i]); + len += 2; + } + break; case REG_DWORD: assert(data_size == sizeof(DWORD)); printf("dword:%08x", *(unsigned int *)data);
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 65426f540c0..2afde27e2d7 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -194,8 +194,8 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) { unsigned int i, len, data_size; const void *data = NULL; + const char *name, *str; const value_key *val; - const char *name;
val = PRD(hive_off + off, sizeof(*val)); if (!val || memcmp(&val->signature, "vk", 2)) @@ -269,6 +269,22 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) assert(data_size == sizeof(DWORD)); printf("dword:%08x", *(unsigned int *)data); break; + case REG_MULTI_SZ: + printf("str(7):""); + + while(data_size > sizeof(WCHAR)) + { + for (len = 0; len < data_size / sizeof(WCHAR); len++) + if (!((WCHAR *)data)[len]) + break; + str = get_unicode_str(data, len); + + printf("%.*s\0", (unsigned int)strlen(str + 1) - 1, str + 1); + data = ((WCHAR *)data) + len + 1; + data_size -= (len + 1) * sizeof(WCHAR); + } + printf("""); + break; default: printf("unhandled data type %d", val->data_type); }
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index 2afde27e2d7..cce45fdb27a 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -206,6 +206,11 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) printf("unsupported value flags: %x\n", val->flags); return FALSE; } + if (!(val->data_size & 0x80000000) && val->data_size > 4 * BLOCK_SIZE) + { + printf("Warning: data blocks not supported\n"); + return TRUE; + }
if (val->name_size) {
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/winedump/dump.c b/tools/winedump/dump.c index 1a97e3bb171..42916ac4fa3 100644 --- a/tools/winedump/dump.c +++ b/tools/winedump/dump.c @@ -65,7 +65,7 @@ void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix
static char* dump_want_n(unsigned sz) { - static char buffer[4 * 1024]; + static char buffer[64 * 1024]; static unsigned idx; char* ret;
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index cce45fdb27a..baa298784e3 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -356,8 +356,6 @@ static BOOL dump_key(unsigned int hive_off, unsigned int off)
if (key->sub_keys) ret = dump_subkeys(hive_off, key->sub_keys_list_off); - if (ret && key->volatile_sub_keys) - ret = dump_subkeys(hive_off, key->volatile_sub_keys_list_off);
path_len -= key->name_size + 1; path[path_len] = 0;
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index baa298784e3..bbf51967e2d 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -201,27 +201,34 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) if (!val || memcmp(&val->signature, "vk", 2)) return FALSE;
- if (!(val->flags & VAL_COMP_NAME) && val->name_size) - { - printf("unsupported value flags: %x\n", val->flags); - return FALSE; - } if (!(val->data_size & 0x80000000) && val->data_size > 4 * BLOCK_SIZE) { printf("Warning: data blocks not supported\n"); return TRUE; }
- if (val->name_size) + if (val->name_size && !(val->flags & VAL_COMP_NAME)) + { + name = PRD(hive_off + off + sizeof(*val), val->name_size); + if (!name) + return FALSE; + name = get_unicode_str((WCHAR *)name, val->name_size / sizeof(WCHAR)); + len = strlen(name) + 1; + + printf("%s=", name); + } + else if (val->name_size) { name = PRD(hive_off + off + sizeof(*val), val->name_size); if (!name) return FALSE; + len = val->name_size + 3;
printf(""%.*s"=", val->name_size, name); } else { + len = 2; printf("@="); }
@@ -253,7 +260,7 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) break; case REG_BINARY: printf("hex:"); - len = val->name_size + 7; /* strlen("""=hex:") */ + len = len + 4; /* strlen("hex:") */ for (i = 0; i < data_size; i++) { if (i)
From: Piotr Caban piotr@codeweavers.com
--- tools/winedump/reg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/winedump/reg.c b/tools/winedump/reg.c index bbf51967e2d..9a0ee0aac86 100644 --- a/tools/winedump/reg.c +++ b/tools/winedump/reg.c @@ -258,9 +258,10 @@ static BOOL dump_value(unsigned int hive_off, unsigned int off) printf("%s", !data ? """" : get_unicode_str((const WCHAR *)data, data_size / sizeof(WCHAR))); break; + case REG_QWORD: case REG_BINARY: - printf("hex:"); - len = len + 4; /* strlen("hex:") */ + printf("hex%s:", val->data_type == REG_QWORD ? "(b)" : ""); + len += 4 + (val->data_type == REG_QWORD ? 3 : 0); /* strlen("hex:") */ for (i = 0; i < data_size; i++) { if (i)
On Wed Aug 2 04:04:15 2023 +0000, Jeffrey Smith wrote:
Does this need to be accounted for in `len`?
It doesn't really matter (it's only visual difference). I've updated the len to account for "(b)" string.
On Wed Aug 2 04:04:15 2023 +0000, Jeffrey Smith wrote:
data_size &= ~0x80000000;
Edit: I now see that you fix in a later commit, though it would probably be better to fix up this commit.
Thanks for spotting it (it was a mistake during rebase).