diff options
author | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2001-09-04 21:20:57 +0000 |
---|---|---|
committer | wrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68> | 2001-09-04 21:20:57 +0000 |
commit | 68afdbe068e5382d4f1d30d50cb4403789f316a0 (patch) | |
tree | 24426419309f606aa4b3eb5df732d96bb4042df5 /dso | |
parent | b99218f872fd87cc2347a8fa1f35d5d601009c9e (diff) | |
download | libapr-68afdbe068e5382d4f1d30d50cb4403789f316a0.tar.gz |
Some message is better than no message. Modified the lookup to show
%n substitutions untranslated, and return real (viewable) error code
from DSO load failure, both for Win32.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62284 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso')
-rw-r--r-- | dso/win32/dso.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/dso/win32/dso.c b/dso/win32/dso.c index cdff9c299..e9775766c 100644 --- a/dso/win32/dso.c +++ b/dso/win32/dso.c @@ -75,6 +75,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, const char *path, apr_pool_t *ctx) { HINSTANCE os_handle; + apr_status_t rv; UINT em; #if APR_HAS_UNICODE_FS @@ -82,16 +83,19 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, if (!apr_get_oslevel(ctx, &os_level) && os_level >= APR_WIN_NT) { apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; - if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) { - return rv; + if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) + / sizeof(apr_wchar_t), path)) + != APR_SUCCESS) { + *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); + return ((*res_handle)->load_error = rv); } /* Prevent ugly popups from killing our app */ em = SetErrorMode(SEM_FAILCRITICALERRORS); os_handle = LoadLibraryExW(wpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!os_handle) os_handle = LoadLibraryExW(wpath, NULL, 0); + if (!os_handle) + rv = apr_get_os_error(); SetErrorMode(em); } else @@ -105,7 +109,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, * that backslashes must be used for the LoadLibrary family of calls. */ apr_cpystrn(fspec, path, sizeof(fspec)); - while (p = strchr(p, '/')) + while ((p = strchr(p, '/')) != NULL) *p = '\\'; /* Prevent ugly popups from killing our app */ @@ -113,13 +117,14 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, os_handle = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!os_handle) os_handle = LoadLibraryEx(path, NULL, 0); + if (!os_handle) + rv = apr_get_os_error(); SetErrorMode(em); } *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); - if(os_handle == NULL) { - (*res_handle)->load_error = apr_get_os_error(); - return (*res_handle)->load_error; + if (rv) { + return ((*res_handle)->load_error = rv); } (*res_handle)->handle = (void*)os_handle; @@ -140,13 +145,11 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, struct apr_dso_handle_t *handle, const char *symname) { - FARPROC retval = GetProcAddress(handle->handle, symname); - if (!retval) { + *ressym = (apr_dso_handle_sym_t)GetProcAddress(handle->handle, symname); + + if (!*ressym) { return apr_get_os_error(); } - - *ressym = retval; - return APR_SUCCESS; } |