Check if a dll is loaded in the process space or not

1) First of all make sure, the exe is running for which you need to know if the dll is loaded.
2) Use the windows API:
typedef DWORD ( WINAPI *GETMODULEFILENAMEEX) ( HANDLE, HMODULE, LPTSTR, DWORD );
3) Open the process:
HANDLE myprocess= OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, myProcessID);
Over here you would need to supply the process id of your exe.
4) GETMODULEFILENAMEEX myModuleFn;
5) Iterate through the modules and compare the names to check if your dll is loaded.
6) Use ENUMPROCESSMODULES to iterate through the modules

Leave a Reply

Your email address will not be published. Required fields are marked *