--- trunk/reactos/include/ntos/ps.h 2005-01-03 03:54:00 UTC (rev 12746)
+++ trunk/reactos/include/ntos/ps.h 2005-01-03 04:06:24 UTC (rev 12747)
@@ -47,6 +47,7 @@
/* Thread access rights */
#define THREAD_TERMINATE (0x0001L)
#define THREAD_SUSPEND_RESUME (0x0002L)
+#define THREAD_ALERT (0x0004L)
#define THREAD_GET_CONTEXT (0x0008L)
#define THREAD_SET_CONTEXT (0x0010L)
#define THREAD_SET_INFORMATION (0x0020L)
@@ -69,6 +70,7 @@
#define PROCESS_SET_QUOTA (0x0100L)
#define PROCESS_SET_INFORMATION (0x0200L)
#define PROCESS_QUERY_INFORMATION (0x0400L)
+#define PROCESS_SET_PORT (0x0800L)
#define PROCESS_ALL_ACCESS (0x1f0fffL)
--- trunk/reactos/ntoskrnl/include/internal/mm.h 2005-01-03 03:54:00 UTC (rev 12746)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h 2005-01-03 04:06:24 UTC (rev 12747)
@@ -158,15 +158,18 @@
typedef struct _SECTION_OBJECT *PSECTION_OBJECT;
+typedef struct _EPROCESS_QUOTA_ENTRY {
+ ULONG Usage;
+ ULONG Limit;
+ ULONG Peak;
+ ULONG Return;
+} EPROCESS_QUOTA_ENTRY, *PEPROCESS_QUOTA_ENTRY;
+
typedef struct _EPROCESS_QUOTA_BLOCK {
-KSPIN_LOCK QuotaLock;
-ULONG ReferenceCount;
-ULONG QuotaPeakPoolUsage[2];
-ULONG QuotaPoolUsage[2];
-ULONG QuotaPoolLimit[2];
-ULONG PeakPagefileUsage;
-ULONG PagefileUsage;
-ULONG PagefileLimit;
+ EPROCESS_QUOTA_ENTRY QuotaEntry[3];
+ LIST_ENTRY QuotaList;
+ ULONG ReferenceCount;
+ ULONG ProcessCount;
} EPROCESS_QUOTA_BLOCK, *PEPROCESS_QUOTA_BLOCK;
/*
--- trunk/reactos/ntoskrnl/ps/process.c 2005-01-03 03:54:00 UTC (rev 12746)
+++ trunk/reactos/ntoskrnl/ps/process.c 2005-01-03 04:06:24 UTC (rev 12747)
@@ -27,9 +27,11 @@
static ULONG PiNextProcessUniqueId = 0; /* TODO */
static LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
-static GENERIC_MAPPING PiProcessMapping = {PROCESS_READ,
- PROCESS_WRITE,
- PROCESS_EXECUTE,
+static GENERIC_MAPPING PiProcessMapping = {STANDARD_RIGHTS_READ | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ STANDARD_RIGHTS_WRITE | PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD |
+ PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_DUP_HANDLE |
+ PROCESS_TERMINATE | PROCESS_SET_QUOTA | PROCESS_SET_INFORMATION | PROCESS_SET_PORT,
+ STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
PROCESS_ALL_ACCESS};
#define MAX_PROCESS_NOTIFY_ROUTINE_COUNT 8
@@ -1191,10 +1193,10 @@
PKERNEL_USER_TIMES ProcessTimeP =
(PKERNEL_USER_TIMES)ProcessInformation;
- ProcessTimeP->CreateTime = (TIME) Process->CreateTime;
+ ProcessTimeP->CreateTime = Process->CreateTime;
ProcessTimeP->UserTime.QuadPart = Process->Pcb.UserTime * 100000LL;
ProcessTimeP->KernelTime.QuadPart = Process->Pcb.KernelTime * 100000LL;
- ProcessTimeP->ExitTime = (TIME) Process->ExitTime;
+ ProcessTimeP->ExitTime = Process->ExitTime;
if (ReturnLength)
{
@@ -2144,7 +2146,6 @@
)
{
PEPROCESS_QUOTA_BLOCK QuotaBlock;
- KIRQL OldValue;
ULONG NewUsageSize;
ULONG NewMaxQuota;
@@ -2154,40 +2155,33 @@
/* Quota Operations are not to be done on the SYSTEM Process */
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
- /* Acquire Spinlock */
- KeAcquireSpinLock(&QuotaBlock->QuotaLock, &OldValue);
-
/* New Size in use */
- NewUsageSize = QuotaBlock->QuotaPoolUsage[PoolType] + Amount;
+ NewUsageSize = QuotaBlock->QuotaEntry[PoolType].Usage + Amount;
/* Does this size respect the quota? */
- if (NewUsageSize > QuotaBlock->QuotaPoolLimit[PoolType]) {
+ if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Limit) {
/* It doesn't, so keep raising the Quota */
- while (MiRaisePoolQuota(PoolType, QuotaBlock->QuotaPoolLimit[PoolType], &NewMaxQuota)) {
+ while (MiRaisePoolQuota(PoolType, QuotaBlock->QuotaEntry[PoolType].Limit, &NewMaxQuota)) {
/* Save new Maximum Quota */
- QuotaBlock->QuotaPoolLimit[PoolType] = NewMaxQuota;
+ QuotaBlock->QuotaEntry[PoolType].Limit = NewMaxQuota;
/* See if the new Maximum Quota fulfills our need */
if (NewUsageSize <= NewMaxQuota) goto QuotaChanged;
}
- KeReleaseSpinLock(&QuotaBlock->QuotaLock, OldValue);
return STATUS_QUOTA_EXCEEDED;
}
QuotaChanged:
/* Save new Usage */
- QuotaBlock->QuotaPoolUsage[PoolType] = NewUsageSize;
+ QuotaBlock->QuotaEntry[PoolType].Usage = NewUsageSize;
/* Is this a new peak? */
- if (NewUsageSize > QuotaBlock->QuotaPeakPoolUsage[PoolType]) {
- QuotaBlock->QuotaPeakPoolUsage[PoolType] = NewUsageSize;
+ if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Peak) {
+ QuotaBlock->QuotaEntry[PoolType].Peak = NewUsageSize;
}
- /* Release spinlock */
- KeReleaseSpinLock(&QuotaBlock->QuotaLock, OldValue);
-
/* All went well */
return STATUS_SUCCESS;
}
--- trunk/reactos/ntoskrnl/ps/thread.c 2005-01-03 03:54:00 UTC (rev 12746)
+++ trunk/reactos/ntoskrnl/ps/thread.c 2005-01-03 04:06:24 UTC (rev 12747)
@@ -43,9 +43,10 @@
static KEVENT PiReaperThreadEvent;
static BOOLEAN PiReaperThreadShouldTerminate = FALSE;
-static GENERIC_MAPPING PiThreadMapping = {THREAD_READ,
- THREAD_WRITE,
- THREAD_EXECUTE,
+static GENERIC_MAPPING PiThreadMapping = {STANDARD_RIGHTS_READ | THREAD_GET_CONTEXT | THREAD_QUERY_INFORMATION,
+ STANDARD_RIGHTS_WRITE | THREAD_TERMINATE | THREAD_SUSPEND_RESUME | THREAD_ALERT |
+ THREAD_SET_INFORMATION | THREAD_SET_CONTEXT,
+ STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
THREAD_ALL_ACCESS};
/* FUNCTIONS ***************************************************************/