summaryrefslogtreecommitdiffstats
path: root/win/tclWinInit.c
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2003-02-13 23:49:47 (GMT)
committerKevin B Kenny <kennykb@acm.org>2003-02-13 23:49:47 (GMT)
commitbd6ef46ac1eac8105c432e3ae7fb7addd1efdc07 (patch)
tree9a331203e4909d4d93c1aab0699629312b9ca703 /win/tclWinInit.c
parent5b22ab3651ec3142fdb0850737ffe806327489b8 (diff)
downloadtcl-bd6ef46ac1eac8105c432e3ae7fb7addd1efdc07.zip
tcl-bd6ef46ac1eac8105c432e3ae7fb7addd1efdc07.tar.gz
tcl-bd6ef46ac1eac8105c432e3ae7fb7addd1efdc07.tar.bz2
Added conversion from the system encoding to tcl_platform(user), so
that it works with non-ASCII7 user names. [Bug 685926]
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r--win/tclWinInit.c14
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);