最近做程序来hook系统(WIN10)的文件删除操作,本以为就是简单的DeleteFile接口,试了下发现并不是,也用API monitor等工具跟踪了也无果,求大神帮忙。
Let's start your job with the NtSetFileInformation (undocumented) function. It's the function called by anything else when a file need to be deleted (with the FileDispositionInformation structure).
Hook这个API试试NtSetFileInformation
shfileoperation
默认是移动文件到回收站。shift+del才是删除文件
其实之这样的,感谢oyljerry的提醒,以新建文件为例CreateFile(APP) --> CreateFileA(kernel32.dll) --> CreateFileW(kernel32.dll) --> NtCreateFile(ntdll.dll) --> NtCreateFile(ntoskrnl.exe),括号内就是不同调用层级,我只Hook App层的操作当然不能成功。