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/win/tests/common/controller.h" | 5 #include "sandbox/win/tests/common/controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 if (disable_csrss_) | 216 if (disable_csrss_) |
217 policy_->SetDisconnectCsrss(); | 217 policy_->SetDisconnectCsrss(); |
218 | 218 |
219 // Get the path to the sandboxed process. | 219 // Get the path to the sandboxed process. |
220 wchar_t prog_name[MAX_PATH]; | 220 wchar_t prog_name[MAX_PATH]; |
221 GetModuleFileNameW(NULL, prog_name, MAX_PATH); | 221 GetModuleFileNameW(NULL, prog_name, MAX_PATH); |
222 | 222 |
223 // Launch the sandboxed process. | 223 // Launch the sandboxed process. |
224 ResultCode result = SBOX_ALL_OK; | 224 ResultCode result = SBOX_ALL_OK; |
| 225 ResultCode warning_result = SBOX_ALL_OK; |
225 PROCESS_INFORMATION target = {0}; | 226 PROCESS_INFORMATION target = {0}; |
226 | 227 |
227 base::string16 arguments(L"\""); | 228 base::string16 arguments(L"\""); |
228 arguments += prog_name; | 229 arguments += prog_name; |
229 arguments += L"\" -child"; | 230 arguments += L"\" -child"; |
230 arguments += no_sandbox_ ? L"-no-sandbox " : L" "; | 231 arguments += no_sandbox_ ? L"-no-sandbox " : L" "; |
231 arguments += command; | 232 arguments += command; |
232 | 233 |
233 if (no_sandbox_) { | 234 if (no_sandbox_) { |
234 STARTUPINFO startup_info = {sizeof(STARTUPINFO)}; | 235 STARTUPINFO startup_info = {sizeof(STARTUPINFO)}; |
235 if (!::CreateProcessW(prog_name, &arguments[0], NULL, NULL, FALSE, 0, | 236 if (!::CreateProcessW(prog_name, &arguments[0], NULL, NULL, FALSE, 0, |
236 NULL, NULL, &startup_info, &target)) { | 237 NULL, NULL, &startup_info, &target)) { |
237 return SBOX_ERROR_GENERIC; | 238 return SBOX_ERROR_GENERIC; |
238 } | 239 } |
239 } else { | 240 } else { |
240 result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_, | 241 result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_, |
241 &target); | 242 &warning_result, &target); |
242 } | 243 } |
243 | 244 |
244 if (SBOX_ALL_OK != result) | 245 if (SBOX_ALL_OK != result) |
245 return SBOX_TEST_FAILED_TO_RUN_TEST; | 246 return SBOX_TEST_FAILED_TO_RUN_TEST; |
246 | 247 |
247 ::ResumeThread(target.hThread); | 248 ::ResumeThread(target.hThread); |
248 | 249 |
249 // For an asynchronous run we don't bother waiting. | 250 // For an asynchronous run we don't bother waiting. |
250 if (is_async_) { | 251 if (is_async_) { |
251 target_process_.Set(target.hProcess); | 252 target_process_.Set(target.hProcess); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 367 |
367 target->LowerToken(); | 368 target->LowerToken(); |
368 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { | 369 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { |
369 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; | 370 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; |
370 } | 371 } |
371 | 372 |
372 return command(argc - 4, argv + 4); | 373 return command(argc - 4, argv + 4); |
373 } | 374 } |
374 | 375 |
375 } // namespace sandbox | 376 } // namespace sandbox |
OLD | NEW |