Reading last few odd bytes using FltReadFile in non-cached mode

Will FltReadFile succeed if used in non-cached mode having sector non aligned length while reading the last few bytes before EOF.

Yes. you may (depending on the FSD) need to provide a sector aligned input buffer and rely on the FSD to truncate to EOF.

But… why not just try this with FileTest? Sure it’s not using FltMgr calls, but it all ends up in the same place.

The FltReadFile call doing non cached io is deep down in a module handling encryption of sparse files. And if I specify a sector aligned multiple for length (greater than EOF) to read the last few bytes till EOF, then FltReadFile fails.

What error does it give?
Are you calling FtlReadFile while in a paging I/O path?

Sector aligned input does work, regardless of unaligned output. As long as
input offset is not beyond EOF of course.

The FltReadFile call doing non cached io is deep down in a module handling

So my question is while doing non cached reads with the FltReadFile, the requirements are: 1- Aligned input buffer ( Using. FltAllocatePoolAlignedWithTag) 2 - Sector aligned offset. 3 - Sector aligned length. Now if the file size is not sector aligned, how do we read the last few non aligned bytes till EOF. Can we specify a non sector aligned length for this special case? Because reading past the EOF will a sector aligned buffer length is failing with FltReadFile.

The FltReadFile is in the cached io path.

return status on failure of FltReadFile is (-1073741807) (0x3FFFFFEF)

This enc driver is not using an isolation filter model but is buold up on the SwapBuffers example.

Pardon me for I am incoherent because of lack of sleep. This is a success error status but the BytesRead is returned as Zero in the special case while reading the last few bytes till EOF.

No, this is not a success status, it is 0xC0000011 which is STATUS_END_OF_FILE. Are you certain the byte offset you are providing is before the EoF?

Thanks Pete! I don’t have access to the code right now. Will update you on this later in the day but I am pretty certain that this is the cause. Thanks for helping and also for all your help in a previous life. BR