]> git.saurik.com Git - wxWidgets.git/commitdiff
Use minimal required process access mask in wxMSW wxKill().
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 9 Sep 2010 21:48:48 +0000 (21:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 9 Sep 2010 21:48:48 +0000 (21:48 +0000)
We don't need PROCESS_TERMINATE permission if we are not going to call
TerminateProcess() for it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65490 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/utils.cpp

index e23656dfa91a86f03f812fbc2328b90648ee240f..47009f0bd093211fafc2bd3e4f5cb9cdadd6eead 100644 (file)
@@ -708,11 +708,11 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
         wxKillAllChildren(pid, sig, krc);
 
     // get the process handle to operate on
-    HANDLE hProcess = ::OpenProcess(SYNCHRONIZE |
-                                    PROCESS_TERMINATE |
-                                    PROCESS_QUERY_INFORMATION,
-                                    FALSE, // not inheritable
-                                    (DWORD)pid);
+    DWORD dwAccess = PROCESS_QUERY_INFORMATION | SYNCHRONIZE;
+    if ( sig == wxSIGKILL )
+        dwAccess |= PROCESS_TERMINATE;
+
+    HANDLE hProcess = ::OpenProcess(dwAccess, FALSE, (DWORD)pid);
     if ( hProcess == NULL )
     {
         if ( krc )