BOOL ReportEvent(hEventSource, fwEventType, fwCategory, IDEvent, pUserSid, cStrings, cbData, plpszStrings, lpvData) | |||||
HANDLE hEventSource; | /* handle returned by RegisterEventSource | */ | |||
WORD fwEventType; | /* event type to log | */ | |||
WORD fwCategory; | /* event category | */ | |||
DWORD IDEvent; | /* event ID | */ | |||
PSID pUserSid; | /* user SID (optional) | */ | |||
WORD cStrings; | /* number of strings to merge with message | */ | |||
DWORD cbData; | /* size of raw data (in bytes) | */ | |||
LPSTR *plpszStrings; | /* array of strings to merge with message | */ | |||
LPVOID lpvData; | /* address of raw data | */ |
The ReportEvent function writes an entry at the end of the event log.
hEventSource
Specifies the event-log handle. This handle is returned by the RegisterEventSource function.
fwEventType
Specifies the type of event being logged. This parameter can have one of the following values:
Value | Meaning |
EVENTLOG_ERROR_TYPE | ||
Error event | ||
EVENTLOG_WARNING_TYPE | ||
Warning event | ||
EVENTLOG_INFORMATION_TYPE | ||
Information event |
fwCategory
Specifies the event category.
IDEvent
The specific event identifier. This identifies the message that goes with this event.
pUserSid
Points to the current user's SID. This parameter can be NULL if the SID is not required.
cStrings
Specifies the number of strings that are in the array at plpszStrings. A value of zero indicates no strings are present.
cbData
Specifies the number of bytes of event-specific raw (binary) data to write to the log. If cbData is zero, no event-specific data is present.
plpszStrings
Points to a buffer containing an array of null-terminated strings that are merged into the message before displaying to the user. This parameter must be a valid pointer (or NULL), even if cStrings is zero.
lpvData
Buffer containing the raw data. This parameter must be a valid pointer (or NULL), even if cbData is zero.
If the function is successful, the return value is TRUE. The entry was written to the log.
If the function fails, the return value is FALSE. Use the GetLastError function to obtain extended error information.
This function is used to log an event. The entry is written to the end of the configured log file for the module represented by hEventSource. The ReportEvent function adds the time, the user name, the length, and the offsets before storing the entry in the log. The caller is responsible for passing in the message string that describes the event specified in IDEvent.
ClearEventLog, CloseEventLog, OpenEventLog, ReadEventLog