diff --git a/directwrite.h b/directwrite.h
index 20412f7..0dc58fe 100644
--- a/directwrite.h
+++ b/directwrite.h
@@ -7,16 +7,16 @@
#include "easyhook.h"
#define HOOK_MANUALLY HOOK_DEFINE
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
extern rettype(WINAPI * ORIG_##name) argtype; \
extern HOOK_TRACE_INFO HOOK_##name;
#include "hooklist.h"
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
-#define HOOK_MANUALLY(rettype, name, argtype) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) \
extern LONG hook_demand_##name(bool bForce = false);
-#define HOOK_DEFINE(rettype, name, argtype) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) ;
#include "hooklist.h"
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
@@ -24,16 +24,16 @@
#else
#define HOOK_MANUALLY HOOK_DEFINE
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
extern rettype(WINAPI * ORIG_##name) argtype; \
extern BOOL IsHooked_##name;
#include "hooklist.h"
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
-#define HOOK_MANUALLY(rettype, name, argtype) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) \
extern LONG hook_demand_##name(bool bForce = false);
-#define HOOK_DEFINE(rettype, name, argtype) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) ;
#include "hooklist.h"
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
diff --git a/expfunc.cpp b/expfunc.cpp
index 90b90e7..89343d5 100644
--- a/expfunc.cpp
+++ b/expfunc.cpp
@@ -86,8 +86,8 @@ extern LONG g_bHookEnabled;
//detours
#include "detours.h"
//
-#define HOOK_MANUALLY(rettype, name, argtype) ;
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
DetourDetach(&(PVOID&)ORIG_##name, IMPL_##name);
LONG hook_term()
{
@@ -108,8 +108,8 @@ LONG hook_term()
#else
#include "easyhook.h"
-#define HOOK_MANUALLY(rettype, name, argtype) ;
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
ORIG_##name = name;
#pragma optimize("s", on)
static LONG hook_term()
diff --git a/gdipp.vcxproj b/gdipp.vcxproj
index 87120f1..3f27bd3 100644
--- a/gdipp.vcxproj
+++ b/gdipp.vcxproj
@@ -813,6 +813,7 @@
+
Sync
@@ -843,6 +844,7 @@
+
diff --git a/gdipp.vcxproj.filters b/gdipp.vcxproj.filters
index 3c4ed04..609c67a 100644
--- a/gdipp.vcxproj.filters
+++ b/gdipp.vcxproj.filters
@@ -66,6 +66,9 @@
Source Files
+
+ Source Files
+
@@ -157,6 +160,9 @@
Header Files
+
+ Header Files
+
diff --git a/hook.cpp b/hook.cpp
index fdc2d5e..abbb7c2 100644
--- a/hook.cpp
+++ b/hook.cpp
@@ -20,6 +20,7 @@
#include
#include
#include "EventLogging.h"
+#include "hookCounter.h"
#ifdef STATIC_LIB
#include
@@ -56,9 +57,13 @@ HINSTANCE g_dllInstance;
#endif
// DATA_foo、ORIG_foo の2つをまとめて定義するマクロ
#define HOOK_MANUALLY HOOK_DEFINE
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
rettype (WINAPI * ORIG_##name) argtype; \
- BOOL IsHooked_##name = false;
+ BOOL IsHooked_##name = false; \
+ rettype WINAPI REF_##name argtype { \
+ HCounter _; \
+ return IMPL_##name arglist; \
+ }
#include "hooklist.h"
@@ -66,8 +71,8 @@ HINSTANCE g_dllInstance;
#undef HOOK_MANUALLY
//
-#define HOOK_MANUALLY(rettype, name, argtype) ;
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
ORIG_##name = name;
#pragma optimize("s", on)
static void hook_initinternal()
@@ -78,9 +83,12 @@ static void hook_initinternal()
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
-#define HOOK_MANUALLY(rettype, name, argtype) ;
-#define HOOK_DEFINE(rettype, name, argtype) \
- if (&ORIG_##name) { DetourAttach(&(PVOID&)ORIG_##name, IMPL_##name); IsHooked_##name = true; }
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
+ if (&ORIG_##name && !IsHooked_##name) { \
+ if (DetourAttach(&(PVOID&)ORIG_##name, REF_##name) == NOERROR) IsHooked_##name = true; \
+ }
+
static LONG hook_init()
{
DetourRestoreAfterWith();
@@ -100,13 +108,13 @@ static LONG hook_init()
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
-#define HOOK_DEFINE(rettype, name, argtype);
-#define HOOK_MANUALLY(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist);
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) \
LONG hook_demand_##name(bool bForce = false){ \
DetourRestoreAfterWith(); \
DetourTransactionBegin(); \
DetourUpdateThread(GetCurrentThread()); \
- if (&ORIG_##name && (bForce || !IsHooked_##name)) { DetourAttach(&(PVOID&)ORIG_##name, IMPL_##name); IsHooked_##name = true; } \
+ if (&ORIG_##name && (bForce || !IsHooked_##name)) { DetourAttach(&(PVOID&)ORIG_##name, REF_##name); IsHooked_##name = true; } \
LONG error = DetourTransactionCommit(); \
if (error != NOERROR) { \
TRACE(_T("hook_init error: %#x\n"), error); \
@@ -119,9 +127,9 @@ static LONG hook_init()
#undef HOOK_DEFINE
//
-#define HOOK_MANUALLY(rettype, name, argtype) ;
-#define HOOK_DEFINE(rettype, name, argtype) \
- DetourDetach(&(PVOID&)ORIG_##name, IMPL_##name); \
+#define HOOK_MANUALLY HOOK_DEFINE
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
+ if (IsHooked_##name) DetourDetach(&(PVOID&)ORIG_##name, REF_##name); \
IsHooked_##name = false;
static void hook_term()
{
@@ -135,6 +143,7 @@ static void hook_term()
if (error != NOERROR) {
TRACE(_T("hook_term error: %#x\n"), error);
}
+ HCounter::wait(3000);
}
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
@@ -148,7 +157,7 @@ static void hook_term()
#endif
#define HOOK_MANUALLY HOOK_DEFINE
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
rettype (WINAPI * ORIG_##name) argtype; \
HOOK_TRACE_INFO HOOK_##name = {0}; //建立hook结构
@@ -157,8 +166,8 @@ static void hook_term()
#undef HOOK_MANUALLY
//
-#define HOOK_MANUALLY(rettype, name, argtype) ;
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
ORIG_##name = name;
#pragma optimize("s", on)
static void hook_initinternal()
@@ -171,12 +180,12 @@ static void hook_initinternal()
#define FORCE(expr) {if(!SUCCEEDED(NtStatus = (expr))) goto ERROR_ABORT;}
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
if (&ORIG_##name) { \
FORCE(LhInstallHook((PVOID&)ORIG_##name, IMPL_##name, (PVOID)0, &HOOK_##name)); \
*(void**)&ORIG_##name = (void*)HOOK_##name.Link->OldProc; \
FORCE(LhSetExclusiveACL(ACLEntries, 0, &HOOK_##name)); }
-#define HOOK_MANUALLY(rettype, name, argtype) ;
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) ;
static LONG hook_init()
{
@@ -196,8 +205,8 @@ ERROR_ABORT:
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
-#define HOOK_DEFINE(rettype, name, argtype);
-#define HOOK_MANUALLY(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist);
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) \
LONG hook_demand_##name(bool bForce = false){ \
NTSTATUS NtStatus; \
ULONG ACLEntries[1] = { 0 }; \
@@ -221,8 +230,8 @@ ERROR_ABORT:
#undef HOOK_MANUALLY
#undef HOOK_DEFINE
-#define HOOK_MANUALLY(rettype, name, argtype) ;
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
ORIG_##name = name;
#pragma optimize("s", on)
static LONG hook_term()
diff --git a/hookCounter.cpp b/hookCounter.cpp
new file mode 100644
index 0000000..c071036
--- /dev/null
+++ b/hookCounter.cpp
@@ -0,0 +1,4 @@
+#include "hookCounter.h"
+#include
+
+std::atomic HCounter::ref(0);
\ No newline at end of file
diff --git a/hookCounter.h b/hookCounter.h
new file mode 100644
index 0000000..0a22394
--- /dev/null
+++ b/hookCounter.h
@@ -0,0 +1,24 @@
+#pragma once
+#include
+#include
+#include
+
+class HCounter {
+ static std::atomic ref;
+
+public:
+ HCounter() {
+ ++this->ref;
+ }
+
+ ~HCounter() {
+ --this->ref;
+ }
+
+ static bool wait(int nCount) {
+ while (--nCount && HCounter::ref.load()) {
+ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
+ return !HCounter::ref;
+ }
+};
diff --git a/hooklist.h b/hooklist.h
index 9b1d7e3..c5b154d 100644
--- a/hooklist.h
+++ b/hooklist.h
@@ -1,9 +1,9 @@
-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(int, GetObjectW, (__in HANDLE h, __in int c, __out_bcount_opt(c) LPVOID pv), (h, c, pv))
+HOOK_DEFINE(int, GetObjectA, (__in HANDLE h, __in int c, __out_bcount_opt(c) LPVOID pv), (h, c, pv))
+HOOK_DEFINE(int, GetTextFaceAliasW, (HDC hdc, int nLen, LPWSTR lpAliasW), (hdc, nLen, lpAliasW))
+HOOK_DEFINE(BOOL, DeleteObject, ( HGDIOBJ hObject),(hObject))
+HOOK_DEFINE(int, GetTextFaceW, ( __in HDC hdc, __in int c, __out_ecount_part_opt(c, return) LPWSTR lpName), (hdc, c, lpName))
+HOOK_DEFINE(int, GetTextFaceA, ( __in HDC hdc, __in int c, __out_ecount_part_opt(c, return) LPSTR lpName), (hdc, c, lpName))
HOOK_DEFINE(DWORD, GetGlyphOutlineW, ( __in HDC hdc, \
__in UINT uChar, \
__in UINT fuFormat, \
@@ -11,14 +11,15 @@ HOOK_DEFINE(DWORD, GetGlyphOutlineW, ( __in HDC hdc, \
__in DWORD cjBuffer, \
__out_bcount_opt(cjBuffer) LPVOID pvBuffer, \
__in CONST MAT2 *lpmat2 \
- ))
+ ), (hdc, uChar, fuFormat, lpgm, cjBuffer, pvBuffer, 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))
+ __in CONST MAT2 *lpmat2), \
+ (hdc, uChar, fuFormat, lpgm, cjBuffer, pvBuffer, lpmat2))
// DrawTextA,W
@@ -28,43 +29,35 @@ HOOK_DEFINE(DWORD, GetGlyphOutlineA, (__in HDC hdc, \
// 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_MANUALLY(HFONT, CreateFontIndirectW, (CONST LOGFONTW *lplf))
-HOOK_MANUALLY(HFONT, CreateFontIndirectExW, (CONST ENUMLOGFONTEXDV *penumlfex))
+
+HOOK_MANUALLY(HFONT, CreateFontIndirectW, (CONST LOGFONTW *lplf), (lplf))
+HOOK_MANUALLY(HFONT, CreateFontIndirectExW, (CONST ENUMLOGFONTEXDV *penumlfex), (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, TextOutA, (HDC hdc, int nXStart, int nYStart, LPCSTR lpString, int cbString), (hdc, nXStart, nYStart, lpString, cbString))
+HOOK_DEFINE(BOOL, TextOutW, (HDC hdc, int nXStart, int nYStart, LPCWSTR lpString, int cbString), (hdc, nXStart, nYStart, lpString, 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, ExtTextOutA, (HDC hdc, int nXStart, int nYStart, UINT fuOptions, CONST RECT *lprc, LPCSTR lpString, UINT cbString, CONST INT *lpDx),
+ (hdc, nXStart, nYStart, fuOptions, lprc, lpString, cbString, 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, ExtTextOutW, (HDC hdc, int nXStart, int nYStart, UINT fuOptions, CONST RECT *lprc, LPCWSTR lpString, UINT cbString, CONST INT *lpDx),
+ (hdc, nXStart, nYStart, fuOptions, lprc, lpString, cbString, lpDx))
+
+HOOK_DEFINE(BOOL, RemoveFontResourceExW, (__in LPCWSTR name, __in DWORD fl, __reserved PVOID pdv), (name, fl, 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_DEFINE(HGDIOBJ, GetStockObject, (__in int i), (i))
+HOOK_DEFINE(BOOL, BeginPath, (HDC hdc), (hdc))
+HOOK_DEFINE(BOOL, EndPath, (HDC hdc), (hdc))
+HOOK_DEFINE(BOOL, AbortPath, (HDC hdc), (hdc));
HOOK_DEFINE(DWORD, GetFontData, (_In_ HDC hdc,
_In_ DWORD dwTable,
_In_ DWORD dwOffset,
_Out_writes_bytes_to_opt_(cjBuffer, return) PVOID pvBuffer,
_In_ DWORD cjBuffer
- ));
-
-/*
-
-HOOK_MANUALLY(LONG, LdrLoadDll, (IN PWCHAR PathToFile OPTIONAL,
- IN ULONG Flags OPTIONAL,
- IN UNICODE_STRING2* ModuleFileName,
- OUT HANDLE* ModuleHandle ))
-*/
+ ), (hdc, dwTable, dwOffset, pvBuffer, cjBuffer));
HOOK_MANUALLY(HRESULT, BitmapRenderTarget_DrawGlyphRun, (
IDWriteBitmapRenderTarget* This,
@@ -74,7 +67,8 @@ HOOK_MANUALLY(HRESULT, BitmapRenderTarget_DrawGlyphRun, (
DWRITE_GLYPH_RUN const* glyphRun,
IDWriteRenderingParams* renderingParams,
COLORREF textColor,
- RECT* blackBoxRect))
+ RECT* blackBoxRect),
+ (This, baselineOriginX, baselineOriginY, measuringMode, glyphRun, renderingParams, textColor, blackBoxRect))
/*
HOOK_MANUALLY(void, SetTextAntialiasMode, (
@@ -88,28 +82,28 @@ HOOK_MANUALLY(void, SetTextRenderingParams, (
HOOK_MANUALLY(HRESULT, DWriteCreateFactory, (
__in DWRITE_FACTORY_TYPE factoryType,
__in REFIID iid,
- __out IUnknown **factory))
+ __out IUnknown **factory), (factoryType, iid, factory))
HOOK_MANUALLY(HRESULT, D2D1CreateDevice, (
IDXGIDevice* dxgiDevice,
CONST D2D1_CREATION_PROPERTIES* creationProperties,
- ID2D1Device** d2dDevice))
+ ID2D1Device** d2dDevice), (dxgiDevice, creationProperties, d2dDevice))
HOOK_MANUALLY(HRESULT, D2D1CreateDeviceContext, (
IDXGISurface* dxgiSurface,
CONST D2D1_CREATION_PROPERTIES* creationProperties,
- ID2D1DeviceContext** d2dDeviceContext))
+ ID2D1DeviceContext** d2dDeviceContext), (dxgiSurface, creationProperties, d2dDeviceContext))
HOOK_MANUALLY(HRESULT, D2D1CreateFactory, (
D2D1_FACTORY_TYPE factoryType,
REFIID riid,
const D2D1_FACTORY_OPTIONS* pFactoryOptions,
- void** ppIFactory))
+ void** ppIFactory), (factoryType, riid, pFactoryOptions, ppIFactory))
HOOK_MANUALLY(HRESULT, GetGdiInterop, (
IDWriteFactory* This,
IDWriteGdiInterop** gdiInterop
- ))
+ ), (This, gdiInterop))
HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis, (
IDWriteFactory* This,
@@ -121,8 +115,8 @@ HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis, (
FLOAT baselineOriginX,
FLOAT baselineOriginY,
IDWriteGlyphRunAnalysis** glyphRunAnalysis
- ))
-
+ ), (This, glyphRun, pixelsPerDip, transform, renderingMode, measuringMode, baselineOriginX, baselineOriginY, glyphRunAnalysis))
+
HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis2, (
IDWriteFactory2* This,
DWRITE_GLYPH_RUN const* glyphRun,
@@ -134,7 +128,7 @@ HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis2, (
FLOAT baselineOriginX,
FLOAT baselineOriginY,
IDWriteGlyphRunAnalysis** glyphRunAnalysis
- ))
+ ), (This, glyphRun, transform, renderingMode, measuringMode, gridFitMode, antialiasMode, baselineOriginX, baselineOriginY, glyphRunAnalysis))
HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis3, (
IDWriteFactory3* This,
@@ -147,7 +141,7 @@ HOOK_MANUALLY(HRESULT, CreateGlyphRunAnalysis3, (
FLOAT baselineOriginX,
FLOAT baselineOriginY,
IDWriteGlyphRunAnalysis** glyphRunAnalysis
- ))
+ ), (This, glyphRun, transform, renderingMode, measuringMode, gridFitMode, antialiasMode, baselineOriginX, baselineOriginY, glyphRunAnalysis))
HOOK_MANUALLY(HRESULT, GetAlphaBlendParams, (
IDWriteGlyphRunAnalysis* This,
@@ -155,49 +149,49 @@ HOOK_MANUALLY(HRESULT, GetAlphaBlendParams, (
FLOAT* blendGamma,
FLOAT* blendEnhancedContrast,
FLOAT* blendClearTypeLevel
- ))
+ ), (This, renderingParams, blendGamma, blendEnhancedContrast, blendClearTypeLevel))
HOOK_MANUALLY(HRESULT, CreateDeviceContext, (
ID2D1Device* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext** deviceContext
- ))
+ ), (This, options, deviceContext))
HOOK_MANUALLY(HRESULT, CreateDeviceContext2, (
ID2D1Device1* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext1** deviceContext
- ))
+ ), (This, options, deviceContext))
HOOK_MANUALLY(HRESULT, CreateDeviceContext3, (
ID2D1Device2* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext2** deviceContext
- ))
+ ), (This, options, deviceContext))
HOOK_MANUALLY(HRESULT, CreateDeviceContext4, (
ID2D1Device3* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext3** deviceContext
- ))
+ ), (This, options, deviceContext))
HOOK_MANUALLY(HRESULT, CreateDeviceContext5, (
ID2D1Device4* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext4** deviceContext
- ))
+ ), (This, options, deviceContext))
HOOK_MANUALLY(HRESULT, CreateDeviceContext6, (
ID2D1Device5* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext5** deviceContext
- ))
+ ), (This, options, deviceContext))
HOOK_MANUALLY(HRESULT, CreateDeviceContext7, (
ID2D1Device6* This,
D2D1_DEVICE_CONTEXT_OPTIONS options,
ID2D1DeviceContext6** deviceContext
- ))
+ ), (This, options, deviceContext))
HOOK_MANUALLY(HRESULT, CreateTextFormat, (
IDWriteFactory* self,
@@ -208,23 +202,24 @@ HOOK_MANUALLY(HRESULT, CreateTextFormat, (
DWRITE_FONT_STRETCH fontStretch,
FLOAT fontSize,
__in_z WCHAR const* localeName,
- __out IDWriteTextFormat** textFormat))
+ __out IDWriteTextFormat** textFormat),
+ (self, fontFamilyName, fontCollection, fontWeight, fontStyle, fontStretch, fontSize, localeName, textFormat))
HOOK_MANUALLY(HRESULT, CreateFontFace, (
IDWriteFont* self,
__out IDWriteFontFace** fontFace
- ))
+ ), (self, fontFace))
HOOK_MANUALLY(HRESULT, DWriteFontFaceReference_CreateFontFace, (
IDWriteFontFaceReference* self,
__out IDWriteFontFace3** fontFace
- ))
+ ), (self, fontFace))
HOOK_MANUALLY(HRESULT, DWriteFontFaceReference_CreateFontFaceWithSimulations, (
IDWriteFontFaceReference* self,
DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags,
__out IDWriteFontFace3** fontFace
- ))
+ ), (self, fontFaceSimulationFlags, fontFace))
HOOK_MANUALLY(HRESULT, CreateBitmapRenderTarget, (
IDWriteGdiInterop* This,
@@ -232,7 +227,7 @@ HOOK_MANUALLY(HRESULT, CreateBitmapRenderTarget, (
UINT32 width,
UINT32 height,
IDWriteBitmapRenderTarget** renderTarget
- ))
+ ), (This, hdc, width, height, renderTarget))
HOOK_MANUALLY(HRESULT, CreateCompatibleRenderTarget, (
ID2D1RenderTarget* This,
@@ -241,23 +236,23 @@ HOOK_MANUALLY(HRESULT, CreateCompatibleRenderTarget, (
CONST D2D1_PIXEL_FORMAT* desiredFormat,
D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options,
ID2D1BitmapRenderTarget** bitmapRenderTarget
- ))
+ ), (This, desiredSize, desiredPixelSize, desiredFormat, options, bitmapRenderTarget))
HOOK_MANUALLY(void, D2D1RenderTarget_SetTextAntialiasMode, (
ID2D1RenderTarget* This,
- D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode));
+ D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode), (This, textAntialiasMode));
HOOK_MANUALLY(void, D2D1DeviceContext_SetTextAntialiasMode, (
ID2D1DeviceContext* This,
- D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode));
+ D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode), (This, textAntialiasMode));
HOOK_MANUALLY(void, D2D1RenderTarget_SetTextRenderingParams, (
ID2D1RenderTarget* This,
- _In_opt_ IDWriteRenderingParams* textRenderingParams));
+ _In_opt_ IDWriteRenderingParams* textRenderingParams), (This, textRenderingParams));
HOOK_MANUALLY(void, D2D1DeviceContext_SetTextRenderingParams, (
ID2D1DeviceContext* This,
- _In_opt_ IDWriteRenderingParams* textRenderingParams));
+ _In_opt_ IDWriteRenderingParams* textRenderingParams), (This, textRenderingParams));
/*
HOOK_MANUALLY(GpStatus, GdipDrawString, (
@@ -274,71 +269,71 @@ HOOK_MANUALLY(HRESULT, CreateWicBitmapRenderTarget, (
ID2D1Factory* This,
IWICBitmap* target,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
- ID2D1RenderTarget** renderTarget));
+ ID2D1RenderTarget** renderTarget), (This, target, renderTargetProperties, renderTarget));
HOOK_MANUALLY(HRESULT, CreateHwndRenderTarget, (
ID2D1Factory* This,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
const D2D1_HWND_RENDER_TARGET_PROPERTIES* hwndRenderTargetProperties,
- ID2D1HwndRenderTarget** hwndRenderTarget));
+ ID2D1HwndRenderTarget** hwndRenderTarget), (This, renderTargetProperties, hwndRenderTargetProperties, hwndRenderTarget));
HOOK_MANUALLY(HRESULT, CreateDxgiSurfaceRenderTarget, (
ID2D1Factory* This,
IDXGISurface* dxgiSurface,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
- ID2D1RenderTarget** renderTarget));
+ ID2D1RenderTarget** renderTarget), (This, dxgiSurface, renderTargetProperties, renderTarget));
HOOK_MANUALLY(HRESULT, CreateDCRenderTarget, (
ID2D1Factory* This,
const D2D1_RENDER_TARGET_PROPERTIES* renderTargetProperties,
- ID2D1DCRenderTarget** dcRenderTarget));
+ ID2D1DCRenderTarget** dcRenderTarget), (This, renderTargetProperties, dcRenderTarget));
HOOK_MANUALLY(HRESULT, CreateDevice1, (
ID2D1Factory1* This,
IDXGIDevice* dxgiDevice,
- ID2D1Device** d2dDevice));
+ ID2D1Device** d2dDevice), (This, dxgiDevice, d2dDevice));
HOOK_MANUALLY(HRESULT, CreateDevice2, (
ID2D1Factory2* This,
IDXGIDevice* dxgiDevice,
ID2D1Device1** d2dDevice1
- ));
+ ), (This, dxgiDevice, d2dDevice1));
HOOK_MANUALLY(HRESULT, CreateDevice3, (
ID2D1Factory3* This,
IDXGIDevice* dxgiDevice,
ID2D1Device2** d2dDevice2
- ));
+ ), (This, dxgiDevice, d2dDevice2));
HOOK_MANUALLY(HRESULT, CreateDevice4, (
ID2D1Factory4* This,
IDXGIDevice* dxgiDevice,
ID2D1Device3** d2dDevice3
- ));
+ ), (This, dxgiDevice, d2dDevice3));
HOOK_MANUALLY(HRESULT, CreateDevice5, (
ID2D1Factory5* This,
IDXGIDevice* dxgiDevice,
ID2D1Device4** d2dDevice4
- ));
+ ), (This, dxgiDevice, d2dDevice4));
HOOK_MANUALLY(HRESULT, CreateDevice6, (
ID2D1Factory6* This,
IDXGIDevice* dxgiDevice,
ID2D1Device5** d2dDevice5
- ));
+ ), (This, dxgiDevice, d2dDevice5));
HOOK_MANUALLY(HRESULT, CreateDevice7, (
ID2D1Factory7* This,
IDXGIDevice* dxgiDevice,
ID2D1Device6** d2dDevice6
- ));
+ ), (This, dxgiDevice, d2dDevice6));
HOOK_MANUALLY(BOOL, MySetProcessMitigationPolicy, (
_In_ PROCESS_MITIGATION_POLICY MitigationPolicy,
_In_ PVOID lpBuffer,
_In_ SIZE_T dwLength
- ));
+ ), (MitigationPolicy, lpBuffer, dwLength));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawGlyphRun1, (
ID2D1DeviceContext *This,
@@ -346,7 +341,7 @@ HOOK_MANUALLY(void, D2D1RenderTarget_DrawGlyphRun1, (
CONST DWRITE_GLYPH_RUN *glyphRun,
CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription,
ID2D1Brush *foregroundBrush,
- DWRITE_MEASURING_MODE measuringMode));
+ DWRITE_MEASURING_MODE measuringMode), (This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget1_DrawGlyphRun1, (
ID2D1DeviceContext *This,
@@ -354,7 +349,7 @@ HOOK_MANUALLY(void, D2D1RenderTarget1_DrawGlyphRun1, (
CONST DWRITE_GLYPH_RUN *glyphRun,
CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription,
ID2D1Brush *foregroundBrush,
- DWRITE_MEASURING_MODE measuringMode));
+ DWRITE_MEASURING_MODE measuringMode), (This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode));
HOOK_MANUALLY(void, D2D1DeviceContext_DrawGlyphRun1, (
ID2D1DeviceContext *This,
@@ -362,7 +357,7 @@ HOOK_MANUALLY(void, D2D1DeviceContext_DrawGlyphRun1, (
CONST DWRITE_GLYPH_RUN *glyphRun,
CONST DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription,
ID2D1Brush *foregroundBrush,
- DWRITE_MEASURING_MODE measuringMode));
+ DWRITE_MEASURING_MODE measuringMode), (This, baselineOrigin, glyphRun, glyphRunDescription, foregroundBrush, measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawGlyphRun, (
ID2D1RenderTarget* This,
@@ -370,7 +365,7 @@ HOOK_MANUALLY(void, D2D1RenderTarget_DrawGlyphRun, (
CONST DWRITE_GLYPH_RUN *glyphRun,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode
- ));
+ ), (This, baselineOrigin, glyphRun, foregroundBrush, measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget1_DrawGlyphRun, (
ID2D1RenderTarget* This,
@@ -378,7 +373,7 @@ HOOK_MANUALLY(void, D2D1RenderTarget1_DrawGlyphRun, (
CONST DWRITE_GLYPH_RUN *glyphRun,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode
- ));
+ ), (This, baselineOrigin, glyphRun, foregroundBrush, measuringMode));
HOOK_MANUALLY(void, D2D1DeviceContext_DrawGlyphRun, (
ID2D1DeviceContext* This,
@@ -386,7 +381,7 @@ HOOK_MANUALLY(void, D2D1DeviceContext_DrawGlyphRun, (
CONST DWRITE_GLYPH_RUN *glyphRun,
ID2D1Brush *foregroundBrush,
DWRITE_MEASURING_MODE measuringMode
- ));
+ ), (This, baselineOrigin, glyphRun, foregroundBrush, measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawText, (
ID2D1RenderTarget* This,
@@ -396,7 +391,8 @@ HOOK_MANUALLY(void, D2D1RenderTarget_DrawText, (
CONST D2D1_RECT_F *layoutRect,
ID2D1Brush *defaultForegroundBrush,
D2D1_DRAW_TEXT_OPTIONS options,
- DWRITE_MEASURING_MODE measuringMode));
+ DWRITE_MEASURING_MODE measuringMode),
+ (This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode));
HOOK_MANUALLY(void, D2D1DeviceContext_DrawText, (
ID2D1DeviceContext* This,
@@ -406,7 +402,8 @@ HOOK_MANUALLY(void, D2D1DeviceContext_DrawText, (
CONST D2D1_RECT_F *layoutRect,
ID2D1Brush *defaultForegroundBrush,
D2D1_DRAW_TEXT_OPTIONS options,
- DWRITE_MEASURING_MODE measuringMode));
+ DWRITE_MEASURING_MODE measuringMode),
+ (This, string, stringLength, textFormat, layoutRect, defaultForegroundBrush, options, measuringMode));
HOOK_MANUALLY(void, D2D1RenderTarget_DrawTextLayout, (
ID2D1RenderTarget* This,
@@ -414,7 +411,8 @@ HOOK_MANUALLY(void, D2D1RenderTarget_DrawTextLayout, (
IDWriteTextLayout *textLayout,
ID2D1Brush *defaultForegroundBrush,
D2D1_DRAW_TEXT_OPTIONS options
- ));
+ ),
+ (This, origin, textLayout, defaultForegroundBrush, options));
//EOF
diff --git a/override.h b/override.h
index 4957820..c044925 100644
--- a/override.h
+++ b/override.h
@@ -121,7 +121,7 @@ BOOL IsProcessUnload();
BOOL IsExeUnload(LPCTSTR lpApp);
#define HOOK_MANUALLY HOOK_DEFINE
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
extern rettype (WINAPI * ORIG_##name) argtype; \
extern rettype WINAPI IMPL_##name argtype;
#include "hooklist.h"
@@ -133,9 +133,9 @@ 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) \
+#define HOOK_MANUALLY(rettype, name, argtype, arglist) \
LONG hook_demand_##name(bool bForce);
-#define HOOK_DEFINE(rettype, name, argtype) ;
+#define HOOK_DEFINE(rettype, name, argtype, arglist) ;
#include "hooklist.h"
#undef HOOK_DEFINE
#undef HOOK_MANUALLY
diff --git a/settings.h b/settings.h
index f7d965b..6c4682f 100644
--- a/settings.h
+++ b/settings.h
@@ -33,7 +33,7 @@ using json = nlohmann::json;
void Set##name(int n) { SetParam(param, n); }
#define HOOK_MANUALLY HOOK_DEFINE
-#define HOOK_DEFINE(rettype, name, argtype) \
+#define HOOK_DEFINE(rettype, name, argtype, arglist) \
extern rettype (WINAPI * ORIG_##name) argtype; \
extern rettype WINAPI IMPL_##name argtype;
#include "hooklist.h"