mimic what native does...
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/module.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 64d4e3113d5..fe65683c6e1 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -969,6 +969,14 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam /* we have a conflict as the new module cannot be found by its base address * we need to get rid of one on the two modules */ + if (lstrcmpW(module->modulename, altmodule->modulename) != 0) + { + /* module overlaps an existing but different module... unload new module and return error */ + WARN("%ls overlaps %ls\n", module->modulename, altmodule->modulename); + module_remove(pcs, module); + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } /* loading same module at same address... don't change anything */ if (module->module.BaseOfImage == altmodule->module.BaseOfImage) { @@ -976,9 +984,10 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam SetLastError(ERROR_SUCCESS); return 0; } - module_remove(pcs, module); - SetLastError(ERROR_INVALID_PARAMETER); - return 0; + /* replace old module with new one, which will look like a shift of base address */ + WARN("Shift module %ls from %I64x to %I64x\n", + module->modulename, altmodule->module.BaseOfImage, module->module.BaseOfImage); + module_remove(pcs, altmodule); }
if ((dbghelp_options & SYMOPT_DEFERRED_LOADS) == 0)