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);
}

Recommended Answers

All 2 Replies

Please use code tags. It doesn't tell you which symbol is multiply defined?

The link error tells you that you have a symbol defined in two or more source files. You will just have to read all your source files to find the offending symbol. One way that can happen is to declare global variables in header files. To do that correctly you need to declare it with the extern keyword, such as extern int stuff; and then declare it once more in only one of the *.c or *.cpp files without extern.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.