| 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 "sandbox/win/src/handle_dispatcher.h" | 5 #include "sandbox/win/src/handle_dispatcher.h" |
| 6 | 6 |
| 7 #include <stdint.h> | |
| 8 | |
| 9 #include "base/win/scoped_handle.h" | 7 #include "base/win/scoped_handle.h" |
| 10 #include "sandbox/win/src/handle_interception.h" | 8 #include "sandbox/win/src/handle_interception.h" |
| 11 #include "sandbox/win/src/handle_policy.h" | 9 #include "sandbox/win/src/handle_policy.h" |
| 12 #include "sandbox/win/src/ipc_tags.h" | 10 #include "sandbox/win/src/ipc_tags.h" |
| 13 #include "sandbox/win/src/policy_broker.h" | 11 #include "sandbox/win/src/policy_broker.h" |
| 14 #include "sandbox/win/src/policy_params.h" | 12 #include "sandbox/win/src/policy_params.h" |
| 15 #include "sandbox/win/src/sandbox.h" | 13 #include "sandbox/win/src/sandbox.h" |
| 16 #include "sandbox/win/src/sandbox_nt_util.h" | 14 #include "sandbox/win/src/sandbox_nt_util.h" |
| 17 #include "sandbox/win/src/sandbox_types.h" | 15 #include "sandbox/win/src/sandbox_types.h" |
| 18 #include "sandbox/win/src/sandbox_utils.h" | 16 #include "sandbox/win/src/sandbox_utils.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 switch (service) { | 34 switch (service) { |
| 37 case IPC_DUPLICATEHANDLEPROXY_TAG: | 35 case IPC_DUPLICATEHANDLEPROXY_TAG: |
| 38 return true; | 36 return true; |
| 39 } | 37 } |
| 40 | 38 |
| 41 return false; | 39 return false; |
| 42 } | 40 } |
| 43 | 41 |
| 44 bool HandleDispatcher::DuplicateHandleProxy(IPCInfo* ipc, | 42 bool HandleDispatcher::DuplicateHandleProxy(IPCInfo* ipc, |
| 45 HANDLE source_handle, | 43 HANDLE source_handle, |
| 46 uint32_t target_process_id, | 44 uint32 target_process_id, |
| 47 uint32_t desired_access, | 45 uint32 desired_access, |
| 48 uint32_t options) { | 46 uint32 options) { |
| 49 static NtQueryObject QueryObject = NULL; | 47 static NtQueryObject QueryObject = NULL; |
| 50 if (!QueryObject) | 48 if (!QueryObject) |
| 51 ResolveNTFunctionPtr("NtQueryObject", &QueryObject); | 49 ResolveNTFunctionPtr("NtQueryObject", &QueryObject); |
| 52 | 50 |
| 53 // Get a copy of the handle for use in the broker process. | 51 // Get a copy of the handle for use in the broker process. |
| 54 HANDLE handle_temp; | 52 HANDLE handle_temp; |
| 55 if (!::DuplicateHandle(ipc->client_info->process, source_handle, | 53 if (!::DuplicateHandle(ipc->client_info->process, source_handle, |
| 56 ::GetCurrentProcess(), &handle_temp, | 54 ::GetCurrentProcess(), &handle_temp, |
| 57 0, FALSE, DUPLICATE_SAME_ACCESS | options)) { | 55 0, FALSE, DUPLICATE_SAME_ACCESS | options)) { |
| 58 ipc->return_info.win32_result = ::GetLastError(); | 56 ipc->return_info.win32_result = ::GetLastError(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 ipc->return_info.win32_result = | 81 ipc->return_info.win32_result = |
| 84 HandlePolicy::DuplicateHandleProxyAction(eval, handle.Get(), | 82 HandlePolicy::DuplicateHandleProxyAction(eval, handle.Get(), |
| 85 target_process_id, | 83 target_process_id, |
| 86 &ipc->return_info.handle, | 84 &ipc->return_info.handle, |
| 87 desired_access, options); | 85 desired_access, options); |
| 88 return true; | 86 return true; |
| 89 } | 87 } |
| 90 | 88 |
| 91 } // namespace sandbox | 89 } // namespace sandbox |
| 92 | 90 |
| OLD | NEW |