[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compilation problems with stat-w32.c
From: |
Bruno Haible |
Subject: |
Re: Compilation problems with stat-w32.c |
Date: |
Wed, 16 Sep 2020 23:54:28 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; ) |
Hi Eli,
You are right on both accounts. Thanks for the reports. Should be fixed
by the two attached patches.
> This happens because stat-w32.c unconditionally sets _WIN32_WINNT to
> the value suitable for Windows 8.0 or later:
>
> #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
> #endif
>
> which later on causes it to expect GetFinalPathNameByHandle to be in
> kernel32.dll, instead of dynamically loading it:
>
> #if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
Yes, an obvious mistake.
> In addition, VOLUME_NAME_NONE is used here, but the Windows headers
> define it only when _WIN32_WINNT is greater or equal to
> _WIN32_WINNT_VISTA
In the MSVC9, MSVC14, and mingw64 headers, I find VOLUME_NAME_NONE
to be always defined. And in some old mingw headers from 2003, I find it
to be never defined.
Bruno
2020-09-16 Bruno Haible <bruno@clisp.org>
stat, fstat: Fix compilation error with old mingw headers.
Reported by Eli Zaretskii <eliz@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00027.html>.
* lib/stat-w32.c (VOLUME_NAME_NONE): Define if the Windows headers don't
define it.
2020-09-16 Bruno Haible <bruno@clisp.org>
stat, fstat: Fix when compiling for versions older than Windows Vista.
Reported by Eli Zaretskii <eliz@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-09/msg00027.html>.
* lib/stat-w32.c: Include <sdkddkver.h>. Test the value of _WIN32_WINNT
that was originally set before we redefined it.
* m4/stat.m4 (gl_PREREQ_STAT_W32): New macro.
(gl_PREREQ_STAT): Require it.
* m4/fstat.m4 (gl_PREREQ_FSTAT): Likewise.
0001-stat-fstat-Fix-when-compiling-for-versions-older-tha.patch
Description: Text Data
0002-stat-fstat-Fix-compilation-error-with-old-mingw-head.patch
Description: Text Data