Own FltAllocatePoolAlignedWithTag

Hi,
I’m using non-cached operations on fileobjects and I do not want to use
FltAllocatePoolAlignedWithTag because I have already some buffer allocated
(moreover in some situations I need to copy data from one disk to another).

Allocated buffer is large enough and I’m only aligning it using
copybuffer = (PVOID)ROUND_TO_SIZE(buffer,
…VolumeProperties.AlignmentRequirement);

But since VolumeProperties.AlignmentRequirement is always 1
(FILE_WORD_ALIGNMENT) no alignment is required and I’m unable to test it. I
just wondering what if AlignmentRequirement is 3 (FILE_LONG_ALIGNMENT) or
other values.

So question is: Is this right way to align buffer ? Is this what
FltAllocatePoolAlignedWithTag do? Will it work on if volume require other
alignment ?

Thanks in advance

Jan Milan

For those who will need some day it’s not right way.

It should be
copybuffer = (PVOID)ROUND_TO_SIZE(buffer,
VolumeProperties.AlignmentRequirement + 1);
or
copybuffer = (buffer + AlignmentRequirement) & ~
(PVOID)AlignmentRequirement;

Jan

“Jan Milan” wrote in message news:xxxxx@ntfsd…
> Hi,
> I’m using non-cached operations on fileobjects and I do not want to use
> FltAllocatePoolAlignedWithTag because I have already some buffer allocated
> (moreover in some situations I need to copy data from one disk to
another).
>
> Allocated buffer is large enough and I’m only aligning it using
> copybuffer = (PVOID)ROUND_TO_SIZE(buffer,
> …VolumeProperties.AlignmentRequirement);
>
> But since VolumeProperties.AlignmentRequirement is always 1
> (FILE_WORD_ALIGNMENT) no alignment is required and I’m unable to test it.
I
> just wondering what if AlignmentRequirement is 3 (FILE_LONG_ALIGNMENT) or
> other values.
>
> So question is: Is this right way to align buffer ? Is this what
> FltAllocatePoolAlignedWithTag do? Will it work on if volume require other
> alignment ?
>
> Thanks in advance
>
> Jan Milan
>
>
>