ReactOS  0.4.15-dev-316-g938df97
job.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for job.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI PspDeleteJob (PVOID ObjectBody)
 
INIT_FUNCTION VOID NTAPI PspInitializeJobStructures (VOID)
 
NTSTATUS NTAPI PspAssignProcessToJob (PEPROCESS Process, PEJOB Job)
 
NTSTATUS NTAPI PspTerminateJobObject (PEJOB Job, KPROCESSOR_MODE AccessMode, NTSTATUS ExitStatus)
 
VOID NTAPI PspRemoveProcessFromJob (IN PEPROCESS Process, IN PEJOB Job)
 
VOID NTAPI PspExitProcessFromJob (IN PEJOB Job, IN PEPROCESS Process)
 
NTSTATUS NTAPI NtAssignProcessToJobObject (HANDLE JobHandle, HANDLE ProcessHandle)
 
NTSTATUS NTAPI NtCreateJobSet (IN ULONG NumJob, IN PJOB_SET_ARRAY UserJobSet, IN ULONG Flags)
 
NTSTATUS NTAPI NtCreateJobObject (PHANDLE JobHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes)
 
NTSTATUS NTAPI NtIsProcessInJob (IN HANDLE ProcessHandle, IN HANDLE JobHandle OPTIONAL)
 
NTSTATUS NTAPI NtOpenJobObject (PHANDLE JobHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes)
 
NTSTATUS NTAPI NtQueryInformationJobObject (HANDLE JobHandle, JOBOBJECTINFOCLASS JobInformationClass, PVOID JobInformation, ULONG JobInformationLength, PULONG ReturnLength)
 
NTSTATUS NTAPI NtSetInformationJobObject (HANDLE JobHandle, JOBOBJECTINFOCLASS JobInformationClass, PVOID JobInformation, ULONG JobInformationLength)
 
NTSTATUS NTAPI NtTerminateJobObject (HANDLE JobHandle, NTSTATUS ExitStatus)
 
PVOID NTAPI PsGetJobLock (PEJOB Job)
 
ULONG NTAPI PsGetJobSessionId (PEJOB Job)
 
ULONG NTAPI PsGetJobUIRestrictionsClass (PEJOB Job)
 
VOID NTAPI PsSetJobUIRestrictionsClass (PEJOB Job, ULONG UIRestrictionsClass)
 

Variables

POBJECT_TYPE PsJobType = NULL
 
LIST_ENTRY PsJobListHead
 
static FAST_MUTEX PsJobListLock
 
BOOLEAN PspUseJobSchedulingClasses
 
CHAR PspJobSchedulingClasses [PSP_JOB_SCHEDULING_CLASSES]
 
GENERIC_MAPPING PspJobMapping
 
ULONG PspJobInfoLengths []
 
ULONG PspJobInfoAlign []
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file job.c.

Function Documentation

◆ NtAssignProcessToJobObject()

NTSTATUS NTAPI NtAssignProcessToJobObject ( HANDLE  JobHandle,
HANDLE  ProcessHandle 
)

Definition at line 157 of file job.c.

160 {
164 
165  PAGED_CODE();
166 
168 
169  /* make sure we're having a handle with enough rights, especially the to
170  terminate the process. otherwise one could abuse the job objects to
171  terminate processes without having rights granted to do so! The reason
172  I open the process handle before the job handle is that a simple test showed
173  that it first complains about a invalid process handle! The other way around
174  would be simpler though... */
179  PreviousMode,
180  (PVOID*)&Process,
181  NULL);
182  if(NT_SUCCESS(Status))
183  {
184  if(Process->Job == NULL)
185  {
186  PEJOB Job;
187 
189  JobHandle,
191  PsJobType,
192  PreviousMode,
193  (PVOID*)&Job,
194  NULL);
195  if(NT_SUCCESS(Status))
196  {
197  /* lock the process so we can safely assign the process. Note that in the
198  meanwhile another thread could have assigned this process to a job! */
199 
200  if(ExAcquireRundownProtection(&Process->RundownProtect))
201  {
202  if(Process->Job == NULL && PsGetProcessSessionId(Process) == Job->SessionId)
203  {
204  /* Just store the pointer to the job object in the process, we'll
205  assign it later. The reason we can't do this here is that locking
206  the job object might require it to wait, which is a bad thing
207  while holding the process lock! */
208  Process->Job = Job;
209  ObReferenceObject(Job);
210  }
211  else
212  {
213  /* process is already assigned to a job or session id differs! */
215  }
216  ExReleaseRundownProtection(&Process->RundownProtect);
217 
218  if(NT_SUCCESS(Status))
219  {
220  /* let's actually assign the process to the job as we're not holding
221  the process lock anymore! */
223  }
224  }
225 
226  ObDereferenceObject(Job);
227  }
228  }
229  else
230  {
231  /* process is already assigned to a job or session id differs! */
233  }
234 
236  }
237 
238  return Status;
239 }
NTKERNELAPI VOID FASTCALL ExReleaseRundownProtection(_Inout_ PEX_RUNDOWN_REF RunRef)
POBJECT_TYPE PsJobType
Definition: job.c:20
LONG NTSTATUS
Definition: precomp.h:26
#define ExAcquireRundownProtection
Definition: ex.h:130
#define JOB_OBJECT_ASSIGN_PROCESS
Definition: pstypes.h:192
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
smooth NULL
Definition: ftsmooth.c:416
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
NTSTATUS NTAPI PspAssignProcessToJob(PEPROCESS Process, PEJOB Job)
Definition: job.c:119
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
#define PROCESS_TERMINATE
Definition: pstypes.h:149
ULONG SessionId
Definition: pstypes.h:1445
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define ObReferenceObject
Definition: obfuncs.h:204
ULONG NTAPI PsGetProcessSessionId(IN PEPROCESS Process)
Definition: process.c:1163
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
POBJECT_TYPE PsProcessType
Definition: process.c:20
#define PAGED_CODE()

