bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH v2] win32: don't force _WIN32_WINNT to a lower version
@ 2020-05-26 11:43 Steve Lhomme
  2020-05-26 20:38 ` Bruno Haible
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Lhomme @ 2020-05-26 11:43 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Steve Lhomme

---
 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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-28  5:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 11:43 [PATCH v2] win32: don't force _WIN32_WINNT to a lower version Steve Lhomme
2020-05-26 20:38 ` Bruno Haible
2020-05-27  6:16   ` Steve Lhomme
2020-05-28  0:12     ` Bruno Haible
2020-05-28  5:33       ` Steve Lhomme

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).