From 109c6ae8d235fd3ae67802baefbb761e38043b60 Mon Sep 17 00:00:00 2001 From: Jason Green Date: Thu, 17 Jan 2008 15:57:12 -0500 Subject: [PATCH] Wrap TRACE strings using the debugstr() functions and update some type casting. From: Eric van Beurden (ericvb@transgaming.com) --- dlls/dbghelp/pe_module.c | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 6676f29..a1f0336 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -67,11 +67,13 @@ static BOOL pe_load_stabs(const struct process* pcs, struct module* module, { ret = stabs_parse(module, module->module.BaseOfImage - nth->OptionalHeader.ImageBase, - RtlImageRvaToVa(nth, (void*)mapping, stabs, NULL), + RtlImageRvaToVa(nth, (HMODULE)mapping, stabs, NULL), stabsize, - RtlImageRvaToVa(nth, (void*)mapping, stabstr, NULL), + RtlImageRvaToVa(nth, (HMODULE)mapping, stabstr, NULL), stabstrsize); } + + TRACE("%s the STABS debug info\n", ret ? "successfully loaded" : "failed to load"); return ret; } @@ -96,7 +98,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module, const IMAGE_DEBUG_DIRECTORY* dbg; BOOL ret = FALSE; - WINE_TRACE("Processing DBG file %s\n", dbg_name); + WINE_TRACE("Processing DBG file %s\n", debugstr_a(dbg_name)); if (SymFindFileInPath(pcs->handle, NULL, dbg_name, NULL, 0, 0, 0, tmp, dbg_match, NULL) && (hFile = CreateFileA(tmp, GENERIC_READ, FILE_SHARE_READ, NULL, @@ -108,7 +110,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module, if (hdr->TimeDateStamp != timestamp) { WINE_ERR("Warning - %s has incorrect internal timestamp\n", - dbg_name); + debugstr_a(dbg_name)); /* * Well, sometimes this happens to DBG files which ARE REALLY the * right .DBG files but nonetheless this check fails. Anyway, @@ -136,7 +138,7 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module, ERR("Wrong signature in .DBG file %s\n", debugstr_a(tmp)); } else - WINE_ERR("-Unable to peruse .DBG file %s (%s)\n", dbg_name, debugstr_a(tmp)); + WINE_ERR("-Unable to peruse .DBG file %s (%s)\n", debugstr_a(dbg_name), debugstr_a(tmp)); if (dbg_mapping) UnmapViewOfFile(dbg_mapping); if (hMap) CloseHandle(hMap); @@ -163,7 +165,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY); if (!nDbg) return FALSE; - dbg = RtlImageRvaToVa(nth, (void*)mapping, dir->VirtualAddress, NULL); + dbg = RtlImageRvaToVa(nth, (HMODULE)mapping, dir->VirtualAddress, NULL); /* Parse debug directory */ if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED) @@ -235,7 +237,7 @@ static BOOL pe_load_export_debug_info(const struct process* pcs, #endif /* Add exported functions */ - if ((exports = RtlImageDirectoryEntryToData((void*)mapping, FALSE, + if ((exports = RtlImageDirectoryEntryToData((HMODULE)mapping, FALSE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size))) { const WORD* ordinals = NULL; @@ -244,9 +246,9 @@ static BOOL pe_load_export_debug_info(const struct process* pcs, unsigned int j; char buffer[16]; - functions = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfFunctions, NULL); - ordinals = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfNameOrdinals, NULL); - names = RtlImageRvaToVa(nth, (void*)mapping, exports->AddressOfNames, NULL); + functions = RtlImageRvaToVa(nth, (HMODULE)mapping, exports->AddressOfFunctions, NULL); + ordinals = RtlImageRvaToVa(nth, (HMODULE)mapping, exports->AddressOfNameOrdinals, NULL); + names = RtlImageRvaToVa(nth, (HMODULE)mapping, exports->AddressOfNames, NULL); if (functions && ordinals && names) { @@ -297,7 +299,7 @@ BOOL pe_load_debug_info(const struct process* pcs, struct module* module) { if ((mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL) { - nth = RtlImageNtHeader(mapping); + nth = RtlImageNtHeader((HMODULE)mapping); if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY)) { @@ -352,7 +354,7 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, if ((mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL) { - IMAGE_NT_HEADERS* nth = RtlImageNtHeader(mapping); + IMAGE_NT_HEADERS* nth = RtlImageNtHeader((HMODULE)mapping); if (nth) { @@ -369,6 +371,8 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, else pe_load_debug_info(pcs, module); } + else + ERR("could not load the module '%s'\n", debugstr_w(loaded_name)); } UnmapViewOfFile(mapping); } -- 1.4.4.2