diff options
author | nijtmans <nijtmans> | 2010-09-09 14:30:20 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2010-09-09 14:30:20 (GMT) |
commit | d1ed32ffcf622ff5726f978e7243ae775dcb70d5 (patch) | |
tree | 3a47e54eec14bb4a5223118b306c2a7f04c021f9 /win | |
parent | 88f1f1e8378e9842ed80c24e5d0c5bb29cd75cf6 (diff) | |
download | tcl-d1ed32ffcf622ff5726f978e7243ae775dcb70d5.zip tcl-d1ed32ffcf622ff5726f978e7243ae775dcb70d5.tar.gz tcl-d1ed32ffcf622ff5726f978e7243ae775dcb70d5.tar.bz2 |
mingw should always link with -ladvapi32
Remove ascii variant of tkWinPocs table,
it is no longer necessary. Fix CreateProcess
signature and remove unused GetModuleFileName and lstrcpy
mingw/cygwin fixes: <tchar.h> should always
be included, and fix conflict in various macro values: Always force
the same values as in VC++.
Diffstat (limited to 'win')
-rwxr-xr-x | win/configure | 2 | ||||
-rw-r--r-- | win/makefile.vc | 22 | ||||
-rw-r--r-- | win/tcl.m4 | 28 | ||||
-rw-r--r-- | win/tclWin32Dll.c | 259 | ||||
-rw-r--r-- | win/tclWinInt.h | 8 | ||||
-rw-r--r-- | win/tclWinPipe.c | 4 | ||||
-rw-r--r-- | win/tclWinPort.h | 49 |
7 files changed, 80 insertions, 292 deletions
diff --git a/win/configure b/win/configure index 5d4614e..6715c57 100755 --- a/win/configure +++ b/win/configure @@ -3908,7 +3908,7 @@ echo "$as_me: WARNING: 64bit mode not supported with GCC on Windows" >&2;} fi SHLIB_LD="" SHLIB_LD_LIBS='${LIBS}' - LIBS="-lws2_32" + LIBS="-lkernel32 -luser32 -ladvapi32 -lws2_32" # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" STLIB_LD='${AR} cr' diff --git a/win/makefile.vc b/win/makefile.vc index 93db8bf..8e0ea11 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -5,7 +5,7 @@ # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# +# # Copyright (c) 1995-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # Copyright (c) 2001-2005 ActiveState Corporation. @@ -13,7 +13,7 @@ # Copyright (c) 2003-2008 Pat Thoyts. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.213 2010/08/04 21:37:19 hobbs Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.214 2010/09/09 14:30:20 nijtmans Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) @@ -93,7 +93,7 @@ the build instructions. # thrdalloc = Use the thread allocator (shared global free pool) # This is the default on threaded builds. # tclalloc = Use the old non-thread allocator -# symbols = Debug build. Links to the debug C runtime, disables +# symbols = Debug build. Links to the debug C runtime, disables # optimizations and creates pdb symbols files. # pdbs = Build detached symbols for release builds. # profile = Adds profiling hooks. Map file is assumed. @@ -116,7 +116,7 @@ the build instructions. # Sets special macros for checking compatability. # # nodep = Turns off compatability macros to ensure the core -# isn't being built with deprecated functions. +# isn't being built with deprecated functions. # fullwarn = Builds with full compiler and link warnings enabled. # Very verbose. # 64bit = Enable 64bit portability warnings (if available) @@ -130,7 +130,7 @@ the build instructions. # TMP_DIR=<path> # OUT_DIR=<path> # Hooks to allow the intermediate and output directories to be -# changed. $(OUT_DIR) is assumed to be +# changed. $(OUT_DIR) is assumed to be # $(BINROOT)\(Release|Debug) based on if symbols are requested. # $(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default. # @@ -448,7 +448,7 @@ PKGSDIR = $(ROOT)\pkgs ### This cranks the optimization level to maximize speed cdebug = -O2 $(OPTIMIZATIONS) !else -cdebug = +cdebug = !endif !if $(SYMBOLS) cdebug = $(cdebug) -Zi @@ -522,7 +522,7 @@ dlllflags = $(lflags) -dll conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows -baselibs = kernel32.lib user32.lib ws2_32.lib +baselibs = kernel32.lib user32.lib advapi32.lib ws2_32.lib # Avoid 'unresolved external symbol __security_cookie' errors. # c.f. http://support.microsoft.com/?id=894573 !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" @@ -836,8 +836,8 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in @LIBS@ $(baselibs) @prefix@ $(_INSTALLDIR) @exec_prefix@ $(BIN_INSTALL_DIR) -@SHLIB_CFLAGS@ -@STLIB_CFLAGS@ +@SHLIB_CFLAGS@ +@STLIB_CFLAGS@ @CFLAGS_WARNING@ -W3 @EXTRA_CFLAGS@ -YX @SHLIB_LD@ $(link32) $(dlllflags) @@ -855,7 +855,7 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in @TCL_INCLUDE_SPEC@ -I$(INCLUDE_INSTALL_DIR) @TCL_LIB_VERSIONS_OK@ @TCL_SRC_DIR@ $(ROOT) -@TCL_PACKAGE_PATH@ +@TCL_PACKAGE_PATH@ @TCL_STUB_LIB_FILE@ $(TCLSTUBLIBNAME) @TCL_STUB_LIB_FLAG@ $(TCLSTUBLIBNAME) @TCL_STUB_LIB_SPEC@ -L$(LIB_INSTALL_DIR) $(TCLSTUBLIBNAME) @@ -875,7 +875,7 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in #--------------------------------------------------------------------- -# The following target generates the file generic/tclDate.c +# The following target generates the file generic/tclDate.c # from the yacc grammar found in generic/tclGetDate.y. This is # only run by hand as yacc is not available in all environments. # The name of the .c file is different than the name of the .y file @@ -27,7 +27,7 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [ else TCL_BIN_DIR_DEFAULT=../../tcl/win fi - + AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.6 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DIR_DEFAULT; pwd`) if test ! -d $TCL_BIN_DIR; then @@ -67,7 +67,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ else TK_BIN_DIR_DEFAULT=../../tk/win fi - + AC_ARG_WITH(tk, [ --with-tk=DIR use Tk 8.6 binaries from DIR], TK_BIN_DIR=$withval, TK_BIN_DIR=`cd $TK_BIN_DIR_DEFAULT; pwd`) if test ! -d $TK_BIN_DIR; then @@ -86,7 +86,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ # Load the tclConfig.sh file. # # Arguments: -# +# # Requires the following vars to be set: # TCL_BIN_DIR # @@ -158,7 +158,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ # Currently a no-op for Windows # # Arguments: -# +# # Requires the following vars to be set: # TK_BIN_DIR # @@ -191,7 +191,7 @@ AC_DEFUN([SC_LOAD_TKCONFIG], [ # # Arguments: # none -# +# # Results: # # Adds the following arguments to configure: @@ -235,7 +235,7 @@ AC_DEFUN([SC_ENABLE_SHARED], [ # # Arguments: # none -# +# # Results: # # Adds the following arguments to configure: @@ -273,11 +273,11 @@ AC_DEFUN([SC_ENABLE_THREADS], [ # # Arguments: # none -# +# # Requires the following vars to be set in the Makefile: # CFLAGS_DEBUG # CFLAGS_OPTIMIZE -# +# # Results: # # Adds the following arguments to configure: @@ -463,7 +463,7 @@ file for information about building with Mingw.]) fi SHLIB_LD="" SHLIB_LD_LIBS='${LIBS}' - LIBS="-lws2_32" + LIBS="-lkernel32 -luser32 -ladvapi32 -lws2_32" # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" STLIB_LD='${AR} cr' @@ -543,7 +543,7 @@ file for information about building with Mingw.]) CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" - # Specify linker flags depending on the type of app being + # Specify linker flags depending on the type of app being # built -- Console vs. Window. # # ORIGINAL COMMENT: @@ -554,7 +554,7 @@ file for information about building with Mingw.]) # cross compiling. Remove this -e workaround once we # require a gcc that does not have this bug. # - # MK NOTE: Tk should use a different mechanism. This causes + # MK NOTE: Tk should use a different mechanism. This causes # interesting problems, such as wish dying at startup. #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" @@ -760,12 +760,12 @@ file for information about building with Mingw.]) CFLAGS_WARNING="-W3" LDFLAGS_DEBUG="-debug:full" LDFLAGS_OPTIMIZE="-release" - + # Specify the CC output file names based on the target name CC_OBJNAME="-Fo\[$]@" CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\"" - # Specify linker flags depending on the type of app being + # Specify linker flags depending on the type of app being # built -- Console vs. Window. if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then LDFLAGS_CONSOLE="-link ${lflags}" @@ -810,7 +810,7 @@ AC_DEFUN([SC_WITH_TCL], [ else TCL_BIN_DEFAULT=../../tcl8.6/win fi - + AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.6 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`) if test ! -d $TCL_BIN_DIR; then diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c index 6141e08..38c24e1 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.65 2010/08/04 21:28:00 hobbs Exp $ + * RCS: @(#) $Id: tclWin32Dll.c,v 1.66 2010/09/09 14:30:20 nijtmans Exp $ */ #include "tclWinInt.h" @@ -65,117 +65,19 @@ typedef struct EXCEPTION_REGISTRATION { 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); -} +#ifndef _MSC_VER +/* Missing from mingw/cygwin headers */ +BOOL WINAPI CreateHardLinkW(LPCTSTR, LPCTSTR, LPSECURITY_ATTRIBUTES); +BOOL WINAPI GetVolumeNameForVolumeMountPointW(LPCTSTR, LPTSTR, DWORD); +DWORD WINAPI GetLongPathNameW(LPCTSTR, LPTSTR, DWORD); +#endif /* - * The following function tables are used to dispatch to either the - * wide-character or multi-byte versions of the operating system calls, - * depending on whether the Unicode calls are available. + * The following function table is used to dispatch to wide-character + * versions of the operating system calls. */ -static TclWinProcs asciiProcs = { - 0, - (BOOL (WINAPI *)(const TCHAR *, LPDCB)) BuildCommDCBA, - (TCHAR *(WINAPI *)(TCHAR *)) CharLowerA, - (BOOL (WINAPI *)(const TCHAR *, const TCHAR *, BOOL)) CopyFileA, - (BOOL (WINAPI *)(const TCHAR *, LPSECURITY_ATTRIBUTES)) CreateDirectoryA, - (HANDLE (WINAPI *)(const TCHAR *, DWORD, DWORD, SECURITY_ATTRIBUTES *, - DWORD, DWORD, HANDLE)) CreateFileA, - (BOOL (WINAPI *)(const TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES, - LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, const TCHAR *, - LPSTARTUPINFOA, LPPROCESS_INFORMATION)) CreateProcessA, - (BOOL (WINAPI *)(const TCHAR *)) DeleteFileA, - (HANDLE (WINAPI *)(const TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileA, - (BOOL (WINAPI *)(HANDLE, WIN32_FIND_DATAT *)) FindNextFileA, - (BOOL (WINAPI *)(TCHAR *, LPDWORD)) GetComputerNameA, - (DWORD (WINAPI *)(DWORD, TCHAR *)) GetCurrentDirectoryA, - (DWORD (WINAPI *)(const TCHAR *)) GetFileAttributesA, - (DWORD (WINAPI *)(const TCHAR *, DWORD nBufferLength, TCHAR *, - TCHAR **)) GetFullPathNameA, - (DWORD (WINAPI *)(HMODULE, TCHAR *, int)) GetModuleFileNameA, - (DWORD (WINAPI *)(const TCHAR *, TCHAR *, DWORD)) GetShortPathNameA, - (UINT (WINAPI *)(const TCHAR *, const TCHAR *, UINT uUnique, - TCHAR *)) GetTempFileNameA, - (DWORD (WINAPI *)(DWORD, TCHAR *)) GetTempPathA, - (BOOL (WINAPI *)(const TCHAR *, TCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD, - TCHAR *, DWORD)) GetVolumeInformationA, - (HINSTANCE (WINAPI *)(const TCHAR *, HANDLE, DWORD)) LoadLibraryExA, - (TCHAR (WINAPI *)(TCHAR *, const TCHAR *)) lstrcpyA, - (BOOL (WINAPI *)(const TCHAR *, const TCHAR *)) MoveFileA, - (BOOL (WINAPI *)(const TCHAR *)) RemoveDirectoryA, - (DWORD (WINAPI *)(const TCHAR *, const TCHAR *, const TCHAR *, DWORD, - TCHAR *, TCHAR **)) SearchPathA, - (BOOL (WINAPI *)(const TCHAR *)) SetCurrentDirectoryA, - (BOOL (WINAPI *)(const TCHAR *, DWORD)) SetFileAttributesA, - - /* - * The three NULL function pointers will only be set when - * Tcl_FindExecutable is called. If you don't ever call that function, the - * application will crash whenever WinTcl tries to call functions through - * these null pointers. That is not a bug in Tcl - Tcl_FindExecutable is - * mandatory in recent Tcl releases. - */ - - NULL, - NULL, - NULL, - NULL, - /* getLongPathNameProc */ - NULL, - /* Security SDK - not available on 95,98,ME */ - NULL, NULL, NULL, NULL, NULL, NULL, - /* 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, - utf2win, - win2utf -}; - -static TclWinProcs unicodeProcs = { +static const TclWinProcs winProcs = { 1, (BOOL (WINAPI *)(const TCHAR *, LPDCB)) BuildCommDCBW, (TCHAR *(WINAPI *)(TCHAR *)) CharLowerW, @@ -185,7 +87,7 @@ static TclWinProcs unicodeProcs = { DWORD, DWORD, HANDLE)) CreateFileW, (BOOL (WINAPI *)(const TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, const TCHAR *, - LPSTARTUPINFOA, LPPROCESS_INFORMATION)) CreateProcessW, + LPSTARTUPINFO, LPPROCESS_INFORMATION)) CreateProcessW, (BOOL (WINAPI *)(const TCHAR *)) DeleteFileW, (HANDLE (WINAPI *)(const TCHAR *, WIN32_FIND_DATAT *)) FindFirstFileW, (BOOL (WINAPI *)(HANDLE, WIN32_FIND_DATAT *)) FindNextFileW, @@ -194,7 +96,6 @@ static TclWinProcs unicodeProcs = { (DWORD (WINAPI *)(const TCHAR *)) GetFileAttributesW, (DWORD (WINAPI *)(const TCHAR *, DWORD nBufferLength, TCHAR *, TCHAR **)) GetFullPathNameW, - (DWORD (WINAPI *)(HMODULE, TCHAR *, int)) GetModuleFileNameW, (DWORD (WINAPI *)(const TCHAR *, TCHAR *, DWORD)) GetShortPathNameW, (UINT (WINAPI *)(const TCHAR *, const TCHAR *, UINT uUnique, TCHAR *)) GetTempFileNameW, @@ -202,39 +103,33 @@ static TclWinProcs unicodeProcs = { (BOOL (WINAPI *)(const TCHAR *, TCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD, TCHAR *, DWORD)) GetVolumeInformationW, (HINSTANCE (WINAPI *)(const TCHAR *, HANDLE, DWORD)) LoadLibraryExW, - (TCHAR (WINAPI *)(TCHAR *, const TCHAR *)) lstrcpyW, (BOOL (WINAPI *)(const TCHAR *, const TCHAR *)) MoveFileW, (BOOL (WINAPI *)(const TCHAR *)) RemoveDirectoryW, (DWORD (WINAPI *)(const TCHAR *, const TCHAR *, const TCHAR *, DWORD, TCHAR *, TCHAR **)) SearchPathW, (BOOL (WINAPI *)(const TCHAR *)) SetCurrentDirectoryW, (BOOL (WINAPI *)(const TCHAR *, DWORD)) SetFileAttributesW, - - /* - * The three NULL function pointers will only be set when - * Tcl_FindExecutable is called. If you don't ever call that function, the - * application will crash whenever WinTcl tries to call functions through - * these null pointers. That is not a bug in Tcl - Tcl_FindExecutable is - * mandatory in recent Tcl releases. - */ - - NULL, - NULL, - NULL, - NULL, - /* getLongPathNameProc */ - NULL, + (BOOL (WINAPI *)(const TCHAR *, GET_FILEEX_INFO_LEVELS, + LPVOID)) GetFileAttributesExW, + (BOOL (WINAPI *)(const TCHAR *, const TCHAR*, + LPSECURITY_ATTRIBUTES)) CreateHardLinkW, + (HANDLE (WINAPI *)(const TCHAR*, UINT, LPVOID, UINT, + LPVOID, DWORD)) FindFirstFileExW, + (BOOL (WINAPI *)(const TCHAR*, TCHAR*, + DWORD)) GetVolumeNameForVolumeMountPointW, + (DWORD (WINAPI *)(const TCHAR*, TCHAR*, + DWORD)) GetLongPathNameW, /* Security SDK - will be filled in on NT,XP,2000,2003 */ - NULL, NULL, NULL, NULL, NULL, NULL, + GetFileSecurityW, ImpersonateSelf, OpenThreadToken, RevertToSelf, MapGenericMask, AccessCheck, /* 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, - utf2wchar, - wchar2utf + (const TCHAR *(*)(const char *, int, Tcl_DString *)) Tcl_WinUtfToTChar, + (const char *(*)(const TCHAR *, int, Tcl_DString *)) Tcl_WinTCharToUtf }; -const TclWinProcs *tclWinProcs = &asciiProcs; +const TclWinProcs *const tclWinProcs = &winProcs; /* * The following declaration is for the VC++ DLL entry point. @@ -492,98 +387,11 @@ TclWinSetInterfaces( { TclWinResetInterfaces(); +#ifdef _UNICODE if (wide) { winTCharEncoding = Tcl_GetEncoding(NULL, "unicode"); - if (unicodeProcs.getFileAttributesExProc == NULL) { - HINSTANCE hInstance = LoadLibraryA("kernel32"); - - if (hInstance != NULL) { - unicodeProcs.getFileAttributesExProc = - (BOOL (WINAPI *)(const TCHAR *, GET_FILEEX_INFO_LEVELS, - LPVOID)) GetProcAddress(hInstance, - "GetFileAttributesExW"); - unicodeProcs.createHardLinkProc = - (BOOL (WINAPI *)(const TCHAR *, const TCHAR*, - LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance, - "CreateHardLinkW"); - unicodeProcs.findFirstFileExProc = - (HANDLE (WINAPI *)(const TCHAR*, UINT, LPVOID, UINT, - LPVOID, DWORD)) GetProcAddress(hInstance, - "FindFirstFileExW"); - unicodeProcs.getVolumeNameForVMPProc = - (BOOL (WINAPI *)(const TCHAR*, TCHAR*, - DWORD)) GetProcAddress(hInstance, - "GetVolumeNameForVolumeMountPointW"); - unicodeProcs.getLongPathNameProc = - (DWORD (WINAPI *)(const TCHAR*, TCHAR*, - DWORD)) GetProcAddress(hInstance, "GetLongPathNameW"); - FreeLibrary(hInstance); - } - hInstance = LoadLibraryA("advapi32"); - if (hInstance != NULL) { - unicodeProcs.getFileSecurityProc = (BOOL (WINAPI *)( - LPCTSTR lpFileName, - SECURITY_INFORMATION RequestedInformation, - PSECURITY_DESCRIPTOR pSecurityDescriptor, - DWORD nLength, LPDWORD lpnLengthNeeded)) - GetProcAddress(hInstance, "GetFileSecurityW"); - unicodeProcs.impersonateSelfProc = (BOOL (WINAPI *) ( - SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)) - GetProcAddress(hInstance, "ImpersonateSelf"); - unicodeProcs.openThreadTokenProc = (BOOL (WINAPI *) ( - HANDLE ThreadHandle, DWORD DesiredAccess, - BOOL OpenAsSelf, PHANDLE TokenHandle)) - GetProcAddress(hInstance, "OpenThreadToken"); - unicodeProcs.revertToSelfProc = (BOOL (WINAPI *) (void)) - GetProcAddress(hInstance, "RevertToSelf"); - unicodeProcs.mapGenericMaskProc = (void (WINAPI *) ( - PDWORD AccessMask, PGENERIC_MAPPING GenericMapping)) - GetProcAddress(hInstance, "MapGenericMask"); - unicodeProcs.accessCheckProc = (BOOL (WINAPI *)( - PSECURITY_DESCRIPTOR pSecurityDescriptor, - HANDLE ClientToken, DWORD DesiredAccess, - PGENERIC_MAPPING GenericMapping, - PPRIVILEGE_SET PrivilegeSet, - LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, - LPBOOL AccessStatus)) GetProcAddress(hInstance, - "AccessCheck"); - FreeLibrary(hInstance); - } - } - tclWinProcs = &unicodeProcs; - } else { - if (asciiProcs.getFileAttributesExProc == NULL) { - HINSTANCE hInstance = LoadLibraryA("kernel32"); - if (hInstance != NULL) { - asciiProcs.getFileAttributesExProc = - (BOOL (WINAPI *)(const TCHAR *, GET_FILEEX_INFO_LEVELS, - LPVOID)) GetProcAddress(hInstance, - "GetFileAttributesExA"); - asciiProcs.createHardLinkProc = - (BOOL (WINAPI *)(const TCHAR *, const TCHAR*, - LPSECURITY_ATTRIBUTES)) GetProcAddress(hInstance, - "CreateHardLinkA"); - asciiProcs.findFirstFileExProc = NULL; - asciiProcs.getLongPathNameProc = NULL; - /* - * The 'findFirstFileExProc' function exists on some of - * 95/98/ME, but it seems not to work as anticipated. - * Therefore we don't set this function pointer. The relevant - * code will fall back on a slower approach using the normal - * findFirstFileProc. - * - * (HANDLE (WINAPI *)(const TCHAR*, UINT, - * LPVOID, UINT, LPVOID, DWORD)) GetProcAddress(hInstance, - * "FindFirstFileExA"); - */ - asciiProcs.getVolumeNameForVMPProc = - (BOOL (WINAPI *)(const TCHAR*, TCHAR*, - DWORD)) GetProcAddress(hInstance, - "GetVolumeNameForVolumeMountPointA"); - FreeLibrary(hInstance); - } - } } +#endif } /* @@ -654,7 +462,6 @@ TclWinResetInterfaces(void) Tcl_FreeEncoding(winTCharEncoding); winTCharEncoding = NULL; } - tclWinProcs = &asciiProcs; } /* @@ -873,11 +680,7 @@ Tcl_WinUtfToTChar( Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { - Tcl_Encoding encoding = NULL; - if (platformId != VER_PLATFORM_WIN32_WINDOWS) { - encoding = winTCharEncoding; - } - return (TCHAR *) Tcl_UtfToExternalDString(encoding, + return (TCHAR *) Tcl_UtfToExternalDString(winTCharEncoding, string, len, dsPtr); } @@ -890,11 +693,7 @@ Tcl_WinTCharToUtf( Tcl_DString *dsPtr) /* Uninitialized or free DString in which the * converted string is stored. */ { - Tcl_Encoding encoding = NULL; - if (platformId != VER_PLATFORM_WIN32_WINDOWS) { - encoding = winTCharEncoding; - } - return Tcl_ExternalToUtfDString(encoding, + return Tcl_ExternalToUtfDString(winTCharEncoding, (const char *) string, len, dsPtr); } diff --git a/win/tclWinInt.h b/win/tclWinInt.h index b60991d..94aa045 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.36 2010/08/04 19:35:22 hobbs Exp $ + * RCS: @(#) $Id: tclWinInt.h,v 1.37 2010/09/09 14:30:20 nijtmans Exp $ */ #ifndef _TCLWININT @@ -50,7 +50,7 @@ typedef struct TclWinProcs { LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE); BOOL (WINAPI *createProcessProc)(const TCHAR *, TCHAR *, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, - LPVOID, const TCHAR *, LPSTARTUPINFOA, LPPROCESS_INFORMATION); + LPVOID, const TCHAR *, LPSTARTUPINFO, LPPROCESS_INFORMATION); BOOL (WINAPI *deleteFileProc)(const TCHAR *); HANDLE (WINAPI *findFirstFileProc)(const TCHAR *, WIN32_FIND_DATAT *); BOOL (WINAPI *findNextFileProc)(HANDLE, WIN32_FIND_DATAT *); @@ -59,7 +59,6 @@ typedef struct TclWinProcs { DWORD (WINAPI *getFileAttributesProc)(const TCHAR *); DWORD (WINAPI *getFullPathNameProc)(const TCHAR *, DWORD, TCHAR *, TCHAR **); - DWORD (WINAPI *getModuleFileNameProc)(HMODULE, TCHAR *, int); DWORD (WINAPI *getShortPathNameProc)(const TCHAR *, TCHAR *, DWORD); UINT (WINAPI *getTempFileNameProc)(const TCHAR *, const TCHAR *, UINT, TCHAR *); @@ -67,7 +66,6 @@ typedef struct TclWinProcs { BOOL (WINAPI *getVolumeInformationProc)(const TCHAR *, TCHAR *, DWORD, LPDWORD, LPDWORD, LPDWORD, TCHAR *, DWORD); HINSTANCE (WINAPI *loadLibraryExProc)(const TCHAR *, HANDLE, DWORD); - TCHAR (WINAPI *lstrcpyProc)(TCHAR *, const TCHAR *); BOOL (WINAPI *moveFileProc)(const TCHAR *, const TCHAR *); BOOL (WINAPI *removeDirectoryProc)(const TCHAR *); DWORD (WINAPI *searchPathProc)(const TCHAR *, const TCHAR *, @@ -115,7 +113,7 @@ typedef struct TclWinProcs { const char *(*tchar2utf)(const TCHAR *, int, Tcl_DString *); } TclWinProcs; -MODULE_SCOPE const TclWinProcs *tclWinProcs; +MODULE_SCOPE const TclWinProcs *const tclWinProcs; /* * Declarations of functions that are not accessible by way of the diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c index 86c546b..a71e5af 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.81 2010/08/30 09:19:38 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPipe.c,v 1.82 2010/09/09 14:30:20 nijtmans Exp $ */ #include "tclWinInt.h" @@ -953,7 +953,7 @@ TclpCreateProcess( { int result, applType, createFlags; Tcl_DString cmdLine; /* Complete command line (TCHAR). */ - STARTUPINFOA startInfo; + STARTUPINFO startInfo; PROCESS_INFORMATION procInfo; SECURITY_ATTRIBUTES secAtts; HANDLE hProcess, h, inputHandle, outputHandle, errorHandle; diff --git a/win/tclWinPort.h b/win/tclWinPort.h index 481a396..1acf980 100644 --- a/win/tclWinPort.h +++ b/win/tclWinPort.h @@ -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: tclWinPort.h,v 1.59 2010/06/24 13:26:04 nijtmans Exp $ + * RCS: @(#) $Id: tclWinPort.h,v 1.60 2010/09/09 14:30:20 nijtmans Exp $ */ #ifndef _TCLWINPORT @@ -38,13 +38,11 @@ /* * Pull in the typedef of TCHAR for windows. */ -#if !defined(_TCHAR_DEFINED) -# include <tchar.h> -# ifndef _TCHAR_DEFINED - /* Borland seems to forget to set this. */ - typedef _TCHAR TCHAR; -# define _TCHAR_DEFINED -# endif +#include <tchar.h> +#ifndef _TCHAR_DEFINED + /* Borland seems to forget to set this. */ + typedef _TCHAR TCHAR; +# define _TCHAR_DEFINED #endif /* @@ -234,27 +232,20 @@ #endif -#ifndef ESOCKTNOSUPPORT -# define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT /* Socket type not supported */ -#endif -#ifndef ESHUTDOWN -# define ESHUTDOWN WSAESHUTDOWN /* Can't send after socket shutdown */ -#endif -#ifndef ETOOMANYREFS -# define ETOOMANYREFS WSAETOOMANYREFS /* Too many references: can't splice */ -#endif -#ifndef EHOSTDOWN -# define EHOSTDOWN WSAEHOSTDOWN /* Host is down */ -#endif -#ifndef EUSERS -# define EUSERS WSAEUSERS /* Too many users (for UFS) */ -#endif -#ifndef EDQUOT -# define EDQUOT WSAEDQUOT /* Disc quota exceeded */ -#endif -#ifndef ESTALE -# define ESTALE WSAESTALE /* Stale NFS file handle */ -#endif +#undef ESOCKTNOSUPPORT +#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT /* Socket type not supported */ +#undef ESHUTDOWN +#define ESHUTDOWN WSAESHUTDOWN /* Can't send after socket shutdown */ +#undef ETOOMANYREFS +#define ETOOMANYREFS WSAETOOMANYREFS /* Too many references: can't splice */ +#undef EHOSTDOWN +#define EHOSTDOWN WSAEHOSTDOWN /* Host is down */ +#undef EUSERS +#define EUSERS WSAEUSERS /* Too many users (for UFS) */ +#undef EDQUOT +#define EDQUOT WSAEDQUOT /* Disc quota exceeded */ +#undef ESTALE +#define ESTALE WSAESTALE /* Stale NFS file handle */ /* * Signals not known to the standard ANSI signal.h. These are used |