[PATCH 3/3] ntdll: Semi-stub SystemModuleInformationEx.

Zebediah Figura z.figura12 at gmail.com
Mon Oct 26 18:40:08 CDT 2020


https://bugs.winehq.org/show_bug.cgi?id=45666
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/ntdll/tests/info.c  |  2 +-
 dlls/ntdll/unix/system.c | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 6805cfb6a8e..70ea7d5146b 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -500,7 +500,7 @@ static void test_query_module(void)
     status = pNtQuerySystemInformation(SystemModuleInformationEx, NULL, 0, &size);
     if (status == STATUS_INVALID_INFO_CLASS)
     {
-        todo_wine win_skip("SystemModuleInformationEx is not supported.\n");
+        win_skip("SystemModuleInformationEx is not supported.\n");
         return;
     }
     ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#x\n", status);
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 7ac084a9899..faa7532cfef 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2357,6 +2357,41 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
         break;
     }
 
+    case SystemModuleInformationEx:
+    {
+        /* 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"
+        };
+
+        ULONG i;
+        RTL_PROCESS_MODULE_INFORMATION_EX *module_info = info;
+
+        len = sizeof(*module_info) * ARRAY_SIZE(fake_modules) + sizeof(module_info->NextOffset);
+        if (len <= size)
+        {
+            memset( info, 0, len );
+            for (i = 0; i < ARRAY_SIZE(fake_modules); i++)
+            {
+                SYSTEM_MODULE *sm = &module_info[i].BaseInfo;
+                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;
+                module_info[i].NextOffset = sizeof(*module_info);
+            }
+            module_info[ARRAY_SIZE(fake_modules)].NextOffset = 0;
+        }
+        else ret = STATUS_INFO_LENGTH_MISMATCH;
+
+        break;
+    }
+
     case SystemHandleInformation:
     {
         struct handle_info *handle_info;
-- 
2.28.0




More information about the wine-devel mailing list