Referenced by AssignProcessToJobObject(), and CreateProcessInternalW().

◆ NtCreateJobObject()

NTSTATUS NTAPI NtCreateJobObject ( PHANDLE  JobHandle,
ACCESS_MASK  DesiredAccess,
POBJECT_ATTRIBUTES  ObjectAttributes 
)

Definition at line 256 of file job.c.

260 {
261  HANDLE hJob;
262  PEJOB Job;
266 
267  PAGED_CODE();
268 
271 
272  /* check for valid buffers */
273  if (PreviousMode != KernelMode)
274  {
275  _SEH2_TRY
276  {
277  ProbeForWriteHandle(JobHandle);
278  }
280  {
282  }
283  _SEH2_END;
284  }
285 
287  PsJobType,
289  PreviousMode,
290  NULL,
291  sizeof(EJOB),
292  0,
293  0,
294  (PVOID*)&Job);
295 
296  if(NT_SUCCESS(Status))
297  {
298  /* FIXME - Zero all fields as we don't yet implement all of them */
299  RtlZeroMemory(Job, sizeof(EJOB));
300 
301  /* make sure that early destruction doesn't attempt to remove the object from
302  the list before it even gets added! */
303  Job->JobLinks.Flink = NULL;
304 
305  /* setup the job object - FIXME: More to do! */
308 
309  /* inherit the session id from the caller */
311 
313 
315  if(!NT_SUCCESS(Status))
316  {
317  DPRINT1("Failed to initialize job lock!!!\n");
318  ObDereferenceObject(Job);
319  return Status;
320  }
322 
323  /* link the object into the global job list */
327 
328  Status = ObInsertObject(Job,
329  NULL,
331  0,
332  NULL,
333  &hJob);
334  if(NT_SUCCESS(Status))
335  {
336  /* pass the handle back to the caller */
337  _SEH2_TRY
338  {
339  /* NOTE: if the caller passed invalid buffers to receive the handle it's his
340  own fault! the object will still be created and live... It's possible
341  to find the handle using ObFindHandleForObject()! */
342  *JobHandle = hJob;
343  }
345  {
347  }
348  _SEH2_END;
349  }
350  }
351 
352  return Status;
353 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define ExInitializeResource
Definition: exfuncs.h:346
POBJECT_TYPE PsJobType
Definition: job.c:20
KEVENT Event
Definition: pstypes.h:1418
LONG NTSTATUS
Definition: precomp.h:26
ERESOURCE JobLock
Definition: pstypes.h:1421
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define InsertTailList(ListHead, Entry)
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
_SEH2_TRY
Definition: create.c:4250
static FAST_MUTEX PsJobListLock
Definition: job.c:23
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
LIST_ENTRY ProcessListHead
Definition: pstypes.h:1420
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:952
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
ULONG CurrentProcess
Definition: shell.c:125
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
EX_PUSH_LOCK MemoryLimitsLock
Definition: pstypes.h:1464
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LIST_ENTRY JobLinks
Definition: pstypes.h:1419
#define ProbeForWriteHandle(Ptr)
Definition: probe.h:43
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2932
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
LIST_ENTRY PsJobListHead
Definition: job.c:22
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
LIST_ENTRY JobSetLinks
Definition: pstypes.h:1466
#define DPRINT1
Definition: precomp.h:8
ULONG SessionId
Definition: pstypes.h:1445
ULONG NTAPI PsGetProcessSessionId(IN PEPROCESS Process)
Definition: process.c:1163
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define PAGED_CODE()

◆ NtCreateJobSet()

