如何清除文件内容而不在内核模式下关闭其句柄 [英] How to clear file content without closing its handle in kernel mode
问题描述
您好,我有一个文件,用于在系统运行时保存数据,我希望保存数据但在保存之前,我想删除其旧内容,所以最后我只能拥有最新内容在文件中。出于某种原因,我想在没有关闭文件句柄的情况下实现这一点。
我首先考虑使用 ZwSetInformationFile 将大小设置为0但我记得不建议使用玩文件大小所以我想知道如果你们中的任何人都可以提供任何帮助。
我等待回复。
谢谢。
我尝试过:
我已经厌倦了ZwSetInformationFile,我的意图是更改文件大小,但我不确定是这样做的。
< blockquote>您可以在致电 FILE_OVERWRITE 选项ff566424(v = vs.85).aspx> ZwCreateFile例程(Windows驱动程序) [ ^ ]。
Hello, I have a file that I use to save data when the system is running and I wish to save data to it but before saving, I want to erase its old content so at the end I can only have the latest content in the file. For some reason I would like to achieve that without close the file handle.
I first thought about using ZwSetInformationFile to set the size to 0 but I remember that its not recommended to play with file size so I was wondering If any of you that have been down the path could provide any help.
I awaiting for a response.
Thank you.
What I have tried:
I have already tired ZwSetInformationFile where my intention is to change the file size but I'm not sure that the way to do it.
You can use the FILE_OVERWRITE
option on your call to ZwCreateFile routine (Windows Drivers)[^].
这篇关于如何清除文件内容而不在内核模式下关闭其句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!