summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/arch/win32/apr_arch_misc.h10
-rw-r--r--misc/win32/misc.c27
-rw-r--r--misc/win32/start.c2
3 files changed, 29 insertions, 10 deletions
diff --git a/include/arch/win32/apr_arch_misc.h b/include/arch/win32/apr_arch_misc.h
index a8a3320dd..196914e68 100644
--- a/include/arch/win32/apr_arch_misc.h
+++ b/include/arch/win32/apr_arch_misc.h
@@ -188,7 +188,10 @@ typedef enum {
DLL_SHSTDAPI = 4, /* shell32 From ShellAPI.h */
DLL_NTDLL = 5, /* ntdll From our real kernel */
DLL_IPHLPAPI = 6, /* Iphlpapi From Iphlpapi.h */
- DLL_defined = 7 /* must define as last idx_ + 1 */
+ DLL_API_MS_WIN_DOWNLEVEL_SHELL32_L1_1_0 = 7,
+ /* api-ms-win-downlevel-shell32-l1-1-0.dll,
+ fallback to shell32.dll */
+ DLL_defined = 8 /* must define as last idx_ + 1 */
} apr_dlltoken_e;
FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal);
@@ -312,6 +315,11 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_IPHLPAPI, PCHAR, NETIOAPI_API_, if_indextoname, 0,
(InterfaceIndex, InterfaceName));
#define if_indextoname apr_winapi_if_indextoname
+APR_DECLARE_LATE_DLL_FUNC(DLL_SHSTDAPI, LPWSTR *, STDAPICALLTYPE, CommandLineToArgvW, 0, (
+ LPCWSTR lpCmdLine,
+ int *pNumArgs),
+ (lpCmdLine, pNumArgs));
+
#endif /* !defined(_WIN32_WCE) */
#endif /* ! MISC_H */
diff --git a/misc/win32/misc.c b/misc/win32/misc.c
index 910b0b41e..5136b9336 100644
--- a/misc/win32/misc.c
+++ b/misc/win32/misc.c
@@ -136,18 +136,21 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level)
typedef struct win32_late_dll_t {
INIT_ONCE control;
+ const apr_wchar_t *apiset_name;
const apr_wchar_t *dll_name;
HMODULE dll_handle;
} win32_late_dll_t;
static win32_late_dll_t late_dll[DLL_defined] = {
- {INIT_ONCE_STATIC_INIT, L"kernel32", NULL},
- {INIT_ONCE_STATIC_INIT, L"advapi32", NULL},
- {INIT_ONCE_STATIC_INIT, L"mswsock", NULL},
- {INIT_ONCE_STATIC_INIT, L"ws2_32", NULL},
- {INIT_ONCE_STATIC_INIT, L"shell32", NULL},
- {INIT_ONCE_STATIC_INIT, L"ntdll.dll", NULL},
- {INIT_ONCE_STATIC_INIT, L"Iphplapi", NULL}
+ {INIT_ONCE_STATIC_INIT, NULL, L"kernel32", NULL},
+ {INIT_ONCE_STATIC_INIT, NULL, L"advapi32", NULL},
+ {INIT_ONCE_STATIC_INIT, NULL, L"mswsock", NULL},
+ {INIT_ONCE_STATIC_INIT, NULL, L"ws2_32", NULL},
+ {INIT_ONCE_STATIC_INIT, NULL, L"shell32", NULL},
+ {INIT_ONCE_STATIC_INIT, NULL, L"ntdll.dll", NULL},
+ {INIT_ONCE_STATIC_INIT, NULL, L"Iphplapi", NULL},
+ {INIT_ONCE_STATIC_INIT, L"api-ms-win-downlevel-shell32-l1-1-0.dll",
+ L"shell32", NULL}
};
static BOOL WINAPI load_dll_callback(PINIT_ONCE InitOnce,
@@ -156,7 +159,15 @@ static BOOL WINAPI load_dll_callback(PINIT_ONCE InitOnce,
{
win32_late_dll_t *dll = Parameter;
- dll->dll_handle = LoadLibraryW(dll->dll_name);
+ /* Try api set dll first if defined. */
+ if (dll->apiset_name) {
+ dll->dll_handle = LoadLibraryExW(dll->apiset_name, NULL,
+ LOAD_LIBRARY_SEARCH_SYSTEM32);
+ }
+
+ if (!dll->dll_handle) {
+ dll->dll_handle = LoadLibraryW(dll->dll_name);
+ }
return TRUE;
}
diff --git a/misc/win32/start.c b/misc/win32/start.c
index e84fb876a..df60283e1 100644
--- a/misc/win32/start.c
+++ b/misc/win32/start.c
@@ -124,7 +124,7 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
sysstr = GetCommandLineW();
if (sysstr) {
- wstrs = CommandLineToArgvW(sysstr, &wstrc);
+ wstrs = apr_winapi_CommandLineToArgvW(sysstr, &wstrc);
if (wstrs) {
*argc = apr_wastrtoastr(argv, wstrs, wstrc);
LocalFree(wstrs);