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 #include <utility> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/win/pe_image.h" | 13 #include "base/win/pe_image.h" |
13 #include "base/win/startup_information.h" | 14 #include "base/win/startup_information.h" |
14 #include "base/win/windows_version.h" | 15 #include "base/win/windows_version.h" |
15 #include "sandbox/win/src/crosscall_client.h" | 16 #include "sandbox/win/src/crosscall_client.h" |
16 #include "sandbox/win/src/crosscall_server.h" | 17 #include "sandbox/win/src/crosscall_server.h" |
17 #include "sandbox/win/src/policy_low_level.h" | 18 #include "sandbox/win/src/policy_low_level.h" |
18 #include "sandbox/win/src/sandbox_types.h" | 19 #include "sandbox/win/src/sandbox_types.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 69 } |
69 | 70 |
70 TargetProcess::TargetProcess(base::win::ScopedHandle initial_token, | 71 TargetProcess::TargetProcess(base::win::ScopedHandle initial_token, |
71 base::win::ScopedHandle lockdown_token, | 72 base::win::ScopedHandle lockdown_token, |
72 base::win::ScopedHandle lowbox_token, | 73 base::win::ScopedHandle lowbox_token, |
73 HANDLE job, | 74 HANDLE job, |
74 ThreadProvider* thread_pool) | 75 ThreadProvider* thread_pool) |
75 // This object owns everything initialized here except thread_pool and | 76 // This object owns everything initialized here except thread_pool and |
76 // the job_ handle. The Job handle is closed by BrokerServices and results | 77 // the job_ handle. The Job handle is closed by BrokerServices and results |
77 // eventually in a call to our dtor. | 78 // eventually in a call to our dtor. |
78 : lockdown_token_(lockdown_token.Pass()), | 79 : lockdown_token_(std::move(lockdown_token)), |
79 initial_token_(initial_token.Pass()), | 80 initial_token_(std::move(initial_token)), |
80 lowbox_token_(lowbox_token.Pass()), | 81 lowbox_token_(std::move(lowbox_token)), |
81 job_(job), | 82 job_(job), |
82 thread_pool_(thread_pool), | 83 thread_pool_(thread_pool), |
83 base_address_(NULL) {} | 84 base_address_(NULL) {} |
84 | 85 |
85 TargetProcess::~TargetProcess() { | 86 TargetProcess::~TargetProcess() { |
86 DWORD exit_code = 0; | 87 DWORD exit_code = 0; |
87 // Give a chance to the process to die. In most cases the JOB_KILL_ON_CLOSE | 88 // Give a chance to the process to die. In most cases the JOB_KILL_ON_CLOSE |
88 // will take effect only when the context changes. As far as the testing went, | 89 // will take effect only when the context changes. As far as the testing went, |
89 // this wait was enough to switch context and kill the processes in the job. | 90 // this wait was enough to switch context and kill the processes in the job. |
90 // If this process is already dead, the function will return without waiting. | 91 // If this process is already dead, the function will return without waiting. |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 new TargetProcess(base::win::ScopedHandle(), base::win::ScopedHandle(), | 360 new TargetProcess(base::win::ScopedHandle(), base::win::ScopedHandle(), |
360 base::win::ScopedHandle(), NULL, NULL); | 361 base::win::ScopedHandle(), NULL, NULL); |
361 PROCESS_INFORMATION process_info = {}; | 362 PROCESS_INFORMATION process_info = {}; |
362 process_info.hProcess = process; | 363 process_info.hProcess = process; |
363 target->sandbox_process_info_.Set(process_info); | 364 target->sandbox_process_info_.Set(process_info); |
364 target->base_address_ = base_address; | 365 target->base_address_ = base_address; |
365 return target; | 366 return target; |
366 } | 367 } |
367 | 368 |
368 } // namespace sandbox | 369 } // namespace sandbox |
OLD | NEW |