diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-04-16 09:28:54 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-04-16 09:28:54 (GMT) |
commit | 551367d26fffabaf2176de988521a98184f49ad0 (patch) | |
tree | 340c9f6f3cef2dd06af7d89c9f1e5567d9ffd05b /win/tclWinInit.c | |
parent | 630c5dd08faa0ca5deac0606be3ac1b36b82a6d3 (diff) | |
download | tcl-551367d26fffabaf2176de988521a98184f49ad0.zip tcl-551367d26fffabaf2176de988521a98184f49ad0.tar.gz tcl-551367d26fffabaf2176de988521a98184f49ad0.tar.bz2 |
Upgrade from Winsock 1.1 to Winsock 2.2, which is always available on Win2000+. See: [http://msdn.microsoft.com/en-us/library/windows/desktop/ms742213%28v=vs.85%29.aspx] for details.
Move winsock initialization to TclpInitPlatform(void), so we can be sure everywhere that we have an initialized winsock2.
Stub entries for TclWinGetServByName/TclWinGetSockOpt/TclWinSetSockOpt are no longer necessary (will be removed in 9.0, but are kept in 8.x)
Diffstat (limited to 'win/tclWinInit.c')
-rw-r--r-- | win/tclWinInit.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 2f3c7e8..4e860b2 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -113,8 +113,8 @@ static int ToUtf(CONST WCHAR *wSrc, char *dst); * * TclpInitPlatform -- * - * Initialize all the platform-dependant things like signals and - * floating-point error handling. + * Initialize all the platform-dependant things like signals, + * floating-point error handling and sockets. * * Called at process initialization time. * @@ -130,20 +130,16 @@ static int ToUtf(CONST WCHAR *wSrc, char *dst); void TclpInitPlatform(void) { - tclPlatform = TCL_PLATFORM_WINDOWS; + WSADATA wsaData; + WORD wVersionRequested = MAKEWORD(2, 2); - /* - * The following code stops Windows 3.X and Windows NT 3.51 from - * automatically putting up Sharing Violation dialogs, e.g, when someone - * tries to access a file that is locked or a drive with no disk in it. - * Tcl already returns the appropriate error to the caller, and they can - * decide to put up their own dialog in response to that failure. - * - * Under 95 and NT 4.0, this is a NOOP because the system doesn't - * automatically put up dialogs when the above operations fail. - */ + tclPlatform = TCL_PLATFORM_WINDOWS; - SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS); + /* + * Initialize the winsock library. On Windows XP and higher this + * can never fail. + */ + WSAStartup(wVersionRequested, &wsaData); #ifdef STATIC_BUILD /* |