diff options
Diffstat (limited to 'lib/stat-w32.c')
-rw-r--r-- | lib/stat-w32.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/stat-w32.c b/lib/stat-w32.c index 19bdfaa379..72442e9335 100644 --- a/lib/stat-w32.c +++ b/lib/stat-w32.c @@ -20,10 +20,22 @@ #if defined _WIN32 && ! defined __CYGWIN__ -/* Ensure that <windows.h> defines FILE_ID_INFO. */ -#if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8) -# undef _WIN32_WINNT -# define _WIN32_WINNT _WIN32_WINNT_WIN8 +/* Attempt to make <windows.h> define FILE_ID_INFO. + But ensure that the redefinition of _WIN32_WINNT does not make us assume + Windows Vista or newer when building for an older version of Windows. */ +#if HAVE_SDKDDKVER_H +# include <sdkddkver.h> +# if _WIN32_WINNT >= _WIN32_WINNT_VISTA +# define WIN32_ASSUME_VISTA 1 +# else +# define WIN32_ASSUME_VISTA 0 +# endif +# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8) +# undef _WIN32_WINNT +# define _WIN32_WINNT _WIN32_WINNT_WIN8 +# endif +#else +# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA) #endif #include <sys/types.h> @@ -46,7 +58,7 @@ #undef GetFinalPathNameByHandle #define GetFinalPathNameByHandle GetFinalPathNameByHandleA -#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA) +#if !WIN32_ASSUME_VISTA /* Avoid warnings from gcc -Wcast-function-type. */ # define GetProcAddress \ @@ -149,7 +161,7 @@ _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf) DWORD type = GetFileType (h); if (type == FILE_TYPE_DISK) { -#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA) +#if !WIN32_ASSUME_VISTA if (!initialized) initialize (); #endif |