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 // Defines InterceptionManager, the class in charge of setting up interceptions | 5 // Defines InterceptionManager, the class in charge of setting up interceptions |
6 // for the sandboxed process. For more details see | 6 // for the sandboxed process. For more details see |
7 // http://dev.chromium.org/developers/design-documents/sandbox . | 7 // http://dev.chromium.org/developers/design-documents/sandbox . |
8 | 8 |
9 #ifndef SANDBOX_SRC_INTERCEPTION_H_ | 9 #ifndef SANDBOX_SRC_INTERCEPTION_H_ |
10 #define SANDBOX_SRC_INTERCEPTION_H_ | 10 #define SANDBOX_SRC_INTERCEPTION_H_ |
11 | 11 |
12 #include <list> | 12 #include <list> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/strings/string16.h" |
17 #include "sandbox/win/src/sandbox_types.h" | 18 #include "sandbox/win/src/sandbox_types.h" |
18 | 19 |
19 namespace sandbox { | 20 namespace sandbox { |
20 | 21 |
21 class TargetProcess; | 22 class TargetProcess; |
22 enum InterceptorId; | 23 enum InterceptorId; |
23 | 24 |
24 // Internal structures used for communication between the broker and the target. | 25 // Internal structures used for communication between the broker and the target. |
25 struct DllPatchInfo; | 26 struct DllPatchInfo; |
26 struct DllInterceptionData; | 27 struct DllInterceptionData; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // | 129 // |
129 // This function must be called only once, after all interceptions have been | 130 // This function must be called only once, after all interceptions have been |
130 // set up using AddToPatchedFunctions. | 131 // set up using AddToPatchedFunctions. |
131 bool InitializeInterceptions(); | 132 bool InitializeInterceptions(); |
132 | 133 |
133 private: | 134 private: |
134 // Used to store the interception information until the actual set-up. | 135 // Used to store the interception information until the actual set-up. |
135 struct InterceptionData { | 136 struct InterceptionData { |
136 InterceptionType type; // Interception type. | 137 InterceptionType type; // Interception type. |
137 InterceptorId id; // Interceptor id. | 138 InterceptorId id; // Interceptor id. |
138 std::wstring dll; // Name of dll to intercept. | 139 base::string16 dll; // Name of dll to intercept. |
139 std::string function; // Name of function to intercept. | 140 std::string function; // Name of function to intercept. |
140 std::string interceptor; // Name of interceptor function. | 141 std::string interceptor; // Name of interceptor function. |
141 const void* interceptor_address; // Interceptor's entry point. | 142 const void* interceptor_address; // Interceptor's entry point. |
142 }; | 143 }; |
143 | 144 |
144 // Calculates the size of the required configuration buffer. | 145 // Calculates the size of the required configuration buffer. |
145 size_t GetBufferSize() const; | 146 size_t GetBufferSize() const; |
146 | 147 |
147 // Rounds up the size of a given buffer, considering alignment (padding). | 148 // Rounds up the size of a given buffer, considering alignment (padding). |
148 // value is the current size of the buffer, and alignment is specified in | 149 // value is the current size of the buffer, and alignment is specified in |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // |TargetServices::InitCalled()| returns true, because it is only then that | 272 // |TargetServices::InitCalled()| returns true, because it is only then that |
272 // we are guaranteed that our IAT has been initialized. | 273 // we are guaranteed that our IAT has been initialized. |
273 #define INTERCEPT_EAT(manager, dll, function, id, num_params) \ | 274 #define INTERCEPT_EAT(manager, dll, function, id, num_params) \ |
274 manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \ | 275 manager->AddToPatchedFunctions(dll, #function, sandbox::INTERCEPTION_EAT, \ |
275 MAKE_SERVICE_NAME(function), id) | 276 MAKE_SERVICE_NAME(function), id) |
276 #endif // SANDBOX_EXPORTS | 277 #endif // SANDBOX_EXPORTS |
277 | 278 |
278 } // namespace sandbox | 279 } // namespace sandbox |
279 | 280 |
280 #endif // SANDBOX_SRC_INTERCEPTION_H_ | 281 #endif // SANDBOX_SRC_INTERCEPTION_H_ |
OLD | NEW |