summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2004-06-02 23:29:29 (GMT)
committerhobbs <hobbs>2004-06-02 23:29:29 (GMT)
commitde5cff5c3f21cae7dc4f054d239b6ad2e02fe427 (patch)
tree34b39b0d27cc859613906d97477c5f0349f79b24 /win/tclWinFile.c
parentb2e16c28830b9415e6d277ab5646b7672673695e (diff)
downloadtcl-de5cff5c3f21cae7dc4f054d239b6ad2e02fe427.zip
tcl-de5cff5c3f21cae7dc4f054d239b6ad2e02fe427.tar.gz
tcl-de5cff5c3f21cae7dc4f054d239b6ad2e02fe427.tar.bz2
* 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.
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c10
1 files changed, 6 insertions, 4 deletions
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);