wineboot: Keep config directory path in Unicode.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-11-28 08:51:17 +01:00
parent e87c84f56d
commit 95c9dee30a
1 changed files with 13 additions and 22 deletions

View File

@ -160,21 +160,21 @@ done:
}
/* print the config directory in a more Unix-ish way */
static const char *prettyprint_configdir(void)
static const WCHAR *prettyprint_configdir(void)
{
static char buffer[MAX_PATH];
WCHAR *path = _wgetenv( wineconfigdirW );
char *p;
static WCHAR buffer[MAX_PATH];
WCHAR *p, *path = _wgetenv( wineconfigdirW );
if (!WideCharToMultiByte( CP_UNIXCP, 0, path, -1, buffer, ARRAY_SIZE(buffer), NULL, NULL ))
strcpy( buffer + ARRAY_SIZE(buffer) - 4, "..." );
lstrcpynW( buffer, path, ARRAY_SIZE(buffer) );
if (lstrlenW( wineconfigdirW ) >= ARRAY_SIZE(buffer) )
lstrcpyW( buffer + ARRAY_SIZE(buffer) - 4, L"..." );
if (!strncmp( buffer, "\\??\\unix\\", 9 ))
if (!wcsncmp( buffer, L"\\??\\unix\\", 9 ))
{
for (p = buffer + 9; *p; p++) if (*p == '\\') *p = '/';
return buffer + 9;
}
else if (!strncmp( buffer, "\\??\\Z:\\", 7 ))
else if (!wcsncmp( buffer, L"\\??\\Z:\\", 7 ))
{
for (p = buffer + 6; *p; p++) if (*p == '\\') *p = '/';
return buffer + 6;
@ -1064,18 +1064,9 @@ static INT_PTR CALLBACK wait_dlgproc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp
static HWND show_wait_window(void)
{
const char *config_dir = prettyprint_configdir();
WCHAR *name;
HWND hwnd;
DWORD len;
len = MultiByteToWideChar( CP_UNIXCP, 0, config_dir, -1, NULL, 0 );
name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_UNIXCP, 0, config_dir, -1, name, len );
hwnd = CreateDialogParamW( GetModuleHandleW(0), MAKEINTRESOURCEW(IDD_WAITDLG), 0,
wait_dlgproc, (LPARAM)name );
HWND hwnd = CreateDialogParamW( GetModuleHandleW(0), MAKEINTRESOURCEW(IDD_WAITDLG), 0,
wait_dlgproc, (LPARAM)prettyprint_configdir() );
ShowWindow( hwnd, SW_SHOWNORMAL );
HeapFree( GetProcessHeap(), 0, name );
return hwnd;
}
@ -1227,13 +1218,13 @@ static void update_wineprefix( BOOL force )
if (!inf_path)
{
WINE_MESSAGE( "wine: failed to update %s, wine.inf not found\n", prettyprint_configdir() );
WINE_MESSAGE( "wine: failed to update %s, wine.inf not found\n", debugstr_w( config_dir ));
return;
}
if ((fd = _wopen( inf_path, O_RDONLY )) == -1)
{
WINE_MESSAGE( "wine: failed to update %s with %s: %s\n",
prettyprint_configdir(), debugstr_w(inf_path), strerror(errno) );
debugstr_w(config_dir), debugstr_w(inf_path), strerror(errno) );
goto done;
}
fstat( fd, &st );
@ -1263,7 +1254,7 @@ static void update_wineprefix( BOOL force )
install_root_pnp_devices();
update_user_profile();
WINE_MESSAGE( "wine: configuration in '%s' has been updated.\n", prettyprint_configdir() );
WINE_MESSAGE( "wine: configuration in %s has been updated.\n", debugstr_w(prettyprint_configdir()) );
}
done: