# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1564124321 0 # Node ID 22e3e829be130170fc0b413cae5150681719721d # Parent 9ac432c8620c787a8c6116ce955e288f090af1d3 Win: Switch to using winsock 2.x, this will remove support for ancient versions of Windows like 95 and NT 3.5 and older... This allows us to use unix domain sockets with Windows 10 for the sockpipe() macro... (used in my HandyFTP application) When compiled with Visual Studio 2017 5.5 and newer will use unix domain sockets, however this may fail on older Windows 10 versions and older versions of Windows. I am not sure it is worth the effort to dual mode it, when it can just be compiled with an older compiler and function on older versions of Windows if necessary. diff -r 9ac432c8620c -r 22e3e829be13 dw.h --- a/dw.h Thu Jul 25 07:51:10 2019 +0000 +++ b/dw.h Fri Jul 26 06:58:41 2019 +0000 @@ -491,6 +491,7 @@ /* Windows specific section */ #if defined(__WIN32__) || defined(WINNT) +#include #include #include diff -r 9ac432c8620c -r 22e3e829be13 dwcompat.h --- a/dwcompat.h Thu Jul 25 07:51:10 2019 +0000 +++ b/dwcompat.h Fri Jul 26 06:58:41 2019 +0000 @@ -129,11 +129,7 @@ #define BKS_TABBEDDIALOG 0x0800 #endif -#define PIPENAME "\\socket\\" __TARGET__ "%d" -#define TPIPENAME "\\socket\\" __TARGET__ "%d" -#else -#define PIPENAME "/tmp/" __TARGET__ "%d" -#define TPIPENAME "/tmp/" __TARGET__ "%d" +#define PIPEROOT "\\socket\\" #endif /* __EMX__ || __IBMC__ */ #if defined(__OS2__) && (defined(__IBMC__) || defined(__WATCOMC__)) @@ -163,8 +159,8 @@ # endif #endif +#include #include -#include #include #include #include @@ -185,13 +181,21 @@ #include -#if defined(__CYGWIN32__) /*|| defined(__MINGW32__)*/ +/* Cygwin and Visual Studio 15.4 (SDK 10.0.16299.15) support domain sockets */ +#if defined(__CYGWIN32__) #include -#endif /* __CYGWIN32__ || __MINGW32__ */ +#elif defined(_MSC_VER) && _MSC_VER >= 1912 +#include +#define PIPEROOT "C:\\Windows\\Temp\\" +#else +#define NO_DOMAIN_SOCKETS +#endif -#ifndef __CYGWIN32__ -#define NO_DOMAIN_SOCKETS -#endif /* __CYGWIN32__ */ +#ifndef PIPEROOT +#define PIPEROOT "/tmp/" +#endif + +#define PIPENAME "%s" __TARGET__ "%d" #if defined(_P_NOWAIT) && !defined(P_NOWAIT) #define P_NOWAIT _P_NOWAIT @@ -318,7 +322,7 @@ #ifdef __IBMC__ #define sockinit() sock_init(); #elif defined(__WIN32__) || defined(WINNT) -#define sockinit() { static WSADATA wsa; WSAStartup(MAKEWORD (1, 1), &wsa); } +#define sockinit() { static WSADATA wsa; WSAStartup(MAKEWORD (2, 0), &wsa); } #else /* !WIN32 */ #define sockinit() #endif @@ -338,7 +342,7 @@ pipes[1] = socket(AF_UNIX, SOCK_STREAM, 0); \ memset(&un, 0, sizeof(un)); \ un.sun_family=AF_UNIX; \ - sprintf(un.sun_path, PIPENAME, pipes[1]); \ + sprintf(un.sun_path, PIPENAME, PIPEROOT, pipes[1]); \ bind(tmpsock, (struct sockaddr *)&un, sizeof(un)); \ listen(tmpsock, 0); \ connect(pipes[1], (struct sockaddr *)&un, sizeof(un)); \ diff -r 9ac432c8620c -r 22e3e829be13 win/browser.c --- a/win/browser.c Thu Jul 25 07:51:10 2019 +0000 +++ b/win/browser.c Fri Jul 26 06:58:41 2019 +0000 @@ -21,6 +21,7 @@ +#include #include #include // Defines of stuff like IWebBrowser2. This is an include file with Visual C 6 and above #include // Defines of stuff like IHTMLDocument2. This is an include file with Visual C 6 and above diff -r 9ac432c8620c -r 22e3e829be13 win/dirent.c --- a/win/dirent.c Thu Jul 25 07:51:10 2019 +0000 +++ b/win/dirent.c Fri Jul 26 06:58:41 2019 +0000 @@ -6,6 +6,7 @@ #include #include +#include #include #define _DW_INTERNAL diff -r 9ac432c8620c -r 22e3e829be13 win/dw.c --- a/win/dw.c Thu Jul 25 07:51:10 2019 +0000 +++ b/win/dw.c Fri Jul 26 06:58:41 2019 +0000 @@ -14,6 +14,7 @@ #define _WIN32_IE 0x0500 #define WINVER 0x500 #endif +#include #include #include #include