Commit 83476e3d authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

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: 's avatarEric Pouech <epouech@codeweavers.com>
parent 4f80a599
...@@ -959,7 +959,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam ...@@ -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 */ /* 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); pcs->loader->synchronize_module_list(pcs);
return 0; return 0;
...@@ -967,7 +967,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam ...@@ -967,7 +967,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE hProcess, HANDLE hFile, PCWSTR wImageNam
if (Flags & SLMFLAG_VIRTUAL) 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); module = module_new(pcs, wImageName, DMT_PE, FALSE, TRUE, BaseOfDll, SizeOfDll, 0, 0, IMAGE_FILE_MACHINE_UNKNOWN);
if (!module) return 0; if (!module) return 0;
module->module.SymType = SymVirtual; module->module.SymType = SymVirtual;
......
...@@ -1774,12 +1774,9 @@ static void test_load_modules_details(void) ...@@ -1774,12 +1774,9 @@ static void test_load_modules_details(void)
base = SymLoadModuleExW(dummy, NULL, base = SymLoadModuleExW(dummy, NULL,
test->in_image_name, test->in_module_name, test->in_image_name, test->in_module_name,
0x4000, 0x6666, NULL, test->flags); 0x4000, 0x6666, NULL, test->flags);
todo_wine_if(i == 0 || i == 1)
ok(base == 0x4000, "SymLoadModuleExW failed: %lu\n", GetLastError()); ok(base == 0x4000, "SymLoadModuleExW failed: %lu\n", GetLastError());
ret = SymGetModuleInfoW64(dummy, base, &im); ret = SymGetModuleInfoW64(dummy, base, &im);
todo_wine_if(i == 0 || i == 1)
ok(ret, "SymGetModuleInfow64 failed: %lu\n", GetLastError()); ok(ret, "SymGetModuleInfow64 failed: %lu\n", GetLastError());
if (!ret) goto temp_bail_out;
if (test->in_image_name) if (test->in_image_name)
{ {
WCHAR *dot; WCHAR *dot;
...@@ -1892,7 +1889,6 @@ static void test_load_modules_details(void) ...@@ -1892,7 +1889,6 @@ static void test_load_modules_details(void)
} }
else ok(0, "Unrecognized file reference %c\n", *ptr); 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")) if (test->in_image_name && !wcscmp(test->in_image_name, L"bar.dll"))
{ {
make_path(filename, topdir, NULL, test->in_image_name); make_path(filename, topdir, NULL, test->in_image_name);
......
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