NTSTATUS NTAPI NtCreateJobSet ( IN ULONG  NumJob,
IN PJOB_SET_ARRAY  UserJobSet,
IN ULONG  Flags 
)

Definition at line 243 of file job.c.

246 {
248  return STATUS_NOT_IMPLEMENTED;
249 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by CreateJobSet().

◆ NtIsProcessInJob()

NTSTATUS NTAPI NtIsProcessInJob ( IN HANDLE  ProcessHandle,
IN HANDLE JobHandle  OPTIONAL 
)

Definition at line 361 of file job.c.

364 {
368 
370 
371  PAGED_CODE();
372 
377  PreviousMode,
378  (PVOID*)&Process,
379  NULL);
380  if(NT_SUCCESS(Status))
381  {
382  /* FIXME - make sure the job object doesn't get exchanged or deleted while trying to
383  reference it, e.g. by locking it somehow until it is referenced... */
384 
385  PEJOB ProcessJob = Process->Job;
386 
387  if(ProcessJob != NULL)
388  {
389  if(JobHandle == NULL)
390  {
391  /* the process is assigned to a job */
393  }
394  else /* JobHandle != NULL */
395  {
396  PEJOB JobObject;
397 
398  /* get the job object and compare the object pointer with the one assigned to the process */
399  Status = ObReferenceObjectByHandle(JobHandle,
401  PsJobType,
402  PreviousMode,
403  (PVOID*)&JobObject,
404  NULL);
405  if(NT_SUCCESS(Status))
406  {
407  Status = ((ProcessJob == JobObject) ? STATUS_PROCESS_IN_JOB : STATUS_PROCESS_NOT_IN_JOB);
408  ObDereferenceObject(JobObject);
409  }
410  }
411  }
412  else
413  {
414  /* the process is not assigned to any job */
416  }
418  }
419 
420  return Status;
421 }
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:158
POBJECT_TYPE PsJobType
Definition: job.c:20
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define JOB_OBJECT_QUERY
Definition: pstypes.h:194
#define STATUS_PROCESS_NOT_IN_JOB
Definition: ntstatus.h:107
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
smooth NULL
Definition: ftsmooth.c:416
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define STATUS_PROCESS_IN_JOB
Definition: ntstatus.h:108
_In_ HANDLE ProcessHandle
Definition: mmfuncs.h:403
POBJECT_TYPE PsProcessType
Definition: process.c:20
#define PAGED_CODE()

Referenced by CreateProcessInternalW(), and IsProcessInJob().

◆ NtOpenJobObject()

NTSTATUS NTAPI NtOpenJobObject ( PHANDLE  JobHandle,
ACCESS_MASK  DesiredAccess,
POBJECT_ATTRIBUTES  ObjectAttributes 
)

Definition at line 429 of file job.c.

433 {
435  HANDLE hJob;
437 
438  PAGED_CODE();
439 
441 
442  /* check for valid buffers */
443  if (PreviousMode != KernelMode)
444  {
445  _SEH2_TRY
446  {
447  ProbeForWriteHandle(JobHandle);
448  }
450  {
452  }
453  _SEH2_END;
454  }
455 
457  PsJobType,
458  PreviousMode,
459  NULL,
461  NULL,
462  &hJob);
463  if(NT_SUCCESS(Status))
464  {
465  _SEH2_TRY
466  {
467  *JobHandle = hJob;
468  }
470  {
472  }
473  _SEH2_END;
474  }
475 
476  return Status;
477 }
NTSTATUS NTAPI ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN OUT PVOID ParseContext, OUT PHANDLE Handle)
Definition: obhandle.c:2529
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
POBJECT_TYPE PsJobType
Definition: job.c:20
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ProbeForWriteHandle(Ptr)
Definition: probe.h:43
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define PAGED_CODE()

◆ NtQueryInformationJobObject()

NTSTATUS NTAPI NtQueryInformationJobObject ( HANDLE  JobHandle,
JOBOBJECTINFOCLASS  JobInformationClass,
PVOID  JobInformation,
ULONG  JobInformationLength,
PULONG  ReturnLength 
)

Definition at line 485 of file job.c.

