internal UnloadDllNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
 }
 internal ExceptionNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
 }
 internal ExitProcessDebugEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
 }
 internal CreateThreadNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
     // OS will close the thread handle when the ExitThread event is processed.
 }
 internal LoadDllNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
     Process.AddModule(new NativeDbgModule(Process, ReadImageName(), BaseAddressWorker, union.LoadDll.hFile));
 }
 internal OutputDebugStringNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
     // On some platforms (Win2K), OutputDebugStrings are really exceptions that need to be cleared.
     ContinueStatus = NativeMethods.ContinueStatus.DBG_CONTINUE;
 }
        // Builder, returns the proper derived event object

        // We'd like this to be protected too
        internal NativeEvent(
            NativePipeline pipeline,
            ref DebugEventHeader header,
            ref DebugEventUnion union
            )
        {
            m_pipeline = pipeline;

            // Copy over
            m_header = header;
            m_union  = union;
        }
        // Builder, returns the proper derived event object

        // We'd like this to be protected too
        internal NativeEvent(
            NativePipeline pipeline,
            ref DebugEventHeader header,
            ref DebugEventUnion union
            )
        {
            m_pipeline = pipeline;

            // Copy over
            m_header = header;
            m_union = union;
        }
        internal CreateProcessDebugEvent(
            NativePipeline pipeline,
            ref DebugEventHeader header,
            ref DebugEventUnion union
            )
            : base(pipeline, ref header, ref union)
        {
            Process.InitHandle(union.CreateProcess.hProcess);

            // Module name of main program is unavailable.
            Process.AddModule(new NativeDbgModule(Process, "<main program>", union.CreateProcess.lpBaseOfImage,
                                                  union.CreateProcess.hFile));
        }
        internal static NativeEvent Build(
            NativePipeline pipeline,
            ref DebugEventHeader header,
            ref DebugEventUnion union
            )
        {
            NativeDbgProcess process = pipeline.GetOrCreateProcess((int)header.dwProcessId);

            switch (header.dwDebugEventCode)
            {
            case NativeDebugEventCode.CREATE_PROCESS_DEBUG_EVENT:
                return(new CreateProcessDebugEvent(pipeline, ref header, ref union));

            case NativeDebugEventCode.EXIT_PROCESS_DEBUG_EVENT:
                return(new ExitProcessDebugEvent(pipeline, ref header, ref union));

            case NativeDebugEventCode.EXCEPTION_DEBUG_EVENT:
                return(new ExceptionNativeEvent(pipeline, ref header, ref union));

            case NativeDebugEventCode.LOAD_DLL_DEBUG_EVENT:
                return(new LoadDllNativeEvent(pipeline, ref header, ref union));

            case NativeDebugEventCode.UNLOAD_DLL_DEBUG_EVENT:
                return(new UnloadDllNativeEvent(pipeline, ref header, ref union));

            case NativeDebugEventCode.OUTPUT_DEBUG_STRING_EVENT:
                return(new OutputDebugStringNativeEvent(pipeline, ref header, ref union));

            case NativeDebugEventCode.CREATE_THREAD_DEBUG_EVENT:
                return(new CreateThreadNativeEvent(pipeline, ref header, ref union));

            case NativeDebugEventCode.EXIT_THREAD_DEBUG_EVENT:
                return(new ExitThreadNativeEvent(pipeline, ref header, ref union));

            default:
                return(new NativeEvent(pipeline, ref header, ref union));
            }
        }
 internal CreateThreadNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
     // OS will close the thread handle when the ExitThread event is processed.
 }
 internal UnloadDllNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
 }
 internal LoadDllNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
     Process.AddModule(new NativeDbgModule(Process, ReadImageName(), BaseAddressWorker, union.LoadDll.hFile));
 }
 internal OutputDebugStringNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
     // On some platforms (Win2K), OutputDebugStrings are really exceptions that need to be cleared.
     ContinueStatus = NativeMethods.ContinueStatus.DBG_CONTINUE;
 }
 internal ExitProcessDebugEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
 }
        internal CreateProcessDebugEvent(
            NativePipeline pipeline,
            ref DebugEventHeader header,
            ref DebugEventUnion union
            )
            : base(pipeline, ref header, ref union)
        {
            Process.InitHandle(union.CreateProcess.hProcess);

            // Module name of main program is unavailable.
            Process.AddModule(new NativeDbgModule(Process, "<main program>", union.CreateProcess.lpBaseOfImage,
                                                  union.CreateProcess.hFile));
        }
 internal ExceptionNativeEvent(
     NativePipeline pipeline,
     ref DebugEventHeader header,
     ref DebugEventUnion union
     )
     : base(pipeline, ref header, ref union)
 {
 }
        internal static NativeEvent Build(
            NativePipeline pipeline,
            ref DebugEventHeader header,
            ref DebugEventUnion union
            )
        {
            NativeDbgProcess process = pipeline.GetOrCreateProcess((int) header.dwProcessId);
            switch (header.dwDebugEventCode)
            {
                case NativeDebugEventCode.CREATE_PROCESS_DEBUG_EVENT:
                    return new CreateProcessDebugEvent(pipeline, ref header, ref union);

                case NativeDebugEventCode.EXIT_PROCESS_DEBUG_EVENT:
                    return new ExitProcessDebugEvent(pipeline, ref header, ref union);

                case NativeDebugEventCode.EXCEPTION_DEBUG_EVENT:
                    return new ExceptionNativeEvent(pipeline, ref header, ref union);

                case NativeDebugEventCode.LOAD_DLL_DEBUG_EVENT:
                    return new LoadDllNativeEvent(pipeline, ref header, ref union);

                case NativeDebugEventCode.UNLOAD_DLL_DEBUG_EVENT:
                    return new UnloadDllNativeEvent(pipeline, ref header, ref union);

                case NativeDebugEventCode.OUTPUT_DEBUG_STRING_EVENT:
                    return new OutputDebugStringNativeEvent(pipeline, ref header, ref union);

                case NativeDebugEventCode.CREATE_THREAD_DEBUG_EVENT:
                    return new CreateThreadNativeEvent(pipeline, ref header, ref union);

                case NativeDebugEventCode.EXIT_THREAD_DEBUG_EVENT:
                    return new ExitThreadNativeEvent(pipeline, ref header, ref union);

                default:
                    return new NativeEvent(pipeline, ref header, ref union);
            }
        }