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 process creation

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

Joined: 17 Apr 2010
Posts: 38

PostPosted: Tue Jun 01, 2010 6:23 pm    Post subject: Hooking process creation Reply with quote

My quick search told me I have the following options:

(1) Write a driver which hooks NtCreateSection()
I don't want to write a driver, it's too messy for the simple thing that I want to accomplish.

(2) Use the AppInit_DLLs registry value
I don't want to use this method, it's kind of lame..

(3) Use EnumProcesses() in a loop and detect new & destroyed processes
I refuse to believe that this the most efficient way for this problem, and I'm always scared of hogging resources.

Anyone know a good method?
Back to top
View user's profile Send private message MSN Messenger
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Tue Jun 01, 2010 6:46 pm    Post subject: Reply with quote

only good and 'official' method is 1, but don't hook NtCreateSection, Just call PsSetCreateProcessNotifyRoutine

alternatively, perhaps you could do something with WMI ( http://msdn.microsoft.com/en-us/library/aa390425%28VS.85%29.aspx )

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
bhpianist
Cheater
Reputation: 1

Joined: 17 Apr 2010
Posts: 38

PostPosted: Wed Jun 02, 2010 11:35 am    Post subject: Reply with quote

Drivers are too messy though.. there isn't another way to run a system-wide hook?

WMI is messy too...
Back to top
View user's profile Send private message MSN Messenger
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Thu Jun 03, 2010 2:14 am    Post subject: Reply with quote

You could use SetWindowsHookEx to inject a dll into every process. The dll could report back to the main application to notify when it has been injected into a new process. However this will not be at the point the process is created but only once it is completely loaded (and running) I think.
Back to top
View user's profile Send private message
bhpianist
Cheater
Reputation: 1

Joined: 17 Apr 2010
Posts: 38

PostPosted: Fri Jun 04, 2010 10:17 pm    Post subject: Reply with quote

tombana wrote:
You could use SetWindowsHookEx to inject a dll into every process. The dll could report back to the main application to notify when it has been injected into a new process. However this will not be at the point the process is created but only once it is completely loaded (and running) I think.


Holy shit, that'll about do it. Thanks.
Any idea when the DLL is injected?
Back to top
View user's profile Send private message MSN Messenger
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Sat Jun 05, 2010 5:29 am    Post subject: Reply with quote

bhpianist wrote:
Holy shit, that'll about do it. Thanks.
Any idea when the DLL is injected?

As soon as you call SetWindowsHookEx (with the appropriate parameters for global injection into áll processes) it will inject the dll into the already running processes. For new processes, I think the dll is loaded somewhere before the entry-point of the main exe is executed.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Sat Jun 05, 2010 5:49 am    Post subject: Reply with quote

Note that it won't load into processes that have no gui
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
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
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