Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the altered search path (LOAD_WITH_ALTERED_SEARCH_PATH) in LoadLibraryEx()

Tags:

c++

winapi

The documentation for LoadLibraryEx() doesn't actually explain what the altered search path is. In the table entry for the LOAD_WITH_ALTERED_SEARCH_PATH flag it says "see the Remarks section", but in the Remarks section it only says that this flag causes LoadLibraryEx() to use the altered search path.

But it doesn't explain anywhere what the altered search path actually is.

like image 977
sashoalm Avatar asked Mar 04 '15 08:03

sashoalm


1 Answers

I finally found the explanation, but it was in a page linked to by the LoadLibraryEx() docs - Dynamic-Link Library Search Order.

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.

So standard begins in the *.exe's directory, while the altered begins in the *.dll's directory.

like image 96
sashoalm Avatar answered Sep 21 '22 10:09

sashoalm