网站首页  词典首页

请输入您要查询的函数:

 

术语 reportevent
释义 ReportEvent
语法:
C++
BOOL ReportEvent(
__in HANDLE hEventLog,
__in WORD wType,
__in WORD wCategory,
__in DWORD dwEventID,
__in PSID lpUserSid,
__in WORD wNumStrings,
__in DWORD dwDataSize,
__in LPCTSTR *lpStrings,
__in LPVOID lpRawData
);
ReportEvent功能
写一个在指定的事件日志的末尾项。
参数
hEventLog [in]
句柄到事件日志。该RegisterEventSource函数返回此句柄。
作为Windows XP SP2中,这个参数不能成为处理安全日志。为了将事件写入安全日志,使用AuthzReportSecurityEvent功能。
wType [in]
事件的类型被记录。此参数可以是下列值之一。
ValueMeaning
EVENTLOG_SUCCESS
0x0000Information事件
EVENTLOG_AUDIT_FAILURE
0x0010Failure审核事件
EVENTLOG_AUDIT_SUCCESS
0x0008Success审核事件
EVENTLOG_ERROR_TYPE
0x0001Error事件
EVENTLOG_INFORMATION_TYPE
0x0004Information事件
EVENTLOG_WARNING_TYPE
0x0002Warning事件
如需有关事件类型的详细信息,请参见事件类型。
wCategory [in]
该事件类别。这是源的具体资料;的类别可以有任何价值。有关更多信息,请参阅事件类别。
dwEventID [in]
该事件标识符。该事件标识符指定邮件中的文件项与相关的事件源。有关更多信息,请参阅事件标识符。
lpUserSid [in]
对当前用户的安全标识符的指针。此参数可以是NULL如果安全标识符不是必需的。
wNumStrings [in]
插入字符串的数组中的数字指向的lpStrings参数。值为零表示没有字符串都存在。
dwDataSize [in]
在事件的字节数,具体的原料(二进制)数据写入到日志中。如果此参数为0,任何情况下,特定的数据是否存在。
lpStrings [in]
一个缓冲区包含一个空数组的指针,终止是到消息字符串合并前事件查看器显示的字符串给用户。此参数必须是一个有效的指针(或NULL),即使wNumStrings是零。每个字符串有32K的字符的限制。
lpRawData [in]
一个缓冲区包含二进制数据的指针。此参数必须是一个有效的指针(或NULL),即使dwDataSize参数为零。
返回值
如果函数成功,返回值为非零值,这表明项目被写入日志。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
这个功能是用来记录一个事件。该条目被写入了由hEventLog参数确定的源配置日志的末尾。该ReportEvent函数将时间,入境的长度和偏移量存储在之前的日志条目。为了使函数来添加用户名,您必须提供在lpUserSid参数用户的SID。
请注意,您登录字符串不能包含%n,其中n是一个(例如整数值,%1),因为在事件查看器当作一个插入字符串。由于IPv6地址可以包含这个字符序列,不能记录一个事件消息,其中包含一个IPv6地址。
实例
有关示例,请参阅Reporting一个事件。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesReportEventW(Unicode)和ReportEventA(ANSI)的
参见
事件记录功能
ClearEventLog
CloseEventLog
OpenEventLog
ReadEventLog
RegisterEventSource
事件日志文件格式
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月6日
==英文原文==ReportEvent Function
Writes an entry at the end of the specified event log.
Syntax
C++
BOOL ReportEvent(
__in HANDLE hEventLog,
__in WORD wType,
__in WORD wCategory,
__in DWORD dwEventID,
__in PSID lpUserSid,
__in WORD wNumStrings,
__in DWORD dwDataSize,
__in LPCTSTR *lpStrings,
__in LPVOID lpRawData
);
Parameters
hEventLog [in]
A handle to the event log. The RegisterEventSource function returns this handle.
As of Windows XP with SP2, this parameter cannot be a handle to the Security log. To write an event to the Security log, use the AuthzReportSecurityEvent function.
wType [in]
The type of event to be logged. This parameter can be one of the following values.
ValueMeaning
EVENTLOG_SUCCESS
0x0000Information event
EVENTLOG_AUDIT_FAILURE
0x0010Failure Audit event
EVENTLOG_AUDIT_SUCCESS
0x0008Success Audit event
EVENTLOG_ERROR_TYPE
0x0001Error event
EVENTLOG_INFORMATION_TYPE
0x0004Information event
EVENTLOG_WARNING_TYPE
0x0002Warning event

For more information about event types, see Event Types .
wCategory [in]
The event category. This is source-specific information; the category can have any value. For more information, see Event Categories .
dwEventID [in]
The event identifier. The event identifier specifies the entry in the message file associated with the event source. For more information, see Event Identifiers .
lpUserSid [in]
A pointer to the current user's security identifier. This parameter can be NULL if the security identifier is not required.
wNumStrings [in]
The number of insert strings in the array pointed to by the lpStrings parameter. A value of zero indicates that no strings are present.
dwDataSize [in]
The number of bytes of event-specific raw (binary) data to write to the log. If this parameter is zero, no event-specific data is present.
lpStrings [in]
A pointer to a buffer containing an array of null-terminated strings that are merged into the message before Event Viewer displays the string to the user. This parameter must be a valid pointer (or NULL), even if wNumStrings is zero. Each string has a limit of 32K characters.
lpRawData [in]
A pointer to the buffer containing the binary data. This parameter must be a valid pointer (or NULL), even if the dwDataSize parameter is zero.
Return Value
If the function succeeds, the return value is nonzero, indicating that the entry was written to the log.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
This function is used to log an event. The entry is written to the end of the configured log for the source identified by the hEventLog parameter. The ReportEvent function adds the time, the entry's length, and the offsets before storing the entry in the log. To enable the function to add the username, you must supply the user's SID in the lpUserSid parameter.
Note that the string that you log cannot contain %n, where n is an integer value (for example, %1) because the event viewer treats it as an insertion string. Because an IPv6 address can contain this character sequence, you cannot log an event message that contains an IPv6 address.
Examples
For an example, see Reporting an Event .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesReportEventW (Unicode) and ReportEventA (ANSI)
See Also
Event Logging Functions
ClearEventLog
CloseEventLog
OpenEventLog
ReadEventLog
RegisterEventSource
Event Log File Format
Send comments about this topic to Microsoft
Build date: 8/6/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa363679(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:17:33