Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 13:53

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help] code crashing game

Discussion on [Help] code crashing game within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2014
Posts: 2
Received Thanks: 0
[Help] code crashing game

My very small hack I've made is crashing my game and I don't know why, all I wanted to do was keep the ammo at 42 (favorite number) and not let it decrease. but whenever I start the exe the game crashes... should I make it as a dll and inject it instead? this is the error I get upon starting the exe "win32 exception 0x0000005 [0x36]"
and here is my code

#include "stdafx.h"
#include <iostream>
#include <string>
#include <Windows.h>


using namespace std;

int main(void)
{

int nVal = 42;

HWND hWnd = FindWindowA(0, "AssaultCube");

if (hWnd == 0)
{
cerr << "Could not find window" << endl;
}
else
{
BYTE data[] = { 0x0, 0x14, 0x384, 0x0 };
DWORD pId;
GetWindowThreadProcessId(hWnd, &pId);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, false, pId);

if (!hProc)
{
cerr << "Process can't open.." << endl;
}
else
{
int stat = WriteProcessMemory(hProc, (LPVOID)0x005100F8, &nVal, (DWORD)sizeof(nVal), NULL);

if (stat < 42)
{
clog << "Activated" << endl;
}
else
{
cerr << "Not applied" << endl;
}

CloseHandle(hProc);
}
}
system("pause");
return 0;
}
ogpayne is offline  
Old 08/23/2015, 03:15   #2
 
~kau~'s Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 634
Received Thanks: 794
WriteProcessMemory is rtn your value? :O how?
Is the adress static?
remove the red line...

int stat = WriteProcessMemory(hProc, (LPVOID)0x005100F8, &nVal, (DWORD)sizeof(nVal), NULL);

if (stat < 42)
{
clog << "Activated" << endl;
}
else
{
cerr << "Not applied" << endl;
}
~kau~ is offline  
Old 10/22/2015, 20:24   #3
 
elite*gold: 225
Join Date: Sep 2014
Posts: 334
Received Thanks: 461
wpm returns a bool, so it can only be 0 or 1, hence your check is ****.
check nVal.
Cyrex' is offline  
Reply


Similar Threads Similar Threads
Game Crashing
07/14/2011 - Dekaron - 0 Replies
so ive updated, freshly unpacked, and had even deleted the CRC and the .log files in the bin folder for the bypass to create new, fresh ones... when PackIO in shadow is set to 1 bypass works all fine, and can log in change it to 0 even when its still completely fresh, game just crashes before it can start loading anyone else with same problem? anyone overcome it?
(Help) NPC Crashing Game
11/05/2010 - Mabinogi - 1 Replies
ive tried talking to eahba and heledd, but everytime it freezes, error message, then i disconnect. Not sure if this is mod related or not. And every other npc works fine. whats wrong? the only thing i can tell is this is mabi v69 as stated or error report and its tiara v67
[big problem]Tbot crashing game when i paste verification code
12/12/2008 - Silkroad Online - 0 Replies
Hello all i have a big problem with tbot , today i have got tbot ,and big bum... When i click confirm game will crash . Can somebody help me ?
My game Crashing
07/14/2008 - GunZ - 2 Replies
I have problem ,my gunz crash after 3-10 minutes and none messege error or something appear. What I have to do? I've used on the fast moonlight engine,and I heared if I use that it maybe the factor to the probelm. But I deleted all are attached to this program also the Kernelmoduleunloader.exe. I just deleted it not unload it or something cause I didn't know how. So what I have to do for unload this progrem and to solve my crash? BTW I have the Crash only on my own server and on Gunz...
Anyone else crashing during the game?
05/09/2007 - Silkroad Online - 2 Replies
I have asked for help on Silkroad .net but nothing as expected. Have any of you experienced crashes when walking, and lag spikes? It is not my computer or internet, why is it doing this? It wasnt before I reinstalled it this morning... Right after I reinstalled it, it just started crashing like never before every time I get a horse or start farming... It is getting annoying and I am considering quitting sro over this crap. I have now reinstalled it about 6 times and restarted my computer more...



All times are GMT +2. The time now is 13:53.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.