如何取消延迟的 MoveFileEx 操作?
我使用以下命令在重新启动计算机后删除一些文件:
MoveFileEx(PChar(File_Address), Nil, MOVEFILE_DELAY_UNTIL_REBOOT);
如何取消执行此命令并防止重新启动后删除文件?
I use the below command to delete some files after reboot the machine:
MoveFileEx(PChar(File_Address), Nil, MOVEFILE_DELAY_UNTIL_REBOOT);
How can i cancel execution of this command and prevent files from deleting after reboot?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过这种方式排队删除的文件将放置在注册表中的
HKLM\System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations
下。也许您可以从那里删除条目,以防止文件被删除。我找不到这方面的 API 函数。Files you enqueue for deletion this way are placed in the registry under
HKLM\System\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations
. Perhaps you can delete entries from there, to prevent the files from being deleted. I couldn't find an API function for this.我想您可以复制该文件(因为它尚未被删除),然后
在重新启动期间将其放回原位。
不过,正如肯·怀特(Ken White)指出的那样,最好从一开始就避免这种情况。
I guess you could copy the file (since it hasn't been deleted yet) and then use
to put it back in place during the reboot.
As Ken White has pointed out, though, it would be much much better to avoid this situation in the first place.