ash: Extend launcher first button to include leading inset.
[chromium-blink-merge.git] / sandbox / src / sidestep_resolver.h
blob1e7fdac508abc812368087692ea89357a78de206
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SANDBOX_SRC_SIDESTEP_RESOLVER_H__
6 #define SANDBOX_SRC_SIDESTEP_RESOLVER_H__
8 #include "base/basictypes.h"
9 #include "sandbox/src/nt_internals.h"
10 #include "sandbox/src/resolver.h"
12 namespace sandbox {
14 // This is the concrete resolver used to perform sidestep interceptions.
15 class SidestepResolverThunk : public ResolverThunk {
16 public:
17 SidestepResolverThunk() {}
18 virtual ~SidestepResolverThunk() {}
20 // Implementation of Resolver::Setup.
21 virtual NTSTATUS Setup(const void* target_module,
22 const void* interceptor_module,
23 const char* target_name,
24 const char* interceptor_name,
25 const void* interceptor_entry_point,
26 void* thunk_storage,
27 size_t storage_bytes,
28 size_t* storage_used);
30 // Implementation of Resolver::GetThunkSize.
31 virtual size_t GetThunkSize() const;
33 private:
34 DISALLOW_COPY_AND_ASSIGN(SidestepResolverThunk);
37 // This is the concrete resolver used to perform smart sidestep interceptions.
38 // This means basically a sidestep interception that skips the interceptor when
39 // the caller resides on the same dll being intercepted. It is intended as
40 // a helper only, because that determination is not infallible.
41 class SmartSidestepResolverThunk : public SidestepResolverThunk {
42 public:
43 SmartSidestepResolverThunk() {}
44 virtual ~SmartSidestepResolverThunk() {}
46 // Implementation of Resolver::Setup.
47 virtual NTSTATUS Setup(const void* target_module,
48 const void* interceptor_module,
49 const char* target_name,
50 const char* interceptor_name,
51 const void* interceptor_entry_point,
52 void* thunk_storage,
53 size_t storage_bytes,
54 size_t* storage_used);
56 // Implementation of Resolver::GetThunkSize.
57 virtual size_t GetThunkSize() const;
59 private:
60 // Performs the actual call to the interceptor if the conditions are correct
61 // (as determined by IsInternalCall).
62 static void SmartStub();
64 // Returns true if return_address is inside the module loaded at base.
65 static bool IsInternalCall(const void* base, void* return_address);
67 DISALLOW_COPY_AND_ASSIGN(SmartSidestepResolverThunk);
70 } // namespace sandbox
73 #endif // SANDBOX_SRC_SIDESTEP_RESOLVER_H__