ntdll: Avoid using LdrQueryProcessModuleInformation() in the Unix library.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-07-10 07:58:35 +02:00
parent bcc3410732
commit afb1654567
1 changed files with 33 additions and 2 deletions

View File

@ -2292,10 +2292,41 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
}
case SystemModuleInformation:
/* FIXME: should be system-wide */
{
/* FIXME: return some fake info for now */
static const char *fake_modules[] =
{
"\\SystemRoot\\system32\\ntoskrnl.exe",
"\\SystemRoot\\system32\\hal.dll",
"\\SystemRoot\\system32\\drivers\\mountmgr.sys"
};
if (!info) ret = STATUS_ACCESS_VIOLATION;
else ret = LdrQueryProcessModuleInformation( info, size, &len );
else
{
ULONG i;
SYSTEM_MODULE_INFORMATION *smi = info;
len = offsetof( SYSTEM_MODULE_INFORMATION, Modules[ARRAY_SIZE(fake_modules)] );
if (len <= size)
{
memset( smi, 0, len );
for (i = 0; i < ARRAY_SIZE(fake_modules); i++)
{
SYSTEM_MODULE *sm = &smi->Modules[i];
sm->ImageBaseAddress = (char *)0x10000000 + 0x200000 * i;
sm->ImageSize = 0x200000;
sm->LoadOrderIndex = i;
sm->LoadCount = 1;
strcpy( (char *)sm->Name, fake_modules[i] );
sm->NameOffset = strrchr( fake_modules[i], '\\' ) - fake_modules[i] + 1;
}
smi->ModulesCount = i;
}
else ret = STATUS_INFO_LENGTH_MISMATCH;
}
break;
}
case SystemHandleInformation:
{