eat_resolver.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.
  4. #ifndef SANDBOX_WIN_SRC_EAT_RESOLVER_H_
  5. #define SANDBOX_WIN_SRC_EAT_RESOLVER_H_
  6. #include <stddef.h>
  7. #include "base/memory/raw_ptr_exclusion.h"
  8. #include "sandbox/win/src/nt_internals.h"
  9. #include "sandbox/win/src/resolver.h"
  10. namespace sandbox {
  11. // This is the concrete resolver used to perform exports table interceptions.
  12. class EatResolverThunk : public ResolverThunk {
  13. public:
  14. EatResolverThunk() : eat_entry_(nullptr) {}
  15. EatResolverThunk(const EatResolverThunk&) = delete;
  16. EatResolverThunk& operator=(const EatResolverThunk&) = delete;
  17. ~EatResolverThunk() override {}
  18. // Implementation of Resolver::Setup.
  19. NTSTATUS Setup(const void* target_module,
  20. const void* interceptor_module,
  21. const char* target_name,
  22. const char* interceptor_name,
  23. const void* interceptor_entry_point,
  24. void* thunk_storage,
  25. size_t storage_bytes,
  26. size_t* storage_used) override;
  27. // Implementation of Resolver::ResolveTarget.
  28. NTSTATUS ResolveTarget(const void* module,
  29. const char* function_name,
  30. void** address) override;
  31. // Implementation of Resolver::GetThunkSize.
  32. size_t GetThunkSize() const override;
  33. private:
  34. // The entry to patch.
  35. // The field is accessed too early during the process startup to support
  36. // raw_ptr<T>.
  37. RAW_PTR_EXCLUSION DWORD* eat_entry_;
  38. };
  39. } // namespace sandbox
  40. #endif // SANDBOX_WIN_SRC_EAT_RESOLVER_H_