Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

psquota.c File Reference

#include "psp.h"

Go to the source code of this file.

Functions

PEPROCESS_QUOTA_BLOCK PsChargeSharedPoolQuota (IN PEPROCESS Process, IN SIZE_T PagedAmount, IN SIZE_T NonPagedAmount)
VOID PsReturnSharedPoolQuota (IN PEPROCESS_QUOTA_BLOCK QuotaBlock, IN SIZE_T PagedAmount, IN SIZE_T NonPagedAmount)
VOID PsChargePoolQuota (IN PEPROCESS Process, IN POOL_TYPE PoolType, IN SIZE_T Amount)
VOID PsReturnPoolQuota (IN PEPROCESS Process, IN POOL_TYPE PoolType, IN SIZE_T Amount)
VOID PspInheritQuota (IN PEPROCESS NewProcess, IN PEPROCESS ParentProcess)
VOID MiReturnPageFileQuota (IN SIZE_T QuotaCharge, IN PEPROCESS CurrentProcess)
VOID PspDereferenceQuota (IN PEPROCESS Process)


Function Documentation

VOID MiReturnPageFileQuota IN SIZE_T  QuotaCharge,
IN PEPROCESS  CurrentProcess
 

Definition at line 133 of file mmquota.c.

References ASSERT, _EPROCESS_QUOTA_BLOCK::PagefileUsage, PspDefaultQuotaBlock, and _EPROCESS_QUOTA_BLOCK::QuotaLock.

Referenced by MiInsertVad(), MiRemoveVad(), MiReturnPageTablePageCommitment(), MiSetProtectionOnSection(), NtAllocateVirtualMemory(), NtFreeVirtualMemory(), and PspDereferenceQuota().

00140 : 00141 00142 This routine releases page file quota. 00143 00144 Arguments: 00145 00146 QuotaCharge - Supplies the quota amount to charge. 00147 00148 CurrentProcess - Supplies a pointer to the current process. 00149 00150 Return Value: 00151 00152 none. 00153 00154 Environment: 00155 00156 Kernel mode, APCs disabled, WorkingSetLock and AddressCreation mutexes 00157 held. 00158 00159 --*/ 00160 00161 { 00162 00163 PEPROCESS_QUOTA_BLOCK QuotaBlock; 00164 KIRQL OldIrql; 00165 00166 QuotaBlock = CurrentProcess->QuotaBlock; 00167 00168 retry_return: 00169 if ( QuotaBlock != &PspDefaultQuotaBlock) { 00170 ExAcquireFastLock (&QuotaBlock->QuotaLock, &OldIrql); 00171 do_return: 00172 ASSERT (CurrentProcess->PagefileUsage >= QuotaCharge); 00173 CurrentProcess->PagefileUsage -= QuotaCharge; 00174 00175 ASSERT (QuotaBlock->PagefileUsage >= QuotaCharge); 00176 QuotaBlock->PagefileUsage -= QuotaCharge; 00177 ExReleaseFastLock(&QuotaBlock->QuotaLock,OldIrql); 00178 } else { 00179 ExAcquireFastLock (&PspDefaultQuotaBlock.QuotaLock, &OldIrql); 00180 if ( (QuotaBlock = CurrentProcess->QuotaBlock) != &PspDefaultQuotaBlock ) { 00181 ExReleaseFastLock(&PspDefaultQuotaBlock.QuotaLock,OldIrql); 00182 goto retry_return; 00183 } 00184 goto do_return; 00185 } 00186 return; 00187 }

VOID PsChargePoolQuota IN PEPROCESS  Process,
IN POOL_TYPE  PoolType,
IN SIZE_T  Amount
 

Definition at line 246 of file psquota.c.

References ASSERT, ExRaiseStatus(), MmRaisePoolQuota(), PagedPool, ProcessObject, PsInitialSystemProcess, PspDefaultNonPagedLimit, PspDefaultPagedLimit, PspDefaultQuotaBlock, _EPROCESS_QUOTA_BLOCK::QuotaLock, _EPROCESS_QUOTA_BLOCK::QuotaPeakPoolUsage, _EPROCESS_QUOTA_BLOCK::QuotaPoolLimit, and _EPROCESS_QUOTA_BLOCK::QuotaPoolUsage.

