1. added EJOB structure

2. implemented PsGetProcessJob(), PsGetJobLock(), PsGetJobSessionId() and PsGetJobUIRestrictionsClass()

svn path=/trunk/; revision=10974
This commit is contained in:
Thomas Bluemel 2004-09-22 14:53:26 +00:00
parent cd3894b51d
commit bebf5b5e5e
5 changed files with 167 additions and 105 deletions

View file

@ -1,4 +1,4 @@
/* $Id: psfuncs.h,v 1.32 2004/08/12 06:04:21 ion Exp $
/* $Id: psfuncs.h,v 1.33 2004/09/22 14:53:26 weiden Exp $
*/
#ifndef _INCLUDE_DDK_PSFUNCS_H
#define _INCLUDE_DDK_PSFUNCS_H
@ -118,17 +118,17 @@ STDCALL PsGetCurrentThreadStackLimit (
PVOID
STDCALL PsGetJobLock(
PVOID */*PEJOB*/ Job
PEJOB Job
);
PVOID
STDCALL PsGetJobSessionId(
PVOID /*PEJOB*/ Job
PEJOB Job
);
ULONG
STDCALL PsGetJobUIRestrictionsClass(
PVOID /*PEJOB*/ Job
PEJOB Job
);
LONGLONG
@ -167,7 +167,7 @@ STDCALL PsGetProcessInheritedFromUniqueProcessId(
PEPROCESS Process
);
PVOID /*PEJOB*/
PEJOB
STDCALL PsGetProcessJob(
PEPROCESS Process
);
@ -311,7 +311,7 @@ PsRevertThreadToSelf(
VOID
STDCALL PsSetJobUIRestrictionsClass(
PVOID /*PEJOB*/ Job,
PEJOB Job,
ULONG UIRestrictionsClass
);

View file

@ -20,7 +20,9 @@ struct _EPROCESS;
struct _KPROCESS;
struct _ETHREAD;
struct _KTHREAD;
struct _EJOB;
typedef struct _EJOB *PEJOB;
typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
typedef struct _IMAGE_INFO {

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: ps.h,v 1.66 2004/08/31 20:17:17 hbirr Exp $
/* $Id: ps.h,v 1.67 2004/09/22 14:53:26 weiden Exp $
*
* FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Process manager definitions
@ -33,6 +33,7 @@
/* Forward declarations. */
struct _KTHREAD;
struct _KTRAPFRAME;
struct _EJOB;
#endif /* __ASM__ */
@ -433,6 +434,9 @@ struct _EPROCESS
/* Added by Alex Ionescu (alex@relsoft.net)*/
ULONG SessionId;
struct _EPORT* SecurityPort;
struct _EJOB* Job;
UINT JobStatus;
};
#define PROCESS_STATE_TERMINATED (1)
@ -574,6 +578,69 @@ VOID
STDCALL
PspRunCreateProcessNotifyRoutines(PEPROCESS, BOOLEAN);
#include <pshpack1.h>
typedef struct _PS_JOB_TOKEN_FILTER
{
UINT CapturedSidCount;
PSID_AND_ATTRIBUTES CapturedSids;
UINT CapturedSidsLength;
UINT CapturedGroupCount;
PSID_AND_ATTRIBUTES CapturedGroups;
UINT CapturedGroupsLength;
UINT CapturedPrivilegeCount;
PLUID_AND_ATTRIBUTES CapturedPrivileges;
UINT CapturedPrivilegesLength;
} PS_JOB_TOKEN_FILTER, *PPS_JOB_TOKEN_FILTER;
#include <poppack.h>
#include <pshpack1.h>
typedef struct _EJOB
{
KEVENT Event;
LIST_ENTRY JobLinks;
LIST_ENTRY ProcessListHead;
ERESOURCE JobLock;
LARGE_INTEGER TotalUserTime;
LARGE_INTEGER TotalKernelTime;
LARGE_INTEGER ThisPeriodTotalUserTime;
LARGE_INTEGER ThisPeriodTotalKernelTime;
UINT TotalPageFaultCount;
UINT TotalProcesses;
UINT ActiveProcesses;
UINT TotalTerminatedProcesses;
LARGE_INTEGER PerProcessUserTimeLimit;
LARGE_INTEGER PerJobUserTimeLimit;
UINT LimitFlags;
UINT MinimumWorkingSetSize;
UINT MaximumWorkingSetSize;
UINT ActiveProcessLimit;
UINT Affinity;
BYTE PriorityClass;
UINT UIRestrictionsClass;
UINT SecurityLimitFlags;
PVOID Token;
PPS_JOB_TOKEN_FILTER Filter;
UINT EndOfJobTimeAction;
PVOID CompletionPort;
PVOID CompletionKey;
UINT SessionId;
UINT SchedulingClass;
ULONGLONG ReadOperationCount;
ULONGLONG WriteOperationCount;
ULONGLONG OtherOperationCount;
ULONGLONG ReadTransferCount;
ULONGLONG WriteTransferCount;
ULONGLONG OtherTransferCount;
IO_COUNTERS IoInfo;
UINT ProcessMemoryLimit;
UINT JobMemoryLimit;
UINT PeakProcessMemoryUsed;
UINT PeakJobMemoryUsed;
UINT CurrentJobMemoryUsed;
FAST_MUTEX MemoryLimitsLock;
} EJOB;
#include <poppack.h>
#endif /* ASSEMBLER */
#endif /* __INCLUDE_INTERNAL_PS_H */

View file

@ -21,152 +21,146 @@
*/
NTSTATUS
STDCALL
NtAssignProcessToJobObject(
HANDLE JobHandle,
HANDLE ProcessHandle
)
NtAssignProcessToJobObject(HANDLE JobHandle,
HANDLE ProcessHandle)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtCreateJobObject(
PHANDLE JobHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes
)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtIsProcessInJob(
IN HANDLE ProcessHandle, // ProcessHandle must PROCESS_QUERY_INFORMATION grant access.
IN HANDLE JobHandle OPTIONAL // JobHandle must grant JOB_OBJECT_QUERY access. Defaults to the current process's job object.
)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtOpenJobObject(
PHANDLE JobHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes
)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtQueryInformationJobObject(
HANDLE JobHandle,
JOBOBJECTINFOCLASS JobInformationClass,
PVOID JobInformation,
ULONG JobInformationLength,
PULONG ReturnLength
)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtSetInformationJobObject(
HANDLE JobHandle,
JOBOBJECTINFOCLASS JobInformationClass,
PVOID JobInformation,
ULONG JobInformationLength
)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtTerminateJobObject(
HANDLE JobHandle,
NTSTATUS ExitStatus
)
NtCreateJobObject(PHANDLE JobHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtIsProcessInJob(IN HANDLE ProcessHandle, // ProcessHandle must PROCESS_QUERY_INFORMATION grant access.
IN HANDLE JobHandle OPTIONAL) // JobHandle must grant JOB_OBJECT_QUERY access. Defaults to the current process's job object.
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtOpenJobObject(PHANDLE JobHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtQueryInformationJobObject(HANDLE JobHandle,
JOBOBJECTINFOCLASS JobInformationClass,
PVOID JobInformation,
ULONG JobInformationLength,
PULONG ReturnLength)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtSetInformationJobObject(HANDLE JobHandle,
JOBOBJECTINFOCLASS JobInformationClass,
PVOID JobInformation,
ULONG JobInformationLength)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @unimplemented
*/
NTSTATUS
STDCALL
NtTerminateJobObject(HANDLE JobHandle,
NTSTATUS ExitStatus)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
/*
* @implemented
*/
PVOID
STDCALL
PsGetJobLock(
PVOID */*PEJOB*/ Job
)
PsGetJobLock(PEJOB Job)
{
UNIMPLEMENTED;
return 0;
assert(Job);
return (PVOID)&Job->JobLock;
}
/*
* @unimplemented
* @implemented
*/
PVOID
STDCALL
PsGetJobSessionId(
PVOID /*PEJOB*/ Job
)
PsGetJobSessionId(PEJOB Job)
{
UNIMPLEMENTED;
return 0;
assert(Job);
return (PVOID)Job->SessionId;
}
/*
* @unimplemented
* @implemented
*/
ULONG
STDCALL
PsGetJobUIRestrictionsClass(
PVOID /*PEJOB*/ Job
)
PsGetJobUIRestrictionsClass(PEJOB Job)
{
UNIMPLEMENTED;
return 0;
assert(Job);
return Job->UIRestrictionsClass;
}
/*
* @unimplemented
*/
VOID
STDCALL
PsSetJobUIRestrictionsClass(
PVOID /*PEJOB*/ Job,
ULONG UIRestrictionsClass
)
PsSetJobUIRestrictionsClass(PEJOB Job,
ULONG UIRestrictionsClass)
{
UNIMPLEMENTED;
assert(Job);
InterlockedExchange((LONG*)&Job->UIRestrictionsClass, (LONG)UIRestrictionsClass);
/* FIXME - walk through the job process list and update the restrictions? */
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.140 2004/08/31 20:17:18 hbirr Exp $
/* $Id: process.c,v 1.141 2004/09/22 14:53:26 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1671,16 +1671,15 @@ PsGetProcessInheritedFromUniqueProcessId(
}
/*
* @unimplemented
* @implemented
*/
PVOID /*PEJOB*/
PEJOB
STDCALL
PsGetProcessJob(
PEPROCESS Process
)
{
UNIMPLEMENTED;
return 0;
return Process->Job;
}
/*