From ba123abf57e854026c0af3b8115db20fcbf9a23a Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 29 Sep 2006 21:32:57 +0200 Subject: [PATCH] winedump: Win64 printf format warning fixes. --- tools/winedump/Makefile.in | 1 - tools/winedump/debug.c | 8 +-- tools/winedump/le.c | 86 ++++++++++++++-------------- tools/winedump/lnk.c | 38 ++++++------- tools/winedump/minidump.c | 100 ++++++++++++++++---------------- tools/winedump/ne.c | 4 +- tools/winedump/pe.c | 114 ++++++++++++++++++------------------- 7 files changed, 175 insertions(+), 176 deletions(-) diff --git a/tools/winedump/Makefile.in b/tools/winedump/Makefile.in index cc0f7adcb83..909a135000f 100644 --- a/tools/winedump/Makefile.in +++ b/tools/winedump/Makefile.in @@ -3,7 +3,6 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ EXEEXT = @EXEEXT@ -DEFS = -DWINE_NO_LONG_AS_INT PROGRAMS = winedump$(EXEEXT) MANPAGES = winedump.man diff --git a/tools/winedump/debug.c b/tools/winedump/debug.c index 8d24a173e89..eb3963b0c78 100644 --- a/tools/winedump/debug.c +++ b/tools/winedump/debug.c @@ -424,9 +424,9 @@ static void dump_codeview_headers(unsigned long base, unsigned long len) const struct {DWORD TimeStamp; DWORD Dunno; char Name[1];} *pdb_data; pdb_data = (const void *)(signature + 1); - printf(" TimeStamp: %08lX (%s)\n", + printf(" TimeStamp: %08X (%s)\n", pdb_data->TimeStamp, get_time_str(pdb_data->TimeStamp)); - printf(" Dunno: %08lX\n", pdb_data->Dunno); + printf(" Dunno: %08X\n", pdb_data->Dunno); printf(" Filename: %s\n", pdb_data->Name); return; } @@ -544,7 +544,7 @@ void dump_coff(unsigned long coffbase, unsigned long len, const void* pmt) */ nampnt = get_coff_name( coff_sym, coff_strtab ); - printf("%05d | %02d:%08lx [%08lx] | %s\n", i, coff_sym->SectionNumber - 1, coff_sym->Value - base, coff_sym->Value, nampnt); + printf("%05d | %02d:%08x [%08x] | %s\n", i, coff_sym->SectionNumber - 1, coff_sym->Value - base, coff_sym->Value, nampnt); i += naux; continue; } @@ -559,7 +559,7 @@ void dump_coff(unsigned long coffbase, unsigned long len, const void* pmt) /* FIXME: add code to find out the file this symbol belongs to, * see winedbg */ - printf("%05d | %02d:%08lx [%08lx] | %s\n", i, coff_sym->SectionNumber - 1, coff_sym->Value - base, coff_sym->Value, nampnt); + printf("%05d | %02d:%08x [%08x] | %s\n", i, coff_sym->SectionNumber - 1, coff_sym->Value - base, coff_sym->Value, nampnt); i += naux; continue; } diff --git a/tools/winedump/le.c b/tools/winedump/le.c index 623abe57421..6fd26462dbf 100644 --- a/tools/winedump/le.c +++ b/tools/winedump/le.c @@ -96,7 +96,7 @@ static void dump_le_header( const IMAGE_VXD_HEADER *le ) le->e32_border == 0 ? "little-indian" : "big-endian"); printf( " Word order: %s\n", le->e32_worder == 0 ? "little-indian" : "big-endian"); - printf( " Executable format level: %ld\n", + printf( " Executable format level: %d\n", le->e32_level); printf( " CPU type: %s\n", le->e32_cpu == 0x01 ? "Intel 80286" : @@ -115,9 +115,9 @@ static void dump_le_header( const IMAGE_VXD_HEADER *le ) le->e32_os == 0x03 ? "DOS 4.x" : le->e32_os == 0x04 ? "Windows 386" : "Unknown"); - printf( " Module version: %ld\n", + printf( " Module version: %d\n", le->e32_ver); - printf( " Module type flags: %08lx\n", + printf( " Module type flags: %08x\n", le->e32_mflags); if (le->e32_mflags & 0x8000) { @@ -140,85 +140,85 @@ static void dump_le_header( const IMAGE_VXD_HEADER *le ) if (le->e32_mflags & 0x8000) printf( " Module is DLL\n"); } - printf( " Number of memory pages: %ld\n", + printf( " Number of memory pages: %d\n", le->e32_mpages); - printf( " Initial object CS number: %08lx\n", + printf( " Initial object CS number: %08x\n", le->e32_startobj); - printf( " Initial EIP: %08lx\n", + printf( " Initial EIP: %08x\n", le->e32_eip); - printf( " Initial object SS number: %08lx\n", + printf( " Initial object SS number: %08x\n", le->e32_stackobj); - printf( " Initial ESP: %08lx\n", + printf( " Initial ESP: %08x\n", le->e32_esp); - printf( " Memory page size: %ld\n", + printf( " Memory page size: %d\n", le->e32_pagesize); - printf( " Bytes on last page: %ld\n", + printf( " Bytes on last page: %d\n", le->e32_lastpagesize); - printf( " Fix-up section size: %ld\n", + printf( " Fix-up section size: %d\n", le->e32_fixupsize); - printf( " Fix-up section checksum: %08lx\n", + printf( " Fix-up section checksum: %08x\n", le->e32_fixupsum); - printf( " Loader section size: %ld\n", + printf( " Loader section size: %d\n", le->e32_ldrsize); - printf( " Loader section checksum: %08lx\n", + printf( " Loader section checksum: %08x\n", le->e32_ldrsum); - printf( " Offset of object table: %08lx\n", + printf( " Offset of object table: %08x\n", le->e32_objtab); - printf( " Object table entries: %ld\n", + printf( " Object table entries: %d\n", le->e32_objcnt); - printf( " Object page map offset: %08lx\n", + printf( " Object page map offset: %08x\n", le->e32_objmap); - printf( " Object iterate data map offset: %08lx\n", + printf( " Object iterate data map offset: %08x\n", le->e32_itermap); - printf( " Resource table offset: %08lx\n", + printf( " Resource table offset: %08x\n", le->e32_rsrctab); - printf( " Resource table entries: %ld\n", + printf( " Resource table entries: %d\n", le->e32_rsrccnt); - printf( " Resident names table offset: %08lx\n", + printf( " Resident names table offset: %08x\n", le->e32_restab); - printf( " Entry table offset: %08lx\n", + printf( " Entry table offset: %08x\n", le->e32_enttab); - printf( " Module directives table offset: %08lx\n", + printf( " Module directives table offset: %08x\n", le->e32_dirtab); - printf( " Module directives entries: %ld\n", + printf( " Module directives entries: %d\n", le->e32_dircnt); - printf( " Fix-up page table offset: %08lx\n", + printf( " Fix-up page table offset: %08x\n", le->e32_fpagetab); - printf( " Fix-up record table offset: %08lx\n", + printf( " Fix-up record table offset: %08x\n", le->e32_frectab); - printf( " Imported modules name table offset: %08lx\n", + printf( " Imported modules name table offset: %08x\n", le->e32_impmod); - printf( " Imported modules count: %ld\n", + printf( " Imported modules count: %d\n", le->e32_impmodcnt); - printf( " Imported procedure name table offset: %08lx\n", + printf( " Imported procedure name table offset: %08x\n", le->e32_impproc); - printf( " Per-page checksum table offset: %08lx\n", + printf( " Per-page checksum table offset: %08x\n", le->e32_pagesum); - printf( " Data pages offset from top of table: %08lx\n", + printf( " Data pages offset from top of table: %08x\n", le->e32_datapage); - printf( " Preload page count: %08lx\n", + printf( " Preload page count: %08x\n", le->e32_preload); - printf( " Non-resident names table offset: %08lx\n", + printf( " Non-resident names table offset: %08x\n", le->e32_nrestab); - printf( " Non-resident names table length: %ld\n", + printf( " Non-resident names table length: %d\n", le->e32_cbnrestab); - printf( " Non-resident names table checksum: %08lx\n", + printf( " Non-resident names table checksum: %08x\n", le->e32_nressum); - printf( " Automatic data object: %08lx\n", + printf( " Automatic data object: %08x\n", le->e32_autodata); - printf( " Debug information offset: %08lx\n", + printf( " Debug information offset: %08x\n", le->e32_debuginfo); - printf( " Debug information length: %ld\n", + printf( " Debug information length: %d\n", le->e32_debuglen); - printf( " Preload instance pages number: %ld\n", + printf( " Preload instance pages number: %d\n", le->e32_instpreload); - printf( " Demand instance pages number: %ld\n", + printf( " Demand instance pages number: %d\n", le->e32_instdemand); - printf( " Extra heap allocation: %ld\n", + printf( " Extra heap allocation: %d\n", le->e32_heapsize); - printf( " VxD resource table offset: %08lx\n", + printf( " VxD resource table offset: %08x\n", le->e32_winresoff); - printf( " Size of VxD resource table: %ld\n", + printf( " Size of VxD resource table: %d\n", le->e32_winreslen); printf( " VxD identifier: %x\n", le->e32_devid); diff --git a/tools/winedump/lnk.c b/tools/winedump/lnk.c index 236415b4fb8..d779dd211b6 100644 --- a/tools/winedump/lnk.c +++ b/tools/winedump/lnk.c @@ -266,17 +266,17 @@ static int dump_location(int fd) printf("Location\n"); printf("--------\n\n"); - printf("Total size = %ld\n", loc->dwTotalSize); - printf("Header size = %ld\n", loc->dwHeaderSize); - printf("Flags = %08lx\n", loc->dwFlags); + printf("Total size = %d\n", loc->dwTotalSize); + printf("Header size = %d\n", loc->dwHeaderSize); + printf("Flags = %08x\n", loc->dwFlags); /* dump out information about the volume the link points to */ - printf("Volume ofs = %08lx ", loc->dwVolTableOfs); + printf("Volume ofs = %08x ", loc->dwVolTableOfs); if (loc->dwVolTableOfs && (loc->dwVolTableOfsdwTotalSize)) { LOCAL_VOLUME_INFO *vol = (LOCAL_VOLUME_INFO *) &p[loc->dwVolTableOfs]; - printf("size %ld type %ld serial %08lx label %ld ", + printf("size %d type %d serial %08x label %d ", vol->dwSize, vol->dwType, vol->dwVolSerial, vol->dwVolLabelOfs); if(vol->dwVolLabelOfs) printf("(\"%s\")", &p[loc->dwVolTableOfs + vol->dwVolLabelOfs]); @@ -284,13 +284,13 @@ static int dump_location(int fd) printf("\n"); /* dump out the path the link points to */ - printf("LocalPath ofs = %08lx ", loc->dwLocalPathOfs); + printf("LocalPath ofs = %08x ", loc->dwLocalPathOfs); if( loc->dwLocalPathOfs && (loc->dwLocalPathOfs < loc->dwTotalSize) ) printf("(\"%s\")", &p[loc->dwLocalPathOfs]); printf("\n"); - printf("Net Path ofs = %08lx\n", loc->dwNetworkVolTableOfs); - printf("Final Path = %08lx ", loc->dwFinalPathOfs); + printf("Net Path ofs = %08x\n", loc->dwNetworkVolTableOfs); + printf("Final Path = %08x ", loc->dwFinalPathOfs); if( loc->dwFinalPathOfs && (loc->dwFinalPathOfs < loc->dwTotalSize) ) printf("(\"%s\")", &p[loc->dwFinalPathOfs]); printf("\n"); @@ -348,7 +348,7 @@ static int dump_advertise_info(int fd, const char *type) printf("Advertise Info\n"); printf("--------------\n\n"); - printf("magic = %lx\n", avt->magic); + printf("magic = %x\n", avt->magic); printf("%s = %s\n", type, avt->bufA); if (avt->magic == 0xa0000006) { @@ -402,19 +402,19 @@ static int dump_lnk_fd(int fd) printf("Header\n"); printf("------\n\n"); - printf("Size: %04lx\n", hdr->dwSize); + printf("Size: %04x\n", hdr->dwSize); printf("GUID: %s\n", guid); - printf("FileAttr: %08lx\n", hdr->dwFileAttr); - printf("FileLength: %08lx\n", hdr->dwFileLength); - printf("nIcon: %ld\n", hdr->nIcon); - printf("Startup: %ld\n", hdr->fStartup); - printf("HotKey: %08lx\n", hdr->wHotKey); - printf("Unknown5: %08lx\n", hdr->Unknown5); - printf("Unknown6: %08lx\n", hdr->Unknown6); + printf("FileAttr: %08x\n", hdr->dwFileAttr); + printf("FileLength: %08x\n", hdr->dwFileLength); + printf("nIcon: %d\n", hdr->nIcon); + printf("Startup: %d\n", hdr->fStartup); + printf("HotKey: %08x\n", hdr->wHotKey); + printf("Unknown5: %08x\n", hdr->Unknown5); + printf("Unknown6: %08x\n", hdr->Unknown6); /* dump out all the flags */ - printf("Flags: %04lx ( ", hdr->dwFlags); + printf("Flags: %04x ( ", hdr->dwFlags); #define FLAG(x) if(hdr->dwFlags & SCF_##x) printf("%s ",#x); FLAG(PIDL) FLAG(LOCATION) @@ -429,7 +429,7 @@ static int dump_lnk_fd(int fd) #undef FLAG printf(")\n"); - printf("Length: %04lx\n", hdr->dwFileLength); + printf("Length: %04x\n", hdr->dwFileLength); printf("\n"); if (hdr->dwFlags & SCF_PIDL) diff --git a/tools/winedump/minidump.c b/tools/winedump/minidump.c index f1c08d91c5f..d070c21a3e0 100644 --- a/tools/winedump/minidump.c +++ b/tools/winedump/minidump.c @@ -72,20 +72,20 @@ void mdmp_dump(void) return; } - printf("Signature: %lu (%.4s)\n", hdr->Signature, (const char*)&hdr->Signature); - printf("Version: %lx\n", hdr->Version); - printf("NumberOfStreams: %lu\n", hdr->NumberOfStreams); - printf("StreamDirectoryRva: %lu\n", hdr->StreamDirectoryRva); - printf("CheckSum: %lu\n", hdr->CheckSum); + printf("Signature: %u (%.4s)\n", hdr->Signature, (const char*)&hdr->Signature); + printf("Version: %x\n", hdr->Version); + printf("NumberOfStreams: %u\n", hdr->NumberOfStreams); + printf("StreamDirectoryRva: %u\n", hdr->StreamDirectoryRva); + printf("CheckSum: %u\n", hdr->CheckSum); printf("TimeDateStamp: %s\n", get_time_str(hdr->u.TimeDateStamp)); - printf("Flags: %lx%08lx\n", (DWORD)(hdr->Flags >> 32), (DWORD)hdr->Flags); + printf("Flags: %x%08x\n", (DWORD)(hdr->Flags >> 32), (DWORD)hdr->Flags); for (idx = 0; idx <= LastReservedStream; idx++) { if (!(dir = get_mdmp_dir(hdr, idx))) continue; stream = PRD(dir->Location.Rva, dir->Location.DataSize); - printf("Directory [%lu]: ", ndir++); + printf("Directory [%u]: ", ndir++); switch (dir->StreamType) { case ThreadListStream: @@ -94,16 +94,16 @@ void mdmp_dump(void) const MINIDUMP_THREAD* mt = &mtl->Threads[0]; unsigned int i; - printf("Threads: %lu\n", mtl->NumberOfThreads); + printf("Threads: %u\n", mtl->NumberOfThreads); for (i = 0; i < mtl->NumberOfThreads; i++, mt++) { printf(" Thread: #%d\n", i); - printf(" ThreadId: %lu\n", mt->ThreadId); - printf(" SuspendCount: %lu\n", mt->SuspendCount); - printf(" PriorityClass: %lu\n", mt->PriorityClass); - printf(" Priority: %lu\n", mt->Priority); - printf(" Teb: 0x%lx%08lx\n", (DWORD)(mt->Teb >> 32), (DWORD)mt->Teb); - printf(" Stack: 0x%lx%08lx-0x%lx%08lx\n", + printf(" ThreadId: %u\n", mt->ThreadId); + printf(" SuspendCount: %u\n", mt->SuspendCount); + printf(" PriorityClass: %u\n", mt->PriorityClass); + printf(" Priority: %u\n", mt->Priority); + printf(" Teb: 0x%x%08x\n", (DWORD)(mt->Teb >> 32), (DWORD)mt->Teb); + printf(" Stack: 0x%x%08x-0x%x%08x\n", (DWORD)(mt->Stack.StartOfMemoryRange >> 32), (DWORD)mt->Stack.StartOfMemoryRange, (DWORD)((mt->Stack.StartOfMemoryRange + mt->Stack.Memory.DataSize) >> 32), @@ -123,23 +123,23 @@ void mdmp_dump(void) const char* p1; const char* p2; - printf("Modules (%s): %lu\n", + printf("Modules (%s): %u\n", dir->StreamType == ModuleListStream ? "PE" : "ELF", mml->NumberOfModules); for (i = 0; i < mml->NumberOfModules; i++, mm++) { printf(" Module #%d:\n", i); - printf(" BaseOfImage: 0x%lx%08lx\n", + printf(" BaseOfImage: 0x%x%08x\n", (DWORD)(mm->BaseOfImage >> 32), (DWORD) mm->BaseOfImage); - printf(" SizeOfImage: %lu\n", mm->SizeOfImage); - printf(" CheckSum: %lu\n", mm->CheckSum); + printf(" SizeOfImage: %u\n", mm->SizeOfImage); + printf(" CheckSum: %u\n", mm->CheckSum); printf(" TimeDateStamp: %s\n", get_time_str(mm->TimeDateStamp)); printf(" ModuleName: "); dump_mdmp_string(mm->ModuleNameRva); printf("\n"); printf(" VersionInfo:\n"); - printf(" dwSignature: %lx\n", mm->VersionInfo.dwSignature); - printf(" dwStrucVersion: %lx\n", + printf(" dwSignature: %x\n", mm->VersionInfo.dwSignature); + printf(" dwStrucVersion: %x\n", mm->VersionInfo.dwStrucVersion); printf(" dwFileVersion: %d,%d,%d,%d\n", HIWORD(mm->VersionInfo.dwFileVersionMS), @@ -151,7 +151,7 @@ void mdmp_dump(void) LOWORD(mm->VersionInfo.dwProductVersionMS), HIWORD(mm->VersionInfo.dwProductVersionLS), LOWORD(mm->VersionInfo.dwProductVersionLS)); - printf(" dwFileFlagsMask: %lu\n", + printf(" dwFileFlagsMask: %u\n", mm->VersionInfo.dwFileFlagsMask); printf(" dwFileFlags: %s%s%s%s%s%s\n", mm->VersionInfo.dwFileFlags & VS_FF_DEBUG ? "Debug " : "", @@ -195,17 +195,17 @@ void mdmp_dump(void) default: p1 = "---"; break; } printf(" dwFileType: %s\n", p1); - printf(" dwFileSubtype: %lu\n", + printf(" dwFileSubtype: %u\n", mm->VersionInfo.dwFileSubtype); - printf(" dwFileDate: %lx%08lx\n", + printf(" dwFileDate: %x%08x\n", mm->VersionInfo.dwFileDateMS, mm->VersionInfo.dwFileDateLS); - printf(" CvRecord: <%lu>\n", mm->CvRecord.DataSize); + printf(" CvRecord: <%u>\n", mm->CvRecord.DataSize); dump_mdmp_data(&mm->CvRecord, " "); - printf(" MiscRecord: <%lu>\n", mm->MiscRecord.DataSize); + printf(" MiscRecord: <%u>\n", mm->MiscRecord.DataSize); dump_mdmp_data(&mm->MiscRecord, " "); - printf(" Reserved0: 0x%lx%08lx\n", + printf(" Reserved0: 0x%x%08x\n", (DWORD)(mm->Reserved0 >> 32), (DWORD)mm->Reserved0); - printf(" Reserved1: 0x%lx%08lx\n", + printf(" Reserved1: 0x%x%08x\n", (DWORD)(mm->Reserved1 >> 32), (DWORD)mm->Reserved1); } } @@ -216,11 +216,11 @@ void mdmp_dump(void) const MINIDUMP_MEMORY_DESCRIPTOR* mmd = &mml->MemoryRanges[0]; unsigned int i; - printf("Memory Ranges: %lu\n", mml->NumberOfMemoryRanges); + printf("Memory Ranges: %u\n", mml->NumberOfMemoryRanges); for (i = 0; i < mml->NumberOfMemoryRanges; i++, mmd++) { printf(" Memory Range #%d:\n", i); - printf(" Range: 0x%lx%08lx-0x%lx%08lx\n", + printf(" Range: 0x%x%08x-0x%x%08x\n", (DWORD)(mmd->StartOfMemoryRange >> 32), (DWORD)mmd->StartOfMemoryRange, (DWORD)((mmd->StartOfMemoryRange + mmd->Memory.DataSize) >> 32), @@ -305,21 +305,21 @@ void mdmp_dump(void) break; default: str = "???"; break; } - printf(" Version: Windows %s (%lu)\n", str, msi->BuildNumber); - printf(" PlatformId: %lu\n", msi->PlatformId); + printf(" Version: Windows %s (%u)\n", str, msi->BuildNumber); + printf(" PlatformId: %u\n", msi->PlatformId); printf(" CSD: "); dump_mdmp_string(msi->CSDVersionRva); printf("\n"); - printf(" Reserved1: %lu\n", msi->u1.Reserved1); + printf(" Reserved1: %u\n", msi->u1.Reserved1); if (msi->ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { printf(" x86.VendorId: %.12s\n", (const char*)&msi->Cpu.X86CpuInfo.VendorId[0]); - printf(" x86.VersionInformation: %lx\n", + printf(" x86.VersionInformation: %x\n", msi->Cpu.X86CpuInfo.VersionInformation); - printf(" x86.FeatureInformation: %lx\n", + printf(" x86.FeatureInformation: %x\n", msi->Cpu.X86CpuInfo.FeatureInformation); - printf(" x86.AMDExtendedCpuFeatures: %lu\n", + printf(" x86.AMDExtendedCpuFeatures: %u\n", msi->Cpu.X86CpuInfo.AMDExtendedCpuFeatures); } } @@ -329,17 +329,17 @@ void mdmp_dump(void) const MINIDUMP_MISC_INFO* mmi = (const MINIDUMP_MISC_INFO*)stream; printf("Misc Information\n"); - printf(" Size: %lu\n", mmi->SizeOfInfo); + printf(" Size: %u\n", mmi->SizeOfInfo); printf(" Flags: %s%s\n", mmi->Flags1 & MINIDUMP_MISC1_PROCESS_ID ? "ProcessId " : "", mmi->Flags1 & MINIDUMP_MISC1_PROCESS_TIMES ? "ProcessTimes " : ""); if (mmi->Flags1 & MINIDUMP_MISC1_PROCESS_ID) - printf(" ProcessId: %lu\n", mmi->ProcessId); + printf(" ProcessId: %u\n", mmi->ProcessId); if (mmi->Flags1 & MINIDUMP_MISC1_PROCESS_TIMES) { - printf(" ProcessCreateTime: %lu\n", mmi->ProcessCreateTime); - printf(" ProcessUserTime: %lu\n", mmi->ProcessUserTime); - printf(" ProcessKernelTime: %lu\n", mmi->ProcessKernelTime); + printf(" ProcessCreateTime: %u\n", mmi->ProcessCreateTime); + printf(" ProcessUserTime: %u\n", mmi->ProcessUserTime); + printf(" ProcessKernelTime: %u\n", mmi->ProcessKernelTime); } } break; @@ -349,21 +349,21 @@ void mdmp_dump(void) unsigned int i; printf("Exception:\n"); - printf(" ThreadId: %08lx\n", mes->ThreadId); + printf(" ThreadId: %08x\n", mes->ThreadId); printf(" ExceptionRecord:\n"); - printf(" ExceptionCode: %lu\n", mes->ExceptionRecord.ExceptionCode); - printf(" ExceptionFlags: %lu\n", mes->ExceptionRecord.ExceptionFlags); - printf(" ExceptionRecord: 0x%lx%08lx\n", + printf(" ExceptionCode: %u\n", mes->ExceptionRecord.ExceptionCode); + printf(" ExceptionFlags: %u\n", mes->ExceptionRecord.ExceptionFlags); + printf(" ExceptionRecord: 0x%x%08x\n", (DWORD)(mes->ExceptionRecord.ExceptionRecord >> 32), (DWORD)mes->ExceptionRecord.ExceptionRecord); - printf(" ExceptionAddress: 0x%lx%08lx\n", + printf(" ExceptionAddress: 0x%x%08x\n", (DWORD)(mes->ExceptionRecord.ExceptionAddress >> 32), (DWORD)(mes->ExceptionRecord.ExceptionAddress)); - printf(" ExceptionNumberParameters: %lu\n", + printf(" ExceptionNumberParameters: %u\n", mes->ExceptionRecord.NumberParameters); for (i = 0; i < mes->ExceptionRecord.NumberParameters; i++) { - printf(" [%d]: 0x%lx%08lx\n", i, + printf(" [%d]: 0x%x%08x\n", i, (DWORD)(mes->ExceptionRecord.ExceptionInformation[i] >> 32), (DWORD)mes->ExceptionRecord.ExceptionInformation[i]); } @@ -373,9 +373,9 @@ void mdmp_dump(void) break; default: - printf("NIY %ld\n", dir->StreamType); - printf(" RVA: %lu\n", dir->Location.Rva); - printf(" Size: %lu\n", dir->Location.DataSize); + printf("NIY %d\n", dir->StreamType); + printf(" RVA: %u\n", dir->Location.Rva); + printf(" Size: %u\n", dir->Location.DataSize); dump_mdmp_data(&dir->Location, " "); break; } diff --git a/tools/winedump/ne.c b/tools/winedump/ne.c index b05ad7c9cb8..a9446e84188 100644 --- a/tools/winedump/ne.c +++ b/tools/winedump/ne.c @@ -73,7 +73,7 @@ static void dump_ne_header( const IMAGE_OS2_HEADER *ne ) printf( "File header:\n" ); 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( "Checksum: %08lx\n", ne->ne_crc ); + printf( "Checksum: %08x\n", ne->ne_crc ); printf( "Flags: %04x\n", ne->ne_flags ); printf( "Auto data segment: %x\n", ne->ne_autodata ); printf( "Heap size: %d bytes\n", ne->ne_heap ); @@ -87,7 +87,7 @@ static void dump_ne_header( const IMAGE_OS2_HEADER *ne ) printf( "Resident name table: %x\n", ne->ne_restab ); printf( "Module table: %x\n", ne->ne_modtab ); printf( "Import table: %x\n", ne->ne_imptab ); - printf( "Non-resident table: %lx\n", ne->ne_nrestab ); + printf( "Non-resident table: %x\n", ne->ne_nrestab ); printf( "Exe type: %x\n", ne->ne_exetyp ); printf( "Other flags: %x\n", ne->ne_flagsothers ); printf( "Fast load area: %x-%x\n", ne->ne_pretthunks << ne->ne_align, diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index 22b243ef2dd..cf1c86450e7 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -159,7 +159,7 @@ static inline void print_word(const char *title, WORD value) static inline void print_dword(const char *title, DWORD value) { - printf(" %-34s 0x%-8lx %lu\n", title, value, value); + printf(" %-34s 0x%-8x %u\n", title, value, value); } static inline void print_longlong(const char *title, ULONGLONG value) @@ -208,11 +208,11 @@ static inline void print_datadirectory(DWORD n, const IMAGE_DATA_DIRECTORY *dire { unsigned i; printf("Data Directory\n"); - printf("%ld\n", n * sizeof(IMAGE_DATA_DIRECTORY)); + printf("%d\n", n * sizeof(IMAGE_DATA_DIRECTORY)); for (i = 0; i < n && i < 16; i++) { - printf(" %-12s rva: 0x%-8lX size: %8lu\n", + printf(" %-12s rva: 0x%-8X size: %8u\n", DirectoryNames[i], directory[i].VirtualAddress, directory[i].Size); } @@ -299,11 +299,11 @@ static void dump_pe_header(void) printf(" Machine: %04X (%s)\n", fileHeader->Machine, get_machine_str(fileHeader->Machine)); printf(" Number of Sections: %d\n", fileHeader->NumberOfSections); - printf(" TimeDateStamp: %08lX (%s) offset %lu\n", + printf(" TimeDateStamp: %08X (%s) offset %lu\n", fileHeader->TimeDateStamp, get_time_str(fileHeader->TimeDateStamp), Offset(&(fileHeader->TimeDateStamp))); - printf(" PointerToSymbolTable: %08lX\n", fileHeader->PointerToSymbolTable); - printf(" NumberOfSymbols: %08lX\n", fileHeader->NumberOfSymbols); + printf(" PointerToSymbolTable: %08X\n", fileHeader->PointerToSymbolTable); + printf(" NumberOfSymbols: %08X\n", fileHeader->NumberOfSymbols); printf(" SizeOfOptionalHeader: %04X\n", fileHeader->SizeOfOptionalHeader); printf(" Characteristics: %04X\n", fileHeader->Characteristics); #define X(f,s) if (fileHeader->Characteristics & f) printf(" %s\n", s) @@ -350,16 +350,16 @@ static void dump_sections(const void* addr, unsigned num_sect) printf("Section Table\n"); for (i = 0; i < num_sect; i++, sectHead++) { - printf(" %02d %-8.8s VirtSize: %-8lu VirtAddr: %-8lu 0x%08lx\n", + printf(" %02d %-8.8s VirtSize: %-8u VirtAddr: %-8u 0x%08x\n", i + 1, sectHead->Name, sectHead->Misc.VirtualSize, sectHead->VirtualAddress, sectHead->VirtualAddress); - printf(" raw data offs: %-8lu raw data size: %-8lu\n", + printf(" raw data offs: %-8u raw data size: %-8u\n", sectHead->PointerToRawData, sectHead->SizeOfRawData); - printf(" relocation offs: %-8lu relocations: %-8u\n", + printf(" relocation offs: %-8u relocations: %-8u\n", sectHead->PointerToRelocations, sectHead->NumberOfRelocations); - printf(" line # offs: %-8lu line #'s: %-8u\n", + printf(" line # offs: %-8u line #'s: %-8u\n", sectHead->PointerToLinenumbers, sectHead->NumberOfLinenumbers); - printf(" characteristics: 0x%08lx\n", sectHead->Characteristics); + printf(" characteristics: 0x%08x\n", sectHead->Characteristics); printf(" "); #define X(b,s) if (sectHead->Characteristics & b) printf(s " ") /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */ @@ -429,16 +429,16 @@ static void dump_dir_exported_functions(void) printf("Exports table:\n"); printf("\n"); printf(" Name: %s\n", (const char*)RVA(exportDir->Name, sizeof(DWORD))); - printf(" Characteristics: %08lx\n", exportDir->Characteristics); - printf(" TimeDateStamp: %08lX %s\n", + printf(" Characteristics: %08x\n", exportDir->Characteristics); + printf(" TimeDateStamp: %08X %s\n", exportDir->TimeDateStamp, get_time_str(exportDir->TimeDateStamp)); printf(" Version: %u.%02u\n", exportDir->MajorVersion, exportDir->MinorVersion); - printf(" Ordinal base: %lu\n", exportDir->Base); - printf(" # of functions: %lu\n", exportDir->NumberOfFunctions); - printf(" # of Names: %lu\n", exportDir->NumberOfNames); - printf("Addresses of functions: %08lX\n", exportDir->AddressOfFunctions); - printf("Addresses of name ordinals: %08lX\n", exportDir->AddressOfNameOrdinals); - printf("Addresses of names: %08lX\n", exportDir->AddressOfNames); + printf(" Ordinal base: %u\n", exportDir->Base); + printf(" # of functions: %u\n", exportDir->NumberOfFunctions); + printf(" # of Names: %u\n", exportDir->NumberOfNames); + printf("Addresses of functions: %08X\n", exportDir->AddressOfFunctions); + printf("Addresses of name ordinals: %08X\n", exportDir->AddressOfNameOrdinals); + printf("Addresses of names: %08X\n", exportDir->AddressOfNames); printf("\n"); printf(" Entry Pt Ordn Name\n"); @@ -462,7 +462,7 @@ static void dump_dir_exported_functions(void) name = (const char*)RVA(*pName, sizeof(DWORD)); if (name && globals.do_demangle) { - printf(" %08lX %4lu ", pFunc[*pOrdl], exportDir->Base + *pOrdl); + printf(" %08X %4u ", pFunc[*pOrdl], exportDir->Base + *pOrdl); symbol_init(&symbol, name); if (symbol_demangle(&symbol) == -1) @@ -475,7 +475,7 @@ static void dump_dir_exported_functions(void) } else { - printf(" %08lX %4lu %s", pFunc[*pOrdl], exportDir->Base + *pOrdl, name); + printf(" %08X %4u %s", pFunc[*pOrdl], exportDir->Base + *pOrdl, name); } /* check for forwarded function */ if ((const char *)RVA(pFunc[*pOrdl],sizeof(void*)) >= (const char *)exportDir && @@ -489,7 +489,7 @@ static void dump_dir_exported_functions(void) { if (pFunc[i] && !(map[i / 32] & (1 << (i % 32)))) { - printf(" %08lX %4lu \n", pFunc[i], exportDir->Base + i); + printf(" %08X %4u \n", pFunc[i], exportDir->Base + i); } } free(map); @@ -503,14 +503,14 @@ static void dump_image_thunk_data64(const IMAGE_THUNK_DATA64 *il) for (; il->u1.Ordinal; il++) { if (IMAGE_SNAP_BY_ORDINAL64(il->u1.Ordinal)) - printf(" %4lu \n", (DWORD)IMAGE_ORDINAL64(il->u1.Ordinal)); + printf(" %4u \n", (DWORD)IMAGE_ORDINAL64(il->u1.Ordinal)); else { iibn = RVA((DWORD)il->u1.AddressOfData, sizeof(DWORD)); if (!iibn) printf("Can't grab import by name info, skipping to next ordinal\n"); else - printf(" %4u %s %lx\n", iibn->Hint, iibn->Name, (DWORD)il->u1.AddressOfData); + printf(" %4u %s %x\n", iibn->Hint, iibn->Name, (DWORD)il->u1.AddressOfData); } } } @@ -521,14 +521,14 @@ static void dump_image_thunk_data32(const IMAGE_THUNK_DATA32 *il) for (; il->u1.Ordinal; il++) { if (IMAGE_SNAP_BY_ORDINAL32(il->u1.Ordinal)) - printf(" %4lu \n", IMAGE_ORDINAL32(il->u1.Ordinal)); + printf(" %4u \n", IMAGE_ORDINAL32(il->u1.Ordinal)); else { iibn = RVA((DWORD)il->u1.AddressOfData, sizeof(DWORD)); if (!iibn) printf("Can't grab import by name info, skipping to next ordinal\n"); else - printf(" %4u %s %lx\n", iibn->Hint, iibn->Name, (DWORD)il->u1.AddressOfData); + printf(" %4u %s %x\n", iibn->Hint, iibn->Name, (DWORD)il->u1.AddressOfData); } } } @@ -550,7 +550,7 @@ static void dump_dir_imported_functions(void) directorySize = opt->DataDirectory[IMAGE_FILE_IMPORT_DIRECTORY].Size; } - printf("Import Table size: %08lx\n", directorySize);/* FIXME */ + printf("Import Table size: %08x\n", directorySize);/* FIXME */ for (;;) { @@ -559,11 +559,11 @@ static void dump_dir_imported_functions(void) if (!importDesc->Name || !importDesc->FirstThunk) break; printf(" offset %08lx %s\n", Offset(importDesc), (const char*)RVA(importDesc->Name, sizeof(DWORD))); - printf(" Hint/Name Table: %08lX\n", (DWORD)importDesc->u.OriginalFirstThunk); - printf(" TimeDataStamp: %08lX (%s)\n", + printf(" Hint/Name Table: %08X\n", (DWORD)importDesc->u.OriginalFirstThunk); + printf(" TimeDataStamp: %08X (%s)\n", importDesc->TimeDateStamp, get_time_str(importDesc->TimeDateStamp)); - printf(" ForwarderChain: %08lX\n", importDesc->ForwarderChain); - printf(" First thunk RVA: %08lX\n", (DWORD)importDesc->FirstThunk); + printf(" ForwarderChain: %08X\n", importDesc->ForwarderChain); + printf(" First thunk RVA: %08X\n", (DWORD)importDesc->FirstThunk); printf(" Ordn Name\n"); @@ -613,7 +613,7 @@ static void dump_dir_delay_imported_functions(void) directorySize = opt->DataDirectory[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT].Size; } - printf("Delay Import Table size: %08lx\n", directorySize); /* FIXME */ + printf("Delay Import Table size: %08x\n", directorySize); /* FIXME */ for (;;) { @@ -622,10 +622,10 @@ static void dump_dir_delay_imported_functions(void) if (!importDesc->szName || !importDesc->pIAT || !importDesc->pINT) break; - printf(" grAttrs %08lx offset %08lx %s\n", importDesc->grAttrs, Offset(importDesc), + printf(" grAttrs %08x offset %08lx %s\n", importDesc->grAttrs, Offset(importDesc), use_rva ? (const char *)RVA(importDesc->szName, sizeof(DWORD)) : (char *)importDesc->szName); - printf(" Hint/Name Table: %08lx\n", importDesc->pINT); - printf(" TimeDataStamp: %08lX (%s)\n", + printf(" Hint/Name Table: %08x\n", importDesc->pINT); + printf(" TimeDataStamp: %08X (%s)\n", importDesc->dwTimeStamp, get_time_str(importDesc->dwTimeStamp)); printf(" Ordn Name\n"); @@ -652,8 +652,8 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx) const char* str; printf("Directory %02u\n", idx + 1); - printf(" Characteristics: %08lX\n", idd->Characteristics); - printf(" TimeDateStamp: %08lX %s\n", + printf(" Characteristics: %08X\n", idd->Characteristics); + printf(" TimeDateStamp: %08X %s\n", idd->TimeDateStamp, get_time_str(idd->TimeDateStamp)); printf(" Version %u.%02u\n", idd->MajorVersion, idd->MinorVersion); switch (idd->Type) @@ -671,10 +671,10 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx) case IMAGE_DEBUG_TYPE_BORLAND: str = "BORLAND"; break; case IMAGE_DEBUG_TYPE_RESERVED10: str = "RESERVED10"; break; } - printf(" Type: %lu (%s)\n", idd->Type, str); - printf(" SizeOfData: %lu\n", idd->SizeOfData); - printf(" AddressOfRawData: %08lX\n", idd->AddressOfRawData); - printf(" PointerToRawData: %08lX\n", idd->PointerToRawData); + printf(" Type: %u (%s)\n", idd->Type, str); + printf(" SizeOfData: %u\n", idd->SizeOfData); + printf(" AddressOfRawData: %08X\n", idd->AddressOfRawData); + printf(" PointerToRawData: %08X\n", idd->PointerToRawData); switch (idd->Type) { @@ -694,10 +694,10 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx) { const IMAGE_DEBUG_MISC* misc = PRD(idd->PointerToRawData, idd->SizeOfData); if (!misc) {printf("Can't get misc debug information\n"); break;} - printf(" DataType: %lu (%s)\n", + printf(" DataType: %u (%s)\n", misc->DataType, (misc->DataType == IMAGE_DEBUG_MISC_EXENAME) ? "Exe name" : "Unknown"); - printf(" Length: %lu\n", misc->Length); + printf(" Length: %u\n", misc->Length); printf(" Unicode: %s\n", misc->Unicode ? "Yes" : "No"); printf(" Data: %s\n", misc->Data); } @@ -760,19 +760,19 @@ static void dump_dir_tls(void) /* FIXME: This does not properly handle large images */ printf( "Thread Local Storage\n" ); - printf( " Raw data %08lx-%08lx (data size %lx zero fill size %lx)\n", + printf( " Raw data %08x-%08x (data size %x zero fill size %x)\n", (DWORD)dir.StartAddressOfRawData, (DWORD)dir.EndAddressOfRawData, (DWORD)(dir.EndAddressOfRawData - dir.StartAddressOfRawData), (DWORD)dir.SizeOfZeroFill ); - printf( " Index address %08lx\n", (DWORD)dir.AddressOfIndex ); - printf( " Characteristics %08lx\n", dir.Characteristics ); - printf( " Callbacks %08lx -> {", (DWORD)dir.AddressOfCallBacks ); + printf( " Index address %08x\n", (DWORD)dir.AddressOfIndex ); + printf( " Characteristics %08x\n", dir.Characteristics ); + printf( " Callbacks %08x -> {", (DWORD)dir.AddressOfCallBacks ); if (dir.AddressOfCallBacks) { DWORD addr = (DWORD)dir.AddressOfCallBacks - PE_nt_headers->OptionalHeader.ImageBase; while ((callbacks = RVA(addr, sizeof(DWORD))) && *callbacks) { - printf( " %08lx", *callbacks ); + printf( " %08x", *callbacks ); addr += sizeof(DWORD); } } @@ -795,14 +795,14 @@ void dump_separate_dbg(void) printf ("Machine: 0x%04X (%s)\n", separateDebugHead->Machine, get_machine_str(separateDebugHead->Machine)); printf ("Characteristics: 0x%04X\n", separateDebugHead->Characteristics); - printf ("TimeDateStamp: 0x%08lX (%s)\n", + printf ("TimeDateStamp: 0x%08X (%s)\n", separateDebugHead->TimeDateStamp, get_time_str(separateDebugHead->TimeDateStamp)); - printf ("CheckSum: 0x%08lX\n", separateDebugHead->CheckSum); - printf ("ImageBase: 0x%08lX\n", separateDebugHead->ImageBase); - printf ("SizeOfImage: 0x%08lX\n", separateDebugHead->SizeOfImage); - printf ("NumberOfSections: 0x%08lX\n", separateDebugHead->NumberOfSections); - printf ("ExportedNamesSize: 0x%08lX\n", separateDebugHead->ExportedNamesSize); - printf ("DebugDirectorySize: 0x%08lX\n", separateDebugHead->DebugDirectorySize); + printf ("CheckSum: 0x%08X\n", separateDebugHead->CheckSum); + printf ("ImageBase: 0x%08X\n", separateDebugHead->ImageBase); + printf ("SizeOfImage: 0x%08X\n", separateDebugHead->SizeOfImage); + printf ("NumberOfSections: 0x%08X\n", separateDebugHead->NumberOfSections); + printf ("ExportedNamesSize: 0x%08X\n", separateDebugHead->ExportedNamesSize); + printf ("DebugDirectorySize: 0x%08X\n", separateDebugHead->DebugDirectorySize); if (!PRD(sizeof(IMAGE_SEPARATE_DEBUG_HEADER), separateDebugHead->NumberOfSections * sizeof(IMAGE_SECTION_HEADER))) @@ -1234,7 +1234,7 @@ static void do_grab_sym( enum FileSig sig, const void* pmt ) { char ordinal_text[256]; /* Ordinal only entry */ - snprintf (ordinal_text, sizeof(ordinal_text), "%s_%lu", + snprintf (ordinal_text, sizeof(ordinal_text), "%s_%u", globals.forward_dll ? globals.forward_dll : OUTPUT_UC_DLL_NAME, exportDir->Base + i); str_toupper(ordinal_text); @@ -1248,7 +1248,7 @@ static void do_grab_sym( enum FileSig sig, const void* pmt ) free(map); if (NORMAL) - printf("%lu named symbols in DLL, %lu total, %d unique (ordinal base = %ld)\n", + printf("%u named symbols in DLL, %u total, %d unique (ordinal base = %d)\n", exportDir->NumberOfNames, exportDir->NumberOfFunctions, j, exportDir->Base); qsort( dll_symbols, j, sizeof(dll_symbol), symbol_cmp );