Hi all, As discussed here, there is in the tree a couple of things related to past versions of Windows: https://www.postgresql.org/message-id/[email protected]
So I have been looking at that more closely, and found more: - MIN_WINNT can be removed from win32.h thanks to d9dd406 which has added a requirement on C99 with Windows 7 as minimum platform supported. (The issue mentioned previously.) - pipe_read_line(), used when finding another binary for a given installation via find_other_exec() has some special handling related to Windows 2000 and older versions. - When trying to load getaddrinfo(), we try to load it from wship6.ddl, which was something needed in Windows 2000, but newer Windows versions include it in ws2_32.dll. - A portion of the docs still refer to Windows 98. Thoughts? -- Michael
diff --git a/src/include/port/win32.h b/src/include/port/win32.h
index bb2f7540b3..728d6badb5 100644
--- a/src/include/port/win32.h
+++ b/src/include/port/win32.h
@@ -9,27 +9,6 @@
#define WIN32
#endif
-/*
- * Make sure _WIN32_WINNT has the minimum required value.
- * Leave a higher value in place. When building with at least Visual
- * Studio 2015 the minimum requirement is Windows Vista (0x0600) to
- * get support for GetLocaleInfoEx() with locales. For everything else
- * the minimum version is Windows XP (0x0501).
- */
-#if defined(_MSC_VER) && _MSC_VER >= 1900
-#define MIN_WINNT 0x0600
-#else
-#define MIN_WINNT 0x0501
-#endif
-
-#if defined(_WIN32_WINNT) && _WIN32_WINNT < MIN_WINNT
-#undef _WIN32_WINNT
-#endif
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT MIN_WINNT
-#endif
-
/*
* We need to prevent <crtdefs.h> from defining a symbol conflicting with
* our errcode() function. Since it's likely to get included by standard
diff --git a/src/common/exec.c b/src/common/exec.c
index 92dc3134a1..3f038d9214 100644
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -364,7 +364,6 @@ find_other_exec(const char *argv0, const char *target,
static char *
pipe_read_line(char *cmd, char *line, int maxsize)
{
-#ifndef WIN32
FILE *pgver;
/* flush output buffers in case popen does not... */
@@ -393,130 +392,6 @@ pipe_read_line(char *cmd, char *line, int maxsize)
return NULL;
return line;
-#else /* WIN32 */
-
- SECURITY_ATTRIBUTES sattr;
- HANDLE childstdoutrd,
- childstdoutwr,
- childstdoutrddup;
- PROCESS_INFORMATION pi;
- STARTUPINFO si;
- char *retval = NULL;
-
- sattr.nLength = sizeof(SECURITY_ATTRIBUTES);
- sattr.bInheritHandle = TRUE;
- sattr.lpSecurityDescriptor = NULL;
-
- if (!CreatePipe(&childstdoutrd, &childstdoutwr, &sattr, 0))
- return NULL;
-
- if (!DuplicateHandle(GetCurrentProcess(),
- childstdoutrd,
- GetCurrentProcess(),
- &childstdoutrddup,
- 0,
- FALSE,
- DUPLICATE_SAME_ACCESS))
- {
- CloseHandle(childstdoutrd);
- CloseHandle(childstdoutwr);
- return NULL;
- }
-
- CloseHandle(childstdoutrd);
-
- ZeroMemory(&pi, sizeof(pi));
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
- si.dwFlags = STARTF_USESTDHANDLES;
- si.hStdError = childstdoutwr;
- si.hStdOutput = childstdoutwr;
- si.hStdInput = INVALID_HANDLE_VALUE;
-
- if (CreateProcess(NULL,
- cmd,
- NULL,
- NULL,
- TRUE,
- 0,
- NULL,
- NULL,
- &si,
- &pi))
- {
- /* Successfully started the process */
- char *lineptr;
-
- ZeroMemory(line, maxsize);
-
- /* Try to read at least one line from the pipe */
- /* This may require more than one wait/read attempt */
- for (lineptr = line; lineptr < line + maxsize - 1;)
- {
- DWORD bytesread = 0;
-
- /* Let's see if we can read */
- if (WaitForSingleObject(childstdoutrddup, 10000) != WAIT_OBJECT_0)
- break; /* Timeout, but perhaps we got a line already */
-
- if (!ReadFile(childstdoutrddup, lineptr, maxsize - (lineptr - line),
- &bytesread, NULL))
- break; /* Error, but perhaps we got a line already */
-
- lineptr += strlen(lineptr);
-
- if (!bytesread)
- break; /* EOF */
-
- if (strchr(line, '\n'))
- break; /* One or more lines read */
- }
-
- if (lineptr != line)
- {
- /* OK, we read some data */
- int len;
-
- /* If we got more than one line, cut off after the first \n */
- lineptr = strchr(line, '\n');
- if (lineptr)
- *(lineptr + 1) = '\0';
-
- len = strlen(line);
-
- /*
- * If EOL is \r\n, convert to just \n. Because stdout is a
- * text-mode stream, the \n output by the child process is
- * received as \r\n, so we convert it to \n. The server main.c
- * sets setvbuf(stdout, NULL, _IONBF, 0) which has the effect of
- * disabling \n to \r\n expansion for stdout.
- */
- if (len >= 2 && line[len - 2] == '\r' && line[len - 1] == '\n')
- {
- line[len - 2] = '\n';
- line[len - 1] = '\0';
- len--;
- }
-
- /*
- * We emulate fgets() behaviour. So if there is no newline at the
- * end, we add one...
- */
- if (len == 0 || line[len - 1] != '\n')
- strcat(line, "\n");
-
- retval = line;
- }
-
- CloseHandle(pi.hProcess);
- CloseHandle(pi.hThread);
- }
-
- CloseHandle(childstdoutwr);
- CloseHandle(childstdoutrddup);
-
- return retval;
-#endif /* WIN32 */
}
diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c
index 9e5829b6dd..4dce138a09 100644
--- a/src/port/getaddrinfo.c
+++ b/src/port/getaddrinfo.c
@@ -69,10 +69,9 @@ haveNativeWindowsIPv6routines(void)
return (getaddrinfo_ptr != NULL);
/*
- * For Windows XP and Windows 2003 (and longhorn/vista), the IPv6 routines
- * are present in the WinSock 2 library (ws2_32.dll). Try that first
+ * For Windows XP and later versions, the IPv6 routines are present in
+ * the WinSock 2 library (ws2_32.dll).
*/
-
hLibrary = LoadLibraryA("ws2_32");
if (hLibrary == NULL || GetProcAddress(hLibrary, "getaddrinfo") == NULL)
@@ -83,13 +82,6 @@ haveNativeWindowsIPv6routines(void)
*/
if (hLibrary != NULL)
FreeLibrary(hLibrary);
-
- /*
- * In Windows 2000, there was only the IPv6 Technology Preview look in
- * the IPv6 WinSock library (wship6.dll).
- */
-
- hLibrary = LoadLibraryA("wship6");
}
/* If hLibrary is null, we couldn't find a dll with functions */
diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml
index 08556b6ebe..178228b152 100644
--- a/doc/src/sgml/install-windows.sgml
+++ b/doc/src/sgml/install-windows.sgml
@@ -42,13 +42,8 @@
<productname>MinGW-w64</productname>. These tools can also be used to
cross-compile for 32 bit and 64 bit <productname>Windows</productname>
targets on other hosts, such as <productname>Linux</productname> and
- <productname>macOS</productname>.
- <productname>Cygwin</productname> is not recommended for running a
- production server, and it should only be used for running on
- older versions of <productname>Windows</productname> where
- the native build does not work, such as
- <productname>Windows 98</productname>. The official
- binaries are built using <productname>Visual Studio</productname>.
+ <productname>macOS</productname>. The official binaries are built using
+ <productname>Visual Studio</productname>.
</para>
<para>
signature.asc
Description: PGP signature
