diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 82dc372d8..dd71ff6d4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2010-09-26 Corinna Vinschen + + * uinfo.cc (cygheap_user::init): Call GetUserNameW and convert to + multibyte here so as not to rely on the current ANSI page. + 2010-09-26 Christopher Faylor * dcrt0.cc (__main): Force signal synchronization. diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 2695d8176..60db38e76 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -37,10 +37,15 @@ details. */ void cygheap_user::init () { - char user_name[UNLEN + 1]; + WCHAR user_name[UNLEN + 1]; DWORD user_name_len = UNLEN + 1; - set_name (GetUserName (user_name, &user_name_len) ? user_name : "unknown"); + if (!GetUserNameW (user_name, &user_name_len)) + wcpcpy (user_name, L"unknown"); + + char mb_user_name[user_name_len = sys_wcstombs (NULL, 0, user_name)]; + sys_wcstombs (mb_user_name, user_name_len, user_name); + set_name (mb_user_name); DWORD siz; PSECURITY_DESCRIPTOR psd;