dbghelp: Fix reading Wine loader's base address.

Note: the 32bit tests in new wow mode are still marked
todo as the ELF debug header is located above the 4G limit
and "default" module management in dbghelp compiled in 32bit
is (mostly) done with 32 bit addresses.
The correct fix should be to always consider ELF (and macho-O)
modules with 64bit addresses (which means likely to move all
modules handling to 64bit even in 32bit compilations).
But that goes far beyond this patch.

This limitation will only impact debuggers compiled in 32bit,
using 32bit builtin dbghelp on a 32bit debuggee.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55058
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55096
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2023-06-23 11:04:55 +02:00 committed by Alexandre Julliard
parent 1ed646ebf6
commit eb1f62bb31
2 changed files with 5 additions and 7 deletions

View file

@ -387,7 +387,7 @@ static BOOL check_live_target(struct process* pcs, BOOL wow64, BOOL child_wow64)
if (!pcs->is_64bit) peb_addr -= 0x1000; /* PEB32 => PEB64 */
if (!ReadProcessMemory(pcs->handle, peb_addr, &peb, sizeof(peb), NULL)) return FALSE;
base = peb.CloudFileFlags;
base = *(const DWORD64*)&peb.CloudFileFlags;
pcs->is_system_64bit = TRUE;
if (pcs->is_64bit)
ReadProcessMemory(pcs->handle,

View file

@ -763,14 +763,16 @@ static void test_loaded_modules(void)
}
}
pcskind = get_process_kind(pi.hProcess);
ret = SymRefreshModuleList(pi.hProcess);
todo_wine_if(pcskind != PCSKIND_32BIT && pcskind != PCSKIND_WINE_OLD_WOW64)
todo_wine_if(pcskind == PCSKIND_WOW64)
ok(ret || broken(GetLastError() == STATUS_PARTIAL_COPY /* Win11 in some cases */), "SymRefreshModuleList failed: %lu\n", GetLastError());
if (!strcmp(winetest_platform, "wine"))
{
unsigned count = get_native_module_count(pi.hProcess);
todo_wine_if(pcskind != PCSKIND_32BIT && pcskind != PCSKIND_WINE_OLD_WOW64)
todo_wine_if(pcskind == PCSKIND_WOW64)
ok(count > 0, "Didn't find any native (ELF/Macho) modules\n");
}
@ -823,14 +825,12 @@ static void test_loaded_modules(void)
"Wrong directory aggregation count %u %u\n",
aggregation.count_systemdir, aggregation.count_wowdir);
}
todo_wine_if(pcskind != PCSKIND_WINE_OLD_WOW64)
ret = SymRefreshModuleList(pi.hProcess);
ok(ret, "SymRefreshModuleList failed: %lu\n", GetLastError());
if (!strcmp(winetest_platform, "wine"))
{
unsigned count = get_native_module_count(pi.hProcess);
todo_wine_if(pcskind != PCSKIND_WINE_OLD_WOW64)
ok(count > 0, "Didn't find any native (ELF/Macho) modules\n");
}
@ -887,14 +887,12 @@ static void test_loaded_modules(void)
break;
}
todo_wine_if(pcskind != PCSKIND_WINE_OLD_WOW64)
ret = SymRefreshModuleList(pi.hProcess);
ok(ret, "SymRefreshModuleList failed: %lu\n", GetLastError());
if (!strcmp(winetest_platform, "wine"))
{
unsigned count = get_native_module_count(pi.hProcess);
todo_wine_if(pcskind != PCSKIND_WINE_OLD_WOW64)
ok(count > 0, "Didn't find any native (ELF/Macho) modules\n");
}