dbghelp: Improve collision handling in SymLoadModuleEx().

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-11-16 17:47:57 +01:00 committed by Alexandre Julliard
parent 1465c7de2a
commit b65ef71fc0
1 changed files with 12 additions and 3 deletions

View File

@ -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)