please review my code:
EXTERN_C
NTSTATUS
DriverEntry(
__in PDRIVER_OBJECT DriverObject,
__in PUNICODE_STRING
)
{
DriverObject->DriverUnload = MyUnload;
LOOKASIDE_LIST_EX lal = {};
PVOID pData = nullptr;
struct MY_TEST
{
UCHAR a[100];
};
if (NT_SUCCESS(ExInitializeLookasideListEx(&lal, nullptr, nullptr, PagedPool, 0, sizeof(MY_TEST), '2222', 0)))
{
// 1
pData = ExAllocateFromLookasideListEx(&lal);
if (pData)
{
KdPrint(("[LAL] allocated ok\n"));
}
// 2
pData = ExAllocateFromLookasideListEx(&lal);
if (pData)
{
KdPrint(("[LAL] allocated ok\n"));
}
// 3
pData = ExAllocateFromLookasideListEx(&lal);
if (pData)
{
KdPrint(("[LAL] allocated ok\n"));
}
ExDeleteLookasideListEx(&lal); // free all allocated buffers?
}
else
{
KdPrint(("[LAL] init fail\n"));
}
return STATUS_SUCCESS;
}
inside ExDeleteLookasideListEx:
i saw that ExDeleteLookasideListEx call free routine callback at the end, but it actually do not free anything:
does programmer must free by their own or i misunderstanding something?
pls explain, thank you so much.