2019-08-18 16:22:07 +02:00
|
|
|
#ifndef __INCLUDED_WINDOWS_HOOK_H__
|
|
|
|
#define __INCLUDED_WINDOWS_HOOK_H__
|
|
|
|
|
|
|
|
#include "Base_Hook.h"
|
|
|
|
#ifndef NO_OVERLAY
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#define VC_EXTRALEAN
|
|
|
|
#include <Windows.h>
|
|
|
|
|
|
|
|
class Windows_Hook : public Base_Hook
|
|
|
|
{
|
|
|
|
public:
|
2019-08-18 17:12:57 +02:00
|
|
|
static constexpr const char* DLL_NAME = "user32.dll";
|
2019-08-18 16:22:07 +02:00
|
|
|
|
|
|
|
private:
|
2019-08-27 15:38:07 +02:00
|
|
|
static Windows_Hook* _inst;
|
|
|
|
|
2019-08-18 16:22:07 +02:00
|
|
|
// Variables
|
2019-08-27 15:38:07 +02:00
|
|
|
bool hooked;
|
2019-08-18 16:22:07 +02:00
|
|
|
bool initialized;
|
|
|
|
HWND _game_hwnd;
|
|
|
|
WNDPROC _game_wndproc;
|
|
|
|
|
|
|
|
// Functions
|
|
|
|
Windows_Hook();
|
|
|
|
|
|
|
|
// Hook to Windows window messages
|
|
|
|
decltype(GetRawInputBuffer)* GetRawInputBuffer;
|
|
|
|
decltype(GetRawInputData)* GetRawInputData;
|
|
|
|
|
|
|
|
static LRESULT CALLBACK HookWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
|
|
|
static UINT WINAPI MyGetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader);
|
|
|
|
static UINT WINAPI MyGetRawInputData(HRAWINPUT hRawInput, UINT uiCommand, LPVOID pData, PUINT pcbSize, UINT cbSizeHeader);
|
|
|
|
|
|
|
|
public:
|
2019-08-27 15:38:07 +02:00
|
|
|
virtual ~Windows_Hook();
|
|
|
|
|
2019-08-18 16:22:07 +02:00
|
|
|
void resetRenderState();
|
|
|
|
void prepareForOverlay(HWND);
|
|
|
|
|
|
|
|
HWND GetGameHwnd() const;
|
|
|
|
WNDPROC GetGameWndProc() const;
|
|
|
|
|
2019-08-27 15:38:07 +02:00
|
|
|
bool start_hook();
|
|
|
|
static Windows_Hook* Inst();
|
2019-08-26 16:38:01 +02:00
|
|
|
virtual const char* get_lib_name() const;
|
2019-08-18 16:22:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif//NO_OVERLAY
|
|
|
|
#endif//__INCLUDED_WINDOWS_HOOK_H__
|