winedump: Enable compilation with long types.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-04-22 16:48:00 +02:00
parent 88c06077f8
commit fdd0ad5939
11 changed files with 220 additions and 271 deletions

View File

@ -1,4 +1,3 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
PROGRAMS = winedump PROGRAMS = winedump
MANPAGES = winedump.man.in MANPAGES = winedump.man.in
SCRIPTS = function_grep.pl SCRIPTS = function_grep.pl

View File

@ -538,12 +538,12 @@ void dump_coff_symbol_table(const IMAGE_SYMBOL *coff_symbols, unsigned num_sy
case IMAGE_SYM_CLASS_LABEL: case IMAGE_SYM_CLASS_LABEL:
if (coff_sym->SectionNumber > 0) if (coff_sym->SectionNumber > 0)
{ {
DWORD base = sectHead[coff_sym->SectionNumber - 1].VirtualAddress; UINT base = sectHead[coff_sym->SectionNumber - 1].VirtualAddress;
nampnt = get_coff_name( coff_sym, coff_strtab ); nampnt = get_coff_name( coff_sym, coff_strtab );
printf("%05d | %02d:%08x [%08x] | %s | %s\n", printf("%05d | %02d:%08x [%08x] | %s | %s\n",
i, coff_sym->SectionNumber - 1, coff_sym->Value, i, coff_sym->SectionNumber - 1, (UINT)coff_sym->Value,
base + coff_sym->Value, base + (UINT)coff_sym->Value,
storage_class(coff_sym->StorageClass), nampnt); storage_class(coff_sym->StorageClass), nampnt);
} }
break; break;
@ -595,8 +595,8 @@ void dump_frame_pointer_omission(unsigned long base, unsigned long len)
default: x = NULL; break; default: x = NULL; break;
} }
printf("%08x-%08x %4u %4u %4u %4u %s%s%s\n", printf("%08x-%08x %4u %4u %4u %4u %s%s%s\n",
fpo->ulOffStart, fpo->ulOffStart + fpo->cbProcSize, (UINT)fpo->ulOffStart, (UINT)(fpo->ulOffStart + fpo->cbProcSize),
fpo->cdwLocals, fpo->cdwParams, fpo->cbProlog, fpo->cbRegs, (UINT)fpo->cdwLocals, fpo->cdwParams, fpo->cbProlog, fpo->cbRegs,
x, fpo->fHasSEH ? " SEH" : "", fpo->fUseBP ? " UseBP" : ""); x, fpo->fHasSEH ? " SEH" : "", fpo->fUseBP ? " UseBP" : "");
fpo++; fpo++;
} }

View File

@ -50,6 +50,6 @@ void dos_dump(void)
printf(" Relocation (file): %u\n", dh->e_lfarlc); printf(" Relocation (file): %u\n", dh->e_lfarlc);
printf(" Overlay number: %u\n", dh->e_ovno); printf(" Overlay number: %u\n", dh->e_ovno);
printf(" OEM id(info): %x(%x)\n", dh->e_oemid, dh->e_oeminfo); printf(" OEM id(info): %x(%x)\n", dh->e_oemid, dh->e_oeminfo);
printf(" Offset to ext header: %x\n", dh->e_lfanew); printf(" Offset to ext header: %x\n", (UINT)dh->e_lfanew);
} }
} }

View File

