[vlc-devel] [PATCH 3/3] [RFC] core: win32: use the altered search path to load modules

Steve Lhomme robux4 at gmail.com
Fri Mar 10 10:34:40 CET 2017


Discard this patch.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).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.

We only need LOAD_LIBRARY_SEARCH_SYSTEM32. For the loaded module the
path is known. For other loaded libraries we should only allow to
lookup in System32. libvlccore is already in memory so it shouldn't
try to load it. At least that's how I interpret the fact that it's
working fine when I try with only LOAD_LIBRARY_SEARCH_SYSTEM32.

On Fri, Mar 10, 2017 at 9:52 AM, Steve Lhomme <robux4 at videolabs.io> wrote:
> The modules are always loaded with an absolute path. And on startup we already
> set the DefaultDllDirectories to LOAD_LIBRARY_SEARCH_SYSTEM32. So we should not
> need anything else to load modules properly with their system libraries.
> ---
>  src/win32/specific.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/win32/specific.c b/src/win32/specific.c
> index a39fae7251..5357d01d15 100644
> --- a/src/win32/specific.c
> +++ b/src/win32/specific.c
> @@ -76,8 +76,7 @@ void system_Init(void)
>      if (GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
>                                         "SetDefaultDllDirectories") != NULL)
>  # endif /* FIXME: not reentrant */
> -        LoadLibraryFlags = LOAD_LIBRARY_SEARCH_APPLICATION_DIR |
> -                           LOAD_LIBRARY_SEARCH_SYSTEM32;
> +        LoadLibraryFlags = LOAD_WITH_ALTERED_SEARCH_PATH;
>  #endif
>  }
>
> --
> 2.11.1
>


More information about the vlc-devel mailing list