Cygwin: Define PSAPI_VERSION as 1 before including psapi.h

The default PSAPI_VERSION is controlled by WIN32_WINNT, which we set to
0x0a00 when building utils since 48a76190 (and is the default in w32api
>= 9.0.0)

In order for the built executables to run on Windows Vista, we must also
define PSAPI_VERSION as 1 (otherwise '#define GetModuleFileNameExA
K32GetModuleFileNameExA' causes a 'The procedure entry point
K32GetModuleFilenameExA could not be located in the dynamic link library
kernel32.dll' error at run time).

Also drop uneeded psapi.h from dlfcn.cc (31ddf45d), resource.cc
(34a6eeab) and ps.cc (1def2148).
This commit is contained in:
Jon Turney 2021-05-20 18:28:01 +01:00
parent e6b667f1a4
commit 9a231073a5
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
8 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include "winsup.h"
#include <psapi.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <ctype.h>

View File

@ -14,7 +14,6 @@ details. */
#include <unistd.h>
#include <sys/param.h>
#include "pinfo.h"
#include "psapi.h"
#include "cygtls.h"
#include "path.h"
#include "fhandler.h"

View File

@ -34,6 +34,7 @@
#include <unistd.h>
#include <sys/param.h>
#include <windows.h>
#define PSAPI_VERSION 1
#include <psapi.h>
#include "dumper.h"

View File

@ -37,10 +37,10 @@
#include <unistd.h>
#include <libgen.h>
#define PSAPI_VERSION 1
#include <windows.h>
#include <winternl.h>
#include <imagehlp.h>
#define PSAPI_VERSION 1
#include <psapi.h>
struct option longopts[] =

View File

@ -13,6 +13,7 @@
ntstatus.h for extended status codes below. */
#include <windows.h>
#undef WIN32_NO_STATUS
#define PSAPI_VERSION 1
#include <psapi.h>
#include <winternl.h>
#include <ntstatus.h>

View File

@ -10,6 +10,7 @@ details. */
#include <stdlib.h>
#include <windows.h>
#define PSAPI_VERSION 1
#include <psapi.h>
#include "loadlib.h"

View File

@ -16,6 +16,7 @@ details. */
#include <sys/cygwin.h>
#include <cygwin/version.h>
#include <windows.h>
#define PSAPI_VERSION 1
#include <psapi.h>
struct option longopts[] =

View File

@ -19,7 +19,6 @@ details. */
#include <limits.h>
#include <sys/cygwin.h>
#include <cygwin/version.h>
#include <psapi.h>
#include <ntdef.h>
#include <ntdll.h>
#include "loadlib.h"