Commit 96fb659b authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

wininet: Use short path name when container path can't be converted to CP_ACP.

parent e4e79e71
...@@ -770,6 +770,7 @@ static void cache_containers_init(void) ...@@ -770,6 +770,7 @@ static void cache_containers_init(void)
WCHAR wszCachePath[MAX_PATH]; WCHAR wszCachePath[MAX_PATH];
WCHAR wszMutexName[MAX_PATH]; WCHAR wszMutexName[MAX_PATH];
int path_len, suffix_len; int path_len, suffix_len;
BOOL def_char;
if (!SHGetSpecialFolderPathW(NULL, wszCachePath, DefaultContainerData[i].nFolder, TRUE)) if (!SHGetSpecialFolderPathW(NULL, wszCachePath, DefaultContainerData[i].nFolder, TRUE))
{ {
...@@ -797,6 +798,20 @@ static void cache_containers_init(void) ...@@ -797,6 +798,20 @@ static void cache_containers_init(void)
wszCachePath[path_len + suffix_len + 2] = '\0'; wszCachePath[path_len + suffix_len + 2] = '\0';
} }
if (!WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, wszCachePath, path_len,
NULL, 0, NULL, &def_char) || def_char)
{
WCHAR tmp[MAX_PATH];
/* cannot convert path to ANSI code page */
if (!(path_len = GetShortPathNameW(wszCachePath, tmp, MAX_PATH)) ||
!WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, tmp, path_len,
NULL, 0, NULL, &def_char) || def_char)
ERR("Can't create container path accessible by ANSI functions\n");
else
memcpy(wszCachePath, tmp, (path_len+1)*sizeof(WCHAR));
}
cache_containers_add(DefaultContainerData[i].cache_prefix, wszCachePath, cache_containers_add(DefaultContainerData[i].cache_prefix, wszCachePath,
DefaultContainerData[i].default_entry_type, wszMutexName); DefaultContainerData[i].default_entry_type, wszMutexName);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment