[Need Help] What am I doing wrong?

Posts 1–15 of 15 · Page 1 of 1
[Need Help] What am I doing wrong?
I am trying to start hacking, and I just want to see if it works.

Here's the code, why doesn't it work in-game, I have the recent address/byte.

Please tell me what I am doing wrong there, and please hesitate to flame me xD

Code:



#include <windows.h>


int HackOn = 0;

int HackMax = 10;

bool test = false;

#define ADDR_SBULLLETS 0x3740DDB6


void Main (void)
{
while(1)

{
if(GetAsyncKeyState(VK_NUMPAD1)&1)

{
test = (!test);

}
if(GetAsyncKeyState(VK_NUMPAD2)&1)

{
HackOn ++;

if(HackOn == HackMax) HackOn = 0;

}
if(test)

{
memcpy( (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x90\x90\x90", 3 );

}else{

memcpy( (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x0F\x94\xC0", 3 );

}
}
}
DWORD WINAPI Lesson (LPVOID)

{
Main();

return 1;

}

BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )

{
DisableThreadLibraryCalls(hDll);

if ( dwReason == DLL_PROCESS_ATTACH )
{

CreateThread(NULL, NULL, Lesson, NULL, NULL, NULL);

}
return TRUE;


}




(Of course it's not my source code, I'm just starting, when I'm done learning I will make my own and not c/p.)
ill give u 2 questions to think about. why do i have HackMax at 10 if u have one feature... and y does it only #include windows...
For the love of god use [code] tags and format your source.

You need to make sure the client is loaded and in game. I would add

Code:
bool HookReady()
{
	if( GetModuleHandleA( "d3d9.dll" ) //Not required if just memory hacking
		!= NULL && GetModuleHandleA("CShell.dll" ) != NULL  && 
		GetModuleHandleA( "ClientFX.fxd" ) != NULL)
		return true;
	return false;
}
and

Code:
bool inGame()
{
	if((*(INT*)GameStatus_ADDR== 1))
		return true;
	else
		return false;
	
}

The in the top of your main method add a check to see if the modules are loaded and sleep for like 25ms -35ms if not AND also add the inGame() method along side your test field to make sure you are in game before memory is modified and have it normal when you are out of game.
Thanks for the help, finally some help.

Did I said please hesitate to flame me? :P

Very new...


More hep is appreciated.
Here you go, this should work.

Code:
#include <windows.h>

#define SuperBullets 0x3740DDB6 /*Defining the address of SuperBullets*/

void Main()
{
	if(GameStatus == 1)/*Checking if In game*/
	{

		if(GetAsyncKeyState (VK_NUMPAD1))/*If Key is pressed*/
		{
			memcpy((LPVOID)SuperBullets, "\x33\xC0\x90", 3);//ON
		} else {
			memcpy((LPVOID)SuperBullets, "\x0F\x94\xC0", 3);//OFF
		}
	}
}

bool IsGameReady(void) //Gets the handle of all of these
{
    if( GetModuleHandleW( L"d3d9.dll"     ) != NULL 
		&& GetModuleHandleW( L"ClientFX.fxd" ) != NULL 
		&& GetModuleHandleW( L"CShell.dll"   ) != NULL )
		return true;
	
	return false;
}

DWORD WINAPI dwMainThread(LPVOID)
{
	while ( !IsGameReady() )
		Sleep(100);

	Main(); 

	return 0;
}

BOOL WINAPI DllMain(
	HINSTANCE hinstDLL,  // handle to DLL module
	DWORD fdwReason,     // reason for calling function
	LPVOID lpReserved )  // reserved
{
	// Perform actions based on the reason for calling.
	switch( fdwReason ) 
	{ 
	case DLL_PROCESS_ATTACH:
		// Initialize once for each new process.
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)dwMainThread, NULL, NULL, NULL);
		MessageBoxA(NULL, "Message", "Caption", MB_OK);
		break;

	case DLL_THREAD_ATTACH:
		// Do thread-specific initialization.
		break;

	case DLL_THREAD_DETACH:
		// Do thread-specific cleanup.
		break;

	case DLL_PROCESS_DETACH:
		// Perform any necessary cleanup.
		break;
	}
	return TRUE;  // Successful DLL_PROCESS_ATTACH.
}
Try learning more C++, How memory works and ASM helps too.
Quote Originally Posted by Flengo View Post
Here you go, this should work.

Code:
#include <windows.h>

#define SuperBullets 0x3740DDB6 /*Defining the address of SuperBullets*/

void Main()
{
	if(GameStatus == 1)/*Checking if In game*/
	{

		if(GetAsyncKeyState (VK_NUMPAD1))/*If Key is pressed*/
		{
			memcpy((LPVOID)SuperBullets, "\x33\xC0\x90", 3);//ON
		} else {
			memcpy((LPVOID)SuperBullets, "\x0F\x94\xC0", 3);//OFF
		}
	}
}

bool IsGameReady(void) //Gets the handle of all of these
{
    if( GetModuleHandleW( L"d3d9.dll"     ) != NULL 
		&& GetModuleHandleW( L"ClientFX.fxd" ) != NULL 
		&& GetModuleHandleW( L"CShell.dll"   ) != NULL )
		return true;
	
	return false;
}

DWORD WINAPI dwMainThread(LPVOID)
{
	while ( !IsGameReady() )
		Sleep(100);

	Main(); 

	return 0;
}

BOOL WINAPI DllMain(
	HINSTANCE hinstDLL,  // handle to DLL module
	DWORD fdwReason,     // reason for calling function
	LPVOID lpReserved )  // reserved
{
	// Perform actions based on the reason for calling.
	switch( fdwReason ) 
	{ 
	case DLL_PROCESS_ATTACH:
		// Initialize once for each new process.
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)dwMainThread, NULL, NULL, NULL);
		MessageBoxA(NULL, "Message", "Caption", MB_OK);
		break;

	case DLL_THREAD_ATTACH:
		// Do thread-specific initialization.
		break;

	case DLL_THREAD_DETACH:
		// Do thread-specific cleanup.
		break;

	case DLL_PROCESS_DETACH:
		// Perform any necessary cleanup.
		break;
	}
	return TRUE;  // Successful DLL_PROCESS_ATTACH.
}
Try learning more C++, How memory works and ASM helps too.
Okay, thanks for the help.

