Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: chrome_elf/hook_util/hook_util.h

Issue 2242323002: Revert of [chrome_elf] Big cleanup and removing dependencies that recently crept in. Part 1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome_elf/elf_imports_unittest.cc ('k') | chrome_elf/hook_util/hook_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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
5 #ifndef CHROME_ELF_HOOK_UTIL_THUNK_GETTER_H_
6 #define CHROME_ELF_HOOK_UTIL_THUNK_GETTER_H_
7
8 #include <windows.h>
9
10 #include "base/macros.h"
11
12 namespace sandbox {
13 class ServiceResolverThunk;
14 }
15
16 namespace elf_hook {
17
18 //------------------------------------------------------------------------------
19 // System Service hooking support
20 //------------------------------------------------------------------------------
21
22 // Creates a |ServiceResolverThunk| based on the OS version. Ownership of the
23 // resulting thunk is passed to the caller.
24 sandbox::ServiceResolverThunk* HookSystemService(bool relaxed);
25
26 //------------------------------------------------------------------------------
27 // Import Address Table hooking support
28 //------------------------------------------------------------------------------
29 class IATHook {
30 public:
31 IATHook();
32 ~IATHook();
33
34 // Intercept a function in an import table of a specific
35 // module. Saves everything needed to Unhook.
36 //
37 // NOTE: Hook can only be called once at a time, to enable Unhook().
38 //
39 // Arguments:
40 // module Module to be intercepted
41 // imported_from_module Module that exports the 'function_name'
42 // function_name Name of the API to be intercepted
43 // new_function New function pointer
44 //
45 // Returns: Windows error code (winerror.h). NO_ERROR if successful.
46 DWORD Hook(HMODULE module,
47 const char* imported_from_module,
48 const char* function_name,
49 void* new_function);
50
51 // Unhook the IAT entry.
52 //
53 // Returns: Windows error code (winerror.h). NO_ERROR if successful.
54 DWORD Unhook();
55
56 private:
57 void* intercept_function_;
58 void* original_function_;
59 IMAGE_THUNK_DATA* iat_thunk_;
60
61 DISALLOW_COPY_AND_ASSIGN(IATHook);
62 };
63
64 } // namespace elf_hook
65
66 #endif // CHROME_ELF_HOOK_UTIL_THUNK_GETTER_H_
OLDNEW
« no previous file with comments | « chrome_elf/elf_imports_unittest.cc ('k') | chrome_elf/hook_util/hook_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698