DWORD Add = 0x3462A11; int value = 0; cout << "Enter the new value: "; cin << value; WriteProcessMemory(hProcess, (LPVOID)Add, &value , sizeof(value), NULL); cout << "Your new value is : " << value << endl;
memcpy((void*)0x3462A11/*Address*/, "\x05\x05\x05\x05"/*Bytes you want to write*/, 4/*how much bytes*/);
memset((void*)0x3462A11/*Address*/, 0x5/*Bytes you want to write*/, 4/*Count of the bytes*/);
void WriteInteger(DWORD Address, int Value)
{
*(int *)Address = Value;
}
WriteInteger(0x3462A11, 5);
#include <windows.h>
void WriteInteger(DWORD Address, int Value)//Write the integer value
{
*(int *)Address = Value;
}
void TheThread()
{
while(1)//Keep the thread alive
{
if(GetAsyncKeyState(VK_INSERT)&0x8000)//Hotkey
{
WriteMemory(0x3462A11, 5);//Hack
}
Sleep(10);//Stop the loop from chewing the cpu
}
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)TheThread, hinstDLL, NULL, NULL);//Creates the thread
return TRUE;
}
private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e)
{
if(this->checkBox1->Checked)
{
WriteInteger(0x3462A11, 1);
}
else
{
WriteInteger(0x3462A11, 0);
}
}
