Skip to content

Commit

Permalink
Fix CreateFont Hook
Browse files Browse the repository at this point in the history
  • Loading branch information
marcussacana committed Aug 2, 2019
1 parent 70e993f commit fa264dd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions SRL/Hook/TextHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ static partial class StringReloader {
static UnmanagedHook hTextOutW;
static UnmanagedHook hExtTextOutA;
static UnmanagedHook hExtTextOutW;
static UnmanagedHook hCreatFontA;
static UnmanagedHook hCreatFontW;
static UnmanagedHook hCreateFontA;
static UnmanagedHook hCreateFontW;
static UnmanagedHook hCreatFontIndirectA;
static UnmanagedHook hCreatFontIndirectW;
#if DEBUG
Expand Down Expand Up @@ -102,11 +102,11 @@ static void InstallCreateFontHooks()
dCreateFontA = new CreateFontADelegate(hCreateFont);
dCreateFontW = new CreateFontWDelegate(hCreateFont);

hCreatFontA = AutoHookCreator("gdi32.dll", "CreateFontA", dCreateFontA);
hCreatFontW = AutoHookCreator("gdi32.dll", "CreateFontW", dCreateFontW);
hCreateFontA = AutoHookCreator("gdi32.dll", "CreateFontA", dCreateFontA);
hCreateFontW = AutoHookCreator("gdi32.dll", "CreateFontW", dCreateFontW);

hCreatFontA.Install();
hCreatFontW.Install();
hCreateFontA.Install();
hCreateFontW.Install();
}

static void InstallCreateFontIndirectHooks()
Expand Down Expand Up @@ -311,12 +311,12 @@ static IntPtr hCreateFont(int nHeight, int nWidth, int nEscapement, int nOrienta
if (LogInput)
Log("CreateFont Hooked, {0} 0x{1:X2}", true, lpszFace, fdwCharSet);

if (hCreateFileW.ImportHook)
if (hCreateFontW.ImportHook)
return CreateFontW(nHeight, nWidth, nEscapement, nOrientation, fnWeight, fdwItalic, fdwUnderline, fdwStrikeOut, fdwCharSet, fdwOutputPrecision, fdwClipPrecision, fdwQuality, fdwPitchAndFamily, lpszFace);

hCreatFontW.Uninstall();
hCreateFontW.Uninstall();
var Result = CreateFontW(nHeight, nWidth, nEscapement, nOrientation, fnWeight, fdwItalic, fdwUnderline, fdwStrikeOut, fdwCharSet, fdwOutputPrecision, fdwClipPrecision, fdwQuality, fdwPitchAndFamily, lpszFace);
hCreatFontW.Install();
hCreateFontW.Install();

return Result;
}
Expand Down

0 comments on commit fa264dd

Please sign in to comment.