@ -60,6 +60,12 @@ static const char *debugstr_wn(const WCHAR *wstr, unsigned int n)
return buf; return buf;
} }
static const char *debugstr_rect(const RECTL *rect)
{
return strmake( "%d,%d - %d,%d",
(UINT)rect->left, (UINT)rect->top, (UINT)rect->right, (UINT)rect->bottom );
}
static unsigned int read_int(const unsigned char *buffer) static unsigned int read_int(const unsigned char *buffer)
{ {
return buffer[0] return buffer[0]
@ -69,7 +75,7 @@ static unsigned int read_int(const unsigned char *buffer)
} }
#define EMRCASE(x) case x: printf("%-20s %08x\n", #x, length); break #define EMRCASE(x) case x: printf("%-20s %08x\n", #x, length); break
#define EMRPLUSCASE(x) case x: printf(" %-20s %04x %08x %08x\n", #x, header->Flags, header->Size, header->DataSize); break #define EMRPLUSCASE(x) case x: printf(" %-20s %04x %08x %08x\n", #x, (UINT)header->Flags, (UINT)header->Size, (UINT)header->DataSize); break
static unsigned offset = 0; static unsigned offset = 0;
@ -91,13 +97,15 @@ static int dump_emfrecord(void)
const ENHMETAHEADER *header = PRD(offset, sizeof(*header)); const ENHMETAHEADER *header = PRD(offset, sizeof(*header));
printf("%-20s %08x\n", "EMR_HEADER", length); printf("%-20s %08x\n", "EMR_HEADER", length);
printf("bounds (%d,%d - %d,%d) frame (%d,%d - %d,%d) signature %#x version %#x bytes %#x records %#x\n" printf("bounds (%s) frame (%s) signature %#x version %#x bytes %#x records %#x\n"
"handles %#x reserved %#x palette entries %#x px %dx%d mm %dx%d μm %dx%d opengl %d description %s\n", "handles %#x reserved %#x palette entries %#x px %dx%d mm %dx%d μm %dx%d opengl %d description %s\n",
header->rclBounds.left, header->rclBounds.top, header->rclBounds.right, header->rclBounds.bottom, debugstr_rect( &header->rclBounds ), debugstr_rect( &header->rclFrame ),
header->rclFrame.left, header->rclFrame.top, header->rclFrame.right, header->rclFrame.bottom, (UINT)header->dSignature, (UINT)header->nVersion, (UINT)header->nBytes,
header->dSignature, header->nVersion, header->nBytes, header->nRecords, header->nHandles, header->sReserved, (UINT)header->nRecords, (UINT)header->nHandles, header->sReserved, (UINT)header->nPalEntries,
header->nPalEntries, header->szlDevice.cx, header->szlDevice.cy, header->szlMillimeters.cx, (UINT)header->szlDevice.cx, (UINT)header->szlDevice.cy,
header->szlMillimeters.cy, header->szlMicrometers.cx, header->szlMicrometers.cy, header->bOpenGL, (UINT)header->szlMillimeters.cx, (UINT)header->szlMillimeters.cy,
(UINT)header->szlMicrometers.cx, (UINT)header->szlMicrometers.cy,
(UINT)header->bOpenGL,
debugstr_wn((LPCWSTR)((const BYTE *)header + header->offDescription), header->nDescription)); debugstr_wn((LPCWSTR)((const BYTE *)header + header->offDescription), header->nDescription));
break; break;
} }
@ -136,9 +144,7 @@ static int dump_emfrecord(void)
const EMRINTERSECTCLIPRECT *clip = PRD(offset, sizeof(*clip)); const EMRINTERSECTCLIPRECT *clip = PRD(offset, sizeof(*clip));
printf("%-20s %08x\n", "EMR_INTERSECTCLIPRECT", length); printf("%-20s %08x\n", "EMR_INTERSECTCLIPRECT", length);
printf("rect %d,%d - %d, %d\n", printf("rect %s\n", debugstr_rect( &clip->rclClip ));
clip->rclClip.left, clip->rclClip.top,
clip->rclClip.right, clip->rclClip.bottom);
break; break;
} }
@ -265,7 +271,8 @@ static int dump_emfrecord(void)
EMRPLUSCASE(EmfPlusRecordTotal); EMRPLUSCASE(EmfPlusRecordTotal);
default: default:
printf(" unknown EMF+ record %x %04x %08x\n", header->Type, header->Flags, header->Size); printf(" unknown EMF+ record %x %04x %08x\n",
(UINT)header->Type, (UINT)header->Flags, (UINT)header->Size);
break; break;
} }
@ -303,16 +310,16 @@ static int dump_emfrecord(void)
{ {
const EMREXTSELECTCLIPRGN *clip = PRD(offset, sizeof(*clip)); const EMREXTSELECTCLIPRGN *clip = PRD(offset, sizeof(*clip));
const RGNDATA *data = (const RGNDATA *)clip->RgnData; const RGNDATA *data = (const RGNDATA *)clip->RgnData;
DWORD i, rc_count = 0; UINT i, rc_count = 0;
const RECT *rc; const RECTL *rc;
if (length >= sizeof(*clip) + sizeof(*data)) if (length >= sizeof(*clip) + sizeof(*data))
rc_count = data->rdh.nCount; rc_count = data->rdh.nCount;
printf("%-20s %08x\n", "EMR_EXTSELECTCLIPRGN", length); printf("%-20s %08x\n", "EMR_EXTSELECTCLIPRGN", length);
printf("mode %d, rects %d\n", clip->iMode, rc_count); printf("mode %d, rects %d\n", (UINT)clip->iMode, rc_count);
for (i = 0, rc = (const RECT *)data->Buffer; i < rc_count; i++, rc++) for (i = 0, rc = (const RECTL *)data->Buffer; i < rc_count; i++)
printf(" (%d,%d)-(%d,%d)", rc->left, rc->top, rc->right, rc->bottom); printf(" (%s)", debugstr_rect( &rc[i] ));
if (rc_count != 0) printf("\n"); if (rc_count != 0) printf("\n");
break; break;
} }
@ -325,20 +332,20 @@ static int dump_emfrecord(void)
const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blt + blt->offBmiSrc); const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blt + blt->offBmiSrc);
printf("%-20s %08x\n", "EMR_STRETCHBLT", length); printf("%-20s %08x\n", "EMR_STRETCHBLT", length);
printf("bounds (%d,%d - %d,%d) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n" printf("bounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n"
"bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n", "bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n",
blt->rclBounds.left, blt->rclBounds.top, blt->rclBounds.right, blt->rclBounds.bottom, debugstr_rect( &blt->rclBounds ), (UINT)blt->xDest, (UINT)blt->yDest, (UINT)blt->cxDest, (UINT)blt->cyDest,
blt->xDest, blt->yDest, blt->cxDest, blt->cyDest, (UINT)blt->xSrc, (UINT)blt->ySrc, (UINT)blt->cxSrc, (UINT)blt->cySrc, (UINT)blt->dwRop,
blt->xSrc, blt->ySrc, blt->cxSrc, blt->cySrc, blt->dwRop,
blt->xformSrc.eM11, blt->xformSrc.eM12, blt->xformSrc.eM21, blt->xformSrc.eM11, blt->xformSrc.eM12, blt->xformSrc.eM21,
blt->xformSrc.eM22, blt->xformSrc.eDx, blt->xformSrc.eDy, blt->xformSrc.eM22, blt->xformSrc.eDx, blt->xformSrc.eDy,
blt->crBkColorSrc, blt->iUsageSrc, blt->offBmiSrc, blt->cbBmiSrc, (UINT)blt->crBkColorSrc, (UINT)blt->iUsageSrc, (UINT)blt->offBmiSrc, (UINT)blt->cbBmiSrc,
blt->offBitsSrc, blt->cbBitsSrc); (UINT)blt->offBitsSrc, (UINT)blt->cbBitsSrc);
printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n" printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n"
"biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n", "biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n",
bmih->biSize, bmih->biWidth, bmih->biHeight, bmih->biPlanes, bmih->biBitCount, (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes,
bmih->biCompression, bmih->biSizeImage, bmih->biXPelsPerMeter, bmih->biYPelsPerMeter, (UINT)bmih->biBitCount, (UINT)bmih->biCompression, (UINT)bmih->biSizeImage,
bmih->biClrUsed, bmih->biClrImportant); (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed,
(UINT)bmih->biClrImportant);
break; break;
} }
@ -354,10 +361,8 @@ static int dump_emfrecord(void)
printf("%-20s %08x\n", "EMR_EXTCREATEFONTINDIRECTW", length); printf("%-20s %08x\n", "EMR_EXTCREATEFONTINDIRECTW", length);
printf("(%d %d %d %d %x out %d clip %x quality %d charset %d) %s %s %s %s\n", printf("(%d %d %d %d %x out %d clip %x quality %d charset %d) %s %s %s %s\n",
plf->lfHeight, plf->lfWidth, (UINT)plf->lfHeight, (UINT)plf->lfWidth, (UINT)plf->lfEscapement, (UINT)plf->lfOrientation,
plf->lfEscapement, plf->lfOrientation, (UINT)plf->lfPitchAndFamily, (UINT)plf->lfOutPrecision, (UINT)plf->lfClipPrecision,
plf->lfPitchAndFamily,
plf->lfOutPrecision, plf->lfClipPrecision,
plf->lfQuality, plf->lfCharSet, plf->lfQuality, plf->lfCharSet,
debugstr_wn(plf->lfFaceName, LF_FACESIZE), debugstr_wn(plf->lfFaceName, LF_FACESIZE),
plf->lfWeight > 400 ? "Bold" : "", plf->lfWeight > 400 ? "Bold" : "",
@ -374,15 +379,12 @@ static int dump_emfrecord(void)
const int *dx = (const int *)((const BYTE *)etoW + etoW->emrtext.offDx); const int *dx = (const int *)((const BYTE *)etoW + etoW->emrtext.offDx);
printf("%-20s %08x\n", "EMR_EXTTEXTOUTW", length); printf("%-20s %08x\n", "EMR_EXTTEXTOUTW", length);
printf("bounds (%d,%d - %d,%d) mode %#x x_scale %f y_scale %f pt (%d,%d) rect (%d,%d - %d,%d) flags %#x, %s\n", printf("bounds (%s) mode %#x x_scale %f y_scale %f pt (%d,%d) rect (%s) flags %#x, %s\n",
etoW->rclBounds.left, etoW->rclBounds.top, etoW->rclBounds.right, etoW->rclBounds.bottom, debugstr_rect( &etoW->rclBounds ), (UINT)etoW->iGraphicsMode, etoW->exScale, etoW->eyScale,
etoW->iGraphicsMode, etoW->exScale, etoW->eyScale, (UINT)etoW->emrtext.ptlReference.x, (UINT)etoW->emrtext.ptlReference.y,
etoW->emrtext.ptlReference.x, etoW->emrtext.ptlReference.y, debugstr_rect( &etoW->emrtext.rcl ), (UINT)etoW->emrtext.fOptions,
etoW->emrtext.rcl.left, etoW->emrtext.rcl.top,
etoW->emrtext.rcl.right, etoW->emrtext.rcl.bottom,
etoW->emrtext.fOptions,
debugstr_wn((LPCWSTR)((const BYTE *)etoW + etoW->emrtext.offString), etoW->emrtext.nChars)); debugstr_wn((LPCWSTR)((const BYTE *)etoW + etoW->emrtext.offString), etoW->emrtext.nChars));
printf("dx_offset %u {", etoW->emrtext.offDx); printf("dx_offset %u {", (UINT)etoW->emrtext.offDx);
for (i = 0; i < etoW->emrtext.nChars; ++i) for (i = 0; i < etoW->emrtext.nChars; ++i)
{ {
printf("%d", dx[i]); printf("%d", dx[i]);
@ -429,20 +431,20 @@ static int dump_emfrecord(void)
const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blend + blend->offBmiSrc); const BITMAPINFOHEADER *bmih = (const BITMAPINFOHEADER *)((const unsigned char *)blend + blend->offBmiSrc);
printf("%-20s %08x\n", "EMR_ALPHABLEND", length); printf("%-20s %08x\n", "EMR_ALPHABLEND", length);
printf("bounds (%d,%d - %d,%d) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n" printf("bounds (%s) dst %d,%d %dx%d src %d,%d %dx%d rop %#x xform (%f, %f, %f, %f, %f, %f)\n"
"bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n", "bk_color %#x usage %#x bmi_offset %#x bmi_size %#x bits_offset %#x bits_size %#x\n",
blend->rclBounds.left, blend->rclBounds.top, blend->rclBounds.right, blend->rclBounds.bottom, debugstr_rect( &blend->rclBounds ), (UINT)blend->xDest, (UINT)blend->yDest, (UINT)blend->cxDest, (UINT)blend->cyDest,
blend->xDest, blend->yDest, blend->cxDest, blend->cyDest, (UINT)blend->xSrc, (UINT)blend->ySrc, (UINT)blend->cxSrc, (UINT)blend->cySrc,
blend->xSrc, blend->ySrc, blend->cxSrc, blend->cySrc, blend->dwRop, (UINT)blend->dwRop, blend->xformSrc.eM11, blend->xformSrc.eM12, blend->xformSrc.eM21,
blend->xformSrc.eM11, blend->xformSrc.eM12, blend->xformSrc.eM21,
blend->xformSrc.eM22, blend->xformSrc.eDx, blend->xformSrc.eDy, blend->xformSrc.eM22, blend->xformSrc.eDx, blend->xformSrc.eDy,
blend->crBkColorSrc, blend->iUsageSrc, blend->offBmiSrc, blend->cbBmiSrc, (UINT)blend->crBkColorSrc, (UINT)blend->iUsageSrc, (UINT)blend->offBmiSrc,
blend->offBitsSrc, blend->cbBitsSrc); (UINT)blend->cbBmiSrc, (UINT)blend->offBitsSrc, (UINT)blend->cbBitsSrc);
printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n" printf("BITMAPINFOHEADER biSize %#x biWidth %d biHeight %d biPlanes %d biBitCount %d biCompression %#x\n"
"biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n", "biSizeImage %#x biXPelsPerMeter %d biYPelsPerMeter %d biClrUsed %#x biClrImportant %#x\n",
bmih->biSize, bmih->biWidth, bmih->biHeight, bmih->biPlanes, bmih->biBitCount, (UINT)bmih->biSize, (UINT)bmih->biWidth, (UINT)bmih->biHeight, (UINT)bmih->biPlanes,
bmih->biCompression, bmih->biSizeImage, bmih->biXPelsPerMeter, bmih->biYPelsPerMeter, (UINT)bmih->biBitCount, (UINT)bmih->biCompression, (UINT)bmih->biSizeImage,
bmih->biClrUsed, bmih->biClrImportant); (UINT)bmih->biXPelsPerMeter, (UINT)bmih->biYPelsPerMeter, (UINT)bmih->biClrUsed,
(UINT)bmih->biClrImportant);
break; break;
} }

