Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: sandbox/win/tests/common/controller.cc

Issue 2130753002: Made setting lowbox token a warning. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted change to logging Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/win/src/target_process.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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;
226 DWORD last_error = ERROR_SUCCESS;
225 PROCESS_INFORMATION target = {0}; 227 PROCESS_INFORMATION target = {0};
226 228
227 base::string16 arguments(L"\""); 229 base::string16 arguments(L"\"");
228 arguments += prog_name; 230 arguments += prog_name;
229 arguments += L"\" -child"; 231 arguments += L"\" -child";
230 arguments += no_sandbox_ ? L"-no-sandbox " : L" "; 232 arguments += no_sandbox_ ? L"-no-sandbox " : L" ";
231 arguments += command; 233 arguments += command;
232 234
233 if (no_sandbox_) { 235 if (no_sandbox_) {
234 STARTUPINFO startup_info = {sizeof(STARTUPINFO)}; 236 STARTUPINFO startup_info = {sizeof(STARTUPINFO)};
235 if (!::CreateProcessW(prog_name, &arguments[0], NULL, NULL, FALSE, 0, 237 if (!::CreateProcessW(prog_name, &arguments[0], NULL, NULL, FALSE, 0,
236 NULL, NULL, &startup_info, &target)) { 238 NULL, NULL, &startup_info, &target)) {
237 return SBOX_ERROR_GENERIC; 239 return SBOX_ERROR_GENERIC;
238 } 240 }
239 } else { 241 } else {
240 result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_, 242 result = broker_->SpawnTarget(prog_name, arguments.c_str(), policy_,
241 &target); 243 &warning_result, &last_error, &target);
242 } 244 }
243 245
244 if (SBOX_ALL_OK != result) 246 if (SBOX_ALL_OK != result)
245 return SBOX_TEST_FAILED_TO_RUN_TEST; 247 return SBOX_TEST_FAILED_TO_RUN_TEST;
246 248
247 ::ResumeThread(target.hThread); 249 ::ResumeThread(target.hThread);
248 250
249 // For an asynchronous run we don't bother waiting. 251 // For an asynchronous run we don't bother waiting.
250 if (is_async_) { 252 if (is_async_) {
251 target_process_.Set(target.hProcess); 253 target_process_.Set(target.hProcess);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 368
367 target->LowerToken(); 369 target->LowerToken();
368 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) { 370 } else if (0 != _wcsicmp(argv[1], L"-child-no-sandbox")) {
369 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; 371 return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND;
370 } 372 }
371 373
372 return command(argc - 4, argv + 4); 374 return command(argc - 4, argv + 4);
373 } 375 }
374 376
375 } // namespace sandbox 377 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/target_process.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698