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