diff --git a/reactos/ntoskrnl/cm/regobj.c b/reactos/ntoskrnl/cm/regobj.c index 4a5ffa8bc04..79d5016f2b1 100644 --- a/reactos/ntoskrnl/cm/regobj.c +++ b/reactos/ntoskrnl/cm/regobj.c @@ -91,7 +91,7 @@ CmiObjectParse(PVOID ParsedObject, { ExReleaseResourceLite(&CmiRegistryLock); KeLeaveCriticalRegion(); - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return Status; } if (FoundObject == NULL) @@ -107,7 +107,7 @@ CmiObjectParse(PVOID ParsedObject, { ExReleaseResourceLite(&CmiRegistryLock); KeLeaveCriticalRegion(); - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_UNSUCCESSFUL); } @@ -140,7 +140,7 @@ CmiObjectParse(PVOID ParsedObject, wcscat(TargetPath.Buffer, EndPtr); } - RtlFreeUnicodeString(FullPath); + ExFreePool(FullPath->Buffer); RtlFreeUnicodeString(&LinkPath); FullPath->Length = TargetPath.Length; FullPath->MaximumLength = TargetPath.MaximumLength; @@ -153,7 +153,7 @@ CmiObjectParse(PVOID ParsedObject, *NextObject = NULL; - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_REPARSE); } } @@ -173,7 +173,7 @@ CmiObjectParse(PVOID ParsedObject, { ExReleaseResourceLite(&CmiRegistryLock); KeLeaveCriticalRegion(); - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(Status); } /* Add the keep-alive reference */ @@ -224,8 +224,8 @@ CmiObjectParse(PVOID ParsedObject, wcscat(TargetPath.Buffer, EndPtr); } - RtlFreeUnicodeString(FullPath); - RtlFreeUnicodeString(&LinkPath); + ExFreePool(FullPath->Buffer); + ExFreePool(LinkPath.Buffer); FullPath->Length = TargetPath.Length; FullPath->MaximumLength = TargetPath.MaximumLength; FullPath->Buffer = TargetPath.Buffer; @@ -237,7 +237,7 @@ CmiObjectParse(PVOID ParsedObject, *NextObject = NULL; - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_REPARSE); } } @@ -258,7 +258,7 @@ CmiObjectParse(PVOID ParsedObject, *NextObject = FoundObject; - RtlFreeUnicodeString(&KeyName); + ExFreePool(KeyName.Buffer); return(STATUS_SUCCESS); } diff --git a/reactos/ntoskrnl/io/device.c b/reactos/ntoskrnl/io/device.c index 91fff63714a..17554f23704 100644 --- a/reactos/ntoskrnl/io/device.c +++ b/reactos/ntoskrnl/io/device.c @@ -18,6 +18,7 @@ #define TAG_DEVICE_EXTENSION TAG('D', 'E', 'X', 'T') #define TAG_SHUTDOWN_ENTRY TAG('S', 'H', 'U', 'T') +#define TAG_IO_TIMER TAG('I', 'O', 'T', 'M') static ULONG IopDeviceObjectNumber = 0; @@ -589,7 +590,7 @@ IoDeleteDevice(PDEVICE_OBJECT DeviceObject) if (DeviceObject->Timer) { IopRemoveTimerFromTimerList(DeviceObject->Timer); - ExFreePool(DeviceObject->Timer); + ExFreePoolWithTag(DeviceObject->Timer, TAG_IO_TIMER); } /* Remove device from driver device list */ diff --git a/reactos/ntoskrnl/io/irp.c b/reactos/ntoskrnl/io/irp.c index 644eefa6d4e..91813e67376 100644 --- a/reactos/ntoskrnl/io/irp.c +++ b/reactos/ntoskrnl/io/irp.c @@ -871,7 +871,7 @@ STDCALL IoFreeIrp(PIRP Irp) { /* Free the pool memory associated with it */ - ExFreePool(Irp); + ExFreePoolWithTag(Irp, TAG_IRP); } /* @@ -1253,7 +1253,7 @@ IoSecondStageCompletion(PKAPC Apc, /* Also check if we should de-allocate it */ if (Irp->Flags & IRP_DEALLOCATE_BUFFER) { - ExFreePool(Irp->AssociatedIrp.SystemBuffer); + ExFreePoolWithTag(Irp->AssociatedIrp.SystemBuffer, TAG_SYS_BUF); } } diff --git a/reactos/ntoskrnl/io/mdl.c b/reactos/ntoskrnl/io/mdl.c index b4b423f3560..b5319ab7202 100644 --- a/reactos/ntoskrnl/io/mdl.c +++ b/reactos/ntoskrnl/io/mdl.c @@ -132,7 +132,7 @@ IoFreeMdl(PMDL Mdl) MmPrepareMdlForReuse(Mdl); - ExFreePool(Mdl); + ExFreePoolWithTag(Mdl, TAG_MDL); } diff --git a/reactos/ntoskrnl/mm/marea.c b/reactos/ntoskrnl/mm/marea.c index c56f4878526..282dfd7c548 100644 --- a/reactos/ntoskrnl/mm/marea.c +++ b/reactos/ntoskrnl/mm/marea.c @@ -812,7 +812,7 @@ MmFreeMemoryArea( } } - ExFreePool(MemoryArea); + ExFreePoolWithTag(MemoryArea, TAG_MAREA); DPRINT("MmFreeMemoryAreaByNode() succeeded\n"); diff --git a/reactos/ntoskrnl/mm/mdl.c b/reactos/ntoskrnl/mm/mdl.c index 7f24286de1c..e51234f721f 100644 --- a/reactos/ntoskrnl/mm/mdl.c +++ b/reactos/ntoskrnl/mm/mdl.c @@ -16,7 +16,7 @@ /* GLOBALS *******************************************************************/ -#define TAG_MDL TAG('M', 'M', 'D', 'L') +#define TAG_MDL TAG('M', 'D', 'L', ' ') #define MI_MDL_MAPPING_REGION_SIZE (256*1024*1024) diff --git a/reactos/ntoskrnl/mm/npool.c b/reactos/ntoskrnl/mm/npool.c index fc92e770adb..cf60a883e9a 100644 --- a/reactos/ntoskrnl/mm/npool.c +++ b/reactos/ntoskrnl/mm/npool.c @@ -1458,6 +1458,28 @@ static BLOCK_HDR* get_block(unsigned int size, unsigned long alignment) #endif /* not WHOLE_PAGE_ALLOCATIONS */ +ULONG STDCALL +ExRosQueryNonPagedPoolTag ( PVOID Addr ) +{ +#ifdef WHOLE_PAGE_ALLOCATIONS /* WHOLE_PAGE_ALLOCATIONS */ + + UNIMPLEMENTED; + return 0; + +#else /* not WHOLE_PAGE_ALLOCATIONS */ + + BLOCK_HDR* blk=address_to_block(Addr); + + if (blk->Magic != BLOCK_HDR_USED_MAGIC) + KEBUGCHECK(0); + if (blk->Magic == BLOCK_HDR_FREE_MAGIC) + KEBUGCHECK(0); + + return blk->Used.Tag; + +#endif /* WHOLE_PAGE_ALLOCATIONS */ +} + VOID STDCALL ExFreeNonPagedPool (PVOID block) /* * FUNCTION: Releases previously allocated memory diff --git a/reactos/ntoskrnl/ntoskrnl.mc b/reactos/ntoskrnl/ntoskrnl.mc index 4fcbae9dda8..dbc250ffd1e 100644 --- a/reactos/ntoskrnl/ntoskrnl.mc +++ b/reactos/ntoskrnl/ntoskrnl.mc @@ -987,6 +987,14 @@ Language=English INVALID_WORK_QUEUE_ITEM . +MessageId=0xC2 +Severity=Success +Facility=System +SymbolicName=BAD_POOL_CALLER +Language=English +BAD_POOL_CALLER +. + MessageId=0xE1 Severity=Success Facility=System diff --git a/reactos/ntoskrnl/ob/object.c b/reactos/ntoskrnl/ob/object.c index 99a6d5d32b4..dfc455f4b89 100644 --- a/reactos/ntoskrnl/ob/object.c +++ b/reactos/ntoskrnl/ob/object.c @@ -507,7 +507,7 @@ ObFindObject(POBJECT_ATTRIBUTES ObjectAttributes, if (current) RtlpCreateUnicodeString (RemainingPath, current, NonPagedPool); - RtlFreeUnicodeString (&PathString); + ExFreePool(PathString.Buffer); *ReturnedObject = CurrentObject; return STATUS_SUCCESS; @@ -806,7 +806,7 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL, } RtlFreeUnicodeString(&Header->Name); RtlFreeUnicodeString(&RemainingPath); - ExFreePool(Header); + ExFreePoolWithTag(Header, Header->ObjectType->Tag); DPRINT("Create Failed\n"); return Status; } @@ -1000,7 +1000,7 @@ ObpDeleteObject(POBJECT_HEADER Header) } DPRINT("ObPerformRetentionChecks() = Freeing object\n"); - ExFreePool(Header); + ExFreePoolWithTag(Header, Header->ObjectType->Tag); return(STATUS_SUCCESS); } @@ -1010,16 +1010,14 @@ VOID STDCALL ObpDeleteObjectWorkRoutine (IN PVOID Parameter) { PRETENTION_CHECK_PARAMS Params = (PRETENTION_CHECK_PARAMS)Parameter; - /* ULONG Tag; */ /* See below */ + ULONG Tag; ASSERT(Params); ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL); /* We need PAGED_CODE somewhere... */ - /* Turn this on when we have ExFreePoolWithTag - Tag = Params->ObjectHeader->ObjectType->Tag; */ + Tag = Params->ObjectHeader->ObjectType->Tag; ObpDeleteObject(Params->ObjectHeader); - ExFreePool(Params); - /* ExFreePoolWithTag(Params, Tag); */ + ExFreePoolWithTag(Params, Tag); }