Here is the source for a dll
Code:
#include "Windows.h"
DWORD OldProtect;
DWORD WriteMemory(const LPVOID lpAddress, const LPVOID lpBuf, const UINT uSize)
{
DWORD dwErrorCode = 0;
DWORD dwOldProtect = 0;
int iRes = VirtualProtect(lpAddress, uSize, PAGE_EXECUTE_READWRITE, &dwOldProtect);
if (iRes == 0)
{
dwErrorCode = GetLastError();
return dwErrorCode;
}
memcpy(lpAddress, lpBuf, uSize);
DWORD dwBytes = 0;
iRes = VirtualProtect(lpAddress, uSize, dwOldProtect, &dwBytes);
if (iRes == 0)
{
dwErrorCode = GetLastError();
return dwErrorCode;
}
return 0x00;
}
DWORD SetByte(const LPVOID dwOffset, const BYTE btValue)
{
return WriteMemory(dwOffset, (LPVOID)& btValue, sizeof(BYTE));
}
extern "C" __declspec(dllexport)void Init()
{
if (VirtualProtect(LPVOID(0x401000), 0xD21FFF, PAGE_EXECUTE_READWRITE, &OldProtect))
{
SetByte((PVOID)(0x004030D1 + 3), 6);
}
}
just replace your offset compile and hook it using the api init