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