コード例 #1
0
        public override bool Process()
        {
            if (processTraceCalled)
            {
                Reset();
            }
            processTraceCalled = true;
            stopProcessing     = false;
            int dwErr = TraceEventNativeMethods.ProcessTrace(handles, (uint)handles.Length, (IntPtr)0, (IntPtr)0);

            Marshal.ThrowExceptionForHR(TraceEventNativeMethods.GetHRFromWin32(dwErr));
            return(!stopProcessing);
        }
コード例 #2
0
        // Process is called after all desired subscriptions have been registered.
        /// <summary>
        /// Processes all the events in the data soruce, issuing callbacks that were subscribed to.  See
        /// code:#Introduction for more
        /// </summary>
        /// <returns>false If StopProcesing was called</returns>
        // [SecuritySafeCritical]
        public override bool Process()
        {
            if (processTraceCalled)
            {
                Reset();
            }
            processTraceCalled = true;
            stopProcessing     = false;
            int dwErr = TraceEventNativeMethods.ProcessTrace(handles, (uint)handles.Length, (IntPtr)0, (IntPtr)0);

            if (dwErr == 6)
            {
                throw new ApplicationException("Error opening ETL file.  Most likely caused by opening a Win8 Trace on a Pre Win8 OS.");
            }

            // ETW returns 1223 when you stop processing explicitly
            if (!(dwErr == 1223 && stopProcessing))
            {
                Marshal.ThrowExceptionForHR(TraceEventNativeMethods.GetHRFromWin32(dwErr));
            }

            return(!stopProcessing);
        }