Referenced by ExAllocatePoolWithQuota(), ExAllocatePoolWithQuotaTag(), ExpAllocateHandleTable(), ExpAllocateHandleTableEntry(), FsRtlCancelNotify(), FsRtlNotifyFullReportChange(), MiCloneProcessAddressSpace(), MiInsertVad(), NtAllocateUserPhysicalPages(), NtAllocateVirtualMemory(), NtSetLdtEntries(), PspSetLdtInformation(), VdmpDelayInterrupt(), and VdmpInitialize().

00254 : 00255 00256 This function charges pool quota of the specified pool type to 00257 the specified process. If the quota charge would exceed the limits 00258 allowed to the process, then an exception is raised and quota is 00259 not charged. 00260 00261 Arguments: 00262 00263 Process - Supplies the process to charge quota to. 00264 00265 PoolType - Supplies the type of pool quota to charge. 00266 00267 Amount - Supplies the amount of pool quota to charge. 00268 00269 Return Value: 00270 00271 Raises STATUS_QUOTA_EXCEEDED if the quota charge would exceed the 00272 limits allowed to the process. 00273 00274 --*/ 00275 00276 { 00277 00278 KIRQL OldIrql; 00279 SIZE_T NewPoolUsage; 00280 PEPROCESS_QUOTA_BLOCK QuotaBlock; 00281 SIZE_T NewLimit; 00282 SIZE_T HardLimit; 00283 00284 ASSERT((Process->Pcb.Header.Type == ProcessObject) || (Process->Pcb.Header.Type == 0)); 00285 00286 QuotaBlock = Process->QuotaBlock; 00287 00288 retry_charge: 00289 if ( QuotaBlock != &PspDefaultQuotaBlock ) { 00290 ExAcquireSpinLock(&QuotaBlock->QuotaLock,&OldIrql); 00291 do_charge: 00292 NewPoolUsage = QuotaBlock->QuotaPoolUsage[PoolType] + Amount; 00293 00294 // 00295 // See if enough quota exists in the block to satisfy the 00296 // request 00297 // 00298 00299 if ( NewPoolUsage > QuotaBlock->QuotaPoolLimit[PoolType] ) { 00300 if ( PoolType == PagedPool ) { 00301 HardLimit = PspDefaultPagedLimit; 00302 } 00303 else { 00304 HardLimit = PspDefaultNonPagedLimit; 00305 } 00306 00307 while ( (HardLimit == 0) && MmRaisePoolQuota(PoolType,QuotaBlock->QuotaPoolLimit[PoolType],&NewLimit) ) { 00308 QuotaBlock->QuotaPoolLimit[PoolType] = NewLimit; 00309 if ( NewPoolUsage <= NewLimit ) { 00310 goto LimitRaised2; 00311 } 00312 } 00313 00314 //DbgPrint("PS: ChargePool Failed P %8x QB %8x PT %8x Amount %8x\n",Process,QuotaBlock,PoolType,Amount);DbgBreakPoint(); 00315 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00316 ExRaiseStatus(STATUS_QUOTA_EXCEEDED); 00317 } 00318 LimitRaised2: 00319 if ( NewPoolUsage < QuotaBlock->QuotaPoolUsage[PoolType] || 00320 NewPoolUsage < Amount ) { 00321 00322 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00323 ExRaiseStatus(STATUS_QUOTA_EXCEEDED); 00324 } 00325 00326 QuotaBlock->QuotaPoolUsage[PoolType] = NewPoolUsage; 00327 if ( NewPoolUsage > QuotaBlock->QuotaPeakPoolUsage[PoolType] ) { 00328 QuotaBlock->QuotaPeakPoolUsage[PoolType] = NewPoolUsage; 00329 } 00330 00331 NewPoolUsage = Process->QuotaPoolUsage[PoolType] + Amount; 00332 Process->QuotaPoolUsage[PoolType] = NewPoolUsage; 00333 if ( NewPoolUsage > Process->QuotaPeakPoolUsage[PoolType] ) { 00334 Process->QuotaPeakPoolUsage[PoolType] = NewPoolUsage; 00335 } 00336 00337 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00338 } 00339 else { 00340 if ( Process == PsInitialSystemProcess ) { 00341 return; 00342 } 00343 00344 ExAcquireSpinLock(&PspDefaultQuotaBlock.QuotaLock,&OldIrql); 00345 if ( (QuotaBlock = Process->QuotaBlock) != &PspDefaultQuotaBlock ) { 00346 ExReleaseSpinLock(&PspDefaultQuotaBlock.QuotaLock,OldIrql); 00347 goto retry_charge; 00348 } 00349 goto do_charge; 00350 00351 } 00352 00353 }

PEPROCESS_QUOTA_BLOCK PsChargeSharedPoolQuota IN PEPROCESS  Process,
IN SIZE_T  PagedAmount,
IN SIZE_T  NonPagedAmount
 

Definition at line 24 of file psquota.c.

References ASSERT, MmRaisePoolQuota(), NonPagedPool, NULL, PagedPool, ProcessObject, PsInitialSystemProcess, PspDefaultNonPagedLimit, PspDefaultPagedLimit, PspDefaultQuotaBlock, _EPROCESS_QUOTA_BLOCK::QuotaLock, _EPROCESS_QUOTA_BLOCK::QuotaPeakPoolUsage, _EPROCESS_QUOTA_BLOCK::QuotaPoolLimit, _EPROCESS_QUOTA_BLOCK::QuotaPoolUsage, and _EPROCESS_QUOTA_BLOCK::ReferenceCount.

Referenced by ObpChargeQuotaForObject().

00032 : 00033 00034 This function charges shared pool quota of the specified pool type 00035 to the specified process's pooled quota block. If the quota charge 00036 would exceed the limits allowed to the process, then an exception is 00037 raised and quota is not charged. 00038 00039 Arguments: 00040 00041 Process - Supplies the process to charge quota to. 00042 00043 PagedAmount - Supplies the amount of paged pool quota to charge. 00044 00045 PagedAmount - Supplies the amount of non paged pool quota to charge. 00046 00047 Return Value: 00048 00049 NULL - Quota was exceeded 00050 00051 NON-NULL - A referenced pointer to the quota block that was charged 00052 00053 --*/ 00054 00055 { 00056 00057 KIRQL OldIrql; 00058 SIZE_T NewPoolUsage; 00059 PEPROCESS_QUOTA_BLOCK QuotaBlock; 00060 SIZE_T NewLimit; 00061 00062 ASSERT((Process->Pcb.Header.Type == ProcessObject) || (Process->Pcb.Header.Type == 0)); 00063 00064 QuotaBlock = Process->QuotaBlock; 00065 00066 retry_charge: 00067 if ( QuotaBlock != &PspDefaultQuotaBlock ) { 00068 ExAcquireSpinLock(&QuotaBlock->QuotaLock,&OldIrql); 00069 do_charge: 00070 00071 if ( PagedAmount ) { 00072 00073 NewPoolUsage = QuotaBlock->QuotaPoolUsage[PagedPool] + PagedAmount; 00074 00075 // 00076 // See if enough quota exists in the block to satisfy the 00077 // request 00078 // 00079 00080 if ( NewPoolUsage > QuotaBlock->QuotaPoolLimit[PagedPool] ) { 00081 while ( (PspDefaultPagedLimit == 0) && MmRaisePoolQuota(PagedPool,QuotaBlock->QuotaPoolLimit[PagedPool],&NewLimit) ) { 00082 QuotaBlock->QuotaPoolLimit[PagedPool] = NewLimit; 00083 if ( NewPoolUsage <= NewLimit ) { 00084 goto LimitRaised0; 00085 } 00086 } 00087 //DbgPrint("PS: ChargeShared(0) Failed P %8x QB %8x PA %8x NPA %8x\n",Process,QuotaBlock,PagedAmount,NonPagedAmount);DbgBreakPoint(); 00088 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00089 return NULL; 00090 } 00091 LimitRaised0: 00092 if ( NewPoolUsage < QuotaBlock->QuotaPoolUsage[PagedPool] || 00093 NewPoolUsage < PagedAmount ) { 00094 00095 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00096 //DbgPrint("PS: ChargeShared(1) Failed P %8x QB %8x PA %8x NPA %8x\n",Process,QuotaBlock,PagedAmount,NonPagedAmount);DbgBreakPoint(); 00097 return NULL; 00098 } 00099 00100 QuotaBlock->QuotaPoolUsage[PagedPool] = NewPoolUsage; 00101 if ( NewPoolUsage > QuotaBlock->QuotaPeakPoolUsage[PagedPool] ) { 00102 QuotaBlock->QuotaPeakPoolUsage[PagedPool] = NewPoolUsage; 00103 } 00104 } 00105 00106 if ( NonPagedAmount ) { 00107 00108 NewPoolUsage = QuotaBlock->QuotaPoolUsage[NonPagedPool] + NonPagedAmount; 00109 00110 // 00111 // See if enough quota exists in the block to satisfy the 00112 // request 00113 // 00114 00115 if ( NewPoolUsage > QuotaBlock->QuotaPoolLimit[NonPagedPool] ) { 00116 while ( (PspDefaultNonPagedLimit == 0) && MmRaisePoolQuota(NonPagedPool,QuotaBlock->QuotaPoolLimit[NonPagedPool],&NewLimit) ) { 00117 QuotaBlock->QuotaPoolLimit[NonPagedPool] = NewLimit; 00118 if ( NewPoolUsage <= NewLimit ) { 00119 goto LimitRaised1; 00120 } 00121 } 00122 if ( PagedAmount ) { 00123 QuotaBlock->QuotaPoolUsage[PagedPool] -= PagedAmount; 00124 } 00125 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00126 //DbgPrint("PS: ChargeShared(2) Failed P %8x QB %8x PA %8x NPA %8x\n",Process,QuotaBlock,PagedAmount,NonPagedAmount);DbgBreakPoint(); 00127 return NULL; 00128 } 00129 00130 LimitRaised1: 00131 if ( NewPoolUsage < QuotaBlock->QuotaPoolUsage[NonPagedPool] || 00132 NewPoolUsage < NonPagedAmount ) { 00133 if ( PagedAmount ) { 00134 QuotaBlock->QuotaPoolUsage[PagedPool] -= PagedAmount; 00135 } 00136 00137 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00138 //DbgPrint("PS: ChargeShared(3) Failed P %8x QB %8x PA %8x NPA %8x\n",Process,QuotaBlock,PagedAmount,NonPagedAmount);DbgBreakPoint(); 00139 return NULL; 00140 } 00141 00142 QuotaBlock->QuotaPoolUsage[NonPagedPool] = NewPoolUsage; 00143 if ( NewPoolUsage > QuotaBlock->QuotaPeakPoolUsage[NonPagedPool] ) { 00144 QuotaBlock->QuotaPeakPoolUsage[NonPagedPool] = NewPoolUsage; 00145 } 00146 } 00147 00148 QuotaBlock->ReferenceCount++; 00149 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00150 } 00151 else { 00152 00153 // 00154 // Don't do ANY quota operations on the initial system process 00155 // 00156 00157 if ( Process == PsInitialSystemProcess ) { 00158 return (PEPROCESS_QUOTA_BLOCK)1; 00159 } 00160 00161 ExAcquireSpinLock(&PspDefaultQuotaBlock.QuotaLock,&OldIrql); 00162 if ( (QuotaBlock = Process->QuotaBlock) != &PspDefaultQuotaBlock ) { 00163 ExReleaseSpinLock(&PspDefaultQuotaBlock.QuotaLock,OldIrql); 00164 goto retry_charge; 00165 } 00166 goto do_charge; 00167 00168 } 00169 return QuotaBlock; 00170 00171 }

VOID PspDereferenceQuota IN PEPROCESS  Process  ) 
 

Definition at line 494 of file psquota.c.

References ExFreePool(), MiReturnPageFileQuota(), NonPagedPool, PagedPool, PsReturnPoolQuota(), _EPROCESS_QUOTA_BLOCK::QuotaLock, and _EPROCESS_QUOTA_BLOCK::ReferenceCount.

Referenced by PspProcessDelete().

00497 { 00498 PEPROCESS_QUOTA_BLOCK QuotaBlock; 00499 KIRQL OldIrql; 00500 00501 QuotaBlock = Process->QuotaBlock; 00502 00503 PsReturnPoolQuota(Process,NonPagedPool,Process->QuotaPoolUsage[NonPagedPool]); 00504 PsReturnPoolQuota(Process,PagedPool,Process->QuotaPoolUsage[PagedPool]); 00505 MiReturnPageFileQuota(Process->PagefileUsage,Process); 00506 00507 ExAcquireSpinLock(&QuotaBlock->QuotaLock,&OldIrql); 00508 00509 QuotaBlock->ReferenceCount--; 00510 if ( QuotaBlock->ReferenceCount == 0 ) { 00511 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00512 ExFreePool(QuotaBlock); 00513 } 00514 else { 00515 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00516 } 00517 }

VOID PspInheritQuota IN PEPROCESS  NewProcess,
IN PEPROCESS  ParentProcess
 

Definition at line 466 of file psquota.c.

References PspDefaultQuotaBlock, _EPROCESS_QUOTA_BLOCK::QuotaLock, and _EPROCESS_QUOTA_BLOCK::ReferenceCount.

Referenced by PspCreateProcess().

00470 { 00471 PEPROCESS_QUOTA_BLOCK QuotaBlock; 00472 KIRQL OldIrql; 00473 00474 if ( ParentProcess ) { 00475 QuotaBlock = ParentProcess->QuotaBlock; 00476 } 00477 else { 00478 QuotaBlock = &PspDefaultQuotaBlock; 00479 } 00480 00481 ExAcquireSpinLock(&QuotaBlock->QuotaLock,&OldIrql); 00482 QuotaBlock->ReferenceCount++; 00483 NewProcess->QuotaBlock = QuotaBlock; 00484 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00485 }

VOID PsReturnPoolQuota IN PEPROCESS  Process,
IN POOL_TYPE  PoolType,
IN SIZE_T  Amount
 

Definition at line 356 of file psquota.c.

References ASSERT, FALSE, MMNONPAGED_QUOTA_INCREASE, MMPAGED_QUOTA_INCREASE, MmReturnPoolQuota(), PagedPool, ProcessObject, PsInitialSystemProcess, PspDefaultQuotaBlock, PspDoingGiveBacks, _EPROCESS_QUOTA_BLOCK::QuotaLock, _EPROCESS_QUOTA_BLOCK::QuotaPoolLimit, _EPROCESS_QUOTA_BLOCK::QuotaPoolUsage, and ROUND_TO_PAGES.

Referenced by ExFreePool(), ExFreePoolWithTag(), ExpAllocateHandleTable(), ExpAllocateHandleTableEntry(), ExpFreeHandleTable(), ExReturnPoolQuota(), FsRtlCancelNotify(), FsRtlNotifyCleanup(), FsRtlNotifyCompleteIrp(), FsRtlNotifyFullReportChange(), MiCleanPhysicalProcessPages(), MiCloneProcessAddressSpace(), MiDecrementCloneBlockReference(), MiInsertVad(), MiPhysicalViewRemover(), MiRemoveVad(), NtAllocateUserPhysicalPages(), NtAllocateVirtualMemory(), PspDereferenceQuota(), PspSetLdtInformation(), PspSetLdtSize(), and VdmpInitialize().

00364 : 00365 00366 This function returns pool quota of the specified pool type to the 00367 specified process. 00368 00369 Arguments: 00370 00371 Process - Supplies the process to return quota to. 00372 00373 PoolType - Supplies the type of pool quota to return. 00374 00375 Amount - Supplies the amount of pool quota to return 00376 00377 Return Value: 00378 00379 Raises STATUS_QUOTA_EXCEEDED if the quota charge would exceed the 00380 limits allowed to the process. 00381 00382 --*/ 00383 00384 { 00385 00386 KIRQL OldIrql; 00387 PEPROCESS_QUOTA_BLOCK QuotaBlock; 00388 SIZE_T GiveBackLimit; 00389 SIZE_T RoundedUsage; 00390 00391 ASSERT((Process->Pcb.Header.Type == ProcessObject) || (Process->Pcb.Header.Type == 0)); 00392 00393 QuotaBlock = Process->QuotaBlock; 00394 retry_return: 00395 if ( QuotaBlock != &PspDefaultQuotaBlock) { 00396 ExAcquireSpinLock(&QuotaBlock->QuotaLock,&OldIrql); 00397 00398 if ( PspDoingGiveBacks ) { 00399 if ( PoolType == PagedPool ) { 00400 GiveBackLimit = MMPAGED_QUOTA_INCREASE; 00401 } 00402 else { 00403 GiveBackLimit = MMNONPAGED_QUOTA_INCREASE; 00404 } 00405 } 00406 else { 00407 GiveBackLimit = 0; 00408 } 00409 do_return: 00410 if ( Amount <= Process->QuotaPoolUsage[PoolType] ) { 00411 Process->QuotaPoolUsage[PoolType] -= Amount; 00412 } 00413 else { 00414 ASSERT(FALSE); 00415 GiveBackLimit = 0; 00416 Process->QuotaPoolUsage[PoolType] = 0; 00417 } 00418 00419 if ( Amount <= QuotaBlock->QuotaPoolUsage[PoolType] ) { 00420 QuotaBlock->QuotaPoolUsage[PoolType] -= Amount; 00421 } 00422 else { 00423 ASSERT(FALSE); 00424 GiveBackLimit = 0; 00425 QuotaBlock->QuotaPoolUsage[PoolType] = 0; 00426 } 00427 00428 if ( GiveBackLimit ) { 00429 if (QuotaBlock->QuotaPoolLimit[PoolType] - QuotaBlock->QuotaPoolUsage[PoolType] > GiveBackLimit ) { 00430 00431 // 00432 // round up the current usage to a page multiple 00433 // 00434 00435 RoundedUsage = ROUND_TO_PAGES(QuotaBlock->QuotaPoolUsage[PoolType]); 00436 00437 // 00438 // Give back the limit minus the rounded usage 00439 // 00440 00441 GiveBackLimit = QuotaBlock->QuotaPoolLimit[PoolType] - RoundedUsage; 00442 QuotaBlock->QuotaPoolLimit[PoolType] -= GiveBackLimit; 00443 MmReturnPoolQuota(PoolType,GiveBackLimit); 00444 00445 } 00446 } 00447 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00448 } 00449 else { 00450 00451 if ( Process == PsInitialSystemProcess ) { 00452 return; 00453 } 00454 00455 ExAcquireSpinLock(&PspDefaultQuotaBlock.QuotaLock,&OldIrql); 00456 if ( (QuotaBlock = Process->QuotaBlock) != &PspDefaultQuotaBlock) { 00457 ExReleaseSpinLock(&PspDefaultQuotaBlock.QuotaLock,OldIrql); 00458 goto retry_return; 00459 } 00460 GiveBackLimit = 0; 00461 goto do_return; 00462 } 00463 }

VOID PsReturnSharedPoolQuota IN PEPROCESS_QUOTA_BLOCK  QuotaBlock,
IN SIZE_T  PagedAmount,
IN SIZE_T  NonPagedAmount
 

Definition at line 174 of file psquota.c.

References ASSERT, ExFreePool(), FALSE, NonPagedPool, and PagedPool.

Referenced by ObpFreeObject().

00182 : 00183 00184 This function returns pool quota of the specified pool type to the 00185 specified process. 00186 00187 Arguments: 00188 00189 QuotaBlock - Supplies the quota block to return quota to. 00190 00191 PagedAmount - Supplies the amount of paged pool quota to return. 00192 00193 PagedAmount - Supplies the amount of non paged pool quota to return. 00194 00195 Return Value: 00196 00197 None. 00198 00199 --*/ 00200 00201 { 00202 00203 KIRQL OldIrql; 00204 00205 // 00206 // if we bypassed the quota charge, don't do anything here either 00207 // 00208 00209 if ( QuotaBlock == (PEPROCESS_QUOTA_BLOCK)1 ) { 00210 return; 00211 } 00212 00213 ExAcquireSpinLock(&QuotaBlock->QuotaLock,&OldIrql); 00214 00215 if ( PagedAmount ) { 00216 00217 if ( PagedAmount <= QuotaBlock->QuotaPoolUsage[PagedPool] ) { 00218 QuotaBlock->QuotaPoolUsage[PagedPool] -= PagedAmount; 00219 } 00220 else { 00221 ASSERT(FALSE); 00222 QuotaBlock->QuotaPoolUsage[PagedPool] = 0; 00223 } 00224 } 00225 if ( NonPagedAmount ) { 00226 00227 if ( NonPagedAmount <= QuotaBlock->QuotaPoolUsage[NonPagedPool] ) { 00228 QuotaBlock->QuotaPoolUsage[NonPagedPool] -= NonPagedAmount; 00229 } 00230 else { 00231 ASSERT(FALSE); 00232 QuotaBlock->QuotaPoolUsage[NonPagedPool] = 0; 00233 } 00234 } 00235 QuotaBlock->ReferenceCount--; 00236 if ( QuotaBlock->ReferenceCount == 0 ) { 00237 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00238 ExFreePool(QuotaBlock); 00239 } 00240 else { 00241 ExReleaseSpinLock(&QuotaBlock->QuotaLock,OldIrql); 00242 } 00243 }


Generated on Sat May 15 19:45:24 2004 for test by doxygen 1.3.7