开发者

How to know if a given DLL is loaded by a given process? [duplicate]

开发者 https://www.devze.com 2022-12-08 20:29 出处:网络
This question already has answers here: Closed 13 years ago. Possible Duplicate: How to programmatically get DLL dependencies
This question already has answers here: Closed 13 years ago.

Possible Duplicate:

How to programmatically get DLL dependencies

On Windows, in a C++ program, I want to know if a given DLL (I know the path) is loaded by a 开发者_JAVA百科given external process (I know the path of the exe), using win32 functions. It must be possible to list all DLLs loaded by a process, as process explorer does.

Fabien


First you have get the ID of the Process you are looking for. Use the EnumProcesses function described here to find your desired process. There is a nice example provided to list all processes and their names, that you can use as a starting point.

As the second step you can list all of the modules, that is the DLLs loaded by each process. Use the EnumProcessModules function.

This example does mostly what you want, you only need to add some more check code to filter for your process and your module.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号