winedump: Simplify guid dumping.
This commit is contained in:
parent
72c52d6d9e
commit
ae48ede907
@ -425,11 +425,9 @@ static void dump_codeview_headers(unsigned long base, unsigned long len)
|
|||||||
if (memcmp(signature, "RSDS", 4) == 0)
|
if (memcmp(signature, "RSDS", 4) == 0)
|
||||||
{
|
{
|
||||||
const OMFSignatureRSDS* rsds_data;
|
const OMFSignatureRSDS* rsds_data;
|
||||||
char guid_str[40];
|
|
||||||
|
|
||||||
rsds_data = (const void *)cv_base;
|
rsds_data = (const void *)cv_base;
|
||||||
printf(" Guid: %s\n",
|
printf(" Guid: %s\n", get_guid_str(&rsds_data->guid));
|
||||||
guid_to_string(&rsds_data->guid, guid_str, sizeof(guid_str)));
|
|
||||||
printf(" Dunno: %08X\n", rsds_data->unknown);
|
printf(" Dunno: %08X\n", rsds_data->unknown);
|
||||||
printf(" Filename: %s\n", rsds_data->name);
|
printf(" Filename: %s\n", rsds_data->name);
|
||||||
return;
|
return;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* File dumping utility
|
* File dumping utility
|
||||||
*
|
*
|
||||||
* Copyright 2001,2005 Eric Pouech
|
* Copyright 2001,2007 Eric Pouech
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -96,13 +96,9 @@ const char *get_time_str(unsigned long _t)
|
|||||||
const time_t t = (const time_t)_t;
|
const time_t t = (const time_t)_t;
|
||||||
const char *str = ctime(&t);
|
const char *str = ctime(&t);
|
||||||
size_t len;
|
size_t len;
|
||||||
static char buf[128];
|
char* buf;
|
||||||
|
|
||||||
if (!str) /* not valid time */
|
if (!str) return "not valid time";
|
||||||
{
|
|
||||||
strcpy(buf, "not valid time");
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
/* FIXME: I don't get the same values from MS' pedump running under Wine...
|
/* FIXME: I don't get the same values from MS' pedump running under Wine...
|
||||||
@ -110,8 +106,12 @@ const char *get_time_str(unsigned long _t)
|
|||||||
*/
|
*/
|
||||||
if (len && str[len-1] == '\n') len--;
|
if (len && str[len-1] == '\n') len--;
|
||||||
if (len >= sizeof(buf)) len = sizeof(buf) - 1;
|
if (len >= sizeof(buf)) len = sizeof(buf) - 1;
|
||||||
memcpy( buf, str, len );
|
buf = dump_want_n(len + 1);
|
||||||
buf[len] = 0;
|
if (buf)
|
||||||
|
{
|
||||||
|
memcpy( buf, str, len );
|
||||||
|
buf[len] = 0;
|
||||||
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,12 +200,16 @@ const char* get_symbol_str(const char* symname)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* guid_to_string(const GUID* guid, char* str, size_t sz)
|
const char* get_guid_str(const GUID* guid)
|
||||||
{
|
{
|
||||||
snprintf(str, sz, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
char* str;
|
||||||
guid->Data1, guid->Data2, guid->Data3,
|
|
||||||
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
str = dump_want_n(39);
|
||||||
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
if (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]);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,14 +279,14 @@ static int dump_advertise_info(const char *type)
|
|||||||
printf("%s = %s\n", type, avt->bufA);
|
printf("%s = %s\n", type, avt->bufA);
|
||||||
if (avt->magic == 0xa0000006)
|
if (avt->magic == 0xa0000006)
|
||||||
{
|
{
|
||||||
char prod_str[40], comp_str[40], feat_str[40];
|
char comp_str[40];
|
||||||
const char *feat, *comp;
|
const char *feat, *comp, *prod_str, *feat_str;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
|
|
||||||
if (base85_to_guid(avt->bufA, &guid))
|
if (base85_to_guid(avt->bufA, &guid))
|
||||||
guid_to_string( &guid, prod_str, sizeof(prod_str) );
|
prod_str = get_guid_str( &guid );
|
||||||
else
|
else
|
||||||
strcpy( prod_str, "?" );
|
prod_str = "?";
|
||||||
|
|
||||||
comp = &avt->bufA[20];
|
comp = &avt->bufA[20];
|
||||||
feat = strchr(comp,'>');
|
feat = strchr(comp,'>');
|
||||||
@ -303,9 +303,9 @@ static int dump_advertise_info(const char *type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (feat && feat[0] == '>' && base85_to_guid( &feat[1], &guid ))
|
if (feat && feat[0] == '>' && base85_to_guid( &feat[1], &guid ))
|
||||||
guid_to_string( &guid, feat_str, sizeof(feat_str) );
|
feat_str = get_guid_str( &guid );
|
||||||
else
|
else
|
||||||
feat_str[0] = 0;
|
feat_str = "";
|
||||||
|
|
||||||
printf(" product: %s\n", prod_str);
|
printf(" product: %s\n", prod_str);
|
||||||
printf(" component: %s\n", comp_str );
|
printf(" component: %s\n", comp_str );
|
||||||
@ -332,7 +332,6 @@ enum FileSig get_kind_lnk(void)
|
|||||||
void lnk_dump(void)
|
void lnk_dump(void)
|
||||||
{
|
{
|
||||||
const LINK_HEADER* hdr;
|
const LINK_HEADER* hdr;
|
||||||
char guid[40];
|
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
hdr = fetch_block();
|
hdr = fetch_block();
|
||||||
@ -340,7 +339,7 @@ void lnk_dump(void)
|
|||||||
printf("Header\n");
|
printf("Header\n");
|
||||||
printf("------\n\n");
|
printf("------\n\n");
|
||||||
printf("Size: %04x\n", hdr->dwSize);
|
printf("Size: %04x\n", hdr->dwSize);
|
||||||
printf("GUID: %s\n", guid_to_string(&hdr->MagicGuid, guid, sizeof(guid)));
|
printf("GUID: %s\n", get_guid_str(&hdr->MagicGuid));
|
||||||
|
|
||||||
printf("FileAttr: %08x\n", hdr->dwFileAttr);
|
printf("FileAttr: %08x\n", hdr->dwFileAttr);
|
||||||
printf("FileLength: %08x\n", hdr->dwFileLength);
|
printf("FileLength: %08x\n", hdr->dwFileLength);
|
||||||
|
@ -625,7 +625,6 @@ static void pdb_ds_dump(void)
|
|||||||
if (root)
|
if (root)
|
||||||
{
|
{
|
||||||
const char* ptr;
|
const char* ptr;
|
||||||
char guid_str[40];
|
|
||||||
|
|
||||||
printf("Root:\n"
|
printf("Root:\n"
|
||||||
"\tVersion: %u\n"
|
"\tVersion: %u\n"
|
||||||
@ -636,7 +635,7 @@ static void pdb_ds_dump(void)
|
|||||||
root->Version,
|
root->Version,
|
||||||
root->TimeDateStamp,
|
root->TimeDateStamp,
|
||||||
root->Age,
|
root->Age,
|
||||||
guid_to_string(&root->guid, guid_str, sizeof(guid_str)),
|
get_guid_str(&root->guid),
|
||||||
root->cbNames);
|
root->cbNames);
|
||||||
for (ptr = &root->names[0]; ptr < &root->names[0] + root->cbNames; ptr += strlen(ptr) + 1)
|
for (ptr = &root->names[0]; ptr < &root->names[0] + root->cbNames; ptr += strlen(ptr) + 1)
|
||||||
printf("\tString: %s\n", ptr);
|
printf("\tString: %s\n", ptr);
|
||||||
|
@ -236,11 +236,11 @@ void dump_data( const unsigned char *ptr, unsigned int size, const ch
|
|||||||
const char* get_time_str( unsigned long );
|
const char* get_time_str( unsigned long );
|
||||||
unsigned int strlenW( const unsigned short *str );
|
unsigned int strlenW( const unsigned short *str );
|
||||||
void dump_unicode_str( const unsigned short *str, int len );
|
void dump_unicode_str( const unsigned short *str, int len );
|
||||||
|
const char* get_guid_str(const GUID* guid);
|
||||||
const char* get_symbol_str(const char* symname);
|
const char* get_symbol_str(const char* symname);
|
||||||
void dump_file_header(const IMAGE_FILE_HEADER *);
|
void dump_file_header(const IMAGE_FILE_HEADER *);
|
||||||
void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *, UINT);
|
void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *, UINT);
|
||||||
void dump_section(const IMAGE_SECTION_HEADER *);
|
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);
|
enum FileSig get_kind_exec(void);
|
||||||
void dos_dump( void );
|
void dos_dump( void );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user