|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // The FontInjector DLL is a utility that allows test code to intercept any |
|
15 // virtual function calls to CFont or COpenFont objects. It is used to detect |
|
16 // possible virtual function calls to objects in the shared heap of the Font |
|
17 // and Bitmap Server from a client process. Currently, such detection only |
|
18 // works on the emulator, where code in a DLL that has been loaded by one |
|
19 // process can effectively be executed from any other process. |
|
20 // |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalTechnology |
|
25 @test |
|
26 */ |
|
27 |
|
28 #ifndef FONTINJECTOR_H |
|
29 #define FONTINJECTOR_H |
|
30 |
|
31 #ifdef __WINS__ |
|
32 |
|
33 #include <e32std.h> |
|
34 |
|
35 class CFont; |
|
36 class COpenFont; |
|
37 |
|
38 class MShellcode |
|
39 { |
|
40 public: |
|
41 virtual void ExecuteShellcode(TInt aFromFunction) = 0; |
|
42 }; |
|
43 |
|
44 template<class C> class XVtableInjector |
|
45 { |
|
46 public: |
|
47 IMPORT_C XVtableInjector(); |
|
48 IMPORT_C ~XVtableInjector(); |
|
49 IMPORT_C TInt InjectShellcode(C* aObject, MShellcode* aShellcode); |
|
50 IMPORT_C static void GetVirtualFunctionName(TInt aIndex, TDes& aName); |
|
51 private: |
|
52 static void ObjectDestroyed(TAny* aObject); |
|
53 virtual void __declspec(naked) Function000(); |
|
54 virtual void __declspec(naked) Function001(); |
|
55 virtual void __declspec(naked) Function002(); |
|
56 virtual void __declspec(naked) Function003(); |
|
57 virtual void __declspec(naked) Function004(); |
|
58 virtual void __declspec(naked) Function005(); |
|
59 virtual void __declspec(naked) Function006(); |
|
60 virtual void __declspec(naked) Function007(); |
|
61 virtual void __declspec(naked) Function008(); |
|
62 virtual void __declspec(naked) Function009(); |
|
63 virtual void __declspec(naked) Function010(); |
|
64 virtual void __declspec(naked) Function011(); |
|
65 virtual void __declspec(naked) Function012(); |
|
66 virtual void __declspec(naked) Function013(); |
|
67 virtual void __declspec(naked) Function014(); |
|
68 virtual void __declspec(naked) Function015(); |
|
69 virtual void __declspec(naked) Function016(); |
|
70 virtual void __declspec(naked) Function017(); |
|
71 virtual void __declspec(naked) Function018(); |
|
72 virtual void __declspec(naked) Function019(); |
|
73 virtual void __declspec(naked) Function020(); |
|
74 virtual void __declspec(naked) Function021(); |
|
75 virtual void __declspec(naked) Function022(); |
|
76 virtual void __declspec(naked) Function023(); |
|
77 virtual void __declspec(naked) Function024(); |
|
78 virtual void __declspec(naked) Function025(); |
|
79 virtual void __declspec(naked) Function026(); |
|
80 virtual void __declspec(naked) Function027(); |
|
81 virtual void __declspec(naked) Function028(); |
|
82 virtual void __declspec(naked) Function029(); |
|
83 virtual void __declspec(naked) Function030(); |
|
84 virtual void __declspec(naked) Function031(); |
|
85 private: |
|
86 static RPointerArray<TAny> gObjects; |
|
87 static MShellcode* gShellcode; |
|
88 static TAny* gOriginalVtable; |
|
89 }; |
|
90 |
|
91 typedef XVtableInjector<CFont> XFontInjector; |
|
92 typedef XVtableInjector<COpenFont> XOpenFontInjector; |
|
93 |
|
94 #endif // __WINS__ |
|
95 |
|
96 #endif // FONTINJECTOR_H |