forked from snowie2000/mactype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
override.h
142 lines (123 loc) · 2.61 KB
/
override.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#pragma once
#include "common.h"
#include "tlsdata.h"
#include "undocAPI.h"
#include "gdiPlusFlat2.h"
#include "cache.h"
#include "settings.h"
#include <set>
#include <dwrite_1.h>
#include <dwrite_2.h>
#include <dwrite_3.h>
using namespace std;
/*
typedef struct _STRING {
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} ANSI_STRING, *PANSI_STRING;
typedef int
(WINAPI *PFNLdrGetProcedureAddress)(
IN HMODULE ModuleHandle,
IN PANSI_STRING FunctionName OPTIONAL,
IN WORD Oridinal OPTIONAL,
OUT PVOID *FunctionAddress );
*/
struct CFontSubResult
{
public:
LPWSTR lpRealName;
LPWSTR lpGDIName;
CFontSubResult(LPCWSTR RealName, LPCWSTR GDIName)
{
lpRealName = _wcsdup(RealName);
lpGDIName = _wcsdup(GDIName);
}
~CFontSubResult()
{
if (lpRealName)
free(lpRealName);
if (lpGDIName)
free(lpGDIName);
}
};
typedef map<HFONT, CFontSubResult*> CFontCache;
typedef set<HDC> CDCArray;
class CThreadLocalInfo
{
private:
CBitmapCache m_bmpCache;
bool m_bInExtTextOut;
bool m_bInUniscribe;
bool m_bInUniTextOut;
bool m_bPadding[2];
bool m_bInPath;
public:
CThreadLocalInfo()
: m_bInExtTextOut(false), m_bInUniscribe(false), m_bInPath(false), m_bInUniTextOut(false)
{
TLSDCArray.insert(&m_bmpCache);
}
~CThreadLocalInfo()
{
TLSDCArray.erase(&m_bmpCache);
}
CBitmapCache& BitmapCache()
{
return m_bmpCache;
}
void InExtTextOut(bool b)
{
m_bInExtTextOut = b;
}
bool InExtTextOut() const
{
return m_bInExtTextOut;
}
void InUniscribe(bool b)
{
m_bInUniscribe = b;
}
bool InUniscribe() const
{
return m_bInUniscribe;
}
void InUniTextOut(bool b)
{
m_bInUniTextOut = b;
}
bool InUniTextOut() const
{
return m_bInUniTextOut;
}
void InPath(bool b)
{
m_bInPath = b;
}
bool Path() const
{
return m_bInPath;
}
};
extern CTlsData<CThreadLocalInfo> g_TLInfo;
BOOL IsProcessExcluded();
BOOL IsProcessUnload();
BOOL IsExeUnload(LPCTSTR lpApp);
#define HOOK_MANUALLY HOOK_DEFINE
#define HOOK_DEFINE(rettype, name, argtype) \
extern rettype (WINAPI * ORIG_##name) argtype; \
extern rettype WINAPI IMPL_##name argtype;
#include "hooklist.h"
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
HFONT GetCurrentFont(HDC hdc);
void AddFontToFT(HFONT hf, LPCTSTR lpszFace, int weight, bool italic);
void AddFontToFT(LPCTSTR lpszFace, int weight, bool italic);
int MyGetProcAddress(HMODULE dll, LPSTR funcname);
#define HOOK_MANUALLY(rettype, name, argtype) \
LONG hook_demand_##name(bool bForce);
#define HOOK_DEFINE(rettype, name, argtype) ;
#include "hooklist.h"
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
//EOF