dbghelp: Rewrote module_is_elf_container_loaded so that it no longer
uses the stored ModuleName (that the dbghelp's caller can override) but rather a combination of base address and filename for the module.
This commit is contained in:
parent
a6a57c934c
commit
59f93f64b7
|
@ -358,27 +358,39 @@ struct module* module_find_by_addr(const struct process* pcs, unsigned long addr
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************
|
||||||
|
* module_is_elf_container_loaded
|
||||||
|
*
|
||||||
|
* checks whether the ELF container, for a (supposed) PE builtin is
|
||||||
|
* already loaded
|
||||||
|
*/
|
||||||
static BOOL module_is_elf_container_loaded(struct process* pcs,
|
static BOOL module_is_elf_container_loaded(struct process* pcs,
|
||||||
const WCHAR* ImageName,
|
const WCHAR* ImageName, DWORD base)
|
||||||
const WCHAR* ModuleName)
|
|
||||||
{
|
{
|
||||||
WCHAR buffer[MAX_PATH];
|
|
||||||
size_t len;
|
size_t len;
|
||||||
struct module* module;
|
struct module* module;
|
||||||
|
LPCWSTR filename, modname;
|
||||||
|
|
||||||
|
if (!base) return FALSE;
|
||||||
|
filename = get_filename(ImageName, NULL);
|
||||||
|
len = strlenW(filename);
|
||||||
|
|
||||||
if (!ModuleName)
|
|
||||||
{
|
|
||||||
module_fill_module(ImageName, buffer, sizeof(buffer));
|
|
||||||
ModuleName = buffer;
|
|
||||||
}
|
|
||||||
len = strlenW(ModuleName);
|
|
||||||
for (module = pcs->lmodules; module; module = module->next)
|
for (module = pcs->lmodules; module; module = module->next)
|
||||||
{
|
{
|
||||||
if (!strncmpiW(module->module.ModuleName, ModuleName, len) &&
|
if (module->type == DMT_ELF &&
|
||||||
module->type == DMT_ELF &&
|
base >= module->module.BaseOfImage &&
|
||||||
!strcmpW(module->module.ModuleName + len, S_ElfW))
|
base < module->module.BaseOfImage + module->module.ImageSize)
|
||||||
|
{
|
||||||
|
modname = get_filename(module->module.LoadedImageName, NULL);
|
||||||
|
if (!strncmpiW(modname, filename, len) &&
|
||||||
|
!memcmp(modname + len, S_DotSoW, 3 * sizeof(WCHAR)))
|
||||||
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* likely a native PE module */
|
||||||
|
WARN("Couldn't find container for %s\n", debugstr_w(ImageName));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +511,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
|
||||||
/* this is a Wine extension to the API just to redo the synchronisation */
|
/* this is a Wine extension to the API just to redo the synchronisation */
|
||||||
if (!wImageName && !hFile) return 0;
|
if (!wImageName && !hFile) return 0;
|
||||||
|
|
||||||
if (module_is_elf_container_loaded(pcs, wImageName, wModuleName))
|
if (module_is_elf_container_loaded(pcs, wImageName, BaseOfDll))
|
||||||
{
|
{
|
||||||
/* force the loading of DLL as builtin */
|
/* force the loading of DLL as builtin */
|
||||||
if ((module = pe_load_module_from_pcs(pcs, wImageName, wModuleName,
|
if ((module = pe_load_module_from_pcs(pcs, wImageName, wModuleName,
|
||||||
|
|
Loading…
Reference in New Issue