private unsafe uint ClassicShimRegister(Guid providerId, ManifestEtw.EtwEnableCallback enableCallback) { ClassicEtw.TRACE_GUID_REGISTRATION trace_guid_registration; if (this.m_regHandle != 0L) { throw new Exception(); } this.m_classicEventHeader = (ClassicEtw.EVENT_HEADER *)Marshal.AllocHGlobal(sizeof(ClassicEtw.EVENT_HEADER)); ZeroMemory((IntPtr)this.m_classicEventHeader, sizeof(ClassicEtw.EVENT_HEADER)); trace_guid_registration.RegHandle = null; trace_guid_registration.Guid = &providerId; this.m_classicControlCallback = new ClassicEtw.ControlCallback(this.ClassicControlCallback); return(ClassicEtw.RegisterTraceGuidsW(this.m_classicControlCallback, null, ref providerId, 1, &trace_guid_registration, null, null, out this.m_regHandle)); }
// // Registers the providerGuid with an inbuilt callback // internal override unsafe void Register(Guid providerGuid) { ulong registrationHandle; ClassicEtw.TRACE_GUID_REGISTRATION guidReg; Guid dummyGuid = new Guid(0xb4955bf0, 0x3af1, 0x4740, 0xb4, 0x75, 0x99, 0x05, 0x5d, 0x3f, 0xe9, 0xaa); _etwProc = new ClassicEtw.ControlCallback(EtwEnableCallback); // This dummyGuid is there for ETW backward compat issues and is the same for all downlevel trace providers guidReg.Guid = &dummyGuid; guidReg.RegHandle = null; ClassicEtw.RegisterTraceGuidsW(_etwProc, IntPtr.Zero, ref providerGuid, 1, ref guidReg, null, null, out registrationHandle); _registrationHandle.Value = registrationHandle; }