OLD | NEW |
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/process_thread_dispatcher.h" | 5 #include "sandbox/win/src/process_thread_dispatcher.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "sandbox/win/src/crosscall_client.h" | 11 #include "sandbox/win/src/crosscall_client.h" |
10 #include "sandbox/win/src/interception.h" | 12 #include "sandbox/win/src/interception.h" |
11 #include "sandbox/win/src/interceptors.h" | 13 #include "sandbox/win/src/interceptors.h" |
12 #include "sandbox/win/src/ipc_tags.h" | 14 #include "sandbox/win/src/ipc_tags.h" |
13 #include "sandbox/win/src/policy_broker.h" | 15 #include "sandbox/win/src/policy_broker.h" |
14 #include "sandbox/win/src/policy_params.h" | 16 #include "sandbox/win/src/policy_params.h" |
15 #include "sandbox/win/src/process_thread_interception.h" | 17 #include "sandbox/win/src/process_thread_interception.h" |
16 #include "sandbox/win/src/process_thread_policy.h" | 18 #include "sandbox/win/src/process_thread_policy.h" |
17 #include "sandbox/win/src/sandbox.h" | 19 #include "sandbox/win/src/sandbox.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 CREATE_PROCESSW_ID, 44) && | 147 CREATE_PROCESSW_ID, 44) && |
146 INTERCEPT_EAT(manager, L"kernel32.dll", CreateProcessA, | 148 INTERCEPT_EAT(manager, L"kernel32.dll", CreateProcessA, |
147 CREATE_PROCESSA_ID, 44); | 149 CREATE_PROCESSA_ID, 44); |
148 | 150 |
149 default: | 151 default: |
150 return false; | 152 return false; |
151 } | 153 } |
152 } | 154 } |
153 | 155 |
154 bool ThreadProcessDispatcher::NtOpenThread(IPCInfo* ipc, | 156 bool ThreadProcessDispatcher::NtOpenThread(IPCInfo* ipc, |
155 uint32 desired_access, | 157 uint32_t desired_access, |
156 uint32 thread_id) { | 158 uint32_t thread_id) { |
157 HANDLE handle; | 159 HANDLE handle; |
158 NTSTATUS ret = ProcessPolicy::OpenThreadAction(*ipc->client_info, | 160 NTSTATUS ret = ProcessPolicy::OpenThreadAction(*ipc->client_info, |
159 desired_access, thread_id, | 161 desired_access, thread_id, |
160 &handle); | 162 &handle); |
161 ipc->return_info.nt_status = ret; | 163 ipc->return_info.nt_status = ret; |
162 ipc->return_info.handle = handle; | 164 ipc->return_info.handle = handle; |
163 return true; | 165 return true; |
164 } | 166 } |
165 | 167 |
166 bool ThreadProcessDispatcher::NtOpenProcess(IPCInfo* ipc, | 168 bool ThreadProcessDispatcher::NtOpenProcess(IPCInfo* ipc, |
167 uint32 desired_access, | 169 uint32_t desired_access, |
168 uint32 process_id) { | 170 uint32_t process_id) { |
169 HANDLE handle; | 171 HANDLE handle; |
170 NTSTATUS ret = ProcessPolicy::OpenProcessAction(*ipc->client_info, | 172 NTSTATUS ret = ProcessPolicy::OpenProcessAction(*ipc->client_info, |
171 desired_access, process_id, | 173 desired_access, process_id, |
172 &handle); | 174 &handle); |
173 ipc->return_info.nt_status = ret; | 175 ipc->return_info.nt_status = ret; |
174 ipc->return_info.handle = handle; | 176 ipc->return_info.handle = handle; |
175 return true; | 177 return true; |
176 } | 178 } |
177 | 179 |
178 bool ThreadProcessDispatcher::NtOpenProcessToken(IPCInfo* ipc, | 180 bool ThreadProcessDispatcher::NtOpenProcessToken(IPCInfo* ipc, |
179 HANDLE process, | 181 HANDLE process, |
180 uint32 desired_access) { | 182 uint32_t desired_access) { |
181 HANDLE handle; | 183 HANDLE handle; |
182 NTSTATUS ret = ProcessPolicy::OpenProcessTokenAction(*ipc->client_info, | 184 NTSTATUS ret = ProcessPolicy::OpenProcessTokenAction(*ipc->client_info, |
183 process, desired_access, | 185 process, desired_access, |
184 &handle); | 186 &handle); |
185 ipc->return_info.nt_status = ret; | 187 ipc->return_info.nt_status = ret; |
186 ipc->return_info.handle = handle; | 188 ipc->return_info.handle = handle; |
187 return true; | 189 return true; |
188 } | 190 } |
189 | 191 |
190 bool ThreadProcessDispatcher::NtOpenProcessTokenEx(IPCInfo* ipc, | 192 bool ThreadProcessDispatcher::NtOpenProcessTokenEx(IPCInfo* ipc, |
191 HANDLE process, | 193 HANDLE process, |
192 uint32 desired_access, | 194 uint32_t desired_access, |
193 uint32 attributes) { | 195 uint32_t attributes) { |
194 HANDLE handle; | 196 HANDLE handle; |
195 NTSTATUS ret = ProcessPolicy::OpenProcessTokenExAction(*ipc->client_info, | 197 NTSTATUS ret = ProcessPolicy::OpenProcessTokenExAction(*ipc->client_info, |
196 process, | 198 process, |
197 desired_access, | 199 desired_access, |
198 attributes, &handle); | 200 attributes, &handle); |
199 ipc->return_info.nt_status = ret; | 201 ipc->return_info.nt_status = ret; |
200 ipc->return_info.handle = handle; | 202 ipc->return_info.handle = handle; |
201 return true; | 203 return true; |
202 } | 204 } |
203 | 205 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // If our logic was wrong, at least we wont allow create a random process. | 238 // If our logic was wrong, at least we wont allow create a random process. |
237 DWORD ret = ProcessPolicy::CreateProcessWAction(eval, *ipc->client_info, | 239 DWORD ret = ProcessPolicy::CreateProcessWAction(eval, *ipc->client_info, |
238 exe_name, *cmd_line, | 240 exe_name, *cmd_line, |
239 proc_info); | 241 proc_info); |
240 | 242 |
241 ipc->return_info.win32_result = ret; | 243 ipc->return_info.win32_result = ret; |
242 return true; | 244 return true; |
243 } | 245 } |
244 | 246 |
245 } // namespace sandbox | 247 } // namespace sandbox |
OLD | NEW |