public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Add comment to point out missing access right per documentation
@ 2016-06-27 16:01 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2016-06-27 16:01 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=532ecdd36f37e4c5985b8a7c992324e5df48f7a1

commit 532ecdd36f37e4c5985b8a7c992324e5df48f7a1
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Jun 27 18:00:01 2016 +0200

    Add comment to point out missing access right per documentation
    
    In get_mem_values we open the process without PROCESS_VM_READ access
    and are *still* able to request working set information, despite
    MSDN claiming we need it for this purpose.  Instead of adding this
    access right, just add an comment to point this out for now.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler_process.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 9730fa7..216f095 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -1436,6 +1436,10 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
   PMEMORY_WORKING_SET_LIST p;
   SIZE_T n = 0x4000, length;
 
+  /* This appears to work despite MSDN claiming that QueryWorkingSSet requires
+     PROCESS_QUERY_INFORMATION *and* PROCESS_VM_READ.  Since we're trying to do
+     everything with least perms, we stick to PROCESS_QUERY_INFORMATION only
+     unless this changes in Windows for some reason. */
   hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, dwProcessId);
   if (hProcess == NULL)
     {


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-27 16:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 16:01 [newlib-cygwin] Add comment to point out missing access right per documentation Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).