I have a user mode process (written in C++) that needs to write a file to a local hard disk partition
and then verify that the file has been written to the physical media without errors.
Is this doable under Windows? How?
I ask the question in NTDEV because I know that hard disks have their own internal cache, so I
am worried that if I use the following sequence: [ write - flush - read - compare ], then the
read may return (at least some) data from the on-disk cache, and not from the physical media.
In case the physical media has errors, I will not be able to detect the corruption.
I think that if I can purge the on-disk cache then all the required data will be read from the
physical media. But I don't know how to do that.
I am aware that Windows has its own caching as well.