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

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

Issue 1539423002: Revert of Switch to standard integer types in sandbox/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/target_services.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 "base/basictypes.h"
8 #include <stdint.h>
9
10 #include "base/macros.h" 8 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
12 #include "base/win/pe_image.h" 10 #include "base/win/pe_image.h"
13 #include "base/win/startup_information.h" 11 #include "base/win/startup_information.h"
14 #include "base/win/windows_version.h" 12 #include "base/win/windows_version.h"
13 #include "sandbox/win/src/crosscall_server.h"
15 #include "sandbox/win/src/crosscall_client.h" 14 #include "sandbox/win/src/crosscall_client.h"
16 #include "sandbox/win/src/crosscall_server.h"
17 #include "sandbox/win/src/policy_low_level.h" 15 #include "sandbox/win/src/policy_low_level.h"
18 #include "sandbox/win/src/sandbox_types.h" 16 #include "sandbox/win/src/sandbox_types.h"
19 #include "sandbox/win/src/sharedmem_ipc_server.h" 17 #include "sandbox/win/src/sharedmem_ipc_server.h"
20 #include "sandbox/win/src/win_utils.h" 18 #include "sandbox/win/src/win_utils.h"
21 19
22 namespace { 20 namespace {
23 21
24 void CopyPolicyToTarget(const void* source, size_t size, void* dest) { 22 void CopyPolicyToTarget(const void* source, size_t size, void* dest) {
25 if (!source || !size) 23 if (!source || !size)
26 return; 24 return;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 return SBOX_ERROR_GENERIC; 259 return SBOX_ERROR_GENERIC;
262 260
263 if (written != size) 261 if (written != size)
264 return SBOX_ERROR_GENERIC; 262 return SBOX_ERROR_GENERIC;
265 263
266 return SBOX_ALL_OK; 264 return SBOX_ALL_OK;
267 } 265 }
268 266
269 // Construct the IPC server and the IPC dispatcher. When the target does 267 // Construct the IPC server and the IPC dispatcher. When the target does
270 // an IPC it will eventually call the dispatcher. 268 // an IPC it will eventually call the dispatcher.
271 DWORD TargetProcess::Init(Dispatcher* ipc_dispatcher, 269 DWORD TargetProcess::Init(Dispatcher* ipc_dispatcher, void* policy,
272 void* policy, 270 uint32 shared_IPC_size, uint32 shared_policy_size) {
273 uint32_t shared_IPC_size,
274 uint32_t shared_policy_size) {
275 // We need to map the shared memory on the target. This is necessary for 271 // We need to map the shared memory on the target. This is necessary for
276 // any IPC that needs to take place, even if the target has not yet hit 272 // any IPC that needs to take place, even if the target has not yet hit
277 // the main( ) function or even has initialized the CRT. So here we set 273 // the main( ) function or even has initialized the CRT. So here we set
278 // the handle to the shared section. The target on the first IPC must do 274 // the handle to the shared section. The target on the first IPC must do
279 // the rest, which boils down to calling MapViewofFile() 275 // the rest, which boils down to calling MapViewofFile()
280 276
281 // We use this single memory pool for IPC and for policy. 277 // We use this single memory pool for IPC and for policy.
282 DWORD shared_mem_size = static_cast<DWORD>(shared_IPC_size + 278 DWORD shared_mem_size = static_cast<DWORD>(shared_IPC_size +
283 shared_policy_size); 279 shared_policy_size);
284 shared_section_.Set(::CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, 280 shared_section_.Set(::CreateFileMappingW(INVALID_HANDLE_VALUE, NULL,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 new TargetProcess(base::win::ScopedHandle(), base::win::ScopedHandle(), 355 new TargetProcess(base::win::ScopedHandle(), base::win::ScopedHandle(),
360 base::win::ScopedHandle(), NULL, NULL); 356 base::win::ScopedHandle(), NULL, NULL);
361 PROCESS_INFORMATION process_info = {}; 357 PROCESS_INFORMATION process_info = {};
362 process_info.hProcess = process; 358 process_info.hProcess = process;
363 target->sandbox_process_info_.Set(process_info); 359 target->sandbox_process_info_.Set(process_info);
364 target->base_address_ = base_address; 360 target->base_address_ = base_address;
365 return target; 361 return target;
366 } 362 }
367 363
368 } // namespace sandbox 364 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/win/src/target_process.h ('k') | sandbox/win/src/target_services.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698