OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/target_process.h" | 5 #include "sandbox/win/src/target_process.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <utility> | 11 #include <utility> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/free_deleter.h" | 14 #include "base/memory/free_deleter.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/win/pe_image.h" | 15 #include "base/win/pe_image.h" |
16 #include "base/win/startup_information.h" | 16 #include "base/win/startup_information.h" |
17 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
18 #include "sandbox/win/src/crosscall_client.h" | 18 #include "sandbox/win/src/crosscall_client.h" |
19 #include "sandbox/win/src/crosscall_server.h" | 19 #include "sandbox/win/src/crosscall_server.h" |
20 #include "sandbox/win/src/policy_low_level.h" | 20 #include "sandbox/win/src/policy_low_level.h" |
21 #include "sandbox/win/src/sandbox_types.h" | 21 #include "sandbox/win/src/sandbox_types.h" |
22 #include "sandbox/win/src/sharedmem_ipc_server.h" | 22 #include "sandbox/win/src/sharedmem_ipc_server.h" |
23 #include "sandbox/win/src/win_utils.h" | 23 #include "sandbox/win/src/win_utils.h" |
24 | 24 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 base::win::ScopedProcessInformation* target_info) { | 126 base::win::ScopedProcessInformation* target_info) { |
127 if (lowbox_token_.IsValid() && | 127 if (lowbox_token_.IsValid() && |
128 base::win::GetVersion() < base::win::VERSION_WIN8) { | 128 base::win::GetVersion() < base::win::VERSION_WIN8) { |
129 // We don't allow lowbox_token below Windows 8. | 129 // We don't allow lowbox_token below Windows 8. |
130 return ERROR_INVALID_PARAMETER; | 130 return ERROR_INVALID_PARAMETER; |
131 } | 131 } |
132 | 132 |
133 exe_name_.reset(_wcsdup(exe_path)); | 133 exe_name_.reset(_wcsdup(exe_path)); |
134 | 134 |
135 // the command line needs to be writable by CreateProcess(). | 135 // the command line needs to be writable by CreateProcess(). |
136 scoped_ptr<wchar_t, base::FreeDeleter> cmd_line(_wcsdup(command_line)); | 136 std::unique_ptr<wchar_t, base::FreeDeleter> cmd_line(_wcsdup(command_line)); |
137 | 137 |
138 // Start the target process suspended. | 138 // Start the target process suspended. |
139 DWORD flags = | 139 DWORD flags = |
140 CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT | DETACHED_PROCESS; | 140 CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT | DETACHED_PROCESS; |
141 | 141 |
142 if (startup_info.has_extended_startup_info()) | 142 if (startup_info.has_extended_startup_info()) |
143 flags |= EXTENDED_STARTUPINFO_PRESENT; | 143 flags |= EXTENDED_STARTUPINFO_PRESENT; |
144 | 144 |
145 if (job_ && base::win::GetVersion() < base::win::VERSION_WIN8) { | 145 if (job_ && base::win::GetVersion() < base::win::VERSION_WIN8) { |
146 // Windows 8 implements nested jobs, but for older systems we need to | 146 // Windows 8 implements nested jobs, but for older systems we need to |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 new TargetProcess(base::win::ScopedHandle(), base::win::ScopedHandle(), | 362 new TargetProcess(base::win::ScopedHandle(), base::win::ScopedHandle(), |
363 base::win::ScopedHandle(), NULL, NULL); | 363 base::win::ScopedHandle(), NULL, NULL); |
364 PROCESS_INFORMATION process_info = {}; | 364 PROCESS_INFORMATION process_info = {}; |
365 process_info.hProcess = process; | 365 process_info.hProcess = process; |
366 target->sandbox_process_info_.Set(process_info); | 366 target->sandbox_process_info_.Set(process_info); |
367 target->base_address_ = base_address; | 367 target->base_address_ = base_address; |
368 return target; | 368 return target; |
369 } | 369 } |
370 | 370 |
371 } // namespace sandbox | 371 } // namespace sandbox |
OLD | NEW |