From dbe17b07a502aa2fc29f9e382adccf8bdc211824 Mon Sep 17 00:00:00 2001
From: Andrew Wesie <awesie@gmail.com>
Date: Fri, 12 Apr 2019 20:06:08 -0500
Subject: [PATCH] ntdll: Add stub for
 NtQuerySystemInformation(SystemModuleInformationEx).

---
 dlls/ntdll/nt.c    | 21 +++++++++++++++++++++
 include/winternl.h |  9 +++++++++
 2 files changed, 30 insertions(+)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index ea740ac81..77b64cac0 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -2622,6 +2622,27 @@ NTSTATUS WINAPI NtQuerySystemInformation(
             ret = STATUS_SUCCESS;
         }
         break;
+    case SystemModuleInformationEx:
+        if (!SystemInformation)
+            ret = STATUS_ACCESS_VIOLATION;
+        else if (Length < sizeof(SYSTEM_MODULE_INFORMATION_EX))
+        {
+            len = sizeof(SYSTEM_MODULE_INFORMATION_EX);
+            ret = STATUS_INFO_LENGTH_MISMATCH;
+        }
+        else
+        {
+            SYSTEM_MODULE_INFORMATION_EX *info = SystemInformation;
+
+            FIXME("info_class SystemModuleInformationEx stub!\n");
+            get_ntdll_system_module(&info->BaseInfo);
+            info->NextOffset = 0;
+            info->ImageCheckSum = 0;
+            info->TimeDateStamp = 0;
+            info->DefaultBase = info->BaseInfo.ImageBaseAddress;
+            ret = STATUS_SUCCESS;
+        }
+        break;
     case SystemHandleInformation:
         {
             struct handle_info *info;
diff --git a/include/winternl.h b/include/winternl.h
index 2b3fb947b..613f55701 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -2272,6 +2272,15 @@ typedef struct _SYSTEM_MODULE_INFORMATION
     SYSTEM_MODULE       Modules[1]; /* FIXME: should be Modules[0] */
 } SYSTEM_MODULE_INFORMATION, *PSYSTEM_MODULE_INFORMATION;
 
+typedef struct _SYSTEM_MODULE_INFORMATION_EX
+{
+    ULONG NextOffset;
+    SYSTEM_MODULE BaseInfo;
+    ULONG ImageCheckSum;
+    ULONG TimeDateStamp;
+    void *DefaultBase;
+} SYSTEM_MODULE_INFORMATION_EX, *PSYSTEM_MODULE_INFORMATION_EX;
+
 #define THREAD_CREATE_FLAGS_CREATE_SUSPENDED        0x00000001
 #define THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH      0x00000002
 #define THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER      0x00000004
-- 
2.21.0

