RegisterEventSource

  HANDLE RegisterEventSource(lpszUNCServer, lpszModule)    
  LPTSTR lpszUNCServer; /* server name for module */
  LPTSTR lpszModule; /* module name for registered handle */

The RegisterEventSource function returns a handle that can be used with the ReportEvent function to log an event.

Any module name can be used, and will be carried in the event log record so that it can be used by the EventViewer for filtering. This function cannot be used to register to create events for modules “\EventLog\System” or “\EventLog\Security”.

Parameters

lpszUNCServer

Points to a null-terminated string that specifies the name of the server where this operation is to be performed. If this parameter is NULL, the operation is performed on the local machine.

lpszModule

Points to a null-terminated string that specifies the name of the module reference by the returned handle. The node must exist in the registration database, and the module name has the following format:

\EventLog\Application\SQL

Return Value

If the function is successful, the return value is a handle that can be used with the ReportEvent function. Otherwise, the return value is NULl.

See Also

DeregisterEventSource, ReportEvent