/*********************************************************************** * SymLoadModule (DBGHELP.@) */ DWORD WINAPI SymLoadModule(HANDLE hProcess, HANDLE hFile, const char* ImageName, const char* ModuleName, DWORD BaseOfDll, DWORD SizeOfDll) { struct process* pcs; struct module* module = NULL; TRACE("(%p %p %s %s %08lx %08lx)\n", hProcess, hFile, debugstr_a(ImageName), debugstr_a(ModuleName), BaseOfDll, SizeOfDll); pcs = process_find_by_handle(hProcess); if (!pcs) return FALSE; /* force transparent ELF loading / unloading */ elf_synchronize_module_list(pcs); /* this is a Wine extension to the API just to redo the synchronisation */ if (!ImageName && !hFile) return 0; if (module_is_elf_container_loaded(pcs, ImageName, ModuleName)) { /* force the loading of DLL as builtin */ if ((module = pe_load_module_from_pcs(pcs, ImageName, ModuleName, BaseOfDll, SizeOfDll))) goto done; WARN("Couldn't locate %s\n", ImageName); return 0; } TRACE("Assuming %s as native DLL\n", ImageName); if (!(module = pe_load_module(pcs, ImageName, hFile, BaseOfDll, SizeOfDll))) { if (module_get_type_by_name(ImageName) == DMT_ELF && (module = elf_load_module(pcs, ImageName, BaseOfDll))) goto done; FIXME("Should have successfully loaded debug information for image %s\n", ImageName); if ((module = pe_load_module_from_pcs(pcs, ImageName, ModuleName, BaseOfDll, SizeOfDll))) goto done; WARN("Couldn't locate %s\n", ImageName); return 0; } module_compute_num_syms(module); done: /* by default pe_load_module fills module.ModuleName from a derivation * of ImageName. Overwrite it, if we have better information */ if (ModuleName) lstrcpynA(module->module.ModuleName, ModuleName, sizeof(module->module.ModuleName)); lstrcpynA(module->module.ImageName, ImageName, sizeof(module->module.ImageName)); return module->module.BaseOfImage; }
/****************************************************************** * refresh_module_list */ static BOOL refresh_module_list(struct process* pcs) { /* force transparent ELF and Mach-O loading / unloading */ return elf_synchronize_module_list(pcs) || macho_synchronize_module_list(pcs); }