网站首页  词典首页

请输入您要查询的函数:

 

术语 starttrace
释义 StartTrace
语法:
C++
ULONG StartTrace(
__out PTRACEHANDLE SessionHandle,
__in LPCTSTR SessionName,
__inout PEVENT_TRACE_PROPERTIES Properties
);
StartTrace功能
该StartTrace函数注册并启动一个事件跟踪会话。
参数
SessionHandle [out]
处理该事件跟踪会话。
不要使用该句柄,如果函数失败。不要比较句柄INVALID_HANDLE_VALUE会议,会议处理的是0,如果处理不正确。
SessionName [in]
NULL结尾的字符串,其中包含了跟踪会话事件的名称。这次会议的名称被限制为1,024个字符,不区分大小写,并且必须是唯一的。
视窗2000:会议的名称是区分大小写的。因此重复的会议名称是允许的。然而,以减少混乱,您应该确保您的会议名称是唯一的。
这个函数复制会话名称是您提供给抵消的属性点LoggerNameOffset成员。
属性[ in , out ]
指针的EVENT_TRACE_PROPERTIES结构,指定会议的行为。以下是主要成员结构设置:
Wnode.BufferSize
Wnode.Guid
Wnode.ClientContext
Wnode.Flags
LogFileMode
LogFileNameOffset
LoggerNameOffset
如果SessionName是KERNEL_LOGGER_NAME,您还必须设置EnableFlags。根据不同类型的日志文件,您选择创建,您可能还需要指定一个MaximumFileSize价值。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是系统错误代码之一。下表列出了一些常见的错误及其原因。
返回codeDescription
以下ERROR_BAD_LENGTHOne是正确的:
物业的Wnode.BufferSize成员指定一个不正确的大小。
属性没有足够的空间分配给持有SessionName副本。
以下ERROR_INVALID_PARAMETEROne是正确的:
属性为NULL。
SessionHandle为NULL。
物业的LogFileNameOffset成员是无效的。
物业的LoggerNameOffset成员是无效的。
物业的LogFileMode成员指定的标志的组合无效。
该Wnode.Guid成员SystemTraceControlGuid,但SessionName参数不KERNEL_LOGGER_NAME。
Windows 2000中:这宗事件并不返回一个错误。
ERROR_ALREADY_EXISTSA会议具有相同名称或GUID已在运行。
ERROR_BAD_PATHNAMEYou可以收到以下原因之一此错误:
另一次会议已经使用的文件名由属性结构LogFileNameOffset成员中指定。
双方LogFileMode和LogFileNameOffset为零。
ERROR_DISK_FULLThere上没有足够的日志文件的驱动器可用空间。如果发生这种情况:
MaximumFileSize不为零,并且没有为日志文件中提供MaximumFileSize字节
该驱动器是一个系统驱动器,而且也没有额外的200 MB可用
MaximumFileSize为零,并且没有额外的200 MB可用
选择更多空间的驱动器,或减少MaximumFileSize指定的大小(如果使用)。
Windows 2000中:不需要额外的200 MB可用磁盘空间。
ERROR_ACCESS_DENIEDOnly具有管理权限的用户,在性能日志用户组的用户,服务本地系统,本地服务运行,是NetworkService可以控制事件跟踪会话。要授予受限用户能够控制跟踪会话,将它们添加到性能日志用户组。具有管理权限和服务作为LocalSystem可以控制的NT内核记录器会话中运行的用户。
Windows XP和Windows 2000:任何人都可以控制跟踪会话。
如果用户是在性能日志用户组的成员,他们可能没有权限创建指定的文件夹中的日志文件。
备注
事件跟踪控制器调用这个函数。
这次会议仍然有效,直到您停止了会议,在计算机重新启动或最大文件大小达到了非圆日志。为了阻止事件跟踪会话,调用ControlTrace功能,并设置ControlCode参数EVENT_TRACE_CONTROL_STOP。
您不能以同样的会议不止一届的GUID。
在此之前的Windows Vista:您可以从一个以上的同届会议的GUID。
要指定一个NT内核记录器会议后,设立SessionName为KERNEL_LOGGER_NAME和物业Wnode.Guid成员SystemTraceControlGuid。如果您不指定为SystemTraceControlGuid的GUID,ETW将覆盖GUID值并将其设置为SystemTraceControlGuid。
Windows 2000中:要启动的内核会议,会议的名称必须是KERNEL_LOGGER_NAME和GUID必须SystemTraceControlGuid。
要指定一个私人记录会议,设置属性Wnode.Guid成员对供应商的控制的GUID,而不是私人记录会议的控件的GUID。提供者必须已登记的GUID,然后再调用StartTrace。
您不使用此函数来启动一个全球记录会议。有关启动全球记录会议细节,请参见配置并启动全球记录器会话。
实例
举一个例子,它使用StartTrace,请参见配置和启动一个事件跟踪会话。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode和ANSI namesStartTraceW(Unicode)和StartTraceA(ANSI)的
参见
ControlTrace
EVENT_TRACE_PROPERTIES
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==StartTrace Function
The StartTrace function registers and starts an event tracing session.
Syntax
C++
ULONG StartTrace(
__out PTRACEHANDLE SessionHandle,
__in LPCTSTR SessionName,
__inout PEVENT_TRACE_PROPERTIES Properties
);
Parameters
SessionHandle [out]
Handle to the event tracing session.
Do not use this handle if the function fails. Do not compare the session handle to INVALID_HANDLE_VALUE; the session handle is 0 if the handle is not valid.
SessionName [in]
Null-terminated string that contains the name of the event tracing session. The session name is limited to 1,024 characters, is case-insensitive, and must be unique.
Windows 2000: Session names are case-sensitive. As a result, duplicate session names are allowed. However, to reduce confusion, you should make sure your session names are unique.
This function copies the session name that you provide to the offset that the LoggerNameOffset member of Properties points to.
Properties [in, out]
Pointer to an EVENT_TRACE_PROPERTIES structure that specifies the behavior of the session. The following are key members of the structure to set:
Wnode.BufferSize
Wnode.Guid
Wnode.ClientContext
Wnode.Flags
LogFileMode
LogFileNameOffset
LoggerNameOffset
If SessionName is KERNEL_LOGGER_NAME, you must also set EnableFlags. Depending on the type of log file you choose to create, you may also need to specify a value for MaximumFileSize.
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_BAD_LENGTHOne of the following is true:
The Wnode.BufferSize member of Properties specifies an incorrect size.
Properties does not have sufficient space allocated to hold a copy of SessionName.
ERROR_INVALID_PARAMETEROne of the following is true:
Properties is NULL.
SessionHandle is NULL.
The LogFileNameOffset member of Properties is not valid.
The LoggerNameOffset member of Properties is not valid.
The LogFileMode member of Properties specifies a combination of flags that is not valid.
The Wnode.Guid member is SystemTraceControlGuid, but the SessionName parameter is not KERNEL_LOGGER_NAME.
Windows 2000: This case does not return an error.
ERROR_ALREADY_EXISTSA session with the same name or GUID is already running.
ERROR_BAD_PATHNAMEYou can receive this error for one of the following reasons:
Another session is already using the file name specified by the LogFileNameOffset member of the Properties structure.
Both LogFileMode and LogFileNameOffset are zero.
ERROR_DISK_FULLThere is not enough free space on the drive for the log file. This occurs if:
MaximumFileSize is nonzero and there is not MaximumFileSize bytes available for the log file
the drive is a system drive and there is not an additional 200 MB available
MaximumFileSize is zero and there is not an additional 200 MB available
Choose a drive with more space, or decrease the size specified in MaximumFileSize (if used).
Windows 2000: Does not require an additional 200 MB available disk space.
ERROR_ACCESS_DENIEDOnly users with administrative privileges, users in the Performance Log Users group, and services running as LocalSystem, LocalService, NetworkService can control event tracing sessions. To grant a restricted user the ability to control trace sessions, add them to the Performance Log Users group. Only users with administrative privileges and services running as LocalSystem can control an NT Kernel Logger session.
Windows XP and Windows 2000: Anyone can control a trace session.
If the user is a member of the Performance Log Users group, they may not have permission to create the log file in the specified folder.