View File

@ -91,8 +91,7 @@ static void dump_le_header( const IMAGE_VXD_HEADER *le )
le->e32_border == 0 ? "little-indian" : "big-endian"); le->e32_border == 0 ? "little-indian" : "big-endian");
printf( " Word order: %s\n", printf( " Word order: %s\n",
le->e32_worder == 0 ? "little-indian" : "big-endian"); le->e32_worder == 0 ? "little-indian" : "big-endian");
printf( " Executable format level: %d\n", printf( " Executable format level: %d\n", (UINT)le->e32_level);
le->e32_level);
printf( " CPU type: %s\n", printf( " CPU type: %s\n",
le->e32_cpu == 0x01 ? "Intel 80286" : le->e32_cpu == 0x01 ? "Intel 80286" :
le->e32_cpu == 0x02 ? "Intel 80386" : le->e32_cpu == 0x02 ? "Intel 80386" :
@ -110,10 +109,8 @@ static void dump_le_header( const IMAGE_VXD_HEADER *le )
le->e32_os == 0x03 ? "DOS 4.x" : le->e32_os == 0x03 ? "DOS 4.x" :
le->e32_os == 0x04 ? "Windows 386" : le->e32_os == 0x04 ? "Windows 386" :
"Unknown"); "Unknown");
printf( " Module version: %d\n", printf( " Module version: %d\n", (UINT)le->e32_ver);
le->e32_ver); printf( " Module type flags: %08x\n", (UINT)le->e32_mflags);
printf( " Module type flags: %08x\n",
le->e32_mflags);
if (le->e32_mflags & 0x8000) if (le->e32_mflags & 0x8000)
{ {
if (le->e32_mflags & 0x0004) if (le->e32_mflags & 0x0004)
@ -135,90 +132,48 @@ static void dump_le_header( const IMAGE_VXD_HEADER *le )
if (le->e32_mflags & 0x8000) if (le->e32_mflags & 0x8000)
printf( " Module is DLL\n"); printf( " Module is DLL\n");
} }
printf( " Number of memory pages: %d\n", printf( " Number of memory pages: %d\n", (UINT)le->e32_mpages);
le->e32_mpages); printf( " Initial object CS number: %08x\n", (UINT)le->e32_startobj);
printf( " Initial object CS number: %08x\n", printf( " Initial EIP: %08x\n", (UINT)le->e32_eip);
le->e32_startobj); printf( " Initial object SS number: %08x\n", (UINT)le->e32_stackobj);
printf( " Initial EIP: %08x\n", printf( " Initial ESP: %08x\n", (UINT)le->e32_esp);
le->e32_eip); printf( " Memory page size: %d\n", (UINT)le->e32_pagesize);
printf( " Initial object SS number: %08x\n", printf( " Bytes on last page: %d\n", (UINT)le->e32_lastpagesize);
le->e32_stackobj); printf( " Fix-up section size: %d\n", (UINT)le->e32_fixupsize);
printf( " Initial ESP: %08x\n", printf( " Fix-up section checksum: %08x\n", (UINT)le->e32_fixupsum);
le->e32_esp); printf( " Loader section size: %d\n", (UINT)le->e32_ldrsize);
printf( " Memory page size: %d\n", printf( " Loader section checksum: %08x\n", (UINT)le->e32_ldrsum);
le->e32_pagesize); printf( " Offset of object table: %08x\n", (UINT)le->e32_objtab);
printf( " Bytes on last page: %d\n", printf( " Object table entries: %d\n", (UINT)le->e32_objcnt);
le->e32_lastpagesize); printf( " Object page map offset: %08x\n", (UINT)le->e32_objmap);
printf( " Fix-up section size: %d\n", printf( " Object iterate data map offset: %08x\n", (UINT)le->e32_itermap);
le->e32_fixupsize); printf( " Resource table offset: %08x\n", (UINT)le->e32_rsrctab);
printf( " Fix-up section checksum: %08x\n", printf( " Resource table entries: %d\n", (UINT)le->e32_rsrccnt);
le->e32_fixupsum); printf( " Resident names table offset: %08x\n", (UINT)le->e32_restab);
printf( " Loader section size: %d\n", printf( " Entry table offset: %08x\n", (UINT)le->e32_enttab);
le->e32_ldrsize); printf( " Module directives table offset: %08x\n", (UINT)le->e32_dirtab);
printf( " Loader section checksum: %08x\n", printf( " Module directives entries: %d\n", (UINT)le->e32_dircnt);
le->e32_ldrsum); printf( " Fix-up page table offset: %08x\n", (UINT)le->e32_fpagetab);
printf( " Offset of object table: %08x\n", printf( " Fix-up record table offset: %08x\n", (UINT)le->e32_frectab);
le->e32_objtab); printf( " Imported modules name table offset: %08x\n", (UINT)le->e32_impmod);
printf( " Object table entries: %d\n", printf( " Imported modules count: %d\n", (UINT)le->e32_impmodcnt);
le->e32_objcnt); printf( " Imported procedure name table offset: %08x\n", (UINT)le->e32_impproc);
printf( " Object page map offset: %08x\n", printf( " Per-page checksum table offset: %08x\n", (UINT)le->e32_pagesum);
le->e32_objmap); printf( " Data pages offset from top of table: %08x\n", (UINT)le->e32_datapage);
printf( " Object iterate data map offset: %08x\n", printf( " Preload page count: %08x\n", (UINT)le->e32_preload);
le->e32_itermap); printf( " Non-resident names table offset: %08x\n", (UINT)le->e32_nrestab);
printf( " Resource table offset: %08x\n", printf( " Non-resident names table length: %d\n", (UINT)le->e32_cbnrestab);
le->e32_rsrctab); printf( " Non-resident names table checksum: %08x\n", (UINT)le->e32_nressum);
printf( " Resource table entries: %d\n", printf( " Automatic data object: %08x\n", (UINT)le->e32_autodata);
le->e32_rsrccnt); printf( " Debug information offset: %08x\n", (UINT)le->e32_debuginfo);
printf( " Resident names table offset: %08x\n", printf( " Debug information length: %d\n", (UINT)le->e32_debuglen);
le->e32_restab); printf( " Preload instance pages number: %d\n", (UINT)le->e32_instpreload);
printf( " Entry table offset: %08x\n", printf( " Demand instance pages number: %d\n", (UINT)le->e32_instdemand);
le->e32_enttab); printf( " Extra heap allocation: %d\n", (UINT)le->e32_heapsize);
printf( " Module directives table offset: %08x\n", printf( " VxD resource table offset: %08x\n", (UINT)le->e32_winresoff);
le->e32_dirtab); printf( " Size of VxD resource table: %d\n", (UINT)le->e32_winreslen);
printf( " Module directives entries: %d\n", printf( " VxD identifier: %x\n", (UINT)le->e32_devid);
le->e32_dircnt); printf( " VxD DDK version: %x\n", (UINT)le->e32_ddkver);
printf( " Fix-up page table offset: %08x\n",
le->e32_fpagetab);
printf( " Fix-up record table offset: %08x\n",
le->e32_frectab);
printf( " Imported modules name table offset: %08x\n",
le->e32_impmod);
printf( " Imported modules count: %d\n",
le->e32_impmodcnt);
printf( " Imported procedure name table offset: %08x\n",
le->e32_impproc);
printf( " Per-page checksum table offset: %08x\n",
le->e32_pagesum);
printf( " Data pages offset from top of table: %08x\n",
le->e32_datapage);
printf( " Preload page count: %08x\n",
le->e32_preload);
printf( " Non-resident names table offset: %08x\n",
le->e32_nrestab);
printf( " Non-resident names table length: %d\n",
le->e32_cbnrestab);
printf( " Non-resident names table checksum: %08x\n",
le->e32_nressum);
printf( " Automatic data object: %08x\n",
le->e32_autodata);
printf( " Debug information offset: %08x\n",
le->e32_debuginfo);
printf( " Debug information length: %d\n",
le->e32_debuglen);
printf( " Preload instance pages number: %d\n",
le->e32_instpreload);
printf( " Demand instance pages number: %d\n",
le->e32_instdemand);
printf( " Extra heap allocation: %d\n",
le->e32_heapsize);
printf( " VxD resource table offset: %08x\n",
le->e32_winresoff);
printf( " Size of VxD resource table: %d\n",
le->e32_winreslen);
printf( " VxD identifier: %x\n",
le->e32_devid);
printf( " VxD DDK version: %x\n",
le->e32_ddkver);
} }
static void dump_le_objects( const IMAGE_VXD_HEADER *le ) static void dump_le_objects( const IMAGE_VXD_HEADER *le )

