| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "sandbox/win/src/ipc_tags.h" | 10 #include "sandbox/win/src/ipc_tags.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { | 210 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { |
| 211 ::CloseHandle(local_handle); | 211 ::CloseHandle(local_handle); |
| 212 return STATUS_ACCESS_DENIED; | 212 return STATUS_ACCESS_DENIED; |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 return status; | 215 return status; |
| 216 } | 216 } |
| 217 | 217 |
| 218 DWORD ProcessPolicy::CreateProcessWAction(EvalResult eval_result, | 218 DWORD ProcessPolicy::CreateProcessWAction(EvalResult eval_result, |
| 219 const ClientInfo& client_info, | 219 const ClientInfo& client_info, |
| 220 const std::wstring &app_name, | 220 const base::string16 &app_name, |
| 221 const std::wstring &command_line, | 221 const base::string16 &command_line, |
| 222 PROCESS_INFORMATION* process_info) { | 222 PROCESS_INFORMATION* process_info) { |
| 223 // The only action supported is ASK_BROKER which means create the process. | 223 // The only action supported is ASK_BROKER which means create the process. |
| 224 if (GIVE_ALLACCESS != eval_result && GIVE_READONLY != eval_result) { | 224 if (GIVE_ALLACCESS != eval_result && GIVE_READONLY != eval_result) { |
| 225 return ERROR_ACCESS_DENIED; | 225 return ERROR_ACCESS_DENIED; |
| 226 } | 226 } |
| 227 | 227 |
| 228 STARTUPINFO startup_info = {0}; | 228 STARTUPINFO startup_info = {0}; |
| 229 startup_info.cb = sizeof(startup_info); | 229 startup_info.cb = sizeof(startup_info); |
| 230 scoped_ptr_malloc<wchar_t> cmd_line(_wcsdup(command_line.c_str())); | 230 scoped_ptr_malloc<wchar_t> cmd_line(_wcsdup(command_line.c_str())); |
| 231 | 231 |
| 232 BOOL should_give_full_access = (GIVE_ALLACCESS == eval_result); | 232 BOOL should_give_full_access = (GIVE_ALLACCESS == eval_result); |
| 233 if (!CreateProcessExWHelper(client_info.process, should_give_full_access, | 233 if (!CreateProcessExWHelper(client_info.process, should_give_full_access, |
| 234 app_name.c_str(), cmd_line.get(), NULL, NULL, | 234 app_name.c_str(), cmd_line.get(), NULL, NULL, |
| 235 FALSE, 0, NULL, NULL, &startup_info, | 235 FALSE, 0, NULL, NULL, &startup_info, |
| 236 process_info)) { | 236 process_info)) { |
| 237 return ERROR_ACCESS_DENIED; | 237 return ERROR_ACCESS_DENIED; |
| 238 } | 238 } |
| 239 return ERROR_SUCCESS; | 239 return ERROR_SUCCESS; |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace sandbox | 242 } // namespace sandbox |
| OLD | NEW |