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

Side by Side Diff: sandbox/win/src/sync_dispatcher.cc

Issue 1851213002: Remove sandbox on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nacl compile issues Created 4 years, 8 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
« no previous file with comments | « sandbox/win/src/sync_dispatcher.h ('k') | sandbox/win/src/sync_interception.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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/win/src/sync_dispatcher.h"
6
7 #include <stdint.h>
8
9 #include "base/win/windows_version.h"
10 #include "sandbox/win/src/crosscall_client.h"
11 #include "sandbox/win/src/interception.h"
12 #include "sandbox/win/src/interceptors.h"
13 #include "sandbox/win/src/ipc_tags.h"
14 #include "sandbox/win/src/policy_broker.h"
15 #include "sandbox/win/src/policy_params.h"
16 #include "sandbox/win/src/sandbox.h"
17 #include "sandbox/win/src/sync_interception.h"
18 #include "sandbox/win/src/sync_policy.h"
19
20 namespace sandbox {
21
22 SyncDispatcher::SyncDispatcher(PolicyBase* policy_base)
23 : policy_base_(policy_base) {
24 static const IPCCall create_params = {
25 {IPC_CREATEEVENT_TAG, {WCHAR_TYPE, UINT32_TYPE, UINT32_TYPE}},
26 reinterpret_cast<CallbackGeneric>(&SyncDispatcher::CreateEvent)};
27
28 static const IPCCall open_params = {
29 {IPC_OPENEVENT_TAG, {WCHAR_TYPE, UINT32_TYPE}},
30 reinterpret_cast<CallbackGeneric>(&SyncDispatcher::OpenEvent)};
31
32 ipc_calls_.push_back(create_params);
33 ipc_calls_.push_back(open_params);
34 }
35
36 bool SyncDispatcher::SetupService(InterceptionManager* manager,
37 int service) {
38 if (service == IPC_CREATEEVENT_TAG) {
39 return INTERCEPT_NT(manager, NtCreateEvent, CREATE_EVENT_ID, 24);
40 }
41 return (service == IPC_OPENEVENT_TAG) &&
42 INTERCEPT_NT(manager, NtOpenEvent, OPEN_EVENT_ID, 16);
43 }
44
45 bool SyncDispatcher::CreateEvent(IPCInfo* ipc,
46 base::string16* name,
47 uint32_t event_type,
48 uint32_t initial_state) {
49 const wchar_t* event_name = name->c_str();
50 CountedParameterSet<NameBased> params;
51 params[NameBased::NAME] = ParamPickerMake(event_name);
52
53 EvalResult result = policy_base_->EvalPolicy(IPC_CREATEEVENT_TAG,
54 params.GetBase());
55 HANDLE handle = NULL;
56 // Return operation status on the IPC.
57 ipc->return_info.nt_status = SyncPolicy::CreateEventAction(
58 result, *ipc->client_info, *name, event_type, initial_state, &handle);
59 ipc->return_info.handle = handle;
60 return true;
61 }
62
63 bool SyncDispatcher::OpenEvent(IPCInfo* ipc,
64 base::string16* name,
65 uint32_t desired_access) {
66 const wchar_t* event_name = name->c_str();
67
68 CountedParameterSet<OpenEventParams> params;
69 params[OpenEventParams::NAME] = ParamPickerMake(event_name);
70 params[OpenEventParams::ACCESS] = ParamPickerMake(desired_access);
71
72 EvalResult result = policy_base_->EvalPolicy(IPC_OPENEVENT_TAG,
73 params.GetBase());
74 HANDLE handle = NULL;
75 // Return operation status on the IPC.
76 ipc->return_info.nt_status = SyncPolicy::OpenEventAction(
77 result, *ipc->client_info, *name, desired_access, &handle);
78 ipc->return_info.handle = handle;
79 return true;
80 }
81
82 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/sync_dispatcher.h ('k') | sandbox/win/src/sync_interception.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698