View File

@ -53,8 +53,8 @@ static void dump_import_object(const IMPORT_OBJECT_HEADER *ioh)
printf(" Version : %X\n", ioh->Version); printf(" Version : %X\n", ioh->Version);
printf(" Machine : %X (%s)\n", ioh->Machine, get_machine_str(ioh->Machine)); printf(" Machine : %X (%s)\n", ioh->Machine, get_machine_str(ioh->Machine));
printf(" TimeDateStamp: %08X %s\n", ioh->TimeDateStamp, get_time_str(ioh->TimeDateStamp)); printf(" TimeDateStamp: %08X %s\n", (UINT)ioh->TimeDateStamp, get_time_str(ioh->TimeDateStamp));
printf(" SizeOfData : %08X\n", ioh->SizeOfData); printf(" SizeOfData : %08X\n", (UINT)ioh->SizeOfData);
name = (const char *)ioh + sizeof(*ioh); name = (const char *)ioh + sizeof(*ioh);
printf(" DLL name : %s\n", name + strlen(name) + 1); printf(" DLL name : %s\n", name + strlen(name) + 1);
printf(" Symbol name : %s\n", name); printf(" Symbol name : %s\n", name);

View File

@ -80,8 +80,8 @@ static int dump_mfrecord(void)
printf("%-20s %08x\n", "METAHEADER", size); printf("%-20s %08x\n", "METAHEADER", size);
printf("type %d header_size %#x version %#x size %#x object_count %d max_record_size %#x " printf("type %d header_size %#x version %#x size %#x object_count %d max_record_size %#x "
"parameter_count %d\n", "parameter_count %d\n",
header->mtType, header->mtHeaderSize * 2, header->mtVersion, header->mtSize * 2, header->mtType, header->mtHeaderSize * 2, header->mtVersion, (UINT)header->mtSize * 2,
header->mtNoObjects, header->mtMaxRecord * 2, header->mtNoParameters); header->mtNoObjects, (UINT)header->mtMaxRecord * 2, header->mtNoParameters);
break; break;
} }
MRCASE(META_SETBKCOLOR); MRCASE(META_SETBKCOLOR);

View File

