如何通过磁盘上的文件数据刷新文件读取缓存?或者只是刷新文件读取缓存? [英] How to refresh the file-read-cache by file data on disk? Or just flush the file-read-cache?

查看:355
本文介绍了如何通过磁盘上的文件数据刷新文件读取缓存?或者只是刷新文件读取缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我几天来一直在寻找解决方案,但没有找到解决办法,请给我任何建议吗?非常感谢!

问题的背景是:
我们为Windows构建文件过滤器驱动程序.当我们的安全应用程序运行时,我们的驱动程序会解密磁盘中的文件数据,并在回写磁盘时加密该数据,因此硬盘上的文件数据始终是加密的.然后,用户无法在不运行我们的应用程序的情况下读取文件.
不幸的是,窗户有CACHE系统.无论我们的应用程序是否运行,Windows缓存都会获取解密的文件数据.因此,如果用户在运行我们的应用程序时打开文件,并且如果另一个用户在退出我们的应用程序后再次打开同一文件,则Windows将从RAM缓存而不是从磁盘读取文件数据,因此该用户可以读取文件尽管磁盘上的文件已被加密,但仍保留数据.

因此,我需要一种在关闭应用程序时刷新Windows文件读取缓存的方法.但是,似乎很难找到一种合理的方法.

有人做过这个吗?谢谢!

Hanbear

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

推荐答案

^ ]包含有关在不进行缓存的情况下读取文件的信息.它在C#中,但是使用API​​,因此也可以用于C ++.
This thread[^] has information on reading files without caching. It is in C# but uses the API so would be useable for C++ too.


这篇关于如何通过磁盘上的文件数据刷新文件读取缓存?或者只是刷新文件读取缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