Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include "scan.hpp"
- #include <Windows.h>
- #include <future>
- #include <iostream>
- #include <d3d9.h>
- using present_t = HRESULT(__stdcall*)(IDirect3DDevice9Ex* pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion);
- present_t oPresent = nullptr;
- HRESULT __stdcall hkPresent(IDirect3DDevice9Ex* pDevice, RECT* pSourceRect, RECT* pDestRect, HWND hDestWindowOverride, RGNDATA* pDirtyRegion)
- {
- D3DRECT rec{ 10, 10, 55, 100 };
- pDevice->Clear(1, &rec, D3DCLEAR_TARGET, D3DCOLOR_XRGB(255, 255, 255), 0, 0);
- return oPresent(pDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
- }
- void init()
- {
- Sigscan scan("gameoverlayrenderer.dll");
- uintptr_t* present_V = *(uintptr_t**)scan.scan("FF 15 ? ? ? ? 8B F8 85 DB", 2);
- oPresent = (present_t)*present_V;
- *present_V = (uintptr_t)(&hkPresent);
- }
- BOOL WINAPI DllMain(void* inst, unsigned long reason, void* reserved)
- {
- if (reason == 1) {
- DisableThreadLibraryCalls((HMODULE)inst);
- std::async(std::launch::async, init);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment