OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "base/process/process.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 return process.Pass(); | 46 return process.Pass(); |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 Process Process::OpenWithExtraPriviles(ProcessId pid) { | 50 Process Process::OpenWithExtraPriviles(ProcessId pid) { |
51 DWORD access = kBasicProcessAccess | PROCESS_DUP_HANDLE | PROCESS_VM_READ; | 51 DWORD access = kBasicProcessAccess | PROCESS_DUP_HANDLE | PROCESS_VM_READ; |
52 ProcessHandle handle = ::OpenProcess(access, FALSE, pid); | 52 ProcessHandle handle = ::OpenProcess(access, FALSE, pid); |
53 return Process(handle); | 53 return Process(handle); |
54 } | 54 } |
55 | 55 |
56 Process Process::OpenWithAccess(ProcessId pid, DWORD desired_access) { | |
57 ProcessHandle handle = ::OpenProcess(desired_access, FALSE, pid); | |
58 return Process(handle); | |
cpu_(ooo_6.6-7.5)
2015/01/22 00:38:32
return Process(::OpenProcess(desired_access, FALSE
rvargas (doing something else)
2015/01/22 01:51:17
Done.
| |
59 } | |
60 | |
56 // static | 61 // static |
57 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { | 62 Process Process::DeprecatedGetProcessFromHandle(ProcessHandle handle) { |
58 DCHECK_NE(handle, ::GetCurrentProcess()); | 63 DCHECK_NE(handle, ::GetCurrentProcess()); |
59 ProcessHandle out_handle; | 64 ProcessHandle out_handle; |
60 if (!::DuplicateHandle(GetCurrentProcess(), handle, | 65 if (!::DuplicateHandle(GetCurrentProcess(), handle, |
61 GetCurrentProcess(), &out_handle, | 66 GetCurrentProcess(), &out_handle, |
62 0, FALSE, DUPLICATE_SAME_ACCESS)) { | 67 0, FALSE, DUPLICATE_SAME_ACCESS)) { |
63 return Process(); | 68 return Process(); |
64 } | 69 } |
65 return Process(out_handle); | 70 return Process(out_handle); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 | 166 |
162 return (::SetPriorityClass(Handle(), priority) != 0); | 167 return (::SetPriorityClass(Handle(), priority) != 0); |
163 } | 168 } |
164 | 169 |
165 int Process::GetPriority() const { | 170 int Process::GetPriority() const { |
166 DCHECK(IsValid()); | 171 DCHECK(IsValid()); |
167 return ::GetPriorityClass(Handle()); | 172 return ::GetPriorityClass(Handle()); |
168 } | 173 } |
169 | 174 |
170 } // namespace base | 175 } // namespace base |
OLD | NEW |