mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTOSKRNL]
- Use tags when allocation and freeing memory and define them in tag.h - Fix some wrongly used tags when freeing - Our new memory manager doesn't check tags when ExFreePoolWithTag is used. It will be fixed after testing svn path=/trunk/; revision=52043
This commit is contained in:
parent
c2e7b8b976
commit
2861515d78
25 changed files with 178 additions and 153 deletions
2
reactos/ntoskrnl/cache/section/data.c
vendored
2
reactos/ntoskrnl/cache/section/data.c
vendored
|
@ -307,7 +307,7 @@ MmFinalizeSegment(PMM_CACHE_SECTION_SEGMENT Segment)
|
|||
MmUnlockCacheSectionSegment(Segment);
|
||||
}
|
||||
DPRINTC("Segment %x destroy\n", Segment);
|
||||
ExFreePool(Segment);
|
||||
ExFreePoolWithTag(Segment, TAG_MM_SECTION_SEGMENT);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
|
|
@ -172,7 +172,8 @@ NtAddAtom(IN PWSTR AtomName,
|
|||
}
|
||||
|
||||
/* If we captured anything, free it */
|
||||
if ((CapturedName) && (CapturedName != AtomName)) ExFreePool(CapturedName);
|
||||
if ((CapturedName) && (CapturedName != AtomName))
|
||||
ExFreePoolWithTag(CapturedName, TAG_ATOM);
|
||||
|
||||
/* Return to caller */
|
||||
return Status;
|
||||
|
@ -321,7 +322,8 @@ NtFindAtom(IN PWSTR AtomName,
|
|||
}
|
||||
|
||||
/* If we captured anything, free it */
|
||||
if ((CapturedName) && (CapturedName != AtomName)) ExFreePool(CapturedName);
|
||||
if ((CapturedName) && (CapturedName != AtomName))
|
||||
ExFreePoolWithTag(CapturedName, TAG_ATOM);
|
||||
|
||||
/* Return to caller */
|
||||
return Status;
|
||||
|
|
|
@ -77,7 +77,7 @@ NTAPI
|
|||
ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
|
||||
{
|
||||
/* Just free it from memory */
|
||||
ExFreePool(CallbackBlock);
|
||||
ExFreePoolWithTag(CallbackBlock, CALLBACK_TAG);
|
||||
}
|
||||
|
||||
VOID
|
||||
|
@ -602,7 +602,7 @@ ExRegisterCallback(IN PCALLBACK_OBJECT CallbackObject,
|
|||
KeReleaseSpinLock(&CallbackObject->Lock, OldIrql);
|
||||
|
||||
/* Free the registration */
|
||||
ExFreePool(CallbackRegistration);
|
||||
ExFreePoolWithTag(CallbackRegistration, CALLBACK_TAG);
|
||||
CallbackRegistration = NULL;
|
||||
|
||||
/* Dereference the object */
|
||||
|
@ -676,7 +676,7 @@ ExUnregisterCallback(IN PVOID CallbackRegistrationHandle)
|
|||
KeReleaseSpinLock(&CallbackObject->Lock, OldIrql);
|
||||
|
||||
/* Delete this registration */
|
||||
ExFreePool(CallbackRegistration);
|
||||
ExFreePoolWithTag(CallbackRegistration, CALLBACK_TAG);
|
||||
|
||||
/* Remove the reference */
|
||||
ObDereferenceObject(CallbackObject);
|
||||
|
|
|
@ -132,7 +132,7 @@ ExpAllocateTablePagedPool(IN PEPROCESS Process OPTIONAL,
|
|||
PVOID Buffer;
|
||||
|
||||
/* Do the allocation */
|
||||
Buffer = ExAllocatePoolWithTag(PagedPool, Size, 'btbO');
|
||||
Buffer = ExAllocatePoolWithTag(PagedPool, Size, TAG_OBJECT_TABLE);
|
||||
if (Buffer)
|
||||
{
|
||||
/* Clear the memory */
|
||||
|
@ -157,7 +157,7 @@ ExpAllocateTablePagedPoolNoZero(IN PEPROCESS Process OPTIONAL,
|
|||
PVOID Buffer;
|
||||
|
||||
/* Do the allocation */
|
||||
Buffer = ExAllocatePoolWithTag(PagedPool, Size, 'btbO');
|
||||
Buffer = ExAllocatePoolWithTag(PagedPool, Size, TAG_OBJECT_TABLE);
|
||||
if (Buffer)
|
||||
{
|
||||
/* Check if we have a process to charge quota */
|
||||
|
@ -178,7 +178,7 @@ ExpFreeTablePagedPool(IN PEPROCESS Process OPTIONAL,
|
|||
IN SIZE_T Size)
|
||||
{
|
||||
/* Free the buffer */
|
||||
ExFreePool(Buffer);
|
||||
ExFreePoolWithTag(Buffer, TAG_OBJECT_TABLE);
|
||||
if (Process)
|
||||
{
|
||||
/* FIXME: Release quota */
|
||||
|
@ -273,7 +273,7 @@ ExpFreeHandleTable(IN PHANDLE_TABLE HandleTable)
|
|||
}
|
||||
|
||||
/* Free the actual table and check if we need to release quota */
|
||||
ExFreePool(HandleTable);
|
||||
ExFreePoolWithTag(HandleTable, TAG_OBJECT_TABLE);
|
||||
if (Process)
|
||||
{
|
||||
/* FIXME: TODO */
|
||||
|
@ -345,7 +345,7 @@ ExpAllocateHandleTable(IN PEPROCESS Process OPTIONAL,
|
|||
/* Allocate the table */
|
||||
HandleTable = ExAllocatePoolWithTag(PagedPool,
|
||||
sizeof(HANDLE_TABLE),
|
||||
'btbO');
|
||||
TAG_OBJECT_TABLE);
|
||||
if (!HandleTable) return NULL;
|
||||
|
||||
/* Check if we have a process */
|
||||
|
@ -362,7 +362,7 @@ ExpAllocateHandleTable(IN PEPROCESS Process OPTIONAL,
|
|||
if (!HandleTableTable)
|
||||
{
|
||||
/* Failed, free the table */
|
||||
ExFreePool(HandleTable);
|
||||
ExFreePoolWithTag(HandleTable, TAG_OBJECT_TABLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -640,7 +640,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Free captured buffer */
|
||||
if (SafeParams) ExFreePool(SafeParams);
|
||||
if (SafeParams) ExFreePoolWithTag(SafeParams, TAG_ERR);
|
||||
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
|
@ -676,7 +676,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus,
|
|||
if (PreviousMode != KernelMode)
|
||||
{
|
||||
/* That means we have a buffer to free */
|
||||
if (SafeParams) ExFreePool(SafeParams);
|
||||
if (SafeParams) ExFreePoolWithTag(SafeParams, TAG_ERR);
|
||||
|
||||
/* Enter SEH Block for return */
|
||||
_SEH2_TRY
|
||||
|
|
|
@ -244,7 +244,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
/* Allocate the a new buffer since loader memory will be freed */
|
||||
ExpNlsTableBase = ExAllocatePoolWithTag(NonPagedPool,
|
||||
ExpNlsTableSize,
|
||||
'iltR');
|
||||
TAG_RTLI);
|
||||
if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED);
|
||||
|
||||
/* Copy the codepage data in its new location. */
|
||||
|
@ -334,7 +334,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize);
|
||||
|
||||
/* Free the previously allocated buffer and set the new location */
|
||||
ExFreePoolWithTag(ExpNlsTableBase, 'iltR');
|
||||
ExFreePoolWithTag(ExpNlsTableBase, TAG_RTLI);
|
||||
ExpNlsTableBase = SectionBase;
|
||||
|
||||
/* Initialize the NLS Tables */
|
||||
|
@ -1321,7 +1321,7 @@ Phase1InitializationDiscard(IN PVOID Context)
|
|||
/* Allocate the initialization buffer */
|
||||
InitBuffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(INIT_BUFFER),
|
||||
'tinI');
|
||||
TAG_INIT);
|
||||
if (!InitBuffer)
|
||||
{
|
||||
/* Bugcheck */
|
||||
|
@ -1961,7 +1961,7 @@ Phase1InitializationDiscard(IN PVOID Context)
|
|||
ExpInitializationPhase++;
|
||||
|
||||
/* Free the boot buffer */
|
||||
ExFreePool(InitBuffer);
|
||||
ExFreePoolWithTag(InitBuffer, TAG_INIT);
|
||||
DPRINT1("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ ExpDeleteProfile(PVOID ObjectBody)
|
|||
/* Unmap the Locked Buffer */
|
||||
MmUnmapLockedPages(Profile->LockedBufferAddress, Profile->Mdl);
|
||||
MmUnlockPages(Profile->Mdl);
|
||||
ExFreePool(Profile->Mdl);
|
||||
IoFreeMdl(Profile->Mdl);
|
||||
}
|
||||
|
||||
/* Check if a Process is associated and reference it */
|
||||
|
@ -368,7 +368,7 @@ NtStartProfile(IN HANDLE ProfileHandle)
|
|||
}
|
||||
|
||||
/* Allocate the Mdl Structure */
|
||||
Profile->Mdl = MmCreateMdl(NULL, Profile->Buffer, Profile->BufferSize);
|
||||
Profile->Mdl = IoAllocateMdl(Profile->Buffer, Profile->BufferSize, FALSE, FALSE, NULL);
|
||||
|
||||
/* Protect this in SEH as we might raise an exception */
|
||||
_SEH2_TRY
|
||||
|
@ -381,7 +381,7 @@ NtStartProfile(IN HANDLE ProfileHandle)
|
|||
/* Release our lock, free the buffer, dereference and return */
|
||||
KeReleaseMutex(&ExpProfileMutex, FALSE);
|
||||
ObDereferenceObject(Profile);
|
||||
ExFreePool(ProfileObject);
|
||||
ExFreePoolWithTag(ProfileObject, TAG_PROFILE);
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END;
|
||||
|
@ -449,7 +449,7 @@ NtStopProfile(IN HANDLE ProfileHandle)
|
|||
/* Unlock the Buffer */
|
||||
MmUnmapLockedPages(Profile->LockedBufferAddress, Profile->Mdl);
|
||||
MmUnlockPages(Profile->Mdl);
|
||||
ExFreePool(Profile->ProfileObject);
|
||||
ExFreePoolWithTag(Profile->ProfileObject, TAG_PROFILE);
|
||||
|
||||
/* Clear the Locked Buffer pointer, meaning the Object is Stopped */
|
||||
Profile->LockedBufferAddress = NULL;
|
||||
|
|
|
@ -220,7 +220,7 @@ ExpAllocateExclusiveWaiterEvent(IN PERESOURCE Resource,
|
|||
{
|
||||
/* Someone already set it, free our event */
|
||||
DPRINT1("WARNING: Handling race condition\n");
|
||||
ExFreePool(Event);
|
||||
ExFreePoolWithTag(Event, TAG_RESOURCE_EVENT);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -280,7 +280,7 @@ ExpAllocateSharedWaiterSemaphore(IN PERESOURCE Resource,
|
|||
{
|
||||
/* Someone already set it, free our semaphore */
|
||||
DPRINT1("WARNING: Handling race condition\n");
|
||||
ExFreePool(Semaphore);
|
||||
ExFreePoolWithTag(Semaphore, TAG_RESOURCE_SEMAPHORE);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -356,7 +356,7 @@ ExpExpandResourceOwnerTable(IN PERESOURCE Resource,
|
|||
{
|
||||
/* Resource changed while we weren't holding the lock; bail out */
|
||||
ExReleaseResourceLock(Resource, LockHandle);
|
||||
ExFreePool(Table);
|
||||
ExFreePoolWithTag(Table, TAG_RESOURCE_TABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -380,7 +380,7 @@ ExpExpandResourceOwnerTable(IN PERESOURCE Resource,
|
|||
ExReleaseResourceLock(Resource, LockHandle);
|
||||
|
||||
/* Free the old table */
|
||||
if (Owner) ExFreePool(Owner);
|
||||
if (Owner) ExFreePoolWithTag(Owner, TAG_RESOURCE_TABLE);
|
||||
|
||||
/* Set the resource index */
|
||||
if (!OldSize) OldSize = 1;
|
||||
|
@ -1473,9 +1473,9 @@ ExDeleteResourceLite(IN PERESOURCE Resource)
|
|||
KeReleaseInStackQueuedSpinLock(&LockHandle);
|
||||
|
||||
/* Free every structure */
|
||||
if (Resource->OwnerTable) ExFreePool(Resource->OwnerTable);
|
||||
if (Resource->SharedWaiters) ExFreePool(Resource->SharedWaiters);
|
||||
if (Resource->ExclusiveWaiters) ExFreePool(Resource->ExclusiveWaiters);
|
||||
if (Resource->OwnerTable) ExFreePoolWithTag(Resource->OwnerTable, TAG_RESOURCE_TABLE);
|
||||
if (Resource->SharedWaiters) ExFreePoolWithTag(Resource->SharedWaiters, TAG_RESOURCE_SEMAPHORE);
|
||||
if (Resource->ExclusiveWaiters) ExFreePoolWithTag(Resource->ExclusiveWaiters, TAG_RESOURCE_EVENT);
|
||||
|
||||
/* Return success */
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -159,7 +159,7 @@ xHalpGetRDiskCount(VOID)
|
|||
BOOLEAN First = TRUE;
|
||||
ULONG Count;
|
||||
|
||||
DirectoryInfo = ExAllocatePool(PagedPool, 2 * PAGE_SIZE);
|
||||
DirectoryInfo = ExAllocatePoolWithTag(PagedPool, 2 * PAGE_SIZE, TAG_FILE_SYSTEM);
|
||||
if (DirectoryInfo == NULL)
|
||||
{
|
||||
return 0;
|
||||
|
@ -178,7 +178,7 @@ xHalpGetRDiskCount(VOID)
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("ZwOpenDirectoryObject for %wZ failed, status=%lx\n", &ArcName, Status);
|
||||
ExFreePool(DirectoryInfo);
|
||||
ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ xHalpGetRDiskCount(VOID)
|
|||
}
|
||||
}
|
||||
}
|
||||
ExFreePool(DirectoryInfo);
|
||||
ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM);
|
||||
return RDiskCount;
|
||||
}
|
||||
|
||||
|
@ -377,8 +377,8 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName,
|
|||
PDRIVE_LAYOUT_INFORMATION Buffer;
|
||||
|
||||
/* Allocate a partition list for a single entry. */
|
||||
Buffer = ExAllocatePool(NonPagedPool,
|
||||
sizeof(DRIVE_LAYOUT_INFORMATION));
|
||||
Buffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||
sizeof(DRIVE_LAYOUT_INFORMATION), TAG_FILE_SYSTEM);
|
||||
if (Buffer != NULL)
|
||||
{
|
||||
RtlZeroMemory(Buffer,
|
||||
|
@ -446,13 +446,13 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
|
||||
DPRINT("RDiskCount %d\n", RDiskCount);
|
||||
|
||||
Buffer1 = (PWSTR)ExAllocatePool(PagedPool,
|
||||
64 * sizeof(WCHAR));
|
||||
Buffer2 = (PWSTR)ExAllocatePool(PagedPool,
|
||||
32 * sizeof(WCHAR));
|
||||
Buffer1 = (PWSTR)ExAllocatePoolWithTag(PagedPool,
|
||||
64 * sizeof(WCHAR), TAG_FILE_SYSTEM);
|
||||
Buffer2 = (PWSTR)ExAllocatePoolWithTag(PagedPool,
|
||||
32 * sizeof(WCHAR), TAG_FILE_SYSTEM);
|
||||
|
||||
PartialInformation = (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePool(PagedPool,
|
||||
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO));
|
||||
PartialInformation = (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePoolWithTag(PagedPool,
|
||||
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO), TAG_FILE_SYSTEM);
|
||||
|
||||
if (!Buffer1 || !Buffer2 || !PartialInformation) return;
|
||||
|
||||
|
@ -528,13 +528,13 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
/* Initialize layout array */
|
||||
if (ConfigInfo->DiskCount == 0)
|
||||
goto end_assign_disks;
|
||||
LayoutArray = ExAllocatePool(NonPagedPool,
|
||||
ConfigInfo->DiskCount * sizeof(PDRIVE_LAYOUT_INFORMATION));
|
||||
LayoutArray = ExAllocatePoolWithTag(NonPagedPool,
|
||||
ConfigInfo->DiskCount * sizeof(PDRIVE_LAYOUT_INFORMATION), TAG_FILE_SYSTEM);
|
||||
if (!LayoutArray)
|
||||
{
|
||||
ExFreePool(PartialInformation);
|
||||
ExFreePool(Buffer2);
|
||||
ExFreePool(Buffer1);
|
||||
ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM);
|
||||
ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM);
|
||||
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
||||
if (hKey) ZwClose(hKey);
|
||||
}
|
||||
|
||||
|
@ -896,9 +896,9 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
for (i = 0; i < ConfigInfo->DiskCount; i++)
|
||||
{
|
||||
if (LayoutArray[i] != NULL)
|
||||
ExFreePool(LayoutArray[i]);
|
||||
ExFreePoolWithTag(LayoutArray[i], TAG_FILE_SYSTEM);
|
||||
}
|
||||
ExFreePool(LayoutArray);
|
||||
ExFreePoolWithTag(LayoutArray, TAG_FILE_SYSTEM);
|
||||
end_assign_disks:
|
||||
|
||||
/* Assign floppy drives */
|
||||
|
@ -948,9 +948,9 @@ end_assign_disks:
|
|||
|
||||
/* Anything else to do? */
|
||||
|
||||
ExFreePool(PartialInformation);
|
||||
ExFreePool(Buffer2);
|
||||
ExFreePool(Buffer1);
|
||||
ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM);
|
||||
ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM);
|
||||
ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM);
|
||||
if (hKey)
|
||||
{
|
||||
ZwClose(hKey);
|
||||
|
@ -1249,8 +1249,8 @@ xHalGetPartialGeometry(IN PDEVICE_OBJECT DeviceObject,
|
|||
Cleanup:
|
||||
/* Free all the pointers */
|
||||
if (Event) ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
|
||||
if (IoStatusBlock) ExFreePool(IoStatusBlock);
|
||||
if (DiskGeometry) ExFreePool(DiskGeometry);
|
||||
if (IoStatusBlock) ExFreePoolWithTag(IoStatusBlock, TAG_FILE_SYSTEM);
|
||||
if (DiskGeometry) ExFreePoolWithTag(DiskGeometry, TAG_FILE_SYSTEM);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1425,7 +1425,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
/* EZ Drive found, bias the offset */
|
||||
IsEzDrive = TRUE;
|
||||
ExFreePool(MbrBuffer);
|
||||
ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM);
|
||||
Offset.QuadPart = 512;
|
||||
}
|
||||
|
||||
|
@ -1843,7 +1843,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
/* EZ Drive found, bias the offset */
|
||||
IsEzDrive = TRUE;
|
||||
ExFreePool(MbrBuffer);
|
||||
ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM);
|
||||
Offset.QuadPart = 512;
|
||||
}
|
||||
|
||||
|
@ -1995,7 +1995,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject,
|
|||
} while (i < PartitionNumber);
|
||||
|
||||
/* Everything done, cleanup */
|
||||
if (Buffer) ExFreePool(Buffer);
|
||||
if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -2043,7 +2043,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
/* EZ Drive found, bias the offset */
|
||||
IsEzDrive = TRUE;
|
||||
ExFreePool(MbrBuffer);
|
||||
ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM);
|
||||
Offset.QuadPart = 512;
|
||||
}
|
||||
|
||||
|
|
|
@ -893,7 +893,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
|
|||
/* Allocate a buffer to read a sector on the disk */
|
||||
Sector = ExAllocatePoolWithTag(NonPagedPool,
|
||||
Disk->SectorSize,
|
||||
'BtsF');
|
||||
TAG_FSTUB);
|
||||
if (!Sector)
|
||||
{
|
||||
DPRINT("EFI::Lacking resources!\n");
|
||||
|
@ -911,7 +911,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
|
|||
(PUSHORT)Sector);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(Sector, 'BtsF');
|
||||
ExFreePoolWithTag(Sector, TAG_FSTUB);
|
||||
DPRINT("EFI::Failed reading sector for partition entry!\n");
|
||||
return Status;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
|
|||
(PUSHORT)Sector);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(Sector, 'BtsF');
|
||||
ExFreePoolWithTag(Sector, TAG_FSTUB);
|
||||
DPRINT("EFI::Failed reading sector for partition entry!\n");
|
||||
return Status;
|
||||
}
|
||||
|
@ -944,7 +944,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk,
|
|||
}
|
||||
|
||||
/* Finally, release memory */
|
||||
ExFreePoolWithTag(Sector, 'BtsF');
|
||||
ExFreePoolWithTag(Sector, TAG_FSTUB);
|
||||
|
||||
/* Compare checksums */
|
||||
if (PreviousCRC32 == EFIHeader->PartitionEntryCRC32)
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#define KeReleaseGuardedMutexUnsafe _KeReleaseGuardedMutexUnsafe
|
||||
#define KeTryToAcquireGuardedMutex _KeTryToAcquireGuardedMutex
|
||||
|
||||
#include "tag.h"
|
||||
#include "ke.h"
|
||||
#include "ob.h"
|
||||
#include "mm.h"
|
||||
|
@ -83,7 +84,6 @@
|
|||
#endif
|
||||
#include "dbgk.h"
|
||||
#include "spinlock.h"
|
||||
#include "tag.h"
|
||||
#include "test.h"
|
||||
#include "inbv.h"
|
||||
#include "vdm.h"
|
||||
|
|
|
@ -136,7 +136,7 @@ ObpDereferenceNameInfo(IN POBJECT_HEADER_NAME_INFO HeaderNameInfo)
|
|||
if (HeaderNameInfo->Name.Buffer)
|
||||
{
|
||||
/* We can get rid of the object name now */
|
||||
ExFreePool(HeaderNameInfo->Name.Buffer);
|
||||
ExFreePoolWithTag(HeaderNameInfo->Name.Buffer, OB_NAME_TAG);
|
||||
RtlInitEmptyUnicodeString(&HeaderNameInfo->Name, NULL, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,21 @@
|
|||
/* formely located in include/callback.h */
|
||||
#define CALLBACK_TAG 'KBLC'
|
||||
|
||||
/* formely located in dbg/dbgkobj.c */
|
||||
#define TAG_DEBUG_EVENT 'EgbD'
|
||||
|
||||
/* formerly located in ex/resource.c */
|
||||
#define TAG_RESOURCE_TABLE 'aTeR'
|
||||
#define TAG_RESOURCE_EVENT 'aTeR'
|
||||
#define TAG_RESOURCE_SEMAPHORE 'aTeR'
|
||||
|
||||
/* formerly located in ex/handle.c */
|
||||
#define TAG_OBJECT_TABLE 'btbO'
|
||||
|
||||
/* formerly located in ex/init.c */
|
||||
#define TAG_INIT 'tinI'
|
||||
#define TAG_RTLI 'iltR'
|
||||
|
||||
/* formerly located in fs/notify.c */
|
||||
#define FSRTL_NOTIFY_TAG 'ITON'
|
||||
|
||||
|
@ -92,6 +102,7 @@
|
|||
#define TAG_DRIVER_MEM 'MVRD' /* drvm */
|
||||
#define TAG_MODULE_OBJECT 'omlk' /* klmo - kernel ldr module object */
|
||||
#define TAG_LDR_WSTR 'swlk' /* klws - kernel ldr wide string */
|
||||
#define TAG_LDR_IMPORTS 'klim' /* klim - kernel ldr imports */
|
||||
|
||||
/* formerly located in lpc/connect */
|
||||
#define TAG_LPC_CONNECT_MESSAGE 'CCPL'
|
||||
|
@ -101,6 +112,7 @@
|
|||
|
||||
/* formerly located in mm/marea.c */
|
||||
#define TAG_MAREA 'ERAM'
|
||||
#define TAG_MVAD 'VADM'
|
||||
|
||||
/* formerly located in mm/pageop.c */
|
||||
#define TAG_MM_PAGEOP 'POPM'
|
||||
|
@ -114,6 +126,9 @@
|
|||
/* formerly located in mm/rmap.c */
|
||||
#define TAG_RMAP 'PAMR'
|
||||
|
||||
/* formerly located in mm/ARM3/section.c */
|
||||
#define TAG_MM ' mM'
|
||||
|
||||
/* formerly located in mm/section.c */
|
||||
#define TAG_MM_SECTION_SEGMENT 'SSMM'
|
||||
#define TAG_SECTION_PAGE_TABLE 'TPSM'
|
||||
|
@ -123,6 +138,9 @@
|
|||
#define TAG_SYMLINK_TTARGET 'TTYS'
|
||||
#define TAG_SYMLINK_TARGET 'TMYS'
|
||||
|
||||
/* formerly located in ob/obsdcach.c */
|
||||
#define TAG_OB_SD_CACHE 'cSbO'
|
||||
|
||||
/* Object Manager Tags */
|
||||
#define OB_NAME_TAG 'mNbO'
|
||||
#define OB_DIR_TAG 'iDbO'
|
||||
|
@ -153,6 +171,11 @@
|
|||
/* formerly located in se/sd.c */
|
||||
#define TAG_SD 'dSeS'
|
||||
|
||||
/* formerly located in se/token.c */
|
||||
#define TAG_TOKEN_USERS 'uKOT'
|
||||
#define TAG_TOKEN_PRIVILAGES 'pKOT'
|
||||
#define TAG_TOKEN_ACL 'kDOT'
|
||||
|
||||
/* LPC Tags */
|
||||
#define TAG_LPC_MESSAGE 'McpL'
|
||||
#define TAG_LPC_ZONE 'ZcpL'
|
||||
|
|
|
@ -762,7 +762,7 @@ IopParseDevice(IN PVOID ParseObject,
|
|||
if (FileObject->FileName.Length)
|
||||
{
|
||||
/* Free it */
|
||||
ExFreePool(FileObject->FileName.Buffer);
|
||||
ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
|
||||
FileObject->FileName.Length = 0;
|
||||
}
|
||||
|
||||
|
@ -868,7 +868,7 @@ IopParseDevice(IN PVOID ParseObject,
|
|||
}
|
||||
|
||||
/* Free our buffer */
|
||||
ExFreePool(FileBasicInfo);
|
||||
ExFreePoolWithTag(FileBasicInfo, TAG_IO);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1331,7 +1331,7 @@ IopQueryNameFile(IN PVOID ObjectBody,
|
|||
if (!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH))
|
||||
{
|
||||
/* Free the buffer and fail */
|
||||
ExFreePool(LocalInfo);
|
||||
ExFreePoolWithTag(LocalInfo, TAG_IO);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1375,7 +1375,7 @@ IopQueryNameFile(IN PVOID ObjectBody,
|
|||
if (NT_ERROR(Status))
|
||||
{
|
||||
/* Fail on errors only, allow warnings */
|
||||
ExFreePool(LocalInfo);
|
||||
ExFreePoolWithTag(LocalInfo, TAG_IO);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1386,7 +1386,7 @@ IopQueryNameFile(IN PVOID ObjectBody,
|
|||
*ReturnLength += LocalFileInfo->FileNameLength;
|
||||
|
||||
/* Free the allocated buffer and return failure */
|
||||
ExFreePool(LocalInfo);
|
||||
ExFreePoolWithTag(LocalInfo, TAG_IO);
|
||||
return STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
|
@ -1414,7 +1414,7 @@ IopQueryNameFile(IN PVOID ObjectBody,
|
|||
sizeof(UNICODE_NULL);
|
||||
|
||||
/* Free buffer and return */
|
||||
ExFreePool(LocalInfo);
|
||||
ExFreePoolWithTag(LocalInfo, TAG_IO);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1908,7 +1908,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
if (OpenPacket.FileObject->FileName.Length)
|
||||
{
|
||||
/* It had a name, free it */
|
||||
ExFreePool(OpenPacket.FileObject->FileName.Buffer);
|
||||
ExFreePoolWithTag(OpenPacket.FileObject->FileName.Buffer, TAG_IO_NAME);
|
||||
}
|
||||
|
||||
/* Clear the device object to invalidate the FO, and dereference */
|
||||
|
|
|
@ -430,7 +430,7 @@ MiAllocateContiguousMemory(IN SIZE_T NumberOfBytes,
|
|||
//
|
||||
// No such luck
|
||||
//
|
||||
ExFreePool(BaseAddress);
|
||||
ExFreePoolWithTag(BaseAddress, 'mCmM');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ MiFreeContiguousMemory(IN PVOID BaseAddress)
|
|||
//
|
||||
// It did, so just use the pool to free this
|
||||
//
|
||||
ExFreePool(BaseAddress);
|
||||
ExFreePoolWithTag(BaseAddress, 'mCmM');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1087,7 +1087,7 @@ MiCreateMemoryEvent(IN PUNICODE_STRING Name,
|
|||
FALSE);
|
||||
CleanUp:
|
||||
/* Free the DACL */
|
||||
ExFreePool(Dacl);
|
||||
ExFreePoolWithTag(Dacl, 'lcaD');
|
||||
|
||||
/* Check if this is the success path */
|
||||
if (NT_SUCCESS(Status))
|
||||
|
@ -1533,7 +1533,7 @@ MmInitializeMemoryLimits(IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
|||
RtlCopyMemory(NewBuffer->Run,
|
||||
Buffer->Run,
|
||||
sizeof(PHYSICAL_MEMORY_RUN) * Run);
|
||||
ExFreePool(Buffer);
|
||||
ExFreePoolWithTag(Buffer, 'lMmM');
|
||||
|
||||
//
|
||||
// Now use the new buffer
|
||||
|
|
|
@ -177,7 +177,7 @@ MiInitializeSystemSpaceMap(IN PVOID InputSession OPTIONAL)
|
|||
BitmapSize = sizeof(RTL_BITMAP) + ((((MmSystemViewSize / MI_SYSTEM_VIEW_BUCKET_SIZE) + 31) / 32) * sizeof(ULONG));
|
||||
Session->SystemSpaceBitMap = ExAllocatePoolWithTag(NonPagedPool,
|
||||
BitmapSize,
|
||||
' mM');
|
||||
TAG_MM);
|
||||
ASSERT(Session->SystemSpaceBitMap);
|
||||
RtlInitializeBitMap(Session->SystemSpaceBitMap,
|
||||
(PULONG)(Session->SystemSpaceBitMap + 1),
|
||||
|
@ -198,7 +198,7 @@ MiInitializeSystemSpaceMap(IN PVOID InputSession OPTIONAL)
|
|||
/* Allocate and zero the view table */
|
||||
Session->SystemSpaceViewTable = ExAllocatePoolWithTag(NonPagedPool,
|
||||
AllocSize,
|
||||
' mM');
|
||||
TAG_MM);
|
||||
ASSERT(Session->SystemSpaceViewTable != NULL);
|
||||
RtlZeroMemory(Session->SystemSpaceViewTable, AllocSize);
|
||||
|
||||
|
@ -948,7 +948,7 @@ MmGetFileNameForFileObject(IN PFILE_OBJECT FileObject,
|
|||
ULONG ReturnLength;
|
||||
|
||||
/* Allocate memory for our structure */
|
||||
ObjectNameInfo = ExAllocatePoolWithTag(PagedPool, 1024, ' mM');
|
||||
ObjectNameInfo = ExAllocatePoolWithTag(PagedPool, 1024, TAG_MM);
|
||||
if (!ObjectNameInfo) return STATUS_NO_MEMORY;
|
||||
|
||||
/* Query the name */
|
||||
|
@ -960,7 +960,7 @@ MmGetFileNameForFileObject(IN PFILE_OBJECT FileObject,
|
|||
{
|
||||
/* Failed, free memory */
|
||||
DPRINT1("Name query failed\n");
|
||||
ExFreePoolWithTag(ObjectNameInfo, ' mM');
|
||||
ExFreePoolWithTag(ObjectNameInfo, TAG_MM);
|
||||
*ModuleName = NULL;
|
||||
return Status;
|
||||
}
|
||||
|
@ -1088,7 +1088,7 @@ NotSection:
|
|||
ModuleNameInformation->Name.Buffer);
|
||||
|
||||
/* Free temp taged buffer from MmGetFileNameForFileObject() */
|
||||
ExFreePoolWithTag(ModuleNameInformation, ' mM');
|
||||
ExFreePoolWithTag(ModuleNameInformation, TAG_MM);
|
||||
DPRINT("Found ModuleName %S by address %p\n", ModuleName->Buffer, Address);
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ MmCallDllInitialize(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
|||
Status = DllInit(&RegPath);
|
||||
|
||||
/* Clean up */
|
||||
ExFreePool(RegPath.Buffer);
|
||||
ExFreePoolWithTag(RegPath.Buffer, TAG_LDR_WSTR);
|
||||
|
||||
/* Return status value which DllInitialize returned */
|
||||
return Status;
|
||||
|
@ -427,7 +427,7 @@ MiDereferenceImports(IN PLOAD_IMPORTS ImportList)
|
|||
!((ULONG_PTR)LdrEntry->LoadedImports & MM_SYSLDR_SINGLE_ENTRY))
|
||||
{
|
||||
/* Free them */
|
||||
ExFreePool(CurrentImports);
|
||||
ExFreePoolWithTag(CurrentImports, TAG_LDR_IMPORTS);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -458,7 +458,7 @@ MiClearImports(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
|
|||
}
|
||||
|
||||
/* Otherwise, free the import list */
|
||||
ExFreePool(LdrEntry->LoadedImports);
|
||||
ExFreePoolWithTag(LdrEntry->LoadedImports, TAG_LDR_IMPORTS);
|
||||
LdrEntry->LoadedImports = MM_SYSLDR_BOOT_LOADED;
|
||||
}
|
||||
|
||||
|
@ -948,7 +948,7 @@ MmUnloadSystemImage(IN PVOID ImageHandle)
|
|||
if (LdrEntry->FullDllName.Buffer)
|
||||
{
|
||||
/* Free it */
|
||||
ExFreePool(LdrEntry->FullDllName.Buffer);
|
||||
ExFreePoolWithTag(LdrEntry->FullDllName.Buffer, TAG_LDR_WSTR);
|
||||
}
|
||||
|
||||
/* Check if we had a section */
|
||||
|
@ -959,7 +959,7 @@ MmUnloadSystemImage(IN PVOID ImageHandle)
|
|||
}
|
||||
|
||||
/* Free the entry */
|
||||
ExFreePool(LdrEntry);
|
||||
ExFreePoolWithTag(LdrEntry, TAG_MODULE_OBJECT);
|
||||
}
|
||||
|
||||
/* Release the system lock and return */
|
||||
|
@ -1022,7 +1022,7 @@ MiResolveImageReferences(IN PVOID ImageBase,
|
|||
LoadedImportsSize = ImportCount * sizeof(PVOID) + sizeof(SIZE_T);
|
||||
LoadedImports = ExAllocatePoolWithTag(PagedPool,
|
||||
LoadedImportsSize,
|
||||
'TDmM');
|
||||
TAG_LDR_IMPORTS);
|
||||
if (LoadedImports)
|
||||
{
|
||||
/* Zero it */
|
||||
|
@ -1059,7 +1059,7 @@ MiResolveImageReferences(IN PVOID ImageBase,
|
|||
{
|
||||
/* It's not, it's importing stuff it shouldn't be! */
|
||||
MiDereferenceImports(LoadedImports);
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
return STATUS_PROCEDURE_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ MiResolveImageReferences(IN PVOID ImageBase,
|
|||
{
|
||||
/* This is not kernel code */
|
||||
MiDereferenceImports(LoadedImports);
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
return STATUS_PROCEDURE_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
@ -1098,7 +1098,7 @@ MiResolveImageReferences(IN PVOID ImageBase,
|
|||
{
|
||||
/* Failed */
|
||||
MiDereferenceImports(LoadedImports);
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ CheckDllState:
|
|||
sizeof(UNICODE_NULL);
|
||||
DllName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||
DllName.MaximumLength,
|
||||
'TDmM');
|
||||
TAG_LDR_WSTR);
|
||||
if (DllName.Buffer)
|
||||
{
|
||||
/* Setup the base length and copy it */
|
||||
|
@ -1177,7 +1177,7 @@ CheckDllState:
|
|||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* We can free the DLL Name */
|
||||
ExFreePool(DllName.Buffer);
|
||||
ExFreePoolWithTag(DllName.Buffer, TAG_LDR_WSTR);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1219,7 +1219,7 @@ CheckDllState:
|
|||
/* Cleanup and return */
|
||||
RtlFreeUnicodeString(&NameString);
|
||||
MiDereferenceImports(LoadedImports);
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ CheckDllState:
|
|||
{
|
||||
/* Cleanup and return */
|
||||
MiDereferenceImports(LoadedImports);
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
DPRINT1("Warning: Driver failed to load, %S not found\n", *MissingDriver);
|
||||
return STATUS_DRIVER_ENTRYPOINT_NOT_FOUND;
|
||||
}
|
||||
|
@ -1282,7 +1282,7 @@ CheckDllState:
|
|||
{
|
||||
/* Cleanup and return */
|
||||
MiDereferenceImports(LoadedImports);
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -1315,13 +1315,13 @@ CheckDllState:
|
|||
if (!ImportCount)
|
||||
{
|
||||
/* Free the list and set it to no imports */
|
||||
ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
LoadedImports = MM_SYSLDR_NO_IMPORTS;
|
||||
}
|
||||
else if (ImportCount == 1)
|
||||
{
|
||||
/* Just one entry, we can free the table and only use our entry */
|
||||
ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
LoadedImports = (PLOAD_IMPORTS)ImportEntry;
|
||||
}
|
||||
else if (ImportCount != LoadedImports->Count)
|
||||
|
@ -1330,7 +1330,7 @@ CheckDllState:
|
|||
LoadedImportsSize = ImportCount * sizeof(PVOID) + sizeof(SIZE_T);
|
||||
NewImports = ExAllocatePoolWithTag(PagedPool,
|
||||
LoadedImportsSize,
|
||||
'TDmM');
|
||||
TAG_LDR_IMPORTS);
|
||||
if (NewImports)
|
||||
{
|
||||
/* Set count */
|
||||
|
@ -1349,7 +1349,7 @@ CheckDllState:
|
|||
}
|
||||
|
||||
/* Free the old copy */
|
||||
ExFreePoolWithTag(LoadedImports, 'TDmM');
|
||||
ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
|
||||
LoadedImports = NewImports;
|
||||
}
|
||||
}
|
||||
|
@ -1625,7 +1625,7 @@ MiBuildImportsForBootDrivers(VOID)
|
|||
if (!(HalEntry) || (!KernelEntry)) return STATUS_NOT_FOUND;
|
||||
|
||||
/* Allocate the list */
|
||||
EntryArray = ExAllocatePoolWithTag(PagedPool, Modules * sizeof(PVOID), 'TDmM');
|
||||
EntryArray = ExAllocatePoolWithTag(PagedPool, Modules * sizeof(PVOID), TAG_LDR_IMPORTS);
|
||||
if (!EntryArray) return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Loop the loaded module list again */
|
||||
|
@ -1773,7 +1773,7 @@ MiBuildImportsForBootDrivers(VOID)
|
|||
LoadedImportsSize = ImportSize * sizeof(PVOID) + sizeof(SIZE_T);
|
||||
LoadedImports = ExAllocatePoolWithTag(PagedPool,
|
||||
LoadedImportsSize,
|
||||
'TDmM');
|
||||
TAG_LDR_IMPORTS);
|
||||
ASSERT(LoadedImports);
|
||||
|
||||
/* Save the count */
|
||||
|
@ -1805,7 +1805,7 @@ MiBuildImportsForBootDrivers(VOID)
|
|||
}
|
||||
|
||||
/* Free the initial array */
|
||||
ExFreePool(EntryArray);
|
||||
ExFreePoolWithTag(EntryArray, TAG_LDR_IMPORTS);
|
||||
|
||||
/* FIXME: Might not need to keep the HAL/Kernel imports around */
|
||||
|
||||
|
@ -1923,7 +1923,7 @@ MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
EntrySize = sizeof(LDR_DATA_TABLE_ENTRY) +
|
||||
LdrEntry->BaseDllName.MaximumLength +
|
||||
sizeof(UNICODE_NULL);
|
||||
NewEntry = ExAllocatePoolWithTag(NonPagedPool, EntrySize, TAG_LDR_WSTR);
|
||||
NewEntry = ExAllocatePoolWithTag(NonPagedPool, EntrySize, TAG_MODULE_OBJECT);
|
||||
if (!NewEntry) return FALSE;
|
||||
|
||||
/* Copy the entry over */
|
||||
|
@ -2561,7 +2561,7 @@ MmLoadSystemImage(IN PUNICODE_STRING FileName,
|
|||
}
|
||||
|
||||
/* Allocate a buffer we'll use for names */
|
||||
Buffer = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH, 'nLmM');
|
||||
Buffer = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH, TAG_LDR_WSTR);
|
||||
if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
/* Check for a separator */
|
||||
|
@ -2906,7 +2906,7 @@ LoaderScan:
|
|||
if (LdrEntry->FullDllName.Buffer)
|
||||
{
|
||||
/* Free it */
|
||||
ExFreePool(LdrEntry->FullDllName.Buffer);
|
||||
ExFreePoolWithTag(LdrEntry->FullDllName.Buffer, TAG_LDR_WSTR);
|
||||
}
|
||||
|
||||
/* Free the entry itself */
|
||||
|
@ -3004,7 +3004,7 @@ Quickie:
|
|||
/* if (NamePrefix) ExFreePool(PrefixName.Buffer); */
|
||||
|
||||
/* Free the name buffer and return status */
|
||||
ExFreePoolWithTag(Buffer, 'nLmM');
|
||||
ExFreePoolWithTag(Buffer, TAG_LDR_WSTR);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -377,7 +377,7 @@ MmInsertMemoryArea(
|
|||
PMMVAD Vad;
|
||||
|
||||
ASSERT(marea->Type == MEMORY_AREA_VIRTUAL_MEMORY || marea->Type == MEMORY_AREA_SECTION_VIEW);
|
||||
Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD), 'Fake');
|
||||
Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD), TAG_MVAD);
|
||||
ASSERT(Vad);
|
||||
RtlZeroMemory(Vad, sizeof(MMVAD));
|
||||
Vad->StartingVpn = PAGE_ROUND_DOWN(marea->StartingAddress) >> PAGE_SHIFT;
|
||||
|
@ -776,7 +776,7 @@ MmFreeMemoryArea(
|
|||
MiRemoveNode(MemoryArea->Vad, &Process->VadRoot);
|
||||
}
|
||||
|
||||
ExFreePool(MemoryArea->Vad);
|
||||
ExFreePoolWithTag(MemoryArea->Vad, TAG_MVAD);
|
||||
MemoryArea->Vad = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -694,7 +694,7 @@ ParseFromRoot:
|
|||
ObjectHeader)))
|
||||
{
|
||||
/* Either couldn't allocate the name, or insert failed */
|
||||
if (NewName) ExFreePool(NewName);
|
||||
if (NewName) ExFreePoolWithTag(NewName, OB_NAME_TAG);
|
||||
|
||||
/* Fail due to memory reasons */
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
|
|
@ -132,7 +132,7 @@ ObpCreateCacheEntry(IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|||
|
||||
/* Calculate the memory we'll need to allocate and allocate it */
|
||||
CacheSize = Length + (sizeof(SECURITY_DESCRIPTOR_HEADER) - sizeof(QUAD));
|
||||
SdHeader = ExAllocatePoolWithTag(PagedPool, CacheSize, 'cSbO');
|
||||
SdHeader = ExAllocatePoolWithTag(PagedPool, CacheSize, TAG_OB_SD_CACHE);
|
||||
if (!SdHeader) return NULL;
|
||||
|
||||
/* Setup the header */
|
||||
|
|
|
@ -311,7 +311,7 @@ SepCaptureAcl(IN PACL InputAcl,
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Free the ACL and return the exception code */
|
||||
ExFreePool(NewAcl);
|
||||
ExFreePoolWithTag(NewAcl, TAG_ACL);
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END;
|
||||
|
@ -361,7 +361,7 @@ SepReleaseAcl(IN PACL CapturedAcl,
|
|||
(AccessMode != KernelMode ||
|
||||
(AccessMode == KernelMode && CaptureIfKernel)))
|
||||
{
|
||||
ExFreePool(CapturedAcl);
|
||||
ExFreePoolWithTag(CapturedAcl, TAG_ACL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -686,7 +686,7 @@ Offset += ROUND_UP(Type##Size, sizeof(ULONG)); \
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* We failed to copy the data to the new descriptor */
|
||||
ExFreePool(NewDescriptor);
|
||||
ExFreePoolWithTag(NewDescriptor, TAG_SD);
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END;
|
||||
|
@ -1248,7 +1248,7 @@ SeDeassignSecurity(PSECURITY_DESCRIPTOR *SecurityDescriptor)
|
|||
|
||||
if (*SecurityDescriptor != NULL)
|
||||
{
|
||||
ExFreePool(*SecurityDescriptor);
|
||||
ExFreePoolWithTag(*SecurityDescriptor, TAG_SD);
|
||||
*SecurityDescriptor = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,34 +60,34 @@ VOID
|
|||
NTAPI
|
||||
FreeInitializedSids(VOID)
|
||||
{
|
||||
if (SeNullSid) ExFreePool(SeNullSid);
|
||||
if (SeWorldSid) ExFreePool(SeWorldSid);
|
||||
if (SeLocalSid) ExFreePool(SeLocalSid);
|
||||
if (SeCreatorOwnerSid) ExFreePool(SeCreatorOwnerSid);
|
||||
if (SeCreatorGroupSid) ExFreePool(SeCreatorGroupSid);
|
||||
if (SeCreatorOwnerServerSid) ExFreePool(SeCreatorOwnerServerSid);
|
||||
if (SeCreatorGroupServerSid) ExFreePool(SeCreatorGroupServerSid);
|
||||
if (SeNtAuthoritySid) ExFreePool(SeNtAuthoritySid);
|
||||
if (SeDialupSid) ExFreePool(SeDialupSid);
|
||||
if (SeNetworkSid) ExFreePool(SeNetworkSid);
|
||||
if (SeBatchSid) ExFreePool(SeBatchSid);
|
||||
if (SeInteractiveSid) ExFreePool(SeInteractiveSid);
|
||||
if (SeServiceSid) ExFreePool(SeServiceSid);
|
||||
if (SePrincipalSelfSid) ExFreePool(SePrincipalSelfSid);
|
||||
if (SeLocalSystemSid) ExFreePool(SeLocalSystemSid);
|
||||
if (SeAuthenticatedUserSid) ExFreePool(SeAuthenticatedUserSid);
|
||||
if (SeRestrictedCodeSid) ExFreePool(SeRestrictedCodeSid);
|
||||
if (SeAliasAdminsSid) ExFreePool(SeAliasAdminsSid);
|
||||
if (SeAliasUsersSid) ExFreePool(SeAliasUsersSid);
|
||||
if (SeAliasGuestsSid) ExFreePool(SeAliasGuestsSid);
|
||||
if (SeAliasPowerUsersSid) ExFreePool(SeAliasPowerUsersSid);
|
||||
if (SeAliasAccountOpsSid) ExFreePool(SeAliasAccountOpsSid);
|
||||
if (SeAliasSystemOpsSid) ExFreePool(SeAliasSystemOpsSid);
|
||||
if (SeAliasPrintOpsSid) ExFreePool(SeAliasPrintOpsSid);
|
||||
if (SeAliasBackupOpsSid) ExFreePool(SeAliasBackupOpsSid);
|
||||
if (SeAuthenticatedUsersSid) ExFreePool(SeAuthenticatedUsersSid);
|
||||
if (SeRestrictedSid) ExFreePool(SeRestrictedSid);
|
||||
if (SeAnonymousLogonSid) ExFreePool(SeAnonymousLogonSid);
|
||||
if (SeNullSid) ExFreePoolWithTag(SeNullSid, TAG_SID);
|
||||
if (SeWorldSid) ExFreePoolWithTag(SeWorldSid, TAG_SID);
|
||||
if (SeLocalSid) ExFreePoolWithTag(SeLocalSid, TAG_SID);
|
||||
if (SeCreatorOwnerSid) ExFreePoolWithTag(SeCreatorOwnerSid, TAG_SID);
|
||||
if (SeCreatorGroupSid) ExFreePoolWithTag(SeCreatorGroupSid, TAG_SID);
|
||||
if (SeCreatorOwnerServerSid) ExFreePoolWithTag(SeCreatorOwnerServerSid, TAG_SID);
|
||||
if (SeCreatorGroupServerSid) ExFreePoolWithTag(SeCreatorGroupServerSid, TAG_SID);
|
||||
if (SeNtAuthoritySid) ExFreePoolWithTag(SeNtAuthoritySid, TAG_SID);
|
||||
if (SeDialupSid) ExFreePoolWithTag(SeDialupSid, TAG_SID);
|
||||
if (SeNetworkSid) ExFreePoolWithTag(SeNetworkSid, TAG_SID);
|
||||
if (SeBatchSid) ExFreePoolWithTag(SeBatchSid, TAG_SID);
|
||||
if (SeInteractiveSid) ExFreePoolWithTag(SeInteractiveSid, TAG_SID);
|
||||
if (SeServiceSid) ExFreePoolWithTag(SeServiceSid, TAG_SID);
|
||||
if (SePrincipalSelfSid) ExFreePoolWithTag(SePrincipalSelfSid, TAG_SID);
|
||||
if (SeLocalSystemSid) ExFreePoolWithTag(SeLocalSystemSid, TAG_SID);
|
||||
if (SeAuthenticatedUserSid) ExFreePoolWithTag(SeAuthenticatedUserSid, TAG_SID);
|
||||
if (SeRestrictedCodeSid) ExFreePoolWithTag(SeRestrictedCodeSid, TAG_SID);
|
||||
if (SeAliasAdminsSid) ExFreePoolWithTag(SeAliasAdminsSid, TAG_SID);
|
||||
if (SeAliasUsersSid) ExFreePoolWithTag(SeAliasUsersSid, TAG_SID);
|
||||
if (SeAliasGuestsSid) ExFreePoolWithTag(SeAliasGuestsSid, TAG_SID);
|
||||
if (SeAliasPowerUsersSid) ExFreePoolWithTag(SeAliasPowerUsersSid, TAG_SID);
|
||||
if (SeAliasAccountOpsSid) ExFreePoolWithTag(SeAliasAccountOpsSid, TAG_SID);
|
||||
if (SeAliasSystemOpsSid) ExFreePoolWithTag(SeAliasSystemOpsSid, TAG_SID);
|
||||
if (SeAliasPrintOpsSid) ExFreePoolWithTag(SeAliasPrintOpsSid, TAG_SID);
|
||||
if (SeAliasBackupOpsSid) ExFreePoolWithTag(SeAliasBackupOpsSid, TAG_SID);
|
||||
if (SeAuthenticatedUsersSid) ExFreePoolWithTag(SeAuthenticatedUsersSid, TAG_SID);
|
||||
if (SeRestrictedSid) ExFreePoolWithTag(SeRestrictedSid, TAG_SID);
|
||||
if (SeAnonymousLogonSid) ExFreePoolWithTag(SeAnonymousLogonSid, TAG_SID);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
@ -306,7 +306,7 @@ SepCaptureSid(IN PSID InputSid,
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Free the SID and return the exception code */
|
||||
ExFreePool(NewSid);
|
||||
ExFreePoolWithTag(NewSid, TAG_SID);
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END;
|
||||
|
@ -357,7 +357,7 @@ SepReleaseSid(IN PSID CapturedSid,
|
|||
(AccessMode != KernelMode ||
|
||||
(AccessMode == KernelMode && CaptureIfKernel)))
|
||||
{
|
||||
ExFreePool(CapturedSid);
|
||||
ExFreePoolWithTag(CapturedSid, TAG_SID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -293,7 +293,7 @@ SepDuplicateToken(PTOKEN Token,
|
|||
AccessToken->UserAndGroups =
|
||||
(PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
|
||||
uLength,
|
||||
'uKOT');
|
||||
TAG_TOKEN_USERS);
|
||||
|
||||
EndMem = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount];
|
||||
|
||||
|
@ -320,7 +320,7 @@ SepDuplicateToken(PTOKEN Token,
|
|||
AccessToken->Privileges =
|
||||
(PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
|
||||
uLength,
|
||||
'pKOT');
|
||||
TAG_TOKEN_PRIVILAGES);
|
||||
|
||||
for (i = 0; i < AccessToken->PrivilegeCount; i++)
|
||||
{
|
||||
|
@ -335,7 +335,7 @@ SepDuplicateToken(PTOKEN Token,
|
|||
AccessToken->DefaultDacl =
|
||||
(PACL) ExAllocatePoolWithTag(PagedPool,
|
||||
Token->DefaultDacl->AclSize,
|
||||
'kDOT');
|
||||
TAG_TOKEN_ACL);
|
||||
memcpy(AccessToken->DefaultDacl,
|
||||
Token->DefaultDacl,
|
||||
Token->DefaultDacl->AclSize);
|
||||
|
@ -460,13 +460,13 @@ SepDeleteToken(PVOID ObjectBody)
|
|||
PTOKEN AccessToken = (PTOKEN)ObjectBody;
|
||||
|
||||
if (AccessToken->UserAndGroups)
|
||||
ExFreePool(AccessToken->UserAndGroups);
|
||||
ExFreePoolWithTag(AccessToken->UserAndGroups, TAG_TOKEN_USERS);
|
||||
|
||||
if (AccessToken->Privileges)
|
||||
ExFreePool(AccessToken->Privileges);
|
||||
ExFreePoolWithTag(AccessToken->Privileges, TAG_TOKEN_PRIVILAGES);
|
||||
|
||||
if (AccessToken->DefaultDacl)
|
||||
ExFreePool(AccessToken->DefaultDacl);
|
||||
ExFreePoolWithTag(AccessToken->DefaultDacl, TAG_TOKEN_ACL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -639,7 +639,7 @@ SepCreateToken(OUT PHANDLE TokenHandle,
|
|||
AccessToken->UserAndGroups =
|
||||
(PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
|
||||
uLength,
|
||||
'uKOT');
|
||||
TAG_TOKEN_USERS);
|
||||
|
||||
EndMem = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount];
|
||||
|
||||
|
@ -675,7 +675,7 @@ SepCreateToken(OUT PHANDLE TokenHandle,
|
|||
AccessToken->Privileges =
|
||||
(PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
|
||||
uLength,
|
||||
'pKOT');
|
||||
TAG_TOKEN_PRIVILAGES);
|
||||
|
||||
if (PreviousMode != KernelMode)
|
||||
{
|
||||
|
@ -704,7 +704,7 @@ SepCreateToken(OUT PHANDLE TokenHandle,
|
|||
AccessToken->DefaultDacl =
|
||||
(PACL) ExAllocatePoolWithTag(PagedPool,
|
||||
DefaultDacl->AclSize,
|
||||
'kDOT');
|
||||
TAG_TOKEN_ACL);
|
||||
memcpy(AccessToken->DefaultDacl,
|
||||
DefaultDacl,
|
||||
DefaultDacl->AclSize);
|
||||
|
@ -1720,7 +1720,7 @@ NtSetInformationToken(IN HANDLE TokenHandle,
|
|||
/* Free the previous dacl if present */
|
||||
if(Token->DefaultDacl != NULL)
|
||||
{
|
||||
ExFreePool(Token->DefaultDacl);
|
||||
ExFreePoolWithTag(Token->DefaultDacl, TAG_TOKEN_ACL);
|
||||
}
|
||||
|
||||
/* Set the new dacl */
|
||||
|
@ -1732,7 +1732,7 @@ NtSetInformationToken(IN HANDLE TokenHandle,
|
|||
/* Clear and free the default dacl if present */
|
||||
if (Token->DefaultDacl != NULL)
|
||||
{
|
||||
ExFreePool(Token->DefaultDacl);
|
||||
ExFreePoolWithTag(Token->DefaultDacl, TAG_TOKEN_ACL);
|
||||
Token->DefaultDacl = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -2478,7 +2478,7 @@ NtOpenThreadTokenEx(IN HANDLE ThreadHandle,
|
|||
PreviousMode, &hToken);
|
||||
}
|
||||
|
||||
if (Dacl) ExFreePool(Dacl);
|
||||
if (Dacl) ExFreePoolWithTag(Dacl, TAG_TOKEN_ACL);
|
||||
|
||||
if (OpenAsSelf)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue