Commit 115fbf63 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

kernelbase: Let GetModuleInformation succeed on 64bit modules in wow64.

parent c66e8760
...@@ -1458,7 +1458,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetModuleFileNameExW( HANDLE process, HMODULE mod ...@@ -1458,7 +1458,7 @@ DWORD WINAPI DECLSPEC_HOTPATCH GetModuleFileNameExW( HANDLE process, HMODULE mod
*/ */
BOOL WINAPI GetModuleInformation( HANDLE process, HMODULE module, MODULEINFO *modinfo, DWORD count ) BOOL WINAPI GetModuleInformation( HANDLE process, HMODULE module, MODULEINFO *modinfo, DWORD count )
{ {
BOOL wow64; BOOL wow64, found = FALSE;
if (count < sizeof(MODULEINFO)) if (count < sizeof(MODULEINFO))
{ {
...@@ -1472,12 +1472,15 @@ BOOL WINAPI GetModuleInformation( HANDLE process, HMODULE module, MODULEINFO *mo ...@@ -1472,12 +1472,15 @@ BOOL WINAPI GetModuleInformation( HANDLE process, HMODULE module, MODULEINFO *mo
{ {
LDR_DATA_TABLE_ENTRY32 ldr_module32; LDR_DATA_TABLE_ENTRY32 ldr_module32;
if (!get_ldr_module32( process, module, &ldr_module32 )) return FALSE; if (get_ldr_module32( process, module, &ldr_module32 ))
modinfo->lpBaseOfDll = (void *)(DWORD_PTR)ldr_module32.BaseAddress; {
modinfo->SizeOfImage = ldr_module32.SizeOfImage; modinfo->lpBaseOfDll = (void *)(DWORD_PTR)ldr_module32.BaseAddress;
modinfo->EntryPoint = (void *)(DWORD_PTR)ldr_module32.EntryPoint; modinfo->SizeOfImage = ldr_module32.SizeOfImage;
modinfo->EntryPoint = (void *)(DWORD_PTR)ldr_module32.EntryPoint;
found = TRUE;
}
} }
else if (!found)
{ {
LDR_DATA_TABLE_ENTRY ldr_module; LDR_DATA_TABLE_ENTRY ldr_module;
......
...@@ -215,10 +215,6 @@ static BOOL test_EnumProcessModulesEx_snapshot(HANDLE proc, struct moduleex_snap ...@@ -215,10 +215,6 @@ static BOOL test_EnumProcessModulesEx_snapshot(HANDLE proc, struct moduleex_snap
MODULEINFO info; MODULEINFO info;
int i, j; int i, j;
BOOL ret; BOOL ret;
BOOL fail, wow64;
ret = IsWow64Process(proc, &wow64);
ok(ret, "IsWow64Process failed: %lu\n", GetLastError());
for (i = 0; i < numsnap; i++) for (i = 0; i < numsnap; i++)
{ {
...@@ -231,27 +227,16 @@ static BOOL test_EnumProcessModulesEx_snapshot(HANDLE proc, struct moduleex_snap ...@@ -231,27 +227,16 @@ static BOOL test_EnumProcessModulesEx_snapshot(HANDLE proc, struct moduleex_snap
mxsnap[i].num_modules = min(needed, sizeof(mxsnap[i].modules)) / sizeof(HMODULE); mxsnap[i].num_modules = min(needed, sizeof(mxsnap[i].modules)) / sizeof(HMODULE);
for (j = 0; j < mxsnap[i].num_modules; j++) for (j = 0; j < mxsnap[i].num_modules; j++)
{ {
/* temporary todo until GetModuleBaseName and friends are fixed */
if ((fail = sizeof(void*) == 8 && wow64))
switch (mxsnap[i].list)
{
case LIST_MODULES_32BIT: fail = FALSE; break;
case LIST_MODULES_DEFAULT: fail = j >= 1; break;
case LIST_MODULES_ALL: fail = j >= mxsnap[0].num_modules; break;
case LIST_MODULES_64BIT: break;
}
ret = GetModuleBaseNameA(proc, mxsnap[i].modules[j], buffer, sizeof(buffer)); ret = GetModuleBaseNameA(proc, mxsnap[i].modules[j], buffer, sizeof(buffer));
ok(ret, "GetModuleBaseName failed: %lu (%u/%lu=%p)\n", GetLastError(), j, mxsnap[i].num_modules, mxsnap[i].modules[j]); ok(ret, "GetModuleBaseName failed: %lu (%u/%lu=%p)\n", GetLastError(), j, mxsnap[i].num_modules, mxsnap[i].modules[j]);
ret = GetModuleFileNameExA(proc, mxsnap[i].modules[j], buffer, sizeof(buffer)); ret = GetModuleFileNameExA(proc, mxsnap[i].modules[j], buffer, sizeof(buffer));
ok(ret, "GetModuleFileNameEx failed: %lu (%u/%lu=%p)\n", GetLastError(), j, mxsnap[i].num_modules, mxsnap[i].modules[j]); ok(ret, "GetModuleFileNameEx failed: %lu (%u/%lu=%p)\n", GetLastError(), j, mxsnap[i].num_modules, mxsnap[i].modules[j]);
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
ret = GetModuleInformation(proc, mxsnap[i].modules[j], &info, sizeof(info)); ret = GetModuleInformation(proc, mxsnap[i].modules[j], &info, sizeof(info));
todo_wine_if(fail) {
ok(ret, "GetModuleInformation failed: %lu\n", GetLastError()); ok(ret, "GetModuleInformation failed: %lu\n", GetLastError());
ok(info.lpBaseOfDll == mxsnap[i].modules[j], "expected %p, got %p\n", mxsnap[i].modules[j], info.lpBaseOfDll); ok(info.lpBaseOfDll == mxsnap[i].modules[j], "expected %p, got %p\n", mxsnap[i].modules[j], info.lpBaseOfDll);
ok(info.SizeOfImage, "image size was 0\n"); ok(info.SizeOfImage, "image size was 0\n");
/* info.EntryPoint to be checked */ /* info.EntryPoint to be checked */
}
} }
winetest_pop_context(); winetest_pop_context();
} }
......
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