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

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

Issue 382613002: Fixes for re-enabling more MSVC level 4 warnings: sandbox/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comments + cleanup Created 6 years, 5 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
« no previous file with comments | « sandbox/win/src/process_policy_test.cc ('k') | sandbox/win/src/sync_policy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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/sync_dispatcher.h" 5 #include "sandbox/win/src/sync_dispatcher.h"
6 6
7 #include "base/win/windows_version.h" 7 #include "base/win/windows_version.h"
8 #include "sandbox/win/src/crosscall_client.h" 8 #include "sandbox/win/src/crosscall_client.h"
9 #include "sandbox/win/src/interception.h" 9 #include "sandbox/win/src/interception.h"
10 #include "sandbox/win/src/interceptors.h" 10 #include "sandbox/win/src/interceptors.h"
(...skipping 17 matching lines...) Expand all
28 {IPC_OPENEVENT_TAG, WCHAR_TYPE, ULONG_TYPE}, 28 {IPC_OPENEVENT_TAG, WCHAR_TYPE, ULONG_TYPE},
29 reinterpret_cast<CallbackGeneric>(&SyncDispatcher::OpenEvent) 29 reinterpret_cast<CallbackGeneric>(&SyncDispatcher::OpenEvent)
30 }; 30 };
31 31
32 ipc_calls_.push_back(create_params); 32 ipc_calls_.push_back(create_params);
33 ipc_calls_.push_back(open_params); 33 ipc_calls_.push_back(open_params);
34 } 34 }
35 35
36 bool SyncDispatcher::SetupService(InterceptionManager* manager, 36 bool SyncDispatcher::SetupService(InterceptionManager* manager,
37 int service) { 37 int service) {
38 if (IPC_CREATEEVENT_TAG == service) { 38 if (service == IPC_CREATEEVENT_TAG) {
39 return INTERCEPT_NT(manager, NtCreateEvent, CREATE_EVENT_ID, 24); 39 return INTERCEPT_NT(manager, NtCreateEvent, CREATE_EVENT_ID, 24);
40 } else if (IPC_OPENEVENT_TAG == service) {
41 return INTERCEPT_NT(manager, NtOpenEvent, OPEN_EVENT_ID, 16);
42 } 40 }
43 return false; 41 return (service == IPC_OPENEVENT_TAG) &&
42 INTERCEPT_NT(manager, NtOpenEvent, OPEN_EVENT_ID, 16);
44 } 43 }
45 44
46 bool SyncDispatcher::CreateEvent(IPCInfo* ipc, base::string16* name, 45 bool SyncDispatcher::CreateEvent(IPCInfo* ipc, base::string16* name,
47 DWORD event_type, DWORD initial_state) { 46 DWORD event_type, DWORD initial_state) {
48 const wchar_t* event_name = name->c_str(); 47 const wchar_t* event_name = name->c_str();
49 CountedParameterSet<NameBased> params; 48 CountedParameterSet<NameBased> params;
50 params[NameBased::NAME] = ParamPickerMake(event_name); 49 params[NameBased::NAME] = ParamPickerMake(event_name);
51 50
52 EvalResult result = policy_base_->EvalPolicy(IPC_CREATEEVENT_TAG, 51 EvalResult result = policy_base_->EvalPolicy(IPC_CREATEEVENT_TAG,
53 params.GetBase()); 52 params.GetBase());
54 HANDLE handle = NULL; 53 HANDLE handle = NULL;
55 DWORD ret = SyncPolicy::CreateEventAction(result, *ipc->client_info, *name,
56 event_type, initial_state,
57 &handle);
58 // Return operation status on the IPC. 54 // Return operation status on the IPC.
59 ipc->return_info.nt_status = ret; 55 ipc->return_info.nt_status = SyncPolicy::CreateEventAction(
56 result, *ipc->client_info, *name, event_type, initial_state, &handle);
60 ipc->return_info.handle = handle; 57 ipc->return_info.handle = handle;
61 return true; 58 return true;
62 } 59 }
63 60
64 bool SyncDispatcher::OpenEvent(IPCInfo* ipc, base::string16* name, 61 bool SyncDispatcher::OpenEvent(IPCInfo* ipc, base::string16* name,
65 DWORD desired_access) { 62 DWORD desired_access) {
66 const wchar_t* event_name = name->c_str(); 63 const wchar_t* event_name = name->c_str();
67 64
68 CountedParameterSet<OpenEventParams> params; 65 CountedParameterSet<OpenEventParams> params;
69 params[OpenEventParams::NAME] = ParamPickerMake(event_name); 66 params[OpenEventParams::NAME] = ParamPickerMake(event_name);
70 params[OpenEventParams::ACCESS] = ParamPickerMake(desired_access); 67 params[OpenEventParams::ACCESS] = ParamPickerMake(desired_access);
71 68
72 EvalResult result = policy_base_->EvalPolicy(IPC_OPENEVENT_TAG, 69 EvalResult result = policy_base_->EvalPolicy(IPC_OPENEVENT_TAG,
73 params.GetBase()); 70 params.GetBase());
74 HANDLE handle = NULL; 71 HANDLE handle = NULL;
75 DWORD ret = SyncPolicy::OpenEventAction(result, *ipc->client_info, *name,
76 desired_access, &handle);
77 // Return operation status on the IPC. 72 // Return operation status on the IPC.
78 ipc->return_info.win32_result = ret; 73 ipc->return_info.nt_status = SyncPolicy::OpenEventAction(
74 result, *ipc->client_info, *name, desired_access, &handle);
79 ipc->return_info.handle = handle; 75 ipc->return_info.handle = handle;
80 return true; 76 return true;
81 } 77 }
82 78
83 } // namespace sandbox 79 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/process_policy_test.cc ('k') | sandbox/win/src/sync_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698