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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.WarningResultCode", | 396 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.WarningResultCode", |
397 last_warning); | 397 last_warning); |
398 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Warning", last_error); | 398 UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Warning", last_error); |
399 } | 399 } |
400 | 400 |
401 sandbox::ResultCode AddPolicyForSandboxedProcess( | 401 sandbox::ResultCode AddPolicyForSandboxedProcess( |
402 sandbox::TargetPolicy* policy) { | 402 sandbox::TargetPolicy* policy) { |
403 sandbox::ResultCode result = sandbox::SBOX_ALL_OK; | 403 sandbox::ResultCode result = sandbox::SBOX_ALL_OK; |
404 | 404 |
405 // Win8+ adds a device DeviceApi that we don't need. | 405 // Win8+ adds a device DeviceApi that we don't need. |
406 if (base::win::GetVersion() > base::win::VERSION_WIN7) | 406 if (base::win::GetVersion() >= base::win::VERSION_WIN8) |
407 result = policy->AddKernelObjectToClose(L"File", L"\\Device\\DeviceApi"); | 407 result = policy->AddKernelObjectToClose(L"File", L"\\Device\\DeviceApi"); |
408 if (result != sandbox::SBOX_ALL_OK) | 408 if (result != sandbox::SBOX_ALL_OK) |
409 return result; | 409 return result; |
410 | 410 |
411 // Close the proxy settings on XP. | 411 // Close the proxy settings on XP. |
412 if (base::win::GetVersion() <= base::win::VERSION_SERVER_2003) | 412 if (base::win::GetVersion() <= base::win::VERSION_SERVER_2003) |
413 result = policy->AddKernelObjectToClose(L"Key", | 413 result = policy->AddKernelObjectToClose(L"Key", |
414 L"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\" \ | 414 L"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\" \ |
415 L"CurrentVersion\\Internet Settings"); | 415 L"CurrentVersion\\Internet Settings"); |
416 if (result != sandbox::SBOX_ALL_OK) | 416 if (result != sandbox::SBOX_ALL_OK) |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 } | 887 } |
888 | 888 |
889 delegate->PostSpawnTarget(target.process_handle()); | 889 delegate->PostSpawnTarget(target.process_handle()); |
890 | 890 |
891 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); | 891 CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1)); |
892 *process = base::Process(target.TakeProcessHandle()); | 892 *process = base::Process(target.TakeProcessHandle()); |
893 return sandbox::SBOX_ALL_OK; | 893 return sandbox::SBOX_ALL_OK; |
894 } | 894 } |
895 | 895 |
896 } // namespace content | 896 } // namespace content |
OLD | NEW |