Page 1 of 1

Noticed LOAD_WITH_ALTERED_SEARCH_PATH flag in LoadLibraryEx

Posted: Fri Apr 28, 2017 2:08 pm
by hvassbotn
I guess this is a way to avoid loading old DLLs that remain in the applications .exe folder?

FLibHandle := LoadLibraryEx(PChar(LibCefPath), 0, LOAD_WITH_ALTERED_SEARCH_PATH);

https://msdn.microsoft.com/en-us/librar ... s.85).aspx
If lpFileName specifies an absolute path and dwFlags is set to LOAD_WITH_ALTERED_SEARCH_PATH, LoadLibraryEx uses the altered search path. The behavior is undefined when LOAD_WITH_ALTERED_SEARCH_PATHflag is set, and lpFileName specifiies a relative path.
https://msdn.microsoft.com/en-us/librar ... 82586.aspx
Note that the standard search strategy and the alternate search strategy specified by LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH differ in just one way: The standard search begins in the calling application's directory, and the alternate search begins in the directory of the executable module that LoadLibraryEx is loading.

Re: Noticed LOAD_WITH_ALTERED_SEARCH_PATH flag in LoadLibraryEx

Posted: Fri Apr 28, 2017 2:41 pm
by salvadordf
Yes. It's part of the code Yoo sent here :
viewtopic.php?f=8&t=52

It's used to load all CEF binaries in a different directory. You also need to set some GlobalCEFApp properties.