ReactOS  0.4.14-dev-98-gb0d4763
psfuncs.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Process Manager Functions *
3  ******************************************************************************/
5 
8 NTAPI
12 
13 /*
14  * PEPROCESS
15  * PsGetCurrentProcess(VOID)
16  */
17 #define PsGetCurrentProcess IoGetCurrentProcess
18 
19 #if !defined(_PSGETCURRENTTHREAD_)
20 #define _PSGETCURRENTTHREAD_
24 NTAPI
26 {
27  return (PETHREAD)KeGetCurrentThread();
28 }
29 #endif /* !_PSGETCURRENTTHREAD_ */
30 
32 $if (_NTDDK_)
33 
37 NTAPI
43 
47 NTAPI
50  _In_ PROCESSINFOCLASS ProcessInformationClass,
51  _Out_ PVOID ProcessInformation,
52  _In_ ULONG ProcessInformationLength,
55 $if (_NTIFS_)
56 
61 NTAPI
65 
70 NTAPI
72  _In_ HANDLE UniqueThreadId,
75 
76 #if (NTDDI_VERSION >= NTDDI_WIN2K)
77 
78 $if (_WDMDDK_)
80 _Post_satisfies_(return <= 0)
84 NTAPI
86  _Out_ PHANDLE ThreadHandle,
92  _In_opt_ _When_(return==0, __drv_aliasesMem) PVOID StartContext);
93 
97 NTAPI
100 
102 $if (_NTDDK_)
103 
106 NTSTATUS
107 NTAPI
109  _In_ PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine,
111 
114 NTSTATUS
115 NTAPI
117  _In_ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
118 
121 NTSTATUS
122 NTAPI
124  _In_ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
125 
127 HANDLE
128 NTAPI
130 
133 HANDLE
134 NTAPI
136 
138 BOOLEAN
139 NTAPI
144  OUT PUNICODE_STRING CSDVersion OPTIONAL);
145 $endif (_NTDDK_)
146 $if (_NTIFS_)
147 
151 NTAPI
157 
161 NTAPI
163 
166 BOOLEAN
167 NTAPI
170 
174 NTSTATUS
175 NTAPI
182 
185 BOOLEAN
186 NTAPI
190 
193 VOID
194 NTAPI
198 
201 VOID
202 NTAPI
204 
207 VOID
208 NTAPI
213 
216 VOID
217 NTAPI
222 
225 NTSTATUS
226 NTAPI
230 
233 HANDLE
234 NTAPI
237 $endif (_NTIFS_)
238 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
239 $if (_NTDDK_ || _NTIFS_)
240 #if (NTDDI_VERSION >= NTDDI_WINXP)
242 
243 $if (_NTDDK_)
246 HANDLE
247 NTAPI
250 
253 HANDLE
254 NTAPI
257 
259 PEPROCESS
260 NTAPI
263 );
264 
266 NTSTATUS
267 NTAPI
269  _In_ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine);
270 
273 NTSTATUS
274 NTAPI
276  _In_ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine);
277 
280 LONGLONG
281 NTAPI
284 $endif (_NTDDK_)
285 $if (_NTIFS_)
286 
289 VOID
290 NTAPI
292  _In_ PACCESS_TOKEN PrimaryToken);
293 
296 VOID
297 NTAPI
299  _In_ PACCESS_TOKEN ImpersonationToken);
300 
304 NTSTATUS
305 NTAPI
310 
312 BOOLEAN
313 NTAPI
316 $endif (_NTIFS_)
317 $if (_NTDDK_ || _NTIFS_)
318 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
320 
321 $if (_NTDDK_)
322 #if (NTDDI_VERSION >= NTDDI_WS03)
324 HANDLE
325 NTAPI
327  IN PETHREAD Thread);
328 #endif /* (NTDDI_VERSION >= NTDDI_WS03) */
329 
330 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
332 PVOID
333 NTAPI
335  VOID);
336 #endif /* (NTDDI_VERSION >= NTDDI_WS03SP1) */
337 
338 #if (NTDDI_VERSION >= NTDDI_VISTA)
339 
341 BOOLEAN
342 NTAPI
344  IN BOOLEAN Prefetching);
345 
347 BOOLEAN
348 NTAPI
350 
351 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
352 
353 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
355 NTSTATUS
356 NTAPI
359  IN BOOLEAN Remove);
360 #endif /* (NTDDI_VERSION >= NTDDI_VISTASP1) */
361 $endif (_NTDDK_)
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE _In_opt_ _When_(return==0, __drv_aliasesMem) PVOID StartContext)
enum _SECURITY_IMPERSONATION_LEVEL * PSECURITY_IMPERSONATION_LEVEL
NTSTATUS NTAPI PsImpersonateClient(IN PETHREAD Thread, IN PACCESS_TOKEN Token, IN BOOLEAN CopyOnOpen, IN BOOLEAN EffectiveOnly, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: security.c:610
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define IN
Definition: typedefs.h:38
return
Definition: dirsup.c:529
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
Definition: iofuncs.h:719
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
#define _Must_inspect_result_
Definition: no_sal2.h:314
NTKERNELAPI NTSTATUS NTAPI PsChargeProcessPoolQuota(_In_ PEPROCESS Process, _In_ POOL_TYPE PoolType, _In_ SIZE_T Amount)
NTKERNELAPI HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
ULONG MinorVersion
Definition: ros_glue.cpp:5
ULONG MajorVersion
Definition: ros_glue.cpp:4
_Inout_ PSE_IMPERSONATION_STATE ImpersonationState
Definition: psfuncs.h:189
_Outptr_ PEPROCESS * Process
Definition: psfuncs.h:64
#define PsGetCurrentThread()
Definition: env_spec_w32.h:81
LARGE_INTEGER NTAPI PsGetProcessExitTime(VOID)
Definition: process.c:1013
VOID(NTAPI * PCREATE_THREAD_NOTIFY_ROUTINE)(_In_ HANDLE ProcessId, _In_ HANDLE ThreadId, _In_ BOOLEAN Create)
Definition: pstypes.h:189
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE StartRoutine
Definition: psfuncs.h:87
NTKERNELAPI VOID NTAPI PsRevertToSelf(VOID)
Definition: security.c:556
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
LONG NTSTATUS
Definition: precomp.h:26
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES ObjectAttributes
Definition: psfuncs.h:40
#define _NTIFS_
Definition: ifssupp.h:20
#define _Outptr_
Definition: no_sal2.h:396
_Out_ PBOOLEAN CopyOnOpen
Definition: psfuncs.h:154
#define _WDMDDK_
Definition: wdm.template.h:26
NTSTATUS NTAPI PsRemoveLoadImageNotifyRoutine(IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:127
#define NTSYSCALLAPI
Definition: ntbasedef.h:204
NTKERNELAPI BOOLEAN NTAPI PsIsSystemThread(_In_ PETHREAD Thread)
$endif(_WDMDDK_) $if(_NTDDK_) __kernel_entry NTSYSCALLAPI NTSTATUS NTAPI NtOpenProcess(_Out_ PHANDLE ProcessHandle
Definition: ke.h:202
#define _In_opt_
Definition: no_sal2.h:213
NTKERNELAPI BOOLEAN NTAPI PsGetVersion(OUT PULONG MajorVersion OPTIONAL, OUT PULONG MinorVersion OPTIONAL, OUT PULONG BuildNumber OPTIONAL, OUT PUNICODE_STRING CSDVersion OPTIONAL)
Definition: psmgr.c:658
uint32_t ULONG_PTR
Definition: typedefs.h:63
__kernel_entry NTSYSCALLAPI NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
_Must_inspect_result_ _Outptr_ PETHREAD * Thread
Definition: psfuncs.h:73
NTKERNELAPI NTSTATUS NTAPI PsSetCreateProcessNotifyRoutineEx(IN PCREATE_PROCESS_NOTIFY_ROUTINE_EX NotifyRoutine, IN BOOLEAN Remove)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTKERNELAPI PEPROCESS NTAPI PsGetThreadProcess(_In_ PETHREAD Thread)
KSTART_ROUTINE * PKSTART_ROUTINE
Definition: ketypes.h:487
VOID(NTAPI * PLOAD_IMAGE_NOTIFY_ROUTINE)(_In_ PUNICODE_STRING FullImageName, _In_ HANDLE ProcessId, _In_ PIMAGE_INFO ImageInfo)
Definition: pstypes.h:220
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
#define __drv_aliasesMem
Definition: btrfs_drv.h:183
VOID NTAPI PsRestoreImpersonation(IN PETHREAD Thread, IN PSE_IMPERSONATION_STATE ImpersonationState)
Definition: security.c:898
unsigned char BOOLEAN
VOID(NTAPI * PCREATE_PROCESS_NOTIFY_ROUTINE_EX)(_Inout_ PEPROCESS Process, _In_ HANDLE ProcessId, _Inout_opt_ PPS_CREATE_NOTIFY_INFO CreateInfo)
Definition: pstypes.h:183
#define FORCEINLINE
Definition: ntbasedef.h:221
#define _Out_
Definition: no_sal2.h:323
#define NTKERNELAPI
_In_ BOOLEAN Remove
Definition: psfuncs.h:110
PsGetCurrentThreadId
Definition: CrNtStubs.h:7
_Must_inspect_result_ _In_opt_ PACCESS_TOKEN Token
Definition: psfuncs.h:178
BOOLEAN NTAPI PsDisableImpersonation(IN PETHREAD Thread, OUT PSE_IMPERSONATION_STATE ImpersonationState)
Definition: security.c:848
int64_t LONGLONG
Definition: typedefs.h:66
#define _Out_opt_
Definition: no_sal2.h:339
_In_ POOL_TYPE PoolType
Definition: psfuncs.h:211
#define __kernel_entry
Definition: specstrings.h:50
NTKERNELAPI BOOLEAN NTAPI PsIsCurrentThreadPrefetching(VOID)
INT POOL_TYPE
Definition: typedefs.h:76
HANDLE NTAPI PsGetThreadProcessId(IN PETHREAD Thread)
Definition: thread.c:745
NTSTATUS NTAPI PsSetLoadImageNotifyRoutine(IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:176
_Out_ PBOOLEAN _Out_ PBOOLEAN _Out_ PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: psfuncs.h:154
#define _Inout_
Definition: no_sal2.h:244
VOID(NTAPI * PCREATE_PROCESS_NOTIFY_ROUTINE)(_In_ HANDLE ParentId, _In_ HANDLE ProcessId, _In_ BOOLEAN Create)
Definition: pstypes.h:160
NTSTATUS NTAPI PsSetCreateThreadNotifyRoutine(IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:260
__kernel_entry NTSYSCALLAPI NTSTATUS NTAPI NtOpenProcess(_Out_ PHANDLE ProcessHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _In_opt_ PCLIENT_ID ClientId)
NTKERNELAPI BOOLEAN NTAPI PsSetCurrentThreadPrefetching(IN BOOLEAN Prefetching)
_In_ POOL_TYPE _In_ ULONG_PTR Amount
Definition: psfuncs.h:211
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
Definition: process.c:919
char * PBOOLEAN
Definition: retypes.h:11
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:414
NTKERNELAPI PVOID NTAPI PsGetCurrentThreadTeb(VOID)
Definition: thread.c:785
NTSTATUS NTAPI PsAssignImpersonationToken(IN PETHREAD Thread, IN HANDLE TokenHandle)
Definition: security.c:502
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:440
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE ProcessHandle
Definition: psfuncs.h:87
NTKERNELAPI NTSTATUS NTAPI PsRemoveCreateThreadNotifyRoutine(_In_ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine)
PACCESS_TOKEN NTAPI PsReferenceImpersonationToken(IN PETHREAD Thread, OUT PBOOLEAN CopyOnOpen, OUT PBOOLEAN EffectiveOnly, OUT PSECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
Definition: security.c:782
ULONG BuildNumber
Definition: ros_glue.cpp:6
LONGLONG NTAPI PsGetProcessCreateTimeQuadPart(PEPROCESS Process)
Definition: process.c:1023
_Out_ PBOOLEAN _Out_ PBOOLEAN EffectiveOnly
Definition: psfuncs.h:154
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define _In_
Definition: no_sal2.h:204
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1144
_In_ NTSTATUS ExitStatus
Definition: psfuncs.h:859
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
NTSTATUS NTAPI PsWrapApcWow64Thread(IN OUT PVOID *ApcContext, IN OUT PVOID *ApcRoutine)
Definition: thread.c:932
unsigned int * PULONG
Definition: retypes.h:1
#define _Post_satisfies_(a)
Definition: btrfs_drv.h:189
VOID NTAPI PsDereferencePrimaryToken(IN PACCESS_TOKEN PrimaryToken)
Definition: security.c:835
NTKERNELAPI HANDLE NTAPI PsGetThreadId(_In_ PETHREAD Thread)
#define OUT
Definition: typedefs.h:39
enum _PROCESSINFOCLASS PROCESSINFOCLASS
Definition: loader.c:63
unsigned int ULONG
Definition: retypes.h:1
NTKERNELAPI VOID NTAPI PsReturnPoolQuota(_In_ PEPROCESS Process, _In_ POOL_TYPE PoolType, _In_ SIZE_T Amount)
HANDLE NTAPI PsGetProcessId(PEPROCESS Process)
Definition: process.c:1063
#define KeGetCurrentThread
Definition: hal.h:44
BOOLEAN NTAPI PsIsThreadTerminating(IN PETHREAD Thread)
Definition: thread.c:868
#define APC_LEVEL
Definition: env_spec_w32.h:695
ULONG ACCESS_MASK
Definition: nt_native.h:40
$if(_WDMDDK_) NTKERNELAPI NTSTATUS NTAPI PsWrapApcWow64Thread(_Inout_ PVOID *ApcContext
Definition: ke.h:1
#define _NTDDK_
_IRQL_requires_max_(PASSIVE_LEVEL) NTSYSAPI NTSTATUS NTAPI ZwOpenProcessTokenEx(_In_ HANDLE ProcessHandle
Definition: Messaging.c:64
NTSTATUS NTAPI PsSetCreateProcessNotifyRoutine(IN PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine, IN BOOLEAN Remove)
Definition: psnotify.c:33
_Inout_ PVOID * ApcRoutine
Definition: psfuncs.h:11
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _In_opt_ PCLIENT_ID ClientId
Definition: psfuncs.h:40
_In_ ACCESS_MASK DesiredAccess
Definition: psfuncs.h:715
NTKERNELAPI VOID NTAPI PsChargePoolQuota(_In_ PEPROCESS Process, _In_ POOL_TYPE PoolType, _In_ SIZE_T Amount)
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
VOID NTAPI PsDereferenceImpersonationToken(IN PACCESS_TOKEN ImpersonationToken)
Definition: security.c:821