Get DLL Directory

I had a question about how to get the DLL directory on a Windows system.

The situation is as follows:

I have a dll and exe file. The exe file must load the DLL to run. These 2 modules are in different directories. Moreover, the DLL is volatile. Now I need to get the DLL at runtime.

How can i do this?

Thanks in advance.

+3
source share
2 answers

Do you need to find where the DLL loads it or find the path from which it was loaded?

The algorithm for finding the path to the DLL is documented in MSDN, and you can use SearchPath to search for the path to the system.

, DLL, GetModuleFileName. , LoadLibrary, GetModuleHandle, hinstDLL DllMain DLL.

+6

, - . exe , DLL . , LoadLibrary().

BTW, , COM. , DLL- CLSID, .

+2

Source: https://habr.com/ru/post/1740092/


All Articles