Skip to content

Commit

Permalink
Change initialization function, should hopefully resolve intermittent…
Browse files Browse the repository at this point in the history
… issues with startup
  • Loading branch information
xeropresence committed Mar 2, 2020
1 parent c726ca2 commit ffcced2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions AOPP/PatchManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include "LargeAddressAwarePatch.h"
#include "ViewDistancePatch.h"

#define params DWORD dwExStyle,LPCSTR lpClassName,LPCSTR lpWindowName,DWORD dwStyle,int X,int Y,int nWidth,int nHeight,HWND hWndParent,HMENU hMenu,HINSTANCE hInstance,LPVOID lpParam
#define params2 dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam
__declspec(noinline) HWND __stdcall CreateWindowHook(params);
#define params HWND a1, int a2
#define params2 a1, a2
__declspec(noinline) HWND __stdcall ShowWindowHook(params);

std::atomic_flag applied = ATOMIC_FLAG_INIT;

Expand Down Expand Up @@ -60,8 +60,8 @@ PatchManager::PatchManager()
return;
}

const char* CreateWindowExW = Patch::GetAddress<const char*>("User32.dll", "CreateWindowExW");
detour = new PLH::x86Detour(reinterpret_cast<const char*>(CreateWindowExW), reinterpret_cast<char*>(&CreateWindowHook), &originalTramp, dis);
const char* ShowWindow = Patch::GetAddress<const char*>("User32.dll", "ShowWindow");
detour = new PLH::x86Detour(reinterpret_cast<const char*>(ShowWindow), reinterpret_cast<char*>(&ShowWindowHook), &originalTramp, dis);

const auto result = detour->hook();

Expand Down Expand Up @@ -100,7 +100,7 @@ PatchManager::PatchManager()



__declspec(noinline) HWND __stdcall CreateWindowHook(params)
__declspec(noinline) HWND __stdcall ShowWindowHook(params)
{
typedef HWND(__stdcall* fnction)(params);
const auto result = reinterpret_cast<fnction>(originalTramp)(params2);
Expand Down

0 comments on commit ffcced2

Please sign in to comment.