| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/pe_image.h" | 8 #include "base/pe_image.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "sandbox/src/crosscall_server.h" | 10 #include "sandbox/src/crosscall_server.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 if (!::GetThreadContext(process_info.hThread, &context)) { | 177 if (!::GetThreadContext(process_info.hThread, &context)) { |
| 178 win_result = ::GetLastError(); | 178 win_result = ::GetLastError(); |
| 179 TerminateTarget(&process_info); | 179 TerminateTarget(&process_info); |
| 180 return win_result; | 180 return win_result; |
| 181 } | 181 } |
| 182 | 182 |
| 183 sandbox_process_ = process_info.hProcess; | 183 sandbox_process_ = process_info.hProcess; |
| 184 sandbox_thread_ = process_info.hThread; | 184 sandbox_thread_ = process_info.hThread; |
| 185 sandbox_process_id_ = process_info.dwProcessId; | 185 sandbox_process_id_ = process_info.dwProcessId; |
| 186 | 186 |
| 187 #ifndef _WIN64 // TODO(gregoryd): This code does not build for Win64. |
| 188 // It is safe to disable it since base_address_ is used for |
| 189 // interception that is not supported on Win64 yet. |
| 187 #pragma warning(push) | 190 #pragma warning(push) |
| 188 #pragma warning(disable: 4312) | 191 #pragma warning(disable: 4312) |
| 189 // This cast generates a warning because it is 32 bit specific. | 192 // This cast generates a warning because it is 32 bit specific. |
| 190 void* entry_point = reinterpret_cast<void*>(context.Eax); | 193 void* entry_point = reinterpret_cast<void*>(context.Eax); |
| 191 #pragma warning(pop) | 194 #pragma warning(pop) |
| 192 base_address_ = GetBaseAddress(exe_path, entry_point); | 195 base_address_ = GetBaseAddress(exe_path, entry_point); |
| 193 | 196 #endif // _WIN64 |
| 194 *target_info = process_info; | 197 *target_info = process_info; |
| 195 return win_result; | 198 return win_result; |
| 196 } | 199 } |
| 197 | 200 |
| 198 ResultCode TargetProcess::TransferVariable(char* name, void* address, | 201 ResultCode TargetProcess::TransferVariable(char* name, void* address, |
| 199 size_t size) { | 202 size_t size) { |
| 200 if (NULL == sandbox_process_) | 203 if (NULL == sandbox_process_) |
| 201 return SBOX_ERROR_UNEXPECTED_CALL; | 204 return SBOX_ERROR_UNEXPECTED_CALL; |
| 202 | 205 |
| 203 void* child_var = address; | 206 void* child_var = address; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 320 |
| 318 | 321 |
| 319 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) { | 322 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) { |
| 320 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL); | 323 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL); |
| 321 target->sandbox_process_ = process; | 324 target->sandbox_process_ = process; |
| 322 target->base_address_ = base_address; | 325 target->base_address_ = base_address; |
| 323 return target; | 326 return target; |
| 324 } | 327 } |
| 325 | 328 |
| 326 } // namespace sandbox | 329 } // namespace sandbox |
| OLD | NEW |