Alexandre Julliard : ntdll: Avoid using LdrQueryProcessModuleInformation() in the Unix library.
Alexandre Julliard
julliard at winehq.org
Fri Jul 10 16:30:30 CDT 2020
Module: wine
Branch: master
Commit: afb16545671e7420c7a8bbb4ef97333c33001564
URL: https://source.winehq.org/git/wine.git/?a=commit;h=afb16545671e7420c7a8bbb4ef97333c33001564
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jul 10 07:58:35 2020 +0200
ntdll: Avoid using LdrQueryProcessModuleInformation() in the Unix library.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/system.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 07a3ad2154..c3dca7ffe2 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -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:
{
More information about the wine-cvs
mailing list