网站首页  词典首页

请输入您要查询的函数:

 

术语 tracemessage
释义 TraceMessage
语法:
C++
ULONG TraceMessage(
__in TRACEHANDLE SessionHandle,
__in ULONG MessageFlags,
__in LPGUID MessageGuid,
__in USHORT MessageNumber,
...
);
TraceMessage功能
该TraceMessage函数发送一条信息性消息的事件跟踪会话。
参数
SessionHandle [in]
句柄事件跟踪会话记录事件。提供者获得的处理要求时,在其ControlCallback执行GetTraceLoggerHandle功能。
MessageFlags [in]
增加了额外的资料提供者开始具体数据事件的部分。该提供的具体数据事件的部分将只包含那些被设置标志的数据。参数数据的变量列表将遵循此信息。此参数可以是一个或多个下列值。
FlagMeaning
TRACE_MESSAGE_COMPONENTIDInclude邮件中的组件标识符。该MessageGuid参数包含组件标识符。
TRACE_MESSAGE_GUIDInclude的事件跟踪消息中的GUID类。该MessageGuid参数包含事件跟踪类GUID。
TRACE_MESSAGE_SEQUENCEInclude在消息序列号。序列号始于1。要使用此标志,控制器必须设置EVENT_TRACE_USE_GLOBAL_SEQUENCE或EVENT_TRACE_USE_LOCAL_SEQUENCE日志文件模式在创建会话。
TRACE_MESSAGE_SYSTEMINFOInclude线程标识符和进程标识符在邮件中。
TRACE_MESSAGE_TIMESTAMPInclude在消息时间戳。
TRACE_MESSAGE_COMPONENTID和TRACE_MESSAGE_GUID是并行不悖的。
这些资料包括在下列顺序事件数据:
序列号
事件跟踪类GUID(或组件标识符)
时间戳
线程标识符
进程标识符
MessageGuid [in]
类GUID或组件ID标识的消息。如果MessageFlags取决于包含TRACE_MESSAGE_COMPONENTID或TRACE_MESSAGE_GUID标志。
MessageNumber [in]
数字,它唯一标识每个消息的发生。您必须定义此参数指定的值,该值应该是有意义的应用程序。
一些可变参数列表附加到邮件中。使用此列表来指定您的供应商,特定事件的数据。该名单必须由双参数,如下表所述。
数据TypeMeaning
PVOIDPointer的参数数据。
size_tThe大小的参数的数据,以字节为单位。
终止使用参数列表对组成的指针为NULL和为零。
调用者必须确保对参数的大小的总和+不超过72个的事件跟踪会话大小的缓冲区。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是系统错误代码之一。下表列出了一些常见的错误及其原因。
返回codeDescription
ERROR_INVALID_HANDLEEither的SessionHandle为NULL或指定NT内核记录器会处理。
ERROR_NOT_ENOUGH_MEMORYThe会议跑出可用缓冲区进行写入。这期间发生的事件发生率高,因为磁盘子系统超载或缓冲区的数目太少。而不是阻塞直到更多的缓冲区变得可用,丢弃事件TraceMessage。
Windows 2000和Windows XP中:不支持。
ERROR_OUTOFMEMORYThe事件被丢弃,因为,虽然缓冲池并没有达到其最大大小,没有足够的可用内存分配一个额外的缓冲,也没有提供接收缓冲区的事件。
ERROR_INVALID_PARAMETERMessageFlags包含一个值无效。
从一个单一的事件ERROR_MORE_DATAData不能跨越多个缓冲区。阿跟踪事件仅限于事件的规模跟踪会话的减去EVENT_TRACE_HEADER结构大小的缓冲区。
备注
供应商调用这个函数。
使用TraceEvent功能是首选方法记录一个事件。在Windows Vista,您应该使用EventWrite函数记录事件。
跟踪中的顺序写的事件发生。
如果您需要访问的信息跟踪,从包装函数的功能,调用此函数TraceMessageVa版本。
消费者将不得不使用EventCallback回调接收和处理的事件,如果MessageFlags参数不包含TRACE_MESSAGE_GUID标志。如果您不指定TRACE_MESSAGE_GUID标志,消费者将无法使用EventClassCallback因为EVENT_TRACE结构Header.Guid成员将不包含事件跟踪类GUID。
请注意,EVENT_TRACE和EVENT_TRACE_HEADER结构的成员,对应于MessageFlags标志只设置相应的标志,如果指定。例如,EVENT_TRACE_HEADER的主题ID和填充的processID成员只有当您指定TRACE_MESSAGE_SYSTEMINFO标志。
要求:
最低支持client-Windows XP
最低支持serverWindows服务器2003
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
参见
TraceEvent
TraceEventInstance
TraceMessageVa
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==TraceMessage Function
The TraceMessage function sends an informational message to an event tracing session.
Syntax
C++
ULONG TraceMessage(
__in TRACEHANDLE SessionHandle,
__in ULONG MessageFlags,
__in LPGUID MessageGuid,
__in USHORT MessageNumber,
...
);
Parameters
SessionHandle [in]
Handle to the event tracing session that records the event. The provider obtains the handle when it calls the GetTraceLoggerHandle function in its ControlCallback implementation.
MessageFlags [in]
Adds additional information to the beginning of the provider-specific data section of the event. The provider-specific data section of the event will contain data only for those flags that are set. The variable list of argument data will follow this information. This parameter can be one or more of the following values.
FlagMeaning
TRACE_MESSAGE_COMPONENTIDInclude the component identifier in the message. The MessageGuid parameter contains the component identifier.
TRACE_MESSAGE_GUIDInclude the event trace class GUID in the message. The MessageGuid parameter contains the event trace class GUID.
TRACE_MESSAGE_SEQUENCEInclude a sequence number in the message. The sequence number starts at one. To use this flag, the controller must have set the EVENT_TRACE_USE_GLOBAL_SEQUENCE or EVENT_TRACE_USE_LOCAL_SEQUENCE log file mode when creating the session.
TRACE_MESSAGE_SYSTEMINFOInclude the thread identifier and process identifier in the message.
TRACE_MESSAGE_TIMESTAMPInclude a time stamp in the message.

