internal static unsafe uint EventRegister(
[In] ref Guid providerId,
[In]EtwEnableCallback enableCallback,
[In]void* callbackContext,
[In][Out]ref long registrationHandle
)
{
Interop.Kernel32.EtwEnableCallback indirection = delegate(ref Guid sourceId,
int isEnabled,
byte level,
ulong matchAnyKeywords,
ulong matchAllKeywords,
Interop.Kernel32.EVENT_FILTER_DESCRIPTOR* filterData,
IntPtr cbContext)
{
enableCallback(ref sourceId,
isEnabled,
level,
(long)matchAnyKeywords,
(long)matchAllKeywords,
(EVENT_FILTER_DESCRIPTOR*)filterData,
(void*)cbContext);
};
ulong temp;
uint status = Interop.Kernel32.EventRegister(ref providerId, indirection, (IntPtr)callbackContext, out temp);
registrationHandle = (long)temp;
return status;
}