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_policy.h" | 5 #include "content/common/sandbox_policy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 "You are attempting to duplicate a privileged handle into a sandboxed" | 482 "You are attempting to duplicate a privileged handle into a sandboxed" |
483 " process.\n Please use the sandbox::BrokerDuplicateHandle API or" | 483 " process.\n Please use the sandbox::BrokerDuplicateHandle API or" |
484 " contact security@chromium.org for assistance."; | 484 " contact security@chromium.org for assistance."; |
485 | 485 |
486 void CheckDuplicateHandle(HANDLE handle) { | 486 void CheckDuplicateHandle(HANDLE handle) { |
487 // Get the object type (32 characters is safe; current max is 14). | 487 // Get the object type (32 characters is safe; current max is 14). |
488 BYTE buffer[sizeof(OBJECT_TYPE_INFORMATION) + 32 * sizeof(wchar_t)]; | 488 BYTE buffer[sizeof(OBJECT_TYPE_INFORMATION) + 32 * sizeof(wchar_t)]; |
489 OBJECT_TYPE_INFORMATION* type_info = | 489 OBJECT_TYPE_INFORMATION* type_info = |
490 reinterpret_cast<OBJECT_TYPE_INFORMATION*>(buffer); | 490 reinterpret_cast<OBJECT_TYPE_INFORMATION*>(buffer); |
491 ULONG size = sizeof(buffer) - sizeof(wchar_t); | 491 ULONG size = sizeof(buffer) - sizeof(wchar_t); |
492 DWORD error; | 492 NTSTATUS error; |
493 error = g_QueryObject(handle, ObjectTypeInformation, type_info, size, &size); | 493 error = g_QueryObject(handle, ObjectTypeInformation, type_info, size, &size); |
494 CHECK(NT_SUCCESS(error)); | 494 CHECK(NT_SUCCESS(error)); |
495 type_info->Name.Buffer[type_info->Name.Length / sizeof(wchar_t)] = L'\0'; | 495 type_info->Name.Buffer[type_info->Name.Length / sizeof(wchar_t)] = L'\0'; |
496 | 496 |
497 // Get the object basic information. | 497 // Get the object basic information. |
498 OBJECT_BASIC_INFORMATION basic_info; | 498 OBJECT_BASIC_INFORMATION basic_info; |
499 size = sizeof(basic_info); | 499 size = sizeof(basic_info); |
500 error = g_QueryObject(handle, ObjectBasicInformation, &basic_info, size, | 500 error = g_QueryObject(handle, ObjectBasicInformation, &basic_info, size, |
501 &size); | 501 &size); |
502 CHECK(NT_SUCCESS(error)); | 502 CHECK(NT_SUCCESS(error)); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 } | 833 } |
834 | 834 |
835 return false; | 835 return false; |
836 } | 836 } |
837 | 837 |
838 bool BrokerAddTargetPeer(HANDLE peer_process) { | 838 bool BrokerAddTargetPeer(HANDLE peer_process) { |
839 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; | 839 return g_broker_services->AddTargetPeer(peer_process) == sandbox::SBOX_ALL_OK; |
840 } | 840 } |
841 | 841 |
842 } // namespace content | 842 } // namespace content |
OLD | NEW |