Remarks
Event trace controllers call this function.
The session remains active until you stop the session, the computer is restarted or the maximum file size is reached for non-circular logs. To stop an event tracing session, call the ControlTrace function and set the ControlCode parameter to EVENT_TRACE_CONTROL_STOP.
You cannot start more than one session with the same session GUID.
Prior to Windows Vista: You can start more than one session with the same session GUID.
To specify an NT Kernel Logger session, set SessionName to KERNEL_LOGGER_NAME and the Wnode.Guid member of Properties to SystemTraceControlGuid. If you do not specify the GUID as SystemTraceControlGuid, ETW will override the GUID value and set it to SystemTraceControlGuid.
Windows 2000: To start the kernel session, the session name must be KERNEL_LOGGER_NAME and the Guid must be SystemTraceControlGuid.
To specify a private logger session, set Wnode.Guid member of Properties to the provider's control GUID, not the private logger session's control GUID. The provider must have registered the GUID before you call StartTrace.
You do not use this function to start a global logger session. For details on starting a global logger session, see Configuring and Starting the Global Logger Session .
Examples
For an example that uses StartTrace, see Configuring and Starting an Event Tracing Session .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
Unicode and ANSI namesStartTraceW (Unicode) and StartTraceA (ANSI)
See Also
ControlTrace
EVENT_TRACE_PROPERTIES
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa364117(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:20:48