Added error handling when hook fails

This commit is contained in:
Nemirtingas 2019-08-16 19:10:12 +02:00
parent 71d3e301c2
commit d06fbba104
12 changed files with 122 additions and 43 deletions

View file

@ -38,9 +38,9 @@ protected:
Hook_Manager();
virtual ~Hook_Manager();
void UnHookAllRendererDetector();
void UnHookAllRendererDetector();
// Setup opengl device
void hook_opengl();
void HookLoadLibrary();
@ -52,13 +52,21 @@ protected:
bool _dx9_hooked; // DX9 Present and PresentEx Hooked ?
bool _dxgi_hooked; // DXGI Present is hooked ? (DX10, DX11, DX12)
// DXGIPresent will be used to detect if DX10, DX11 or DX12 should be used for overlay
void HookDXGIPresent();
// DX9 Present and PresentEx will be used to detect if DX9 should be used for overlay
void HookDX9Present();
// wglMakeCurrent will be used to detect if OpenGL3 should be used for overlay
void HookwglMakeCurrent();
// Setup DX9 Device and get vtable
void hook_dx9();
// Setup DX10 Device and get vtable
void hook_dx10();
// Setup DX11 Device and get vtable
void hook_dx11();
// Setup DX12 Device and get vtable
void hook_dx12();
void create_hookA(const char* libname);
void create_hookW(const wchar_t* libname);
@ -66,9 +74,12 @@ protected:
static HMODULE WINAPI MyLoadLibraryW(LPCWSTR lpLibFileName);
static HMODULE WINAPI MyLoadLibraryExA(LPCTSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
static HMODULE WINAPI MyLoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
// If this is called, then DX10, DX11 or DX12 will be used to render overlay
static HRESULT STDMETHODCALLTYPE MyIDXGISwapChain_Present(IDXGISwapChain* _this, UINT SyncInterval, UINT Flags);
// If any of theses is called, then DX9 will be used to render overlay
static HRESULT STDMETHODCALLTYPE MyPresent(IDirect3DDevice9* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion);
static HRESULT STDMETHODCALLTYPE MyPresentEx(IDirect3DDevice9Ex* _this, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion, DWORD dwFlags);
// If this is called, then OpenGL 3 will be used to render overlay
static BOOL WINAPI MywglMakeCurrent(HDC hDC, HGLRC hGLRC);
public: