Alexandre Julliard : wineboot: Keep config directory path in Unicode.
Alexandre Julliard
julliard at winehq.org
Thu Nov 28 16:02:20 CST 2019
Module: wine
Branch: master
Commit: 95c9dee30aa34020079ff0a614d34761db504333
URL: https://source.winehq.org/git/wine.git/?a=commit;h=95c9dee30aa34020079ff0a614d34761db504333
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Nov 28 08:51:17 2019 +0100
wineboot: Keep config directory path in Unicode.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/wineboot/wineboot.c | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 0a404c74a8..dd9a5bd8f6 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -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:
More information about the wine-cvs
mailing list