ReactOS  0.4.13-dev-563-g0561610
PsNotify.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS kernel-mode tests
3  * LICENSE: GPLv2+ - See COPYING in the top level directory
4  * PURPOSE: Kernel-Mode Test Suite Process Notification Routines test
5  * PROGRAMMER: Thomas Faber <thomas.faber@reactos.org>
6  */
7 
8 #include <kmt_test.h>
9 
10 //#define NDEBUG
11 #include <debug.h>
12 
13 static
14 VOID
15 NTAPI
17  IN HANDLE ParentId,
20 {
21  ok_irql(PASSIVE_LEVEL);
22  if (!Create)
24  else
26  "ProcessId %p equals current\n", ProcessId);
27  DPRINT("%s(%p, %p, %d)\n", __FUNCTION__, ParentId, ProcessId, Create);
28 }
29 
30 static
31 VOID
33 {
35 
38 
41 
44 
47 
50 
53 
54  /* TODO: test whether the callback is notified on process creation */
55 
58 
61 
62  /* TODO: register the same routine twice */
63  /* TODO: register more than the maximum number of notifications */
64 }
65 
66 static
67 VOID
68 NTAPI
71  IN HANDLE ThreadId,
73 {
74  ok_irql(PASSIVE_LEVEL);
75  if (!Create)
76  {
79  }
80  else
81  {
82  ok(ThreadId != PsGetCurrentThreadId(),
83  "ThreadId %p equals current\n", ThreadId);
84  }
85  DPRINT("%s(%p, %p, %d)\n", __FUNCTION__, ProcessId, ThreadId, Create);
86 }
87 
88 static
89 VOID
91 {
93 
96 
99 
102 
105 
108 
111 
112  /* TODO: test whether the callback is notified on thread creation */
113 
116 
119 
120  /* TODO: register the same routine twice */
121  /* TODO: register more than the maximum number of notifications */
122 }
123 
124 static
125 VOID
126 NTAPI
128  IN PUNICODE_STRING FullImageName OPTIONAL,
130  IN PIMAGE_INFO ImageInfo)
131 {
132  ok_irql(PASSIVE_LEVEL);
133  DPRINT("%s('%wZ', %p, %p)\n", __FUNCTION__, FullImageName, ProcessId, ImageInfo);
134 }
135 
136 static
137 VOID
139 {
141 
144 
147 
150 
153 
156 
159 
160  /* TODO: test whether the callback is notified on image load */
161 
164 
167 
168  /* TODO: register the same routine twice */
169  /* TODO: register more than the maximum number of notifications */
170 }
171 
172 START_TEST(PsNotify)
173 {
177 }
#define IN
Definition: typedefs.h:38
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define TRUE
Definition: types.h:120
_In_ BOOLEAN Create
Definition: pstypes.h:511
#define ok_eq_pointer(value, expected)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI PsRemoveLoadImageNotifyRoutine(IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:127
static VOID TestCreateThreadNotify(VOID)
Definition: PsNotify.c:90
static VOID TestLoadImageNotify(VOID)
Definition: PsNotify.c:138
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define ok(value,...)
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PsGetCurrentThreadId
Definition: CrNtStubs.h:7
static VOID NTAPI CreateProcessNotifyRoutine(IN HANDLE ParentId, IN HANDLE ProcessId, IN BOOLEAN Create)
Definition: PsNotify.c:16
static VOID NTAPI LoadImageNotifyRoutine(IN PUNICODE_STRING FullImageName OPTIONAL, IN HANDLE ProcessId, IN PIMAGE_INFO ImageInfo)
Definition: PsNotify.c:127
NTSTATUS NTAPI PsSetLoadImageNotifyRoutine(IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:176
NTSTATUS NTAPI PsSetCreateThreadNotifyRoutine(IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:260
START_TEST(PsNotify)
Definition: PsNotify.c:172
NTSTATUS NTAPI PsRemoveCreateThreadNotifyRoutine(IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:211
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:24
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
#define STATUS_PROCEDURE_NOT_FOUND
Definition: ntstatus.h:344
static VOID NTAPI CreateThreadNotifyRoutine(IN HANDLE ProcessId, IN HANDLE ThreadId, IN BOOLEAN Create)
Definition: PsNotify.c:69
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define __FUNCTION__
Definition: types.h:112
static VOID TestCreateProcessNotify(VOID)
Definition: PsNotify.c:32
NTSTATUS NTAPI PsSetCreateProcessNotifyRoutine(IN PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine, IN BOOLEAN Remove)
Definition: psnotify.c:33
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68