I am refining a DLL module that acts as a sort of plugin for a Windows application.
This plugin is compatibile with various versions of a single software line. Now, for a certain functionality, I have to access the configuration files of the parent software. Since different versions of the software have these in different places, I have to find out which version loads the DLL. The separate versions are readily discernable by the process executable name (i.e. abc_v1.exe, abc_v2.exe, abc_v3.exe).
Is there a way to get the name of the process that loaded the DLL? I am using C++ with some basic WinAPI commands, but not ATL, MFC or such.
Currently I am polling the parent software by use of it's own SDK functions, but that requires opening a connection. Depending on content of the configuration files, the DLL does not need to open a connection, so I would like to know which version loaded it before having to establish communication.
Process Explorer has a facility that allows you to search through the currently running processes for a specific file. To perform this search go to Find -> Find Handle or DLL... and then enter the name of the file you are interested in. Save this answer. Show activity on this post.
You can retrieve the information by using a program, or by using Windows Explorer as follows: Select the DLL with the right mouse button. Select Properties from the pop-up menu. Select the Version tab.
The DLL. Load method loads a particular dynamic link library in TestComplete and returns a pointer to the library. Later, this pointer can be used to call routines from the dll. Before you load a dll, you should define its type and type of its functions using the DLL.
Running Process ExplorerOn the View menu, make sure Show Lower Pane is checked. Press CTRL+D or select View > Lower Pane View > DLLs to enable DLL view mode.
Call GetModuleFileName
passing NULL
as the module handle. From the documentation:
A handle to the loaded module whose path is being requested. If this parameter is NULL, GetModuleFileName retrieves the path of the executable file of the current process.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With