diff options
author | kennykb <kennykb@noemail.net> | 2003-02-13 23:49:46 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2003-02-13 23:49:46 (GMT) |
commit | 50dd268cbeb7fc2b2cbdffe2ad9490317253549a (patch) | |
tree | 9a331203e4909d4d93c1aab0699629312b9ca703 /win/tclWinInit.c | |
parent | 0fe0e6b393a667e56a0fd8fa71aa5dcaa78012e9 (diff) | |
download | tcl-50dd268cbeb7fc2b2cbdffe2ad9490317253549a.zip tcl-50dd268cbeb7fc2b2cbdffe2ad9490317253549a.tar.gz tcl-50dd268cbeb7fc2b2cbdffe2ad9490317253549a.tar.bz2 |
Added conversion from the system encoding to tcl_platform(user), so
that it works with non-ASCII7 user names. [Bug 685926]
FossilOrigin-Name: 42d87fe11195f2006bc75323bddc99d0b3d86de4
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r-- | win/tclWinInit.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index bdfbc8f..a61d59a 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -7,12 +7,13 @@ * Copyright (c) 1998-1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclWinInit.c,v 1.38 2003/02/04 17:06:53 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.39 2003/02/13 23:49:48 kennykb Exp $ */ #include "tclWinInt.h" #include <winnt.h> #include <winbase.h> +#include <lmcons.h> /* * The following declaration is a workaround for some Microsoft brain damage. @@ -597,6 +598,8 @@ TclpSetVariables(interp) OemId *oemId; OSVERSIONINFOA osInfo; Tcl_DString ds; + TCHAR szUserName[ UNLEN+1 ]; + DWORD dwUserNameLen; osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); GetVersionExA(&osInfo); @@ -663,11 +666,12 @@ TclpSetVariables(interp) * faster than asking the system. */ - Tcl_DStringSetLength(&ds, 100); + Tcl_DStringInit( &ds ); if (TclGetEnv("USERNAME", &ds) == NULL) { - if (GetUserName(Tcl_DStringValue(&ds), (LPDWORD) &Tcl_DStringLength(&ds)) == 0) { - Tcl_DStringSetLength(&ds, 0); - } + + if ( GetUserName( szUserName, &dwUserNameLen ) != 0 ) { + Tcl_WinTCharToUtf( szUserName, dwUserNameLen, &ds ); + } } Tcl_SetVar2(interp, "tcl_platform", "user", Tcl_DStringValue(&ds), TCL_GLOBAL_ONLY); |