Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: base/process/process_handle_win.cc

Issue 860453002: Move OpenProcessHandleWithAccess to Process::OpenWithAccess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ServiceProcessControlBrowserTest.Setup again Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process/process_handle.h" 5 #include "base/process/process_handle.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/win/scoped_handle.h" 10 #include "base/win/scoped_handle.h"
(...skipping 18 matching lines...) Expand all
29 SYNCHRONIZE, 29 SYNCHRONIZE,
30 FALSE, pid); 30 FALSE, pid);
31 31
32 if (result == NULL) 32 if (result == NULL)
33 return false; 33 return false;
34 34
35 *handle = result; 35 *handle = result;
36 return true; 36 return true;
37 } 37 }
38 38
39 bool OpenProcessHandleWithAccess(ProcessId pid,
40 uint32 access_flags,
41 ProcessHandle* handle) {
42 ProcessHandle result = OpenProcess(access_flags, FALSE, pid);
43
44 if (result == NULL)
45 return false;
46
47 *handle = result;
48 return true;
49 }
50
51 void CloseProcessHandle(ProcessHandle process) { 39 void CloseProcessHandle(ProcessHandle process) {
52 CloseHandle(process); 40 CloseHandle(process);
53 } 41 }
54 42
55 ProcessId GetProcId(ProcessHandle process) { 43 ProcessId GetProcId(ProcessHandle process) {
56 // This returns 0 if we have insufficient rights to query the process handle. 44 // This returns 0 if we have insufficient rights to query the process handle.
57 return GetProcessId(process); 45 return GetProcessId(process);
58 } 46 }
59 47
60 bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) { 48 bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 *level = HIGH_INTEGRITY; 90 *level = HIGH_INTEGRITY;
103 } else { 91 } else {
104 NOTREACHED(); 92 NOTREACHED();
105 return false; 93 return false;
106 } 94 }
107 95
108 return true; 96 return true;
109 } 97 }
110 98
111 } // namespace base 99 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698