Chromium Code Reviews| 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 // Sandbox is a sandbox library for windows processes. Use when you want a | 5 // Sandbox is a sandbox library for windows processes. Use when you want a |
| 6 // 'privileged' process and a 'locked down process' to interact with. | 6 // 'privileged' process and a 'locked down process' to interact with. |
| 7 // The privileged process is called the broker and it is started by external | 7 // The privileged process is called the broker and it is started by external |
| 8 // means (such as the user starting it). The 'sandboxed' process is called the | 8 // means (such as the user starting it). The 'sandboxed' process is called the |
| 9 // target and it is started by the broker. There can be many target processes | 9 // target and it is started by the broker. There can be many target processes |
| 10 // started by a single broker process. This library provides facilities | 10 // started by a single broker process. This library provides facilities |
| 11 // for both the broker and the target. | 11 // for both the broker and the target. |
| 12 // | 12 // |
| 13 // The design rationale and relevant documents can be found at http://go/sbox. | 13 // The design rationale and relevant documents can be found at http://go/sbox. |
| 14 // | 14 // |
| 15 // Note: this header does not include the SandboxFactory definitions because | 15 // Note: this header does not include the SandboxFactory definitions because |
| 16 // there are cases where the Sandbox library is linked against the main .exe | 16 // there are cases where the Sandbox library is linked against the main .exe |
| 17 // while its API needs to be used in a DLL. | 17 // while its API needs to be used in a DLL. |
| 18 | 18 |
| 19 #ifndef SANDBOX_SRC_SANDBOX_H__ | 19 #ifndef SANDBOX_SRC_SANDBOX_H__ |
| 20 #define SANDBOX_SRC_SANDBOX_H__ | 20 #define SANDBOX_SRC_SANDBOX_H__ |
| 21 | 21 |
| 22 #include <windows.h> | 22 #include <windows.h> |
| 23 | 23 |
| 24 #include "base/basictypes.h" | 24 #include "base/basictypes.h" |
| 25 #include "sandbox/src/sandbox_policy.h" | 25 #include "sandbox/src/sandbox_policy.h" |
| 26 #include "sandbox/src/sandbox_types.h" | 26 #include "sandbox/src/sandbox_types.h" |
| 27 | 27 |
| 28 namespace base { | |
| 29 namespace win { | |
| 30 | |
| 31 class ScopedProcessInformation; | |
| 32 | |
| 33 } // namespace win | |
| 34 } // namespace namespace | |
| 35 | |
| 28 // sandbox: Google User-Land Application Sandbox | 36 // sandbox: Google User-Land Application Sandbox |
| 29 namespace sandbox { | 37 namespace sandbox { |
| 30 | 38 |
| 31 class BrokerServices; | 39 class BrokerServices; |
| 32 class ProcessState; | 40 class ProcessState; |
| 33 class TargetPolicy; | 41 class TargetPolicy; |
| 34 class TargetServices; | 42 class TargetServices; |
| 35 | 43 |
| 36 // BrokerServices exposes all the broker API. | 44 // BrokerServices exposes all the broker API. |
| 37 // The basic use is to start the target(s) and wait for them to end. | 45 // The basic use is to start the target(s) and wait for them to end. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 62 // Creates a new target (child process) in a suspended state. | 70 // Creates a new target (child process) in a suspended state. |
| 63 // Parameters: | 71 // Parameters: |
| 64 // exe_path: This is the full path to the target binary. This parameter | 72 // exe_path: This is the full path to the target binary. This parameter |
| 65 // can be null and in this case the exe path must be the first argument | 73 // can be null and in this case the exe path must be the first argument |
| 66 // of the command_line. | 74 // of the command_line. |
| 67 // command_line: The arguments to be passed as command line to the new | 75 // command_line: The arguments to be passed as command line to the new |
| 68 // process. This can be null if the exe_path parameter is not null. | 76 // process. This can be null if the exe_path parameter is not null. |
| 69 // policy: This is the pointer to the policy object for the sandbox to | 77 // policy: This is the pointer to the policy object for the sandbox to |
| 70 // be created. | 78 // be created. |
| 71 // target: returns the resulting target process information such as process | 79 // target: returns the resulting target process information such as process |
| 72 // handle and PID just as if CreateProcess() had been called. The caller is | 80 // handle and PID just as if CreateProcess() had been called. |
| 73 // responsible for closing the handles returned in this structure. | |
| 74 // Returns: | 81 // Returns: |
| 75 // ALL_OK if successful. All other return values imply failure. | 82 // ALL_OK if successful. All other return values imply failure. |
| 76 virtual ResultCode SpawnTarget(const wchar_t* exe_path, | 83 virtual ResultCode SpawnTarget( |
| 77 const wchar_t* command_line, | 84 const wchar_t* exe_path, |
| 78 TargetPolicy* policy, | 85 const wchar_t* command_line, |
| 79 PROCESS_INFORMATION* target) = 0; | 86 TargetPolicy* policy, |
| 87 base::win::ScopedProcessInformation* target) = 0; | |
|
cpu_(ooo_6.6-7.5)
2012/04/02 21:11:50
I rather keep this interface, in fact this whole f
| |
| 80 | 88 |
| 81 // This call blocks (waits) for all the targets to terminate. | 89 // This call blocks (waits) for all the targets to terminate. |
| 82 // Returns: | 90 // Returns: |
| 83 // ALL_OK if successful. All other return values imply failure. | 91 // ALL_OK if successful. All other return values imply failure. |
| 84 // If the return is ERROR_GENERIC, you can call ::GetLastError() to get | 92 // If the return is ERROR_GENERIC, you can call ::GetLastError() to get |
| 85 // more information. | 93 // more information. |
| 86 virtual ResultCode WaitForAllTargets() = 0; | 94 virtual ResultCode WaitForAllTargets() = 0; |
| 87 }; | 95 }; |
| 88 | 96 |
| 89 // TargetServices models the current process from the perspective | 97 // TargetServices models the current process from the perspective |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 // Returns the ProcessState object. Through that object it's possible to have | 133 // Returns the ProcessState object. Through that object it's possible to have |
| 126 // information about the current state of the process, such as whether | 134 // information about the current state of the process, such as whether |
| 127 // LowerToken has been called or not. | 135 // LowerToken has been called or not. |
| 128 virtual ProcessState* GetState() = 0; | 136 virtual ProcessState* GetState() = 0; |
| 129 }; | 137 }; |
| 130 | 138 |
| 131 } // namespace sandbox | 139 } // namespace sandbox |
| 132 | 140 |
| 133 | 141 |
| 134 #endif // SANDBOX_SRC_SANDBOX_H__ | 142 #endif // SANDBOX_SRC_SANDBOX_H__ |
| OLD | NEW |