SwapBuffers example issue

Hi

I created a filter driver based on swapBuffers example, I will swap the buffer in the pre-paging and NonCache IO write.

and pass the buffer pointer to the completionContext, release the buffer in the post write.

it works good in Windows 2012, but in Windows 10, I find out some files were written with
NULL data which it is not NULL in pre-write when I check the buffer, but the buffer in post-write is NULL data.

this happens when I copy a batch files, for example 30 files, it always has one or two files have issue, the small files( less than 1mb) don’t have issue, the file has issue is 62MB, if only copy the file one by one, it can’t see this issue either.

anyone has idea what’s going on with this?

Thanks
Ben

Can you describe us this scenario better.
Where do you see your buffer in pre-write ?
What flags are there set ? ( irp flags )
Where is the buffer in post-write you are checking for ?
I believe there are some cases that you are just missing or treating improperly. I think the Flags will be your friends here. See how these requests are different from the others flag-wise.
Keep a file-spy opened as well if you find it difficult to debug or keep track with a debugger and let us know.