* uinfo.cc (cygheap_user::init): Call GetUserNameW and convert to

multibyte here so as not to rely on the current ANSI page.
This commit is contained in:
Corinna Vinschen 2010-09-26 15:45:10 +00:00
parent 71ef21429a
commit ebdc75d9b5
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2010-09-26 Corinna Vinschen <corinna@vinschen.de>
* 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 <me+cygwin@cgf.cx>
* dcrt0.cc (__main): Force signal synchronization.

View File

@ -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;