Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: sandbox/src/handle_interception.cc

Issue 9838083: Add a sandbox API for broker handle duplication (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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 "sandbox/src/crosscall_client.h"
8 #include "sandbox/src/ipc_tags.h"
9 #include "sandbox/src/sandbox_factory.h"
10 #include "sandbox/src/sandbox_nt_util.h"
11 #include "sandbox/src/sharedmem_ipc_client.h"
12 #include "sandbox/src/target_services.h"
13
14 namespace sandbox {
15
16 ResultCode DuplicateHandleProxy(HANDLE source_handle,
17 DWORD target_process_id,
18 HANDLE* target_handle,
19 DWORD desired_access,
20 BOOL inherit_handle,
21 DWORD options) {
22 *target_handle = NULL;
23
24 void* memory = GetGlobalIPCMemory();
25 if (NULL == memory)
26 return SBOX_ERROR_NO_SPACE;
27
28 SharedMemIPCClient ipc(memory);
29 CrossCallReturn answer = {0};
30 ResultCode code = CrossCall(ipc, IPC_DUPLICATEHANDLEPROXY_TAG,
31 source_handle, target_process_id,
32 desired_access, inherit_handle, options,
33 &answer);
34 if (SBOX_ALL_OK != code)
35 return code;
36
37 if (answer.win32_result) {
38 ::SetLastError(answer.nt_status);
39 return SBOX_ERROR_GENERIC;
40 }
41
42 *target_handle = answer.handle;
43 return SBOX_ALL_OK;
44 }
45
46 } // namespace sandbox
47
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698