1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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>
This commit is contained in:
Eric Pouech 2024-01-08 15:29:02 +01:00 committed by Alexandre Julliard
parent 4f80a599b6
commit 83476e3d4a
2 changed files with 2 additions and 6 deletions

View file

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

View file

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