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++]Hooking process Problem (( solved, don't post))
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
gogodr
I post too much
Reputation: 125

Joined: 19 Dec 2006
Posts: 2041

PostPosted: Mon Dec 15, 2008 11:29 pm    Post subject: [C++]Hooking process Problem (( solved, don't post)) Reply with quote

My trainer is almost finished
the problem is that at the moment of hooking it just doesn't x_x
can someone tell me whats wrong?
(( or maybe its a protection that the game haves? if so.. how is that cheat engine can hook on it? ... ))

BTW this is for Grand Chase USA
message boxes help because you have to hook in the main.exe as the gameguard loads then it dissapears and creates some more addresses in game
so the hack must be activated in game but hooked before the game loads completly

Code:

#include <windows.h>
#include <iostream>

void main()
{
   MessageBox (NULL, "click to hook" , "hook", 0);
   unsigned long PID;
   HWND hWindow=FindWindow(NULL, "main");
    HANDLE hProcess;
      DWORD amp = 0x01;
    DWORD Newdatasize=sizeof(amp);

   if (hWindow != 0)
{
MessageBox (NULL, "Game Found" , "Game Found", 0);

    CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);
            GetWindowThreadProcessId(hWindow, &PID);
hProcess=OpenProcess(PROCESS_ALL_ACCESS, TRUE, PID);

   if (hProcess != 0)
      {
         MessageBox (NULL, "click this to activate after you are inside" , "activation", 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F24, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F25, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F26, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02707394, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02707398, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02651E6C, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02651E70, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F10, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F11, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F12, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F28, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F29, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F2A, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x027078FC, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02707900, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F2B, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F2C, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F2D, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F2E, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02707ECC, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02707ECF, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02707ED0, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F1C, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F1D, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F1E, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x027068D4, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x027068D8, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F20, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02706E44, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02706E48, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F14, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F15, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F16, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02705E44, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02705E48, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x026A6F18, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02706384, &amp, Newdatasize, 0);

WriteProcessMemory(hProcess, (LPVOID)0x02706388, &amp, Newdatasize, 0);

CloseHandle(hProcess);
MessageBox (NULL, "1 Hit KO Activated" , "1 Hit KO Activated", 0);

}
      else
   {
      MessageBox (NULL, "Failed to activate the hack" , "Failed", 0);
 
         }
      }
else
{
MessageBox (NULL, "Couldn't find the Main.exe" , "Couldn't find", 0);

}
}


Last edited by gogodr on Wed Dec 17, 2008 1:29 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Mon Dec 15, 2008 11:41 pm    Post subject: Reply with quote

GameGuard detects calls to WriteProcessMemory.

You have to wait for GrandChase to unpack itself and then disable GG.

Also, I thought the monster addreses were in pointers.

Final thing, the values in those addresses change quite a lot. That means you need to freeze them.
Back to top
View user's profile Send private message
gogodr
I post too much
Reputation: 125

Joined: 19 Dec 2006
Posts: 2041

PostPosted: Mon Dec 15, 2008 11:53 pm    Post subject: Reply with quote

monster are in 4 byte addresses

yeah that may be a problem but for now.. the problem is that it doesnt hook

this

HWND hWindow=FindWindow(NULL, "main");

is not working right
Back to top
View user's profile Send private message MSN Messenger
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Tue Dec 16, 2008 12:16 am    Post subject: Reply with quote

That's because you have it completely wrong. Go learn C++ before you make something idiotic like this.
Back to top
View user's profile Send private message
gogodr
I post too much
Reputation: 125

Joined: 19 Dec 2006
Posts: 2041

PostPosted: Tue Dec 16, 2008 12:49 am    Post subject: Reply with quote

if you are so PRO and its all wrong, why dont you tell me whats wrong?
Back to top
View user's profile Send private message MSN Messenger
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Tue Dec 16, 2008 2:02 am    Post subject: Reply with quote

gogodr wrote:
if you are so PRO and its all wrong, why dont you tell me whats wrong?


I am not saying I am pro, just that you have no idea what you are doing.

Code:

HWND FindWindow(     
    LPCTSTR lpClassName,   //This is the classname of the window. I really don't know how to describe it.
    LPCTSTR lpWindowName //This is the windows caption. You were saying that GrandChase's main window's caption was main. It definitely isn't.
);


I was merely angry that you are jumping straight into this sort of stuff without even understanding the basics.

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

MSDN and google should answer almost every question.
Back to top
View user's profile Send private message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 16, 2008 6:22 am    Post subject: Reply with quote

Code:

hProcess=OpenProcess(PROCESS_ALL_ACCESS, TRUE, PID);

Code:

hProcess = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_READ | PROCESS_CREATE_THREAD, FALSE, Pid);

i don't think you'll be able to write to process's memory with ALL_ACCESS.
plus all user32.dll api's are hooked while gg is on
don't have much time to check the rest of the code
oh and you can create a codecave to replace all those WPM lines using inline asm
Back to top
View user's profile Send private message
GMZorita
Grandmaster Cheater Supreme
Reputation: 0

Joined: 21 Mar 2007
Posts: 1361

PostPosted: Tue Dec 16, 2008 7:00 am    Post subject: Reply with quote

1qaz wrote:
Code:

hProcess=OpenProcess(PROCESS_ALL_ACCESS, TRUE, PID);

Code:

hProcess = OpenProcess(PROCESS_VM_WRITE | PROCESS_VM_READ | PROCESS_CREATE_THREAD, FALSE, Pid);

i don't think you'll be able to write to process's memory with ALL_ACCESS.
plus all user32.dll api's are hooked while gg is on
don't have much time to check the rest of the code
oh and you can create a codecave to replace all those WPM lines using inline asm

Do you have any idea of what "ALL" means?
msdn wrote:
PROCESS_ALL_ACCESS All possible access rights for a process object.

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

Joined: 19 Dec 2006
Posts: 2041

PostPosted: Tue Dec 16, 2008 8:41 am    Post subject: Reply with quote

HawwwaH wrote:
gogodr wrote:
if you are so PRO and its all wrong, why dont you tell me whats wrong?


I am not saying I am pro, just that you have no idea what you are doing.

Code:

HWND FindWindow(     
    LPCTSTR lpClassName,   //This is the classname of the window. I really don't know how to describe it.
    LPCTSTR lpWindowName //This is the windows caption. You were saying that GrandChase's main window's caption was main. It definitely isn't.
);


I was merely angry that you are jumping straight into this sort of stuff without even understanding the basics.

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

MSDN and google should answer almost every question.


you were angry for nothing because of not knowing then -_-
because grand chase main application is main.exe
on cheat engine you need to hook the main.exe to apply the hack
there is a grandchase.exe but its only the launcher that verifys your files before starting the game then it launches the main.exe

I'm pretty sure I understand the bassis of programming ... -_-

http://img355.imageshack.us/img355/5611/79525667pc3.jpg
(( here is the file with the granchase files you can see there is the main.exe))
Back to top
View user's profile Send private message MSN Messenger
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Dec 16, 2008 8:45 am    Post subject: Reply with quote

The window isn't called main though... Rolling Eyes
Back to top
View user's profile Send private message MSN Messenger
gogodr
I post too much
Reputation: 125

Joined: 19 Dec 2006
Posts: 2041

PostPosted: Tue Dec 16, 2008 8:56 am    Post subject: Reply with quote

noz3001 wrote:
The window isn't called main though... Rolling Eyes

the process on the task manager processes list is called "main.exe"
I should change it to the name that its shown in the applications tab?
in the aplications tab it shows "GrandChase v08.06.15.0"
Back to top
View user's profile Send private message MSN Messenger
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Dec 16, 2008 9:20 am    Post subject: Reply with quote

Whatever it show up as in the bar at the bottom.
Back to top
View user's profile Send private message MSN Messenger
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Tue Dec 16, 2008 9:29 am    Post subject: Reply with quote

The file name is main.exe, GrandChase v08.06.15.0 is the title. (also window name)

Don't expect coding anything this way, go learn the basics of C++ before jumping to coding lame trainers if anything at all, we're not gonna code it for you so stop asking us every stupid question you have, even when the error tells you exacly what the problem is you're asking us how to fix it? (http://forum.cheatengine.org/viewtopic.php?t=335953)
You don't even know the syntax of the language (http://forum.cheatengine.org/viewtopic.php?t=335919) and your code is inefficient (see first post) and it isn't even correct. (Passed the process name instead of window name as a parameters, for instance)

You can clearly see you just copy-pasted the code someone gave you.

http://cplusplus.com - enjoy.
Back to top
View user's profile Send private message
Abilityfun
How do I cheat?
Reputation: 0

Joined: 10 Jun 2007
Posts: 8

PostPosted: Tue Dec 16, 2008 11:22 am    Post subject: Reply with quote

Before you copy and paste don't forget to initialize some of your variables, I can't even tell what you are trying to do with your code.
Back to top
View user's profile Send private message
gogodr
I post too much
Reputation: 125

Joined: 19 Dec 2006
Posts: 2041

PostPosted: Tue Dec 16, 2008 12:08 pm    Post subject: Reply with quote

well i dont care if some ppl doesnt like my method but this is my way to learn a language, this is the same way I learnt a little of Boreland delphi.
actually in this forum the only thing that helped me with this code was a reminder that I had to use this in a main anyways that wasnt the only solution I could kept it as a void HitKO and then make my main and call ir , t
or make a form and place a button that calls is, now I'm going to try changing the name and if something else is wrong, ok I wont ask for anymore here since most of ppl just doesnt know or if they know they are just "GTFO and learn by yourselft" Rolling Eyes
Back to top
View user's profile Send private message MSN Messenger
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