Zebediah Figura : psapi/tests: Avoid using PROCESS_ALL_ACCESS.

Alexandre Julliard julliard at winehq.org
Fri Jul 6 15:52:09 CDT 2018


Module: wine
Branch: master
Commit: 81242f747efc733afbf987f7bc7d168dd4fa2fc2
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=81242f747efc733afbf987f7bc7d168dd4fa2fc2

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Jul  6 00:05:37 2018 +0200

psapi/tests: Avoid using PROCESS_ALL_ACCESS.

Since its value changed in Windows Vista.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/psapi/tests/psapi_main.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index aba05274..3fec5d7 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -56,7 +56,7 @@ static BOOL init_func_ptrs(void)
     return TRUE;
 }
 
-static HANDLE hpSR, hpQI, hpVR, hpQV, hpAA;
+static HANDLE hpSR, hpQI, hpVR, hpQV;
 static const HANDLE hBad = (HANDLE)0xdeadbeef;
 
 static void test_EnumProcesses(void)
@@ -726,10 +726,15 @@ static void test_ws_functions(void)
 {
     PSAPI_WS_WATCH_INFORMATION wswi[4096];
     ULONG_PTR pages[4096];
+    HANDLE ws_handle;
     char *addr;
     unsigned int i;
     BOOL ret;
 
+    ws_handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_SET_QUOTA |
+        PROCESS_SET_INFORMATION, FALSE, GetCurrentProcessId());
+    ok(!!ws_handle, "got error %u\n", GetLastError());
+
     SetLastError(0xdeadbeef);
     EmptyWorkingSet(NULL);
     todo_wine ok(GetLastError() == ERROR_INVALID_HANDLE, "expected error=ERROR_INVALID_HANDLE but got %d\n", GetLastError());
@@ -739,7 +744,7 @@ static void test_ws_functions(void)
     todo_wine ok(GetLastError() == ERROR_ACCESS_DENIED, "expected error=ERROR_ACCESS_DENIED but got %d\n", GetLastError());
 
     SetLastError(0xdeadbeef);
-    ret = EmptyWorkingSet(hpAA);
+    ret = EmptyWorkingSet(ws_handle);
     ok(ret == 1, "failed with %d\n", GetLastError());
 
     SetLastError( 0xdeadbeef );
@@ -755,7 +760,7 @@ static void test_ws_functions(void)
         ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
     }
     SetLastError(0xdeadbeef);
-    ret = InitializeProcessForWsWatch(hpAA);
+    ret = InitializeProcessForWsWatch(ws_handle);
     ok(ret == 1, "failed with %d\n", GetLastError());
     
     addr = VirtualAlloc(NULL, 1, MEM_COMMIT, PAGE_READWRITE);
@@ -817,9 +822,8 @@ START_TEST(psapi_main)
     hpQI = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
     hpVR = OpenProcess(PROCESS_VM_READ, FALSE, pid);
     hpQV = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
-    hpAA = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
 
-    if(hpSR && hpQI && hpVR && hpQV && hpAA)
+    if(hpSR && hpQI && hpVR && hpQV)
         {
 	    test_EnumProcesses();
 	    test_EnumProcessModules();
@@ -837,5 +841,4 @@ START_TEST(psapi_main)
     CloseHandle(hpQI);
     CloseHandle(hpVR);
     CloseHandle(hpQV);
-    CloseHandle(hpAA);
 }




More information about the wine-cvs mailing list