Use memory wrappers instead of ExAllocatePool/ExFreePool directly

svn path=/trunk/; revision=42974
This commit is contained in:
Hervé Poussineau 2009-08-30 19:20:30 +00:00
parent e6097bec74
commit 6ca346d8d4
5 changed files with 32 additions and 32 deletions

View file

@ -62,7 +62,7 @@ CmpFreeKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
if (!Kcb->PrivateAlloc) if (!Kcb->PrivateAlloc)
{ {
/* Free it from the pool */ /* Free it from the pool */
ExFreePoolWithTag(Kcb, TAG_CM); CmpFree(Kcb, 0);
return; return;
} }
@ -98,7 +98,7 @@ CmpFreeKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
} }
/* Free the page */ /* Free the page */
ExFreePoolWithTag(AllocPage, TAG_CM); CmpFree(AllocPage, 0);
} }
/* Release the lock */ /* Release the lock */
@ -151,7 +151,7 @@ SearchKcbList:
} }
/* Allocate an allocation page */ /* Allocate an allocation page */
AllocPage = ExAllocatePoolWithTag(PagedPool, PAGE_SIZE, TAG_CM); AllocPage = CmpAllocate(PAGE_SIZE, TRUE, TAG_CM);
if (AllocPage) if (AllocPage)
{ {
/* Set default entries */ /* Set default entries */
@ -178,9 +178,9 @@ SearchKcbList:
} }
/* Allocate a KCB only */ /* Allocate a KCB only */
CurrentKcb = ExAllocatePoolWithTag(PagedPool, CurrentKcb = CmpAllocate(sizeof(CM_KEY_CONTROL_BLOCK),
sizeof(CM_KEY_CONTROL_BLOCK), TRUE,
TAG_CM); TAG_CM);
if (CurrentKcb) if (CurrentKcb)
{ {
/* Set it up */ /* Set it up */
@ -231,7 +231,7 @@ SearchList:
} }
/* Allocate an allocation page */ /* Allocate an allocation page */
AllocPage = ExAllocatePoolWithTag(PagedPool, PAGE_SIZE, TAG_CM); AllocPage = CmpAllocate(PAGE_SIZE, TRUE, TAG_CM);
if (AllocPage) if (AllocPage)
{ {
/* Set default entries */ /* Set default entries */
@ -295,7 +295,7 @@ CmpFreeDelayItem(PVOID Entry)
} }
/* Now free the page */ /* Now free the page */
ExFreePoolWithTag(AllocPage, TAG_CM); CmpFree(AllocPage, 0);
} }
/* Release the lock */ /* Release the lock */

View file

