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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 if (logging::IsLoggingToFileEnabled()) { | 807 if (logging::IsLoggingToFileEnabled()) { |
808 DCHECK(base::FilePath(logging::GetLogFileFullPath()).IsAbsolute()); | 808 DCHECK(base::FilePath(logging::GetLogFileFullPath()).IsAbsolute()); |
809 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, | 809 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, |
810 sandbox::TargetPolicy::FILES_ALLOW_ANY, | 810 sandbox::TargetPolicy::FILES_ALLOW_ANY, |
811 logging::GetLogFileFullPath().c_str()); | 811 logging::GetLogFileFullPath().c_str()); |
812 if (result != sandbox::SBOX_ALL_OK) | 812 if (result != sandbox::SBOX_ALL_OK) |
813 return result; | 813 return result; |
814 } | 814 } |
815 } | 815 } |
816 | 816 |
| 817 #if !defined(OFFICIAL_BUILD) |
817 // If stdout/stderr point to a Windows console, these calls will | 818 // If stdout/stderr point to a Windows console, these calls will |
818 // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS. | 819 // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS. |
819 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); | 820 policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE)); |
820 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); | 821 policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE)); |
| 822 #endif |
821 | 823 |
822 if (!delegate->PreSpawnTarget(policy.get())) | 824 if (!delegate->PreSpawnTarget(policy.get())) |
823 return sandbox::SBOX_ERROR_DELEGATE_PRE_SPAWN; | 825 return sandbox::SBOX_ERROR_DELEGATE_PRE_SPAWN; |
824 | 826 |
825 TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); | 827 TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS"); |
826 | 828 |
827 PROCESS_INFORMATION temp_process_info = {}; | 829 PROCESS_INFORMATION temp_process_info = {}; |
828 sandbox::ResultCode last_warning = sandbox::SBOX_ALL_OK; | 830 sandbox::ResultCode last_warning = sandbox::SBOX_ALL_OK; |
829 DWORD last_error = ERROR_SUCCESS; | 831 DWORD last_error = ERROR_SUCCESS; |
830 result = g_broker_services->SpawnTarget( | 832 result = g_broker_services->SpawnTarget( |
(...skipping 20 matching lines...) Expand all Loading... |
851 } | 853 } |
852 | 854 |
853 delegate->PostSpawnTarget(target.process_handle()); | 855 delegate->PostSpawnTarget(target.process_handle()); |
854 | 856 |
855 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); | 857 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); |
856 *process = base::Process(target.TakeProcessHandle()); | 858 *process = base::Process(target.TakeProcessHandle()); |
857 return sandbox::SBOX_ALL_OK; | 859 return sandbox::SBOX_ALL_OK; |
858 } | 860 } |
859 | 861 |
860 } // namespace content | 862 } // namespace content |
OLD | NEW |