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)
| 33 | /// </code> |
| 34 | /// </remarks> |
| 35 | public sealed class DebugMonitor { |
| 36 | |
| 37 | /// <summary> |
| 38 | /// Private constructor so no one can create a instance |
| 39 | /// of this static class |
| 40 | /// </summary> |
| 41 | private DebugMonitor() { |
| 42 | ; |
| 43 | } |
| 44 | |
| 45 | #region Win32 API Imports |
| 46 | |
| 47 | [StructLayout(LayoutKind.Sequential)] |
| 48 | private struct SECURITY_DESCRIPTOR { |
| 49 | public byte revision; |
| 50 | public byte size; |
| 51 | public short control; |
| 52 | public IntPtr owner; |
| 53 | public IntPtr group; |
| 54 | public IntPtr sacl; |
| 55 | public IntPtr dacl; |
| 56 | } |
| 57 | |
| 58 | [StructLayout(LayoutKind.Sequential)] |
| 59 | private struct SECURITY_ATTRIBUTES { |
| 60 | public int nLength; |
| 61 | public IntPtr lpSecurityDescriptor; |
| 62 | public int bInheritHandle; |
| 63 | } |
| 64 | |
| 65 | [Flags] |
| 66 | private enum PageProtection : uint { |
| 67 | NoAccess = 0x01, |
| 68 | Readonly = 0x02, |
| 69 | ReadWrite = 0x04, |
| 70 | WriteCopy = 0x08, |
| 71 | Execute = 0x10, |
| 72 | ExecuteRead = 0x20, |
| 73 | ExecuteReadWrite = 0x40, |
| 74 | ExecuteWriteCopy = 0x80, |
| 75 | Guard = 0x100, |
| 76 | NoCache = 0x200, |
| 77 | WriteCombine = 0x400, |
| 78 | } |
| 79 | |
| 80 | |
| 81 | private const int WAIT_OBJECT_0 = 0; |
| 82 | private const uint INFINITE = 0xFFFFFFFF; |
| 83 | private const int ERROR_ALREADY_EXISTS = 183; |
| 84 | |
| 85 | private const uint SECURITY_DESCRIPTOR_REVISION = 1; |
| 86 | |
| 87 | private const uint SECTION_MAP_READ = 0x0004; |
| 88 | |
| 89 | [DllImport("kernel32.dll", SetLastError = true)] |
| 90 | private static extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, uint |
| 91 | dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow, |
| 92 | uint dwNumberOfBytesToMap); |
nothing calls this directly
no outgoing calls
no test coverage detected