diff --git a/ntoskrnl/ob/obhandle.c b/ntoskrnl/ob/obhandle.c index cff2cbb80e9..bf9f1f09cb5 100644 --- a/ntoskrnl/ob/obhandle.c +++ b/ntoskrnl/ob/obhandle.c @@ -457,14 +457,19 @@ ObpChargeQuotaForObject(IN POBJECT_HEADER ObjectHeader, NonPagedPoolCharge = ObjectType->TypeInfo.DefaultNonPagedPoolCharge; } - /* Charge the quota */ - ObjectHeader->QuotaBlockCharged = (PVOID)1; - DPRINT("FIXME: Should charge: %lx %lx\n", PagedPoolCharge, NonPagedPoolCharge); -#if 0 - PsChargeSharedPoolQuota(PsGetCurrentProcess(), - PagedPoolCharge, - NonPagedPoolCharge); -#endif + /* Is this the system process? */ + if (PsGetCurrentProcess() == PsInitialSystemProcess) + { + /* It is, don't do anything */ + ObjectHeader->QuotaBlockCharged = OBP_SYSTEM_PROCESS_QUOTA; + } + else + { + /* Charge the quota */ + ObjectHeader->QuotaBlockCharged = PsChargeSharedPoolQuota(PsGetCurrentProcess(), + PagedPoolCharge, + NonPagedPoolCharge); + } /* Check if we don't have a quota block */ if (!ObjectHeader->QuotaBlockCharged) return STATUS_QUOTA_EXCEEDED; diff --git a/ntoskrnl/ob/oblife.c b/ntoskrnl/ob/oblife.c index 06c0d96e904..f46cb4098b3 100644 --- a/ntoskrnl/ob/oblife.c +++ b/ntoskrnl/ob/oblife.c @@ -110,13 +110,12 @@ ObpDeallocateObject(IN PVOID Object) } /* Return the quota */ - DPRINT("FIXME: Should return quotas: %lx %lx\n", PagedPoolCharge, NonPagedPoolCharge); -#if 0 - PsReturnSharedPoolQuota(ObjectHeader->QuotaBlockCharged, - PagedPoolCharge, - NonPagedPoolCharge); -#endif - + if (Header->QuotaBlockCharged != OBP_SYSTEM_PROCESS_QUOTA) + { + PsReturnSharedPoolQuota(Header->QuotaBlockCharged, + PagedPoolCharge, + NonPagedPoolCharge); + } } }