From c1269392e0d1b73063ee9adde6058e2fffaff864 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Wed, 21 Feb 2007 21:56:22 +0100 Subject: [PATCH] dbghelp: Move elf_fetch_file_info to Unicode. --- dlls/dbghelp/dbghelp_private.h | 2 +- dlls/dbghelp/elf_module.c | 9 ++++++--- dlls/dbghelp/minidump.c | 4 +--- dlls/dbghelp/path.c | 24 +++++++++--------------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 733570295b1..fedde7edf77 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -418,7 +418,7 @@ extern void* fetch_buffer(struct process* pcs, unsigned size); #define ELF_NO_MAP ((const void*)0xffffffff) typedef BOOL (*elf_enum_modules_cb)(const WCHAR*, unsigned long addr, void* user); extern BOOL elf_enum_modules(HANDLE hProc, elf_enum_modules_cb, void*); -extern BOOL elf_fetch_file_info(const char* name, DWORD* base, DWORD* size, DWORD* checksum); +extern BOOL elf_fetch_file_info(const WCHAR* name, DWORD* base, DWORD* size, DWORD* checksum); struct elf_file_map; extern BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap); extern struct module* diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index f6f51174214..02b13dcda4f 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -1128,11 +1128,14 @@ BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap) * * Gathers some more information for an ELF module from a given file */ -BOOL elf_fetch_file_info(const char* name, DWORD* base, +BOOL elf_fetch_file_info(const WCHAR* name, DWORD* base, DWORD* size, DWORD* checksum) { struct elf_file_map fmap; - if (!elf_map_file(name, &fmap)) return FALSE; + char tmp[MAX_PATH]; + + WideCharToMultiByte(CP_UNIXCP, 0, name, -1, tmp, sizeof(tmp), 0, 0); + if (!elf_map_file(tmp, &fmap)) return FALSE; if (base) *base = fmap.elf_start; *size = fmap.elf_size; *checksum = calc_crc32(&fmap); @@ -1594,7 +1597,7 @@ BOOL elf_synchronize_module_list(struct process* pcs) return FALSE; } -BOOL elf_fetch_file_info(const char* name, DWORD* base, +BOOL elf_fetch_file_info(const WCHAR* name, DWORD* base, DWORD* size, DWORD* checksum) { return FALSE; diff --git a/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c index f51258056d6..7c3ec6fdb68 100644 --- a/dlls/dbghelp/minidump.c +++ b/dlls/dbghelp/minidump.c @@ -275,15 +275,13 @@ static BOOL fetch_elf_module_info_cb(const WCHAR* name, unsigned long base, { struct dump_context* dc = (struct dump_context*)user; DWORD rbase, size, checksum; - char tmp[MAX_PATH]; /* FIXME: there's no relevant timestamp on ELF modules */ /* NB: if we have a non-null base from the live-target use it (whenever * the ELF module is relocatable or not). If we have a null base (ELF * module isn't relocatable) then grab its base address from ELF file */ - WideCharToMultiByte(CP_UNIXCP, 0, name, -1, tmp, sizeof(tmp), 0, 0); - if (!elf_fetch_file_info(tmp, &rbase, &size, &checksum)) + if (!elf_fetch_file_info(name, &rbase, &size, &checksum)) size = checksum = 0; add_module(dc, name, base ? base : rbase, size, 0 /* FIXME */, checksum, TRUE); return TRUE; diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index 1bc59b70ee8..bd974376ae9 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -392,26 +392,20 @@ static BOOL CALLBACK sffip_cb(LPCWSTR buffer, void* user) } break; case DMT_ELF: + if (elf_fetch_file_info(buffer, 0, &size, &checksum)) { - char fn[MAX_PATH]; - - WideCharToMultiByte(CP_ACP, 0, buffer, -1, fn, MAX_PATH, NULL, NULL); - - if (elf_fetch_file_info(fn, 0, &size, &checksum)) + if (checksum != (DWORD_PTR)s->id) { - if (checksum != (DWORD_PTR)s->id) - { - WARN("Found %s, but wrong checksums: %08x %08lx\n", - debugstr_w(buffer), checksum, (DWORD_PTR)s->id); - return FALSE; - } - } - else - { - WARN("Couldn't read %s\n", debugstr_w(buffer)); + WARN("Found %s, but wrong checksums: %08x %08lx\n", + debugstr_w(buffer), checksum, (DWORD_PTR)s->id); return FALSE; } } + else + { + WARN("Couldn't read %s\n", debugstr_w(buffer)); + return FALSE; + } break; case DMT_PDB: {