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

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

Issue 3836005: Move pe_image and registry from base to base/win and use the namespace. It re... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « sandbox/src/sidestep_resolver.cc ('k') | webkit/glue/plugins/plugin_list_win.cc » ('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) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2010 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/src/target_process.h" 5 #include "sandbox/src/target_process.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/pe_image.h"
9 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/win/pe_image.h"
10 #include "sandbox/src/crosscall_server.h" 10 #include "sandbox/src/crosscall_server.h"
11 #include "sandbox/src/crosscall_client.h" 11 #include "sandbox/src/crosscall_client.h"
12 #include "sandbox/src/policy_low_level.h" 12 #include "sandbox/src/policy_low_level.h"
13 #include "sandbox/src/sandbox_types.h" 13 #include "sandbox/src/sandbox_types.h"
14 #include "sandbox/src/sharedmem_ipc_server.h" 14 #include "sandbox/src/sharedmem_ipc_server.h"
15 15
16 namespace { 16 namespace {
17 17
18 void TerminateTarget(PROCESS_INFORMATION* pi) { 18 void TerminateTarget(PROCESS_INFORMATION* pi) {
19 ::CloseHandle(pi->hThread); 19 ::CloseHandle(pi->hThread);
(...skipping 27 matching lines...) Expand all
47 SANDBOX_INTERCEPT size_t g_shared_IPC_size; 47 SANDBOX_INTERCEPT size_t g_shared_IPC_size;
48 SANDBOX_INTERCEPT size_t g_shared_policy_size; 48 SANDBOX_INTERCEPT size_t g_shared_policy_size;
49 49
50 // Returns the address of the main exe module in memory taking in account 50 // Returns the address of the main exe module in memory taking in account
51 // address space layout randomization. 51 // address space layout randomization.
52 void* GetBaseAddress(const wchar_t* exe_name, void* entry_point) { 52 void* GetBaseAddress(const wchar_t* exe_name, void* entry_point) {
53 HMODULE exe = ::LoadLibrary(exe_name); 53 HMODULE exe = ::LoadLibrary(exe_name);
54 if (NULL == exe) 54 if (NULL == exe)
55 return exe; 55 return exe;
56 56
57 PEImage pe(exe); 57 base::win::PEImage pe(exe);
58 if (!pe.VerifyMagic()) { 58 if (!pe.VerifyMagic()) {
59 ::FreeLibrary(exe); 59 ::FreeLibrary(exe);
60 return exe; 60 return exe;
61 } 61 }
62 PIMAGE_NT_HEADERS nt_header = pe.GetNTHeaders(); 62 PIMAGE_NT_HEADERS nt_header = pe.GetNTHeaders();
63 char* base = reinterpret_cast<char*>(entry_point) - 63 char* base = reinterpret_cast<char*>(entry_point) -
64 nt_header->OptionalHeader.AddressOfEntryPoint; 64 nt_header->OptionalHeader.AddressOfEntryPoint;
65 65
66 ::FreeLibrary(exe); 66 ::FreeLibrary(exe);
67 return base; 67 return base;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 321
322 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) { 322 TargetProcess* MakeTestTargetProcess(HANDLE process, HMODULE base_address) {
323 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL); 323 TargetProcess* target = new TargetProcess(NULL, NULL, NULL, NULL);
324 target->sandbox_process_ = process; 324 target->sandbox_process_ = process;
325 target->base_address_ = base_address; 325 target->base_address_ = base_address;
326 return target; 326 return target;
327 } 327 }
328 328
329 } // namespace sandbox 329 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/src/sidestep_resolver.cc ('k') | webkit/glue/plugins/plugin_list_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698