| 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 "content/common/sandbox_win.h" | 5 #include "content/common/sandbox_win.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 if (logging::IsLoggingToFileEnabled()) { | 777 if (logging::IsLoggingToFileEnabled()) { |
| 778 DCHECK(base::FilePath(logging::GetLogFileFullPath()).IsAbsolute()); | 778 DCHECK(base::FilePath(logging::GetLogFileFullPath()).IsAbsolute()); |
| 779 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | 779 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
| 780 sandbox::TargetPolicy::FILES_ALLOW_ANY, | 780 sandbox::TargetPolicy::FILES_ALLOW_ANY, |
| 781 logging::GetLogFileFullPath().c_str()); | 781 logging::GetLogFileFullPath().c_str()); |
| 782 if (result != sandbox::SBOX_ALL_OK) | 782 if (result != sandbox::SBOX_ALL_OK) |
| 783 return result; | 783 return result; |
| 784 } | 784 } |
| 785 } | 785 } |
| 786 | 786 |
| 787 #if !defined(OFFICIAL_BUILD) | |
| 788 // If stdout/stderr point to a Windows console, these calls will | 787 // If stdout/stderr point to a Windows console, these calls will |
| 789 // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS. | 788 // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS. |
| 790 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); | 789 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); |
| 791 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); | 790 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); |
| 792 #endif | |
| 793 | 791 |
| 794 if (!delegate->PreSpawnTarget(policy)) | 792 if (!delegate->PreSpawnTarget(policy)) |
| 795 return sandbox::SBOX_ERROR_DELEGATE_PRE_SPAWN; | 793 return sandbox::SBOX_ERROR_DELEGATE_PRE_SPAWN; |
| 796 | 794 |
| 797 TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); | 795 TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); |
| 798 | 796 |
| 799 PROCESS_INFORMATION temp_process_info = {}; | 797 PROCESS_INFORMATION temp_process_info = {}; |
| 800 sandbox::ResultCode last_warning = sandbox::SBOX_ALL_OK; | 798 sandbox::ResultCode last_warning = sandbox::SBOX_ALL_OK; |
| 801 DWORD last_error = ERROR_SUCCESS; | 799 DWORD last_error = ERROR_SUCCESS; |
| 802 result = g_broker_services->SpawnTarget( | 800 result = g_broker_services->SpawnTarget( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 825 } | 823 } |
| 826 | 824 |
| 827 delegate->PostSpawnTarget(target.process_handle()); | 825 delegate->PostSpawnTarget(target.process_handle()); |
| 828 | 826 |
| 829 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); | 827 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); |
| 830 *process = base::Process(target.TakeProcessHandle()); | 828 *process = base::Process(target.TakeProcessHandle()); |
| 831 return sandbox::SBOX_ALL_OK; | 829 return sandbox::SBOX_ALL_OK; |
| 832 } | 830 } |
| 833 | 831 |
| 834 } // namespace content | 832 } // namespace content |
| OLD | NEW |