[PATCH] ntoskrnl: Add MmIsThisAnNtAsSystem
Alex Henrie
alexhenrie24 at gmail.com
Thu Aug 1 23:20:20 CDT 2019
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47578
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
MSDN says that this function has been deprecated since Windows XP, so
it's not surprising that it always returns FALSE on the test VMs.
---
dlls/ntoskrnl.exe/ntoskrnl.c | 7 +++++++
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
dlls/ntoskrnl.exe/tests/ntoskrnl.c | 12 ++++++++++++
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 92f9afab33..7ff5ab9cb9 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -2971,6 +2971,13 @@ PVOID WINAPI MmGetSystemRoutineAddress(PUNICODE_STRING SystemRoutineName)
return pFunc;
}
+/***********************************************************************
+ * MmIsThisAnNtAsSystem (NTOSKRNL.EXE.@)
+ */
+BOOLEAN WINAPI MmIsThisAnNtAsSystem(void)
+{
+ return FALSE;
+}
/***********************************************************************
* MmQuerySystemSize (NTOSKRNL.EXE.@)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 439cae3097..6f4bd88538 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -699,7 +699,7 @@
@ stub MmIsDriverVerifying
@ stub MmIsNonPagedSystemAddressValid
@ stub MmIsRecursiveIoFault
-@ stub MmIsThisAnNtAsSystem
+@ stdcall MmIsThisAnNtAsSystem()
@ stub MmIsVerifierEnabled
@ stub MmLockPagableDataSection
@ stub MmLockPagableImageSection
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 48ddb299cf..5c04ee313c 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -32,11 +32,20 @@
static HANDLE device;
+static BOOLEAN (WINAPI *pMmIsThisAnNtAsSystem)(void);
static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)(const WCHAR *, UNICODE_STRING *, WCHAR **, CURDIR *);
static BOOL (WINAPI *pRtlFreeUnicodeString)(UNICODE_STRING *);
static BOOL (WINAPI *pCancelIoEx)(HANDLE, OVERLAPPED *);
static BOOL (WINAPI *pSetFileCompletionNotificationModes)(HANDLE, UCHAR);
+static void test_system(void)
+{
+ if (!pMmIsThisAnNtAsSystem) /* 32-bit XP/7/8 */
+ skip("MmIsThisAnNtAsSystem is not available\n");
+ else
+ ok(!pMmIsThisAnNtAsSystem(), "System reports that it is an old NT Server\n");
+}
+
static void load_resource(const char *name, char *filename)
{
static char path[MAX_PATH];
@@ -347,12 +356,15 @@ START_TEST(ntoskrnl)
BOOL ret;
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
+ pMmIsThisAnNtAsSystem = (void *)GetProcAddress(GetModuleHandleA("ntoskrnl.exe"), "MmIsThisAnNtAsSystem");
pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(hntdll, "RtlDosPathNameToNtPathName_U");
pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
pCancelIoEx = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "CancelIoEx");
pSetFileCompletionNotificationModes = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"),
"SetFileCompletionNotificationModes");
+ test_system();
+
if (!(service = load_driver(filename, "driver.dll", "WineTestDriver")))
return;
if (!start_driver(service))
--
2.22.0
More information about the wine-devel
mailing list