OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/top_level_dispatcher.h" | 5 #include "sandbox/win/src/top_level_dispatcher.h" |
6 | 6 |
| 7 #include <stdint.h> |
7 #include <string.h> | 8 #include <string.h> |
8 | 9 |
9 #include "base/basictypes.h" | |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "sandbox/win/src/crosscall_server.h" | 12 #include "sandbox/win/src/crosscall_server.h" |
13 #include "sandbox/win/src/filesystem_dispatcher.h" | 13 #include "sandbox/win/src/filesystem_dispatcher.h" |
14 #include "sandbox/win/src/handle_dispatcher.h" | 14 #include "sandbox/win/src/handle_dispatcher.h" |
15 #include "sandbox/win/src/interception.h" | 15 #include "sandbox/win/src/interception.h" |
16 #include "sandbox/win/src/internal_types.h" | 16 #include "sandbox/win/src/internal_types.h" |
17 #include "sandbox/win/src/ipc_tags.h" | 17 #include "sandbox/win/src/ipc_tags.h" |
18 #include "sandbox/win/src/named_pipe_dispatcher.h" | 18 #include "sandbox/win/src/named_pipe_dispatcher.h" |
19 #include "sandbox/win/src/process_mitigations_win32k_dispatcher.h" | 19 #include "sandbox/win/src/process_mitigations_win32k_dispatcher.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 return dispatcher->SetupService(manager, service); | 109 return dispatcher->SetupService(manager, service); |
110 } | 110 } |
111 | 111 |
112 // We service IPC_PING_TAG message which is a way to test a round trip of the | 112 // We service IPC_PING_TAG message which is a way to test a round trip of the |
113 // IPC subsystem. We receive a integer cookie and we are expected to return the | 113 // IPC subsystem. We receive a integer cookie and we are expected to return the |
114 // cookie times two (or three) and the current tick count. | 114 // cookie times two (or three) and the current tick count. |
115 bool TopLevelDispatcher::Ping(IPCInfo* ipc, void* arg1) { | 115 bool TopLevelDispatcher::Ping(IPCInfo* ipc, void* arg1) { |
116 switch (ipc->ipc_tag) { | 116 switch (ipc->ipc_tag) { |
117 case IPC_PING1_TAG: { | 117 case IPC_PING1_TAG: { |
118 IPCInt ipc_int(arg1); | 118 IPCInt ipc_int(arg1); |
119 uint32 cookie = ipc_int.As32Bit(); | 119 uint32_t cookie = ipc_int.As32Bit(); |
120 ipc->return_info.extended_count = 2; | 120 ipc->return_info.extended_count = 2; |
121 ipc->return_info.extended[0].unsigned_int = ::GetTickCount(); | 121 ipc->return_info.extended[0].unsigned_int = ::GetTickCount(); |
122 ipc->return_info.extended[1].unsigned_int = 2 * cookie; | 122 ipc->return_info.extended[1].unsigned_int = 2 * cookie; |
123 return true; | 123 return true; |
124 } | 124 } |
125 case IPC_PING2_TAG: { | 125 case IPC_PING2_TAG: { |
126 CountedBuffer* io_buffer = reinterpret_cast<CountedBuffer*>(arg1); | 126 CountedBuffer* io_buffer = reinterpret_cast<CountedBuffer*>(arg1); |
127 if (sizeof(uint32) != io_buffer->Size()) | 127 if (sizeof(uint32_t) != io_buffer->Size()) |
128 return false; | 128 return false; |
129 | 129 |
130 uint32* cookie = reinterpret_cast<uint32*>(io_buffer->Buffer()); | 130 uint32_t* cookie = reinterpret_cast<uint32_t*>(io_buffer->Buffer()); |
131 *cookie = (*cookie) * 3; | 131 *cookie = (*cookie) * 3; |
132 return true; | 132 return true; |
133 } | 133 } |
134 default: | 134 default: |
135 return false; | 135 return false; |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 Dispatcher* TopLevelDispatcher::GetDispatcher(int ipc_tag) { | 139 Dispatcher* TopLevelDispatcher::GetDispatcher(int ipc_tag) { |
140 if (ipc_tag >= IPC_LAST_TAG || ipc_tag <= IPC_UNUSED_TAG) | 140 if (ipc_tag >= IPC_LAST_TAG || ipc_tag <= IPC_UNUSED_TAG) |
141 return NULL; | 141 return NULL; |
142 | 142 |
143 return ipc_targets_[ipc_tag]; | 143 return ipc_targets_[ipc_tag]; |
144 } | 144 } |
145 | 145 |
146 } // namespace sandbox | 146 } // namespace sandbox |
OLD | NEW |