Dmitry Timoshkov : winedump: Use common binary dumper for typelib.
Alexandre Julliard
julliard at winehq.org
Tue Jul 10 15:36:44 CDT 2018
Module: wine
Branch: master
Commit: 3d26b00fce20b80b423f7c15e1975eb50166fc5e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3d26b00fce20b80b423f7c15e1975eb50166fc5e
Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date: Tue Jul 10 11:41:54 2018 +0800
winedump: Use common binary dumper for typelib.
This is an adapted code from dump.c.
Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winedump/tlb.c | 52 +++++++++++++++++++++++++++++++++++++---------------
1 file changed, 37 insertions(+), 15 deletions(-)
diff --git a/tools/winedump/tlb.c b/tools/winedump/tlb.c
index d288359..5d009fc 100644
--- a/tools/winedump/tlb.c
+++ b/tools/winedump/tlb.c
@@ -283,25 +283,47 @@ static void print_ctl2(const char *name)
printf("\n");
}
-static void dump_binary(int n)
+static int tlb_isprint(unsigned char c)
{
- int i;
+ return c >= 32;
+}
- for(i = 1; i <= n; i++) {
- switch(i & 0x0f) {
- case 0:
- printf("%02x\n", tlb_read_byte());
- break;
- case 1:
- print_offset();
- /* fall through */
- default:
- printf("%02x ", tlb_read_byte());
+static void dump_binary(int size)
+{
+ const unsigned char *ptr;
+ int i, j;
+
+ if (!size) return;
+
+ ptr = tlb_read(size);
+ if (!ptr) return;
+
+ print_offset();
+ printf("%08x: ", offset - size);
+
+ for (i = 0; i < size; i++)
+ {
+ printf("%02x%c", ptr[i], (i % 16 == 7) ? '-' : ' ');
+ if ((i % 16) == 15)
+ {
+ printf( " " );
+ for (j = 0; j < 16; j++)
+ printf("%c", tlb_isprint(ptr[i-15+j]) ? ptr[i-15+j] : '.');
+ if (i < size-1)
+ {
+ printf("\n");
+ print_offset();
+ printf("%08x: ", offset - size + i + 1);
+ }
}
}
-
- if(n&0x0f)
- printf("\n");
+ if (i % 16)
+ {
+ printf("%*s ", 3 * (16-(i%16)), "");
+ for (j = 0; j < i % 16; j++)
+ printf("%c", tlb_isprint(ptr[i-(i%16)+j]) ? ptr[i-(i%16)+j] : '.');
+ }
+ printf("\n");
}
static int dump_msft_varflags(void)
More information about the wine-cvs
mailing list