Question about "FltAllocatePoolAlignedWithTag"

Hi,

I am reading the example code “swapBuffer”, in the pre_read, it allocates the memory
with “FltAllocatePoolAlignedWithTag”, I knows that IRP_NOCACHE read has to be sector size aligned.

if I just use “ExAllocatePoolWithTag” to allocate the memory with the aligned sector size, does it cause any problem?

Thanks
Mike

FltAllocatePoolAlignedWithTag guarantees that the *buffer* has the
appropriate alignment, ExAllocatePoolWithTag does not provide any such
guarantee. If you want to use ExAllocatePoolWithTag (why?) you would need to
over-allocate and then align the buffer yourself.

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntfsd…

Hi,

I am reading the example code “swapBuffer”, in the pre_read, it allocates
the memory
with “FltAllocatePoolAlignedWithTag”, I knows that IRP_NOCACHE read has to
be sector size aligned.

if I just use “ExAllocatePoolWithTag” to allocate the memory with the
aligned sector size, does it cause any problem?

Thanks
Mike

ExAllocatePoolWithTag, if called with >= PAGE_SIZE, guarantees that the result is page-aligned.

Also, the maximum possible sector size in Windows is PAGE_SIZE.

So, it can work.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntfsd…
> Hi,
>
> I am reading the example code “swapBuffer”, in the pre_read, it allocates the memory
> with “FltAllocatePoolAlignedWithTag”, I knows that IRP_NOCACHE read has to be sector size aligned.
>
> if I just use “ExAllocatePoolWithTag” to allocate the memory with the aligned sector size, does it cause any problem?
>
> Thanks
> Mike
>