EventUnregister function (evntprov.h)

Unregisters an ETW event provider.

All event providers registered by a component must be unregistered before the component unloads. If a DLL registers an event provider and then unloads without unregistering the event provider, the process may crash.


ULONG EVNTAPI EventUnregister(
  [in] REGHANDLE RegHandle


[in] RegHandle

Event provider registration handle returned by EventRegister.

Return value

Returns ERROR_SUCCESS if successful.


If EventRegister fails, it returns a zero-valued RegHandle. ETW APIs such as EventWrite and EventUnregister will safely accept a zero-valued RegHandle value, do nothing, and return immediately. Callers do not need to check for a zero-valued RegHandle before calling EventWrite or EventUnregister.


Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header evntprov.h
Library Advapi32.lib
DLL Advapi32.dll

See also