diff --git a/tools/winedump/dump.c b/tools/winedump/dump.c index 21074d10efb..bdd9e931211 100644 --- a/tools/winedump/dump.c +++ b/tools/winedump/dump.c @@ -131,6 +131,15 @@ void dump_unicode_str( const WCHAR *str, int len ) printf( "\"" ); } +char* guid_to_string(const GUID* guid, char* str, size_t sz) +{ + snprintf(str, sz, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + guid->Data1, guid->Data2, guid->Data3, + guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], + guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); + return str; +} + const void* PRD(unsigned long prd, unsigned long len) { return (prd + len > dump_total_len) ? NULL : (const char*)dump_base + prd; diff --git a/tools/winedump/lnk.c b/tools/winedump/lnk.c index 13f3542847d..91f109ca067 100644 --- a/tools/winedump/lnk.c +++ b/tools/winedump/lnk.c @@ -106,14 +106,6 @@ typedef struct lnk_string_tag static unsigned offset; -static void guid_to_string(const GUID* guid, char *str) -{ - sprintf(str, "{%08x-%04x-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}", - guid->Data1, guid->Data2, guid->Data3, - guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], - guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); -} - static const void* fetch_block(void) { const unsigned* u; @@ -292,7 +284,7 @@ static int dump_advertise_info(const char *type) GUID guid; if (base85_to_guid(avt->bufA, &guid)) - guid_to_string( &guid, prod_str ); + guid_to_string( &guid, prod_str, sizeof(prod_str) ); else strcpy( prod_str, "?" ); @@ -311,7 +303,7 @@ static int dump_advertise_info(const char *type) } if (feat && feat[0] == '>' && base85_to_guid( &feat[1], &guid )) - guid_to_string( &guid, feat_str ); + guid_to_string( &guid, feat_str, sizeof(feat_str) ); else feat_str[0] = 0; @@ -345,12 +337,10 @@ void lnk_dump(void) offset = 0; hdr = fetch_block(); - guid_to_string(&hdr->MagicGuid, guid); - printf("Header\n"); printf("------\n\n"); printf("Size: %04x\n", hdr->dwSize); - printf("GUID: %s\n", guid); + printf("GUID: %s\n", guid_to_string(&hdr->MagicGuid, guid, sizeof(guid))); printf("FileAttr: %08x\n", hdr->dwFileAttr); printf("FileLength: %08x\n", hdr->dwFileLength); diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c index 9243b18033b..30747457a3f 100644 --- a/tools/winedump/pdb.c +++ b/tools/winedump/pdb.c @@ -625,18 +625,18 @@ static void pdb_ds_dump(void) if (root) { const char* ptr; + char guid_str[40]; + printf("Root:\n" "\tVersion: %u\n" "\tTimeDateStamp: %08x\n" "\tAge: %08x\n" - "\tguid {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n" + "\tguid %s\n" "\tcbNames: %08x\n", root->Version, root->TimeDateStamp, root->Age, - root->guid.Data1, root->guid.Data2, root->guid.Data3, - root->guid.Data4[0], root->guid.Data4[1], root->guid.Data4[2], root->guid.Data4[3], - root->guid.Data4[4], root->guid.Data4[5], root->guid.Data4[6], root->guid.Data4[7], + guid_to_string(&root->guid, guid_str, sizeof(guid_str)), root->cbNames); for (ptr = &root->names[0]; ptr < &root->names[0] + root->cbNames; ptr += strlen(ptr) + 1) printf("\tString: %s\n", ptr); diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h index 540bbd02215..8aee2f9121f 100644 --- a/tools/winedump/winedump.h +++ b/tools/winedump/winedump.h @@ -239,6 +239,7 @@ void dump_unicode_str( const unsigned short *str, int len ); void dump_file_header(const IMAGE_FILE_HEADER *); void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *, UINT); void dump_section(const IMAGE_SECTION_HEADER *); +char* guid_to_string(const GUID* guid, char *str, size_t sz); enum FileSig get_kind_exec(void); void dos_dump( void );