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

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

Issue 2183263003: [chrome_elf] Big ELF cleanup. Part 1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fixes, part 1. 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
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 // Systen Service hooking support
robertshield 2016/08/03 04:52:45 s/Systen/System/
penny 2016/08/04 18:55:35 Done.
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 {
robertshield 2016/08/03 04:52:45 It would be pretty cool (and not too much work I t
penny 2016/08/04 18:55:35 Done. Was going to leave this until I finish remov
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 // Arguments:
38 // module Module to be intercepted
39 // imported_from_module Module that exports the 'function_name'
40 // function_name Name of the API to be intercepted
robertshield 2016/08/03 04:52:45 new_function should be added here for completeness
penny 2016/08/04 18:55:35 Done.
41 //
42 // Returns: Windows error code (winerror.h). NO_ERROR if successful.
43 DWORD Hook(HMODULE module,
robertshield 2016/08/03 04:52:45 From the implementation, it looks like Hook should
penny 2016/08/04 18:55:35 Done.
44 const char* imported_from_module,
45 const char* function_name,
46 void* new_function);
47
48 // Unhook the IAT entry.
49 //
50 // Returns: Windows error code (winerror.h). NO_ERROR if successful.
51 DWORD Unhook();
52
53 private:
54 HMODULE module_handle_;
55 void* intercept_function_;
56 void* original_function_;
57 IMAGE_THUNK_DATA* iat_thunk_;
58
59 DISALLOW_COPY_AND_ASSIGN(elf_hook::IATHook);
60 };
61 }
62
63 #endif // CHROME_ELF_HOOK_UTIL_THUNK_GETTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698