OLD | NEW |
---|---|
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/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" |
9 | 8 |
10 namespace sandbox { | 9 namespace sandbox { |
11 | 10 |
12 NTSTATUS ServiceResolverThunk::ResolveInterceptor( | 11 NTSTATUS ServiceResolverThunk::ResolveInterceptor( |
13 const void* interceptor_module, | 12 const void* interceptor_module, |
14 const char* interceptor_name, | 13 const char* interceptor_name, |
15 const void** address) { | 14 const void** address) { |
16 // After all, we are using a locally mapped version of the exe, so the | 15 // After all, we are using a locally mapped version of the exe, so the |
17 // action is the same as for a target function. | 16 // action is the same as for a target function. |
18 return ResolveTarget(interceptor_module, interceptor_name, | 17 return ResolveTarget(interceptor_module, interceptor_name, |
19 const_cast<void**>(address)); | 18 const_cast<void**>(address)); |
20 } | 19 } |
21 | 20 |
22 // In this case all the work is done from the parent, so resolve is | 21 // In this case all the work is done from the parent, so resolve is |
23 // just a simple GetProcAddress. | 22 // just a simple GetProcAddress. |
24 NTSTATUS ServiceResolverThunk::ResolveTarget(const void* module, | 23 NTSTATUS ServiceResolverThunk::ResolveTarget(const void* module, |
25 const char* function_name, | 24 const char* function_name, |
26 void** address) { | 25 void** address) { |
27 DCHECK(address); | |
rvargas (doing something else)
2013/11/26 20:42:12
removing this is fine
robertshield
2013/11/27 20:28:01
Done.
| |
28 if (NULL == module) | 26 if (NULL == module) |
29 return STATUS_UNSUCCESSFUL; | 27 return STATUS_UNSUCCESSFUL; |
30 | 28 |
31 base::win::PEImage module_image(module); | 29 base::win::PEImage module_image(module); |
32 *address = module_image.GetProcAddress(function_name); | 30 *address = module_image.GetProcAddress(function_name); |
33 | 31 |
34 if (NULL == *address) { | 32 if (NULL == *address) { |
35 NOTREACHED(); | |
rvargas (doing something else)
2013/11/26 20:42:12
but this is a little more worrisome. How about DCH
robertshield
2013/11/27 20:28:01
Done.
| |
36 return STATUS_UNSUCCESSFUL; | 33 return STATUS_UNSUCCESSFUL; |
37 } | 34 } |
38 | 35 |
39 return STATUS_SUCCESS; | 36 return STATUS_SUCCESS; |
40 } | 37 } |
41 | 38 |
42 } // namespace sandbox | 39 } // namespace sandbox |
OLD | NEW |