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

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

Issue 84063004: Restructure sandbox code to reduce dependencies pulled in by intercept code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Grr.. rietveld upload! Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/service_resolver.h" 5 #include "sandbox/win/src/service_resolver.h"
6 6
7 #include "base/logging.h"
8 #include "base/win/pe_image.h" 7 #include "base/win/pe_image.h"
8 #include "sandbox/win/src/sandbox_nt_util.h"
9 9
10 namespace sandbox { 10 namespace sandbox {
11 11
12 NTSTATUS ServiceResolverThunk::ResolveInterceptor( 12 NTSTATUS ServiceResolverThunk::ResolveInterceptor(
13 const void* interceptor_module, 13 const void* interceptor_module,
14 const char* interceptor_name, 14 const char* interceptor_name,
15 const void** address) { 15 const void** address) {
16 // After all, we are using a locally mapped version of the exe, so the 16 // After all, we are using a locally mapped version of the exe, so the
17 // action is the same as for a target function. 17 // action is the same as for a target function.
18 return ResolveTarget(interceptor_module, interceptor_name, 18 return ResolveTarget(interceptor_module, interceptor_name,
19 const_cast<void**>(address)); 19 const_cast<void**>(address));
20 } 20 }
21 21
22 // In this case all the work is done from the parent, so resolve is 22 // In this case all the work is done from the parent, so resolve is
23 // just a simple GetProcAddress. 23 // just a simple GetProcAddress.
24 NTSTATUS ServiceResolverThunk::ResolveTarget(const void* module, 24 NTSTATUS ServiceResolverThunk::ResolveTarget(const void* module,
25 const char* function_name, 25 const char* function_name,
26 void** address) { 26 void** address) {
27 DCHECK(address);
28 if (NULL == module) 27 if (NULL == module)
29 return STATUS_UNSUCCESSFUL; 28 return STATUS_UNSUCCESSFUL;
30 29
31 base::win::PEImage module_image(module); 30 base::win::PEImage module_image(module);
32 *address = module_image.GetProcAddress(function_name); 31 *address = module_image.GetProcAddress(function_name);
33 32
34 if (NULL == *address) { 33 if (NULL == *address) {
35 NOTREACHED(); 34 NOTREACHED_NT();
36 return STATUS_UNSUCCESSFUL; 35 return STATUS_UNSUCCESSFUL;
37 } 36 }
38 37
39 return STATUS_SUCCESS; 38 return STATUS_SUCCESS;
40 } 39 }
41 40
41 void ServiceResolverThunk::AllowLocalPatches() {
42 ntdll_base_ = ::GetModuleHandle(L"ntdll.dll");
cpu_(ooo_6.6-7.5) 2013/11/29 18:30:07 don't we have a constant for "ntdll.dll"? if it is
robertshield 2013/11/29 19:29:08 There's a wide version of kNtdllName in internal_t
cpu_(ooo_6.6-7.5) 2013/12/01 00:18:44 Either fix sgtm.
43 }
44
42 } // namespace sandbox 45 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698