If I do
LoadLibrary(\"MyTest.dll\")
Windows will locate and load it from \"C:\\TestFolder\\Test\\MyTest.dll\"
, because
To load the DLL without running any malicious code inside, use LoadLibraryEx
with the DONT_RESOLVE_DLL_REFERENCES
and LOAD_LIBRARY_AS_DATAFILE
flags.
Then you can use GetModuleFileName
.
You should also read about all the other flags, which allow you to perform all the various searches Windows is capable of.