Module: wine Branch: master Commit: 83476e3d4ab0a0c7b1eca392e363591ba550440c URL: https://gitlab.winehq.org/wine/wine/-/commit/83476e3d4ab0a0c7b1eca392e363591...
Author: Eric Pouech epouech@codeweavers.com Date: Mon Jan 8 15:29:02 2024 +0100
dbghelp: Fix some corner case of virtual module loading.
Seen when debugging some game, one can load a virtual module with a NULL image name.
Signed-off-by: Eric Pouech epouech@codeweavers.com
---
dlls/dbghelp/module.c | 4 ++-- dlls/dbghelp/tests/path.c | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index a0de4f65056..5021d54c93e 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -959,7 +959,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam }
/* this is a Wine extension to the API just to redo the synchronisation */ - if (!wImageName && !hFile) + if (!wImageName && !hFile && !Flags) { pcs->loader->synchronize_module_list(pcs); return 0; @@ -967,7 +967,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
if (Flags & SLMFLAG_VIRTUAL) { - if (!wImageName) return 0; + if (!wImageName) wImageName = L""; module = module_new(pcs, wImageName, DMT_PE, FALSE, TRUE, BaseOfDll, SizeOfDll, 0, 0, IMAGE_FILE_MACHINE_UNKNOWN); if (!module) return 0; module->module.SymType = SymVirtual; diff --git a/dlls/dbghelp/tests/path.c b/dlls/dbghelp/tests/path.c index fc9a2e13bf9..9afefd2d12a 100644 --- a/dlls/dbghelp/tests/path.c +++ b/dlls/dbghelp/tests/path.c @@ -1774,12 +1774,9 @@ static void test_load_modules_details(void) base = SymLoadModuleExW(dummy, NULL, test->in_image_name, test->in_module_name, 0x4000, 0x6666, NULL, test->flags); - todo_wine_if(i == 0 || i == 1) ok(base == 0x4000, "SymLoadModuleExW failed: %lu\n", GetLastError()); ret = SymGetModuleInfoW64(dummy, base, &im); - todo_wine_if(i == 0 || i == 1) ok(ret, "SymGetModuleInfow64 failed: %lu\n", GetLastError()); - if (!ret) goto temp_bail_out; if (test->in_image_name) { WCHAR *dot; @@ -1892,7 +1889,6 @@ static void test_load_modules_details(void) } else ok(0, "Unrecognized file reference %c\n", *ptr); } - temp_bail_out: if (test->in_image_name && !wcscmp(test->in_image_name, L"bar.dll")) { make_path(filename, topdir, NULL, test->in_image_name);