Chromium Code Reviews
  | 
| OLD | NEW | 
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "sandbox/src/handle_interception.h" | |
| 6 | |
| 7 #include "base/win/scoped_handle.h" | |
| 
 
rvargas (doing something else)
2012/03/27 00:35:33
remove
 
jschuh
2012/03/27 01:36:19
Done.
 
 | |
| 8 #include "sandbox/src/crosscall_client.h" | |
| 9 #include "sandbox/src/ipc_tags.h" | |
| 10 #include "sandbox/src/sandbox_factory.h" | |
| 11 #include "sandbox/src/sandbox_nt_util.h" | |
| 12 #include "sandbox/src/sharedmem_ipc_client.h" | |
| 13 #include "sandbox/src/target_services.h" | |
| 14 | |
| 15 namespace sandbox { | |
| 16 | |
| 17 ResultCode DuplicateHandleProxy(HANDLE source_handle, | |
| 18 DWORD target_process_id, | |
| 19 HANDLE* target_handle, | |
| 20 DWORD desired_access, | |
| 21 BOOL inherit_handle, | |
| 22 DWORD options) { | |
| 23 if (!ValidParameter(target_handle, sizeof(HANDLE), WRITE)) | |
| 
 
rvargas (doing something else)
2012/03/27 00:35:33
I wouldn't worry about this... maybe just target_h
 
jschuh
2012/03/27 01:36:19
Done.
 
 | |
| 24 return SBOX_ERROR_BAD_PARAMS; | |
| 25 | |
| 26 void* memory = GetGlobalIPCMemory(); | |
| 27 if (NULL == memory) | |
| 28 return SBOX_ERROR_NO_SPACE; | |
| 29 | |
| 30 SharedMemIPCClient ipc(memory); | |
| 31 CrossCallReturn answer = {0}; | |
| 32 ResultCode code = CrossCall(ipc, IPC_DUPLICATEHANDLEPROXY_TAG, | |
| 33 source_handle, target_process_id, | |
| 34 desired_access, inherit_handle, options, | |
| 35 &answer); | |
| 36 if (SBOX_ALL_OK != code) | |
| 37 return code; | |
| 38 | |
| 39 if (answer.win32_result) { | |
| 40 ::SetLastError(answer.nt_status); | |
| 41 return SBOX_ERROR_GENERIC; | |
| 42 } | |
| 43 | |
| 44 *target_handle = answer.handle; | |
| 45 return SBOX_ALL_OK; | |
| 46 } | |
| 47 | |
| 48 } // namespace sandbox | |
| 49 | |
| OLD | NEW |