forked from snowie2000/mactype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooklist.h
414 lines (352 loc) · 13.9 KB
/
hooklist.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
HOOK_DEFINE(int, GetObjectW, (__in HANDLE h, __in int c, __out_bcount_opt(c) LPVOID pv))
HOOK_DEFINE(int, GetObjectA, (__in HANDLE h, __in int c, __out_bcount_opt(c) LPVOID pv))
HOOK_DEFINE(int, GetTextFaceAliasW, (HDC hdc, int nLen, LPWSTR lpAliasW))
HOOK_DEFINE(BOOL, DeleteObject, ( HGDIOBJ hObject))
HOOK_DEFINE(int, GetTextFaceW, ( __in HDC hdc, __in int c, __out_ecount_part_opt(c, return) LPWSTR lpName))
HOOK_DEFINE(int, GetTextFaceA, ( __in HDC hdc, __in int c, __out_ecount_part_opt(c, return) LPSTR lpName))
HOOK_DEFINE(DWORD, GetGlyphOutlineW, ( __in HDC hdc, \
__in UINT uChar, \
__in UINT fuFormat, \
__out LPGLYPHMETRICS lpgm, \
__in DWORD cjBuffer, \
__out_bcount_opt(cjBuffer) LPVOID pvBuffer, \
__in CONST MAT2 *lpmat2 \
))
HOOK_DEFINE(DWORD, GetGlyphOutlineA, (__in HDC hdc, \
__in UINT uChar, \
__in UINT fuFormat, \
__out LPGLYPHMETRICS lpgm, \
__in DWORD cjBuffer, \
__out_bcount_opt(cjBuffer) LPVOID pvBuffer, \
__in CONST MAT2 *lpmat2))
// DrawTextA,W
// DrawTextExA,W
// TabbedTextOutA,W
// TextOutA,W
// ExtTextOutA
// は内部で ExtTextOutWを呼んでるから ExtTextOutW だけ実装すればOK。←XPの場合
// Windows 2000 でも動くようにその他のAPIもフックを掛けておく。
/*
HOOK_DEFINE(HFONT, CreateFontA, (int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCSTR lpszFace))
HOOK_DEFINE(HFONT, CreateFontW, (int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, DWORD fdwItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCWSTR lpszFace))
HOOK_DEFINE(HFONT, CreateFontIndirectA, (CONST LOGFONTA *lplf))*/
HOOK_DEFINE(HFONT, CreateFontIndirectW, (CONST LOGFONTW *lplf))
HOOK_DEFINE(HFONT, CreateFontIndirectExW, (CONST ENUMLOGFONTEXDV *penumlfex))
// HOOK_DEFINE(BOOL, GetCharWidthW, (HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer))
// HOOK_DEFINE(BOOL, GetCharWidth32W, (HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer))
HOOK_DEFINE(BOOL, TextOutA, (HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString))
HOOK_DEFINE(BOOL, TextOutW, (HDC hdc, int nXStart, int nYStart, LPCWSTR lpString, int cbString))
HOOK_DEFINE(BOOL, ExtTextOutA, (HDC hdc, int nXStart, int nYStart, UINT fuOptions, CONST RECT *lprc, LPCSTR lpString, UINT cbString, CONST INT *lpDx))
HOOK_DEFINE(BOOL, ExtTextOutW, (HDC hdc, int nXStart, int nYStart, UINT fuOptions, CONST RECT *lprc, LPCWSTR lpString, UINT cbString, CONST INT *lpDx))
HOOK_DEFINE(BOOL, RemoveFontResourceExW, (__in LPCWSTR name, __in DWORD fl, __reserved PVOID pdv))
//HOOK_DEFINE(BOOL, RemoveFontResourceW, (__in LPCWSTR lpFileName))
HOOK_DEFINE(HGDIOBJ, GetStockObject, (__in int i))
HOOK_DEFINE(BOOL, BeginPath, (HDC hdc))
HOOK_DEFINE(BOOL, EndPath, (HDC hdc))
HOOK_DEFINE(BOOL, AbortPath, (HDC hdc));
/*
HOOK_MANUALLY(LONG, LdrLoadDll, (IN PWCHAR PathToFile OPTIONAL,
IN ULONG Flags OPTIONAL,
IN UNICODE_STRING2* ModuleFileName,
OUT HANDLE* ModuleHandle ))
*/
HOOK_MANUALLY(HRESULT, BitmapRenderTarget_DrawGlyphRun, (
IDWriteBitmapRenderTarget* This,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
DWRITE_MEASURING_MODE measuringMode,
DWRITE_GLYPH_RUN const* glyphRun,
IDWriteRenderingParams* renderingParams,
COLORREF textColor,
RECT* blackBoxRect))
/*
HOOK_MANUALLY(void, SetTextAntialiasMode, (
ID2D1RenderTarget* self,
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode))
HOOK_MANUALLY(void, SetTextRenderingParams, (
ID2D1RenderTarget* self,
__in_opt IDWriteRenderingParams *textRenderingParams ))*/
HOOK_MANUALLY(HRESULT, DWriteCreateFactory, (
__in DWRITE_FACTORY_TYPE factoryType,
__in REFIID iid,
__out IUnknown **factory))
HOOK_MANUALLY(HRESULT, D2D1CreateDevice, (
IDXGIDevice* dxgiDevice,
CONST D2D1_CREATION_PROPERTIES* creationProperties,
ID2D1Device** d2dDevice))
HOOK_MANUALLY(HRESULT, D2D1CreateDeviceContext, (
IDXGISurface* dxgiSurface,
CONST D2D1_CREATION_PROPERTIES* creationProperties,
ID2D1DeviceContext** d2dDeviceContext))
HOOK_MANUALLY(HRESULT, D2D1CreateFactory, (
D2D1_FACTORY_TYPE factoryType,
REFIID riid,
const D2D1_FACTORY_OPTIONS* pFactoryOptions,
void** ppIFactory))
HOOK_MANUALLY(HRESULT, GetGdiInterop, (
IDWriteFactory* This,
IDWriteGdiInterop** gdiInterop
))
HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis, (
IDWriteFactory* This,
DWRITE_GLYPH_RUN const* glyphRun,
FLOAT pixelsPerDip,
DWRITE_MATRIX const* transform,
DWRITE_RENDERING_MODE renderingMode,
DWRITE_MEASURING_MODE measuringMode,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
IDWriteGlyphRunAnalysis** glyphRunAnalysis
))
HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis2, (
IDWriteFactory2* This,
DWRITE_GLYPH_RUN const* glyphRun,
DWRITE_MATRIX const* transform,
DWRITE_RENDERING_MODE renderingMode,
DWRITE_MEASURING_MODE measuringMode,
DWRITE_GRID_FIT_MODE gridFitMode,
DWRITE_TEXT_ANTIALIAS_MODE antialiasMode,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
IDWriteGlyphRunAnalysis** glyphRunAnalysis
))
HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis3, (
IDWriteFactory3* This,
DWRITE_GLYPH_RUN const* glyphRun,
DWRITE_MATRIX const* transform,
DWRITE_RENDERING_MODE1 renderingMode,
DWRITE_MEASURING_MODE measuringMode,
DWRITE_GRID_FIT_MODE gridFitMode,
DWRITE_TEXT_ANTIALIAS_MODE antialiasMode,
FLOAT baselineOriginX,
FLOAT baselineOriginY,
IDWriteGlyphRunAnalysis** glyphRunAnalysis
))
HOOK_MANUALLY(HRESULT, GetAlphaBlendParams, (
IDWriteGlyphRunAnalysis* This,
IDWriteRenderingParams* renderingParams,
FLOAT* blendGamma,
FLOAT* blendEnhancedContrast,
FLOAT* blendClearTypeLevel
))
HOOK_MANUALLY(HRESULT, CreateDeviceContext, (
ID2D1Device* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext** deviceContext
))
HOOK_MANUALLY(HRESULT, CreateDeviceContext2, (
ID2D1Device1* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext1** deviceContext
))
HOOK_MANUALLY(HRESULT, CreateDeviceContext3, (
ID2D1Device2* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext2** deviceContext
))
HOOK_MANUALLY(HRESULT, CreateDeviceContext4, (
ID2D1Device3* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext3** deviceContext
))
HOOK_MANUALLY(HRESULT, CreateDeviceContext5, (
ID2D1Device4* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext4** deviceContext
))
HOOK_MANUALLY(HRESULT, CreateDeviceContext6, (
ID2D1Device5* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext5** deviceContext
))
HOOK_MANUALLY(HRESULT, CreateDeviceContext7, (
ID2D1Device6* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext6** deviceContext
))
HOOK_MANUALLY(HRESULT, CreateTextFormat, (
IDWriteFactory* self,
__in_z WCHAR const* fontFamilyName,
__maybenull IDWriteFontCollection* fontCollection,
DWRITE_FONT_WEIGHT fontWeight,
DWRITE_FONT_STYLE fontStyle,
DWRITE_FONT_STRETCH fontStretch,
FLOAT fontSize,
__in_z WCHAR const* localeName,
__out IDWriteTextFormat** textFormat))
HOOK_MANUALLY(HRESULT, CreateFontFace, (
IDWriteFont* self,
__out IDWriteFontFace** fontFace
))
HOOK_MANUALLY(HRESULT, DWriteFontFaceReference_CreateFontFace, (
IDWriteFontFaceReference* self,
__out IDWriteFontFace3** fontFace
))
HOOK_MANUALLY(HRESULT, DWriteFontFaceReference_CreateFontFaceWithSimulations, (
IDWriteFontFaceReference* self,
DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags,
__out IDWriteFontFace3** fontFace
))
HOOK_MANUALLY(HRESULT, CreateBitmapRenderTarget, (
IDWriteGdiInterop* This,
HDC hdc,
UINT32 width,
UINT32 height,
IDWriteBitmapRenderTarget** renderTarget
))
HOOK_MANUALLY(HRESULT, CreateCompatibleRenderTarget, (
ID2D1RenderTarget* This,
CONST D2D1_SIZE_F* desiredSize,
CONST D2D1_SIZE_U* desiredPixelSize,
CONST D2D1_PIXEL_FORMAT* desiredFormat,
D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options,
ID2D1BitmapRenderTarget** bitmapRenderTarget
))
HOOK_MANUALLY(void, D2D1RenderTarget_SetTextAntialiasMode, (
ID2D1RenderTarget* This,
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode));
HOOK_MANUALLY(void, D2D1DeviceContext_SetTextAntialiasMode, (
ID2D1DeviceContext* This,
D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode));
HOOK_MANUALLY(void, D2D1RenderTarget_SetTextRenderingParams, (
ID2D1RenderTarget* This,
_In_opt_ IDWriteRenderingParams* textRenderingParams));
HOOK_MANUALLY(void, D2D1DeviceContext_SetTextRenderingParams, (
ID2D1DeviceContext* This,
_In_opt_ IDWriteRenderingParams* textRenderingParams));
/*
HOOK_MANUALLY(GpStatus, GdipDrawString, (
GpGraphics *graphics,
GDIPCONST WCHAR *string,
INT length,
GDIPCONST GpFont *font,
GDIPCONST RectF *layoutRect,
GDIPCONST GpStringFormat *stringFormat,
GDIPCONST GpBrush *brush
))*/
HOOK_MANUALLY(HRESULT, CreateWicBitmapRenderTarget, (
ID2D1Factory* This,
IWICBitmap* target,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
ID2D1RenderTarget** renderTarget));
HOOK_MANUALLY(HRESULT, CreateHwndRenderTarget, (
ID2D1Factory* This,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
const D2D1_HWND_RENDER_TARGET_PROPERTIES* hwndRenderTargetProperties,
ID2D1HwndRenderTarget** hwndRenderTarget));
HOOK_MANUALLY(HRESULT, CreateDxgiSurfaceRenderTarget, (
ID2D1Factory* This,
IDXGISurface* dxgiSurface,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
ID2D1RenderTarget** renderTarget));
HOOK_MANUALLY(HRESULT, CreateDCRenderTarget, (
ID2D1Factory* This,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
ID2D1DCRenderTarget** dcRenderTarget));
HOOK_MANUALLY(HRESULT, CreateDevice1, (
ID2D1Factory1* This,
IDXGIDevice* dxgiDevice,
ID2D1Device** d2dDevice));
HOOK_MANUALLY(HRESULT, CreateDevice2, (
ID2D1Factory2* This,
IDXGIDevice* dxgiDevice,
ID2D1Device1** d2dDevice1
));
HOOK_MANUALLY(HRESULT, CreateDevice3, (
ID2D1Factory3* This,
IDXGIDevice* dxgiDevice,
ID2D1Device2** d2dDevice2
));
HOOK_MANUALLY(HRESULT, CreateDevice4, (
ID2D1Factory4* This,
IDXGIDevice* dxgiDevice,
ID2D1Device3** d2dDevice3
));
HOOK_MANUALLY(HRESULT, CreateDevice5, (
ID2D1Factory5* This,
IDXGIDevice* dxgiDevice,
ID2D1Device4** d2dDevice4
));
HOOK_MANUALLY(HRESULT, CreateDevice6, (
ID2D1Factory6* This,
IDXGIDevice* dxgiDevice,
ID2D1Device5** d2dDevice5
));
HOOK_MANUALLY(HRESULT, CreateDevice7, (
ID2D1Factory7* This,
IDXGIDevice* dxgiDevice,
ID2D1Device6** d2dDevice6
));
HOOK_MANUALLY(BOOL, MySetProcessMitigationPolicy, (
_In_ PROCESS_MITIGATION_POLICY MitigationPolicy,
_In_ PVOID lpBuffer,
_In_ SIZE_T dwLength
));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawGlyphRun1, (
ID2D1DeviceContext *This,
D2D1_POINT_2F baselineOrigin,
CONST DWRITE_GLYPH_RUN *glyphRun,
CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget1_DrawGlyphRun1, (
ID2D1DeviceContext *This,
D2D1_POINT_2F baselineOrigin,
CONST DWRITE_GLYPH_RUN *glyphRun,
CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode));
HOOK_MANUALLY(void, D2D1DeviceContext_DrawGlyphRun1, (
ID2D1DeviceContext *This,
D2D1_POINT_2F baselineOrigin,
CONST DWRITE_GLYPH_RUN *glyphRun,
CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawGlyphRun, (
ID2D1RenderTarget* This,
D2D1_POINT_2F baselineOrigin,
CONST DWRITE_GLYPH_RUN *glyphRun,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode
));
HOOK_MANUALLY(void, D2D1RenderTarget1_DrawGlyphRun, (
ID2D1RenderTarget* This,
D2D1_POINT_2F baselineOrigin,
CONST DWRITE_GLYPH_RUN *glyphRun,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode
));
HOOK_MANUALLY(void, D2D1DeviceContext_DrawGlyphRun, (
ID2D1DeviceContext* This,
D2D1_POINT_2F baselineOrigin,
CONST DWRITE_GLYPH_RUN *glyphRun,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode
));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawText, (
ID2D1RenderTarget* This,
CONST WCHAR *string,
UINT32 stringLength,
IDWriteTextFormat *textFormat,
CONST D2D1_RECT_F *layoutRect,
ID2D1Brush *defaultForegroundBrush,
D2D1_DRAW_TEXT_OPTIONS options,
DWRITE_MEASURING_MODE measuringMode));
HOOK_MANUALLY(void, D2D1DeviceContext_DrawText, (
ID2D1DeviceContext* This,
CONST WCHAR *string,
UINT32 stringLength,
IDWriteTextFormat *textFormat,
CONST D2D1_RECT_F *layoutRect,
ID2D1Brush *defaultForegroundBrush,
D2D1_DRAW_TEXT_OPTIONS options,
DWRITE_MEASURING_MODE measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawTextLayout, (
ID2D1RenderTarget* This,
D2D1_POINT_2F origin,
IDWriteTextLayout *textLayout,
ID2D1Brush *defaultForegroundBrush,
D2D1_DRAW_TEXT_OPTIONS options
));
//EOF