Commit b65ef71f authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Improve collision handling in SymLoadModuleEx().

parent 1465c7de
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment