OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_policy.h" | 5 #include "sandbox/win/src/process_thread_policy.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 BOOL should_give_full_access = (GIVE_ALLACCESS == eval_result); | 231 BOOL should_give_full_access = (GIVE_ALLACCESS == eval_result); |
232 if (!CreateProcessExWHelper(client_info.process, should_give_full_access, | 232 if (!CreateProcessExWHelper(client_info.process, should_give_full_access, |
233 app_name.c_str(), cmd_line.get(), NULL, NULL, | 233 app_name.c_str(), cmd_line.get(), NULL, NULL, |
234 FALSE, 0, NULL, NULL, &startup_info, | 234 FALSE, 0, NULL, NULL, &startup_info, |
235 process_info)) { | 235 process_info)) { |
236 return ERROR_ACCESS_DENIED; | 236 return ERROR_ACCESS_DENIED; |
237 } | 237 } |
238 return ERROR_SUCCESS; | 238 return ERROR_SUCCESS; |
239 } | 239 } |
240 | 240 |
| 241 DWORD ProcessPolicy::CreateThreadAction( |
| 242 const ClientInfo& client_info, |
| 243 const SIZE_T stack_size, |
| 244 const LPTHREAD_START_ROUTINE start_address, |
| 245 const LPVOID parameter, |
| 246 const DWORD creation_flags, |
| 247 LPDWORD thread_id, |
| 248 HANDLE* handle) { |
| 249 HANDLE local_handle = |
| 250 ::CreateRemoteThread(client_info.process, nullptr, stack_size, |
| 251 start_address, parameter, creation_flags, thread_id); |
| 252 if (!local_handle) { |
| 253 return ::GetLastError(); |
| 254 } |
| 255 if (!::DuplicateHandle(::GetCurrentProcess(), local_handle, |
| 256 client_info.process, handle, 0, FALSE, |
| 257 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { |
| 258 return ERROR_ACCESS_DENIED; |
| 259 } |
| 260 return ERROR_SUCCESS; |
| 261 } |
| 262 |
241 } // namespace sandbox | 263 } // namespace sandbox |
OLD | NEW |