[PATCH] Ensure PSAPI_VERSION is 1 when building ldd

Jon Turney jon.turney@dronecode.org.uk
Thu May 20 17:46:35 GMT 2021


The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building ldd, which gets PSAPI_VERSION=2.

This causes K32GetModuleFileNameEx to be used for GetFileNameFromHandle,
which isn't available on Windows Vista.

Define PSAPI_VERSION as 1 for the built executable to work on Windows
Vista.
---
 winsup/utils/ldd.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/winsup/utils/ldd.cc b/winsup/utils/ldd.cc
index 1e1863c1c..d370db986 100644
--- a/winsup/utils/ldd.cc
+++ b/winsup/utils/ldd.cc
@@ -38,6 +38,7 @@
 #include <libgen.h>
 
 #define _WIN32_WINNT 0x0a00
+#define PSAPI_VERSION 1
 #include <windows.h>
 #include <winternl.h>
 #include <imagehlp.h>
-- 
2.31.1



More information about the Cygwin-patches mailing list