[PATCH] ntoskrnl: Add MmIsThisAnNtAsSystem

Zebediah Figura z.figura12 at gmail.com
Thu Aug 1 23:26:40 CDT 2019


Hello Alex,

On 8/1/19 11:20 PM, Alex Henrie wrote:
> 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))
> 

Is the application really calling this function from a user-mode 
process? If not, I think this test should go in driver.c, instead, 
somewhere around main_test(). I suspect that will also get rid of the 
missing function workaround.

ἔρρωσο,
Zeb



More information about the wine-devel mailing list