public static DiagnosticsNativeMethods.CriticalTraceRegistrationHandle RegisterTrace(Guid provider, DiagnosticsNativeMethods.ControlCallback callback)
            {
                DiagnosticsNativeMethods.CriticalTraceRegistrationHandle criticalTraceRegistrationHandle = new DiagnosticsNativeMethods.CriticalTraceRegistrationHandle();
                long handle;
                int  num = DiagnosticsNativeMethods.CriticalTraceRegistrationHandle.RegisterTraceGuids(callback, IntPtr.Zero, ref provider, 0, IntPtr.Zero, null, null, out handle);

                if (num != 0)
                {
                    throw new Win32Exception(num);
                }
                criticalTraceRegistrationHandle.Initialize(callback, handle);
                return(criticalTraceRegistrationHandle);
            }
Beispiel #2
0
        private unsafe static void RegisterGuid(ref ETWTrace.EtwTraceGuids traceGuids, out DiagnosticsNativeMethods.CriticalTraceRegistrationHandle regHandle, DiagnosticsNativeMethods.ControlCallback callback, out IntPtr eventHandle)
        {
            Guid events = traceGuids.Events;

            DiagnosticsNativeMethods.TraceGuidRegistration traceGuidRegistration;
            traceGuidRegistration.guid   = &events;
            traceGuidRegistration.handle = IntPtr.Zero;
            regHandle   = DiagnosticsNativeMethods.CriticalTraceRegistrationHandle.RegisterTrace(traceGuids.Provider, ref traceGuidRegistration, callback);
            eventHandle = traceGuidRegistration.handle;
        }