michael@0: // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "sandbox/win/src/service_resolver.h" michael@0: michael@0: #include "base/logging.h" michael@0: #include "base/win/pe_image.h" michael@0: michael@0: namespace sandbox { michael@0: michael@0: NTSTATUS ServiceResolverThunk::ResolveInterceptor( michael@0: const void* interceptor_module, michael@0: const char* interceptor_name, michael@0: const void** address) { michael@0: // After all, we are using a locally mapped version of the exe, so the michael@0: // action is the same as for a target function. michael@0: return ResolveTarget(interceptor_module, interceptor_name, michael@0: const_cast(address)); michael@0: } michael@0: michael@0: // In this case all the work is done from the parent, so resolve is michael@0: // just a simple GetProcAddress. michael@0: NTSTATUS ServiceResolverThunk::ResolveTarget(const void* module, michael@0: const char* function_name, michael@0: void** address) { michael@0: DCHECK(address); michael@0: if (NULL == module) michael@0: return STATUS_UNSUCCESSFUL; michael@0: michael@0: base::win::PEImage module_image(module); michael@0: *address = module_image.GetProcAddress(function_name); michael@0: michael@0: if (NULL == *address) { michael@0: NOTREACHED(); michael@0: return STATUS_UNSUCCESSFUL; michael@0: } michael@0: michael@0: return STATUS_SUCCESS; michael@0: } michael@0: michael@0: } // namespace sandbox