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

Side by Side Diff: chrome_frame/vtable_patch_manager.h

Issue 218019: Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/vectored_handler-impl.h ('k') | chrome_frame/vtable_patch_manager.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 (c) 2009 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_FRAME_COMMON_VTABLE_PATCH_MANAGER_H_
6 #define CHROME_FRAME_COMMON_VTABLE_PATCH_MANAGER_H_
7
8 #include <windows.h>
9
10 struct FunctionStub;
11 // This namespace provides methods to patch VTable methods of COM interfaces.
12 namespace vtable_patch {
13
14 // This structure represents information about one VTable method.
15 // We allocate an array of these structures per VTable that we patch to
16 // remember the original method. We also use this structure to actually
17 // describe the VTable patch functions
18 struct MethodPatchInfo {
19 int index_;
20 PROC method_;
21 FunctionStub* stub_;
22 };
23
24 // Patches methods in the passed in COM interface. The indexes of the
25 // methods to patch and the actual patch functions are described in the
26 // array pointed to by patches.
27 // @param[in] unknown The pointer of the COM interface to patch
28 // @param[in] patches An array of MethodPatchInfo structures describing
29 // the methods to patch and the patch functions.
30 // The last entry of patches must have index_ set to -1.
31 HRESULT PatchInterfaceMethods(void* unknown, MethodPatchInfo* patches);
32
33 // Using the patch info provided in |patches| the function goes through the
34 // list of patched methods and modifies thunks so that they no longer point
35 // to a hook method but rather go straight through to the original target.
36 // The thunk itself is not destroyed to support chaining.
37 // @param[in] patches An array of MethodPatchInfo structures describing
38 // the methods to patch and the patch functions.
39 // The last entry of patches must have index_ set to -1.
40 HRESULT UnpatchInterfaceMethods(MethodPatchInfo* patches);
41
42 } // namespace vtable_patch
43
44 // Begins the declaration of a VTable patch
45 // @param IFName The name of the interface to patch
46 #define BEGIN_VTABLE_PATCHES(IFName) \
47 vtable_patch::MethodPatchInfo IFName##_PatchInfo[] = {
48
49 // Defines a single method patch in a VTable
50 // @param index The index of the method to patch
51 // @param PatchFunction The patch function
52 #define VTABLE_PATCH_ENTRY(index, PatchFunction) {\
53 index, \
54 reinterpret_cast<PROC>(PatchFunction), \
55 NULL, \
56 },
57
58 // Ends the declaration of a VTable patch by adding an entry with
59 // index set to -1.
60 #define END_VTABLE_PATCHES() \
61 -1, NULL, NULL \
62 };
63
64 #endif // CHROME_FRAME_COMMON_VTABLE_PATCH_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome_frame/vectored_handler-impl.h ('k') | chrome_frame/vtable_patch_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698