|
ReactOS 0.4.17-dev-806-gffa4164
|
#include <ntoskrnl.h>#include <debug.h>
Go to the source code of this file.
Classes | |
| struct | PSP_TERMINATE_PROCESS_CONTEXT |
| struct | PSP_QUERY_JOB_PROCESS_ID_CONTEXT |
Macros | |
| #define | NDEBUG |
Context structure used to pass the job object and exit status to the process termination callback.
| [in] | Job | A pointer to the job object. |
| [in] | ExitStatus | The exit status to be used for all terminated processes. |
Assigns a process to a job object.
| [in] | JobHandle | Handle to the job object. |
| [in] | ProcessHandle | Handle to the process to be assigned. |
Definition at line 1928 of file job.c.
Referenced by AssignProcessToJobObject(), and CreateProcessInternalW().
| NTSTATUS NTAPI NtCreateJobObject | ( | _Out_ PHANDLE | JobHandle, |
| _In_ ACCESS_MASK | DesiredAccess, | ||
| _In_opt_ POBJECT_ATTRIBUTES | ObjectAttributes | ||
| ) |
Creates a job object.
| [out] | JobHandle | A pointer to a handle that will receive the handle of the created job object. |
| [in] | DesiredAccess | Specifies the desired access rights for the job object. |
| [in,optional] | ObjectAttributes An optional pointer to an object attributes block |
Definition at line 1728 of file job.c.
Definition at line 1834 of file job.c.
Referenced by CreateJobSet().
Determines if a specified process is associated with a specified or any job.
| [in] | ProcessHandle | A handle to the process being queried. |
| [in,optional] | JobHandle An optional handle to the job object being compared. If NULL, the function checks if the process is associated with any job. |
Definition at line 2014 of file job.c.
Referenced by CreateProcessInternalW(), and IsProcessInJob().
| NTSTATUS NTAPI NtOpenJobObject | ( | _Out_ PHANDLE | JobHandle, |
| _In_ ACCESS_MASK | DesiredAccess, | ||
| _In_ POBJECT_ATTRIBUTES | ObjectAttributes | ||
| ) |
Opens a handle to an existing job object.
| JobHandle | A pointer to a handle that will receive the handle of the created job object. |
| DesiredAccess | Specifies the desired access rights for the job object. |
| ObjectAttributes | Pointer to the OBJECT_ATTRIBUTES structure specifying the object name and attributes. |
Definition at line 1862 of file job.c.
| NTSTATUS NTAPI NtQueryInformationJobObject | ( | _In_opt_ HANDLE | JobHandle, |
| _In_ JOBOBJECTINFOCLASS | JobInformationClass, | ||
| _Out_writes_bytes_(JobInformationLength) PVOID | JobInformation, | ||
| _In_ ULONG | JobInformationLength, | ||
| _Out_opt_ PULONG | ReturnLength | ||
| ) |
Retrieves information about a job object based on the requested information class.
| [in,optional] | JobHandle Handle to the job object for which information is being queried. The handle must have the JOB_OBJECT_QUERY access right. If NULL, the current process' job is used. | |
| [in] | JobInformationClass | Specifies the type of information to query. |
| [out] | JobInformation | Pointer to a buffer that receives the requested job object information. |
| [in] | JobInformationLength | Specifies the size, in bytes, of the JobInformation buffer. |
| [out,optional] | ReturnLength Pointer to a variable that receives the size, in bytes, of the information written to the JobInformation buffer. Specify NULL to not receive this information. |
Definition at line 2179 of file job.c.
Referenced by QueryInformationJobObject().
| NTSTATUS NTAPI NtSetInformationJobObject | ( | _In_ HANDLE | JobHandle, |
| _In_ JOBOBJECTINFOCLASS | JobInformationClass, | ||
| _In_reads_bytes_(JobInformationLength) PVOID | JobInformation, | ||
| _In_ ULONG | JobInformationLength | ||
| ) |
Sets the information for a job object, updating the specified job object limits.
This function is called to modify various job object limits, including basic limits, extended limits, security limits, and other job-specific settings.
| [in] | JobHandle | A handle to the job object that is being modified. The handle must have the JOB_OBJECT_SET_ATTRIBUTES access right. |
| [in] | JobInformationClass | The class of information to set. This determines the structure and content of the JobInformation parameter. |
| [in] | JobInformation | A pointer to a buffer that contains the information to be set. The type and content of the buffer depend on the value of JobInformationClass. |
| [in] | JobInformationLength | The size of the buffer pointed to by JobInformation, in bytes. |
Definition at line 2406 of file job.c.
Referenced by SetInformationJobObject().
Terminates all processes currently associated with the specified job object.
| [in] | JobHandle | A handle to the job object to be terminated. |
| [in] | ExitStatus | The exit status to be used for all terminated processes. |
Definition at line 2118 of file job.c.
Referenced by TerminateJobObject().
Assigns a process to a job object.
| [in] | Process | Pointer to the process to be assigned to the job. |
| [in] | Job | Pointer to the job object to which the process is to be assigned. |
Definition at line 432 of file job.c.
Referenced by NtAssignProcessToJobObject(), and PspCreateProcess().
|
static |
Queues an initial new-process notification for a process already assigned to a job.
| [in] | Process | A borrowed pointer to the process being notified. |
| [in] | Context | A pointer to the job associated with the completion port. |
Definition at line 1174 of file job.c.
Referenced by PspAssociateCompletionPortWithJob().
|
static |
Associates an I/O completion port with a job object and enumerates its processes to propagate the association.
| [in] | Job | A pointer to the job object to which the I/O completion port will be associated. |
| [in] | AssociateCpInfo | A structure containing information used to associate a completion port with a job (the handle of the I/O completion port and the key). |
Definition at line 1223 of file job.c.
Referenced by NtSetInformationJobObject().
| VOID NTAPI PspCloseJob | ( | _In_ PEPROCESS | Process, |
| _In_ PVOID | ObjectBody, | ||
| _In_ ACCESS_MASK | GrantedAccess, | ||
| _In_ ULONG_PTR | ProcessHandleCount, | ||
| _In_ ULONG_PTR | SystemHandleCount | ||
| ) |
Handles the closing of a job object.
| [in] | Process | Unused. |
| [in] | ObjectBody | A pointer to the job object being closed. |
| [in] | GrantedAccess | Unused. |
| [in] | ProcessHandleCount | Unused. |
| [in] | SystemHandleCount | The number of system handles currently open for the job object. |
Definition at line 845 of file job.c.
Referenced by PspInitPhase0().
Marks a process inactive in its assigned job.
| [in] | Job | A pointer to the process's assigned job. |
| [in] | Process | A pointer to the process being marked inactive. |
Definition at line 574 of file job.c.
Referenced by PspExitProcessFromJob(), PspRemoveProcessFromJob(), and PspTerminateProcessCallback().
Deletes the specified job object and cleans up associated resources.
| [in] | ObjectBody | A pointer to the job object to be deleted. |
Definition at line 909 of file job.c.
Referenced by PspInitPhase0().
| NTSTATUS NTAPI PspEnumerateProcessesInJob | ( | _In_ PEJOB | Job, |
| _In_ PJOB_ENUMERATOR_CALLBACK | Callback, | ||
| _In_opt_ PVOID | Context | ||
| ) |
Enumerates all processes currently associated with the specified job object and invokes a callback for each process.
| [in] | Job | A pointer to the job object whose processes are to be enumerated. |
| [in] | Callback | A pointer to the callback invoked for each referenced process. |
| [in,optional] | Context An optional context pointer passed to the callback. |
The callback is invoked without the job lock held.
Definition at line 290 of file job.c.
Referenced by PspTerminateJobObject().
|
static |
Enumerates all assigned processes while the caller holds the job lock and invokes a callback for each process.
| [in] | Job | A pointer to the job object whose processes are to be enumerated. |
| [in] | Callback | A pointer to the callback invoked for each process. |
| [in,optional] | Context An optional context pointer passed to the callback. |
The caller must hold the job lock shared or exclusive.
The callback must not release or recursively acquire the job lock, modify job membership, dereference the process object, or retain the process pointer after returning.
Definition at line 347 of file job.c.
Referenced by PspAssociateCompletionPortWithJob(), and PspQueryJobProcessIdList().
Handles the exit of a process from the specified job object.
| [in] | Process | A pointer to the process that is exiting the job. |
Definition at line 659 of file job.c.
Referenced by PspExitThread().
|
static |
Returns the next referenced process directly assigned to a job.
| [in] | Job | A pointer to the job object being enumerated. |
| [in,optional] | PreviousProcess A referenced process returned by the previous call, or NULL to start enumeration. When non-NULL, its reference is consumed by this function, regardless of whether another process is returned. |
The job lock is not held when this function returns.
This relies on job membership remaining fixed until process object deletion. The reference to PreviousProcess therefore keeps its JobLinks valid until the next process has been selected.
Definition at line 227 of file job.c.
Referenced by PspEnumerateProcessesInJob().
|
static |
Returns the next process directly assigned to a job while the job lock is held.
| [in] | Job | A pointer to the job object being enumerated. |
| [in,optional] | PreviousProcess A pointer to the process after which enumeration should continue, or NULL to return the first process. |
Neither PreviousProcess nor the returned process is referenced by this function. The caller must ensure that PreviousProcess remains linked to the job and that direct job membership isn't modified during the enumeration.
Definition at line 158 of file job.c.
Referenced by PspEnumerateProcessesInJobLocked(), and PspGetNextProcessInJob().
Definition at line 128 of file job.c.
Referenced by PspInitPhase0().
| NTSTATUS NTAPI PspInvokeW32JobCallout | ( | _In_ PEJOB | Job, |
| _In_ PSW32JOBCALLOUTTYPE | CalloutType, | ||
| _In_opt_ PVOID | Data | ||
| ) |
Invokes the win32k job callout, if win32k has registered one.
| [in] | Job | A pointer to the job object the callout applies to. |
| [in] | CalloutType | The operation win32k is being asked to perform. |
| [in,optional] | Data Class specific data. For PsW32JobCalloutSetInformation this is the new UI restrictions class, for PsW32JobCalloutAddProcess the W32PROCESS of the process being added to the job. |
Definition at line 1637 of file job.c.
Referenced by PspAssignProcessToJob(), PspDeleteJob(), and PspSetJobUIRestrictions().
|
static |
Collects accounting information, such as total user time, kernel time, page fault counts, and I/O operations, for the given job object.
| [in] | Job | Pointer to the job object whose accounting information is being queried. |
| [out] | BasicAndIo | Pointer to a structure that will be filled with basic accounting and I/O information about the job. |
Definition at line 1297 of file job.c.
Referenced by NtQueryInformationJobObject().
|
static |
Retrieves basic or extended limit information for a job object.
| [in] | Job | Pointer to the job object whose limit information is being queried. |
| [in] | Extended | A boolean value indicating whether extended limit information is being requested or only basic limit information. |
| [out] | ExtendedLimit | Pointer to a structure that will be filled with basic or extended limit information about the job. |
Definition at line 1379 of file job.c.
Referenced by NtQueryInformationJobObject().
|
static |
Collects a list of process IDs for all processes associated with a job.
| [in] | Job | Pointer to the job object whose process IDs are being queried. |
| [out] | ProcIdList | Pointer to a structure that will be filled with the list of process IDs and information about the number of assigned and returned process IDs. |
| [in] | JobInformationLength | Specifies the size, in bytes, of the buffer that will receive the process ID list. |
| [out] | ReturnRequiredLength | Pointer to a variable that receives the size, in bytes, of the information written to the buffer. If there is a buffer overflow, the required size is returned. |
Definition at line 1510 of file job.c.
Referenced by NtQueryInformationJobObject().
|
static |
Callback function used to collect the process IDs for all active processes in a job object.
| [in] | Process | A pointer to the process whose ID is being added to the process list. |
| [in,out] | Context | A pointer to the context structure that tracks the process ID collection. This context holds the list of process IDs, the length of the buffer, and the status of the collection operation. |
Definition at line 1445 of file job.c.
Referenced by PspQueryJobProcessIdList().
Removes a process from its assigned job.
| [in] | Process | A pointer to the process being removed from its assigned job. |
Definition at line 609 of file job.c.
Referenced by PspDeleteProcess().
| NTSTATUS NTAPI PspSendJobMessageLocked | ( | _In_ PEJOB | Job, |
| _In_ ULONG | Message, | ||
| _In_opt_ PVOID | CompletionValue, | ||
| _In_ BOOLEAN | Quota | ||
| ) |
Queues a message to a job's completion port.
| [in] | Job | A pointer to the job receiving the notification. |
| [in] | Message | The job notification message (JOB_OBJECT_MSG_*). |
| [in,optional] | CompletionValue The message specific completion value. | |
| [in] | Quota | Specifies whether the completion packet is charged as quota. |
Definition at line 397 of file job.c.
Referenced by PspAssignProcessToJob(), PspAssociateCompletionPortCallback(), PspExitProcess(), PspExitProcessFromJob(), PspRemoveProcessFromJob(), and PspTerminateProcessCallback().
|
static |
Helper function to set limit information for a job object, either basic or extended limits.
| [in] | Job | The job object being modified. |
| [in] | ExtendedLimit | A pointer to the structure containing the limit information to be set. |
| [in] | IsExtendedLimit | A boolean value indicating whether the limit information is extended. |
Definition at line 966 of file job.c.
Referenced by NtSetInformationJobObject().
Applies a new basic UI restrictions class to a job object.
| [in] | Job | A pointer to the job object being modified. |
| [in] | UIRestrictionsClass | The new set of JOB_OBJECT_UILIMIT_* flags. |
Definition at line 1678 of file job.c.
Referenced by NtSetInformationJobObject().
Terminates all processes currently associated with the specified job object.
| [in] | Job | A pointer to the job object to be terminated. |
| [in] | ExitStatus | The exit status to be used for all terminated processes. |
Definition at line 788 of file job.c.
Referenced by NtTerminateJobObject(), and PspCloseJob().
|
static |
Callback function to terminate a process and update the job's active process counter.
| [in] | Process | A pointer to the process object to be terminated. |
| [in] | Context | A pointer to a PSP_TERMINATE_PROCESS_CONTEXT structure. |
Definition at line 711 of file job.c.
Referenced by PspTerminateJobObject().
| LIST_ENTRY PsJobListHead |
Definition at line 25 of file job.c.
Referenced by NtCreateJobObject(), and PspInitializeJobStructures().
|
static |
Definition at line 26 of file job.c.
Referenced by NtCreateJobObject(), PspDeleteJob(), and PspInitializeJobStructures().
| POBJECT_TYPE PsJobType = NULL |
Definition at line 23 of file job.c.
Referenced by NtAssignProcessToJobObject(), NtCreateJobObject(), NtIsProcessInJob(), NtOpenJobObject(), NtQueryInformationJobObject(), NtSetInformationJobObject(), NtTerminateJobObject(), NtUserUserHandleGrantAccess(), PspInitPhase0(), and TestObjectTypes().
| ULONG PspJobInfoAlign[] |
| ULONG PspJobInfoLengths[] |
Definition at line 56 of file job.c.
Referenced by NtQueryInformationJobObject(), and NtSetInformationJobObject().
| GENERIC_MAPPING PspJobMapping |
| CHAR PspJobSchedulingClasses[PSP_JOB_SCHEDULING_CLASSES] |
Definition at line 30 of file job.c.
Referenced by PsChangeQuantumTable(), and PspComputeQuantumAndPriority().
| BOOLEAN PspUseJobSchedulingClasses |
Definition at line 28 of file job.c.
Referenced by PsChangeQuantumTable(), and PspComputeQuantumAndPriority().