Einzelnen Beitrag anzeigen

PeterPanino

Registriert seit: 4. Sep 2004
1.465 Beiträge
 
Delphi 10.4 Sydney
 
#3

AW: SetWindowsHookEx und WH_SHELL

  Alt 14. Okt 2023, 10:22
Not an answer but i don't have CodeSite installed, so i changed these calls to OutputDebugString.

My observation on Delphi XE8
1) It is working in the Debugger and no IDE crash.
2) There is a problem when it is running with the debugger, BUT the output is stopping after the first hook report, then nothing being captured in IDE EventLog.

with DebugView and the application running without a debugger the output is correct and there is no failure, so my deduction is the debugger is faulty or CodeSite is not prepared for MultiThreading inside the debugger with external Threads.

Also i remember a thing from the past, these hooks use OS threads, meaning they are external for the debugger and these are privileged threads, also TThread is faulty when it comes to ExternalThread in its implementation, as ThreadID will not give you the real thread ID if it is called from the thread itself, it will return DWORD(-2) always, so if the debugger is depending on TThread to external threads like the hook one in this case, then there is a big chance it is messing with its own threads causing the catastrophic failure.

Same about threadID can go with codesite.

Just guessing and hope it help.
This may be a misunderstanding: I do not launch the host app from the IDE. I compile the host app and launch it from the file explorer. The IDE (and other Win32 programs) are apparently terminated because the injected DLL is not properly unhooked when the host app is terminated.
Geändert von PeterPanino, damit der Platz auf dem Bildschirm nicht so leer aussieht.
  Mit Zitat antworten Zitat