mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[WIN32KNT_APITEST] Add more tests for NtUserProcessConnect() (#3937)
Show that NtUserProcessConnect() should return pointers in user client-space.
This commit is contained in:
parent
a2e9dcf0a7
commit
103c43861b
1 changed files with 34 additions and 6 deletions
|
@ -1,22 +1,29 @@
|
|||
/*
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Test for NtUserProcessConnect
|
||||
* PROGRAMMERS:
|
||||
* PROJECT: ReactOS api tests
|
||||
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
||||
* PURPOSE: Test for NtUserProcessConnect
|
||||
* COPYRIGHT: Copyright 2008-2020 Timo Kreuzer
|
||||
* Copyright 2021 Hermes Belusca-Maito
|
||||
*/
|
||||
|
||||
#include <win32nt.h>
|
||||
|
||||
#define NTOS_MODE_USER
|
||||
#include <ndk/exfuncs.h>
|
||||
|
||||
START_TEST(NtUserProcessConnect)
|
||||
{
|
||||
HANDLE hProcess;
|
||||
NTSTATUS Status;
|
||||
USERCONNECT UserConnect = {0};
|
||||
SYSTEM_BASIC_INFORMATION SystemInformation;
|
||||
ULONG_PTR MaximumUserModeAddress;
|
||||
|
||||
hProcess = GetCurrentProcess();
|
||||
|
||||
UserConnect.ulVersion = MAKELONG(0, 5);
|
||||
Status = NtUserProcessConnect(hProcess, &UserConnect, sizeof(USERCONNECT));
|
||||
UserConnect.ulVersion = MAKELONG(0, 5); // == USER_VERSION
|
||||
// UserConnect.dwDispatchCount;
|
||||
Status = NtUserProcessConnect(hProcess, &UserConnect, sizeof(UserConnect));
|
||||
TEST(NT_SUCCESS(Status));
|
||||
|
||||
printf("UserConnect.ulVersion = 0x%lx\n", UserConnect.ulVersion);
|
||||
|
@ -27,4 +34,25 @@ START_TEST(NtUserProcessConnect)
|
|||
printf("UserConnect.siClient.pDispInfo = 0x%p\n", UserConnect.siClient.pDispInfo);
|
||||
printf("UserConnect.siClient.ulSharedDelta = 0x%Ix\n", UserConnect.siClient.ulSharedDelta);
|
||||
|
||||
/* Verify the validity of some mandatory fields */
|
||||
TEST(UserConnect.ulVersion == MAKELONG(0, 5));
|
||||
TEST(UserConnect.ulCurrentVersion == 0);
|
||||
TEST(UserConnect.siClient.ulSharedDelta != 0);
|
||||
|
||||
/* Get the max um address */
|
||||
Status = NtQuerySystemInformation(SystemBasicInformation,
|
||||
&SystemInformation,
|
||||
sizeof(SystemInformation),
|
||||
NULL);
|
||||
TEST(NT_SUCCESS(Status));
|
||||
|
||||
MaximumUserModeAddress = SystemInformation.MaximumUserModeAddress;
|
||||
|
||||
/* Verify the validity of pointers -- They must be in client space */
|
||||
TEST(UserConnect.siClient.psi != NULL);
|
||||
TEST(UserConnect.siClient.aheList != NULL);
|
||||
// TEST(UserConnect.siClient.pDispInfo != NULL);
|
||||
TEST((ULONG_PTR)UserConnect.siClient.psi < MaximumUserModeAddress);
|
||||
TEST((ULONG_PTR)UserConnect.siClient.aheList < MaximumUserModeAddress);
|
||||
// TEST((ULONG_PTR)UserConnect.siClient.pDispInfo < MaximumUserModeAddress);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue