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 #include "sandbox/src/target_process.h" | 5 #include "sandbox/src/target_process.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/win/pe_image.h" | 9 #include "base/win/pe_image.h" |
10 #include "sandbox/src/crosscall_server.h" | 10 #include "sandbox/src/crosscall_server.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 if (!target_info->DuplicateFrom(process_info)) { | 202 if (!target_info->DuplicateFrom(process_info)) { |
203 ::TerminateProcess(process_info.process_handle(), 0); | 203 ::TerminateProcess(process_info.process_handle(), 0); |
204 return ERROR_INVALID_FUNCTION; | 204 return ERROR_INVALID_FUNCTION; |
205 } | 205 } |
206 | 206 |
207 base_address_ = GetBaseAddress(exe_path, entry_point); | 207 base_address_ = GetBaseAddress(exe_path, entry_point); |
208 sandbox_process_info_.Swap(&process_info); | 208 sandbox_process_info_.Swap(&process_info); |
209 return win_result; | 209 return win_result; |
210 } | 210 } |
211 | 211 |
212 ResultCode TargetProcess::TransferVariable(char* name, void* address, | 212 ResultCode TargetProcess::TransferVariable(const char* name, void* address, |
213 size_t size) { | 213 size_t size) { |
214 if (!sandbox_process_info_.IsValid()) | 214 if (!sandbox_process_info_.IsValid()) |
215 return SBOX_ERROR_UNEXPECTED_CALL; | 215 return SBOX_ERROR_UNEXPECTED_CALL; |
216 | 216 |
217 void* child_var = address; | 217 void* child_var = address; |
218 | 218 |
219 #if SANDBOX_EXPORTS | 219 #if SANDBOX_EXPORTS |
220 HMODULE module = ::LoadLibrary(exe_name_.get()); | 220 HMODULE module = ::LoadLibrary(exe_name_.get()); |
221 if (NULL == module) | 221 if (NULL == module) |
222 return SBOX_ERROR_GENERIC; | 222 return SBOX_ERROR_GENERIC; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 | 334 |
335 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) { | 335 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) { |
336 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL); | 336 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL); |
337 target->sandbox_process_info_.Receive()->hProcess = process; | 337 target->sandbox_process_info_.Receive()->hProcess = process; |
338 target->base_address_ = base_address; | 338 target->base_address_ = base_address; |
339 return target; | 339 return target; |
340 } | 340 } |
341 | 341 |
342 } // namespace sandbox | 342 } // namespace sandbox |
OLD | NEW |