Hi,
This is my first attempt to use madCodeHook and have this questions:
1. I have an application write in Delphi that is a Windows Service. From this app I want to inject a DLL to other running service, but only this. Is it posible with madCodeHook? How?
2. Is posible to create multiple IPC queues with CreateIPCQueue?
3. When I use the CreateIPCQueue/SendIPCMessage, the computer cracks! I think when SendIPCMessage is called from my hooked DLL the system restarts! What I'm doing wrong?
4. What is the best method to exchange a large number of messages from de Hooked DLL to my application (is a service)? IPC functions of madCodeHook? Sockets? Named Pipes?.
Thanks in advance for your help and congratulations to madshi, who is doing a very good job with these packages!!
Hook to Windows Service
1. Simply call InjectLibrary(otherServiceProcessHandle, 'your.dll').
2. Sure.
3. madCodeHook's IPC functions are currently not too fast. They're not meant to be stressed by thousands of messages per second. Maybe that's the reason why you're having problems? If not, what APIs are you hooking?
4. Anything that performs as good as possible. You should be aware that communication over process boundaries costs some time. So be careful that you don't slow down things too much by doing too much conversation.
2. Sure.
3. madCodeHook's IPC functions are currently not too fast. They're not meant to be stressed by thousands of messages per second. Maybe that's the reason why you're having problems? If not, what APIs are you hooking?
4. Anything that performs as good as possible. You should be aware that communication over process boundaries costs some time. So be careful that you don't slow down things too much by doing too much conversation.
Ok, but I have problems to inject my dll to the other service.
Please see my code:
PH:=OpenProcess(PROCESS_ALL_ACCESS, False, PID);
If PH>0 then
Begin
If Inject then
Begin
Result:=InjectLibrary(PH,FDLL);
End
Else
Begin
Result:=UninjectLibrary(PH,FDLL);
End;
CloseHandle(PH);
End;
PID is the PID of the other service process, and FDLL is a string with the name to the DLL I wish to Hook to PID.
When I run this code, the other service process dies.
Any idea?
Thanks
Please see my code:
PH:=OpenProcess(PROCESS_ALL_ACCESS, False, PID);
If PH>0 then
Begin
If Inject then
Begin
Result:=InjectLibrary(PH,FDLL);
End
Else
Begin
Result:=UninjectLibrary(PH,FDLL);
End;
CloseHandle(PH);
End;
PID is the PID of the other service process, and FDLL is a string with the name to the DLL I wish to Hook to PID.
When I run this code, the other service process dies.
Any idea?
Thanks
Sorry, it's my fault. I hook a DLL that uses SendIPCMessage to communicate with my application.
When I use this function within a library injected to all system proceses (SYSTEM_PROCESS & ...) my computer crash. When I use this function within a library injected to a single process, the process dies.
I remove the SendIPCMessage function and now the process not dies and the library still gets injected.
When I use this function within a library injected to all system proceses (SYSTEM_PROCESS & ...) my computer crash. When I use this function within a library injected to a single process, the process dies.
I remove the SendIPCMessage function and now the process not dies and the library still gets injected.