Commit 02506933 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

kernel32: Allow GetModuleInformation() to succeed on a WoW64 process.

parent 54f287d8
......@@ -1907,6 +1907,7 @@ BOOL WINAPI K32GetModuleInformation(HANDLE process, HMODULE module,
MODULEINFO *modinfo, DWORD cb)
{
LDR_MODULE ldr_module;
BOOL wow64;
if (cb < sizeof(MODULEINFO))
{
......@@ -1914,12 +1915,29 @@ BOOL WINAPI K32GetModuleInformation(HANDLE process, HMODULE module,
return FALSE;
}
if (!get_ldr_module(process, module, &ldr_module))
if (!IsWow64Process(process, &wow64))
return FALSE;
modinfo->lpBaseOfDll = ldr_module.BaseAddress;
modinfo->SizeOfImage = ldr_module.SizeOfImage;
modinfo->EntryPoint = ldr_module.EntryPoint;
if (sizeof(void *) == 8 && wow64)
{
LDR_MODULE32 ldr_module32;
if (!get_ldr_module32(process, module, &ldr_module32))
return FALSE;
modinfo->lpBaseOfDll = (void *)(DWORD_PTR)ldr_module32.BaseAddress;
modinfo->SizeOfImage = ldr_module32.SizeOfImage;
modinfo->EntryPoint = (void *)(DWORD_PTR)ldr_module32.EntryPoint;
}
else
{
if (!get_ldr_module(process, module, &ldr_module))
return FALSE;
modinfo->lpBaseOfDll = ldr_module.BaseAddress;
modinfo->SizeOfImage = ldr_module.SizeOfImage;
modinfo->EntryPoint = ldr_module.EntryPoint;
}
return TRUE;
}
......
......@@ -182,6 +182,7 @@ static void test_EnumProcessModules(void)
if (sizeof(void *) == 8)
{
MODULEINFO info;
char name[40];
strcpy(buffer, "C:\\windows\\syswow64\\notepad.exe");
......@@ -207,6 +208,12 @@ static void test_EnumProcessModules(void)
todo_wine
ok(!strcmp(name, buffer), "got %s\n", name);
ret = GetModuleInformation(pi.hProcess, hMod, &info, sizeof(info));
ok(ret, "got error %u\n", GetLastError());
ok(info.lpBaseOfDll == hMod, "expected %p, got %p\n", hMod, info.lpBaseOfDll);
ok(info.SizeOfImage, "image size was 0\n");
ok(info.EntryPoint >= info.lpBaseOfDll, "got entry point %p\n", info.EntryPoint);
TerminateProcess(pi.hProcess, 0);
}
else if (wow64)
......
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