跟踪哪个进程打开了特定文件
在 Windows 的内核模式中,我能够拦截和监视在特定磁盘上执行的几乎所有操作。 当出于任何目的打开文件时,我会收到一个事件。
现在我想追踪哪个应用程序打开了它。 我认为这应该是可能的,但不知道如何。
我正在使用 Windows Win32 API 中的标准文件管理功能。
提前致谢。
/罗伯特
From kernel mode in Windows I'm able to intercept and monitor virtually all actions performed on a particular disk. When a file is opened for any purpose I get an event.
Now I want to trace which application that opened it. I think this should be possible but don't know how.
I'm using the standard file management functions in Windows Win32 API.
Thanks in advance.
/Robert
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Sysinternals Filemon(免费)可以做到这一点,而且更好的是他们描述了如何他们做到了:
-亚当
Sysinternals Filemon (free) does this, and better yet they describe how they did it:
-Adam
Sysinternals 在执行和解释方面做得非常好,旧版本的一些源代码仍然可用 这里,并且代码有详细记录(恕我直言)。 这也可能是一个好的开始。
Sysinternals did a so good job at doing it and explaining it, that some source code of old version are still available here for instance, and the code is well documented (imho). It could be a good start as well.
我会使用 Sysinternals 的“handle.exe”应用程序。
或者,您实际上正在尝试以编程方式执行此操作吗?
I would use the "handle.exe" app from Sysinternals.
Or, are you actually trying to do this programmactically?
只需使用 Win32 N.API 从文件句柄获取 pid。
这是15年来的常见问题解答...
Just use Win32 N.API to get the pid from the File handle.
It's a FAQ for 15 years...