Platform SDK: Debugging and Error Handling |
The RegisterEventSource function retrieves a registered handle to an event log.
HANDLE RegisterEventSource( LPCTSTR lpUNCServerName, // server name LPCTSTR lpSourceName // source name );
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Event
Log\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, use the DeregisterEventSource function.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Unsupported.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Advapi32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
Event Logging Overview, Event Logging Functions, DeregisterEventSource, ReportEvent