Start process with SetWindowsHookEx

c++ / delphi package - dll injection and api hooking

Start process with SetWindowsHookEx

Postby nildo » Wed May 12, 2004 11:46 am

Hello Mathias!
Is there a way to start a process with a single SetWindowsHookEx DLL kind, injected?

Like the CreateProcessEx, but with not a MadCodeHook DLL. Thank you!
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am

Postby madshi » Wed May 12, 2004 5:57 pm

I'm sorry but I don't understand what you mean... :confused:
madshi
Site Admin
 
Posts: 9774
Joined: Sun Mar 21, 2004 5:25 pm

Postby nildo » Wed May 12, 2004 6:19 pm

FOr example:

I have a DLL witch has a Windows Hook to catch WH_GETMESSAGE (just for example). And this hook is instaled by SetWindowsHookEX. Is there a way to start a new process, that will get started with my hook installed?
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am

Postby madshi » Wed May 12, 2004 7:19 pm

Ehm, just call CreateProcess? I'm still not sure what you mean...
madshi
Site Admin
 
Posts: 9774
Joined: Sun Mar 21, 2004 5:25 pm

Postby nildo » Wed May 12, 2004 7:34 pm

Erm, lemme try to explain...

My program has a menu: "INJECT INTO PROCESS ->", that will inject my DLL into an openned process. BUt this DLL is a single HW_GETMESSAGE hook. So I inject it using SetWindowsHookEx. Right?

But I wish to have a manu like: "INJECT INTO NEW PROCESS..." and the user will choose the EXE that he would like to start, and this process will open with my hook alread installed, like if the first line of the program is to load my HOok. :confused:

Understand?
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am

Postby madshi » Wed May 12, 2004 8:12 pm

Well, you can start the process by using CreateProcess, then call WaitForInputIdle, then call SetWindowsHookEx. I guess that should work. But why don't you simply use madCodeHook? :o
madshi
Site Admin
 
Posts: 9774
Joined: Sun Mar 21, 2004 5:25 pm

Postby nildo » Wed May 12, 2004 8:30 pm

WaitForInputIdle -> If this process is a console application or does not have a message queue, WaitForInputIdle returns immediately. (by MSDN)

Is there a way to do for all kind of applications?

I can not use "in this case" MadCodeHook for injection, its a KeyBoardHook, and I have to keep compatibilities with some other codes. Thats because I need iimediatly, but I will port them to MadCodeHook as I will have a time
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am

Postby madshi » Thu May 13, 2004 6:45 am

SetWindowsHookEx works only on GUI processes, I believe. I'm not sure whether it works with console only processes. And it definately doesn't work with "all kind of applications".
madshi
Site Admin
 
Posts: 9774
Joined: Sun Mar 21, 2004 5:25 pm

Postby nildo » Thu May 13, 2004 11:13 am

Thank you!!! :D
nildo
 
Posts: 249
Joined: Mon Mar 22, 2004 11:32 am


Return to madCodeHook

Who is online

Users browsing this forum: No registered users and 6 guests