ReactOS  0.4.12-dev-720-g6accaef
psnotify.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for psnotify.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS NTAPI PsSetCreateProcessNotifyRoutine (IN PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine, IN BOOLEAN Remove)
 
ULONG NTAPI PsSetLegoNotifyRoutine (PVOID LegoNotifyRoutine)
 
NTSTATUS NTAPI PsRemoveLoadImageNotifyRoutine (IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
 
NTSTATUS NTAPI PsSetLoadImageNotifyRoutine (IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
 
NTSTATUS NTAPI PsRemoveCreateThreadNotifyRoutine (IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine)
 
NTSTATUS NTAPI PsSetCreateThreadNotifyRoutine (IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine)
 

Variables

BOOLEAN PsImageNotifyEnabled = FALSE
 
ULONG PspThreadNotifyRoutineCount
 
ULONG PspProcessNotifyRoutineCount
 
ULONG PspLoadImageNotifyRoutineCount
 
EX_CALLBACK PspThreadNotifyRoutine [PSP_MAX_CREATE_THREAD_NOTIFY]
 
EX_CALLBACK PspProcessNotifyRoutine [PSP_MAX_CREATE_PROCESS_NOTIFY]
 
EX_CALLBACK PspLoadImageNotifyRoutine [PSP_MAX_LOAD_IMAGE_NOTIFY]
 
PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file psnotify.c.

Function Documentation

◆ PsRemoveCreateThreadNotifyRoutine()

NTSTATUS NTAPI PsRemoveCreateThreadNotifyRoutine ( IN PCREATE_THREAD_NOTIFY_ROUTINE  NotifyRoutine)

Definition at line 211 of file psnotify.c.

212 {
213  ULONG i;
215  PAGED_CODE();
216 
217  /* Loop all callbacks */
218  for (i = 0; i < PSP_MAX_CREATE_THREAD_NOTIFY; i++)
219  {
220  /* Reference this slot */
222  if (CallBack)
223  {
224  /* Check for a match */
225  if (ExGetCallBackBlockRoutine(CallBack) == (PVOID)NotifyRoutine)
226  {
227  /* Try removing it if it matches */
229  NULL,
230  CallBack))
231  {
232  /* We removed it, now dereference the block */
235  CallBack);
236 
237  /* Wait for active callbacks */
238  ExWaitForCallBacks(CallBack);
239 
240  /* Free the callback and return */
241  ExFreeCallBack(CallBack);
242  return STATUS_SUCCESS;
243  }
244  }
245 
246  /* Dereference the callback */
248  }
249  }
250 
251  /* Nothing found to remove */
253 }
#define PAGED_CODE()
Definition: video.h:57
EX_CALLBACK PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY]
Definition: psnotify.c:21
ULONG PspThreadNotifyRoutineCount
Definition: psnotify.c:19
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
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExReferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack)
Definition: callback.c:122
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN NTAPI ExCompareExchangeCallBack(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK NewBlock, IN PEX_CALLBACK_ROUTINE_BLOCK OldBlock)
Definition: callback.c:170
#define PSP_MAX_CREATE_THREAD_NOTIFY
Definition: ps.h:64
#define InterlockedDecrement
Definition: armddk.h:52
PEX_CALLBACK_FUNCTION NTAPI ExGetCallBackBlockRoutine(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:93
VOID NTAPI ExDereferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:109
VOID NTAPI ExWaitForCallBacks(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:85
#define STATUS_PROCEDURE_NOT_FOUND
Definition: ntstatus.h:344
VOID NTAPI ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:77
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
signed int * PLONG
Definition: retypes.h:5

Referenced by TestCreateThreadNotify().

◆ PsRemoveLoadImageNotifyRoutine()

NTSTATUS NTAPI PsRemoveLoadImageNotifyRoutine ( IN PLOAD_IMAGE_NOTIFY_ROUTINE  NotifyRoutine)

Definition at line 127 of file psnotify.c.

128 {
129  ULONG i;
131  PAGED_CODE();
132 
133  /* Loop all callbacks */
134  for (i = 0; i < PSP_MAX_LOAD_IMAGE_NOTIFY; i++)
135  {
136  /* Reference this slot */
138  if (CallBack)
139  {
140  /* Check for a match */
141  if (ExGetCallBackBlockRoutine(CallBack) == (PVOID)NotifyRoutine)
142  {
143  /* Try removing it if it matches */
145  NULL,
146  CallBack))
147  {
148  /* We removed it, now dereference the block */
151  CallBack);
152 
153  /* Wait for active callbacks */
154  ExWaitForCallBacks(CallBack);
155 
156  /* Free the callback and return */
157  ExFreeCallBack(CallBack);
158  return STATUS_SUCCESS;
159  }
160  }
161 
162  /* Dereference the callback */
164  }
165  }
166 
167  /* Nothing found to remove */
169 }
#define PAGED_CODE()
Definition: video.h:57
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
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExReferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack)
Definition: callback.c:122
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN NTAPI ExCompareExchangeCallBack(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK NewBlock, IN PEX_CALLBACK_ROUTINE_BLOCK OldBlock)
Definition: callback.c:170
#define PSP_MAX_LOAD_IMAGE_NOTIFY
Definition: ps.h:65
ULONG PspLoadImageNotifyRoutineCount
Definition: psnotify.c:20
#define InterlockedDecrement
Definition: armddk.h:52
EX_CALLBACK PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY]
Definition: psnotify.c:23
PEX_CALLBACK_FUNCTION NTAPI ExGetCallBackBlockRoutine(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:93
VOID NTAPI ExDereferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:109
VOID NTAPI ExWaitForCallBacks(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:85
#define STATUS_PROCEDURE_NOT_FOUND
Definition: ntstatus.h:344
VOID NTAPI ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:77
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
signed int * PLONG
Definition: retypes.h:5

Referenced by TestLoadImageNotify().

◆ PsSetCreateProcessNotifyRoutine()

NTSTATUS NTAPI PsSetCreateProcessNotifyRoutine ( IN PCREATE_PROCESS_NOTIFY_ROUTINE  NotifyRoutine,
IN BOOLEAN  Remove 
)

Definition at line 33 of file psnotify.c.

35 {
36  ULONG i;
38  PAGED_CODE();
39 
40  /* Check if we're removing */
41  if (Remove)
42  {
43  /* Loop all the routines */
44  for (i = 0; i < PSP_MAX_CREATE_PROCESS_NOTIFY; i++)
45  {
46  /* Reference the callback block */
48  if (!CallBack) continue;
49 
50  /* Check it this is a matching block */
51  if (ExGetCallBackBlockRoutine(CallBack) == (PVOID)NotifyRoutine)
52  {
53  /* Try removing it if it matches */
55  NULL,
56  CallBack))
57  {
58  /* Decrement the number of routines */
60 
61  /* Dereference the block */
63  CallBack);
64 
65  /* Wait for active callbacks */
66  ExWaitForCallBacks(CallBack);
67 
68  /* Free the callback and exit */
69  ExFreeCallBack(CallBack);
70  return STATUS_SUCCESS;
71  }
72 
73  /* Dereference the block */
75  CallBack);
76  }
77  }
78 
79  /* We didn't find any matching block */
81  }
82  else
83  {
84  /* Allocate a callback */
85  CallBack = ExAllocateCallBack((PVOID)NotifyRoutine, NULL);
86  if (!CallBack) return STATUS_INSUFFICIENT_RESOURCES;
87 
88  /* Loop all callbacks */
89  for (i = 0; i < PSP_MAX_CREATE_PROCESS_NOTIFY; i++)
90  {
91  /* Add this routine if it's an empty slot */
93  CallBack,
94  NULL))
95  {
96  /* Found and inserted into an empty slot, return */
98  return STATUS_SUCCESS;
99  }
100  }
101 
102  /* We didn't find a free slot, free the callback and fail */
103  ExFreeCallBack(CallBack);
105  }
106 }
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExAllocateCallBack(IN PEX_CALLBACK_FUNCTION Function, IN PVOID Context)
Definition: callback.c:54
#define PSP_MAX_CREATE_PROCESS_NOTIFY
Definition: ps.h:66
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define PAGED_CODE()
Definition: video.h:57
EX_CALLBACK PspProcessNotifyRoutine[PSP_MAX_CREATE_PROCESS_NOTIFY]
Definition: psnotify.c:22
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
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExReferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack)
Definition: callback.c:122
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN NTAPI ExCompareExchangeCallBack(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK NewBlock, IN PEX_CALLBACK_ROUTINE_BLOCK OldBlock)
Definition: callback.c:170
_In_ BOOLEAN Remove
Definition: psfuncs.h:110
ULONG PspProcessNotifyRoutineCount
Definition: psnotify.c:19
#define InterlockedDecrement
Definition: armddk.h:52
PEX_CALLBACK_FUNCTION NTAPI ExGetCallBackBlockRoutine(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:93
VOID NTAPI ExDereferenceCallBackBlock(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:109
#define InterlockedIncrement
Definition: armddk.h:53
VOID NTAPI ExWaitForCallBacks(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:85
#define STATUS_PROCEDURE_NOT_FOUND
Definition: ntstatus.h:344
VOID NTAPI ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:77
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
signed int * PLONG
Definition: retypes.h:5

Referenced by TestCreateProcessNotify().

◆ PsSetCreateThreadNotifyRoutine()

NTSTATUS NTAPI PsSetCreateThreadNotifyRoutine ( IN PCREATE_THREAD_NOTIFY_ROUTINE  NotifyRoutine)

Definition at line 260 of file psnotify.c.

261 {
262  ULONG i;
264  PAGED_CODE();
265 
266  /* Allocate a callback */
267  CallBack = ExAllocateCallBack((PVOID)NotifyRoutine, NULL);
268  if (!CallBack) return STATUS_INSUFFICIENT_RESOURCES;
269 
270  /* Loop callbacks */
271  for (i = 0; i < PSP_MAX_CREATE_THREAD_NOTIFY; i++)
272  {
273  /* Add this entry if the slot is empty */
275  CallBack,
276  NULL))
277  {
278  /* Return success */
280  return STATUS_SUCCESS;
281  }
282  }
283 
284  /* No free space found, fail */
285  ExFreeCallBack(CallBack);
287 }
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExAllocateCallBack(IN PEX_CALLBACK_FUNCTION Function, IN PVOID Context)
Definition: callback.c:54
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PAGED_CODE()
Definition: video.h:57
EX_CALLBACK PspThreadNotifyRoutine[PSP_MAX_CREATE_THREAD_NOTIFY]
Definition: psnotify.c:21
ULONG PspThreadNotifyRoutineCount
Definition: psnotify.c:19
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
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN NTAPI ExCompareExchangeCallBack(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK NewBlock, IN PEX_CALLBACK_ROUTINE_BLOCK OldBlock)
Definition: callback.c:170
#define PSP_MAX_CREATE_THREAD_NOTIFY
Definition: ps.h:64
#define InterlockedIncrement
Definition: armddk.h:53
VOID NTAPI ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:77
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
signed int * PLONG
Definition: retypes.h:5

Referenced by TestCreateThreadNotify().

◆ PsSetLegoNotifyRoutine()

ULONG NTAPI PsSetLegoNotifyRoutine ( PVOID  LegoNotifyRoutine)

Definition at line 113 of file psnotify.c.

114 {
115  /* Set the System-Wide Lego Routine */
116  PspLegoNotifyRoutine = LegoNotifyRoutine;
117 
118  /* Return the location to the Lego Data */
119  return FIELD_OFFSET(KTHREAD, LegoData);
120 }
PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine
Definition: psnotify.c:24
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254

◆ PsSetLoadImageNotifyRoutine()

NTSTATUS NTAPI PsSetLoadImageNotifyRoutine ( IN PLOAD_IMAGE_NOTIFY_ROUTINE  NotifyRoutine)

Definition at line 176 of file psnotify.c.

177 {
178  ULONG i;
180  PAGED_CODE();
181 
182  /* Allocate a callback */
183  CallBack = ExAllocateCallBack((PVOID)NotifyRoutine, NULL);
184  if (!CallBack) return STATUS_INSUFFICIENT_RESOURCES;
185 
186  /* Loop callbacks */
187  for (i = 0; i < PSP_MAX_LOAD_IMAGE_NOTIFY; i++)
188  {
189  /* Add this entry if the slot is empty */
191  CallBack,
192  NULL))
193  {
194  /* Return success */
197  return STATUS_SUCCESS;
198  }
199  }
200 
201  /* No free space found, fail */
202  ExFreeCallBack(CallBack);
204 }
BOOLEAN PsImageNotifyEnabled
Definition: psnotify.c:18
PEX_CALLBACK_ROUTINE_BLOCK NTAPI ExAllocateCallBack(IN PEX_CALLBACK_FUNCTION Function, IN PVOID Context)
Definition: callback.c:54
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define PAGED_CODE()
Definition: video.h:57
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
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN NTAPI ExCompareExchangeCallBack(IN OUT PEX_CALLBACK CallBack, IN PEX_CALLBACK_ROUTINE_BLOCK NewBlock, IN PEX_CALLBACK_ROUTINE_BLOCK OldBlock)
Definition: callback.c:170
#define PSP_MAX_LOAD_IMAGE_NOTIFY
Definition: ps.h:65
ULONG PspLoadImageNotifyRoutineCount
Definition: psnotify.c:20
EX_CALLBACK PspLoadImageNotifyRoutine[PSP_MAX_LOAD_IMAGE_NOTIFY]
Definition: psnotify.c:23
#define InterlockedIncrement
Definition: armddk.h:53
VOID NTAPI ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
Definition: callback.c:77
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
signed int * PLONG
Definition: retypes.h:5

Referenced by TestLoadImageNotify().

Variable Documentation

◆ PsImageNotifyEnabled

BOOLEAN PsImageNotifyEnabled = FALSE

Definition at line 18 of file psnotify.c.

Referenced by DbgkCreateThread(), MmLoadSystemImage(), and PsSetLoadImageNotifyRoutine().

◆ PspLegoNotifyRoutine

PLEGO_NOTIFY_ROUTINE PspLegoNotifyRoutine

Definition at line 24 of file psnotify.c.

Referenced by PspRunLegoRoutine(), and PsSetLegoNotifyRoutine().

◆ PspLoadImageNotifyRoutine

◆ PspLoadImageNotifyRoutineCount

ULONG PspLoadImageNotifyRoutineCount

Definition at line 20 of file psnotify.c.

Referenced by PsRemoveLoadImageNotifyRoutine(), and PsSetLoadImageNotifyRoutine().

◆ PspProcessNotifyRoutine

◆ PspProcessNotifyRoutineCount

ULONG PspProcessNotifyRoutineCount

◆ PspThreadNotifyRoutine

◆ PspThreadNotifyRoutineCount

ULONG PspThreadNotifyRoutineCount