dbghelp: Move elf_fetch_file_info to Unicode.

This commit is contained in:
Eric Pouech 2007-02-21 21:56:22 +01:00 committed by Alexandre Julliard
parent 039d54a4bf
commit c1269392e0
4 changed files with 17 additions and 22 deletions

View File

@ -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*

View File

@ -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;

View File

@ -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;

View File

@ -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:
{