tags:

views:

177

answers:

2

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 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

A: 

I don't know if this will solve your problem, but as i see it will solve, take a look: Determining Whether a DLL or EXE Is a Managed Component

Best Regards.

Nathan Campos
+2  A: 

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.

Frank Bollack