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 Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Tue Dec 16, 2008 4:14 pm    Post subject: Reply with quote

GMZorita wrote:
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.

well, i'v said i'm not sure about that part
from my experience ALL_ACCESS Flag didn't give me the privilege to change the memory, or injecting dll's and other stuff
i had to specify the correct flags
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Tue Dec 16, 2008 4:45 pm    Post subject: Reply with quote

Why dont you do it via DLL injecting? Much easier!
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Tue Dec 16, 2008 5:18 pm    Post subject: Reply with quote

Code:

    CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);


I don't think this is needed at all...
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

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

PostPosted: Tue Dec 16, 2008 5:38 pm    Post subject: Reply with quote

_void_ wrote:
Code:

    CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);


I don't think this is needed at all...


noz3001 wrote:
Code:
CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);


Isn't needed. It was only in my code because I used it to test something and forgot to remove it.
Back to top
View user's profile Send private message MSN Messenger
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Tue Dec 16, 2008 6:48 pm    Post subject: Reply with quote

GMZorita wrote:
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.

Do you have any idea what "DOES NOT WORK ON WINDOWS VISTA" means? Rolling Eyes

_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Tue Dec 16, 2008 8:19 pm    Post subject: Reply with quote

noz3001 wrote:
_void_ wrote:
Code:

    CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);


I don't think this is needed at all...


noz3001 wrote:
Code:
CreateRemoteThread(hWindow, NULL, 0, 0, 0, NULL, NULL);


Isn't needed. It was only in my code because I used it to test something and forgot to remove it.


I didn't read all the posts.
Back to top
View user's profile Send private message
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Tue Dec 16, 2008 10:45 pm    Post subject: Reply with quote

gogodr wrote:
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


Sorry that you are butthurt but almost everything is either wrong or copy and pasted (or both) so, you can see why we get tired. I was angry because, it appeared that you did not look up or even attempt to understand the code you had stolen and then came here asking us why it wasn't working.

If you even want to see what isn't working with something like this, use a logical troubleshooting method. Mine would be something like:
Code:

HWND hWnd = FindWindow(NULL, "main");
printf("According to FindWindow, the HWND is: %s", hWnd);
DWORD pID;
GetWindowThreadProcessId(...); //I don't remember off the top of my head
printf("According to GetWindowThreadProcessId, the PID is: %s", pID);
HANDLE h = OpenProcess(...); //Same as pID
printf("According to OpenProcess, the HANDLE is: %s", h);
getchar();


Now, that quick thing would tell you instantly that FindWindow wasn't working. After that, I would check the parameters and use something like Spy++ to have a look at GrandChase.

PROTIP:
From memory, look at:
"D3D Window"
"GrandChase -version number here-"
Back to top
View user's profile Send private message
hacksign23
Master Cheater
Reputation: 0

Joined: 26 Nov 2006
Posts: 404

PostPosted: Wed Dec 17, 2008 1:19 am    Post subject: Reply with quote

o_o

you don't get the process name
process name examples wrote:


winmine.exe
firefox.exe


instead, you get the window name
window name examples wrote:

Minesweeper
Mozilla Firefox Start Page - Mozilla Firefox

if this is said before, than dam.

you can get it by using GetProcessByName()
*requires an array but it's simple*
i think.

oh, do
using namespace System::Diagnostics

i think.

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

Joined: 10 Sep 2007
Posts: 197
Location: Colorado

PostPosted: Wed Dec 17, 2008 1:52 am    Post subject: Reply with quote

As some have pointed out, you're using FindWindow wrong. Even if you're using it right, I wouldn't use it to find the handle of a window. The reason for this is because windows are allowed to have the same title. You could use the class name, but that is equally unreliable since you look for the class "BUTTON". Best way is to enumerate the running processes.

When using OpenProcess, you should use PROCESS_VM_OPERATION and PROCESS_VM_WRITE. PROCESS_ALL_ACCESS will not work on all computers, not without changing the status of the user. Anyways, you shouldn't give it all access rights if you're not planning on using all the functions that require rights that you are not using.

Enumerating processes: http://msdn.microsoft.com/en-us/library/ms682623

Code:

HWND hWnd = FindWindow(NULL, "main");
printf("According to FindWindow, the HWND is: %s", hWnd);
DWORD pID;
GetWindowThreadProcessId(...); //I don't remember off the top of my head
printf("According to GetWindowThreadProcessId, the PID is: %s", pID);
HANDLE h = OpenProcess(...); //Same as pID
printf("According to OpenProcess, the HANDLE is: %s", h);
getchar();


This is ok, but it will cause an error. HWND and HANDLE are of the type void * and they are not char arrays that ends in 0 ('\0'). Also, DWORD is of the type unsigned long.
Back to top
View user's profile Send private message
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Thu Dec 18, 2008 12:46 am    Post subject: Reply with quote

killersamurai:
It will give quick trouble shooting to see where it isn't working... I know there are better methods but, I am lazy.
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Thu Dec 18, 2008 2:02 am    Post subject: Reply with quote

killersamurai wrote:
As some have pointed out, you're using FindWindow wrong. Even if you're using it right, I wouldn't use it to find the handle of a window. The reason for this is because windows are allowed to have the same title. You could use the class name, but that is equally unreliable since you look for the class "BUTTON". Best way is to enumerate the running processes.

When using OpenProcess, you should use PROCESS_VM_OPERATION and PROCESS_VM_WRITE. PROCESS_ALL_ACCESS will not work on all computers, not without changing the status of the user. Anyways, you shouldn't give it all access rights if you're not planning on using all the functions that require rights that you are not using.

Enumerating processes: http://msdn.microsoft.com/en-us/library/ms682623

Code:

HWND hWnd = FindWindow(NULL, "main");
printf("According to FindWindow, the HWND is: %s", hWnd);
DWORD pID;
GetWindowThreadProcessId(...); //I don't remember off the top of my head
printf("According to GetWindowThreadProcessId, the PID is: %s", pID);
HANDLE h = OpenProcess(...); //Same as pID
printf("According to OpenProcess, the HANDLE is: %s", h);
getchar();


This is ok, but it will cause an error. HWND and HANDLE are of the type void * and they are not char arrays that ends in 0 ('\0'). Also, DWORD is of the type unsigned long.


Processes can have the same filename too..
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 Previous  1, 2
Page 2 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