Click here to Skip to main content
15,887,867 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
Hi there,

I just looked for a solution on this question several days but didn't find one, could you please give me any suggestion? Thanks a lot!

The background of the question is:
We build a file filter driver for windows. When our security app is running, our driver DECRYPT the file data from disk and ENCRYPT the data when writing back to disk, so the file data on harddisk is always encrypted. Then, user cannot read file without running our app.
Unfortunately, windows has CACHE system. Windows cache gets the decrypted file data whenever our app is running or not. Therefore, if an user opens a file when our app is running, and if another user opens the same file again after quit our app, windows will read the file data from RAM cache instead of from the disk, so this user can read the file data although the file on disk has already been encrypted.

Therefore, I need a way to flush the windows file-read-cache when closing our application. But it looks like quite difficult to find a reasonable way.

Did anyone work on this before? Thanks!

Hanbear
Posted
Updated 10-Mar-11 13:06pm
v3
Comments
Henry Minute 10-Mar-11 11:09am    
Which language are you using? Please alter your tags to indicate this.
hanbear 10-Mar-11 19:08pm    
Updated, thanks!
Dalek Dave 10-Mar-11 19:38pm    
Nice to see people try before resorting to asking! plus 5 for effort

1 solution

This thread[^] has information on reading files without caching. It is in C# but uses the API so would be useable for C++ too.
 
Share this answer
 
Comments
hanbear 10-Mar-11 19:17pm    
Thank you, Henry!
I read that question when I was googling. But it's for reading/writing file by your own app. What I need is to flush windows cache for other applications such as notepad, word, PS...
Dalek Dave 10-Mar-11 19:39pm    
Interesting link, henry.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900