The RegisterEventSource function returns a registered handle to an event log.
HANDLE RegisterEventSource(
LPCTSTR lpUNCServerName, // server name for source
LPCTSTR lpSourceName // source name for registered handle
);
HKEY_LOCAL_MACHINE
System
CurrentControlSet
Services
EventLog
Application
WinApp
Security
System
If the function succeeds, the return value is a handle that can be used with the ReportEvent function.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
If the source name cannot be found, the event logging service uses the Application logfile; it does not create a new source. Events are reported for the source, however, there are no message and category message files specified for looking up descriptions of the event identifiers for the source.
To close the handle to the event log, call the DeregisterEventSource function.
Windows NT: Requires version 3.1 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use advapi32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Event Logging Overview, Event Logging Functions, DeregisterEventSource, ReportEvent