kernel-moduledevice-driverwindows-kernelwindows-api-code-pack

How to allocate heap in kernel space for an array of fix-sized arrays of characters?


I know that in kernel space one usually uses ExAllocatePoolWithTag function, but I don't know how to allocate memory for a dynamically-sized array of fixed-sized arrays of chars (kind of 2x2 matrix of which the number of lines could dynamically increase).


Solution

  • You can use Lookaside lists for allocating fixed-size buffers (in your case fixed-sized arrays of chars) dynamically.

    You can read more about it on MSDN, the documentation for it is very well written:

    https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-lookaside-lists