summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/.cvsignore2
-rw-r--r--win/tclWin32Dll.c122
-rw-r--r--win/tclWinFCmd.c12
-rw-r--r--win/tclWinFile.c12
-rw-r--r--win/tclWinInt.h84
-rw-r--r--win/tclWinLoad.c4
-rw-r--r--win/tclWinPipe.c12
-rw-r--r--win/tclWinSerial.c4
8 files changed, 138 insertions, 114 deletions
diff --git a/win/.cvsignore b/win/.cvsignore
index 3f15505..7a35fbb 100644
--- a/win/.cvsignore
+++ b/win/.cvsignore
@@ -24,3 +24,5 @@ tcl.suo
*.res
*.exp
*.lib
+*.pdb
+*.ilk
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index 1295c26..76fc642 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWin32Dll.c,v 1.60 2009/08/02 10:41:09 nijtmans Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.61 2010/02/15 22:56:19 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -63,6 +63,53 @@ typedef struct EXCEPTION_REGISTRATION {
#define cpuid __asm __emit 0fh __asm __emit 0a2h
#endif
+static Tcl_Encoding winTCharEncoding = NULL;
+
+static const TCHAR *utf2win(
+ const char *string, /* Source string in UTF-8. */
+ int len, /* Source string length in bytes, or < 0 for
+ * strlen(). */
+ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
+ * converted string is stored. */
+{
+ return (const TCHAR *) Tcl_UtfToExternalDString(NULL, string, len, dsPtr);
+}
+
+static const TCHAR *utf2wchar(
+ const char *string, /* Source string in UTF-8. */
+ int len, /* Source string length in bytes, or < 0 for
+ * strlen(). */
+ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
+ * converted string is stored. */
+{
+ return (const TCHAR *) Tcl_UtfToExternalDString(winTCharEncoding,
+ string, len, dsPtr);
+}
+
+static const char *win2utf(
+ const TCHAR *string, /* Source string in Unicode when running NT,
+ * ANSI when running 95. */
+ int len, /* Source string length in bytes, or < 0 for
+ * platform-specific string length. */
+ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
+ * converted string is stored. */
+{
+ return Tcl_ExternalToUtfDString(NULL,
+ (const char *) string, len, dsPtr);
+}
+
+static const char *wchar2utf(
+ const TCHAR *string, /* Source string in Unicode when running NT,
+ * ANSI when running 95. */
+ int len, /* Source string length in bytes, or < 0 for
+ * platform-specific string length. */
+ Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
+ * converted string is stored. */
+{
+ return Tcl_ExternalToUtfDString(winTCharEncoding,
+ (const char *) string, len, dsPtr);
+}
+
/*
* The following function tables are used to dispatch to either the
* wide-character or multi-byte versions of the operating system calls,
@@ -71,7 +118,6 @@ typedef struct EXCEPTION_REGISTRATION {
static TclWinProcs asciiProcs = {
0,
-
(BOOL (WINAPI *)(const TCHAR *, LPDCB)) BuildCommDCBA,
(TCHAR *(WINAPI *)(TCHAR *)) CharLowerA,
(BOOL (WINAPI *)(const TCHAR *, const TCHAR *, BOOL)) CopyFileA,
@@ -115,7 +161,6 @@ static TclWinProcs asciiProcs = {
NULL,
NULL,
- /* deleted (int (__cdecl*)(const TCHAR *, struct _utimbuf *)) _utime, */
NULL,
NULL,
/* getLongPathNameProc */
@@ -125,12 +170,13 @@ static TclWinProcs asciiProcs = {
/* ReadConsole and WriteConsole */
(BOOL (WINAPI *)(HANDLE, LPVOID, DWORD, LPDWORD, LPVOID)) ReadConsoleA,
(BOOL (WINAPI *)(HANDLE, const void*, DWORD, LPDWORD, LPVOID)) WriteConsoleA,
- (BOOL (WINAPI *)(LPTSTR, LPDWORD)) GetUserNameA
+ (BOOL (WINAPI *)(LPTSTR, LPDWORD)) GetUserNameA,
+ utf2win,
+ win2utf
};
static TclWinProcs unicodeProcs = {
1,
-
(BOOL (WINAPI *)(const TCHAR *, LPDCB)) BuildCommDCBW,
(TCHAR *(WINAPI *)(TCHAR *)) CharLowerW,
(BOOL (WINAPI *)(const TCHAR *, const TCHAR *, BOOL)) CopyFileW,
@@ -174,7 +220,6 @@ static TclWinProcs unicodeProcs = {
NULL,
NULL,
- /* deleted (int (__cdecl*)(const TCHAR *, struct _utimbuf *)) _wutime, */
NULL,
NULL,
/* getLongPathNameProc */
@@ -184,11 +229,12 @@ static TclWinProcs unicodeProcs = {
/* ReadConsole and WriteConsole */
(BOOL (WINAPI *)(HANDLE, LPVOID, DWORD, LPDWORD, LPVOID)) ReadConsoleW,
(BOOL (WINAPI *)(HANDLE, const void*, DWORD, LPDWORD, LPVOID)) WriteConsoleW,
- (BOOL (WINAPI *)(LPTSTR, LPDWORD)) GetUserNameW
+ (BOOL (WINAPI *)(LPTSTR, LPDWORD)) GetUserNameW,
+ utf2wchar,
+ wchar2utf
};
-TclWinProcs *tclWinProcs = &asciiProcs;
-static Tcl_Encoding tclWinTCharEncoding;
+const TclWinProcs *tclWinProcs = &asciiProcs;
/*
* The following declaration is for the VC++ DLL entry point.
@@ -446,54 +492,53 @@ TclWinSetInterfaces(
TclWinResetInterfaces();
if (wide) {
- tclWinProcs = &unicodeProcs;
- tclWinTCharEncoding = Tcl_GetEncoding(NULL, "unicode");
- if (tclWinProcs->getFileAttributesExProc == NULL) {
+ winTCharEncoding = Tcl_GetEncoding(NULL, "unicode");
+ if (unicodeProcs.getFileAttributesExProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("kernel32");
if (hInstance != NULL) {
- tclWinProcs->getFileAttributesExProc =
+ unicodeProcs.getFileAttributesExProc =
(BOOL (WINAPI *)(const TCHAR *, GET_FILEEX_INFO_LEVELS,
LPVOID)) GetProcAddress(hInstance,
"GetFileAttributesExW");
- tclWinProcs->createHardLinkProc =
+ unicodeProcs.createHardLinkProc =
(BOOL (WINAPI *)(const TCHAR *, const TCHAR*,
LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
"CreateHardLinkW");
- tclWinProcs->findFirstFileExProc =
+ unicodeProcs.findFirstFileExProc =
(HANDLE (WINAPI *)(const TCHAR*, UINT, LPVOID, UINT,
LPVOID, DWORD)) GetProcAddress(hInstance,
"FindFirstFileExW");
- tclWinProcs->getVolumeNameForVMPProc =
+ unicodeProcs.getVolumeNameForVMPProc =
(BOOL (WINAPI *)(const TCHAR*, TCHAR*,
DWORD)) GetProcAddress(hInstance,
"GetVolumeNameForVolumeMountPointW");
- tclWinProcs->getLongPathNameProc =
+ unicodeProcs.getLongPathNameProc =
(DWORD (WINAPI *)(const TCHAR*, TCHAR*,
DWORD)) GetProcAddress(hInstance, "GetLongPathNameW");
FreeLibrary(hInstance);
}
hInstance = LoadLibraryA("advapi32");
if (hInstance != NULL) {
- tclWinProcs->getFileSecurityProc = (BOOL (WINAPI *)(
+ unicodeProcs.getFileSecurityProc = (BOOL (WINAPI *)(
LPCTSTR lpFileName,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor,
DWORD nLength, LPDWORD lpnLengthNeeded))
GetProcAddress(hInstance, "GetFileSecurityW");
- tclWinProcs->impersonateSelfProc = (BOOL (WINAPI *) (
+ unicodeProcs.impersonateSelfProc = (BOOL (WINAPI *) (
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel))
GetProcAddress(hInstance, "ImpersonateSelf");
- tclWinProcs->openThreadTokenProc = (BOOL (WINAPI *) (
+ unicodeProcs.openThreadTokenProc = (BOOL (WINAPI *) (
HANDLE ThreadHandle, DWORD DesiredAccess,
BOOL OpenAsSelf, PHANDLE TokenHandle))
GetProcAddress(hInstance, "OpenThreadToken");
- tclWinProcs->revertToSelfProc = (BOOL (WINAPI *) (void))
+ unicodeProcs.revertToSelfProc = (BOOL (WINAPI *) (void))
GetProcAddress(hInstance, "RevertToSelf");
- tclWinProcs->mapGenericMaskProc = (void (WINAPI *) (
+ unicodeProcs.mapGenericMaskProc = (void (WINAPI *) (
PDWORD AccessMask, PGENERIC_MAPPING GenericMapping))
GetProcAddress(hInstance, "MapGenericMask");
- tclWinProcs->accessCheckProc = (BOOL (WINAPI *)(
+ unicodeProcs.accessCheckProc = (BOOL (WINAPI *)(
PSECURITY_DESCRIPTOR pSecurityDescriptor,
HANDLE ClientToken, DWORD DesiredAccess,
PGENERIC_MAPPING GenericMapping,
@@ -504,20 +549,21 @@ TclWinSetInterfaces(
FreeLibrary(hInstance);
}
}
+ tclWinProcs = &unicodeProcs;
} else {
- if (tclWinProcs->getFileAttributesExProc == NULL) {
+ if (asciiProcs.getFileAttributesExProc == NULL) {
HINSTANCE hInstance = LoadLibraryA("kernel32");
if (hInstance != NULL) {
- tclWinProcs->getFileAttributesExProc =
+ asciiProcs.getFileAttributesExProc =
(BOOL (WINAPI *)(const TCHAR *, GET_FILEEX_INFO_LEVELS,
LPVOID)) GetProcAddress(hInstance,
"GetFileAttributesExA");
- tclWinProcs->createHardLinkProc =
+ asciiProcs.createHardLinkProc =
(BOOL (WINAPI *)(const TCHAR *, const TCHAR*,
LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance,
"CreateHardLinkA");
- tclWinProcs->findFirstFileExProc = NULL;
- tclWinProcs->getLongPathNameProc = NULL;
+ asciiProcs.findFirstFileExProc = NULL;
+ asciiProcs.getLongPathNameProc = NULL;
/*
* The 'findFirstFileExProc' function exists on some of
* 95/98/ME, but it seems not to work as anticipated.
@@ -529,7 +575,7 @@ TclWinSetInterfaces(
* LPVOID, UINT, LPVOID, DWORD)) GetProcAddress(hInstance,
* "FindFirstFileExA");
*/
- tclWinProcs->getVolumeNameForVMPProc =
+ asciiProcs.getVolumeNameForVMPProc =
(BOOL (WINAPI *)(const TCHAR*, TCHAR*,
DWORD)) GetProcAddress(hInstance,
"GetVolumeNameForVolumeMountPointA");
@@ -603,9 +649,9 @@ TclWinEncodingsCleanup(void)
void
TclWinResetInterfaces(void)
{
- if (tclWinTCharEncoding != NULL) {
- Tcl_FreeEncoding(tclWinTCharEncoding);
- tclWinTCharEncoding = NULL;
+ if (winTCharEncoding != NULL) {
+ Tcl_FreeEncoding(winTCharEncoding);
+ winTCharEncoding = NULL;
}
tclWinProcs = &asciiProcs;
}
@@ -826,7 +872,11 @@ Tcl_WinUtfToTChar(
Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
- return (TCHAR *) Tcl_UtfToExternalDString(tclWinTCharEncoding,
+ Tcl_Encoding encoding = NULL;
+ if (platformId != VER_PLATFORM_WIN32_WINDOWS) {
+ encoding = winTCharEncoding;
+ }
+ return (TCHAR *) Tcl_UtfToExternalDString(encoding,
string, len, dsPtr);
}
@@ -839,7 +889,11 @@ Tcl_WinTCharToUtf(
Tcl_DString *dsPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
- return Tcl_ExternalToUtfDString(tclWinTCharEncoding,
+ Tcl_Encoding encoding = NULL;
+ if (platformId != VER_PLATFORM_WIN32_WINDOWS) {
+ encoding = winTCharEncoding;
+ }
+ return Tcl_ExternalToUtfDString(encoding,
(const char *) string, len, dsPtr);
}
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c
index 6f5cd8d..67ba3eb 100644
--- a/win/tclWinFCmd.c
+++ b/win/tclWinFCmd.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinFCmd.c,v 1.58 2009/08/02 10:41:09 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFCmd.c,v 1.59 2010/02/15 22:56:19 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -930,8 +930,8 @@ TclpObjCopyDirectory(
return TCL_ERROR;
}
- Tcl_WinUtfToTChar(Tcl_GetString(normSrcPtr), -1, &srcString);
- Tcl_WinUtfToTChar(Tcl_GetString(normDestPtr), -1, &dstString);
+ tclWinProcs->utf2tchar(Tcl_GetString(normSrcPtr), -1, &srcString);
+ tclWinProcs->utf2tchar(Tcl_GetString(normDestPtr), -1, &dstString);
ret = TraverseWinTree(TraversalCopy, &srcString, &dstString, &ds);
@@ -1003,7 +1003,7 @@ TclpObjRemoveDirectory(
if (normPtr == NULL) {
return TCL_ERROR;
}
- Tcl_WinUtfToTChar(Tcl_GetString(normPtr), -1, &native);
+ tclWinProcs->utf2tchar(Tcl_GetString(normPtr), -1, &native);
ret = DoRemoveDirectory(&native, recursive, &ds);
Tcl_DStringFree(&native);
} else {
@@ -1720,7 +1720,7 @@ ConvertFileNameFormat(
Tcl_Obj *tempPath;
Tcl_DString ds;
Tcl_DString dsTemp;
- TCHAR *nativeName;
+ const TCHAR *nativeName;
const char *tempString;
int tempLen;
WIN32_FIND_DATAT data;
@@ -1737,7 +1737,7 @@ ConvertFileNameFormat(
Tcl_DStringInit(&ds);
tempString = Tcl_GetStringFromObj(tempPath,&tempLen);
- nativeName = Tcl_WinUtfToTChar(tempString, tempLen, &ds);
+ nativeName = tclWinProcs->utf2tchar(tempString, tempLen, &ds);
Tcl_DecrRefCount(tempPath);
handle = tclWinProcs->findFirstFileProc(nativeName, &data);
if (handle == INVALID_HANDLE_VALUE) {
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index f18ca7e..57a9aef 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.102 2010/01/13 06:46:56 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.103 2010/02/15 22:56:19 nijtmans Exp $
*/
/* #define _WIN32_WINNT 0x0500 */
@@ -1003,7 +1003,7 @@ TclpMatchInDirectory(
dirName = Tcl_DStringAppend(&dsOrig, "*.*", 3);
}
- native = Tcl_WinUtfToTChar(dirName, -1, &ds);
+ native = tclWinProcs->utf2tchar(dirName, -1, &ds);
if (tclWinProcs->findFirstFileExProc == NULL || (types == NULL)
|| (types->type != TCL_GLOB_TYPE_DIR)) {
handle = tclWinProcs->findFirstFileProc(native, &data);
@@ -2225,7 +2225,7 @@ NativeDev(
} else {
p++;
}
- nativeVol = Tcl_WinUtfToTChar(fullPath, p - fullPath, &volString);
+ nativeVol = tclWinProcs->utf2tchar(fullPath, p - fullPath, &volString);
dw = (DWORD) -1;
tclWinProcs->getVolumeInformationProc(nativeVol, NULL, 0, &dw, NULL,
NULL, NULL, 0);
@@ -2750,7 +2750,7 @@ TclpObjNormalizePath(
*/
WIN32_FILE_ATTRIBUTE_DATA data;
- const char *nativePath = Tcl_WinUtfToTChar(path,
+ const char *nativePath = tclWinProcs->utf2tchar(path,
currentPathEndPosition - path, &ds);
if (tclWinProcs->getFileAttributesExProc(nativePath,
@@ -2945,7 +2945,7 @@ TclpObjNormalizePath(
if (1) {
WCHAR wpath[MAX_PATH];
const char *nativePath =
- Tcl_WinUtfToTChar(path, lastValidPathEnd - path, &ds);
+ tclWinProcs->utf2tchar(path, lastValidPathEnd - path, &ds);
DWORD wpathlen = tclWinProcs->getLongPathNameProc(nativePath,
(TCHAR *) wpath, MAX_PATH);
@@ -3248,7 +3248,7 @@ TclNativeCreateNativeRep(
}
}
}
- Tcl_WinUtfToTChar(str, len, &ds);
+ tclWinProcs->utf2tchar(str, len, &ds);
if (tclWinProcs->useWide) {
len = Tcl_DStringLength(&ds) + sizeof(WCHAR);
} else {
diff --git a/win/tclWinInt.h b/win/tclWinInt.h
index 7257afe..13d25ef 100644
--- a/win/tclWinInt.h
+++ b/win/tclWinInt.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinInt.h,v 1.33 2010/02/05 10:03:24 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinInt.h,v 1.34 2010/02/15 22:56:19 nijtmans Exp $
*/
#ifndef _TCLWININT
@@ -17,14 +17,6 @@
#include "tclInt.h"
/*
- * The following specifies how much stack space TclpCheckStackSpace()
- * ensures is available. TclpCheckStackSpace() is called by Tcl_EvalObj()
- * to help avoid overflowing the stack in the case of infinite recursion.
- */
-
-#define TCL_WIN_STACK_THRESHOLD 0x8000
-
-/*
* Some versions of Borland C have a define for the OSVERSIONINFO for
* Win32s and for NT, but not for Windows 95.
* Define VER_PLATFORM_WIN32_CE for those without newer headers.
@@ -50,7 +42,6 @@ typedef union {
typedef struct TclWinProcs {
int useWide;
-
BOOL (WINAPI *buildCommDCBProc)(const TCHAR *, LPDCB);
TCHAR * (WINAPI *charLowerProc)(TCHAR *);
BOOL (WINAPI *copyFileProc)(const TCHAR *, const TCHAR *, BOOL);
@@ -66,8 +57,8 @@ typedef struct TclWinProcs {
BOOL (WINAPI *getComputerNameProc)(WCHAR *, LPDWORD);
DWORD (WINAPI *getCurrentDirectoryProc)(DWORD, WCHAR *);
DWORD (WINAPI *getFileAttributesProc)(const TCHAR *);
- DWORD (WINAPI *getFullPathNameProc)(const TCHAR *, DWORD nBufferLength,
- WCHAR *, TCHAR **);
+ DWORD (WINAPI *getFullPathNameProc)(const TCHAR *, DWORD, WCHAR *,
+ TCHAR **);
DWORD (WINAPI *getModuleFileNameProc)(HMODULE, WCHAR *, int);
DWORD (WINAPI *getShortPathNameProc)(const TCHAR *, WCHAR *, DWORD);
UINT (WINAPI *getTempFileNameProc)(const TCHAR *, const TCHAR *, UINT,
@@ -92,62 +83,39 @@ typedef struct TclWinProcs {
*/
BOOL (WINAPI *getFileAttributesExProc)(const TCHAR *,
GET_FILEEX_INFO_LEVELS, LPVOID);
- BOOL (WINAPI *createHardLinkProc)(const TCHAR*, const TCHAR*,
- LPSECURITY_ATTRIBUTES);
+ BOOL (WINAPI *createHardLinkProc)(const TCHAR *, const TCHAR *,
+ LPSECURITY_ATTRIBUTES);
- /* deleted INT (__cdecl *utimeProc)(const TCHAR*, struct _utimbuf *); */
/* These two are also NULL at start; see comment above */
- HANDLE (WINAPI *findFirstFileExProc)(const TCHAR*, UINT,
- LPVOID, UINT,
- LPVOID, DWORD);
- BOOL (WINAPI *getVolumeNameForVMPProc)(const TCHAR*, TCHAR*, DWORD);
- DWORD (WINAPI *getLongPathNameProc)(const TCHAR*, TCHAR*, DWORD);
+ HANDLE (WINAPI *findFirstFileExProc)(const TCHAR *, UINT,
+ LPVOID, UINT, LPVOID, DWORD);
+ BOOL (WINAPI *getVolumeNameForVMPProc)(const TCHAR *, TCHAR *, DWORD);
+ DWORD (WINAPI *getLongPathNameProc)(const TCHAR *, TCHAR *, DWORD);
/*
* These six are for the security sdk to get correct file
* permissions on NT, 2000, XP, etc. On 95,98,ME they are
* always null.
*/
- BOOL (WINAPI *getFileSecurityProc)(LPCTSTR lpFileName,
- SECURITY_INFORMATION RequestedInformation,
- PSECURITY_DESCRIPTOR pSecurityDescriptor,
- DWORD nLength,
- LPDWORD lpnLengthNeeded);
- BOOL (WINAPI *impersonateSelfProc) (SECURITY_IMPERSONATION_LEVEL
- ImpersonationLevel);
- BOOL (WINAPI *openThreadTokenProc) (HANDLE ThreadHandle,
- DWORD DesiredAccess, BOOL OpenAsSelf,
- PHANDLE TokenHandle);
+ BOOL (WINAPI *getFileSecurityProc)(LPCTSTR, SECURITY_INFORMATION,
+ PSECURITY_DESCRIPTOR, DWORD, LPDWORD);
+ BOOL (WINAPI *impersonateSelfProc) (SECURITY_IMPERSONATION_LEVEL);
+ BOOL (WINAPI *openThreadTokenProc) (HANDLE, DWORD, BOOL, PHANDLE);
BOOL (WINAPI *revertToSelfProc) (void);
- void (WINAPI *mapGenericMaskProc) (PDWORD AccessMask,
- PGENERIC_MAPPING GenericMapping);
- BOOL (WINAPI *accessCheckProc)(PSECURITY_DESCRIPTOR pSecurityDescriptor,
- HANDLE ClientToken, DWORD DesiredAccess,
- PGENERIC_MAPPING GenericMapping,
- PPRIVILEGE_SET PrivilegeSet,
- LPDWORD PrivilegeSetLength,
- LPDWORD GrantedAccess,
- LPBOOL AccessStatus);
+ void (WINAPI *mapGenericMaskProc) (PDWORD, PGENERIC_MAPPING);
+ BOOL (WINAPI *accessCheckProc)(PSECURITY_DESCRIPTOR, HANDLE, DWORD,
+ PGENERIC_MAPPING, PPRIVILEGE_SET, LPDWORD, LPDWORD, LPBOOL);
/*
* Unicode console support. WriteConsole and ReadConsole
*/
- BOOL (WINAPI *readConsoleProc)(
- HANDLE hConsoleInput,
- LPVOID lpBuffer,
- DWORD nNumberOfCharsToRead,
- LPDWORD lpNumberOfCharsRead,
- LPVOID lpReserved
- );
- BOOL (WINAPI *writeConsoleProc)(
- HANDLE hConsoleOutput,
- const void* lpBuffer,
- DWORD nNumberOfCharsToWrite,
- LPDWORD lpNumberOfCharsWritten,
- LPVOID lpReserved
- );
- BOOL (WINAPI *getUserName)(LPTSTR lpBuffer, LPDWORD lpnSize);
+ BOOL (WINAPI *readConsoleProc)(HANDLE, LPVOID, DWORD, LPDWORD, LPVOID);
+ BOOL (WINAPI *writeConsoleProc)(HANDLE, const void *, DWORD, LPDWORD,
+ LPVOID);
+ BOOL (WINAPI *getUserName)(LPTSTR, LPDWORD);
+ const TCHAR *(*utf2tchar)(const char *, int, Tcl_DString *);
+ const char *(*tchar2utf)(const TCHAR *, int, Tcl_DString *);
} TclWinProcs;
-MODULE_SCOPE TclWinProcs *tclWinProcs;
+MODULE_SCOPE const TclWinProcs *tclWinProcs;
/*
* Declarations of functions that are not accessible by way of the
@@ -167,9 +135,9 @@ MODULE_SCOPE Tcl_Channel TclWinOpenSerialChannel(HANDLE handle,
char *channelName, int permissions);
MODULE_SCOPE HANDLE TclWinSerialReopen(HANDLE handle, const TCHAR *name,
DWORD access);
-MODULE_SCOPE int TclWinSymLinkCopyDirectory(const TCHAR* LinkOriginal,
- const TCHAR* LinkCopy);
-MODULE_SCOPE int TclWinSymLinkDelete(const TCHAR* LinkOriginal,
+MODULE_SCOPE int TclWinSymLinkCopyDirectory(const TCHAR *LinkOriginal,
+ const TCHAR *LinkCopy);
+MODULE_SCOPE int TclWinSymLinkDelete(const TCHAR *LinkOriginal,
int linkOnly);
#if defined(TCL_THREADS) && defined(USE_THREAD_ALLOC)
MODULE_SCOPE void TclWinFreeAllocCache(void);
diff --git a/win/tclWinLoad.c b/win/tclWinLoad.c
index af19ff1..26f50a4 100644
--- a/win/tclWinLoad.c
+++ b/win/tclWinLoad.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinLoad.c,v 1.23 2009/02/03 23:10:57 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinLoad.c,v 1.24 2010/02/15 22:56:19 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -68,7 +68,7 @@ TclpDlopen(
Tcl_DString ds;
const char *fileName = Tcl_GetString(pathPtr);
- nativeName = Tcl_WinUtfToTChar(fileName, -1, &ds);
+ nativeName = tclWinProcs->utf2tchar(fileName, -1, &ds);
handle = tclWinProcs->loadLibraryProc(nativeName);
Tcl_DStringFree(&ds);
}
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index fda862e..b7dddaa 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinPipe.c,v 1.74 2010/01/22 13:02:50 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinPipe.c,v 1.75 2010/02/15 22:56:19 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -597,7 +597,7 @@ TclpOpenFile(
break;
}
- nativePath = Tcl_WinUtfToTChar(path, -1, &ds);
+ nativePath = tclWinProcs->utf2tchar(path, -1, &ds);
/*
* If the file is not being created, use the existing file attributes.
@@ -1399,7 +1399,7 @@ ApplicationType(
for (i = 0; i < (int) (sizeof(extensions) / sizeof(extensions[0])); i++) {
Tcl_DStringSetLength(&nameBuf, nameLen);
Tcl_DStringAppend(&nameBuf, extensions[i], -1);
- nativeName = Tcl_WinUtfToTChar(Tcl_DStringValue(&nameBuf),
+ nativeName = tclWinProcs->utf2tchar(Tcl_DStringValue(&nameBuf),
Tcl_DStringLength(&nameBuf), &ds);
found = tclWinProcs->searchPathProc(NULL, nativeName, NULL, MAX_PATH,
nativeFullPath, &rest);
@@ -1624,7 +1624,7 @@ BuildCommandLine(
}
}
Tcl_DStringFree(linePtr);
- Tcl_WinUtfToTChar(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), linePtr);
+ tclWinProcs->utf2tchar(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds), linePtr);
Tcl_DStringFree(&ds);
}
@@ -3196,7 +3196,7 @@ TclpOpenTemporaryFile(
if (basenameObj) {
const char *string = Tcl_GetStringFromObj(basenameObj, &length);
- Tcl_WinUtfToTChar(string, length, &buf);
+ tclWinProcs->utf2tchar(string, length, &buf);
memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf));
namePtr += Tcl_DStringLength(&buf);
Tcl_DStringFree(&buf);
@@ -3217,7 +3217,7 @@ TclpOpenTemporaryFile(
sprintf(number, "%d.TMP", counter);
counter = (unsigned short) (counter + 1);
- Tcl_WinUtfToTChar(number, strlen(number), &buf);
+ tclWinProcs->utf2tchar(number, strlen(number), &buf);
memcpy(namePtr, Tcl_DStringValue(&buf), Tcl_DStringLength(&buf));
if (tclWinProcs->useWide) {
*(WCHAR *)(namePtr + Tcl_DStringLength(&buf) + 1) = '\0';
diff --git a/win/tclWinSerial.c b/win/tclWinSerial.c
index c3144e3..f05207f 100644
--- a/win/tclWinSerial.c
+++ b/win/tclWinSerial.c
@@ -11,7 +11,7 @@
*
* Serial functionality implemented by Rolf.Schroedter@dlr.de
*
- * RCS: @(#) $Id: tclWinSerial.c,v 1.41 2010/01/13 06:46:56 nijtmans Exp $
+ * RCS: @(#) $Id: tclWinSerial.c,v 1.42 2010/02/15 22:56:19 nijtmans Exp $
*/
#include "tclWinInt.h"
@@ -1682,7 +1682,7 @@ SerialSetOptionProc(
}
return TCL_ERROR;
}
- native = Tcl_WinUtfToTChar(value, -1, &ds);
+ native = tclWinProcs->utf2tchar(value, -1, &ds);
result = tclWinProcs->buildCommDCBProc(native, &dcb);
Tcl_DStringFree(&ds);