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 


Compiles, but crashes.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Wed Aug 27, 2008 6:57 pm    Post subject: Compiles, but crashes. Reply with quote

I'm attempting to code a bot using an OOP approach, but the project just crashes miserably after ticking a check box. It compiles, but the debugger says I'm passing a bad pointer to the static function. I've attached the relavent source files. Help would be greatly appreciated. I'm completely lost with this. I have no idea where to start.

The whole solution:
http://www.megaupload.com/?d=RNWSFR5U

I would really appreciate it if you could help. I've tried for literally 3 hours and have gotten absolutely no where.



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.

Back to top
View user's profile Send private message AIM Address
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Wed Aug 27, 2008 7:03 pm    Post subject: Reply with quote

Brb ill take a look

Multiple problems:

1. DO NOT USE CloseHandle(), its not the proper thing to do.

Code:
TerminateThread (hBotFunction, 0);


Replace them all with TerminateThread

2. The AutoClicker PostMessageX is wrong.

Code:
      PostMessageX(MShWnd, WM_LBUTTONDOWN, NULL, (LPARAM)&CursorPosition);
      PostMessageX(MShWnd, WM_LBUTTONUP, NULL, (LPARAM)&CursorPosition);


This will send a click once.

3. You have

Code:
virtual BOOL BotFunctionThread();=0
<<What?

change it to

Code:
virtual BOOL BotFunctionThread();
Back to top
View user's profile Send private message Send e-mail
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Wed Aug 27, 2008 8:14 pm    Post subject: Reply with quote

Those aren't the problems. AutoLoot crashes, its not even creating the thread in order to be terminated (hence the crashing), and the abstract class was an attempted resolution which didn't work. In other words, I had it the way you had it beforehand. Im pretty sure it has to do with the polymorphic characteristics of the class... I'm just not sure exactly what.
Back to top
View user's profile Send private message AIM Address
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Wed Aug 27, 2008 8:17 pm    Post subject: Reply with quote

Well with there changes, nothing crashes for me.
Back to top
View user's profile Send private message Send e-mail
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Wed Aug 27, 2008 8:19 pm    Post subject: Reply with quote

It crashes when you tick/untick
Back to top
View user's profile Send private message AIM Address
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Aug 27, 2008 9:32 pm    Post subject: Reply with quote

Actually, what you should be avoiding is TerminateThread().
Back to top
View user's profile Send private message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Wed Aug 27, 2008 9:53 pm    Post subject: Reply with quote

Zand wrote:
Actually, what you should be avoiding is TerminateThread().


How so?
Back to top
View user's profile Send private message Send e-mail
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Aug 27, 2008 9:56 pm    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/library/ms686717.aspx

Hmmm..........BBCode trouble
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Aug 28, 2008 4:40 am    Post subject: Reply with quote

hBotFunction = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)BotFunctionThreadStart, this, 0, NULL);

Uh, i'm looking for the BotFunctionThreadStart, and i don't see it

You should be calling botfuntionthread but also, you don't initalize the delay except for KeyBotFunctions which is never called in these routines. Is the crash due to an uninitalized variable being used?

_________________
Back to top
View user's profile Send private message
WafflesFTW
Expert Cheater
Reputation: 0

Joined: 21 Mar 2008
Posts: 131

PostPosted: Thu Aug 28, 2008 10:31 am    Post subject: Reply with quote

BotFunctionThreadStart is a static function defined in the class. I can only call a static function within the class via createThread, so I need the static function to then call the virtual function. KeyBotFunctions/MouseBotFunctions is a constructor so its called and initialized then.
Back to top
View user's profile Send private message AIM Address
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Thu Aug 28, 2008 10:35 am    Post subject: Reply with quote

Read more about WM_LBUTTONDOWN notification, MK_LBUTTON -_-
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Thu Aug 28, 2008 2:14 pm    Post subject: Reply with quote

That shouldn't crash it though. It should just ignore it
_________________
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
Page 1 of 1

 
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