491 {
492  PEJOB Job;
494  BOOLEAN NoOutput;
495  PVOID GenericCopy;
496  PLIST_ENTRY NextEntry;
497  PKTHREAD CurrentThread;
501  ULONG RequiredLength, RequiredAlign, SizeToCopy, NeededSize;
502 
503  PAGED_CODE();
504 
505  CurrentThread = KeGetCurrentThread();
506 
507  /* Validate class */
508  if (JobInformationClass > JobObjectJobSetInformation || JobInformationClass < JobObjectBasicAccountingInformation)
509  {
511  }
512 
513  /* Get associated lengths & alignments */
514  RequiredLength = PspJobInfoLengths[JobInformationClass];
515  RequiredAlign = PspJobInfoAlign[JobInformationClass];
516  SizeToCopy = RequiredLength;
517  NeededSize = RequiredLength;
518 
519  /* If length mismatch (needed versus provided) */
520  if (JobInformationLength != RequiredLength)
521  {
522  /* This can only be accepted if: JobObjectBasicProcessIdList or JobObjectSecurityLimitInformation
523  * Or if size is bigger than needed
524  */
525  if ((JobInformationClass != JobObjectBasicProcessIdList && JobInformationClass != JobObjectSecurityLimitInformation) ||
526  JobInformationLength < RequiredLength)
527  {
529  }
530 
531  /* Set what we need to copy out */
532  SizeToCopy = JobInformationLength;
533  }
534 
536  /* If not comming from umode, we need to probe buffers */
537  if (PreviousMode != KernelMode)
538  {
539  ASSERT(((RequiredAlign) == 1) || ((RequiredAlign) == 2) || ((RequiredAlign) == 4) || ((RequiredAlign) == 8) || ((RequiredAlign) == 16));
540 
541  _SEH2_TRY
542  {
543  /* Probe out buffer for write */
544  if (JobInformation != NULL)
545  {
546  ProbeForWrite(JobInformation, JobInformationLength, RequiredAlign);
547  }
548 
549  /* But also return lenght if asked */
550  if (ReturnLength != NULL)
551  {
552  ProbeForWrite(JobInformation, sizeof(ULONG), sizeof(ULONG));
553  }
554  }
556  {
558  }
559  _SEH2_END;
560  }
561 
562  /* If a job handle was provided, use it */
563  if (JobHandle != NULL)
564  {
565  Status = ObReferenceObjectByHandle(JobHandle,
567  PsJobType,
568  PreviousMode,
569  (PVOID*)&Job,
570  NULL);
571  if (!NT_SUCCESS(Status))
572  {
573  return Status;
574  }
575  }
576  /* Otherwise, get our current process' job, if any */
577  else
578  {
580 
581  CurrentProcess = (PEPROCESS)CurrentThread->ApcState.Process;
582  Job = CurrentProcess->Job;
583  if (Job == NULL)
584  {
585  return STATUS_ACCESS_DENIED;
586  }
587 
588  ObReferenceObject(Job);
589  }
590 
591  /* By default, assume we'll have to copy data */
592  NoOutput = FALSE;
593  /* Select class */
594  switch (JobInformationClass)
595  {
596  /* Basic counters */
599  /* Zero basics */
601 
602  /* Lock */
603  KeEnterGuardedRegionThread(CurrentThread);
605 
606  /* Initialize with job counters */
612  BasicAndIo.BasicInfo.TotalProcesses = Job->TotalProcesses;
613  BasicAndIo.BasicInfo.ActiveProcesses = Job->ActiveProcesses;
615 
616  /* We also set IoInfo, even though we might not return it */
617  BasicAndIo.IoInfo.ReadOperationCount = Job->ReadOperationCount;
620  BasicAndIo.IoInfo.ReadTransferCount = Job->ReadTransferCount;
621  BasicAndIo.IoInfo.WriteTransferCount = Job->WriteTransferCount;
622  BasicAndIo.IoInfo.OtherTransferCount = Job->OtherTransferCount;
623 
624  /* For every process, sum its counters */
625  for (NextEntry = Job->ProcessListHead.Flink;
626  NextEntry != &Job->ProcessListHead;
627  NextEntry = NextEntry->Flink)
628  {
630 
631  Process = CONTAINING_RECORD(NextEntry, EPROCESS, JobLinks);
632  if (!BooleanFlagOn(Process->JobStatus, 2))
633  {
634  PROCESS_VALUES Values;
635 
636  KeQueryValuesProcess(&Process->Pcb, &Values);
639  BasicAndIo.IoInfo.ReadOperationCount += Values.IoInfo.ReadOperationCount;
642  BasicAndIo.IoInfo.ReadTransferCount += Values.IoInfo.ReadTransferCount;
643  BasicAndIo.IoInfo.WriteTransferCount += Values.IoInfo.WriteTransferCount;
644  BasicAndIo.IoInfo.OtherTransferCount += Values.IoInfo.OtherTransferCount;
645  }
646  }
647 
648  /* And done */
650  KeLeaveGuardedRegionThread(CurrentThread);
651 
652  /* We'll copy back the buffer */
653  GenericCopy = &BasicAndIo;
655 
656  break;
657 
658  /* Limits information */
661  /* Lock */
662  KeEnterGuardedRegionThread(CurrentThread);
664 
665  /* Copy basic information */
666  ExtendedLimit.BasicLimitInformation.LimitFlags = Job->LimitFlags;
672  ExtendedLimit.BasicLimitInformation.Affinity = Job->Affinity;
675 
676  /* If asking for extending limits */
677  if (JobInformationClass == JobObjectExtendedLimitInformation)
678  {
679  /* Lock our memory lock */
681  /* Return limits */
682  ExtendedLimit.ProcessMemoryLimit = Job->ProcessMemoryLimit << PAGE_SHIFT;
683  ExtendedLimit.JobMemoryLimit = Job->JobMemoryLimit << PAGE_SHIFT;
685  ExtendedLimit.PeakJobMemoryUsed = Job->PeakJobMemoryUsed << PAGE_SHIFT;
687 
688  /* And done */
690  KeLeaveGuardedRegionThread(CurrentThread);
691 
692  /* We'll never return IoInfo, so zero it out to avoid
693  * kernel memory leak
694  */
695  RtlZeroMemory(&ExtendedLimit.IoInfo, sizeof(IO_COUNTERS));
696  }
697  else
698  {
699  /* And done */
701  KeLeaveGuardedRegionThread(CurrentThread);
702  }
703 
704  /* We'll copy back the buffer */
705  GenericCopy = &ExtendedLimit;
707 
708  break;
709 
710  default:
711  DPRINT1("Class %d not implemented\n", JobInformationClass);
713  break;
714  }
715 
716  /* Job is no longer required */
717  ObDereferenceObject(Job);
718 
719  /* If we succeeed, copy back data */
720  if (NT_SUCCESS(Status))
721  {
722  _SEH2_TRY
723  {
724  /* If we have anything to copy, do it */
725  if (!NoOutput)
726  {
727  RtlCopyMemory(JobInformation, GenericCopy, SizeToCopy);
728  }
729 
730  /* And return length if asked */
731  if (ReturnLength != NULL)
732  {
733  *ReturnLength = NeededSize;
734  }
735  }
737  {
739  }
740  _SEH2_END;
741  }
742 
743  return Status;
744 }
ULONG LimitFlags
Definition: pstypes.h:1432
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
ULONGLONG OtherOperationCount
Definition: pstypes.h:85
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
POBJECT_TYPE PsJobType
Definition: job.c:20
LARGE_INTEGER TotalUserTime
Definition: pstypes.h:1422
LARGE_INTEGER ThisPeriodTotalKernelTime
Definition: pstypes.h:1425
LONG NTSTATUS
Definition: precomp.h:26
struct _EPROCESS * PEPROCESS
Definition: nt_native.h:30
ULONGLONG WriteOperationCount
Definition: pstypes.h:84
ERESOURCE JobLock
Definition: pstypes.h:1421
ULONG TotalTerminatedProcesses
Definition: pstypes.h:1429
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
IO_COUNTERS IoInfo
Definition: ke.h:43
ULONGLONG WriteTransferCount
Definition: pstypes.h:1451
#define JOB_OBJECT_QUERY
Definition: pstypes.h:194
ULONG PeakProcessMemoryUsed
Definition: pstypes.h:1456
ULONG ActiveProcesses
Definition: pstypes.h:1428
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
ULONG PspJobInfoAlign[]
Definition: job.c:68
_SEH2_TRY
Definition: create.c:4250
ULONG Affinity
Definition: pstypes.h:1436
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
KAPC_STATE ApcState
Definition: ketypes.h:1668
JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo
Definition: pstypes.h:1535
JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation
Definition: pstypes.h:1541
ULONGLONG ReadTransferCount
Definition: pstypes.h:1450
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
ULONG SchedulingClass
Definition: pstypes.h:1446
smooth NULL
Definition: ftsmooth.c:416
LIST_ENTRY ProcessListHead
Definition: pstypes.h:1420
LARGE_INTEGER ThisPeriodTotalUserTime
Definition: pstypes.h:1424
ULONGLONG WriteTransferCount
Definition: pstypes.h:87
LARGE_INTEGER PerProcessUserTimeLimit
Definition: pstypes.h:1430
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
ULONG CurrentProcess
Definition: shell.c:125
ULONG MaximumWorkingSetSize
Definition: pstypes.h:1434
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
EX_PUSH_LOCK MemoryLimitsLock
Definition: pstypes.h:1464
if(!(yy_init))
Definition: macro.lex.yy.c:714
VOID NTAPI KeQueryValuesProcess(IN PKPROCESS Process, PPROCESS_VALUES Values)
Definition: procobj.c:522
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG PspJobInfoLengths[]
Definition: job.c:53
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeEnterGuardedRegionThread(_Thread)
Definition: ke_x.h:22
LARGE_INTEGER PerJobUserTimeLimit
Definition: pstypes.h:1431
VOID FASTCALL KeReleaseGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:75
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:226
ULONGLONG ReadTransferCount
Definition: pstypes.h:86
LARGE_INTEGER TotalKernelTime
Definition: pstypes.h:1423
ULONG JobMemoryLimit
Definition: pstypes.h:1455
ULONG ProcessMemoryLimit
Definition: pstypes.h:1454
Definition: typedefs.h:118
ULONGLONG OtherOperationCount
Definition: pstypes.h:1449
ULONG TotalProcesses
Definition: pstypes.h:1427
UCHAR PriorityClass
Definition: pstypes.h:1437
ULONG ActiveProcessLimit
Definition: pstypes.h:1435
Status
Definition: gdiplustypes.h:24
LARGE_INTEGER PerProcessUserTimeLimit
Definition: pstypes.h:1490
_SEH2_END
Definition: create.c:4424
ULONGLONG OtherTransferCount
Definition: pstypes.h:1452
ULONG MinimumWorkingSetSize
Definition: pstypes.h:1433
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
ULONG TotalPageFaultCount
Definition: pstypes.h:1426
LARGE_INTEGER TotalKernelTime
Definition: ke.h:41
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
ULONGLONG ReadOperationCount
Definition: pstypes.h:1447
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
ULONGLONG WriteOperationCount
Definition: pstypes.h:1448
#define ObReferenceObject
Definition: obfuncs.h:204
VOID FASTCALL KeAcquireGuardedMutexUnsafe(IN OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:64
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
LARGE_INTEGER TotalUserTime
Definition: ke.h:42
#define KeLeaveGuardedRegionThread(_Thread)
Definition: ke_x.h:43
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
ULONGLONG OtherTransferCount
Definition: pstypes.h:88
#define KeGetCurrentThread
Definition: hal.h:44
return STATUS_SUCCESS
Definition: btrfs.c:3014
LONGLONG QuadPart
Definition: typedefs.h:113
ULONGLONG ReadOperationCount
Definition: pstypes.h:83
ULONG PeakJobMemoryUsed
Definition: pstypes.h:1457
#define PAGED_CODE()

Referenced by QueryInformationJobObject().

◆ NtSetInformationJobObject()

NTSTATUS NTAPI NtSetInformationJobObject ( HANDLE  JobHandle,
JOBOBJECTINFOCLASS  JobInformationClass,
PVOID  JobInformation,
ULONG  JobInformationLength 
)

Definition at line 752 of file job.c.

757 {
758  PEJOB Job;
760  PKTHREAD CurrentThread;
763  ULONG RequiredLength, RequiredAlign;
764 
765  PAGED_CODE();
766 
767  CurrentThread = KeGetCurrentThread();
768 
769  /* Validate class */
770  if (JobInformationClass > JobObjectJobSetInformation || JobInformationClass < JobObjectBasicAccountingInformation)
771  {
773  }
774 
775  /* Get associated lengths & alignments */
776  RequiredLength = PspJobInfoLengths[JobInformationClass];
777  RequiredAlign = PspJobInfoAlign[JobInformationClass];
778 
780  /* If not comming from umode, we need to probe buffers */
781  if (PreviousMode != KernelMode)
782  {
783  ASSERT(((RequiredAlign) == 1) || ((RequiredAlign) == 2) || ((RequiredAlign) == 4) || ((RequiredAlign) == 8) || ((RequiredAlign) == 16));
784 
785  _SEH2_TRY
786  {
787  /* Probe out buffer for read */
788  if (JobInformationLength != 0)
789  {
790  ProbeForRead(JobInformation, JobInformationLength, RequiredAlign);
791  }
792  }
794  {
796  }
797  _SEH2_END;
798  }
799 
800  /* Validate input size */
801  if (JobInformationLength != RequiredLength)
802  {
804  }
805 
806  /* Open the given job */
808  if (JobInformationClass == JobObjectSecurityLimitInformation)
809  {
811  }
812  Status = ObReferenceObjectByHandle(JobHandle,
814  PsJobType,
815  PreviousMode,
816  (PVOID*)&Job,
817  NULL);
818  if (!NT_SUCCESS(Status))
819  {
820  return Status;
821  }
822 
823  /* And set the information */
824  KeEnterGuardedRegionThread(CurrentThread);
825  switch (JobInformationClass)
826  {
828  DPRINT1("Class JobObjectExtendedLimitInformation not implemented\n");
830  break;
831 
832  default:
833  DPRINT1("Class %d not implemented\n", JobInformationClass);
835  break;
836  }
837  KeLeaveGuardedRegionThread(CurrentThread);
838 
839  ObDereferenceObject(Job);
840 
841  return Status;
842 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
POBJECT_TYPE PsJobType
Definition: job.c:20
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
ULONG PspJobInfoAlign[]
Definition: job.c:68
_SEH2_TRY
Definition: create.c:4250
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG PspJobInfoLengths[]
Definition: job.c:53
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeEnterGuardedRegionThread(_Thread)
Definition: ke_x.h:22
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:226
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define JOB_OBJECT_SET_ATTRIBUTES
Definition: pstypes.h:193
#define KeLeaveGuardedRegionThread(_Thread)
Definition: ke_x.h:43
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define KeGetCurrentThread
Definition: hal.h:44
#define JOB_OBJECT_SET_SECURITY_ATTRIBUTES
Definition: pstypes.h:196
return STATUS_SUCCESS
Definition: btrfs.c:3014
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define PAGED_CODE()

Referenced by SetInformationJobObject().

◆ NtTerminateJobObject()

NTSTATUS NTAPI NtTerminateJobObject ( HANDLE  JobHandle,
NTSTATUS  ExitStatus 
)

Definition at line 850 of file job.c.

853 {
855  PEJOB Job;
857 
858  PAGED_CODE();
859 
861 
863  JobHandle,
865  PsJobType,
866  PreviousMode,
867  (PVOID*)&Job,
868  NULL);
869  if(NT_SUCCESS(Status))
870  {
872  Job,
873  PreviousMode,
874  ExitStatus);
875  ObDereferenceObject(Job);
876  }
877 
878  return Status;
879 }
POBJECT_TYPE PsJobType
Definition: job.c:20
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:496
smooth NULL
Definition: ftsmooth.c:416
#define JOB_OBJECT_TERMINATE
Definition: pstypes.h:195
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
NTSTATUS NTAPI PspTerminateJobObject(PEJOB Job, KPROCESSOR_MODE AccessMode, NTSTATUS ExitStatus)
Definition: job.c:128
Status
Definition: gdiplustypes.h:24
_In_ NTSTATUS ExitStatus
Definition: psfuncs.h:859
#define PAGED_CODE()

