Created
October 13, 2022 17:16
-
-
Save 4el0ve4ik/82cf32d2e7d708e3aee8bf49e88696fd to your computer and use it in GitHub Desktop.
bullyWindowedMode plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <process.h> | |
RECT Size = { 0,0,800,480 }; | |
using tProcWMMessage = bool(__stdcall*)(unsigned int); | |
tProcWMMessage procWMMessage = nullptr; | |
unsigned long hookedProcWM(bool stat) { | |
return false; | |
} | |
void InjectCall(DWORD _offset, DWORD target) | |
{ | |
unsigned long Protection; | |
VirtualProtect((void*)_offset, 5, PAGE_EXECUTE_READWRITE, &Protection); | |
target -= (_offset + 5); | |
*((unsigned char*)_offset) = 0xE8; | |
memcpy((LPVOID)(_offset + 1), &target, sizeof(DWORD)); | |
VirtualProtect((void*)_offset, 5, Protection, 0); | |
} | |
void Thread(void*) { | |
while (true) | |
{ | |
Sleep(350); | |
HWND hWND = nullptr; | |
if ((hWND = *reinterpret_cast<HWND*>(0xBD77FC)) != nullptr) { | |
unsigned long oldProt = NULL; | |
void *addr = reinterpret_cast<void*>(0x405F47); | |
VirtualProtect(addr, 1, PAGE_EXECUTE_READWRITE, &oldProt); | |
*reinterpret_cast<unsigned char*>(addr) = 0x09; | |
VirtualProtect(addr, 1, oldProt, NULL); | |
procWMMessage = reinterpret_cast<tProcWMMessage>(0x405DB0); | |
InjectCall(0x401106, (DWORD)&hookedProcWM); | |
SetWindowLong(hWND, GWL_STYLE, WS_OVERLAPPEDWINDOW | WS_VISIBLE); | |
SetWindowLong(hWND, GWL_EXSTYLE, 0L); | |
ShowWindow(hWND, SW_SHOWDEFAULT); | |
MoveWindow(hWND, Size.left, Size.top, Size.right - Size.left, Size.bottom - Size.top, true); | |
break; | |
} | |
} | |
_endthread(); | |
} | |
BOOL __stdcall DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID) { | |
DisableThreadLibraryCalls(hinst); | |
if (fdwReason == 1) | |
_beginthread(Thread, NULL, NULL); | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment