Process Hacker
nttp.h
Go to the documentation of this file.
1 #ifndef _NTTP_H
2 #define _NTTP_H
3 
4 // Some types are already defined in winnt.h.
5 
6 typedef struct _TP_ALPC TP_ALPC, *PTP_ALPC;
7 
8 // private
9 typedef VOID (NTAPI *PTP_ALPC_CALLBACK)(
10  _Inout_ PTP_CALLBACK_INSTANCE Instance,
11  _Inout_opt_ PVOID Context,
12  _In_ PTP_ALPC Alpc
13  );
14 
15 // rev
16 typedef VOID (NTAPI *PTP_ALPC_CALLBACK_EX)(
17  _Inout_ PTP_CALLBACK_INSTANCE Instance,
18  _Inout_opt_ PVOID Context,
19  _In_ PTP_ALPC Alpc,
20  _In_ PVOID ApcContext
21  );
22 
23 #if (PHNT_VERSION >= PHNT_VISTA)
24 
25 // private
26 _Check_return_
27 NTSYSAPI
28 NTSTATUS
29 NTAPI
31  _Out_ PTP_POOL *PoolReturn,
32  _Reserved_ PVOID Reserved
33  );
34 
35 // winbase:CloseThreadpool
36 NTSYSAPI
37 VOID
38 NTAPI
40  _Inout_ PTP_POOL Pool
41  );
42 
43 // winbase:SetThreadpoolThreadMaximum
44 NTSYSAPI
45 VOID
46 NTAPI
48  _Inout_ PTP_POOL Pool,
49  _In_ LONG MaxThreads
50  );
51 
52 // private
53 NTSYSAPI
54 NTSTATUS
55 NTAPI
57  _Inout_ PTP_POOL Pool,
58  _In_ LONG MinThreads
59  );
60 
61 #if (PHNT_VERSION >= PHNT_WIN7)
62 // rev
63 NTSYSAPI
64 NTSTATUS
65 NTAPI
67  _In_ PTP_POOL Pool,
68  _Out_ PTP_POOL_STACK_INFORMATION PoolStackInformation
69  );
70 #endif
71 
72 #if (PHNT_VERSION >= PHNT_WIN7)
73 // rev
74 NTSYSAPI
75 NTSTATUS
76 NTAPI
78  _Inout_ PTP_POOL Pool,
79  _In_ PTP_POOL_STACK_INFORMATION PoolStackInformation
80  );
81 #endif
82 
83 // private
84 _Check_return_
85 NTSYSAPI
86 NTSTATUS
87 NTAPI
89  _Out_ PTP_CLEANUP_GROUP *CleanupGroupReturn
90  );
91 
92 // winbase:CloseThreadpoolCleanupGroup
93 NTSYSAPI
94 VOID
95 NTAPI
97  _Inout_ PTP_CLEANUP_GROUP CleanupGroup
98  );
99 
100 // winbase:CloseThreadpoolCleanupGroupMembers
101 NTSYSAPI
102 VOID
103 NTAPI
105  _Inout_ PTP_CLEANUP_GROUP CleanupGroup,
106  _In_ LOGICAL CancelPendingCallbacks,
107  _Inout_opt_ PVOID CleanupParameter
108  );
109 
110 // winbase:SetEventWhenCallbackReturns
111 NTSYSAPI
112 VOID
113 NTAPI
115  _Inout_ PTP_CALLBACK_INSTANCE Instance,
116  _In_ HANDLE Event
117  );
118 
119 // winbase:ReleaseSemaphoreWhenCallbackReturns
120 NTSYSAPI
121 VOID
122 NTAPI
124  _Inout_ PTP_CALLBACK_INSTANCE Instance,
125  _In_ HANDLE Semaphore,
126  _In_ LONG ReleaseCount
127  );
128 
129 // winbase:ReleaseMutexWhenCallbackReturns
130 NTSYSAPI
131 VOID
132 NTAPI
134  _Inout_ PTP_CALLBACK_INSTANCE Instance,
135  _In_ HANDLE Mutex
136  );
137 
138 // winbase:LeaveCriticalSectionWhenCallbackReturns
139 NTSYSAPI
140 VOID
141 NTAPI
143  _Inout_ PTP_CALLBACK_INSTANCE Instance,
144  _Inout_ PRTL_CRITICAL_SECTION CriticalSection
145  );
146 
147 // winbase:FreeLibraryWhenCallbackReturns
148 NTSYSAPI
149 VOID
150 NTAPI
152  _Inout_ PTP_CALLBACK_INSTANCE Instance,
153  _In_ PVOID DllHandle
154  );
155 
156 // winbase:CallbackMayRunLong
157 NTSYSAPI
158 NTSTATUS
159 NTAPI
161  _Inout_ PTP_CALLBACK_INSTANCE Instance
162  );
163 
164 // winbase:DisassociateCurrentThreadFromCallback
165 NTSYSAPI
166 VOID
167 NTAPI
169  _Inout_ PTP_CALLBACK_INSTANCE Instance
170  );
171 
172 // winbase:TrySubmitThreadpoolCallback
173 _Check_return_
174 NTSYSAPI
175 NTSTATUS
176 NTAPI
178  _In_ PTP_SIMPLE_CALLBACK Callback,
179  _Inout_opt_ PVOID Context,
180  _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
181  );
182 
183 // private
184 _Check_return_
185 NTSYSAPI
186 NTSTATUS
187 NTAPI
189  _Out_ PTP_WORK *WorkReturn,
190  _In_ PTP_WORK_CALLBACK Callback,
191  _Inout_opt_ PVOID Context,
192  _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
193  );
194 
195 // winbase:CloseThreadpoolWork
196 NTSYSAPI
197 VOID
198 NTAPI
200  _Inout_ PTP_WORK Work
201  );
202 
203 // winbase:SubmitThreadpoolWork
204 NTSYSAPI
205 VOID
206 NTAPI
207 TpPostWork(
208  _Inout_ PTP_WORK Work
209  );
210 
211 // winbase:WaitForThreadpoolWorkCallbacks
212 NTSYSAPI
213 VOID
214 NTAPI
216  _Inout_ PTP_WORK Work,
217  _In_ LOGICAL CancelPendingCallbacks
218  );
219 
220 // private
221 _Check_return_
222 NTSYSAPI
223 NTSTATUS
224 NTAPI
226  _Out_ PTP_TIMER *Timer,
227  _In_ PTP_TIMER_CALLBACK Callback,
228  _Inout_opt_ PVOID Context,
229  _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
230  );
231 
232 // winbase:CloseThreadpoolTimer
233 NTSYSAPI
234 VOID
235 NTAPI
237  _Inout_ PTP_TIMER Timer
238  );
239 
240 // winbase:SetThreadpoolTimer
241 NTSYSAPI
242 VOID
243 NTAPI
244 TpSetTimer(
245  _Inout_ PTP_TIMER Timer,
246  _In_opt_ PLARGE_INTEGER DueTime,
247  _In_ LONG Period,
248  _In_opt_ LONG WindowLength
249  );
250 
251 // winbase:IsThreadpoolTimerSet
252 NTSYSAPI
253 LOGICAL
254 NTAPI
256  _In_ PTP_TIMER Timer
257  );
258 
259 // winbase:WaitForThreadpoolTimerCallbacks
260 NTSYSAPI
261 VOID
262 NTAPI
264  _Inout_ PTP_TIMER Timer,
265  _In_ LOGICAL CancelPendingCallbacks
266  );
267 
268 // private
269 _Check_return_
270 NTSYSAPI
271 NTSTATUS
272 NTAPI
274  _Out_ PTP_WAIT *WaitReturn,
275  _In_ PTP_WAIT_CALLBACK Callback,
276  _Inout_opt_ PVOID Context,
277  _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
278  );
279 
280 // winbase:CloseThreadpoolWait
281 NTSYSAPI
282 VOID
283 NTAPI
285  _Inout_ PTP_WAIT Wait
286  );
287 
288 // winbase:SetThreadpoolWait
289 NTSYSAPI
290 VOID
291 NTAPI
292 TpSetWait(
293  _Inout_ PTP_WAIT Wait,
294  _In_opt_ HANDLE Handle,
295  _In_opt_ PLARGE_INTEGER Timeout
296  );
297 
298 // winbase:WaitForThreadpoolWaitCallbacks
299 NTSYSAPI
300 VOID
301 NTAPI
303  _Inout_ PTP_WAIT Wait,
304  _In_ LOGICAL CancelPendingCallbacks
305  );
306 
307 // private
308 typedef VOID (NTAPI *PTP_IO_CALLBACK)(
309  _Inout_ PTP_CALLBACK_INSTANCE Instance,
310  _Inout_opt_ PVOID Context,
311  _In_ PVOID ApcContext,
312  _In_ PIO_STATUS_BLOCK IoSB,
313  _In_ PTP_IO Io
314  );
315 
316 // private
317 _Check_return_
318 NTSYSAPI
319 NTSTATUS
320 NTAPI
322  _Out_ PTP_IO *IoReturn,
323  _In_ HANDLE File,
324  _In_ PTP_IO_CALLBACK Callback,
325  _Inout_opt_ PVOID Context,
326  _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
327  );
328 
329 // winbase:CloseThreadpoolIo
330 NTSYSAPI
331 VOID
332 NTAPI
334  _Inout_ PTP_IO Io
335  );
336 
337 // winbase:StartThreadpoolIo
338 NTSYSAPI
339 VOID
340 NTAPI
342  _Inout_ PTP_IO Io
343  );
344 
345 // winbase:CancelThreadpoolIo
346 NTSYSAPI
347 VOID
348 NTAPI
350  _Inout_ PTP_IO Io
351  );
352 
353 // winbase:WaitForThreadpoolIoCallbacks
354 NTSYSAPI
355 VOID
356 NTAPI
358  _Inout_ PTP_IO Io,
359  _In_ LOGICAL CancelPendingCallbacks
360  );
361 
362 // private
363 NTSYSAPI
364 NTSTATUS
365 NTAPI
367  _Out_ PTP_ALPC *AlpcReturn,
368  _In_ HANDLE AlpcPort,
369  _In_ PTP_ALPC_CALLBACK Callback,
370  _Inout_opt_ PVOID Context,
371  _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
372  );
373 
374 #if (PHNT_VERSION >= PHNT_WIN7)
375 // rev
376 NTSYSAPI
377 NTSTATUS
378 NTAPI
380  _Out_ PTP_ALPC *AlpcReturn,
381  _In_ HANDLE AlpcPort,
382  _In_ PTP_ALPC_CALLBACK_EX Callback,
383  _Inout_opt_ PVOID Context,
384  _In_opt_ PTP_CALLBACK_ENVIRON CallbackEnviron
385  );
386 #endif
387 
388 // private
389 NTSYSAPI
390 VOID
391 NTAPI
393  _Inout_ PTP_ALPC Alpc
394  );
395 
396 // private
397 NTSYSAPI
398 VOID
399 NTAPI
401  _Inout_ PTP_ALPC Alpc
402  );
403 
404 // private
405 typedef enum _TP_TRACE_TYPE
406 {
410 } TP_TRACE_TYPE;
411 
412 // private
413 NTSYSAPI
414 VOID
415 NTAPI
417  _In_ TP_TRACE_TYPE Type
418  );
419 
420 // private
421 NTSYSAPI
422 VOID
423 NTAPI
425  _In_ HANDLE Thread
426  );
427 
428 #endif
429 
430 #endif