Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[c++]loop crash
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Nov 13, 2008 3:41 pm    Post subject: [c++]loop crash Reply with quote

after recent update from nexon ms.

some code in my trainer are crashing me for no reason.

After many trials....

here is what i got so far

Crash code

Code:
.
mainthread
{
. limit = blahblah from userinput
.

For(int x=0; x< limit;x++)
{

function(param1);
Sleep(50);
}
}



DWORD function(int x)
{
some calculation
and calling other funtions

return 1;
}



working code

Code:
.

mainthread
{
. limit = blahblah from userinput
.

function(param1,limit,0);

}

DWORD function(int x,int total,int current_counter)
{
some calculation
and calling other funtions

current_counter++;
Sleep(50);

if(current_counter>=limit)
return 1;
else
return function(param1,limit,current_counter);

}


so basicaly if i used For,while or dowhile loop, i get crash instantly.
only the 2nd method (recursive calls) works when i need to loop them

anyone knwo why :S ...

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils


Last edited by Bizarro on Fri Nov 14, 2008 6:33 pm; edited 6 times in total
Back to top
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Thu Nov 13, 2008 3:51 pm    Post subject: Reply with quote

Is it a MSfunction?
Does it have Params?

And I dont think it checks ESP or else the 2nd way would not work either.

_________________
Gone
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Nov 13, 2008 4:50 pm    Post subject: Reply with quote

i tried
For, while, dowhile
all crashed

then when i tried Recursive calls, it worked with no crash =D

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
Spawnfestis
GO Moderator
Reputation: 0

Joined: 02 Nov 2007
Posts: 1746
Location: Pakistan

PostPosted: Thu Nov 13, 2008 4:53 pm    Post subject: Reply with quote

Well what the fuck is:
Code:
function1(param1,param2);

????

_________________

CLICK TO HAX MAPLESTORAY ^ !!!!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Nov 13, 2008 4:56 pm    Post subject: Reply with quote

Spawnfestis wrote:
Well what the fuck is:
Code:
function1(param1,param2);

????


just a general function..


ie
Code:
DWORD functionname(int a,int b, int c)
{
doing stuff....
return 1;
}

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Thu Nov 13, 2008 4:57 pm    Post subject: Reply with quote

Spawnfestis wrote:
Well what the fuck is:
Code:
function1(param1,param2);

????

I asked him if it had any param, so just to let us know that it takes 2 params...

BTW on while or for or blablabla...

Are you doing something like
Code:

for(...)
function1(i,10);


and normaly you do:
Code:

function1(1,10);
function1(2,10);

Get what i mean?


Edit1:
Is it in your app, or its a code cave in some MS procedure?

_________________
Gone
Back to top
View user's profile Send private message
Spawnfestis
GO Moderator
Reputation: 0

Joined: 02 Nov 2007
Posts: 1746
Location: Pakistan

PostPosted: Thu Nov 13, 2008 5:19 pm    Post subject: Reply with quote

GMZorita wrote:
Spawnfestis wrote:
Well what the fuck is:
Code:
function1(param1,param2);

????

I asked him if it had any param, so just to let us know that it takes 2 params...

BTW on while or for or blablabla...

Are you doing something like
Code:

for(...)
function1(i,10);


and normaly you do:
Code:

function1(1,10);
function1(2,10);

Get what i mean?


Edit1:
Is it in your app, or its a code cave in some MS procedure?

I'm asking what is in the function, what the function does to MS. As it might collide with its recent updates.

_________________

CLICK TO HAX MAPLESTORAY ^ !!!!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Nov 13, 2008 5:21 pm    Post subject: Reply with quote

Spawnfestis wrote:
GMZorita wrote:
Spawnfestis wrote:
Well what the fuck is:
Code:
function1(param1,param2);

????

I asked him if it had any param, so just to let us know that it takes 2 params...

BTW on while or for or blablabla...

