if (!Kcb->PrivateAlloc)
{
/* Free it from the pool */
- ExFreePool(Kcb);
+ ExFreePoolWithTag(Kcb, TAG_CM);
return;
}
}
/* Free the page */
- ExFreePool(AllocPage);
+ ExFreePoolWithTag(AllocPage, TAG_CM);
}
/* Release the lock */
}
/* Now free the page */
- ExFreePool(AllocPage);
+ ExFreePoolWithTag(AllocPage, TAG_CM);
}
/* Release the lock */
}
/* Close our handle, free the buffer and return status */
- ExFreePool(CmpConfigurationData);
+ ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
NtClose(KeyHandle);
return Status;
}
if (!NT_SUCCESS(Status)) KeBugCheckEx(REGISTRY_ERROR, 11, 8, Status, 0);
/* Free the SIDs and original ACL */
- for (i = 0; i < 4; i++) ExFreePool(Sid[i]);
- ExFreePool(Acl);
+ for (i = 0; i < 4; i++) ExFreePoolWithTag(Sid[i], TAG_CM);
+ ExFreePoolWithTag(Acl, TAG_CM);
/* Return the security descriptor */
return SecurityDescriptor;
SecurityDescriptor);
/* Free the security descriptor */
- ExFreePool(SecurityDescriptor);
+ ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
if (!NT_SUCCESS(Status)) return FALSE;
/* Add the hive to the hive list */
0,
0,
(PVOID*)&RootKey);
- ExFreePool(SecurityDescriptor);
+ ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
if (!NT_SUCCESS(Status)) return FALSE;
/* Sanity check, and get the key cell */
if (!NT_SUCCESS(Status))
{
/* Fail */
- ExFreePool(ValueInfo);
+ ExFreePoolWithTag(ValueInfo, TAG_CM);
return Status;
}
ValueInfo->Data,
ValueInfo->DataLength);
ConfigPath[ValueInfo->DataLength / sizeof(WCHAR)] = UNICODE_NULL;
- ExFreePool(ValueInfo);
+ ExFreePoolWithTag(ValueInfo, TAG_CM);
}
else
{
}
/* Get rid of the SD */
- ExFreePool(SecurityDescriptor);
+ ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
/* FIXME: Link SECURITY to SAM */
/* FIXME: Add to HiveList key */
/* Free the security descriptor */
- ExFreePool(SecurityDescriptor);
+ ExFreePoolWithTag(SecurityDescriptor, TAG_CM);
/* Fill out the Hardware key with the ARC Data from the Loader */
Status = CmpInitializeHardwareConfiguration(KeLoaderBlock);
}
/* Free the load options */
- ExFreePool(CmpLoadOptions.Buffer);
+ ExFreePoolWithTag(CmpLoadOptions.Buffer, TAG_CM);
/* If we got here, all went well */
return TRUE;
}
/* Free the configuration data */
- ExFreePool(CmpConfigurationData);
+ ExFreePoolWithTag(CmpConfigurationData, TAG_CM);
}
/* Open physical memory */
ZwClose(SectionHandle);
/* Free the BIOS version string buffer */
- if (BiosVersion) ExFreePool(BiosVersion);
+ if (BiosVersion) ExFreePoolWithTag(BiosVersion, TAG_CM);
Quickie:
/* Close the procesor handle */
RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize);
/* Free the previously allocated buffer and set the new location */
- ExFreePool(ExpNlsTableBase);
+ ExFreePoolWithTag(ExpNlsTableBase, TAG('R', 't', 'l', 'i'));
ExpNlsTableBase = SectionBase;
/* Initialize the NLS Tables */
if (!Irp)
{
/* Fail, free the event */
- ExFreePool(Event);
+ ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
return STATUS_INSUFFICIENT_RESOURCES;
}
if (!Irp)
{
/* Fail, free the event */
- ExFreePool(Event);
+ ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
return STATUS_INSUFFICIENT_RESOURCES;
}
}
/* Free the event and return the Status */
- ExFreePool(Event);
+ ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
return Status;
}
Cleanup:
/* Free all the pointers */
- if (Event) ExFreePool(Event);
+ if (Event) ExFreePoolWithTag(Event, TAG_FILE_SYSTEM);
if (IoStatusBlock) ExFreePool(IoStatusBlock);
if (DiskGeometry) ExFreePool(DiskGeometry);
return;
if (!Irp)
{
/* Failed */
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
return;
}
if (((PUSHORT)Buffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE)
{
/* Failed */
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
return;
}
if (PartitionDescriptor->PartitionType != MbrTypeIdentifier)
{
/* It's not, free our buffer */
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
}
else
{
Status = HalpGetFullGeometry(DeviceObject, &DiskGeometry, &MaxOffset);
if (!NT_SUCCESS(Status))
{
- ExFreePool(*PartitionBuffer);
+ ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
*PartitionBuffer = NULL;
return Status;
}
if (!Buffer)
{
/* Fail, free the input buffer */
- ExFreePool(*PartitionBuffer);
+ ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
+ *PartitionBuffer = NULL;
return STATUS_INSUFFICIENT_RESOURCES;
}
BufferSize);
/* Free the old buffer and set this one as the new one */
- ExFreePool(*PartitionBuffer);
+ ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
*PartitionBuffer = DriveLayoutInfo;
/* Double the size */
if (!i) (*PartitionBuffer)->Signature = 0;
/* Free the buffer and check for success */
- if (Buffer) ExFreePool(Buffer);
- if (!NT_SUCCESS(Status)) ExFreePool(*PartitionBuffer);
+ if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
+ if (!NT_SUCCESS(Status)) ExFreePoolWithTag(*PartitionBuffer, TAG_FILE_SYSTEM);
/* Return status */
return Status;
}
/* If we had a buffer, free it, then return status */
- if (Buffer) ExFreePool(Buffer);
+ if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM);
return Status;
}
if (!NT_SUCCESS(Status))
{
/* Try again */
- ExFreePool(PartitionBuffer);
- ExFreePool(DriveLayout);
+ ExFreePoolWithTag(PartitionBuffer, TAG_IO);
+ ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
return FALSE;
}
*PartitionCount = DriveLayout->PartitionCount;
/* Free the buffer */
- ExFreePool(PartitionBuffer);
- ExFreePool(DriveLayout);
+ ExFreePoolWithTag(PartitionBuffer, TAG_IO);
+ ExFreePoolWithTag(DriveLayout, TAG_FILE_SYSTEM);
return TRUE;
}
}
/* Free the buffer */
- ExFreePool(PartitionBuffer);
+ ExFreePoolWithTag(PartitionBuffer, TAG_IO);
}
/* Return success */
}
/* Free the shutdown entry and reset the event */
- ExFreePool(ShutdownEntry);
+ ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
KeClearEvent(&Event);
/* Go to the next entry */
if (DeviceObject->SecurityDescriptor)
{
/* Free it */
- ExFreePool(DeviceObject->SecurityDescriptor);
+ ExFreePoolWithTag(DeviceObject->SecurityDescriptor, TAG_SD);
}
/* Remove the device from the list */
NextEntry = NextEntry->Blink;
/* Free the entry */
- ExFreePool(ShutdownEntry);
+ ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
}
/* Go to the next entry */
NextEntry = NextEntry->Blink;
/* Free the entry */
- ExFreePool(ShutdownEntry);
+ ExFreePoolWithTag(ShutdownEntry, TAG_SHUTDOWN_ENTRY);
}
/* Go to the next entry */
POBJECT_TYPE IoDriverObjectType = NULL;
+#define TAG_RTLREGISTRY TAG('R', 'q', 'r', 'v')
+
extern BOOLEAN ExpInTextModeSetup;
/* PRIVATE FUNCTIONS **********************************************************/
RtlAppendUnicodeStringToString(ImagePath, &InputImagePath);
/* Free caller's string */
- RtlFreeUnicodeString(&InputImagePath);
+ ExFreePoolWithTag(InputImagePath.Buffer, TAG_RTLREGISTRY);
}
return STATUS_SUCCESS;
/* BOOLEAN ServiceRunning;*/ // needed ??
} SERVICE, *PSERVICE;
+#define TAG_RTLREGISTRY TAG('R', 'q', 'r', 'v')
+
/* GLOBALS ********************************************************************/
LIST_ENTRY GroupListHead = {NULL, NULL};
*/
if (Service->ServiceGroup.Buffer)
{
- ExFreePool(Service->ServiceGroup.Buffer);
+ ExFreePoolWithTag(Service->ServiceGroup.Buffer, TAG_RTLREGISTRY);
}
if (Service->ImagePath.Buffer)
{
- ExFreePool(Service->ImagePath.Buffer);
+ ExFreePoolWithTag(Service->ImagePath.Buffer, TAG_RTLREGISTRY);
}
ExFreePool(Service);
return(Status);
/* Clear the file name */
if (FileObject->FileName.Buffer)
{
- ExFreePool(FileObject->FileName.Buffer);
+ ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME);
FileObject->FileName.Buffer = NULL;
}
{
/* Clear it in the IRP for completion */
Irp->UserEvent = NULL;
- ExFreePool(Event);
+ ExFreePoolWithTag(Event, TAG_IO);
}
/* Set the caller IOSB */
if (!NT_SUCCESS(Status))
{
if (ControllerFullInformation != NULL)
- ExFreePool(ControllerFullInformation);
+ ExFreePoolWithTag(ControllerFullInformation, TAG_IO_RESOURCE);
return Status;
}
MaximumControllerNumber = ControllerFullInformation->SubKeys;
/* Free Memory */
- ExFreePool(ControllerFullInformation);
+ ExFreePoolWithTag(ControllerFullInformation, TAG_IO_RESOURCE);
ControllerFullInformation = NULL;
}
MaximumPeripheralNumber = PeripheralFullInformation->SubKeys;
/* Free Memory */
- ExFreePool(PeripheralFullInformation);
+ ExFreePoolWithTag(PeripheralFullInformation, TAG_IO_RESOURCE);
PeripheralFullInformation = NULL;
}
{
if (PeripheralInformation[PeripheralLoop])
{
- ExFreePool(PeripheralInformation[PeripheralLoop]);
+ ExFreePoolWithTag(PeripheralInformation[PeripheralLoop], TAG_IO_RESOURCE);
PeripheralInformation[PeripheralLoop] = NULL;
}
}
{
if (ControllerInformation[ControllerLoop])
{
- ExFreePool(ControllerInformation[ControllerLoop]);
+ ExFreePoolWithTag(ControllerInformation[ControllerLoop], TAG_IO_RESOURCE);
ControllerInformation[ControllerLoop] = NULL;
}
}
}
/* Deallocate the old Buffer */
- ExFreePool(FullInformation);
+ ExFreePoolWithTag(FullInformation, TAG_IO_RESOURCE);
/* Try to find a Bus */
for (BusLoop = 0; NT_SUCCESS(Status); BusLoop++)
{
if (BusInformation[SubBusLoop])
{
- ExFreePool(BusInformation[SubBusLoop]);
+ ExFreePoolWithTag(BusInformation[SubBusLoop], TAG_IO_RESOURCE);
BusInformation[SubBusLoop] = NULL;
}
}
/* Free the last remaining Allocated Memory */
if (BasicInformation)
- ExFreePool(BasicInformation);
+ ExFreePoolWithTag(BasicInformation, TAG_IO_RESOURCE);
return Status;
}
}
/* Free Memory */
- ExFreePool(RootRegKey.Buffer);
+ ExFreePoolWithTag(RootRegKey.Buffer, TAG_IO_RESOURCE);
return Status;
}
if (!(Irp->AllocationFlags & IRP_ALLOCATED_FIXED_SIZE))
{
/* Free it */
- ExFreePool(Irp);
+ ExFreePoolWithTag(Irp, TAG_IRP);
}
else
{
{
/* All lists failed, use the pool */
List->L.FreeMisses++;
- ExFreePool(Irp);
+ ExFreePoolWithTag(Irp, TAG_IRP);
Irp = NULL;
}
}
if (!NT_SUCCESS(Status))
{
/* Failed, free memory */
- ExFreePool(ObjectNameInfo);
+ ExFreePoolWithTag(ObjectNameInfo, TAG('M', 'm', ' ', ' '));
return Status;
}
}
else
{
- ExFreePool(Buffer);
+ ExFreePoolWithTag(Buffer, TAG('M', 'm', 'X', 'r'));
}
return Status;
break;
}
- ExFreePool(FileHeaderBuffer);
+ ExFreePoolWithTag(FileHeaderBuffer, TAG('M', 'm', 'X', 'r'));
/*
* No loader handled the format
{
CurrentEntry = RemoveHeadList(RegionListHead);
CurrentRegion = CONTAINING_RECORD(CurrentEntry, MM_REGION, RegionListEntry);
- ExFreePool(CurrentRegion);
+ ExFreePoolWithTag(CurrentRegion, TAG_MM_REGION);
}
if (Section->AllocationAttributes & SEC_PHYSICALMEMORY)
&MissingForwarder);\r
\r
/* Free the forwarder name and set the thunk */\r
- ExFreePool(ForwardName);\r
+ ExFreePoolWithTag(ForwardName, TAG_LDR_WSTR);\r
Address->u1 = ForwardThunk.u1;\r
break;\r
}\r
{\r
/* Failed */\r
MiDereferenceImports(LoadedImports);\r
- if (LoadedImports) ExFreePool(LoadedImports);\r
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);\r
return Status;\r
}\r
\r
/* Cleanup and return */\r
RtlFreeUnicodeString(&NameString);\r
MiDereferenceImports(LoadedImports);\r
- if (LoadedImports) ExFreePool(LoadedImports);\r
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);\r
return Status;\r
}\r
\r
{\r
/* Cleanup and return */\r
MiDereferenceImports(LoadedImports);\r
- if (LoadedImports) ExFreePool(LoadedImports);\r
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);\r
return STATUS_DRIVER_ENTRYPOINT_NOT_FOUND;\r
}\r
\r
{\r
/* Cleanup and return */\r
MiDereferenceImports(LoadedImports);\r
- if (LoadedImports) ExFreePool(LoadedImports);\r
+ if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);\r
return Status;\r
}\r
\r
if (!ImportCount)\r
{\r
/* Free the list and set it to no imports */\r
- ExFreePool(LoadedImports);\r
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);\r
LoadedImports = (PVOID)-2;\r
}\r
else if (ImportCount == 1)\r
{\r
/* Just one entry, we can free the table and only use our entry */\r
- ExFreePool(LoadedImports);\r
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);\r
LoadedImports = (PLOAD_IMPORTS)ImportEntry;\r
}\r
else if (ImportCount != LoadedImports->Count)\r
}\r
\r
/* Free the old copy */\r
- ExFreePool(LoadedImports);\r
+ ExFreePoolWithTag(LoadedImports, TAG_LDR_WSTR);\r
LoadedImports = NewImports;\r
}\r
}\r
}\r
\r
/* Free the entry itself */\r
- ExFreePool(LdrEntry);\r
+ ExFreePoolWithTag(LdrEntry, TAG_MODULE_OBJECT);\r
LdrEntry = NULL;\r
goto Quickie;\r
}\r
if (NamePrefix) ExFreePool(PrefixName.Buffer);\r
\r
/* Free the name buffer and return status */\r
- ExFreePool(Buffer);\r
+ ExFreePoolWithTag(Buffer, TAG_LDR_WSTR);\r
return Status;\r
}\r
\r
CurrentEntry->ChainLink = NULL;
/* Free it */
- ExFreePool(CurrentEntry);
+ ExFreePoolWithTag(CurrentEntry, OB_DIR_TAG);
/* Return */
return TRUE;
if (!NT_SUCCESS(Status))
{
/* Free the buffer and fail */
- ExFreePool(LocalBuffer);
+ ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
return Status;
}
/* Dereference the directory and free our buffer */
ObDereferenceObject(Directory);
- ExFreePool(LocalBuffer);
+ ExFreePoolWithTag(LocalBuffer, OB_NAME_TAG);
/* Return status to caller */
return Status;
else
{
/* Otherwise we had a DB, free it */
- ExFreePool(OldHandleDatabase);
+ ExFreePoolWithTag(OldHandleDatabase, TAG_OB_HANDLE);
}
/* Find the end of the copy and zero out the new data */
if (!NT_SUCCESS(Status))
{
/* Fail */
- ExFreePool(TempBuffer);
+ ExFreePoolWithTag(TempBuffer, TAG_OB_TEMP_STORAGE);
return Status;
}
/* Release the object attributes and temporary buffer */
ObpReleaseObjectCreateInformation(&TempBuffer->ObjectCreateInfo);
if (ObjectName.Buffer) ObpFreeObjectNameBuffer(&ObjectName);
- ExFreePool(TempBuffer);
+ ExFreePoolWithTag(TempBuffer, TAG_OB_TEMP_STORAGE);
/* Return status */
OBTRACE(OB_HANDLE_DEBUG,
if (ObjectNameInfo->Name.Buffer)
{
/* Free it */
- ExFreePool(ObjectNameInfo->Name.Buffer);
+ ExFreePoolWithTag(ObjectNameInfo->Name.Buffer, OB_NAME_TAG );
}
/* Write new one */
if (NT_SUCCESS(Status))
{
/* Free the old copy */
- ExFreePool(SecurityDescriptor);
+ ExFreePoolWithTag(SecurityDescriptor, TAG_SD);
/* Set the new pointer */
ASSERT(NewSd);
if (!NT_SUCCESS(Status))
{
/* Free the descriptor and tell the caller we failed */
- ExFreePool(*SecurityDescriptor);
+ ExFreePoolWithTag(*SecurityDescriptor, TAG_SEC_QUERY);
*MemoryAllocated = FALSE;
}
}
/* Free wait block array */
- if (WaitBlockArray) ExFreePool(WaitBlockArray);
+ if (WaitBlockArray) ExFreePoolWithTag(WaitBlockArray, TAG_WAIT);
/* Re-enable APCs if needed */
if (LockInUse) KeLeaveCriticalRegion();
#define NDEBUG
#include <debug.h>
+#define TAG_ATMT TAG('A', 't', 'o', 'T') /* Atom table */
+
extern ULONG NtGlobalFlag;
typedef struct _RTL_RANGE_ENTRY
PRTL_ATOM_TABLE_ENTRY
RtlpAllocAtomTableEntry(ULONG Size)
{
- PRTL_ATOM_TABLE_ENTRY Entry = ExAllocatePool(NonPagedPool,
- Size);
- if (Entry != NULL)
- {
- RtlZeroMemory(Entry,
- Size);
- }
+ PRTL_ATOM_TABLE_ENTRY Entry;
- return Entry;
+ Entry = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_ATMT);
+ if (Entry != NULL)
+ {
+ RtlZeroMemory(Entry, Size);
+ }
+
+ return Entry;
}
VOID
RtlpFreeAtomTableEntry(PRTL_ATOM_TABLE_ENTRY Entry)
{
- ExFreePool(Entry);
+ ExFreePoolWithTag(Entry, TAG_ATMT);
}
VOID
/* allocate enough memory to store a complete copy of a self-relative
security descriptor */
- NewDescriptor = ExAllocatePool(PoolType,
- DescriptorSize);
+ NewDescriptor = ExAllocatePoolWithTag(PoolType,
+ DescriptorSize,
+ TAG_SD);
if(NewDescriptor != NULL)
{
ULONG_PTR Offset = sizeof(SECURITY_DESCRIPTOR);
(CurrentMode == KernelMode && CaptureIfKernelMode)))
{
/* only delete the descriptor when SeCaptureSecurityDescriptor() allocated one! */
- ExFreePool(CapturedSecurityDescriptor);
+ ExFreePoolWithTag(CapturedSecurityDescriptor, TAG_SD);
}
return STATUS_SUCCESS;
DaclLength,
SaclLength);
- Descriptor = ExAllocatePool(PagedPool,
- Length);
+ Descriptor = ExAllocatePoolWithTag(PagedPool,
+ Length,
+ TAG_SD);
if (Descriptor == NULL)
{
DPRINT1("ExAlloctePool() failed\n");