OLD | NEW |
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 #ifndef BASE_PROCESS_PROCESS_HANDLE_H_ | 5 #ifndef BASE_PROCESS_PROCESS_HANDLE_H_ |
6 #define BASE_PROCESS_PROCESS_HANDLE_H_ | 6 #define BASE_PROCESS_PROCESS_HANDLE_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Returns the id of the current process. | 37 // Returns the id of the current process. |
38 BASE_EXPORT ProcessId GetCurrentProcId(); | 38 BASE_EXPORT ProcessId GetCurrentProcId(); |
39 | 39 |
40 // Returns the ProcessHandle of the current process. | 40 // Returns the ProcessHandle of the current process. |
41 BASE_EXPORT ProcessHandle GetCurrentProcessHandle(); | 41 BASE_EXPORT ProcessHandle GetCurrentProcessHandle(); |
42 | 42 |
43 // Converts a PID to a process handle. This handle must be closed by | 43 // Converts a PID to a process handle. This handle must be closed by |
44 // CloseProcessHandle when you are done with it. Returns true on success. | 44 // CloseProcessHandle when you are done with it. Returns true on success. |
45 BASE_EXPORT bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle); | 45 BASE_EXPORT bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle); |
46 | 46 |
47 // Converts a PID to a process handle. On Windows the handle is opened | |
48 // with more access rights and must only be used by trusted code. | |
49 // You have to close returned handle using CloseProcessHandle. Returns true | |
50 // on success. | |
51 // TODO(sanjeevr): Replace all calls to OpenPrivilegedProcessHandle with the | |
52 // more specific OpenProcessHandleWithAccess method and delete this. | |
53 BASE_EXPORT bool OpenPrivilegedProcessHandle(ProcessId pid, | |
54 ProcessHandle* handle); | |
55 | |
56 // Converts a PID to a process handle using the desired access flags. Use a | 47 // Converts a PID to a process handle using the desired access flags. Use a |
57 // combination of the kProcessAccess* flags defined above for |access_flags|. | 48 // combination of the kProcessAccess* flags defined above for |access_flags|. |
58 BASE_EXPORT bool OpenProcessHandleWithAccess(ProcessId pid, | 49 BASE_EXPORT bool OpenProcessHandleWithAccess(ProcessId pid, |
59 uint32 access_flags, | 50 uint32 access_flags, |
60 ProcessHandle* handle); | 51 ProcessHandle* handle); |
61 | 52 |
62 // Closes the process handle opened by OpenProcessHandle. | 53 // Closes the process handle opened by OpenProcessHandle. |
63 BASE_EXPORT void CloseProcessHandle(ProcessHandle process); | 54 BASE_EXPORT void CloseProcessHandle(ProcessHandle process); |
64 | 55 |
65 // Returns the unique ID for the specified process. This is functionally the | 56 // Returns the unique ID for the specified process. This is functionally the |
(...skipping 19 matching lines...) Expand all Loading... |
85 // Returns the path to the executable of the given process. | 76 // Returns the path to the executable of the given process. |
86 BASE_EXPORT FilePath GetProcessExecutablePath(ProcessHandle process); | 77 BASE_EXPORT FilePath GetProcessExecutablePath(ProcessHandle process); |
87 | 78 |
88 // Returns the ID for the parent of the given process. | 79 // Returns the ID for the parent of the given process. |
89 BASE_EXPORT ProcessId GetParentProcessId(ProcessHandle process); | 80 BASE_EXPORT ProcessId GetParentProcessId(ProcessHandle process); |
90 #endif | 81 #endif |
91 | 82 |
92 } // namespace base | 83 } // namespace base |
93 | 84 |
94 #endif // BASE_PROCESS_PROCESS_HANDLE_H_ | 85 #endif // BASE_PROCESS_PROCESS_HANDLE_H_ |
OLD | NEW |