C# Class DbMon.NET.DebugMonitor

This class captures all strings passed to OutputDebugString when the application is not debugged.
This class is a port of Microsofts Visual Studio's C++ example "dbmon", which can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample98/html/vcsmpdbmon.asp. public static void Main(string[] args) { DebugMonitor.Start(); DebugMonitor.OnOutputDebugString += new OnOutputDebugStringHandler(OnOutputDebugString); Console.WriteLine("Press 'Enter' to exit."); Console.ReadLine(); DebugMonitor.Stop(); } private static void OnOutputDebugString(int pid, string text) { Console.WriteLine(DateTime.Now + ": " + text); }
Show file Open project: 9chu/LuaSTGPlus

Public Methods

Method Description
Start ( ) : void

Starts this debug monitor

Stop ( ) : void

Stops this debug monitor. This call we block the executing thread until this debug monitor is stopped.

Private Methods

Method Description
Capture ( ) : void

Captures

CloseHandle ( IntPtr hHandle ) : bool
CreateApplicationException ( string text ) : ApplicationException

Helper to create a new application exception, which has automaticly the last win 32 error code appended.

CreateEvent ( SECURITY_ATTRIBUTES &sa, bool bManualReset, bool bInitialState, string lpName ) : IntPtr
CreateFileMapping ( IntPtr hFile, SECURITY_ATTRIBUTES &lpFileMappingAttributes, PageProtection flProtect, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, string lpName ) : IntPtr
DebugMonitor ( ) : System

Private constructor so no one can create a instance of this static class

Dispose ( ) : void

Dispose all resources

FireOnOutputDebugString ( int pid, string text ) : void
InitializeSecurityDescriptor ( SECURITY_DESCRIPTOR &sd, uint dwRevision ) : bool
MapViewOfFile ( IntPtr hFileMappingObject, uint dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow, uint dwNumberOfBytesToMap ) : IntPtr
PulseEvent ( IntPtr hEvent ) : bool
SetEvent ( IntPtr hEvent ) : bool
SetSecurityDescriptorDacl ( SECURITY_DESCRIPTOR &sd, bool daclPresent, IntPtr dacl, bool daclDefaulted ) : bool
UnmapViewOfFile ( IntPtr lpBaseAddress ) : bool
WaitForSingleObject ( IntPtr handle, uint milliseconds ) : Int32

Method Details

Start() public static method

Starts this debug monitor
public static Start ( ) : void
return void

Stop() public static method

Stops this debug monitor. This call we block the executing thread until this debug monitor is stopped.
public static Stop ( ) : void
return void