I have to define gamestatus, like superbullet, right?




Eh, I really need a teacher, people usually don't like to help with these stuff...
Quote Originally Posted by MohammaDMD18 View Post
Okay, thanks for the help.

I have to define gamestatus, like superbullet, right?



Eh, I really need a teacher, people usually don't like to help with these stuff...
Oh yeah. I forgot to define GameStatus. Do the same.
Quote Originally Posted by Flengo View Post


Oh yeah. I forgot to define GameStatus. Do the same.
It injects perfectly, even the pop-up comes, but in-game the superbullet doesn't work...hmm...I'm gonna keep learning C++, while trying to creat 1 working hack for CA, while being a noob and c/p-ing the source codes D:

I've realized how hard coding is, now on I'm gonna show some real respect to the coders, thank them and all that.
Quote Originally Posted by MohammaDMD18 View Post
It injects perfectly, even the pop-up comes, but in-game the superbullet doesn't work...hmm...I'm gonna keep learning C++, while trying to creat 1 working hack for CA, while being a noob and c/p-ing the source codes D:

I've realized how hard coding is, now on I'm gonna show some real respect to the coders, thank them and all that.
thats cause i bet u didnt read and figure out that u had to change it to (VK_NUMPAD1)&1)
That code wont work @Flengo. When I hit the numpad 1 button, the superbullets turns on but as soon as I let go it will turn off again.
Quote Originally Posted by master131 View Post
That code wont work @Flengo. When I hit the numpad 1 button, the superbullets turns on but as soon as I let go it will turn off again.
Code:
if(GetAsyncKeyState (VK_NUMPAD1)&1)
Woops
Just have the keypress trigger a boolean to change and use that same variable in a loop to determine to modify the memory.

Code:
//At top of program
BOOL sBullets = false; 

//top of main loop
if(GetAsyncKeyState (VK_NUMPAD1))
			sBullets = !sBullets //Switch state to opposite


//In loop farther down
if(sBullets )
	memcpy((LPVOID)SuperBullets, "\x33\xC0\x90", 3);//ON
else
	memcpy((LPVOID)SuperBullets, "\x0F\x94\xC0", 3);//OFF
The code given isn't on a while loop
Quote Originally Posted by flameswor10 View Post
The code given isn't on a while loop
How do you know I'm from there?

And just add
Code:
while(1){
To the beginning of where the hacks start. Before anything, in that function.

EDIT:

Also, Didn't notice. Its
Code:
if(*(BYTE*)GameStatus == 1)
Posts 1–15 of 15 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us