bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] win32: don't force _WIN32_WINNT to a lower version


From: Steve Lhomme
Subject: [PATCH v2] win32: don't force _WIN32_WINNT to a lower version
Date: Tue, 26 May 2020 13:43:24 +0200

---
 lib/ftruncate.c   | 2 ++
 lib/sethostname.c | 6 ++++--
 lib/stat-w32.c    | 6 ++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/ftruncate.c b/lib/ftruncate.c
index a1856374e..990b71dbb 100644
--- a/lib/ftruncate.c
+++ b/lib/ftruncate.c
@@ -30,8 +30,10 @@
    argument.  So, define a 64-bit safe SetFileSize function ourselves.  */
 
 /* Ensure that <windows.h> declares GetFileSizeEx.  */
+#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0500
 #  undef _WIN32_WINNT
 #  define _WIN32_WINNT _WIN32_WINNT_WIN2K
+#endif
 
 /* Get declarations of the native Windows API functions.  */
 #  define WIN32_LEAN_AND_MEAN
diff --git a/lib/sethostname.c b/lib/sethostname.c
index 87b3af958..379e6ca13 100644
--- a/lib/sethostname.c
+++ b/lib/sethostname.c
@@ -88,8 +88,10 @@ sethostname (const char *name, size_t len)
 /* Native Windows API.  Also used on Cygwin.  */
 
 /* Ensure that <windows.h> declares SetComputerNameEx.  */
-#undef _WIN32_WINNT
-#define _WIN32_WINNT _WIN32_WINNT_WIN2K
+#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0500
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT _WIN32_WINNT_WIN2K
+#endif
 
 #define WIN32_LEAN_AND_MEAN
 
diff --git a/lib/stat-w32.c b/lib/stat-w32.c
index 5048093e6..69b06740f 100644
--- a/lib/stat-w32.c
+++ b/lib/stat-w32.c
@@ -21,8 +21,10 @@
 #if defined _WIN32 && ! defined __CYGWIN__
 
 /* Ensure that <windows.h> defines FILE_ID_INFO.  */
-#undef _WIN32_WINNT
-#define _WIN32_WINNT _WIN32_WINNT_WIN8
+#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT _WIN32_WINNT_WIN8
+#endif
 
 #include <sys/types.h>
 #include <sys/stat.h>
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]