什么 Win32 API 可用于查找打开给定文件的进程? [英] What Win32 API can be used to find the process that has a given file open?

查看:47
本文介绍了什么 Win32 API 可用于查找打开给定文件的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我读取或写入文件并收到 33 或 32 错误,我想记录一条消息,其中包含打开该文件的其他进程的名称.必须有一个 Win32 API 可以用来获取此信息.进程资源管理器显示它.当然,Process Explorer 也有关于内存中所有进程的信息.我更愿意在不询问所有进程的情况下找到罪魁祸首.

If I read or write to a file and receive a 33 or 32 error, I would like to log a message containing the name of the other process(es) that have the file opened. There must be a Win32 API I could use to get this info. Process Explorer displays it. Of course, Process Explorer also has info about all processes in memory. I'd prefer to find the culprit without interrogating all processes.

推荐答案

似乎可以满足您的需求.

This seems to do what you want.

显然它使用了一些隐藏的 API,例如 NtQueryInformationProcess.

obviously it uses some hidden API such as NtQueryInformationProcess.

这篇关于什么 Win32 API 可用于查找打开给定文件的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