ReactOS  r75907
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
49  _In_ HANDLE ProcessHandle,
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_)
84 NTAPI
86  _Out_ PHANDLE ThreadHandle,
87  _In_ ULONG DesiredAccess,
88  _In_opt_ POBJECT_ATTRIBUTES ObjectAttributes,
89  _In_opt_ HANDLE ProcessHandle,
90  _Out_opt_ PCLIENT_ID ClientId,
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
142  OUT PULONG MinorVersion OPTIONAL,
143  OUT PULONG BuildNumber OPTIONAL,
144  OUT PUNICODE_STRING CSDVersion OPTIONAL);
145 $endif (_NTDDK_)
146 $if (_NTIFS_)
147 
151 NTAPI
153  _Inout_ PETHREAD Thread,
157 
161 NTAPI
163 
166 BOOLEAN
167 NTAPI
169  _In_ PETHREAD Thread);
170 
174 NTSTATUS
175 NTAPI
177  _Inout_ PETHREAD Thread,
179  _In_ BOOLEAN CopyOnOpen,
180  _In_ BOOLEAN EffectiveOnly,
181  _In_ SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
182 
185 BOOLEAN
186 NTAPI
188  _Inout_ PETHREAD Thread,
190 
193 VOID
194 NTAPI
196  _Inout_ PETHREAD Thread,
197  _In_ PSE_IMPERSONATION_STATE ImpersonationState);
198 
201 VOID
202 NTAPI
203 PsRevertToSelf(VOID);
204 
207 VOID
208 NTAPI
210  _In_ PEPROCESS Process,
213 
216 VOID
217 NTAPI
219  _In_ PEPROCESS Process,
220  _In_ POOL_TYPE PoolType,
221  _In_ ULONG_PTR Amount);
222 
225 NTSTATUS
226 NTAPI
228  _In_ PETHREAD Thread,
229  _In_opt_ HANDLE Token);
230 
233 HANDLE
234 NTAPI
236  _Inout_ PEPROCESS Process);
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
249  _In_ PEPROCESS Process);
250 
253 HANDLE
254 NTAPI
256  _In_ PETHREAD Thread);
257 
259 PEPROCESS
260 NTAPI
262  _In_ PETHREAD Thread
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
283  _In_ PEPROCESS Process);
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
307  _In_ PEPROCESS Process,
308  _In_ POOL_TYPE PoolType,
309  _In_ ULONG_PTR Amount);
310 
312 BOOLEAN
313 NTAPI
315  _In_ PETHREAD Thread);
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_VISTA)
331 
333 BOOLEAN
334 NTAPI
336  IN BOOLEAN Prefetching);
337 
339 BOOLEAN
340 NTAPI
342 
343 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
344 
345 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
347 NTSTATUS
348 NTAPI
351  IN BOOLEAN Remove);
352 #endif /* (NTDDI_VERSION >= NTDDI_VISTASP1) */
353 $endif (_NTDDK_)
DWORD *typedef PVOID
Definition: winlogon.h:52
_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:588
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define IN
Definition: typedefs.h:39
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID ApcContext
Definition: iofuncs.h:719
#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
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE StartRoutine
Definition: psfuncs.h:87
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
Definition: thread.c:643
_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
PVOID PACCESS_TOKEN
Definition: setypes.h:11
#define _WDMDDK_
Definition: wdm.template.h:26
NTSTATUS NTAPI PsRemoveLoadImageNotifyRoutine(IN PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine)
Definition: psnotify.c:127
_In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ PEPROCESS ProcessId
Definition: iotypes.h:1451
#define NTSYSCALLAPI
Definition: ntbasedef.h:196
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:660
uint32_t ULONG_PTR
Definition: typedefs.h:64
__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:472
enum _SECURITY_IMPERSONATION_LEVEL SECURITY_IMPERSONATION_LEVEL
#define __drv_aliasesMem
Definition: btrfs_drv.h:161
VOID NTAPI PsRestoreImpersonation(IN PETHREAD Thread, IN PSE_IMPERSONATION_STATE ImpersonationState)
Definition: security.c:873
#define FORCEINLINE
Definition: ntbasedef.h:213
#define _Out_
Definition: no_sal2.h:323
#define NTKERNELAPI
PsGetCurrentThreadId
Definition: CrNtStubs.h:7
return(0)
_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:823
int64_t LONGLONG
Definition: typedefs.h:67
#define _Out_opt_
Definition: no_sal2.h:339
unsigned char BOOLEAN
#define __kernel_entry
Definition: specstrings.h:50
NTKERNELAPI BOOLEAN NTAPI PsIsCurrentThreadPrefetching(VOID)
INT POOL_TYPE
Definition: typedefs.h:77
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
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
_In_ BOOLEAN Remove
Definition: psfuncs.h:110
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
Definition: process.c:919
char * PBOOLEAN
Definition: retypes.h:11
IN REFCLSID IN PUNKNOWN IN POOL_TYPE PoolType
Definition: unknown.h:68
PVOID *typedef PHANDLE
Definition: ntsecpkg.h:411
NTSTATUS NTAPI PsAssignImpersonationToken(IN PETHREAD Thread, IN HANDLE TokenHandle)
Definition: security.c:480
PACCESS_TOKEN NTAPI PsReferencePrimaryToken(PEPROCESS Process)
Definition: security.c:418
#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:757
ULONG BuildNumber
Definition: ros_glue.cpp:6
LONGLONG NTAPI PsGetProcessCreateTimeQuadPart(PEPROCESS Process)
Definition: process.c:1023
ACPI_EFI_STATUS ExitStatus
Definition: acefiex.h:480
_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
VOID(NTAPI * PCREATE_PROCESS_NOTIFY_ROUTINE)(_In_ HANDLE ParentId, _In_ HANDLE ProcessId, _In_ BOOLEAN Create)
Definition: pstypes.h:160
VOID(NTAPI * PCREATE_THREAD_NOTIFY_ROUTINE)(_In_ HANDLE ProcessId, _In_ HANDLE ThreadId, _In_ BOOLEAN Create)
Definition: pstypes.h:189
DWORD *typedef HANDLE
Definition: winlogon.h:52
LONG NTSTATUS
Definition: DriverTester.h:11
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1144
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:167
VOID NTAPI PsDereferencePrimaryToken(IN PACCESS_TOKEN PrimaryToken)
Definition: security.c:810
NTKERNELAPI HANDLE NTAPI PsGetThreadId(_In_ PETHREAD Thread)
#define OUT
Definition: typedefs.h:40
enum _PROCESSINFOCLASS PROCESSINFOCLASS
Definition: loader.c:60
unsigned int ULONG
Definition: retypes.h:1
VOID(NTAPI * PLOAD_IMAGE_NOTIFY_ROUTINE)(_In_ PUNICODE_STRING FullImageName, _In_ HANDLE ProcessId, _In_ PIMAGE_INFO ImageInfo)
Definition: pstypes.h:220
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
VOID(NTAPI * PCREATE_PROCESS_NOTIFY_ROUTINE_EX)(_Inout_ PEPROCESS Process, _In_ HANDLE ProcessId, _Inout_opt_ PPS_CREATE_NOTIFY_INFO CreateInfo)
Definition: pstypes.h:183
IN HDEVINFO IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
Definition: devinst.c:44
ULONG ACCESS_MASK
Definition: nt_native.h:40
VOID NTAPI PsRevertToSelf(VOID)
Definition: security.c:534
$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:37
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)
VOID NTAPI PsDereferenceImpersonationToken(IN PACCESS_TOKEN ImpersonationToken)
Definition: security.c:796