先看一下微软官方对PendingFileRenameOperations的解释:
Stores the names of files to be renamed when the system restarts.
This entry consists of pairs of file names. The file specified in the first item of the pair is renamed to match the second item of the pair. The system adds this entry to the registry when a user or program tries to rename a file that is in use. The file names are stored in the value of this entry until the system is restarted and they are renamed.
有点英文知识的应该能看懂这个意思,我就不再赘述。
pending的注册表项是HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session Manager下键PendingFileRenameOperations。
movefile工具是用来编辑这个注册表项的。它的下载地址是:http://www.brothersoft.com/movefile-155209.html
movefile的用法是在cmd里切到movefile.exe的目录下下,运行movefile soursefilename destfilename。即可在注册表项里加入两个的文件的绝对路径。例如:
如果当前目录下存在1.txt 2.txt 3.txt 4.txt
输入如下:
movefile 1.txt ""
movefile 2.txt 3.txt
movefile 4.txt 5.txt
重启之后:
发现1.txt被删除,4.txt被改名为5.txt,但是2.txt和3.txt没有改变。由此可以发现当源文件和目的文件都存在的情况下,重启之后不执行重命名操作。如果执行重命名操作将可能会发生文件的覆盖,这种方案可以用于木马病毒等替换系统正常文件,但是经过我的多此测试,没有发生相关的事件。