diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2010-09-26 19:45:10 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2010-09-26 19:45:10 +0400 |
commit | ebdc75d9b5556c17871cb0e9f5ba115e25c8d4d4 (patch) | |
tree | 104d2e9943892febd7781699c621315136796843 /winsup/cygwin/uinfo.cc | |
parent | 71ef21429a1df119a07c3e022322337d327963a5 (diff) |
* uinfo.cc (cygheap_user::init): Call GetUserNameW and convert to
multibyte here so as not to rely on the current ANSI page.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r-- | winsup/cygwin/uinfo.cc | 9 |
1 files changed, 7 insertions, 2 deletions
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; |