Hi can someone please this code for me because i have the same error
Here is the code:
// Work please.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include <Windows.h>
#include <wchar.h>
#define ThreadMake(x) CreateThread(NULL,0, (LPTHREAD_START_ROUTINE)&x,NULL,0,NULL);
#define ThreadMakeParam(x, param) CreateThread(NULL,0, (LPTHREAD_START_ROUTINE)&x,param,0,NULL);
#define BEEP_ACTIVATED Beep(2000, 500);
#define BEEP_DEACTIVATED Beep(1000, 500);
void Initialize();
void ToggleAmmo();
void ToggleTagHack();
void Write2Asm(void*, BYTE*, int);
DWORD pAmmo;
DWORD pTagHack;
void Hotkeys()
{
while(true)
{
if (GetAsyncKeyState(VK_F4))
{
ToggleAmmo();
}
if (GetAsyncKeyState(VK_F3))
{
ToggleTagHack();
}
Sleep(500);
}
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
Beep(5000, 1000);
Initialize();
ThreadMake(Hotkeys);
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
void Initialize()
{
DWORD CrysisBase = (DWORD)GetModuleHandle(L"CryGameCrysis2");
pAmmo = (CrysisBase + 0x4225D);
pTagHack = (CrysisBase + 0xF50C2);
//WCHAR tempChar[256];
//swprintf(tempChar, 256, L"0x%X", pAmmoOffset);
//MessageBox(NULL, tempChar, L"Info", MB_OK | MB_ICONASTERISK);
}
void ToggleAmmo()
{
static bool hack_activated = false;
if(hack_activated)
{
Write2Asm((void*)pAmmo,(PBYTE)"\x89\x70\x04",3);
hack_activated = false;
BEEP_DEACTIVATED
}
else
{
Write2Asm((void*)pAmmo,(PBYTE)"\x90\x90\x90",3);
hack_activated = true;
BEEP_ACTIVATED
}
}
void ToggleTagHack()
{
static int hack_state = 0;
switch(hack_state)
{
case 0:
Write2Asm((void*)pTagHack,(PBYTE)"\xB3\x01",2);
hack_state++;
BEEP_ACTIVATED
break;
case 1:
Write2Asm((void*)pTagHack,(PBYTE)"\xB3\x02",2);
hack_state++;
BEEP_ACTIVATED
break;
case 2:
Write2Asm((void*)pTagHack,(PBYTE)"\x8A\xD8",2);
hack_state = 0;
BEEP_DEACTIVATED
break;
}
}
void Write2Asm(void* pxAddress, BYTE * MyBytes, int size)
{
unsigned long Protection;
VirtualProtect((void*)pxAddress, size, PAGE_READWRITE, &Protection);
memcpy((void*)pxAddress, (const void*)MyBytes, size);
VirtualProtect((void*)pxAddress, size, Protection, 0);
}