From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/dbghelp_private.h | 4 ++-- dlls/dbghelp/elf_module.c | 2 +- dlls/dbghelp/macho_module.c | 2 +- dlls/dbghelp/path.c | 5 +++-- dlls/dbghelp/pe_module.c | 3 ++- dlls/dbghelp/tests/dbghelp.c | 2 -- 6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index a8ef5bfff84..96169ae1bf6 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -764,8 +764,8 @@ extern BOOL path_find_symbol_file(const struct process* pcs, const struc PCSTR full_path, enum module_type type, const GUID* guid, DWORD dw1, DWORD dw2, WCHAR *buffer, BOOL* is_unmatched) DECLSPEC_HIDDEN; extern WCHAR *get_dos_file_name(const WCHAR *filename) __WINE_DEALLOC(HeapFree, 3) __WINE_MALLOC DECLSPEC_HIDDEN; -extern BOOL search_dll_path(const struct process* process, const WCHAR *name, - BOOL (*match)(void*, HANDLE, const WCHAR*), void *param) DECLSPEC_HIDDEN; +extern BOOL search_dll_path(const struct process* process, const WCHAR *name, WORD machine, + BOOL (*match)(void*, HANDLE, const WCHAR*), void *param) DECLSPEC_HIDDEN; extern BOOL search_unix_path(const WCHAR *name, const WCHAR *path, BOOL (*match)(void*, HANDLE, const WCHAR*), void *param) DECLSPEC_HIDDEN; extern const WCHAR* file_name(const WCHAR* str) DECLSPEC_HIDDEN; extern const char* file_nameA(const char* str) DECLSPEC_HIDDEN; diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index bc063bf1466..1a38949a321 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -1445,7 +1445,7 @@ static BOOL elf_search_and_load_file(struct process* pcs, const WCHAR* filename, load_elf.elf_info = elf_info;
ret = search_unix_path(filename, process_getenv(pcs, L"LD_LIBRARY_PATH"), elf_load_file_cb, &load_elf) - || search_dll_path(pcs, filename, elf_load_file_cb, &load_elf); + || search_dll_path(pcs, filename, IMAGE_FILE_MACHINE_UNKNOWN, elf_load_file_cb, &load_elf); }
return ret; diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c index 4852f5beaa4..f1b3107408c 100644 --- a/dlls/dbghelp/macho_module.c +++ b/dlls/dbghelp/macho_module.c @@ -1583,7 +1583,7 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam ret = search_unix_path(p, fallback, macho_load_file_cb, &load_params); } if (!ret && p == filename) - ret = search_dll_path(pcs, filename, macho_load_file_cb, &load_params); + ret = search_dll_path(pcs, filename, IMAGE_FILE_MACHINE_UNKNOWN, macho_load_file_cb, &load_params);
return ret; } diff --git a/dlls/dbghelp/path.c b/dlls/dbghelp/path.c index d23a4b5733e..fe1da8849eb 100644 --- a/dlls/dbghelp/path.c +++ b/dlls/dbghelp/path.c @@ -722,7 +722,7 @@ static BOOL try_match_file(const WCHAR *name, BOOL (*match)(void*, HANDLE, const return FALSE; }
-BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*match)(void*, HANDLE, const WCHAR*), void *param) +BOOL search_dll_path(const struct process *process, const WCHAR *name, WORD machine, BOOL (*match)(void*, HANDLE, const WCHAR*), void *param) { const WCHAR *env; WCHAR *p, *end; @@ -733,7 +733,8 @@ BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL (*ma
name = file_name(name);
- cpu = process_get_cpu(process); + cpu = machine == IMAGE_FILE_MACHINE_UNKNOWN ? process_get_cpu(process) : cpu_find(machine); + for (machine_dir = all_machine_dir; machine_dir < all_machine_dir + ARRAY_SIZE(all_machine_dir); machine_dir++) if (machine_dir->machine == cpu->machine) break; if (machine_dir >= all_machine_dir + ARRAY_SIZE(all_machine_dir)) return FALSE; diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 3262f93db9c..7aeb1cf8901 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -824,7 +824,8 @@ struct module* pe_load_native_module(struct process* pcs, const WCHAR* name, if (pe_map_file(hFile, &modfmt->u.pe_info->fmap, DMT_PE)) { struct builtin_search builtin = { NULL }; - if (opened && modfmt->u.pe_info->fmap.u.pe.builtin && search_dll_path(pcs, loaded_name, search_builtin_pe, &builtin)) + if (opened && modfmt->u.pe_info->fmap.u.pe.builtin && + search_dll_path(pcs, loaded_name, modfmt->u.pe_info->fmap.u.pe.file_header.Machine, search_builtin_pe, &builtin)) { TRACE("reloaded %s from %s\n", debugstr_w(loaded_name), debugstr_w(builtin.path)); image_unmap_file(&modfmt->u.pe_info->fmap); diff --git a/dlls/dbghelp/tests/dbghelp.c b/dlls/dbghelp/tests/dbghelp.c index 7ea5be9c441..8b65ef68670 100644 --- a/dlls/dbghelp/tests/dbghelp.c +++ b/dlls/dbghelp/tests/dbghelp.c @@ -226,7 +226,6 @@ static void test_modules(void) ret = SymGetModuleInfoW64(GetCurrentProcess(), base2, &im); ok(ret, "SymGetModuleInfoW64 failed: %lu\n", GetLastError()); ok(im.BaseOfImage == base2, "Wrong base address\n"); - todo_wine_if(sizeof(void*) == 8) ok(im.MachineType == machines[1], "Wrong machine %lx\n", im.MachineType); } @@ -245,7 +244,6 @@ static void test_modules(void) ret = SymGetModuleInfoW64(GetCurrentProcess(), base2, &im); ok(ret, "SymGetModuleInfoW64 failed: %lu\n", GetLastError()); ok(im.BaseOfImage == base2, "Wrong base address\n"); - todo_wine_if(sizeof(void*) == 8) ok(im.MachineType == machines[1], "Wrong machine %lx\n", im.MachineType); }