apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r744978 - in /apr/apr/trunk: dso/win32/dso.c include/arch/win32/apr_arch_misc.h
Date Tue, 17 Feb 2009 12:00:17 GMT
Author: mturk
Date: Tue Feb 17 12:00:16 2009
New Revision: 744978

URL: http://svn.apache.org/viewvc?rev=744978&view=rev
Log:
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

Modified:
    apr/apr/trunk/dso/win32/dso.c
    apr/apr/trunk/include/arch/win32/apr_arch_misc.h

Modified: apr/apr/trunk/dso/win32/dso.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/dso/win32/dso.c?rev=744978&r1=744977&r2=744978&view=diff
==============================================================================
--- apr/apr/trunk/dso/win32/dso.c (original)
+++ apr/apr/trunk/dso/win32/dso.c Tue Feb 17 12:00:16 2009
@@ -77,8 +77,24 @@
         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

Modified: apr/apr/trunk/include/arch/win32/apr_arch_misc.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/arch/win32/apr_arch_misc.h?rev=744978&r1=744977&r2=744978&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_misc.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_misc.h Tue Feb 17 12:00:16 2009
@@ -470,6 +470,14 @@
 #define WSAPoll apr_winapi_WSAPoll
 #define HAVE_POLL   1
 
+#ifdef SetDllDirectoryW
+#undef SetDllDirectoryW
+#endif
+APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, SetDllDirectoryW, 0, (
+    IN LPCWSTR lpPathName),
+    (lpPathName));
+#define SetDllDirectoryW apr_winapi_SetDllDirectoryW
+
 #endif /* !defined(_WIN32_WCE) */
 
 #endif  /* ! MISC_H */



Mime
View raw message