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>
16 CreateProcessNotifyRoutine(
21 ok_irql(PASSIVE_LEVEL
);
23 ok_eq_pointer(ProcessId
, PsGetCurrentProcessId());
25 ok(ProcessId
!= PsGetCurrentProcessId(),
26 "ProcessId %p equals current\n", ProcessId
);
27 DPRINT("%s(%p, %p, %d)\n", __FUNCTION__
, ParentId
, ProcessId
, Create
);
32 TestCreateProcessNotify(VOID
)
36 Status
= PsSetCreateProcessNotifyRoutine(NULL
, TRUE
);
37 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
39 Status
= PsSetCreateProcessNotifyRoutine(NULL
, FALSE
);
40 ok_eq_hex(Status
, STATUS_SUCCESS
);
42 Status
= PsSetCreateProcessNotifyRoutine(NULL
, TRUE
);
43 ok_eq_hex(Status
, STATUS_SUCCESS
);
45 Status
= PsSetCreateProcessNotifyRoutine(NULL
, TRUE
);
46 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
48 Status
= PsSetCreateProcessNotifyRoutine(CreateProcessNotifyRoutine
, TRUE
);
49 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
51 Status
= PsSetCreateProcessNotifyRoutine(CreateProcessNotifyRoutine
, FALSE
);
52 ok_eq_hex(Status
, STATUS_SUCCESS
);
54 /* TODO: test whether the callback is notified on process creation */
56 Status
= PsSetCreateProcessNotifyRoutine(CreateProcessNotifyRoutine
, TRUE
);
57 ok_eq_hex(Status
, STATUS_SUCCESS
);
59 Status
= PsSetCreateProcessNotifyRoutine(CreateProcessNotifyRoutine
, TRUE
);
60 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
62 /* TODO: register the same routine twice */
63 /* TODO: register more than the maximum number of notifications */
69 CreateThreadNotifyRoutine(
74 ok_irql(PASSIVE_LEVEL
);
77 ok_eq_pointer(ProcessId
, PsGetCurrentProcessId());
78 ok_eq_pointer(ThreadId
, PsGetCurrentThreadId());
82 ok(ThreadId
!= PsGetCurrentThreadId(),
83 "ThreadId %p equals current\n", ThreadId
);
85 DPRINT("%s(%p, %p, %d)\n", __FUNCTION__
, ProcessId
, ThreadId
, Create
);
90 TestCreateThreadNotify(VOID
)
94 Status
= PsRemoveCreateThreadNotifyRoutine(NULL
);
95 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
97 Status
= PsSetCreateThreadNotifyRoutine(NULL
);
98 ok_eq_hex(Status
, STATUS_SUCCESS
);
100 Status
= PsRemoveCreateThreadNotifyRoutine(NULL
);
101 ok_eq_hex(Status
, STATUS_SUCCESS
);
103 Status
= PsRemoveCreateThreadNotifyRoutine(NULL
);
104 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
106 Status
= PsRemoveCreateThreadNotifyRoutine(CreateThreadNotifyRoutine
);
107 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
109 Status
= PsSetCreateThreadNotifyRoutine(CreateThreadNotifyRoutine
);
110 ok_eq_hex(Status
, STATUS_SUCCESS
);
112 /* TODO: test whether the callback is notified on thread creation */
114 Status
= PsRemoveCreateThreadNotifyRoutine(CreateThreadNotifyRoutine
);
115 ok_eq_hex(Status
, STATUS_SUCCESS
);
117 Status
= PsRemoveCreateThreadNotifyRoutine(CreateThreadNotifyRoutine
);
118 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
120 /* TODO: register the same routine twice */
121 /* TODO: register more than the maximum number of notifications */
127 LoadImageNotifyRoutine(
128 IN PUNICODE_STRING FullImageName OPTIONAL
,
130 IN PIMAGE_INFO ImageInfo
)
132 ok_irql(PASSIVE_LEVEL
);
133 DPRINT("%s('%wZ', %p, %p)\n", __FUNCTION__
, FullImageName
, ProcessId
, ImageInfo
);
138 TestLoadImageNotify(VOID
)
142 Status
= PsRemoveLoadImageNotifyRoutine(NULL
);
143 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
145 Status
= PsSetLoadImageNotifyRoutine(NULL
);
146 ok_eq_hex(Status
, STATUS_SUCCESS
);
148 Status
= PsRemoveLoadImageNotifyRoutine(NULL
);
149 ok_eq_hex(Status
, STATUS_SUCCESS
);
151 Status
= PsRemoveLoadImageNotifyRoutine(NULL
);
152 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
154 Status
= PsRemoveLoadImageNotifyRoutine(LoadImageNotifyRoutine
);
155 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
157 Status
= PsSetLoadImageNotifyRoutine(LoadImageNotifyRoutine
);
158 ok_eq_hex(Status
, STATUS_SUCCESS
);
160 /* TODO: test whether the callback is notified on image load */
162 Status
= PsRemoveLoadImageNotifyRoutine(LoadImageNotifyRoutine
);
163 ok_eq_hex(Status
, STATUS_SUCCESS
);
165 Status
= PsRemoveLoadImageNotifyRoutine(LoadImageNotifyRoutine
);
166 ok_eq_hex(Status
, STATUS_PROCEDURE_NOT_FOUND
);
168 /* TODO: register the same routine twice */
169 /* TODO: register more than the maximum number of notifications */
174 TestCreateProcessNotify();
175 TestCreateThreadNotify();
176 TestLoadImageNotify();