OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 SANDBOX_SRC_TARGET_PROCESS_H__ | 5 #ifndef SANDBOX_SRC_TARGET_PROCESS_H__ |
6 #define SANDBOX_SRC_TARGET_PROCESS_H__ | 6 #define SANDBOX_SRC_TARGET_PROCESS_H__ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/win/scoped_handle.h" | 12 #include "base/win/scoped_handle.h" |
13 #include "base/win/scoped_process_information.h" | 13 #include "base/win/scoped_process_information.h" |
14 #include "sandbox/win/src/crosscall_server.h" | 14 #include "sandbox/win/src/crosscall_server.h" |
15 #include "sandbox/win/src/sandbox_types.h" | 15 #include "sandbox/win/src/sandbox_types.h" |
16 | 16 |
| 17 namespace base { |
| 18 namespace win { |
| 19 |
| 20 class StartupInformation; |
| 21 |
| 22 }; // namespace win |
| 23 }; // namespace base |
| 24 |
17 namespace sandbox { | 25 namespace sandbox { |
18 | 26 |
19 class SharedMemIPCServer; | 27 class SharedMemIPCServer; |
20 class ThreadProvider; | 28 class ThreadProvider; |
21 | 29 |
22 // TargetProcess models a target instance (child process). Objects of this | 30 // TargetProcess models a target instance (child process). Objects of this |
23 // class are owned by the Policy used to create them. | 31 // class are owned by the Policy used to create them. |
24 class TargetProcess { | 32 class TargetProcess { |
25 public: | 33 public: |
26 // The constructor takes ownership of |initial_token| and |lockdown_token|. | 34 // The constructor takes ownership of |initial_token| and |lockdown_token|. |
27 TargetProcess(HANDLE initial_token, HANDLE lockdown_token, HANDLE job, | 35 TargetProcess(HANDLE initial_token, HANDLE lockdown_token, HANDLE job, |
28 ThreadProvider* thread_pool); | 36 ThreadProvider* thread_pool); |
29 ~TargetProcess(); | 37 ~TargetProcess(); |
30 | 38 |
31 // TODO(cpu): Currently there does not seem to be a reason to implement | 39 // TODO(cpu): Currently there does not seem to be a reason to implement |
32 // reference counting for this class since is internal, but kept the | 40 // reference counting for this class since is internal, but kept the |
33 // the same interface so the interception framework does not need to be | 41 // the same interface so the interception framework does not need to be |
34 // touched at this point. | 42 // touched at this point. |
35 void AddRef() {} | 43 void AddRef() {} |
36 void Release() {} | 44 void Release() {} |
37 | 45 |
38 // Creates the new target process. The process is created suspended. | 46 // Creates the new target process. The process is created suspended. |
39 DWORD Create(const wchar_t* exe_path, | 47 DWORD Create(const wchar_t* exe_path, |
40 const wchar_t* command_line, | 48 const wchar_t* command_line, |
41 const wchar_t* desktop, | 49 const base::win::StartupInformation& startup_info, |
42 base::win::ScopedProcessInformation* target_info); | 50 base::win::ScopedProcessInformation* target_info); |
43 | 51 |
44 // Destroys the target process. | 52 // Destroys the target process. |
45 void Terminate(); | 53 void Terminate(); |
46 | 54 |
47 // Creates the IPC objects such as the BrokerDispatcher and the | 55 // Creates the IPC objects such as the BrokerDispatcher and the |
48 // IPC server. The IPC server uses the services of the thread_pool. | 56 // IPC server. The IPC server uses the services of the thread_pool. |
49 DWORD Init(Dispatcher* ipc_dispatcher, void* policy, | 57 DWORD Init(Dispatcher* ipc_dispatcher, void* policy, |
50 uint32 shared_IPC_size, uint32 shared_policy_size); | 58 uint32 shared_IPC_size, uint32 shared_policy_size); |
51 | 59 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 }; | 121 }; |
114 | 122 |
115 // Creates a mock TargetProcess used for testing interceptions. | 123 // Creates a mock TargetProcess used for testing interceptions. |
116 // TODO(cpu): It seems that this method is not going to be used anymore. | 124 // TODO(cpu): It seems that this method is not going to be used anymore. |
117 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address); | 125 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address); |
118 | 126 |
119 | 127 |
120 } // namespace sandbox | 128 } // namespace sandbox |
121 | 129 |
122 #endif // SANDBOX_SRC_TARGET_PROCESS_H__ | 130 #endif // SANDBOX_SRC_TARGET_PROCESS_H__ |
OLD | NEW |