@ -71,7 +71,7 @@ enum FileSig get_kind_mdmp(void)
void mdmp_dump(void) void mdmp_dump(void)
{ {
const MINIDUMP_HEADER* hdr = PRD(0, sizeof(MINIDUMP_HEADER)); const MINIDUMP_HEADER* hdr = PRD(0, sizeof(MINIDUMP_HEADER));
ULONG idx, ndir = 0; UINT idx, ndir = 0;
const MINIDUMP_DIRECTORY* dir; const MINIDUMP_DIRECTORY* dir;
const void* stream; const void* stream;
@ -81,13 +81,13 @@ void mdmp_dump(void)
return; return;
} }
printf("Signature: %u (%.4s)\n", hdr->Signature, (const char*)&hdr->Signature); printf("Signature: %u (%.4s)\n", (UINT)hdr->Signature, (const char*)&hdr->Signature);
printf("Version: %x\n", hdr->Version); printf("Version: %x\n", (UINT)hdr->Version);
printf("NumberOfStreams: %u\n", hdr->NumberOfStreams); printf("NumberOfStreams: %u\n", (UINT)hdr->NumberOfStreams);
printf("StreamDirectoryRva: %u\n", hdr->StreamDirectoryRva); printf("StreamDirectoryRva: %u\n", (UINT)hdr->StreamDirectoryRva);
printf("CheckSum: %u\n", hdr->CheckSum); printf("CheckSum: %u\n", (UINT)hdr->CheckSum);
printf("TimeDateStamp: %s\n", get_time_str(hdr->u.TimeDateStamp)); printf("TimeDateStamp: %s\n", get_time_str(hdr->u.TimeDateStamp));
printf("Flags: %x%08x\n", (DWORD)(hdr->Flags >> 32), (DWORD)hdr->Flags); printf("Flags: %x%08x\n", (UINT)(hdr->Flags >> 32), (UINT)hdr->Flags);
for (idx = 0; idx <= LastReservedStream; idx++) for (idx = 0; idx <= LastReservedStream; idx++)
{ {
@ -103,20 +103,20 @@ void mdmp_dump(void)
const MINIDUMP_THREAD* mt = mtl->Threads; const MINIDUMP_THREAD* mt = mtl->Threads;
unsigned int i; unsigned int i;
printf("Threads: %u\n", mtl->NumberOfThreads); printf("Threads: %u\n", (UINT)mtl->NumberOfThreads);
for (i = 0; i < mtl->NumberOfThreads; i++, mt++) for (i = 0; i < mtl->NumberOfThreads; i++, mt++)
{ {
printf(" Thread: #%d\n", i); printf(" Thread: #%d\n", i);
printf(" ThreadId: %u\n", mt->ThreadId); printf(" ThreadId: %u\n", (UINT)mt->ThreadId);
printf(" SuspendCount: %u\n", mt->SuspendCount); printf(" SuspendCount: %u\n", (UINT)mt->SuspendCount);
printf(" PriorityClass: %u\n", mt->PriorityClass); printf(" PriorityClass: %u\n", (UINT)mt->PriorityClass);
printf(" Priority: %u\n", mt->Priority); printf(" Priority: %u\n", (UINT)mt->Priority);
printf(" Teb: 0x%x%08x\n", (DWORD)(mt->Teb >> 32), (DWORD)mt->Teb); printf(" Teb: 0x%x%08x\n", (UINT)(mt->Teb >> 32), (UINT)mt->Teb);
printf(" Stack: 0x%x%08x-0x%x%08x\n", printf(" Stack: 0x%x%08x-0x%x%08x\n",
(DWORD)(mt->Stack.StartOfMemoryRange >> 32), (UINT)(mt->Stack.StartOfMemoryRange >> 32),
(DWORD)mt->Stack.StartOfMemoryRange, (UINT)mt->Stack.StartOfMemoryRange,
(DWORD)((mt->Stack.StartOfMemoryRange + mt->Stack.Memory.DataSize) >> 32), (UINT)((mt->Stack.StartOfMemoryRange + mt->Stack.Memory.DataSize) >> 32),
(DWORD)(mt->Stack.StartOfMemoryRange + mt->Stack.Memory.DataSize)); (UINT)(mt->Stack.StartOfMemoryRange + mt->Stack.Memory.DataSize));
dump_mdmp_data(&mt->Stack.Memory, " "); dump_mdmp_data(&mt->Stack.Memory, " ");
printf(" ThreadContext:\n"); printf(" ThreadContext:\n");
dump_mdmp_data(&mt->ThreadContext, " "); dump_mdmp_data(&mt->ThreadContext, " ");
@ -134,23 +134,22 @@ void mdmp_dump(void)
printf("Modules (%s): %u\n", printf("Modules (%s): %u\n",
dir->StreamType == ModuleListStream ? "PE" : "ELF", dir->StreamType == ModuleListStream ? "PE" : "ELF",
mml->NumberOfModules); (UINT)mml->NumberOfModules);
for (i = 0; i < mml->NumberOfModules; i++, mm++) for (i = 0; i < mml->NumberOfModules; i++, mm++)
{ {
printf(" Module #%d:\n", i); printf(" Module #%d:\n", i);
printf(" BaseOfImage: 0x%x%08x\n", printf(" BaseOfImage: 0x%x%08x\n",
(DWORD)(mm->BaseOfImage >> 32), (DWORD) mm->BaseOfImage); (UINT)(mm->BaseOfImage >> 32), (UINT) mm->BaseOfImage);
printf(" SizeOfImage: %u\n", mm->SizeOfImage); printf(" SizeOfImage: %u\n", (UINT)mm->SizeOfImage);
printf(" CheckSum: %u\n", mm->CheckSum); printf(" CheckSum: %u\n", (UINT)mm->CheckSum);
printf(" TimeDateStamp: %s\n", get_time_str(mm->TimeDateStamp)); printf(" TimeDateStamp: %s\n", get_time_str(mm->TimeDateStamp));
printf(" ModuleName: "); printf(" ModuleName: ");
dump_mdmp_string(mm->ModuleNameRva); dump_mdmp_string(mm->ModuleNameRva);
printf("\n"); printf("\n");
printf(" VersionInfo:\n"); printf(" VersionInfo:\n");
printf(" dwSignature: %x\n", mm->VersionInfo.dwSignature); printf(" dwSignature: %x\n", (UINT)mm->VersionInfo.dwSignature);
printf(" dwStrucVersion: %x\n", printf(" dwStrucVersion: %x\n", (UINT)mm->VersionInfo.dwStrucVersion);
mm->VersionInfo.dwStrucVersion); printf(" dwFileVersion: %d,%d,%d,%d\n",
printf(" dwFileVersion: %d,%d,%d,%d\n",
HIWORD(mm->VersionInfo.dwFileVersionMS), HIWORD(mm->VersionInfo.dwFileVersionMS),
LOWORD(mm->VersionInfo.dwFileVersionMS), LOWORD(mm->VersionInfo.dwFileVersionMS),
HIWORD(mm->VersionInfo.dwFileVersionLS), HIWORD(mm->VersionInfo.dwFileVersionLS),
@ -160,9 +159,8 @@ void mdmp_dump(void)
LOWORD(mm->VersionInfo.dwProductVersionMS), LOWORD(mm->VersionInfo.dwProductVersionMS),
HIWORD(mm->VersionInfo.dwProductVersionLS), HIWORD(mm->VersionInfo.dwProductVersionLS),
LOWORD(mm->VersionInfo.dwProductVersionLS)); LOWORD(mm->VersionInfo.dwProductVersionLS));
printf(" dwFileFlagsMask: %u\n", printf(" dwFileFlagsMask: %u\n", (UINT)mm->VersionInfo.dwFileFlagsMask);
mm->VersionInfo.dwFileFlagsMask); printf(" dwFileFlags: %s%s%s%s%s%s\n",
printf(" dwFileFlags: %s%s%s%s%s%s\n",
mm->VersionInfo.dwFileFlags & VS_FF_DEBUG ? "Debug " : "", mm->VersionInfo.dwFileFlags & VS_FF_DEBUG ? "Debug " : "",
mm->VersionInfo.dwFileFlags & VS_FF_INFOINFERRED ? "Inferred " : "", mm->VersionInfo.dwFileFlags & VS_FF_INFOINFERRED ? "Inferred " : "",
mm->VersionInfo.dwFileFlags & VS_FF_PATCHED ? "Patched " : "", mm->VersionInfo.dwFileFlags & VS_FF_PATCHED ? "Patched " : "",
@ -204,20 +202,19 @@ void mdmp_dump(void)
default: p1 = "---"; break; default: p1 = "---"; break;
} }
printf(" dwFileType: %s\n", p1); printf(" dwFileType: %s\n", p1);
printf(" dwFileSubtype: %u\n", printf(" dwFileSubtype: %u\n", (UINT)mm->VersionInfo.dwFileSubtype);
mm->VersionInfo.dwFileSubtype);
printf(" dwFileDate: %x%08x\n", printf(" dwFileDate: %x%08x\n",
mm->VersionInfo.dwFileDateMS, mm->VersionInfo.dwFileDateLS); (UINT)mm->VersionInfo.dwFileDateMS, (UINT)mm->VersionInfo.dwFileDateLS);
printf(" CvRecord: <%u>\n", mm->CvRecord.DataSize); printf(" CvRecord: <%u>\n", (UINT)mm->CvRecord.DataSize);
dump_mdmp_data(&mm->CvRecord, " "); dump_mdmp_data(&mm->CvRecord, " ");
printf(" MiscRecord: <%u>\n", mm->MiscRecord.DataSize); printf(" MiscRecord: <%u>\n", (UINT)mm->MiscRecord.DataSize);
dump_mdmp_data(&mm->MiscRecord, " "); dump_mdmp_data(&mm->MiscRecord, " ");
printf(" Reserved0: 0x%x%08x\n", printf(" Reserved0: 0x%x%08x\n",
(DWORD)(mm->Reserved0 >> 32), (DWORD)mm->Reserved0); (UINT)(mm->Reserved0 >> 32), (UINT)mm->Reserved0);
printf(" Reserved1: 0x%x%08x\n", printf(" Reserved1: 0x%x%08x\n",
(DWORD)(mm->Reserved1 >> 32), (DWORD)mm->Reserved1); (UINT)(mm->Reserved1 >> 32), (UINT)mm->Reserved1);
} }
} }
break; break;
case MemoryListStream: case MemoryListStream:
{ {
@ -225,17 +222,17 @@ void mdmp_dump(void)
const MINIDUMP_MEMORY_DESCRIPTOR* mmd = mml->MemoryRanges; const MINIDUMP_MEMORY_DESCRIPTOR* mmd = mml->MemoryRanges;
unsigned int i; unsigned int i;
printf("Memory Ranges: %u\n", mml->NumberOfMemoryRanges); printf("Memory Ranges: %u\n", (UINT)mml->NumberOfMemoryRanges);
for (i = 0; i < mml->NumberOfMemoryRanges; i++, mmd++) for (i = 0; i < mml->NumberOfMemoryRanges; i++, mmd++)
{ {
printf(" Memory Range #%d:\n", i); printf(" Memory Range #%d:\n", i);
printf(" Range: 0x%x%08x-0x%x%08x\n", printf(" Range: 0x%x%08x-0x%x%08x\n",
(DWORD)(mmd->StartOfMemoryRange >> 32), (UINT)(mmd->StartOfMemoryRange >> 32),
(DWORD)mmd->StartOfMemoryRange, (UINT)mmd->StartOfMemoryRange,
(DWORD)((mmd->StartOfMemoryRange + mmd->Memory.DataSize) >> 32), (UINT)((mmd->StartOfMemoryRange + mmd->Memory.DataSize) >> 32),
(DWORD)(mmd->StartOfMemoryRange + mmd->Memory.DataSize)); (UINT)(mmd->StartOfMemoryRange + mmd->Memory.DataSize));
dump_mdmp_data(&mmd->Memory, " "); dump_mdmp_data(&mmd->Memory, " ");
} }
} }
break; break;
case SystemInfoStream: case SystemInfoStream:
@ -371,22 +368,19 @@ void mdmp_dump(void)
break; break;
default: str = "???"; break; default: str = "???"; break;
} }
printf(" Version: Windows %s (%u)\n", str, msi->BuildNumber); printf(" Version: Windows %s (%u)\n", str, (UINT)msi->BuildNumber);
printf(" PlatformId: %u\n", msi->PlatformId); printf(" PlatformId: %u\n", (UINT)msi->PlatformId);
printf(" CSD: "); printf(" CSD: ");
dump_mdmp_string(msi->CSDVersionRva); dump_mdmp_string(msi->CSDVersionRva);
printf("\n"); printf("\n");
printf(" Reserved1: %u\n", msi->u1.Reserved1); printf(" Reserved1: %u\n", (UINT)msi->u1.Reserved1);
if (msi->ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) if (msi->ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
{ {
printf(" x86.VendorId: %.12s\n", printf(" x86.VendorId: %.12s\n",
(const char*)msi->Cpu.X86CpuInfo.VendorId); (const char*)msi->Cpu.X86CpuInfo.VendorId);
printf(" x86.VersionInformation: %x\n", printf(" x86.VersionInformation: %x\n", (UINT)msi->Cpu.X86CpuInfo.VersionInformation);
msi->Cpu.X86CpuInfo.VersionInformation); printf(" x86.FeatureInformation: %x\n", (UINT)msi->Cpu.X86CpuInfo.FeatureInformation);
printf(" x86.FeatureInformation: %x\n", printf(" x86.AMDExtendedCpuFeatures: %x\n", (UINT)msi->Cpu.X86CpuInfo.AMDExtendedCpuFeatures);
msi->Cpu.X86CpuInfo.FeatureInformation);
printf(" x86.AMDExtendedCpuFeatures: %x\n",
msi->Cpu.X86CpuInfo.AMDExtendedCpuFeatures);
} }
if (sizeof(MINIDUMP_SYSTEM_INFO) + 4 > dir->Location.DataSize && if (sizeof(MINIDUMP_SYSTEM_INFO) + 4 > dir->Location.DataSize &&
msi->CSDVersionRva >= dir->Location.Rva + 4) msi->CSDVersionRva >= dir->Location.Rva + 4)
@ -410,17 +404,17 @@ void mdmp_dump(void)
const MINIDUMP_MISC_INFO* mmi = (const MINIDUMP_MISC_INFO*)stream; const MINIDUMP_MISC_INFO* mmi = (const MINIDUMP_MISC_INFO*)stream;
printf("Misc Information\n"); printf("Misc Information\n");
printf(" Size: %u\n", mmi->SizeOfInfo); printf(" Size: %u\n", (UINT)mmi->SizeOfInfo);
printf(" Flags: %s%s\n", printf(" Flags: %s%s\n",
mmi->Flags1 & MINIDUMP_MISC1_PROCESS_ID ? "ProcessId " : "", mmi->Flags1 & MINIDUMP_MISC1_PROCESS_ID ? "ProcessId " : "",
mmi->Flags1 & MINIDUMP_MISC1_PROCESS_TIMES ? "ProcessTimes " : ""); mmi->Flags1 & MINIDUMP_MISC1_PROCESS_TIMES ? "ProcessTimes " : "");
if (mmi->Flags1 & MINIDUMP_MISC1_PROCESS_ID) if (mmi->Flags1 & MINIDUMP_MISC1_PROCESS_ID)
printf(" ProcessId: %u\n", mmi->ProcessId); printf(" ProcessId: %u\n", (UINT)mmi->ProcessId);
if (mmi->Flags1 & MINIDUMP_MISC1_PROCESS_TIMES) if (mmi->Flags1 & MINIDUMP_MISC1_PROCESS_TIMES)
{ {
printf(" ProcessCreateTime: %u\n", mmi->ProcessCreateTime); printf(" ProcessCreateTime: %u\n", (UINT)mmi->ProcessCreateTime);
printf(" ProcessUserTime: %u\n", mmi->ProcessUserTime); printf(" ProcessUserTime: %u\n", (UINT)mmi->ProcessUserTime);
printf(" ProcessKernelTime: %u\n", mmi->ProcessKernelTime); printf(" ProcessKernelTime: %u\n", (UINT)mmi->ProcessKernelTime);
} }
} }
break; break;
@ -430,23 +424,22 @@ void mdmp_dump(void)
unsigned int i; unsigned int i;
printf("Exception:\n"); printf("Exception:\n");
printf(" ThreadId: %08x\n", mes->ThreadId); printf(" ThreadId: %08x\n", (UINT)mes->ThreadId);
printf(" ExceptionRecord:\n"); printf(" ExceptionRecord:\n");
printf(" ExceptionCode: %u\n", mes->ExceptionRecord.ExceptionCode); printf(" ExceptionCode: %u\n", (UINT)mes->ExceptionRecord.ExceptionCode);
printf(" ExceptionFlags: %u\n", mes->ExceptionRecord.ExceptionFlags); printf(" ExceptionFlags: %u\n", (UINT)mes->ExceptionRecord.ExceptionFlags);
printf(" ExceptionRecord: 0x%x%08x\n", printf(" ExceptionRecord: 0x%x%08x\n",
(DWORD)(mes->ExceptionRecord.ExceptionRecord >> 32), (UINT)(mes->ExceptionRecord.ExceptionRecord >> 32),
(DWORD)mes->ExceptionRecord.ExceptionRecord); (UINT)mes->ExceptionRecord.ExceptionRecord);
printf(" ExceptionAddress: 0x%x%08x\n", printf(" ExceptionAddress: 0x%x%08x\n",
(DWORD)(mes->ExceptionRecord.ExceptionAddress >> 32), (UINT)(mes->ExceptionRecord.ExceptionAddress >> 32),
(DWORD)(mes->ExceptionRecord.ExceptionAddress)); (UINT)(mes->ExceptionRecord.ExceptionAddress));
printf(" ExceptionNumberParameters: %u\n", printf(" ExceptionNumberParameters: %u\n", (UINT)mes->ExceptionRecord.NumberParameters);
mes->ExceptionRecord.NumberParameters);
for (i = 0; i < mes->ExceptionRecord.NumberParameters; i++) for (i = 0; i < mes->ExceptionRecord.NumberParameters; i++)
{ {
printf(" [%d]: 0x%x%08x\n", i, printf(" [%d]: 0x%x%08x\n", i,
(DWORD)(mes->ExceptionRecord.ExceptionInformation[i] >> 32), (UINT)(mes->ExceptionRecord.ExceptionInformation[i] >> 32),
(DWORD)mes->ExceptionRecord.ExceptionInformation[i]); (UINT)mes->ExceptionRecord.ExceptionInformation[i]);
} }
printf(" ThreadContext:\n"); printf(" ThreadContext:\n");
dump_mdmp_data(&mes->ThreadContext, " "); dump_mdmp_data(&mes->ThreadContext, " ");
@ -454,9 +447,9 @@ void mdmp_dump(void)
break; break;
default: default:
printf("NIY %d\n", dir->StreamType); printf("NIY %d\n", (UINT)dir->StreamType);
printf(" RVA: %u\n", dir->Location.Rva); printf(" RVA: %u\n", (UINT)dir->Location.Rva);
printf(" Size: %u\n", dir->Location.DataSize); printf(" Size: %u\n", (UINT)dir->Location.DataSize);
dump_mdmp_data(&dir->Location, " "); dump_mdmp_data(&dir->Location, " ");
break; break;
} }

