ReactOS  0.4.13-dev-52-g0efcfec
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 
39 VOID
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 
61 VOID
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 
83 VOID
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,
96  ProcessId,
97  ImageInfo);
98  }
99 }
100 
102 VOID
104 {
105  /* Call it */
107 }
108 
110 VOID
112 {
113  /* Enter a Critical Region */
115 
116  /* Lock the Process */
117  ExAcquirePushLockShared(&Process->ProcessLock);
118 }
119 
121 VOID
123 {
124  /* Unlock the Process */
125  ExReleasePushLockShared(&Process->ProcessLock);
126 
127  /* Leave Critical Region */
129 }
130 
132 VOID
134 {
135  /* Enter a Critical Region */
137 
138  /* Lock the Process */
139  ExAcquirePushLockExclusive(&Process->ProcessLock);
140 }
141 
143 VOID
145 {
146  /* Unlock the Process */
147  ExReleasePushLockExclusive(&Process->ProcessLock);
148 
149  /* Leave Critical Region */
151 }
152 
154 VOID
156 {
157  /* Enter a Critical Region */
159 
160  /* Lock the Thread */
162 }
163 
165 VOID
167 {
168  /* Unlock the Thread */
170 
171  /* Leave Critical Region */
173 }
174 
176 VOID
178 {
179  /* Enter a Critical Region */
181 
182  /* Lock the Thread */
184 }
185 
187 VOID
189 {
190  /* Unlock the Process */
192 
193  /* Leave Critical Thread */
195 }
196 
198 PEPROCESS
200 {
201  /* Get the current process */
202  return (PEPROCESS)KeGetCurrentThread()->ApcState.Process;
203 }
#define PSP_MAX_CREATE_PROCESS_NOTIFY
Definition: ps.h:66
FORCEINLINE VOID ExAcquirePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1022
#define IN
Definition: typedefs.h:38
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
FORCEINLINE VOID PspUnlockThreadSecurityExclusive(IN PETHREAD Thread)
Definition: ps_x.h:188
FORCEINLINE VOID PspLockThreadSecurityShared(IN PETHREAD Thread)
Definition: ps_x.h:155
PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine
Definition: psnotify.c:24
FORCEINLINE VOID PspLockProcessSecurityExclusive(IN PEPROCESS Process)
Definition: ps_x.h:133
_In_ BOOLEAN Create
Definition: pstypes.h:511
FORCEINLINE PEPROCESS _PsGetCurrentProcess(VOID)
Definition: ps_x.h:199
uint32_t ULONG_PTR
Definition: typedefs.h:63
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
EX_CALLBACK PspProcessNotifyRoutine[PSP_MAX_CREATE_PROCESS_NOTIFY]
Definition: psnotify.c:22
FORCEINLINE VOID PspUnlockProcessSecurityShared(IN PEPROCESS Process)
Definition: ps_x.h:122
FORCEINLINE VOID ExReleasePushLockExclusive(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1238
unsigned char BOOLEAN
#define FORCEINLINE
Definition: ntbasedef.h:221
#define PSP_MAX_CREATE_THREAD_NOTIFY
Definition: ps.h:64
#define PSP_MAX_LOAD_IMAGE_NOTIFY
Definition: ps.h:65
ULONG CurrentProcess
Definition: shell.c:125
ULONG PspProcessNotifyRoutineCount
Definition: psnotify.c:19
FORCEINLINE VOID PspRunCreateProcessNotifyRoutines(IN PEPROCESS CurrentProcess, IN BOOLEAN Create)
Definition: ps_x.h:62
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
EX_CALLBACK PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY]
Definition: psnotify.c:21
FORCEINLINE VOID PspRunLoadImageNotifyRoutines(PUNICODE_STRING FullImageName, HANDLE ProcessId, PIMAGE_INFO ImageInfo)
Definition: ps_x.h:84
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
FORCEINLINE VOID PspUnlockThreadSecurityShared(IN PETHREAD Thread)
Definition: ps_x.h:166
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1091
FORCEINLINE VOID PspRunCreateThreadNotifyRoutines(IN PETHREAD CurrentThread, IN BOOLEAN Create)
Definition: ps_x.h:40
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
FORCEINLINE VOID ExDoCallBack(IN OUT PEX_CALLBACK Callback, IN PVOID Context, IN PVOID Argument1, IN PVOID Argument2)
Definition: ex.h:539
ULONG PspThreadNotifyRoutineCount
Definition: psnotify.c:19
FORCEINLINE VOID PspRunLegoRoutine(IN PKTHREAD Thread)
Definition: ps_x.h:103
FORCEINLINE VOID PspLockProcessSecurityShared(IN PEPROCESS Process)
Definition: ps_x.h:111
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1199
unsigned int ULONG
Definition: retypes.h:1
FORCEINLINE VOID PspUnlockProcessSecurityExclusive(IN PEPROCESS Process)
Definition: ps_x.h:144
FORCEINLINE VOID PspLockThreadSecurityExclusive(IN PETHREAD Thread)
Definition: ps_x.h:177
EX_PUSH_LOCK ThreadLock
Definition: pstypes.h:1091
#define KeGetCurrentThread
Definition: hal.h:44
EX_CALLBACK PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY]
Definition: psnotify.c:23