security/sandbox/win/src/service_resolver.cc

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #include "sandbox/win/src/service_resolver.h"
michael@0 6
michael@0 7 #include "base/logging.h"
michael@0 8 #include "base/win/pe_image.h"
michael@0 9
michael@0 10 namespace sandbox {
michael@0 11
michael@0 12 NTSTATUS ServiceResolverThunk::ResolveInterceptor(
michael@0 13 const void* interceptor_module,
michael@0 14 const char* interceptor_name,
michael@0 15 const void** address) {
michael@0 16 // After all, we are using a locally mapped version of the exe, so the
michael@0 17 // action is the same as for a target function.
michael@0 18 return ResolveTarget(interceptor_module, interceptor_name,
michael@0 19 const_cast<void**>(address));
michael@0 20 }
michael@0 21
michael@0 22 // In this case all the work is done from the parent, so resolve is
michael@0 23 // just a simple GetProcAddress.
michael@0 24 NTSTATUS ServiceResolverThunk::ResolveTarget(const void* module,
michael@0 25 const char* function_name,
michael@0 26 void** address) {
michael@0 27 DCHECK(address);
michael@0 28 if (NULL == module)
michael@0 29 return STATUS_UNSUCCESSFUL;
michael@0 30
michael@0 31 base::win::PEImage module_image(module);
michael@0 32 *address = module_image.GetProcAddress(function_name);
michael@0 33
michael@0 34 if (NULL == *address) {
michael@0 35 NOTREACHED();
michael@0 36 return STATUS_UNSUCCESSFUL;
michael@0 37 }
michael@0 38
michael@0 39 return STATUS_SUCCESS;
michael@0 40 }
michael@0 41
michael@0 42 } // namespace sandbox

mercurial