diff options
Diffstat (limited to 'gnulib/import/stat-w32.c')
-rw-r--r-- | gnulib/import/stat-w32.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/gnulib/import/stat-w32.c b/gnulib/import/stat-w32.c index 19bdfaa..914707e 100644 --- a/gnulib/import/stat-w32.c +++ b/gnulib/import/stat-w32.c @@ -1,5 +1,5 @@ /* Core of implementation of fstat and stat for native Windows. - Copyright (C) 2017-2020 Free Software Foundation, Inc. + Copyright (C) 2017-2021 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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,12 @@ #undef GetFinalPathNameByHandle #define GetFinalPathNameByHandle GetFinalPathNameByHandleA -#if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA) +/* Older mingw headers do not define VOLUME_NAME_NONE. */ +#ifndef VOLUME_NAME_NONE +# define VOLUME_NAME_NONE 4 +#endif + +#if !WIN32_ASSUME_VISTA /* Avoid warnings from gcc -Wcast-function-type. */ # define GetProcAddress \ @@ -149,7 +166,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 |