Awesome-Windows-Debug icon indicating copy to clipboard operation
Awesome-Windows-Debug copied to clipboard

[Dev] Windows Kernel - ExAllocatePoolWithTag / ExFreePool

Open nixawk opened this issue 8 years ago • 0 comments

bluescreen

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;

nixawk avatar Sep 05 '17 01:09 nixawk