Are you doing something like
Code:

for(...)
function1(i,10);


and normaly you do:
Code:

function1(1,10);
function1(2,10);

Get what i mean?


Edit1:
Is it in your app, or its a code cave in some MS procedure?

I'm asking what is in the function, what the function does to MS. As it might collide with its recent updates.


He said it works when it's not in a loop so the function is ok

_________________
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Nov 13, 2008 6:33 pm    Post subject: Reply with quote

there is nothing wrong with my code as its working last patch.
it only started crashing after the new patch.

i had to remove most of the for loop and change it to recursive calls to avoid the crashing.

@spawnfetis it does work by replacing the loop with numerous repetitive single calls. i just showed an example(2) up there.

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
sloppy
Expert Cheater
Reputation: 0

Joined: 17 Aug 2008
Posts: 123

PostPosted: Thu Nov 13, 2008 6:54 pm    Post subject: Reply with quote

You are not giving us much to work with, at the very least you should post your function or provide details of what it's doing exactly.

Try a simple test..
Code:
char szBuff[10];

for(int i = 1;  i <= 3; i++)
{
   sprintf_s(szBuff, sizeof(szBuff), "Loop: %d", i);
   MessageBox(0, szBuff, "Test", MB_OK);
}
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Thu Nov 13, 2008 9:33 pm    Post subject: Reply with quote

run it from the debugger, when you crash, you'll get a lovely message pointing you in the right direction.
Back to top
View user's profile Send private message
Bizarro
I post too much
Reputation: 0

Joined: 01 May 2007
Posts: 2648

PostPosted: Thu Nov 13, 2008 10:22 pm    Post subject: Reply with quote

here is what i know so far

Crash code

Code:
.
.
. limit = blahblah from userinput
.

For(int x=0; x< limit;x++)
{

function(param1);
Sleep(50);
}


DWORD param1(int x)
{
some calculation
and calling other funtions

return 1;
}



working code

Code:
.
. limit = blahblah from userinput
.

function(param1,limit,0);



DWORD function(int x,int total,int current_counter)
{
some calculation
and calling other funtions

current_counter++;
if(current_counter>=limit)
return 1;
else
return function(param1,limit,current_counter);

}

_________________

w8 baby.com Banner contest, Come join NOW!!
Check us out for Prize deatils
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Fri Nov 14, 2008 12:53 am    Post subject: Reply with quote

Bizarro wrote:
here is what i know so far

Crash code

Code:
.
.
. limit = blahblah from userinput
.

For(int x=0; x< limit;x++)
{

function(param1);
Sleep(50);
}


DWORD param1(int x)
{
some calculation
and calling other funtions

return 1;
}



working code

Code:
.
. limit = blahblah from userinput
.

function(param1,limit,0);



DWORD function(int x,int total,int current_counter)
{
some calculation
and calling other funtions

current_counter++;
if(current_counter>=limit)
return 1;
else
return function(param1,limit,current_counter);

}


try to delete all code in (param1) and see if it still crash or rename it simple

it could be that GG detect your trainer but in some way it craches when it does the scan/ or they just try to close it

well possible not because it would be stupid but since there is no reason for your trainer to crash you could atleast test

notice if you use a keystroke (postmessagex/sendinput) try just delete that part there you send it and try again i had a crash problem with PMX for maple because i had the bypass function in another unit (delphi)

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Fri Nov 14, 2008 1:42 am    Post subject: Reply with quote

Just post the damn source so it's possible to be of help.
Back to top
View user's profile Send private message
ups2000ups
I post too much
Reputation: 0

Joined: 31 Jul 2006
Posts: 2471

PostPosted: Fri Nov 14, 2008 2:14 am    Post subject: Reply with quote

bizzaro - could you post one of the codes that crash instead of writing examples

(sorry for bad english i dont have the spell checker on my school comp)

_________________
dont complain about my english...
1*1 = 2?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites