Hello Everyone,
I am working on a minifilter driver where I am monitoring all IRP_MJ_CREATE & IRP_MJ_CLEANUP calls (pre & post)
I am using FLT_STREAMHANDLE_CONTEXT, to save some context info for only important calls that I need to monitor.
I have taken care of allocating and freeing required memory using the required functions like:
FltAllocateContext
FltReleaseContext
FltDeleteContext
Context allocation is done in the Post call of create and released in post call of clean up.
There is a que using the following functions:
ExAllocateFromNPagedLookasideList
ExFreeToNPagedLookasideList
The que is created in post cleanup and freed in the workitemroutine.
Also I am using the following functions to allocate local buffer when required:
ExAllocatePoolWithTag
ExFreePoolWithTag
I am allocating like 256 bytes buffer in every call and I make sure its freed at the end of the call.
The ExAllocatePoolWithTag call fails for a few calls. for example if there are 100 calls made may be 5 to 10 calls fail ramdomly.
I am loosing important calls due to this reason.
how can I make sure that the memory allocation never fails? or at least
how can I check if I am allocating too much memory?
The same behavior is on all machines that I am testing on and also all OS 32 & 64.
Thank you!