Calling a DLL from a DLL / LoadLibraryEx
Posted on 1999-01-05
Consider application \a\foo.exe, which loads \b\first.dll via LoadLibraryEx( "\\b\\first", NULL, LOAD_WITH_ALTERED_SEARCH_PATH ). Now, first.dll tries to access \b\second.dll via LoadLibraryEx( "second", NULL, 0 ) or LoadLibraryEx( "second", NULL, LOAD_WITH_ALTERED_SEARCH_PATH )...
both fail. Just what does the ALTERED_SEARCH_PATH flag apply to? MS documentation says it applies to "any associated executable modules that the specified module causes to be loaded." Yes LoadLibrary can't find second.dll -- is there a way around this? Hardcoding the path to second.dll inside first.dll is not an option.