ReactOS 0.4.15-dev-8339-g4028de8
ps_x.h
Go to the documentation of this file.
1/*
2* PROJECT: ReactOS Kernel
3* LICENSE: GPL - See COPYING in the top level directory
4* FILE: ntoskrnl/include/internal/ps_x.h
5* PURPOSE: Internal Inlined Functions for the Process Manager
6* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7* Thomas Weidenmueller (w3seek@reactos.org)
8*/
9
10//
11// Extract Quantum Settings from the Priority Separation Mask
12//
13#define PspPrioritySeparationFromMask(Mask) \
14 ((Mask) & 3)
15
16#define PspQuantumTypeFromMask(Mask) \
17 ((Mask) & 12)
18
19#define PspQuantumLengthFromMask(Mask) \
20 ((Mask) & 48)
21
22//
23// Cross Thread Flag routines
24//
25#define PspSetCrossThreadFlag(Thread, Flag) \
26 InterlockedOr((PLONG)&Thread->CrossThreadFlags, Flag)
27#define PspClearCrossThreadFlag(Thread, Flag) \
28 InterlockedAnd((PLONG)&Thread->CrossThreadFlags, ~Flag)
29
30//
31// Process flag routines
32//
33#define PspSetProcessFlag(Process, Flag) \
34 InterlockedOr((PLONG)&Process->Flags, Flag)
35#define PspClearProcessFlag(Process, Flag) \
36 InterlockedAnd((PLONG)&Process->Flags, ~Flag)
37
39VOID
42{
43 ULONG i;
44
45 /* Check if we have registered routines */
47 {
48 /* Loop callbacks */
49 for (i = 0; i < PSP_MAX_CREATE_THREAD_NOTIFY; i++)
50 {
51 /* Do the callback */
53 CurrentThread->Cid.UniqueProcess,
54 CurrentThread->Cid.UniqueThread,
56 }
57 }
58}
59
61VOID
64{
65 ULONG i;
66
67 /* Check if we have registered routines */
69 {
70 /* Loop callbacks */
71 for (i = 0; i < PSP_MAX_CREATE_PROCESS_NOTIFY; i++)
72 {
73 /* Do the callback */
75 CurrentProcess->InheritedFromUniqueProcessId,
76 CurrentProcess->UniqueProcessId,
78 }
79 }
80}
81
83VOID
86 PIMAGE_INFO ImageInfo)
87{
88 ULONG i;
89
90 /* Loop the notify routines */
91 for (i = 0; i < PSP_MAX_LOAD_IMAGE_NOTIFY; ++ i)
92 {
93 /* Do the callback */
95 FullImageName,
97 ImageInfo);
98 }
99}
100
102VOID
104{
105 /* Call it */
107}
108
110VOID
112{
113 /* Enter a Critical Region */
115
116 /* Lock the Process */
117 ExAcquirePushLockShared(&Process->ProcessLock);
118}
119
121VOID
123{
124 /* Unlock the Process */
125 ExReleasePushLockShared(&Process->ProcessLock);
126
127 /* Leave Critical Region */
129}
130
132VOID
134{
135 /* Enter a Critical Region */
137
138 /* Lock the Process */
139 ExAcquirePushLockExclusive(&Process->ProcessLock);
140}
141
143VOID
145{
146 /* Unlock the Process */
147 ExReleasePushLockExclusive(&Process->ProcessLock);
148
149 /* Leave Critical Region */
151}
152
154VOID
156{
157 /* Enter a Critical Region */
159
160 /* Lock the Thread */
162}
163
165VOID
167{
168 /* Unlock the Thread */
170
171 /* Leave Critical Region */
173}
174
176VOID
178{
179 /* Enter a Critical Region */
181
182 /* Lock the Thread */
184}
185
187VOID
189{
190 /* Unlock the Process */
192
193 /* Leave Critical Thread */
195}
196
200{
201 /* Get the current process */
202 return (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
203}
unsigned char BOOLEAN
@ Create
Definition: registry.c:563
FORCEINLINE VOID ExDoCallBack(IN OUT PEX_CALLBACK Callback, IN PVOID Context, IN PVOID Argument1, IN PVOID Argument2)
Definition: ex.h:553
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1036
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1105
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1213
FORCEINLINE VOID ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1252
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2711
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define KeGetCurrentThread
Definition: hal.h:55
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
EX_CALLBACK PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY]
Definition: psnotify.c:23
PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine
Definition: psnotify.c:24
#define PSP_MAX_CREATE_PROCESS_NOTIFY
Definition: ps.h:66
ULONG PspProcessNotifyRoutineCount
Definition: ps.h:463
EX_CALLBACK PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY]
Definition: psnotify.c:21
ULONG PspThreadNotifyRoutineCount
Definition: psnotify.c:19
#define PSP_MAX_LOAD_IMAGE_NOTIFY
Definition: ps.h:65
#define PSP_MAX_CREATE_THREAD_NOTIFY
Definition: ps.h:64
EX_CALLBACK PspProcessNotifyRoutine[PSP_MAX_CREATE_PROCESS_NOTIFY]
Definition: psnotify.c:22
FORCEINLINE VOID PspUnlockProcessSecurityExclusive(IN PEPROCESS Process)
Definition: ps_x.h:144
FORCEINLINE VOID PspRunLegoRoutine(IN PKTHREAD Thread)
Definition: ps_x.h:103
FORCEINLINE VOID PspUnlockThreadSecurityShared(IN PETHREAD Thread)
Definition: ps_x.h:166
FORCEINLINE VOID PspLockThreadSecurityExclusive(IN PETHREAD Thread)
Definition: ps_x.h:177
FORCEINLINE VOID PspUnlockProcessSecurityShared(IN PEPROCESS Process)
Definition: ps_x.h:122
FORCEINLINE VOID PspUnlockThreadSecurityExclusive(IN PETHREAD Thread)
Definition: ps_x.h:188
FORCEINLINE VOID PspRunLoadImageNotifyRoutines(PUNICODE_STRING FullImageName, HANDLE ProcessId, PIMAGE_INFO ImageInfo)
Definition: ps_x.h:84
FORCEINLINE VOID PspRunCreateThreadNotifyRoutines(IN PETHREAD CurrentThread, IN BOOLEAN Create)
Definition: ps_x.h:40
FORCEINLINE PEPROCESS _PsGetCurrentProcess(VOID)
Definition: ps_x.h:199
FORCEINLINE VOID PspRunCreateProcessNotifyRoutines(IN PEPROCESS CurrentProcess, IN BOOLEAN Create)
Definition: ps_x.h:62
FORCEINLINE VOID PspLockProcessSecurityExclusive(IN PEPROCESS Process)
Definition: ps_x.h:133
FORCEINLINE VOID PspLockThreadSecurityShared(IN PETHREAD Thread)
Definition: ps_x.h:155
FORCEINLINE VOID PspLockProcessSecurityShared(IN PEPROCESS Process)
Definition: ps_x.h:111
EX_PUSH_LOCK ThreadLock
Definition: pstypes.h:1160
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define FORCEINLINE
Definition: wdftypes.h:67