@ -821,9 +821,9 @@ CmpMarkIndexDirty(IN PHHIVE Hive,
SearchName.Length = CmpCompressedNameSize(Node->Name, SearchName.Length = CmpCompressedNameSize(Node->Name,
Node->NameLength); Node->NameLength);
SearchName.MaximumLength = SearchName.Length; SearchName.MaximumLength = SearchName.Length;
SearchName.Buffer = ExAllocatePoolWithTag(PagedPool, SearchName.Buffer = CmpAllocate(SearchName.Length,
SearchName.Length, TRUE,
TAG_CM); TAG_CM);
if (!SearchName.Buffer) if (!SearchName.Buffer)
{ {
/* Fail */ /* Fail */
@ -917,7 +917,7 @@ CmpMarkIndexDirty(IN PHHIVE Hive,
if (Child != HCELL_NIL) if (Child != HCELL_NIL)
{ {
/* We found it, free the name now */ /* We found it, free the name now */
if (IsCompressed) ExFreePool(SearchName.Buffer); if (IsCompressed) CmpFree(SearchName.Buffer, 0);
/* Release the parent key */ /* Release the parent key */
HvReleaseCell(Hive, ParentKey); HvReleaseCell(Hive, ParentKey);
@ -942,7 +942,7 @@ Quickie:
if (CellToRelease != HCELL_NIL) HvReleaseCell(Hive, CellToRelease); if (CellToRelease != HCELL_NIL) HvReleaseCell(Hive, CellToRelease);
/* Free the search name and return failure */ /* Free the search name and return failure */
if (IsCompressed) ExFreePool(SearchName.Buffer); if (IsCompressed) CmpFree(SearchName.Buffer, 0);
return FALSE; return FALSE;
} }
@ -1758,9 +1758,9 @@ CmpRemoveSubKey(IN PHHIVE Hive,
if (SearchName.MaximumLength > sizeof(Buffer)) if (SearchName.MaximumLength > sizeof(Buffer))
{ {
/* Allocate one */ /* Allocate one */
SearchName.Buffer = ExAllocatePoolWithTag(PagedPool, SearchName.Buffer = CmpAllocate(SearchName.Length,
SearchName.Length, TRUE,
TAG_CM); TAG_CM);
if (!SearchName.Buffer) return FALSE; if (!SearchName.Buffer) return FALSE;
} }
else else
@ -1899,7 +1899,7 @@ Exit:
if ((IsCompressed) && (SearchName.MaximumLength > sizeof(Buffer))) if ((IsCompressed) && (SearchName.MaximumLength > sizeof(Buffer)))
{ {
/* Free the buffer we allocated */ /* Free the buffer we allocated */
ExFreePool(SearchName.Buffer); CmpFree(SearchName.Buffer, 0);
} }
/* Return the result */ /* Return the result */

View file

@ -32,7 +32,7 @@ CmpInitializeCache(VOID)
Length = CmpHashTableSize * sizeof(CM_KEY_HASH_TABLE_ENTRY); Length = CmpHashTableSize * sizeof(CM_KEY_HASH_TABLE_ENTRY);
/* Allocate it */ /* Allocate it */
CmpCacheTable = ExAllocatePoolWithTag(PagedPool, Length, TAG_CM); CmpCacheTable = CmpAllocate(Length, TRUE, TAG_CM);
if (!CmpCacheTable) if (!CmpCacheTable)
{ {
/* Take the system down */ /* Take the system down */
@ -53,7 +53,7 @@ CmpInitializeCache(VOID)
Length = CmpHashTableSize * sizeof(CM_NAME_HASH_TABLE_ENTRY); Length = CmpHashTableSize * sizeof(CM_NAME_HASH_TABLE_ENTRY);
/* Now allocate the name cache table */ /* Now allocate the name cache table */
CmpNameCacheTable = ExAllocatePoolWithTag(PagedPool, Length, TAG_CM); CmpNameCacheTable = CmpAllocate(Length, TRUE, TAG_CM);
if (!CmpNameCacheTable) if (!CmpNameCacheTable)
{ {
/* Take the system down */ /* Take the system down */
@ -249,7 +249,7 @@ CmpGetNameControlBlock(IN PUNICODE_STRING NodeName)
{ {
/* Allocate one */ /* Allocate one */
NcbSize = FIELD_OFFSET(CM_NAME_CONTROL_BLOCK, Name) + Length; NcbSize = FIELD_OFFSET(CM_NAME_CONTROL_BLOCK, Name) + Length;
Ncb = ExAllocatePoolWithTag(PagedPool, NcbSize, TAG_CM); Ncb = CmpAllocate(NcbSize, TRUE, TAG_CM);
if (!Ncb) if (!Ncb)
{ {
/* Release the lock and fail */ /* Release the lock and fail */
@ -343,7 +343,7 @@ CmpDereferenceNameControlBlockWithLock(IN PCM_NAME_CONTROL_BLOCK Ncb)
} }
/* Found it, now free it */ /* Found it, now free it */
ExFreePool(Ncb); CmpFree(Ncb, 0);
} }
/* Release the lock */ /* Release the lock */
@ -446,12 +446,12 @@ CmpCleanUpKcbValueCache(IN PCM_KEY_CONTROL_BLOCK Kcb)
if (CMP_IS_CELL_CACHED(CachedList[i])) if (CMP_IS_CELL_CACHED(CachedList[i]))
{ {
/* Free it */ /* Free it */
ExFreePool((PVOID)CMP_GET_CACHED_CELL(CachedList[i])); CmpFree((PVOID)CMP_GET_CACHED_CELL(CachedList[i]), 0);
} }
} }
/* Now free the list */ /* Now free the list */
ExFreePool((PVOID)CMP_GET_CACHED_CELL(Kcb->ValueCache.ValueList)); CmpFree((PVOID)CMP_GET_CACHED_CELL(Kcb->ValueCache.ValueList), 0);
Kcb->ValueCache.ValueList = HCELL_NIL; Kcb->ValueCache.ValueList = HCELL_NIL;
} }
else if (Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND) else if (Kcb->ExtFlags & CM_KCB_SYM_LINK_FOUND)
@ -490,7 +490,7 @@ CmpCleanUpKcbCacheWithLock(IN PCM_KEY_CONTROL_BLOCK Kcb,
CmpDereferenceNameControlBlockWithLock(Kcb->NameBlock); CmpDereferenceNameControlBlockWithLock(Kcb->NameBlock);
/* Check if we have an index hint block and free it */ /* Check if we have an index hint block and free it */
if (Kcb->ExtFlags & CM_KCB_SUBKEY_HINT) ExFreePool(Kcb->IndexHint); if (Kcb->ExtFlags & CM_KCB_SUBKEY_HINT) CmpFree(Kcb->IndexHint, 0);
/* Check if we were already deleted */ /* Check if we were already deleted */
Parent = Kcb->ParentKcb; Parent = Kcb->ParentKcb;
@ -529,7 +529,7 @@ CmpCleanUpSubKeyInfo(IN PCM_KEY_CONTROL_BLOCK Kcb)
if (Kcb->ExtFlags & (CM_KCB_SUBKEY_HINT)) if (Kcb->ExtFlags & (CM_KCB_SUBKEY_HINT))
{ {
/* Kill it */ /* Kill it */
ExFreePool(Kcb->IndexHint); CmpFree(Kcb->IndexHint, 0);
} }
/* Remove subkey flags */ /* Remove subkey flags */
@ -931,9 +931,9 @@ CmpConstructName(IN PCM_KEY_CONTROL_BLOCK Kcb)
} }
/* Allocate the unicode string now */ /* Allocate the unicode string now */
KeyName = ExAllocatePoolWithTag(PagedPool, KeyName = CmpAllocate(NameLength + sizeof(UNICODE_STRING),
NameLength + sizeof(UNICODE_STRING), TRUE,
TAG_CM); TAG_CM);
if (!KeyName) return NULL; if (!KeyName) return NULL;
@ -954,7 +954,7 @@ CmpConstructName(IN PCM_KEY_CONTROL_BLOCK Kcb)
MyKcb->ExtFlags & CM_KCB_KEY_NON_EXIST) MyKcb->ExtFlags & CM_KCB_KEY_NON_EXIST)
{ {
/* Failure */ /* Failure */
ExFreePool(KeyName); CmpFree(KeyName, 0);
return NULL; return NULL;
} }
@ -967,7 +967,7 @@ CmpConstructName(IN PCM_KEY_CONTROL_BLOCK Kcb)
if (!KeyNode) if (!KeyNode)
{ {
/* Failure */ /* Failure */
ExFreePool(KeyName); CmpFree(KeyName, 0);
return NULL; return NULL;
} }
} }

View file

@ -797,7 +797,7 @@ Quickie:
if (ValueCellToRelease) HvReleaseCell(Kcb->KeyHive, ValueCellToRelease); if (ValueCellToRelease) HvReleaseCell(Kcb->KeyHive, ValueCellToRelease);
/* Free the buffer */ /* Free the buffer */
if (BufferAllocated) ExFreePool(Buffer); if (BufferAllocated) CmpFree(Buffer, 0);
/* Free the cell */ /* Free the cell */
if (CellToRelease) HvReleaseCell(Kcb->KeyHive, CellToRelease); if (CellToRelease) HvReleaseCell(Kcb->KeyHive, CellToRelease);

View file

@ -188,7 +188,7 @@ CmpValueToData(IN PHHIVE Hive,
if (BufferAllocated) if (BufferAllocated)
{ {
/* Free the buffer and bugcheck */ /* Free the buffer and bugcheck */
ExFreePool(Buffer); CmpFree(Buffer, 0);
KeBugCheckEx(REGISTRY_ERROR, 8, 0, (ULONG_PTR)Hive, (ULONG_PTR)Value); KeBugCheckEx(REGISTRY_ERROR, 8, 0, (ULONG_PTR)Hive, (ULONG_PTR)Value);
} }