--- trunk/reactos/ntoskrnl/ps/quota.c 2005-08-01 11:46:30 UTC (rev 16946)
+++ trunk/reactos/ntoskrnl/ps/quota.c 2005-08-01 11:58:47 UTC (rev 16947)
@@ -19,17 +19,18 @@
STDCALL
PspInheritQuota(PEPROCESS Process, PEPROCESS ParentProcess)
{
- PEPROCESS_QUOTA_BLOCK QuotaBlock;
+ if (ParentProcess != NULL)
+ {
+ PEPROCESS_QUOTA_BLOCK QuotaBlock = ParentProcess->QuotaBlock;
+
+ ASSERT(QuotaBlock != NULL);
- if (ParentProcess != NULL)
- QuotaBlock = ParentProcess->QuotaBlock;
+ InterlockedIncrementUL(&QuotaBlock->ReferenceCount);
+
+ Process->QuotaBlock = QuotaBlock;
+ }
else
- QuotaBlock = &PspDefaultQuotaBlock;
-
- ASSERT(QuotaBlock != NULL);
-
- InterlockedIncrement(&QuotaBlock->ReferenceCount);
- Process->QuotaBlock = QuotaBlock;
+ Process->QuotaBlock = &PspDefaultQuotaBlock;
}
VOID
@@ -38,10 +39,10 @@
{
PEPROCESS_QUOTA_BLOCK QuotaBlock = Process->QuotaBlock;
- if (InterlockedDecrement(&QuotaBlock->ReferenceCount) == 0)
+ if (QuotaBlock != &PspDefaultQuotaBlock &&
+ InterlockedDecrementUL(&QuotaBlock->ReferenceCount) == 0)
{
- if (QuotaBlock != &PspDefaultQuotaBlock)
- ExFreePool(QuotaBlock);
+ ExFreePool(QuotaBlock);
}
}