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

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

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle) {
40 ProcessHandle result = OpenProcess(PROCESS_DUP_HANDLE |
41 PROCESS_TERMINATE |
42 PROCESS_QUERY_INFORMATION |
43 PROCESS_VM_READ |
44 SYNCHRONIZE,
45 FALSE, pid);
46
47 if (result == NULL)
48 return false;
49
50 *handle = result;
51 return true;
52 }
53
54 bool OpenProcessHandleWithAccess(ProcessId pid, 39 bool OpenProcessHandleWithAccess(ProcessId pid,
55 uint32 access_flags, 40 uint32 access_flags,
56 ProcessHandle* handle) { 41 ProcessHandle* handle) {
57 ProcessHandle result = OpenProcess(access_flags, FALSE, pid); 42 ProcessHandle result = OpenProcess(access_flags, FALSE, pid);
58 43
59 if (result == NULL) 44 if (result == NULL)
60 return false; 45 return false;
61 46
62 *handle = result; 47 *handle = result;
63 return true; 48 return true;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 *level = HIGH_INTEGRITY; 102 *level = HIGH_INTEGRITY;
118 } else { 103 } else {
119 NOTREACHED(); 104 NOTREACHED();
120 return false; 105 return false;
121 } 106 }
122 107
123 return true; 108 return true;
124 } 109 }
125 110
126 } // namespace base 111 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698