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