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 


Hooking

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

Joined: 14 Apr 2007
Posts: 214

PostPosted: Sat Apr 14, 2007 8:02 pm    Post subject: Hooking Reply with quote

I know that people say that hooking is Easy, but im just a beginner.

Can Someone Help me On How the Hook works and how to attach it to my program? (Like a Tutorial)
I'm currently making a trainer and all i just need is a hook which will attach itself to MapleStory.

P.S : I hate using c++ Anyway on getting it to work in VB?

Edit: Or Is It Just Easy to Open the Program using the CEHook Process on Maple?
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sat Apr 14, 2007 8:16 pm    Post subject: Re: Hooking Reply with quote

Well if you are a biginner you should not start doing trainer and stuff. Don't use Visual Basic, use C++ and asm . If you want to do a trainer or a bot you most probably will need to create a DLL. And you will also need to create a driver that will allow some API that are bloacked by GG.

ArmenianUnit wrote:

I'm currently making a trainer and all i just need is a hook which will attach itself to MapleStory.


You mean?
Code:
 HWND hWindow = FindWindow(NULL, “MapleStory”);
CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);
GetWindowThreadProcessId(hWindow, &PID);


And here is an example of a bot in a DLL. THIS WILL RLY NOT WORK WITH MAPLE BTW Rolling Eyes

Code:
#include "windows.h"

void WINAPI BotZ();
HANDLE hBotZ;

BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
    if (ul_reason_for_call == DLL_PROCESS_ATTACH)
    {
        // Create a new thread in the process when injected and start our BotZ() Function. //
        hBotZ = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)BotZ, NULL, 0, 0);
    }
    return TRUE;
}

void WINAPI BotZ()
{
    MessageBoxA(0, "This is our bot function.", "Hello", MB_ICONINFORMATION);
           while ( 0 == 0 )                                                                     // Infinite loop
    {
        if (GetAsyncKeyState(VK_F5))                                      // Only IF the F5 key has been presses
        {
            while(!GetAsyncKeyState(VK_F6))                    // Only while the key F6 has not been pressed.
            {
                keybd_event(VkKeyScan('z'),0,0,0);     // Presses z key
                Sleep(100);
            }

                Sleep(10); //No crashing!
           
        }
        Sleep(10);
    }
}



Its copy pasted from noz3001 blog http://noz3001.wordpress.com/

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

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Sat Apr 14, 2007 9:33 pm    Post subject: Reply with quote

But that code isn't particularly good code. I'm sure I said this before but

Code:

while(0 == 0)


Is very poor coding, for an infinite loop you should do

Code:

for(;;)


Because this does not test any conditions, and it is translated into an unconditional jump (jmp) instead of a compare and a conditional jump (cmp, je)

Though modern compilers may recognize that 0 will never not equal 0, you cannot always abuse the compiler to make up for you lack. Another thing, its a good idea to close any handles to threads/processes you create.
Back to top
View user's profile Send private message
Robotex
Master Cheater
Reputation: 0

Joined: 05 Sep 2006
Posts: 378
Location: The pizza country!

PostPosted: Sun Apr 15, 2007 3:19 am    Post subject: Reply with quote

I don't think an infinite loop is always a good thing, I prefer a loop wich stoppes when i don't need it anymore
Like:
bool Close = false;
void MyFunc
{
while(!Close)
{
blahblah
if(GetAsyncKeyState(VK_F12))
Close=true;
}
}
And for getting an another process handle i use CreateToolhelp32Snapshot

_________________

ASM/C++ Coder
Project Speranza lead developer
Back to top
View user's profile Send private message
UnLmtD
Grandmaster Cheater
Reputation: 0

Joined: 13 Mar 2007
Posts: 894
Location: Canada

PostPosted: Sun Apr 15, 2007 7:01 am    Post subject: Reply with quote

I didn't know that, thanks appalsap
_________________
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