mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
use tags for pool allocations, and reformat code
svn path=/trunk/; revision=14547
This commit is contained in:
parent
18cff7ccc9
commit
601ea5384b
1 changed files with 441 additions and 420 deletions
|
@ -17,15 +17,20 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
#define TAG_EJOB TAG('E', 'J', 'O', 'B') /* EJOB */
|
||||
|
||||
POBJECT_TYPE EXPORTED PsJobType = NULL;
|
||||
|
||||
LIST_ENTRY PsJobListHead;
|
||||
static FAST_MUTEX PsJobListLock;
|
||||
|
||||
static GENERIC_MAPPING PiJobMapping = {STANDARD_RIGHTS_READ | JOB_OBJECT_QUERY,
|
||||
static GENERIC_MAPPING PiJobMapping =
|
||||
{
|
||||
STANDARD_RIGHTS_READ | JOB_OBJECT_QUERY,
|
||||
STANDARD_RIGHTS_WRITE | JOB_OBJECT_ASSIGN_PROCESS | JOB_OBJECT_SET_ATTRIBUTES | JOB_OBJECT_TERMINATE | JOB_OBJECT_SET_SECURITY_ATTRIBUTES,
|
||||
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
|
||||
STANDARD_RIGHTS_ALL | JOB_OBJECT_ALL_ACCESS};
|
||||
STANDARD_RIGHTS_ALL | JOB_OBJECT_ALL_ACCESS
|
||||
};
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
|
@ -54,9 +59,10 @@ PiDeleteJob(PVOID ObjectBody)
|
|||
VOID INIT_FUNCTION
|
||||
PsInitJobManagment ( VOID )
|
||||
{
|
||||
PsJobType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
|
||||
PsJobType = ExAllocatePoolWithTag (
|
||||
NonPagedPool, sizeof(OBJECT_TYPE), TAG_EJOB );
|
||||
|
||||
PsJobType->Tag = TAG('E', 'J', 'O', 'B');
|
||||
PsJobType->Tag = TAG_EJOB;
|
||||
PsJobType->TotalObjects = 0;
|
||||
PsJobType->TotalHandles = 0;
|
||||
PsJobType->PeakObjects = 0;
|
||||
|
@ -84,7 +90,8 @@ PsInitJobManagment(VOID)
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
PspAssignProcessToJob(PEPROCESS Process,
|
||||
PspAssignProcessToJob (
|
||||
PEPROCESS Process,
|
||||
PEJOB Job)
|
||||
{
|
||||
DPRINT("PspAssignProcessToJob() is unimplemented!\n");
|
||||
|
@ -92,7 +99,8 @@ PspAssignProcessToJob(PEPROCESS Process,
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
PspTerminateJobObject(PEJOB Job,
|
||||
PspTerminateJobObject (
|
||||
PEJOB Job,
|
||||
KPROCESSOR_MODE AccessMode,
|
||||
NTSTATUS ExitStatus )
|
||||
{
|
||||
|
@ -106,7 +114,8 @@ PspTerminateJobObject(PEJOB Job,
|
|||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtAssignProcessToJobObject(HANDLE JobHandle,
|
||||
NtAssignProcessToJobObject (
|
||||
HANDLE JobHandle,
|
||||
HANDLE ProcessHandle)
|
||||
{
|
||||
PEPROCESS Process;
|
||||
|
@ -123,7 +132,8 @@ NtAssignProcessToJobObject(HANDLE JobHandle,
|
|||
I open the process handle before the job handle is that a simple test showed
|
||||
that it first complains about a invalid process handle! The other way around
|
||||
would be simpler though... */
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
Status = ObReferenceObjectByHandle(
|
||||
ProcessHandle,
|
||||
PROCESS_TERMINATE,
|
||||
PsProcessType,
|
||||
PreviousMode,
|
||||
|
@ -135,7 +145,8 @@ NtAssignProcessToJobObject(HANDLE JobHandle,
|
|||
{
|
||||
PEJOB Job;
|
||||
|
||||
Status = ObReferenceObjectByHandle(JobHandle,
|
||||
Status = ObReferenceObjectByHandle(
|
||||
JobHandle,
|
||||
JOB_OBJECT_ASSIGN_PROCESS,
|
||||
PsJobType,
|
||||
PreviousMode,
|
||||
|
@ -193,7 +204,8 @@ NtAssignProcessToJobObject(HANDLE JobHandle,
|
|||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtCreateJobObject(PHANDLE JobHandle,
|
||||
NtCreateJobObject (
|
||||
PHANDLE JobHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes )
|
||||
{
|
||||
|
@ -300,7 +312,8 @@ NtCreateJobObject(PHANDLE JobHandle,
|
|||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtIsProcessInJob(IN HANDLE ProcessHandle,
|
||||
NtIsProcessInJob (
|
||||
IN HANDLE ProcessHandle,
|
||||
IN HANDLE JobHandle OPTIONAL )
|
||||
{
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
|
@ -311,7 +324,8 @@ NtIsProcessInJob(IN HANDLE ProcessHandle,
|
|||
|
||||
PAGED_CODE();
|
||||
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
Status = ObReferenceObjectByHandle(
|
||||
ProcessHandle,
|
||||
PROCESS_QUERY_INFORMATION,
|
||||
PsProcessType,
|
||||
PreviousMode,
|
||||
|
@ -366,7 +380,8 @@ NtIsProcessInJob(IN HANDLE ProcessHandle,
|
|||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtOpenJobObject(PHANDLE JobHandle,
|
||||
NtOpenJobObject (
|
||||
PHANDLE JobHandle,
|
||||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||
{
|
||||
|
@ -432,7 +447,8 @@ NtOpenJobObject(PHANDLE JobHandle,
|
|||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtQueryInformationJobObject(HANDLE JobHandle,
|
||||
NtQueryInformationJobObject (
|
||||
HANDLE JobHandle,
|
||||
JOBOBJECTINFOCLASS JobInformationClass,
|
||||
PVOID JobInformation,
|
||||
ULONG JobInformationLength,
|
||||
|
@ -448,7 +464,8 @@ NtQueryInformationJobObject(HANDLE JobHandle,
|
|||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtSetInformationJobObject(HANDLE JobHandle,
|
||||
NtSetInformationJobObject (
|
||||
HANDLE JobHandle,
|
||||
JOBOBJECTINFOCLASS JobInformationClass,
|
||||
PVOID JobInformation,
|
||||
ULONG JobInformationLength)
|
||||
|
@ -463,7 +480,8 @@ NtSetInformationJobObject(HANDLE JobHandle,
|
|||
*/
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
NtTerminateJobObject(HANDLE JobHandle,
|
||||
NtTerminateJobObject (
|
||||
HANDLE JobHandle,
|
||||
NTSTATUS ExitStatus )
|
||||
{
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
|
@ -474,7 +492,8 @@ NtTerminateJobObject(HANDLE JobHandle,
|
|||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
Status = ObReferenceObjectByHandle(JobHandle,
|
||||
Status = ObReferenceObjectByHandle(
|
||||
JobHandle,
|
||||
JOB_OBJECT_TERMINATE,
|
||||
PsJobType,
|
||||
PreviousMode,
|
||||
|
@ -482,7 +501,8 @@ NtTerminateJobObject(HANDLE JobHandle,
|
|||
NULL);
|
||||
if(NT_SUCCESS(Status))
|
||||
{
|
||||
Status = PspTerminateJobObject(Job,
|
||||
Status = PspTerminateJobObject(
|
||||
Job,
|
||||
PreviousMode,
|
||||
ExitStatus);
|
||||
ObDereferenceObject(Job);
|
||||
|
@ -533,7 +553,8 @@ PsGetJobUIRestrictionsClass(PEJOB Job)
|
|||
*/
|
||||
VOID
|
||||
STDCALL
|
||||
PsSetJobUIRestrictionsClass(PEJOB Job,
|
||||
PsSetJobUIRestrictionsClass (
|
||||
PEJOB Job,
|
||||
ULONG UIRestrictionsClass)
|
||||
{
|
||||
ASSERT(Job);
|
||||
|
|
Loading…
Reference in a new issue