View File

@ -113,7 +113,7 @@ static void dump_ne_header( const IMAGE_OS2_HEADER *ne )
printf( "File header:\n" ); printf( "File header:\n" );
printf( "Linker version: %d.%d\n", ne->ne_ver, ne->ne_rev ); printf( "Linker version: %d.%d\n", ne->ne_ver, ne->ne_rev );
printf( "Entry table: %x len %d\n", ne->ne_enttab, ne->ne_cbenttab ); printf( "Entry table: %x len %d\n", ne->ne_enttab, ne->ne_cbenttab );
printf( "Checksum: %08x\n", ne->ne_crc ); printf( "Checksum: %08x\n", (UINT)ne->ne_crc );
printf( "Flags: %04x\n", ne->ne_flags ); printf( "Flags: %04x\n", ne->ne_flags );
printf( "Auto data segment: %x\n", ne->ne_autodata ); printf( "Auto data segment: %x\n", ne->ne_autodata );
printf( "Heap size: %d bytes\n", ne->ne_heap ); printf( "Heap size: %d bytes\n", ne->ne_heap );
@ -127,7 +127,7 @@ static void dump_ne_header( const IMAGE_OS2_HEADER *ne )
printf( "Resident name table: %x\n", ne->ne_restab ); printf( "Resident name table: %x\n", ne->ne_restab );
printf( "Module table: %x\n", ne->ne_modtab ); printf( "Module table: %x\n", ne->ne_modtab );
printf( "Import table: %x\n", ne->ne_imptab ); printf( "Import table: %x\n", ne->ne_imptab );
printf( "Non-resident table: %x\n", ne->ne_nrestab ); printf( "Non-resident table: %x\n", (UINT)ne->ne_nrestab );
printf( "Exe type: %x\n", ne->ne_exetyp ); printf( "Exe type: %x\n", ne->ne_exetyp );
printf( "Other flags: %x\n", ne->ne_flagsothers ); printf( "Other flags: %x\n", ne->ne_flagsothers );
printf( "Fast load area: %x-%x\n", ne->ne_pretthunks << ne->ne_align, printf( "Fast load area: %x-%x\n", ne->ne_pretthunks << ne->ne_align,

View File

@ -711,7 +711,7 @@ static void pdb_dump_fpo(struct pdb_reader* reader, unsigned stream_idx)
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
{ {
printf("\t%08x %08x %4d %4d %7d %4d %6s %c %c\n", printf("\t%08x %08x %4d %4d %7d %4d %6s %c %c\n",
fpo[i].ulOffStart, fpo[i].cbProcSize, fpo[i].cdwLocals, fpo[i].cdwParams, (UINT)fpo[i].ulOffStart, (UINT)fpo[i].cbProcSize, (UINT)fpo[i].cdwLocals, fpo[i].cdwParams,
fpo[i].cbProlog, fpo[i].cbRegs, frame_type[fpo[i].cbFrame], fpo[i].cbProlog, fpo[i].cbRegs, frame_type[fpo[i].cbFrame],
fpo[i].fHasSEH ? 'Y' : 'N', fpo[i].fUseBP ? 'Y' : 'N'); fpo[i].fHasSEH ? 'Y' : 'N', fpo[i].fUseBP ? 'Y' : 'N');
} }

View File

@ -231,8 +231,8 @@ static inline void print_datadirectory(DWORD n, const IMAGE_DATA_DIRECTORY *dire
for (i = 0; i < n && i < 16; i++) for (i = 0; i < n && i < 16; i++)
{ {
printf(" %-12s rva: 0x%-8x size: 0x%-8x\n", printf(" %-12s rva: 0x%-8x size: 0x%-8x\n",
DirectoryNames[i], directory[i].VirtualAddress, DirectoryNames[i], (UINT)directory[i].VirtualAddress,
directory[i].Size); (UINT)directory[i].Size);
} }
} }
@ -350,12 +350,12 @@ void dump_file_header(const IMAGE_FILE_HEADER *fileHeader)
fileHeader->Machine, get_machine_str(fileHeader->Machine)); fileHeader->Machine, get_machine_str(fileHeader->Machine));
printf(" Number of Sections: %d\n", fileHeader->NumberOfSections); printf(" Number of Sections: %d\n", fileHeader->NumberOfSections);
printf(" TimeDateStamp: %08X (%s) offset %lu\n", printf(" TimeDateStamp: %08X (%s) offset %lu\n",
fileHeader->TimeDateStamp, get_time_str(fileHeader->TimeDateStamp), (UINT)fileHeader->TimeDateStamp, get_time_str(fileHeader->TimeDateStamp),
Offset(&(fileHeader->TimeDateStamp))); Offset(&(fileHeader->TimeDateStamp)));
printf(" PointerToSymbolTable: %08X\n", fileHeader->PointerToSymbolTable); printf(" PointerToSymbolTable: %08X\n", (UINT)fileHeader->PointerToSymbolTable);
printf(" NumberOfSymbols: %08X\n", fileHeader->NumberOfSymbols); printf(" NumberOfSymbols: %08X\n", (UINT)fileHeader->NumberOfSymbols);
printf(" SizeOfOptionalHeader: %04X\n", fileHeader->SizeOfOptionalHeader); printf(" SizeOfOptionalHeader: %04X\n", (UINT)fileHeader->SizeOfOptionalHeader);
printf(" Characteristics: %04X\n", fileHeader->Characteristics); printf(" Characteristics: %04X\n", (UINT)fileHeader->Characteristics);
#define X(f,s) if (fileHeader->Characteristics & f) printf(" %s\n", s) #define X(f,s) if (fileHeader->Characteristics & f) printf(" %s\n", s)
X(IMAGE_FILE_RELOCS_STRIPPED, "RELOCS_STRIPPED"); X(IMAGE_FILE_RELOCS_STRIPPED, "RELOCS_STRIPPED");
X(IMAGE_FILE_EXECUTABLE_IMAGE, "EXECUTABLE_IMAGE"); X(IMAGE_FILE_EXECUTABLE_IMAGE, "EXECUTABLE_IMAGE");
@ -394,14 +394,14 @@ void dump_section(const IMAGE_SECTION_HEADER *sectHead, const char* strtable)
else else
printf(" %-8.8s", sectHead->Name); printf(" %-8.8s", sectHead->Name);
printf(" VirtSize: 0x%08x VirtAddr: 0x%08x\n", printf(" VirtSize: 0x%08x VirtAddr: 0x%08x\n",
sectHead->Misc.VirtualSize, sectHead->VirtualAddress); (UINT)sectHead->Misc.VirtualSize, (UINT)sectHead->VirtualAddress);
printf(" raw data offs: 0x%08x raw data size: 0x%08x\n", printf(" raw data offs: 0x%08x raw data size: 0x%08x\n",
sectHead->PointerToRawData, sectHead->SizeOfRawData); (UINT)sectHead->PointerToRawData, (UINT)sectHead->SizeOfRawData);
printf(" relocation offs: 0x%08x relocations: 0x%08x\n", printf(" relocation offs: 0x%08x relocations: 0x%08x\n",
sectHead->PointerToRelocations, sectHead->NumberOfRelocations); (UINT)sectHead->PointerToRelocations, (UINT)sectHead->NumberOfRelocations);
printf(" line # offs: %-8u line #'s: %-8u\n", printf(" line # offs: %-8u line #'s: %-8u\n",
sectHead->PointerToLinenumbers, sectHead->NumberOfLinenumbers); (UINT)sectHead->PointerToLinenumbers, (UINT)sectHead->NumberOfLinenumbers);
printf(" characteristics: 0x%08x\n", sectHead->Characteristics); printf(" characteristics: 0x%08x\n", (UINT)sectHead->Characteristics);
printf(" "); printf(" ");
#define X(b,s) if (sectHead->Characteristics & b) printf(" " s) #define X(b,s) if (sectHead->Characteristics & b) printf(" " s)
/* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */ /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
@ -610,16 +610,16 @@ static void dump_dir_exported_functions(void)
printf("Exports table:\n"); printf("Exports table:\n");
printf("\n"); printf("\n");
printf(" Name: %s\n", (const char*)RVA(exportDir->Name, sizeof(DWORD))); printf(" Name: %s\n", (const char*)RVA(exportDir->Name, sizeof(DWORD)));
printf(" Characteristics: %08x\n", exportDir->Characteristics); printf(" Characteristics: %08x\n", (UINT)exportDir->Characteristics);
printf(" TimeDateStamp: %08X %s\n", printf(" TimeDateStamp: %08X %s\n",
exportDir->TimeDateStamp, get_time_str(exportDir->TimeDateStamp)); (UINT)exportDir->TimeDateStamp, get_time_str(exportDir->TimeDateStamp));
printf(" Version: %u.%02u\n", exportDir->MajorVersion, exportDir->MinorVersion); printf(" Version: %u.%02u\n", exportDir->MajorVersion, exportDir->MinorVersion);
printf(" Ordinal base: %u\n", exportDir->Base); printf(" Ordinal base: %u\n", (UINT)exportDir->Base);
printf(" # of functions: %u\n", exportDir->NumberOfFunctions); printf(" # of functions: %u\n", (UINT)exportDir->NumberOfFunctions);
printf(" # of Names: %u\n", exportDir->NumberOfNames); printf(" # of Names: %u\n", (UINT)exportDir->NumberOfNames);
printf("Addresses of functions: %08X\n", exportDir->AddressOfFunctions); printf("Addresses of functions: %08X\n", (UINT)exportDir->AddressOfFunctions);
printf("Addresses of name ordinals: %08X\n", exportDir->AddressOfNameOrdinals); printf("Addresses of name ordinals: %08X\n", (UINT)exportDir->AddressOfNameOrdinals);
printf("Addresses of names: %08X\n", exportDir->AddressOfNames); printf("Addresses of names: %08X\n", (UINT)exportDir->AddressOfNames);
printf("\n"); printf("\n");
printf(" Entry Pt Ordn Name\n"); printf(" Entry Pt Ordn Name\n");
@ -636,7 +636,7 @@ static void dump_dir_exported_functions(void)
for (i = 0; i < exportDir->NumberOfFunctions; i++) for (i = 0; i < exportDir->NumberOfFunctions; i++)
{ {
if (!pFunc[i]) continue; if (!pFunc[i]) continue;
printf(" %08X %5u ", pFunc[i], exportDir->Base + i); printf(" %08X %5u ", pFunc[i], (UINT)exportDir->Base + i);
if (funcs[i]) if (funcs[i])
printf("%s", get_symbol_str((const char*)RVA(funcs[i], sizeof(DWORD)))); printf("%s", get_symbol_str((const char*)RVA(funcs[i], sizeof(DWORD))));
else else
@ -1665,7 +1665,7 @@ static void dump_image_thunk_data32(const IMAGE_THUNK_DATA32 *il, int offset, UI
for (; il->u1.Ordinal; il++, thunk_rva += sizeof(UINT)) for (; il->u1.Ordinal; il++, thunk_rva += sizeof(UINT))
{ {
if (IMAGE_SNAP_BY_ORDINAL32(il->u1.Ordinal)) if (IMAGE_SNAP_BY_ORDINAL32(il->u1.Ordinal))
printf(" %08x %4u <by ordinal>\n", thunk_rva, IMAGE_ORDINAL32(il->u1.Ordinal)); printf(" %08x %4u <by ordinal>\n", thunk_rva, (UINT)IMAGE_ORDINAL32(il->u1.Ordinal));
else else
{ {
iibn = RVA((DWORD)il->u1.AddressOfData - offset, sizeof(DWORD)); iibn = RVA((DWORD)il->u1.AddressOfData - offset, sizeof(DWORD));
@ -1695,8 +1695,8 @@ static void dump_dir_imported_functions(void)
printf(" offset %08lx %s\n", Offset(importDesc), (const char*)RVA(importDesc->Name, sizeof(DWORD))); printf(" offset %08lx %s\n", Offset(importDesc), (const char*)RVA(importDesc->Name, sizeof(DWORD)));
printf(" Hint/Name Table: %08X\n", (UINT)importDesc->u.OriginalFirstThunk); printf(" Hint/Name Table: %08X\n", (UINT)importDesc->u.OriginalFirstThunk);
printf(" TimeDateStamp: %08X (%s)\n", printf(" TimeDateStamp: %08X (%s)\n",
importDesc->TimeDateStamp, get_time_str(importDesc->TimeDateStamp)); (UINT)importDesc->TimeDateStamp, get_time_str(importDesc->TimeDateStamp));
printf(" ForwarderChain: %08X\n", importDesc->ForwarderChain); printf(" ForwarderChain: %08X\n", (UINT)importDesc->ForwarderChain);
printf(" First thunk RVA: %08X\n", (UINT)importDesc->FirstThunk); printf(" First thunk RVA: %08X\n", (UINT)importDesc->FirstThunk);
printf(" Thunk Ordn Name\n"); printf(" Thunk Ordn Name\n");
@ -1782,12 +1782,12 @@ static void dump_dir_delay_imported_functions(void)
if (!importDesc->DllNameRVA || !importDesc->ImportAddressTableRVA || !importDesc->ImportNameTableRVA) break; if (!importDesc->DllNameRVA || !importDesc->ImportAddressTableRVA || !importDesc->ImportNameTableRVA) break;
printf(" grAttrs %08x offset %08lx %s\n", importDesc->Attributes.AllAttributes, Offset(importDesc), printf(" grAttrs %08x offset %08lx %s\n", (UINT)importDesc->Attributes.AllAttributes,
(const char *)RVA(importDesc->DllNameRVA - offset, sizeof(DWORD))); Offset(importDesc), (const char *)RVA(importDesc->DllNameRVA - offset, sizeof(DWORD)));
printf(" Hint/Name Table: %08x\n", importDesc->ImportNameTableRVA); printf(" Hint/Name Table: %08x\n", (UINT)importDesc->ImportNameTableRVA);
printf(" Address Table: %08x\n", importDesc->ImportAddressTableRVA); printf(" Address Table: %08x\n", (UINT)importDesc->ImportAddressTableRVA);
printf(" TimeDateStamp: %08X (%s)\n", printf(" TimeDateStamp: %08X (%s)\n",
importDesc->TimeDateStamp, get_time_str(importDesc->TimeDateStamp)); (UINT)importDesc->TimeDateStamp, get_time_str(importDesc->TimeDateStamp));
printf(" Thunk Ordn Name\n"); printf(" Thunk Ordn Name\n");
@ -1813,9 +1813,9 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx)
const char* str; const char* str;
printf("Directory %02u\n", idx + 1); printf("Directory %02u\n", idx + 1);
printf(" Characteristics: %08X\n", idd->Characteristics); printf(" Characteristics: %08X\n", (UINT)idd->Characteristics);
printf(" TimeDateStamp: %08X %s\n", printf(" TimeDateStamp: %08X %s\n",
idd->TimeDateStamp, get_time_str(idd->TimeDateStamp)); (UINT)idd->TimeDateStamp, get_time_str(idd->TimeDateStamp));
printf(" Version %u.%02u\n", idd->MajorVersion, idd->MinorVersion); printf(" Version %u.%02u\n", idd->MajorVersion, idd->MinorVersion);
switch (idd->Type) switch (idd->Type)
{ {
@ -1838,10 +1838,10 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx)
case IMAGE_DEBUG_TYPE_MPX: str = "MPX"; break; case IMAGE_DEBUG_TYPE_MPX: str = "MPX"; break;
case IMAGE_DEBUG_TYPE_REPRO: str = "REPRO"; break; case IMAGE_DEBUG_TYPE_REPRO: str = "REPRO"; break;
} }
printf(" Type: %u (%s)\n", idd->Type, str); printf(" Type: %u (%s)\n", (UINT)idd->Type, str);
printf(" SizeOfData: %u\n", idd->SizeOfData); printf(" SizeOfData: %u\n", (UINT)idd->SizeOfData);
printf(" AddressOfRawData: %08X\n", idd->AddressOfRawData); printf(" AddressOfRawData: %08X\n", (UINT)idd->AddressOfRawData);
printf(" PointerToRawData: %08X\n", idd->PointerToRawData); printf(" PointerToRawData: %08X\n", (UINT)idd->PointerToRawData);
switch (idd->Type) switch (idd->Type)
{ {
@ -1862,9 +1862,8 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx)
const IMAGE_DEBUG_MISC* misc = PRD(idd->PointerToRawData, idd->SizeOfData); const IMAGE_DEBUG_MISC* misc = PRD(idd->PointerToRawData, idd->SizeOfData);
if (!misc) {printf("Can't get misc debug information\n"); break;} if (!misc) {printf("Can't get misc debug information\n"); break;}
printf(" DataType: %u (%s)\n", printf(" DataType: %u (%s)\n",
misc->DataType, (UINT)misc->DataType, (misc->DataType == IMAGE_DEBUG_MISC_EXENAME) ? "Exe name" : "Unknown");
(misc->DataType == IMAGE_DEBUG_MISC_EXENAME) ? "Exe name" : "Unknown"); printf(" Length: %u\n", (UINT)misc->Length);
printf(" Length: %u\n", misc->Length);
printf(" Unicode: %s\n", misc->Unicode ? "Yes" : "No"); printf(" Unicode: %s\n", misc->Unicode ? "Yes" : "No");
printf(" Data: %s\n", misc->Data); printf(" Data: %s\n", misc->Data);
} }
@ -1906,7 +1905,7 @@ static inline void print_clrflags(const char *title, UINT value)
static inline void print_clrdirectory(const char *title, const IMAGE_DATA_DIRECTORY *dir) static inline void print_clrdirectory(const char *title, const IMAGE_DATA_DIRECTORY *dir)
{ {
printf(" %-23s rva: 0x%-8x size: 0x%-8x\n", title, dir->VirtualAddress, dir->Size); printf(" %-23s rva: 0x%-8x size: 0x%-8x\n", title, (UINT)dir->VirtualAddress, (UINT)dir->Size);
} }
static void dump_dir_clr_header(void) static void dump_dir_clr_header(void)
@ -1964,7 +1963,7 @@ static void dump_dir_reloc(void)
printf( "Relocations\n" ); printf( "Relocations\n" );
while (rel < end - 1 && rel->SizeOfBlock) while (rel < end - 1 && rel->SizeOfBlock)
{ {
printf( " Page %x\n", rel->VirtualAddress ); printf( " Page %x\n", (UINT)rel->VirtualAddress );
relocs = (const USHORT *)(rel + 1); relocs = (const USHORT *)(rel + 1);
i = (rel->SizeOfBlock - sizeof(*rel)) / sizeof(USHORT); i = (rel->SizeOfBlock - sizeof(*rel)) / sizeof(USHORT);
while (i--) while (i--)
@ -2048,13 +2047,13 @@ void dbg_dump(void)
separateDebugHead->Machine, get_machine_str(separateDebugHead->Machine)); separateDebugHead->Machine, get_machine_str(separateDebugHead->Machine));
printf ("Characteristics: 0x%04X\n", separateDebugHead->Characteristics); printf ("Characteristics: 0x%04X\n", separateDebugHead->Characteristics);
printf ("TimeDateStamp: 0x%08X (%s)\n", printf ("TimeDateStamp: 0x%08X (%s)\n",
separateDebugHead->TimeDateStamp, get_time_str(separateDebugHead->TimeDateStamp)); (UINT)separateDebugHead->TimeDateStamp, get_time_str(separateDebugHead->TimeDateStamp));
printf ("CheckSum: 0x%08X\n", separateDebugHead->CheckSum); printf ("CheckSum: 0x%08X\n", (UINT)separateDebugHead->CheckSum);
printf ("ImageBase: 0x%08X\n", separateDebugHead->ImageBase); printf ("ImageBase: 0x%08X\n", (UINT)separateDebugHead->ImageBase);
printf ("SizeOfImage: 0x%08X\n", separateDebugHead->SizeOfImage); printf ("SizeOfImage: 0x%08X\n", (UINT)separateDebugHead->SizeOfImage);
printf ("NumberOfSections: 0x%08X\n", separateDebugHead->NumberOfSections); printf ("NumberOfSections: 0x%08X\n", (UINT)separateDebugHead->NumberOfSections);
printf ("ExportedNamesSize: 0x%08X\n", separateDebugHead->ExportedNamesSize); printf ("ExportedNamesSize: 0x%08X\n", (UINT)separateDebugHead->ExportedNamesSize);
printf ("DebugDirectorySize: 0x%08X\n", separateDebugHead->DebugDirectorySize); printf ("DebugDirectorySize: 0x%08X\n", (UINT)separateDebugHead->DebugDirectorySize);
if (!PRD(sizeof(IMAGE_SEPARATE_DEBUG_HEADER), if (!PRD(sizeof(IMAGE_SEPARATE_DEBUG_HEADER),
separateDebugHead->NumberOfSections * sizeof(IMAGE_SECTION_HEADER))) separateDebugHead->NumberOfSections * sizeof(IMAGE_SECTION_HEADER)))
@ -2528,7 +2527,7 @@ static void do_grab_sym( void )
/* Ordinal only entry */ /* Ordinal only entry */
sprintf (ordinal_text, "%s_%u", sprintf (ordinal_text, "%s_%u",
globals.forward_dll ? globals.forward_dll : OUTPUT_UC_DLL_NAME, globals.forward_dll ? globals.forward_dll : OUTPUT_UC_DLL_NAME,
exportDir->Base + i); (UINT)exportDir->Base + i);
str_toupper(ordinal_text); str_toupper(ordinal_text);
dll_symbols[j].symbol = xstrdup(ordinal_text); dll_symbols[j].symbol = xstrdup(ordinal_text);
assert(dll_symbols[j].symbol); assert(dll_symbols[j].symbol);
@ -2541,7 +2540,8 @@ static void do_grab_sym( void )
if (NORMAL) if (NORMAL)
printf("%u named symbols in DLL, %u total, %d unique (ordinal base = %d)\n", printf("%u named symbols in DLL, %u total, %d unique (ordinal base = %d)\n",
exportDir->NumberOfNames, exportDir->NumberOfFunctions, j, exportDir->Base); (UINT)exportDir->NumberOfNames, (UINT)exportDir->NumberOfFunctions,
j, (UINT)exportDir->Base);
qsort( dll_symbols, j, sizeof(dll_symbol), symbol_cmp ); qsort( dll_symbols, j, sizeof(dll_symbol), symbol_cmp );