[PATCH 5/5] Cygwin: Use MEMORY_WORKING_SET_EX_INFORMATION in dumper

Jon Turney jon.turney@dronecode.org.uk
Tue Jul 28 21:04:17 GMT 2020


On 28/07/2020 03:20, Takashi Yano via Cygwin-patches wrote:
> Hi Jon,
> 
> On Sat, 18 Jul 2020 16:00:28 +0100
> Jon Turney wrote:
>> Use the (undocumented) MEMORY_WORKING_SET_EX_INFORMATION in dumper to
>> determine if a MEM_IMAGE region is unsharable, and hence has been
>> modified.
>> ---
>>   winsup/doc/utils.xml     |  8 ++---
>>   winsup/utils/Makefile.in |  2 +-
>>   winsup/utils/dumper.cc   | 63 ++++++++++++++++++++++++++++++++++++++--
>>   3 files changed, 65 insertions(+), 8 deletions(-)
> 
> After this commit, 32bit build failes with:
> 
> /usr/lib/gcc/i686-pc-cygwin/9.3.0/../../../../i686-pc-cygwin/bin/ld: dumper.o:/home/yano/newlib-cygwin/i686-pc-cygwin/winsup/utils/../../.././winsup/utils/dumper.cc:295: undefined reference to `NtQueryVirtualMemory'

Thanks very much for pointing this out.

> This seems to be solved with the patch:

Yes, I guess that it needs that for stdcall.  I applied your patch.

> diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc
> index 3af138b9e..36dbf9dbb 100644
> --- a/winsup/utils/dumper.cc
> +++ b/winsup/utils/dumper.cc
> @@ -272,7 +272,7 @@ typedef enum _MEMORY_INFORMATION_CLASS
>   } MEMORY_INFORMATION_CLASS;
> 
>   extern "C"
> -NTSTATUS
> +NTSTATUS NTAPI
>   NtQueryVirtualMemory(HANDLE ProcessHandle,
>                       LPVOID BaseAddress,
>                       MEMORY_INFORMATION_CLASS MemoryInformationClass,
> 


More information about the Cygwin-patches mailing list