diff options
author | Mladen Turk <mturk@apache.org> | 2009-02-17 12:00:16 +0000 |
---|---|---|
committer | Mladen Turk <mturk@apache.org> | 2009-02-17 12:00:16 +0000 |
commit | 229789e3043fff16f2cdf394c869866831362228 (patch) | |
tree | 80147209f5987fae2868208bd4c0c9555863554e /dso | |
parent | d15de0c7a9958d2dd7d8af0d45194572e287b6cd (diff) | |
download | apr-229789e3043fff16f2cdf394c869866831362228.tar.gz |
Use SetDllDirectory if supported by OS in case dependent .dll's are in the same path as loading .dll, but that path is not inside the system PATH. Instead failing try to reload with the .dll path hoping all dependencies can be resolved there
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@744978 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso')
-rw-r--r-- | dso/win32/dso.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/dso/win32/dso.c b/dso/win32/dso.c index d4a689387..085470905 100644 --- a/dso/win32/dso.c +++ b/dso/win32/dso.c @@ -77,8 +77,24 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, os_handle = LoadLibraryExW(wpath, NULL, 0); if (!os_handle) os_handle = LoadLibraryExW(wpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if (!os_handle) + if (!os_handle) { +#ifndef _WIN32_WCE + apr_wchar_t *ignored; + apr_wchar_t fpath[APR_PATH_MAX]; + rv = apr_get_os_error(); + if (GetFullPathNameW(wpath, sizeof(fpath) / sizeof(apr_wchar_t), fpath, &ignored)) { + if (SetDllDirectoryW(fpath)) { + os_handle = LoadLibraryExW(fpath, NULL, 0); + if (!os_handle) + os_handle = LoadLibraryExW(fpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if (os_handle) + rv = APR_SUCCESS; + } + } +#else rv = apr_get_os_error(); +#endif + } #ifndef _WIN32_WCE SetErrorMode(em); #endif |