ReactOS 0.4.17-dev-1247-ge46f4bb
ntuserpfn.c File Reference
#include <rtl.h>
#include <ndk/rtlfuncs.h>
#include <debug.h>
Include dependency graph for ntuserpfn.c:

Go to the source code of this file.

Classes

struct  _NTUSER_PFN
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _NTUSER_PFN NTUSER_PFN
 
typedef struct _NTUSER_PFN * PNTUSER_PFN
 

Functions

NTSTATUS NTAPI RtlInitializeNtUserPfn (_In_reads_bytes_(SizeOfWndProcsA) LPCVOID WndProcsA, _In_ SIZE_T SizeOfWndProcsA, _In_reads_bytes_(SizeOfWndProcsW) LPCVOID WndProcsW, _In_ SIZE_T SizeOfWndProcsW, _In_reads_bytes_(SizeOfWorkerProcs) LPCVOID WorkerProcs, _In_ SIZE_T SizeOfWorkerProcs)
 
NTSTATUS NTAPI RtlRetrieveNtUserPfn (_Outptr_ const VOID **NtdllWndProcsA, _Outptr_ const VOID **NtdllWndProcsW, _Outptr_ const VOID **NtdllWorkerProcs)
 

Variables

const NTUSER_PFN RtlpNtUserPfns = { 0 }
 
const NTUSER_PFN NtDllUserStubs
 
static BOOLEAN NtUserPfnsInitialized
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file ntuserpfn.c.

Typedef Documentation

◆ NTUSER_PFN

◆ PNTUSER_PFN

Function Documentation

◆ RtlInitializeNtUserPfn()

NTSTATUS NTAPI RtlInitializeNtUserPfn ( _In_reads_bytes_(SizeOfWndProcsA) LPCVOID  WndProcsA,
_In_ SIZE_T  SizeOfWndProcsA,
_In_reads_bytes_(SizeOfWndProcsW) LPCVOID  WndProcsW,
_In_ SIZE_T  SizeOfWndProcsW,
_In_reads_bytes_(SizeOfWorkerProcs) LPCVOID  WorkerProcs,
_In_ SIZE_T  SizeOfWorkerProcs 
)

Definition at line 29 of file ntuserpfn.c.

36{
37 ULONG OldProtect;
41
42 /* Validate parameters */
43 if ((SizeOfWndProcsA != sizeof(RtlpNtUserPfns.WndProcsA)) ||
44 (SizeOfWndProcsW != sizeof(RtlpNtUserPfns.WndProcsW)) ||
45 (SizeOfWorkerProcs != sizeof(RtlpNtUserPfns.WorkerProcs)))
46 {
48 }
49
50 /* Check if already initialized */
52 {
54 }
55
56 /* Change page protection, so we can set up the PFNs */
58 RegionSize = sizeof(RtlpNtUserPfns);
63 &OldProtect);
64 if (!NT_SUCCESS(Status))
65 {
66 return Status;
67 }
68
69 RtlCopyMemory((PVOID)RtlpNtUserPfns.WndProcsA, WndProcsA, SizeOfWndProcsA);
70 RtlCopyMemory((PVOID)RtlpNtUserPfns.WndProcsW, WndProcsW, SizeOfWndProcsW);
71 RtlCopyMemory((PVOID)RtlpNtUserPfns.WorkerProcs, WorkerProcs, SizeOfWorkerProcs);
72
73 /* Restore original page protection */
77 OldProtect,
78 &OldProtect);
79 if (!NT_SUCCESS(Status))
80 {
81 return Status;
82 }
83
85
86 return STATUS_SUCCESS;
87}
LONG NTSTATUS
Definition: precomp.h:26
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID * BaseAddress
Definition: mmfuncs.h:408
__kernel_entry _Inout_ _Inout_ PSIZE_T RegionSize
Definition: mmfuncs.h:176
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define NtCurrentProcess()
Definition: nt_native.h:1660
NTSTATUS NTAPI NtProtectVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UnsafeBaseAddress, IN OUT SIZE_T *UnsafeNumberOfBytesToProtect, IN ULONG NewAccessProtection, OUT PULONG UnsafeOldAccessProtection)
Definition: virtual.c:3076
static BOOLEAN NtUserPfnsInitialized
Definition: ntuserpfn.c:25
const NTUSER_PFN RtlpNtUserPfns
Definition: ntuserpfn.c:21
#define STATUS_SUCCESS
Definition: shellext.h:65
PVOID WndProcsW[RTLP_NUMBER_OF_NTUSER_WNDPROCS]
Definition: ntuserpfn.c:17
PVOID WorkerProcs[RTLP_NUMBER_OF_NTUSER_WORKERPROCS]
Definition: ntuserpfn.c:18
PVOID WndProcsA[RTLP_NUMBER_OF_NTUSER_WNDPROCS]
Definition: ntuserpfn.c:16
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135

◆ RtlRetrieveNtUserPfn()

NTSTATUS NTAPI RtlRetrieveNtUserPfn ( _Outptr_ const VOID **  NtdllWndProcsA,
_Outptr_ const VOID **  NtdllWndProcsW,
_Outptr_ const VOID **  NtdllWorkerProcs 
)

Definition at line 92 of file ntuserpfn.c.

96{
98 {
100 }
101
102 *NtdllWndProcsA = NtDllUserStubs.WndProcsA;
103 *NtdllWndProcsW = NtDllUserStubs.WndProcsW;
104 *NtdllWorkerProcs = NtDllUserStubs.WorkerProcs;
105
106 return STATUS_SUCCESS;
107}
const NTUSER_PFN NtDllUserStubs

Variable Documentation

◆ NtDllUserStubs

const NTUSER_PFN NtDllUserStubs
extern

Referenced by RtlRetrieveNtUserPfn().

◆ NtUserPfnsInitialized

BOOLEAN NtUserPfnsInitialized
static

Definition at line 25 of file ntuserpfn.c.

Referenced by RtlInitializeNtUserPfn(), and RtlRetrieveNtUserPfn().

◆ RtlpNtUserPfns

const NTUSER_PFN RtlpNtUserPfns = { 0 }

Definition at line 21 of file ntuserpfn.c.

Referenced by RtlInitializeNtUserPfn().