OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_CROSSCALL_PARAMS_H__ | 5 #ifndef SANDBOX_SRC_CROSSCALL_PARAMS_H__ |
6 #define SANDBOX_SRC_CROSSCALL_PARAMS_H__ | 6 #define SANDBOX_SRC_CROSSCALL_PARAMS_H__ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <lmaccess.h> | 9 #include <lmaccess.h> |
10 | 10 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // between one parameter and the next down | 195 // between one parameter and the next down |
196 template <size_t NUMBER_PARAMS, size_t BLOCK_SIZE> | 196 template <size_t NUMBER_PARAMS, size_t BLOCK_SIZE> |
197 class ActualCallParams : public CrossCallParams { | 197 class ActualCallParams : public CrossCallParams { |
198 public: | 198 public: |
199 // constructor. Pass the ipc unique tag as input | 199 // constructor. Pass the ipc unique tag as input |
200 explicit ActualCallParams(uint32 tag) | 200 explicit ActualCallParams(uint32 tag) |
201 : CrossCallParams(tag, NUMBER_PARAMS) { | 201 : CrossCallParams(tag, NUMBER_PARAMS) { |
202 param_info_[0].offset_ = parameters_ - reinterpret_cast<char*>(this); | 202 param_info_[0].offset_ = parameters_ - reinterpret_cast<char*>(this); |
203 } | 203 } |
204 | 204 |
| 205 // Testing-only constructor. Allows setting the |number_params| to a |
| 206 // wrong value. |
| 207 ActualCallParams(uint32 tag, uint32 number_params) |
| 208 : CrossCallParams(tag, number_params) { |
| 209 param_info_[0].offset_ = parameters_ - reinterpret_cast<char*>(this); |
| 210 } |
| 211 |
205 // Copies each paramter into the internal buffer. For each you must supply: | 212 // Copies each paramter into the internal buffer. For each you must supply: |
206 // index: 0 for the first param, 1 for the next an so on | 213 // index: 0 for the first param, 1 for the next an so on |
207 bool CopyParamIn(size_t index, const void* parameter_address, size_t size, | 214 bool CopyParamIn(size_t index, const void* parameter_address, size_t size, |
208 bool is_in_out, ArgType type) { | 215 bool is_in_out, ArgType type) { |
209 if (index >= NUMBER_PARAMS) { | 216 if (index >= NUMBER_PARAMS) { |
210 return false; | 217 return false; |
211 } | 218 } |
212 | 219 |
213 if (kuint32max == size) { | 220 if (kuint32max == size) { |
214 // Memory error while getting the size. | 221 // Memory error while getting the size. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 DISALLOW_EVIL_CONSTRUCTORS(ActualCallParams); | 275 DISALLOW_EVIL_CONSTRUCTORS(ActualCallParams); |
269 }; | 276 }; |
270 | 277 |
271 COMPILE_ASSERT(sizeof(ActualCallParams<1, 1024>) == 1024, bad_size_buffer); | 278 COMPILE_ASSERT(sizeof(ActualCallParams<1, 1024>) == 1024, bad_size_buffer); |
272 COMPILE_ASSERT(sizeof(ActualCallParams<2, 1024>) == 1024, bad_size_buffer); | 279 COMPILE_ASSERT(sizeof(ActualCallParams<2, 1024>) == 1024, bad_size_buffer); |
273 COMPILE_ASSERT(sizeof(ActualCallParams<3, 1024>) == 1024, bad_size_buffer); | 280 COMPILE_ASSERT(sizeof(ActualCallParams<3, 1024>) == 1024, bad_size_buffer); |
274 | 281 |
275 } // namespace sandbox | 282 } // namespace sandbox |
276 | 283 |
277 #endif // SANDBOX_SRC_CROSSCALL_PARAMS_H__ | 284 #endif // SANDBOX_SRC_CROSSCALL_PARAMS_H__ |
OLD | NEW |