home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////////
- //
- // File : MsgTracerThread.h
- // Project : MsgTrace
- // Component : MsgTracer
- //---------------------------------------------------------------------------
- // Description : thread that does the monitoring
- //
- /////////////////////////////////////////////////////////////////////////////
- //
- // SourceSafe Strings. Do not change.
- //---------------------------------------------------------------------------
- // $Author: jeskes $
- // $Date: $
- // $Revision: $
- //
- /////////////////////////////////////////////////////////////////////////////
-
- #ifndef MSGTRACERTHREAD_H
- #define MSGTRACERTHREAD_H
-
- /////////////////////////////////////////////////////////////////////////////
-
- class CMsgTracerProcess;
-
- /////////////////////////////////////////////////////////////////////////////
-
- class CMsgTracerThread : public CObject
- {
- //---------------------------------------------------------------------------
- // construction
- //---------------------------------------------------------------------------
- public:
- CMsgTracerThread();
- virtual ~CMsgTracerThread();
-
- //---------------------------------------------------------------------------
- // thread proc
- //---------------------------------------------------------------------------
- protected:
- HANDLE m_hStopEvent;
- HANDLE m_hEndedEvent;
-
- CWinThread* m_pWinThread;
-
- static UINT ThreadStub( CMsgTracerThread* pThis );
- UINT ThreadProc();
-
- public:
- void Run();
- void Stop();
-
- BOOL IsRunning( DWORD dwTimeout = 0 );
-
- void Suspend();
- void Resume();
-
- //---------------------------------------------------------------------------
- // flags for debug event processing
- //---------------------------------------------------------------------------
- public:
- BOOL m_bWantOutputDebugStringEvents;
-
- //---------------------------------------------------------------------------
- // attach a running process
- //---------------------------------------------------------------------------
- protected:
- HANDLE m_hAttachEvent;
- HANDLE m_hAttachedEvent;
- HANDLE m_hAttachMutex;
-
- CMsgTracerProcess* m_pProcessToAttach;
-
- class SAttachStruct : public CObject
- {
- public:
- CMsgTracerThread* m_pThis;
- CMsgTracerProcess* m_pProcessToAttach;
- };
-
- static UINT AttachStub( SAttachStruct* pAttachStruct );
- UINT AttachProc( CMsgTracerProcess* pProcessToAttach );
-
- public:
- void AttachProcess( CMsgTracerProcess* pProcess, BOOL bWait = FALSE );
-
- //---------------------------------------------------------------------------
- // working
- //---------------------------------------------------------------------------
- protected:
- DEBUG_EVENT m_de;
- CCriticalSection m_csDispatch;
-
- void DispatchDebugEvent();
-
- void OnCreateProcessDebugEvent();
- void OnExitProcessDebugEvent();
- void OnOutputDebugStringEvent();
- DWORD OnExceptionDebugEvent();
- };
-
- /////////////////////////////////////////////////////////////////////////////
- #endif
-