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