From de5cff5c3f21cae7dc4f054d239b6ad2e02fe427 Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 2 Jun 2004 23:29:29 +0000 Subject: * win/tclWinFile.c (TclpFindExecutable): when using GetModuleFileNameA (Win9x), convert from CP_ACP to WCHAR then convert back to utf8. Adjunct to 2004-04-07 fix. --- ChangeLog | 6 ++++++ win/tclWinFile.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a21b3a6..9bc2e7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-06-02 Jeff Hobbs + + * win/tclWinFile.c (TclpFindExecutable): when using + GetModuleFileNameA (Win9x), convert from CP_ACP to WCHAR then + convert back to utf8. Adjunct to 2004-04-07 fix. + 2004-06-02 David Gravereaux * tests/winPipe.c (winpipe-6.1): blocking set to 1 before diff --git a/win/tclWinFile.c b/win/tclWinFile.c index e527290..05462ed 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.64 2004/05/19 22:41:22 kennykb Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.65 2004/06/02 23:29:30 hobbs Exp $ */ //#define _WIN32_WINNT 0x0500 @@ -702,10 +702,12 @@ TclpFindExecutable(argv0) if (GetModuleFileNameW(NULL, wName, MAX_PATH) == 0) { GetModuleFileNameA(NULL, name, sizeof(name)); - } else { - WideCharToMultiByte(CP_UTF8, 0, wName, -1, - name, sizeof(name), NULL, NULL); + /* + * Convert to WCHAR to get out of ANSI codepage + */ + MultiByteToWideChar(CP_ACP, 0, name, -1, wName, MAX_PATH); } + WideCharToMultiByte(CP_UTF8, 0, wName, -1, name, sizeof(name), NULL, NULL); tclNativeExecutableName = ckalloc((unsigned) (strlen(name) + 1)); strcpy(tclNativeExecutableName, name); -- cgit v0.12