psapi/tests: Fix the EnumProcessModules() test and provide more diagnostic information if it fails.

On some Windows systems aclayers.dll gets injected into the process and brings in a lot of extra dlls.
This commit is contained in:
Francois Gouget 2011-08-26 16:09:03 +02:00 committed by Alexandre Julliard
parent d82c70e511
commit 187de1794e

View file

@ -107,10 +107,26 @@ static void test_EnumProcessModules(void)
ret = pEnumProcessModules(hpQV, &hMod, sizeof(HMODULE), &cbNeeded);
if(ret != 1)
return;
ok(cbNeeded / sizeof(HMODULE) >= 3 && cbNeeded / sizeof(HMODULE) <= 5 * sizeof(HMODULE),
"cbNeeded=%d\n", cbNeeded);
ok(hMod == GetModuleHandle(NULL),
"hMod=%p GetModuleHandle(NULL)=%p\n", hMod, GetModuleHandle(NULL));
ok(cbNeeded % sizeof(hMod) == 0, "not a multiple of sizeof(HMODULE) cbNeeded=%d\n", cbNeeded);
/* Windows sometimes has a bunch of extra dlls, presumably brought in by
* aclayers.dll.
*/
if (cbNeeded < 4 * sizeof(HMODULE) || cbNeeded > 30 * sizeof(HMODULE))
{
HMODULE hmods[100];
int i;
ok(0, "cbNeeded=%d\n", cbNeeded);
pEnumProcessModules(hpQV, hmods, sizeof(hmods), &cbNeeded);
for (i = 0 ; i < cbNeeded/sizeof(*hmods); i++)
{
char path[1024];
GetModuleFileNameA(hmods[i], path, sizeof(path));
trace("i=%d hmod=%p path=[%s]\n", i, hmods[i], path);
}
}
}
static void test_GetModuleInformation(void)