Awesome-Windows-Debug
Awesome-Windows-Debug copied to clipboard
[Dev] Windows Kernel - ExAllocatePoolWithTag / ExFreePool
NTSTATUS ntstatus;
UNICODE_STRING dst = {0};
UNICODE_STRING src = RTL_CONSTANT_STRING(L"Allocate Example");
dst.Buffer = (PWCHAR)ExAllocatePoolWithTag(NonPagedPool, src.Length, 'TEST');
if (dst.Buffer == NULL)
{
DbgPrint(".....");
ntstatus = STATUS_INSUFFICIENT_RESOURCES;
}
dst.Length = dst.MaximumLength = src.Length;
RtlCopyUnicodeString(&dst, &src);
ExFreePool(dst.Buffer);
dst.Buffer = NULL;
dst.Length = dst.MaximumLength = 0;