TRACE_MESSAGE_COMPONENTID and TRACE_MESSAGE_GUID are mutually exclusive.
The information is included in the event data in the following order:
Sequence number
Event trace class GUID (or component identifier)
Time stamp
Thread identifier
Process identifier
MessageGuid [in]
Class GUID or component ID that identifies the message. Depends if MessageFlags contains the TRACE_MESSAGE_COMPONENTID or TRACE_MESSAGE_GUID flag.
MessageNumber [in]
Number that uniquely identifies each occurrence of the message. You must define the value specified for this parameter; the value should be meaningful to the application.
A list of variable arguments to be appended to the message. Use this list to specify your provider-specific event data. The list must be composed of pairs of arguments, as described in the following table.
Data TypeMeaning
PVOIDPointer to the argument data.
size_tThe size of the argument data, in bytes.

Terminate the list using an argument pair consisting of a pointer to NULL and zero.
The caller must ensure that the sum of the sizes of the arguments + 72 does not exceed the size of the event tracing session's buffer.
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is one of the system error codes . The following table includes some common errors and their causes.
Return codeDescription
ERROR_INVALID_HANDLEEither the SessionHandle is NULL or specifies the NT Kernel Logger session handle.
ERROR_NOT_ENOUGH_MEMORYThe session ran out of free buffers to write to. This can occur during high event rates because the disk subsystem is overloaded or the number of buffers is too small. Rather than blocking until more buffers become available, TraceMessage discards the event.
Windows 2000 and Windows XP: Not supported.
ERROR_OUTOFMEMORYThe event is discarded because, although the buffer pool has not reached its maximum size, there is insufficient available memory to allocate an additional buffer and there is no buffer available to receive the event.
ERROR_INVALID_PARAMETERMessageFlags contains a value that is not valid.
ERROR_MORE_DATAData from a single event cannot span multiple buffers. A trace event is limited to the size of the event tracing session's buffer minus the size of the EVENT_TRACE_HEADER structure.

Remarks
Providers call this function.
Using the TraceEvent function is the preferred way to log an event. On Windows Vista, you should use the EventWrite function to log events.
The trace events are written in the order in which they occur.
If you need to access message tracing functionality from a wrapper function, call the TraceMessageVa version of this function.
Consumers will have to use the EventCallback callback to receive and process the events if the MessageFlags parameter does not contain the TRACE_MESSAGE_GUID flag. If you do not specify the TRACE_MESSAGE_GUID flag, the consumer will not be able to use the EventClassCallback because the Header.Guid member of the EVENT_TRACE structure will not contain the event trace class GUID.
Note that the members of the EVENT_TRACE and EVENT_TRACE_HEADER structures that correspond to the MessageFlags flags are set only if the corresponding flag is specified. For example, the ThreadId and ProcessId members of EVENT_TRACE_HEADER are populated only if you specify the TRACE_MESSAGE_SYSTEMINFO flag.
Requirements
Minimum supported clientWindows XP
Minimum supported serverWindows Server 2003
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
See Also
TraceEvent
TraceEventInstance
TraceMessageVa
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa364139(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:22:42