Alexandre Julliard : advapi32: Avoid slashes and backslashes in user
names.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Feb 28 08:19:15 CST 2007
Module: wine
Branch: master
Commit: ec636f151b78c3d5bc8e8d0b33fcca1465574a3a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ec636f151b78c3d5bc8e8d0b33fcca1465574a3a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Feb 28 14:51:04 2007 +0100
advapi32: Avoid slashes and backslashes in user names.
---
dlls/advapi32/advapi.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/dlls/advapi32/advapi.c b/dlls/advapi32/advapi.c
index fbcb1a6..126f8d1 100644
--- a/dlls/advapi32/advapi.c
+++ b/dlls/advapi32/advapi.c
@@ -84,7 +84,7 @@ BOOL WINAPI
GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
{
const char *name = wine_get_user_name();
- DWORD len = MultiByteToWideChar( CP_UNIXCP, 0, name, -1, NULL, 0 );
+ DWORD i, len = MultiByteToWideChar( CP_UNIXCP, 0, name, -1, NULL, 0 );
if (len > *lpSize)
{
@@ -95,6 +95,12 @@ GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
*lpSize = len;
MultiByteToWideChar( CP_UNIXCP, 0, name, -1, lpszName, len );
+
+ /* Word uses the user name to create named mutexes and file mappings,
+ * and backslashes in the name cause the creation to fail.
+ */
+ for (i = 0; lpszName[i]; i++)
+ if (lpszName[i] == '\\' || lpszName[i] == '/') lpszName[i] = '_';
return TRUE;
}
More information about the wine-cvs
mailing list