[Lazarus] disable the debugger capturing the OutputDebugString() messages

Bernd prof7bit at googlemail.com
Sun Jul 18 19:52:28 CEST 2010


2010/7/18 Sven Barth <pascaldragon at googlemail.com>:
> Hi again!
>
> I took the time to implement a OutputToDebugMonitor myself. It prints the
> message directly to e.g. DebugView even if a debugger like GDB is attached
> to the process.

Wow! That was fast! I didn't even consider implementing this myself
after looking at the code for a while.

  (* first try to open the mutex, if that fails call OutputDebugString, which
    will create that for us (we can't do that ourselves easily) *)
  mutex := OpenMutexW(SYNCHRONIZE or READ_CONTROL or MUTANT_QUERY_STATE, True,
             PWideChar(DBWinMutex));
  if mutex = 0 then begin
    OutputDebugStringA(PChar(aStr));
    Exit;
  end;

Does this really create the mutex or wouldn't the original
OutputDebugString() just raise the debug exception and invoke the
debugger and then return before it even comes to the point where the
mutex is needed?




More information about the Lazarus mailing list