ReactOS 0.4.16-dev-197-g92996da
NtUserProcessConnect.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4 * PURPOSE: Test for NtUserProcessConnect
5 * COPYRIGHT: Copyright 2008-2020 Timo Kreuzer
6 * Copyright 2021 Hermes Belusca-Maito
7 */
8
9#include "../win32nt.h"
10
11#define NTOS_MODE_USER
12#include <ndk/exfuncs.h>
13
15{
18 USERCONNECT UserConnect = {0};
19 SYSTEM_BASIC_INFORMATION SystemInformation;
20 ULONG_PTR MaximumUserModeAddress;
21
23
24 UserConnect.ulVersion = MAKELONG(0, 5); // == USER_VERSION
25 // UserConnect.dwDispatchCount;
26 Status = NtUserProcessConnect(hProcess, &UserConnect, sizeof(UserConnect));
28
29 printf("UserConnect.ulVersion = 0x%lx\n", UserConnect.ulVersion);
30 printf("UserConnect.ulCurrentVersion = 0x%lx\n", UserConnect.ulCurrentVersion);
31 printf("UserConnect.dwDispatchCount = 0x%lx\n", UserConnect.dwDispatchCount);
32 printf("UserConnect.siClient.psi = 0x%p\n", UserConnect.siClient.psi);
33 printf("UserConnect.siClient.aheList = 0x%p\n", UserConnect.siClient.aheList);
34 printf("UserConnect.siClient.pDispInfo = 0x%p\n", UserConnect.siClient.pDispInfo);
35 printf("UserConnect.siClient.ulSharedDelta = 0x%Ix\n", UserConnect.siClient.ulSharedDelta);
36
37 /* Verify the validity of some mandatory fields */
38 TEST(UserConnect.ulVersion == MAKELONG(0, 5));
39 TEST(UserConnect.ulCurrentVersion == 0);
40 TEST(UserConnect.siClient.ulSharedDelta != 0);
41
42 /* Get the max um address */
44 &SystemInformation,
45 sizeof(SystemInformation),
46 NULL);
48
49 MaximumUserModeAddress = SystemInformation.MaximumUserModeAddress;
50
51 /* Verify the validity of pointers -- They must be in client space */
52 TEST(UserConnect.siClient.psi != NULL);
53 TEST(UserConnect.siClient.aheList != NULL);
54 // TEST(UserConnect.siClient.pDispInfo != NULL);
55 TEST((ULONG_PTR)UserConnect.siClient.psi < MaximumUserModeAddress);
56 TEST((ULONG_PTR)UserConnect.siClient.aheList < MaximumUserModeAddress);
57 // TEST((ULONG_PTR)UserConnect.siClient.pDispInfo < MaximumUserModeAddress);
58}
#define START_TEST(x)
Definition: atltest.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define GetCurrentProcess()
Definition: compat.h:759
@ SystemBasicInformation
Definition: ntddk_ex.h:11
#define printf
Definition: freeldr.h:97
Status
Definition: gdiplustypes.h:25
NTSTATUS NTAPI NtUserProcessConnect(IN HANDLE ProcessHandle, OUT PUSERCONNECT pUserConnect, IN ULONG Size)
Definition: ntstubs.c:476
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define TEST(x)
Definition: precomp.h:20
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
PVOID aheList
Definition: ntuser.h:1131
PSERVERINFO psi
Definition: ntuser.h:1130
PVOID pDispInfo
Definition: ntuser.h:1132
ULONG_PTR ulSharedDelta
Definition: ntuser.h:1133
ULONG ulVersion
Definition: ntuser.h:1142
DWORD dwDispatchCount
Definition: ntuser.h:1144
ULONG ulCurrentVersion
Definition: ntuser.h:1143
SHAREDINFO siClient
Definition: ntuser.h:1145
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MAKELONG(a, b)
Definition: typedefs.h:249