diff options
author | Marcel Raad <Marcel.Raad@teamviewer.com> | 2020-07-23 21:28:14 +0200 |
---|---|---|
committer | Marcel Raad <Marcel.Raad@teamviewer.com> | 2020-07-27 10:42:38 +0200 |
commit | 0c6112a139c1133f7bdfc440903c0e5602c84d90 (patch) | |
tree | 3e7229f7e175db8c3a2bfea45cad93c38ed9e1b3 /src/tool_doswin.c | |
parent | 8829703b5a8d595457f3f4954cf09e6d6bae1523 (diff) | |
download | curl-0c6112a139c1133f7bdfc440903c0e5602c84d90.tar.gz |
WIN32: stop forcing narrow-character API
Except where the results are only used for character output.
getenv is not touched because it's part of the public API, and having
it return UTF-8 instead of ANSI would be a breaking change.
Fixes https://github.com/curl/curl/issues/5658
Fixes https://github.com/curl/curl/issues/5712
Closes https://github.com/curl/curl/pull/5718
Diffstat (limited to 'src/tool_doswin.c')
-rw-r--r-- | src/tool_doswin.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/tool_doswin.c b/src/tool_doswin.c index b7df3e615..78285a21b 100644 --- a/src/tool_doswin.c +++ b/src/tool_doswin.c @@ -36,6 +36,7 @@ #include "tool_bname.h" #include "tool_doswin.h" +#include "curlx.h" #include "memdebug.h" /* keep this as LAST include */ #ifdef WIN32 @@ -612,7 +613,7 @@ char **__crt0_glob_function(char *arg) CURLcode FindWin32CACert(struct OperationConfig *config, curl_sslbackend backend, - const char *bundle_file) + const TCHAR *bundle_file) { CURLcode result = CURLE_OK; @@ -626,15 +627,19 @@ CURLcode FindWin32CACert(struct OperationConfig *config, backend != CURLSSLBACKEND_SCHANNEL) { DWORD res_len; - char buf[PATH_MAX]; - char *ptr = NULL; + TCHAR buf[PATH_MAX]; + TCHAR *ptr = NULL; - buf[0] = '\0'; + buf[0] = TEXT('\0'); - res_len = SearchPathA(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr); + res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr); if(res_len > 0) { Curl_safefree(config->cacert); +#ifdef UNICODE + config->cacert = curlx_convert_wchar_to_UTF8(buf); +#else config->cacert = strdup(buf); +#endif if(!config->cacert) result = CURLE_OUT_OF_MEMORY; } @@ -702,7 +707,7 @@ bool tool_isVistaOrGreater; CURLcode win32_init(void) { - OSVERSIONINFOEXA osvi; + OSVERSIONINFOEX osvi; unsigned __int64 mask = 0; unsigned char op = VER_GREATER_EQUAL; @@ -712,7 +717,7 @@ CURLcode win32_init(void) VER_SET_CONDITION(mask, VER_MAJORVERSION, op); VER_SET_CONDITION(mask, VER_MINORVERSION, op); - if(VerifyVersionInfoA(&osvi, (VER_MAJORVERSION | VER_MINORVERSION), mask)) + if(VerifyVersionInfo(&osvi, (VER_MAJORVERSION | VER_MINORVERSION), mask)) tool_isVistaOrGreater = true; else if(GetLastError() == ERROR_OLD_WIN_VERSION) tool_isVistaOrGreater = false; |