Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: sandbox/win/src/target_process.cc

Issue 1849323003: Convert //sandbox to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup nonsfi_sandbox_unittest.cc Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sandbox/win/src/target_process.h ('k') | sandbox/win/src/top_level_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « sandbox/win/src/target_process.h ('k') | sandbox/win/src/top_level_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698