Replace deprecated memory allocation functions

This commit is contained in:
David Lönnhager
2022-09-13 12:55:20 +02:00
parent aa72fc8544
commit 446c7f7ae0
11 changed files with 30 additions and 30 deletions

View File

@@ -49,7 +49,7 @@ TreeAllocateRoutineNonPaged
{
UNREFERENCED_PARAMETER(Table);
return ExAllocatePoolWithTag(NonPagedPool, ByteSize, ST_POOL_TAG);
return ExAllocatePoolUninitialized(NonPagedPool, ByteSize, ST_POOL_TAG);
}
PVOID
@@ -61,7 +61,7 @@ TreeAllocateRoutinePaged
{
UNREFERENCED_PARAMETER(Table);
return ExAllocatePoolWithTag(PagedPool, ByteSize, ST_POOL_TAG);
return ExAllocatePoolUninitialized(PagedPool, ByteSize, ST_POOL_TAG);
}
VOID
@@ -144,7 +144,7 @@ Initialize
const auto poolType = (Pageable == ST_PAGEABLE::YES) ? PagedPool : NonPagedPool;
*Context = (CONTEXT*)
ExAllocatePoolWithTag(poolType, sizeof(CONTEXT), ST_POOL_TAG);
ExAllocatePoolUninitialized(poolType, sizeof(CONTEXT), ST_POOL_TAG);
if (*Context == NULL)
{

View File

@@ -90,7 +90,7 @@ AddEntryInner
const auto poolType = (Context->Pageable == ST_PAGEABLE::YES) ? PagedPool : NonPagedPool;
auto record = (REGISTERED_IMAGE_ENTRY*)
ExAllocatePoolWithTag(poolType, allocationSize, ST_POOL_TAG);
ExAllocatePoolUninitialized(poolType, allocationSize, ST_POOL_TAG);
if (record == NULL)
{
@@ -141,7 +141,7 @@ Initialize
{
const auto poolType = (Pageable == ST_PAGEABLE::YES) ? PagedPool : NonPagedPool;
*Context = (CONTEXT*)ExAllocatePoolWithTag(poolType, sizeof(CONTEXT), ST_POOL_TAG);
*Context = (CONTEXT*)ExAllocatePoolUninitialized(poolType, sizeof(CONTEXT), ST_POOL_TAG);
if (*Context == NULL)
{

View File

@@ -21,7 +21,7 @@ BuildSplittingEvent
auto eventSize = FIELD_OFFSET(ST_SPLITTING_EVENT, ImageName) + ImageName->Length;
auto allocationSize = headerSize + eventSize;
auto buffer = ExAllocatePoolWithTag(NonPagedPool, allocationSize, ST_POOL_TAG);
auto buffer = ExAllocatePoolUninitialized(NonPagedPool, allocationSize, ST_POOL_TAG);
if (buffer == NULL)
{
@@ -60,7 +60,7 @@ BuildSplittingErrorEvent
auto eventSize = FIELD_OFFSET(ST_SPLITTING_ERROR_EVENT, ImageName) + ImageName->Length;
auto allocationSize = headerSize + eventSize;
auto buffer = ExAllocatePoolWithTag(NonPagedPool, allocationSize, ST_POOL_TAG);
auto buffer = ExAllocatePoolUninitialized(NonPagedPool, allocationSize, ST_POOL_TAG);
if (buffer == NULL)
{
@@ -91,7 +91,7 @@ WrapEvent
size_t BufferSize
)
{
auto evt = (RAW_EVENT*)ExAllocatePoolWithTag(NonPagedPool, sizeof(RAW_EVENT), ST_POOL_TAG);
auto evt = (RAW_EVENT*)ExAllocatePoolUninitialized(NonPagedPool, sizeof(RAW_EVENT), ST_POOL_TAG);
if (evt == NULL)
{
@@ -203,7 +203,7 @@ BuildErrorMessageEvent
auto eventSize = FIELD_OFFSET(ST_ERROR_MESSAGE_EVENT, ErrorMessage) + ErrorMessage->Length;
auto allocationSize = headerSize + eventSize;
auto buffer = ExAllocatePoolWithTag(NonPagedPool, allocationSize, ST_POOL_TAG);
auto buffer = ExAllocatePoolUninitialized(NonPagedPool, allocationSize, ST_POOL_TAG);
if (buffer == NULL)
{

View File

@@ -71,7 +71,7 @@ Initialize
{
*Context = NULL;
auto context = (CONTEXT*)ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
auto context = (CONTEXT*)ExAllocatePoolUninitialized(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
if (NULL == context)
{

View File

@@ -104,7 +104,7 @@ PushTransactionEvent
BLOCK_CONNECTIONS_ENTRY *Target
)
{
auto evt = (TRANSACTION_EVENT*)ExAllocatePoolWithTag(NonPagedPool, sizeof(TRANSACTION_EVENT), ST_POOL_TAG);
auto evt = (TRANSACTION_EVENT*)ExAllocatePoolUninitialized(NonPagedPool, sizeof(TRANSACTION_EVENT), ST_POOL_TAG);
if (evt == NULL)
{
@@ -175,7 +175,7 @@ TransactionRemovedEntry
)
{
auto evt = (TRANSACTION_EVENT_ADD_ENTRY*)
ExAllocatePoolWithTag(NonPagedPool, sizeof(TRANSACTION_EVENT_ADD_ENTRY), ST_POOL_TAG);
ExAllocatePoolUninitialized(NonPagedPool, sizeof(TRANSACTION_EVENT_ADD_ENTRY), ST_POOL_TAG);
if (evt == NULL)
{
@@ -201,7 +201,7 @@ TransactionSwappedLists
)
{
auto evt = (TRANSACTION_EVENT_SWAP_LISTS*)
ExAllocatePoolWithTag(NonPagedPool, sizeof(TRANSACTION_EVENT_SWAP_LISTS), ST_POOL_TAG);
ExAllocatePoolUninitialized(NonPagedPool, sizeof(TRANSACTION_EVENT_SWAP_LISTS), ST_POOL_TAG);
if (evt == NULL)
{
@@ -246,7 +246,7 @@ CustomGetAppIdFromFileName
auto allocationSize = offsetStringBuffer + copiedStringLength;
auto blob = (FWP_BYTE_BLOB*)
ExAllocatePoolWithTag(PagedPool, allocationSize, ST_POOL_TAG);
ExAllocatePoolUninitialized(PagedPool, allocationSize, ST_POOL_TAG);
if (blob == NULL)
{
@@ -519,7 +519,7 @@ AddBlockFiltersCreateEntryTx
auto allocationSize = offsetStringBuffer + ImageName->Length;
auto entry = (BLOCK_CONNECTIONS_ENTRY*)
ExAllocatePoolWithTag(PagedPool, allocationSize, ST_POOL_TAG);
ExAllocatePoolUninitialized(PagedPool, allocationSize, ST_POOL_TAG);
if (entry == NULL)
{
@@ -695,7 +695,7 @@ Initialize
)
{
auto context = (APP_FILTERS_CONTEXT*)
ExAllocatePoolWithTag(PagedPool, sizeof(APP_FILTERS_CONTEXT), ST_POOL_TAG);
ExAllocatePoolUninitialized(PagedPool, sizeof(APP_FILTERS_CONTEXT), ST_POOL_TAG);
if (context == NULL)
{

View File

@@ -973,7 +973,7 @@ Initialize
eventing::CONTEXT *Eventing
)
{
auto context = (CONTEXT*)ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
auto context = (CONTEXT*)ExAllocatePoolUninitialized(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
if (context == NULL)
{

View File

@@ -333,11 +333,11 @@ Initialize
procbroker::CONTEXT *ProcessEventBroker
)
{
auto context = (CONTEXT*)ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
auto context = (CONTEXT*)ExAllocatePoolUninitialized(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
if (context == NULL)
{
DbgPrint("ExAllocatePoolWithTag() failed\n");
DbgPrint("ExAllocatePoolUninitialized() failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -429,11 +429,11 @@ PendRequest
);
auto record = (PENDED_CLASSIFICATION*)
ExAllocatePoolWithTag(NonPagedPool, sizeof(PENDED_CLASSIFICATION), ST_POOL_TAG);
ExAllocatePoolUninitialized(NonPagedPool, sizeof(PENDED_CLASSIFICATION), ST_POOL_TAG);
if (record == NULL)
{
DbgPrint("ExAllocatePoolWithTag() failed\n");
DbgPrint("ExAllocatePoolUninitialized() failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}

View File

@@ -14,7 +14,7 @@ Initialize
CONTEXT **Context
)
{
auto context = (CONTEXT*)ExAllocatePoolWithTag(PagedPool, sizeof(CONTEXT), ST_POOL_TAG);
auto context = (CONTEXT*)ExAllocatePoolUninitialized(PagedPool, sizeof(CONTEXT), ST_POOL_TAG);
if (NULL == context)
{
@@ -71,7 +71,7 @@ Subscribe
void *ClientContext
)
{
auto sub = (SUBSCRIPTION*)ExAllocatePoolWithTag(PagedPool, sizeof(SUBSCRIPTION), ST_POOL_TAG);
auto sub = (SUBSCRIPTION*)ExAllocatePoolUninitialized(PagedPool, sizeof(SUBSCRIPTION), ST_POOL_TAG);
if (NULL == sub)
{

View File

@@ -513,7 +513,7 @@ Initialize
void *CallbackContext
)
{
auto context = (CONTEXT*)ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
auto context = (CONTEXT*)ExAllocatePoolUninitialized(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
if (NULL == context)
{

View File

@@ -66,7 +66,7 @@ SystemProcessEvent
auto allocationSize = offsetStringBuffer + imageName->Length;
record = (PROCESS_EVENT *)ExAllocatePoolWithTag(PagedPool, allocationSize, ST_POOL_TAG);
record = (PROCESS_EVENT *)ExAllocatePoolUninitialized(PagedPool, allocationSize, ST_POOL_TAG);
if (record == NULL)
{
@@ -101,7 +101,7 @@ SystemProcessEvent
// Process is departing.
//
record = (PROCESS_EVENT *)ExAllocatePoolWithTag(PagedPool, sizeof(PROCESS_EVENT), ST_POOL_TAG);
record = (PROCESS_EVENT *)ExAllocatePoolUninitialized(PagedPool, sizeof(PROCESS_EVENT), ST_POOL_TAG);
if (record == NULL)
{
@@ -198,7 +198,7 @@ Initialize
bool notifyRoutineRegistered = false;
auto context = (CONTEXT*)ExAllocatePoolWithTag(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
auto context = (CONTEXT*)ExAllocatePoolUninitialized(NonPagedPool, sizeof(CONTEXT), ST_POOL_TAG);
if (NULL == context)
{

View File

@@ -119,7 +119,7 @@ GetDevicePathImageName
// Allocate name buffer.
//
*ImageName = (UNICODE_STRING*)ExAllocatePoolWithTag(PagedPool, bufferLength, ST_POOL_TAG);
*ImageName = (UNICODE_STRING*)ExAllocatePoolUninitialized(PagedPool, bufferLength, ST_POOL_TAG);
if (NULL == *ImageName)
{
@@ -241,7 +241,7 @@ AllocateCopyDowncaseString
const auto poolType = (Pageable == ST_PAGEABLE::YES) ? PagedPool : NonPagedPool;
auto finalBuffer = (PWCH)ExAllocatePoolWithTag(poolType, lower.Length, ST_POOL_TAG);
auto finalBuffer = (PWCH)ExAllocatePoolUninitialized(poolType, lower.Length, ST_POOL_TAG);
if (finalBuffer == NULL)
{
@@ -293,7 +293,7 @@ DuplicateString
{
const auto poolType = (Pageable == ST_PAGEABLE::YES) ? PagedPool : NonPagedPool;
auto buffer = (PWCH)ExAllocatePoolWithTag(poolType, Src->Length, ST_POOL_TAG);
auto buffer = (PWCH)ExAllocatePoolUninitialized(poolType, Src->Length, ST_POOL_TAG);
if (NULL == buffer)
{