[PATCH] Cygwin: Use documented QueryWorkingSetEx() in dumper
Jon Turney
jon.turney@dronecode.org.uk
Fri Jul 31 19:33:14 GMT 2020
On 31/07/2020 19:40, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
> Hi,
>
> Reading this MS documentation
>
> https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-queryworkingsetex
>
> ... the remarks section goes:
>
> Programs that must run on earlier versions of Windows as well as Windows 7 and later versions should always call this function as QueryWorkingSetEx. To ensure correct resolution of symbols, add Psapi.lib to the TARGETLIBS macro and compile the program with "-DPSAPI_VERSION=1". To use run-time dynamic linking, load Psapi.dll.
>
> So if I'm reading correctly and if Vista is still being supported in Cygwin, then I guess PSAPI_VERSION=1 must be used (either Makefile or source)...
This is correct.
The MSDN documentation is unhelpfully silent on the default behaviour if
PSAPI_VERSION is not specified.
For the w32api headers, at least, the default depends on the targetted
version set via the NTDDI_VERSION macro (or historical alternatives to
that), and unless Win7 or later is targetted, it defaults to
PSAPI_VERSION=1.
Note that dumper already uses various psapi functions
(EnumProcessModule, GetModuleInformation, GetModuleFileNameExA), so this
patch doesn't introduce this potential ambiguity as a new issue.
More information about the Cygwin-patches
mailing list