MmUnlockCacheSectionSegment(Segment);
}
DPRINTC("Segment %x destroy\n", Segment);
- ExFreePool(Segment);
+ ExFreePoolWithTag(Segment, TAG_MM_SECTION_SEGMENT);
}
NTSTATUS
}
/* 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;
}
/* 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;
ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock)
{
/* Just free it from memory */
- ExFreePool(CallbackBlock);
+ ExFreePoolWithTag(CallbackBlock, CALLBACK_TAG);
}
VOID
KeReleaseSpinLock(&CallbackObject->Lock, OldIrql);
/* Free the registration */
- ExFreePool(CallbackRegistration);
+ ExFreePoolWithTag(CallbackRegistration, CALLBACK_TAG);
CallbackRegistration = NULL;
/* Dereference the object */
KeReleaseSpinLock(&CallbackObject->Lock, OldIrql);
/* Delete this registration */
- ExFreePool(CallbackRegistration);
+ ExFreePoolWithTag(CallbackRegistration, CALLBACK_TAG);
/* Remove the reference */
ObDereferenceObject(CallbackObject);
PVOID Buffer;
/* Do the allocation */
- Buffer = ExAllocatePoolWithTag(PagedPool, Size, 'btbO');
+ Buffer = ExAllocatePoolWithTag(PagedPool, Size, TAG_OBJECT_TABLE);
if (Buffer)
{
/* Clear the memory */
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 */
IN SIZE_T Size)
{
/* Free the buffer */
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_OBJECT_TABLE);
if (Process)
{
/* FIXME: Release quota */
}
/* Free the actual table and check if we need to release quota */
- ExFreePool(HandleTable);
+ ExFreePoolWithTag(HandleTable, TAG_OBJECT_TABLE);
if (Process)
{
/* FIXME: TODO */
/* Allocate the table */
HandleTable = ExAllocatePoolWithTag(PagedPool,
sizeof(HANDLE_TABLE),
- 'btbO');
+ TAG_OBJECT_TABLE);
if (!HandleTable) return NULL;
/* Check if we have a process */
if (!HandleTableTable)
{
/* Failed, free the table */
- ExFreePool(HandleTable);
+ ExFreePoolWithTag(HandleTable, TAG_OBJECT_TABLE);
return NULL;
}
_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());
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
/* 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. */
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 */
/* Allocate the initialization buffer */
InitBuffer = ExAllocatePoolWithTag(NonPagedPool,
sizeof(INIT_BUFFER),
- 'tinI');
+ TAG_INIT);
if (!InitBuffer)
{
/* Bugcheck */
ExpInitializationPhase++;
/* Free the boot buffer */
- ExFreePool(InitBuffer);
+ ExFreePoolWithTag(InitBuffer, TAG_INIT);
DPRINT1("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed);
}
/* 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 */
}
/* 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
/* 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;
/* 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;
{
/* Someone already set it, free our event */
DPRINT1("WARNING: Handling race condition\n");
- ExFreePool(Event);
+ ExFreePoolWithTag(Event, TAG_RESOURCE_EVENT);
}
break;
{
/* Someone already set it, free our semaphore */
DPRINT1("WARNING: Handling race condition\n");
- ExFreePool(Semaphore);
+ ExFreePoolWithTag(Semaphore, TAG_RESOURCE_SEMAPHORE);
}
break;
{
/* Resource changed while we weren't holding the lock; bail out */
ExReleaseResourceLock(Resource, LockHandle);
- ExFreePool(Table);
+ ExFreePoolWithTag(Table, TAG_RESOURCE_TABLE);
}
else
{
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;
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;
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;
if (!NT_SUCCESS(Status))
{
DPRINT1("ZwOpenDirectoryObject for %wZ failed, status=%lx\n", &ArcName, Status);
- ExFreePool(DirectoryInfo);
+ ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM);
return 0;
}
}
}
}
- ExFreePool(DirectoryInfo);
+ ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM);
return RDiskCount;
}
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,
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;
/* 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);
}
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 */
/* 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);
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;
}
{
/* EZ Drive found, bias the offset */
IsEzDrive = TRUE;
- ExFreePool(MbrBuffer);
+ ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM);
Offset.QuadPart = 512;
}
{
/* EZ Drive found, bias the offset */
IsEzDrive = TRUE;
- ExFreePool(MbrBuffer);
+ ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM);
Offset.QuadPart = 512;
}
} while (i < PartitionNumber);
/* Everything done, cleanup */
- if (Buffer) ExFreePool(Buffer);
+ if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
return Status;
}
{
/* EZ Drive found, bias the offset */
IsEzDrive = TRUE;
- ExFreePool(MbrBuffer);
+ ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM);
Offset.QuadPart = 512;
}
/* 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");
(PUSHORT)Sector);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(Sector, 'BtsF');
+ ExFreePoolWithTag(Sector, TAG_FSTUB);
DPRINT("EFI::Failed reading sector for partition entry!\n");
return Status;
}
(PUSHORT)Sector);
if (!NT_SUCCESS(Status))
{
- ExFreePoolWithTag(Sector, 'BtsF');
+ ExFreePoolWithTag(Sector, TAG_FSTUB);
DPRINT("EFI::Failed reading sector for partition entry!\n");
return Status;
}
}
/* Finally, release memory */
- ExFreePoolWithTag(Sector, 'BtsF');
+ ExFreePoolWithTag(Sector, TAG_FSTUB);
/* Compare checksums */
if (PreviousCRC32 == EFIHeader->PartitionEntryCRC32)
#define KeReleaseGuardedMutexUnsafe _KeReleaseGuardedMutexUnsafe
#define KeTryToAcquireGuardedMutex _KeTryToAcquireGuardedMutex
+#include "tag.h"
#include "ke.h"
#include "ob.h"
#include "mm.h"
#endif
#include "dbgk.h"
#include "spinlock.h"
-#include "tag.h"
#include "test.h"
#include "inbv.h"
#include "vdm.h"
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);
}
/* 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'
#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'
/* 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'
/* 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'
#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'
/* 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'
if (FileObject->FileName.Length)
{
/* Free it */
- ExFreePool(FileObject->FileName.Buffer);
+ ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
FileObject->FileName.Length = 0;
}
}
/* Free our buffer */
- ExFreePool(FileBasicInfo);
+ ExFreePoolWithTag(FileBasicInfo, TAG_IO);
}
else
{
if (!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH))
{
/* Free the buffer and fail */
- ExFreePool(LocalInfo);
+ ExFreePoolWithTag(LocalInfo, TAG_IO);
return Status;
}
if (NT_ERROR(Status))
{
/* Fail on errors only, allow warnings */
- ExFreePool(LocalInfo);
+ ExFreePoolWithTag(LocalInfo, TAG_IO);
return Status;
}
*ReturnLength += LocalFileInfo->FileNameLength;
/* Free the allocated buffer and return failure */
- ExFreePool(LocalInfo);
+ ExFreePoolWithTag(LocalInfo, TAG_IO);
return STATUS_BUFFER_OVERFLOW;
}
sizeof(UNICODE_NULL);
/* Free buffer and return */
- ExFreePool(LocalInfo);
+ ExFreePoolWithTag(LocalInfo, TAG_IO);
return Status;
}
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 */
//
// No such luck
//
- ExFreePool(BaseAddress);
+ ExFreePoolWithTag(BaseAddress, 'mCmM');
}
}
//
// It did, so just use the pool to free this
//
- ExFreePool(BaseAddress);
+ ExFreePoolWithTag(BaseAddress, 'mCmM');
return;
}
FALSE);
CleanUp:
/* Free the DACL */
- ExFreePool(Dacl);
+ ExFreePoolWithTag(Dacl, 'lcaD');
/* Check if this is the success path */
if (NT_SUCCESS(Status))
RtlCopyMemory(NewBuffer->Run,
Buffer->Run,
sizeof(PHYSICAL_MEMORY_RUN) * Run);
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, 'lMmM');
//
// Now use the new buffer
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),
/* Allocate and zero the view table */
Session->SystemSpaceViewTable = ExAllocatePoolWithTag(NonPagedPool,
AllocSize,
- ' mM');
+ TAG_MM);
ASSERT(Session->SystemSpaceViewTable != NULL);
RtlZeroMemory(Session->SystemSpaceViewTable, AllocSize);
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 */
{
/* Failed, free memory */
DPRINT1("Name query failed\n");
- ExFreePoolWithTag(ObjectNameInfo, ' mM');
+ ExFreePoolWithTag(ObjectNameInfo, TAG_MM);
*ModuleName = NULL;
return Status;
}
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);
}
Status = DllInit(&RegPath);
/* Clean up */
- ExFreePool(RegPath.Buffer);
+ ExFreePoolWithTag(RegPath.Buffer, TAG_LDR_WSTR);
/* Return status value which DllInitialize returned */
return Status;
!((ULONG_PTR)LdrEntry->LoadedImports & MM_SYSLDR_SINGLE_ENTRY))
{
/* Free them */
- ExFreePool(CurrentImports);
+ ExFreePoolWithTag(CurrentImports, TAG_LDR_IMPORTS);
}
}
else
}
/* Otherwise, free the import list */
- ExFreePool(LdrEntry->LoadedImports);
+ ExFreePoolWithTag(LdrEntry->LoadedImports, TAG_LDR_IMPORTS);
LdrEntry->LoadedImports = MM_SYSLDR_BOOT_LOADED;
}
if (LdrEntry->FullDllName.Buffer)
{
/* Free it */
- ExFreePool(LdrEntry->FullDllName.Buffer);
+ ExFreePoolWithTag(LdrEntry->FullDllName.Buffer, TAG_LDR_WSTR);
}
/* Check if we had a section */
}
/* Free the entry */
- ExFreePool(LdrEntry);
+ ExFreePoolWithTag(LdrEntry, TAG_MODULE_OBJECT);
}
/* Release the system lock and return */
LoadedImportsSize = ImportCount * sizeof(PVOID) + sizeof(SIZE_T);
LoadedImports = ExAllocatePoolWithTag(PagedPool,
LoadedImportsSize,
- 'TDmM');
+ TAG_LDR_IMPORTS);
if (LoadedImports)
{
/* Zero it */
{
/* 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;
}
{
/* This is not kernel code */
MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
return STATUS_PROCEDURE_NOT_FOUND;
}
{
/* Failed */
MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
return Status;
}
sizeof(UNICODE_NULL);
DllName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
DllName.MaximumLength,
- 'TDmM');
+ TAG_LDR_WSTR);
if (DllName.Buffer)
{
/* Setup the base length and copy it */
if (NT_SUCCESS(Status))
{
/* We can free the DLL Name */
- ExFreePool(DllName.Buffer);
+ ExFreePoolWithTag(DllName.Buffer, TAG_LDR_WSTR);
}
else
{
/* Cleanup and return */
RtlFreeUnicodeString(&NameString);
MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
return Status;
}
{
/* 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;
}
{
/* Cleanup and return */
MiDereferenceImports(LoadedImports);
- if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM');
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
return Status;
}
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)
LoadedImportsSize = ImportCount * sizeof(PVOID) + sizeof(SIZE_T);
NewImports = ExAllocatePoolWithTag(PagedPool,
LoadedImportsSize,
- 'TDmM');
+ TAG_LDR_IMPORTS);
if (NewImports)
{
/* Set count */
}
/* Free the old copy */
- ExFreePoolWithTag(LoadedImports, 'TDmM');
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS);
LoadedImports = NewImports;
}
}
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 */
LoadedImportsSize = ImportSize * sizeof(PVOID) + sizeof(SIZE_T);
LoadedImports = ExAllocatePoolWithTag(PagedPool,
LoadedImportsSize,
- 'TDmM');
+ TAG_LDR_IMPORTS);
ASSERT(LoadedImports);
/* Save the count */
}
/* Free the initial array */
- ExFreePool(EntryArray);
+ ExFreePoolWithTag(EntryArray, TAG_LDR_IMPORTS);
/* FIXME: Might not need to keep the HAL/Kernel imports around */
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 */
}
/* 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 */
if (LdrEntry->FullDllName.Buffer)
{
/* Free it */
- ExFreePool(LdrEntry->FullDllName.Buffer);
+ ExFreePoolWithTag(LdrEntry->FullDllName.Buffer, TAG_LDR_WSTR);
}
/* Free the entry itself */
/* if (NamePrefix) ExFreePool(PrefixName.Buffer); */
/* Free the name buffer and return status */
- ExFreePoolWithTag(Buffer, 'nLmM');
+ ExFreePoolWithTag(Buffer, TAG_LDR_WSTR);
return Status;
}
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;
MiRemoveNode(MemoryArea->Vad, &Process->VadRoot);
}
- ExFreePool(MemoryArea->Vad);
+ ExFreePoolWithTag(MemoryArea->Vad, TAG_MVAD);
MemoryArea->Vad = NULL;
}
}
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;
/* 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 */
_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;
(AccessMode != KernelMode ||
(AccessMode == KernelMode && CaptureIfKernel)))
{
- ExFreePool(CapturedAcl);
+ ExFreePoolWithTag(CapturedAcl, TAG_ACL);
}
}
_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;
if (*SecurityDescriptor != NULL)
{
- ExFreePool(*SecurityDescriptor);
+ ExFreePoolWithTag(*SecurityDescriptor, TAG_SD);
*SecurityDescriptor = NULL;
}
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
_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;
(AccessMode != KernelMode ||
(AccessMode == KernelMode && CaptureIfKernel)))
{
- ExFreePool(CapturedSid);
+ ExFreePoolWithTag(CapturedSid, TAG_SID);
}
}
AccessToken->UserAndGroups =
(PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
uLength,
- 'uKOT');
+ TAG_TOKEN_USERS);
EndMem = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount];
AccessToken->Privileges =
(PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
uLength,
- 'pKOT');
+ TAG_TOKEN_PRIVILAGES);
for (i = 0; i < AccessToken->PrivilegeCount; i++)
{
AccessToken->DefaultDacl =
(PACL) ExAllocatePoolWithTag(PagedPool,
Token->DefaultDacl->AclSize,
- 'kDOT');
+ TAG_TOKEN_ACL);
memcpy(AccessToken->DefaultDacl,
Token->DefaultDacl,
Token->DefaultDacl->AclSize);
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);
}
AccessToken->UserAndGroups =
(PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
uLength,
- 'uKOT');
+ TAG_TOKEN_USERS);
EndMem = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount];
AccessToken->Privileges =
(PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool,
uLength,
- 'pKOT');
+ TAG_TOKEN_PRIVILAGES);
if (PreviousMode != KernelMode)
{
AccessToken->DefaultDacl =
(PACL) ExAllocatePoolWithTag(PagedPool,
DefaultDacl->AclSize,
- 'kDOT');
+ TAG_TOKEN_ACL);
memcpy(AccessToken->DefaultDacl,
DefaultDacl,
DefaultDacl->AclSize);
/* Free the previous dacl if present */
if(Token->DefaultDacl != NULL)
{
- ExFreePool(Token->DefaultDacl);
+ ExFreePoolWithTag(Token->DefaultDacl, TAG_TOKEN_ACL);
}
/* Set the new dacl */
/* Clear and free the default dacl if present */
if (Token->DefaultDacl != NULL)
{
- ExFreePool(Token->DefaultDacl);
+ ExFreePoolWithTag(Token->DefaultDacl, TAG_TOKEN_ACL);
Token->DefaultDacl = NULL;
}
}
PreviousMode, &hToken);
}
- if (Dacl) ExFreePool(Dacl);
+ if (Dacl) ExFreePoolWithTag(Dacl, TAG_TOKEN_ACL);
if (OpenAsSelf)
{