dbghelp: Skip the dllprefix when matching PE with ELF modules.

This commit is contained in:
Huw Davies 2013-09-27 11:14:42 +01:00 committed by Alexandre Julliard
parent 8b21fefbf6
commit 5c7c954658
2 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
MODULE = dbghelp.dll
IMPORTLIB = dbghelp
EXTRADEFS = -D_IMAGEHLP_SOURCE_
EXTRADEFS = -D_IMAGEHLP_SOURCE_ -DDLLPREFIX='"$(DLLPREFIX)"'
IMPORTS = psapi
DELAYIMPORTS = version
EXTRALIBS = @ZLIB@

View File

@ -422,6 +422,16 @@ static BOOL module_is_container_loaded(const struct process* pcs,
size_t len;
struct module* module;
PCWSTR filename, modname;
static WCHAR* dll_prefix;
static int dll_prefix_len;
if (!dll_prefix)
{
dll_prefix_len = MultiByteToWideChar( CP_UNIXCP, 0, DLLPREFIX, -1, NULL, 0 );
dll_prefix = HeapAlloc( GetProcessHeap(), 0, dll_prefix_len * sizeof(WCHAR) );
MultiByteToWideChar( CP_UNIXCP, 0, DLLPREFIX, -1, dll_prefix, dll_prefix_len );
dll_prefix_len--;
}
if (!base) return FALSE;
filename = get_filename(ImageName, NULL);
@ -434,6 +444,7 @@ static BOOL module_is_container_loaded(const struct process* pcs,
base < module->module.BaseOfImage + module->module.ImageSize)
{
modname = get_filename(module->module.LoadedImageName, NULL);
if (dll_prefix_len && !strncmpW( modname, dll_prefix, dll_prefix_len )) modname += dll_prefix_len;
if (!strncmpiW(modname, filename, len) &&
!memcmp(modname + len, S_DotSoW, 3 * sizeof(WCHAR)))
{