Referenced by TerminateJobObject().

◆ PsGetJobLock()

PVOID NTAPI PsGetJobLock ( PEJOB  Job)

Definition at line 887 of file job.c.

888 {
889  ASSERT(Job);
890  return (PVOID)&Job->JobLock;
891 }
ERESOURCE JobLock
Definition: pstypes.h:1421
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ PsGetJobSessionId()

ULONG NTAPI PsGetJobSessionId ( PEJOB  Job)

Definition at line 899 of file job.c.

900 {
901  ASSERT(Job);
902  return Job->SessionId;
903 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG SessionId
Definition: pstypes.h:1445

◆ PsGetJobUIRestrictionsClass()

ULONG NTAPI PsGetJobUIRestrictionsClass ( PEJOB  Job)

Definition at line 911 of file job.c.

912 {
913  ASSERT(Job);
914  return Job->UIRestrictionsClass;
915 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG UIRestrictionsClass
Definition: pstypes.h:1438

◆ PspAssignProcessToJob()

NTSTATUS NTAPI PspAssignProcessToJob ( PEPROCESS  Process,
PEJOB  Job 
)

Definition at line 119 of file job.c.

121 {
122  DPRINT("PspAssignProcessToJob() is unimplemented!\n");
123  return STATUS_NOT_IMPLEMENTED;
124 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by NtAssignProcessToJobObject().

◆ PspDeleteJob()

VOID NTAPI PspDeleteJob ( PVOID  ObjectBody)

Definition at line 87 of file job.c.

88 {
89  PEJOB Job = (PEJOB)ObjectBody;
90 
91  /* remove the reference to the completion port if associated */
92  if(Job->CompletionPort != NULL)
93  {
95  }
96 
97  /* unlink the job object */
98  if(Job->JobLinks.Flink != NULL)
99  {
101  RemoveEntryList(&Job->JobLinks);
103  }
104 
105  ExDeleteResource(&Job->JobLock);
106 }
ERESOURCE JobLock
Definition: pstypes.h:1421
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
VOID FASTCALL ExReleaseFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:31
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
static FAST_MUTEX PsJobListLock
Definition: job.c:23
smooth NULL
Definition: ftsmooth.c:416
#define ExDeleteResource
Definition: exfuncs.h:345
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
PVOID CompletionPort
Definition: pstypes.h:1443
LIST_ENTRY JobLinks
Definition: pstypes.h:1419
VOID FASTCALL ExAcquireFastMutex(IN PFAST_MUTEX FastMutex)
Definition: fmutex.c:23
struct _EJOB * PEJOB

◆ PspExitProcessFromJob()

VOID NTAPI PspExitProcessFromJob ( IN PEJOB  Job,
IN PEPROCESS  Process 
)

Definition at line 146 of file job.c.

148 {
149  /* FIXME */
150 }

Referenced by PspExitThread().

◆ PspInitializeJobStructures()

INIT_FUNCTION VOID NTAPI PspInitializeJobStructures ( VOID  )

Definition at line 111 of file job.c.

112 {
115 }
static FAST_MUTEX PsJobListLock
Definition: job.c:23
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
LIST_ENTRY PsJobListHead
Definition: job.c:22
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

Referenced by PspInitPhase0().

◆ PspRemoveProcessFromJob()

VOID NTAPI PspRemoveProcessFromJob ( IN PEPROCESS  Process,
IN PEJOB  Job 
)

Definition at line 138 of file job.c.

140 {
141  /* FIXME */
142 }

Referenced by PspDeleteProcess().

◆ PspTerminateJobObject()

NTSTATUS NTAPI PspTerminateJobObject ( PEJOB  Job,
KPROCESSOR_MODE  AccessMode,
NTSTATUS  ExitStatus 
)

Definition at line 128 of file job.c.

131 {
132  DPRINT("PspTerminateJobObject() is unimplemented!\n");
133  return STATUS_NOT_IMPLEMENTED;
134 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
void DPRINT(...)
Definition: polytest.cpp:61

Referenced by NtTerminateJobObject().

◆ PsSetJobUIRestrictionsClass()

VOID NTAPI PsSetJobUIRestrictionsClass ( PEJOB  Job,
ULONG  UIRestrictionsClass 
)

Definition at line 923 of file job.c.

925 {
926  ASSERT(Job);
927  (void)InterlockedExchangeUL(&Job->UIRestrictionsClass, UIRestrictionsClass);
928  /* FIXME - walk through the job process list and update the restrictions? */
929 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define InterlockedExchangeUL(Target, Value)
Definition: ex.h:1516
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG UIRestrictionsClass
Definition: pstypes.h:1438

Variable Documentation

◆ PsJobListHead

LIST_ENTRY PsJobListHead

Definition at line 22 of file job.c.

Referenced by NtCreateJobObject(), and PspInitializeJobStructures().

◆ PsJobListLock

FAST_MUTEX PsJobListLock
static

Definition at line 23 of file job.c.

Referenced by NtCreateJobObject(), PspDeleteJob(), and PspInitializeJobStructures().

◆ PsJobType

◆ PspJobInfoAlign

ULONG PspJobInfoAlign[]
Initial value:
=
{
0x0,
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG),
sizeof(ULONG)
}
unsigned int ULONG
Definition: retypes.h:1

Definition at line 68 of file job.c.

Referenced by NtQueryInformationJobObject(), and NtSetInformationJobObject().

◆ PspJobInfoLengths

ULONG PspJobInfoLengths[]
Initial value:
=
{
0x0,
0x4
}
struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION JOBOBJECT_EXTENDED_LIMIT_INFORMATION
struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION JOBOBJECT_SECURITY_LIMIT_INFORMATION
struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT JOBOBJECT_ASSOCIATE_COMPLETION_PORT
struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
struct _JOBOBJECT_BASIC_PROCESS_ID_LIST JOBOBJECT_BASIC_PROCESS_ID_LIST

Definition at line 53 of file job.c.

Referenced by NtQueryInformationJobObject(), and NtSetInformationJobObject().

◆ PspJobMapping

GENERIC_MAPPING PspJobMapping
Initial value:
=
{
}
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
#define STANDARD_RIGHTS_WRITE
Definition: nt_native.h:66
#define JOB_OBJECT_ASSIGN_PROCESS
Definition: pstypes.h:192
#define STANDARD_RIGHTS_EXECUTE
Definition: nt_native.h:67
#define JOB_OBJECT_QUERY
Definition: pstypes.h:194
#define JOB_OBJECT_TERMINATE
Definition: pstypes.h:195
#define STANDARD_RIGHTS_READ
Definition: nt_native.h:65
#define SYNCHRONIZE
Definition: nt_native.h:61
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
#define JOB_OBJECT_SET_ATTRIBUTES
Definition: pstypes.h:193

Definition at line 41 of file job.c.

Referenced by PspInitPhase0().

◆ PspJobSchedulingClasses

CHAR PspJobSchedulingClasses[PSP_JOB_SCHEDULING_CLASSES]
Initial value:
=
{
1 * 6,
2 * 6,
3 * 6,
4 * 6,
5 * 6,
6 * 6,
7 * 6,
8 * 6,
9 * 6,
10 * 6
}

Definition at line 27 of file job.c.

Referenced by PsChangeQuantumTable(), and PspComputeQuantumAndPriority().

◆ PspUseJobSchedulingClasses

BOOLEAN PspUseJobSchedulingClasses

Definition at line 25 of file job.c.

Referenced by PsChangeQuantumTable(), and PspComputeQuantumAndPriority().