madshi wrote:Thanks nildo for helping out...
Problem with dll hooking
Under the hooking rules for system wide hooking I thought one isn't supposed to use 'GUI' stuff like FindWindow, MessageBox, etc.
Does that not apply here? Isn't this GUI stuff in the dll which is then injected and run as a system service.
It seems to be stable enough in Delphi. However, when I convert this code to Builder it hooks the opendialog boxes and changes the title/view ok, but then gives an access violation.
Am I missing something?
Does that not apply here? Isn't this GUI stuff in the dll which is then injected and run as a system service.
It seems to be stable enough in Delphi. However, when I convert this code to Builder it hooks the opendialog boxes and changes the title/view ok, but then gives an access violation.
Am I missing something?
You must not use FindWindow inside of some system processes, otherwise the OS will reboot.
If you want to hook dialog boxes, it makes sense to not inject your dll into system processes, cause system processes usually don't show dialog boxes (at least not file open/save dialogs). You should inject into system processes only if you really need it.
uall is right, though, if user32.dll is loaded in a process, you can most probably also use it. Just make sure that you weren't the one who loaded it...
If you want to hook dialog boxes, it makes sense to not inject your dll into system processes, cause system processes usually don't show dialog boxes (at least not file open/save dialogs). You should inject into system processes only if you really need it.
uall is right, though, if user32.dll is loaded in a process, you can most probably also use it. Just make sure that you weren't the one who loaded it...
Thanks uall and madshi. It is just that the examples in this thread used:
if not InjectLibrary((ALL_SESSIONS or SYSTEM_PROCESSES), 'DllHook.dll') then
ShowMessage('Fehler beim Inject von DllHook.dll');
and used findwindow and messagebox.
Just wanted clarification on this usage and the rules for hooking. Should the injectlibrary parameter just be for SYSTEM_PROCESSES?
if not InjectLibrary((ALL_SESSIONS or SYSTEM_PROCESSES), 'DllHook.dll') then
ShowMessage('Fehler beim Inject von DllHook.dll');
and used findwindow and messagebox.
Just wanted clarification on this usage and the rules for hooking. Should the injectlibrary parameter just be for SYSTEM_PROCESSES?