Re: windbg有没有什么命令能看文件是被谁持有?

Windows内核调试

windbg有没有什么命令能看文件是被谁持有?


zmsx 2010-02-05, 10:54 上午

在 IRP_MJ_Set_Information 里读要删除的文件时会发现无法复制该文件.

The process cannot access the file because it is being used by another process.

想看看是谁锁住了这个文件。不知道有没有相关的命令。谢谢

Re: windbg有没有什么命令能看文件是被谁持有?


Oak 2010-02-05, 12:40 下午
这个没有,建议用filemonitor sysinternal出的。

Re: windbg有没有什么命令能看文件是被谁持有?


nightxie 2010-02-05, 17:28 下午
直接看irp->thread 再看thread是哪个process的。
这是我删除一个txt时显示的:
kd> !irp 81c77590
Irp is active with 8 stacks 8 is current (= 0x81c776fc)
No Mdl: System buffer=82235bd8: Thread 81dd5db0: Irp stack trace.
.....

kd> !thread -p 81dd5db0 0
PROCESS 81cecbf8 SessionId: 0 Cid: 01c0 Peb: 7ffdc000 ParentCid: 01a8
DirBase: 11829000 ObjectTable: e15a4aa0 HandleCount: 298.
Image: explorer.exe

THREAD 81dd5db0 Cid 01c0.00b4 Teb: 7ffd3000 Win32Thread: e1b81b68 RUNNING on processor 0

这里看到是explorer.exe再删除文件~~~ :D

Re: windbg有没有什么命令能看文件是被谁持有?


zmsx 2010-02-05, 20:27 下午
嗯嗯 好办法。我试试。:)

Re: windbg有没有什么命令能看文件是被谁持有?


王宇 2010-02-06, 04:05 上午

仿照 Process Explorer 实现一份也不复杂的。枚举、搜索句柄表再 ObQueryNameString() 找名字就 OK。如图:



我的:

Powered by Community Server Powered by CnForums.Net