[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Compilation problems with stat-w32.c
From: |
Eli Zaretskii |
Subject: |
Compilation problems with stat-w32.c |
Date: |
Thu, 10 Sep 2020 17:22:20 +0300 |
I've built today's snapshot of GDB on MS-Windows, and bumped into a
problem: starting the produced binary on Windows XP fails with this
message:
The procedure entry point GetFinalPathNameByHandleA could not be
located in the dynamic link library KERNEL32.dll.
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)
[...]
#else
# define GetFileInformationByHandleExFunc GetFileInformationByHandleEx
# define GetFinalPathNameByHandleFunc GetFinalPathNameByHandle
#endif
The code I elided and replaced with "[...]" sets up to load the above
two APIs dynamically, and is capable of coping with these two
functions being unavailable. But it is never used, due to the
redefinition of _WIN32_WINNT above. That looks like a bug, or what am
I missing?
Please also note that these APIs are only needed if
_GL_WINDOWS_STAT_INODES is 2, so for lower values of
_GL_WINDOWS_STAT_INODES this redefinition is not needed at all.
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, so for lower values I suggest to simple define it,
something like:
#elif !defined VOLUME_NAME_NONE
# define VOLUME_NAME_NONE 0x4
#endif
Thanks.
- Compilation problems with stat-w32.c,
Eli Zaretskii <=