ReactOS 0.4.17-dev-1196-gb6224c3
RtlInitializeNtUserPfn.c File Reference
#include "precomp.h"
Include dependency graph for RtlInitializeNtUserPfn.c:

Go to the source code of this file.

Typedefs

typedef NTSTATUS NTAPI FN_RtlInitializeNtUserPfn(PVOID *ProcsA, SIZE_T SizeOfProcsA, PVOID *ProcsW, SIZE_T SizeOfProcsW, PVOID *OtherProcs, SIZE_T SizeOfOtherProcs)
 

Functions

 START_TEST (RtlInitializeNtUserPfn)
 

Variables

FN_RtlInitializeNtUserPfn * pRtlInitializeNtUserPfn
 

Typedef Documentation

◆ FN_RtlInitializeNtUserPfn

typedef NTSTATUS NTAPI FN_RtlInitializeNtUserPfn(PVOID *ProcsA, SIZE_T SizeOfProcsA, PVOID *ProcsW, SIZE_T SizeOfProcsW, PVOID *OtherProcs, SIZE_T SizeOfOtherProcs)

Definition at line 13 of file RtlInitializeNtUserPfn.c.

Function Documentation

◆ START_TEST()

START_TEST ( RtlInitializeNtUserPfn  )

Definition at line 23 of file RtlInitializeNtUserPfn.c.

24{
25 HINSTANCE hinstNtdll = GetModuleHandleW(L"ntdll.dll");
26 pRtlInitializeNtUserPfn = (FN_RtlInitializeNtUserPfn*)GetProcAddress(hinstNtdll, "RtlInitializeNtUserPfn");
28 {
29 skip("RtlInitializeNtUserPfn is not available\n");
30 return;
31 }
32
34 PVOID ProcsA[24] = { 0 };
35 PVOID ProcsW[24] = { 0 };
36 PVOID OtherProcs[11] = { 0 };
37 ULONG Count1, Count2;
38
45 Status = pRtlInitializeNtUserPfn(ProcsA, 0, ProcsW, 0, OtherProcs, 1);
47
48 printf("NTDDI version: %lx\n", GetNTDDIVersion());
49
50 /* OS version specific count of A/W functions */
51 Count1 = (GetNTDDIVersion() >= NTDDI_WIN10) ? 24 : 23;
52
53 /* OS version specific count of other functions */
54 Count2 = (GetNTDDIVersion() >= NTDDI_WIN11) ? 18 : 11;
55
56 /* Try different variants of too large sizes */
57 Status = pRtlInitializeNtUserPfn(ProcsA, (Count1 + 1) * sizeof(PVOID), ProcsW, Count1 * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
59 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, (Count1 + 1) * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
61 Status = pRtlInitializeNtUserPfn(ProcsA, (Count1 + 1) * sizeof(PVOID), ProcsW, (Count1 + 1) * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
63 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, Count1 * sizeof(PVOID), OtherProcs, (Count2 + 1) * sizeof(PVOID));
65
67 {
68 /* Try different variants of too small sizes (these succeed on Windows 10) */
69 Status = pRtlInitializeNtUserPfn(ProcsA, (Count1 - 1) * sizeof(PVOID), ProcsW, Count1 * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
71 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, (Count1 - 1) * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
73 Status = pRtlInitializeNtUserPfn(ProcsA, (Count1 - 1) * sizeof(PVOID), ProcsW, (Count1 - 1) * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
75 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, Count1 * sizeof(PVOID), OtherProcs, (Count2 - 1) * sizeof(PVOID));
77 }
78
79 /* Try unaligned sizes */
80 Status = pRtlInitializeNtUserPfn(ProcsA, (Count1 * sizeof(PVOID)) - 1, ProcsW, Count1 * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
82 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, (Count1 * sizeof(PVOID)) - 1, OtherProcs, Count2 * sizeof(PVOID));
84 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, Count1 * sizeof(PVOID), OtherProcs, (Count2 * sizeof(PVOID)) - 1);
86
87 /* Pass the expected sizes */
88 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, Count1 * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
90
91 /* Try to initialize again */
92 Status = pRtlInitializeNtUserPfn(ProcsA, Count1 * sizeof(PVOID), ProcsW, Count1 * sizeof(PVOID), OtherProcs, Count2 * sizeof(PVOID));
94}
NTSTATUS NTAPI FN_RtlInitializeNtUserPfn(PVOID *ProcsA, SIZE_T SizeOfProcsA, PVOID *ProcsW, SIZE_T SizeOfProcsW, PVOID *OtherProcs, SIZE_T SizeOfOtherProcs)
FN_RtlInitializeNtUserPfn * pRtlInitializeNtUserPfn
#define GetNTVersion()
Definition: apitest.h:17
static ULONG GetNTDDIVersion(VOID)
Definition: apitest.h:23
#define ok_ntstatus(status, expected)
Definition: atltest.h:135
#define skip(...)
Definition: atltest.h:64
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define L(x)
Definition: resources.c:13
#define printf
Definition: freeldr.h:103
Status
Definition: gdiplustypes.h:24
#define _WIN32_WINNT_WIN10
Definition: sdkddkver.h:32
#define NTDDI_WIN11
Definition: sdkddkver.h:131
#define NTDDI_WIN10
Definition: sdkddkver.h:117
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

Variable Documentation

◆ pRtlInitializeNtUserPfn

FN_RtlInitializeNtUserPfn* pRtlInitializeNtUserPfn

Definition at line 21 of file RtlInitializeNtUserPfn.c.

Referenced by InitFunctionPtrs(), START_TEST(), and test_user_procs().