网站首页  词典首页

请输入您要查询的函数:

 

术语 enumeratetraceguids
释义 EnumerateTraceGuids
语法:
C++
ULONG EnumerateTraceGuids(
__inout PTRACE_GUID_PROPERTIES *GuidPropertiesArray,
__in ULONG PropertyArrayCount,
__out PULONG GuidCount
);
EnumerateTraceGuids功能
该EnumerateTraceGuids函数检索有关注册的事件跟踪提供程序在计算机上运行。
注意:此功能已被取代EnumerateTraceGuidsEx。
参数
GuidPropertiesArray [ in , out ]
一个指针数组TRACE_GUID_PROPERTIES结构。
PropertyArrayCount [in]
在数量GuidPropertiesArray数组元素。
GuidCount [out]
实际数字事件跟踪计算机上注册的供应商。
返回值
如果函数成功,返回值是ERROR_SUCCESS。
如果函数失败,返回值是系统错误代码之一。下表列出了一些常见的错误及其原因。
返回codeDescription
以下ERROR_INVALID_PARAMETEROne是正确的:
PropertyArrayCount为零
GuidPropertiesArray为NULL
ERROR_MORE_DATAThe属性数组太小,无法获得所有已登记的供应商信息(GuidCount比PropertyArrayCount更大)。填充函数与在PropertyArrayCount指定搭建的GUID属性数组。
ERROR_ACCESS_DENIEDOnly具有管理权限的用户,在性能日志用户组的用户,服务本地系统,本地服务运行,是NetworkService可以列举跟踪提供程序。要授予受限用户能够枚举跟踪提供程序,将它们添加到性能日志用户组或见EventAccessControl。
Windows XP和Windows 2000:任何人都可以使一个跟踪供应商。
备注
事件跟踪控制器调用这个函数。
有关注册事件跟踪供应商,见RegisterTraceGuids信息。
您可以使用TRACE_GUID_PROPERTIES.LoggerId成员来决定的会议使供应商如TRACE_GUID_PROPERTIES.IsEnable为TRUE。
这份名单将不包括核心供应商。
实例
下面的示例演示如何调用此函数。
#define MAX_SESSIONS 64
PTRACE_GUID_PROPERTIES pProviders[MAX_SESSIONS]; //Array of pointers to property structures
PTRACE_GUID_PROPERTIES pBuffer = NULL; //Buffer that contains all the property structures
ULONG RegisteredProviderCount = 0; //Actual number of providers registered on the computer
ULONG rc = ERROR_SUCCESS;
ULONG BufferSize = sizeof(TRACE_GUID_PROPERTIES) * MAX_SESSIONS;
WCHAR ProviderGuid[50];
pBuffer = (PTRACE_GUID_PROPERTIES) malloc(BufferSize);
if (NULL == pBuffer)
{
wprintf(L"Error allocating memory for properties.\\n");
goto cleanup;
}
ZeroMemory(pBuffer, BufferSize);
for (USHORT i=0; i < MAX_SESSIONS; i++)
{
pProviders[i] = pBuffer+i;
}
rc = EnumerateTraceGuids(pProviders, (ULONG)MAX_SESSIONS, &RegisteredProviderCount);
if (ERROR_SUCCESS == rc || ERROR_MORE_DATA == rc)
{
wprintf(L"Requested provider count, %d. Registered provider count, %d.\\n", MAX_SESSIONS, RegisteredProviderCount);
for (USHORT i=0; i < RegisteredProviderCount && i < MAX_SESSIONS; i++)
{
StringFromGUID2(pProviders[i]->Guid, ProviderGuid, sizeof(ProviderGuid)),
wprintf(L"Provider #%d\\nGuid: %s\\nEnabled: %s\\n",
i,
ProviderGuid,
(pProviders[i]->IsEnable) ? L"TRUE" : L"FALSE");
if (pProviders[i]->IsEnable)
{
wprintf(L"Session ID: %ld\\nEnable level: %ld\\nEnable flags: %ld\\n",
pProviders[i]->LoggerId,
pProviders[i]->EnableLevel,
pProviders[i]->EnableFlags);
}

wprintf(L"\\n");
}
}
else
{
wprintf(L"Error calling EnumerateTraceGuids, %d.\\n", rc);
goto cleanup;
}
cleanup:
if (pBuffer)
free(pBuffer);
要求:
最低支持client-Windows XP
最低支持serverWindows服务器2003
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
参见
EnumerateTraceGuidsEx
QueryAllTraces
RegisterTraceGuids
TRACE_GUID_PROPERTIES
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月30日
==英文原文==EnumerateTraceGuids Function
The EnumerateTraceGuids function retrieves information about registered event trace providers that are running on the computer.
Note This function has been superseded by EnumerateTraceGuidsEx .
Syntax
C++
ULONG EnumerateTraceGuids(
__inout PTRACE_GUID_PROPERTIES *GuidPropertiesArray,
__in ULONG PropertyArrayCount,
__out PULONG GuidCount
);
Parameters
GuidPropertiesArray [in, out]
An array of pointers to TRACE_GUID_PROPERTIES structures.
PropertyArrayCount [in]
Number of elements in the GuidPropertiesArray array.
GuidCount [out]
Actual number of event tracing providers registered on the computer.
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_PARAMETEROne of the following is true:
PropertyArrayCount is zero
GuidPropertiesArray is NULL
ERROR_MORE_DATAThe property array is too small to receive information for all registered providers (GuidCount is greater than PropertyArrayCount). The function fills the GUID property array with the number of structures specified in PropertyArrayCount.
ERROR_ACCESS_DENIEDOnly users with administrative privileges, users in the Performance Log Users group, and services running as LocalSystem, LocalService, NetworkService can enumerate trace providers. To grant a restricted user the ability to enumerate trace providers, add them to the Performance Log Users group or see EventAccessControl .
Windows XP and Windows 2000: Anyone can enable a trace provider.

Remarks
Event trace controllers call this function.
For information on registering event trace providers, see RegisterTraceGuids .
You can use the TRACE_GUID_PROPERTIES.LoggerId member to determine which session enabled the provider if TRACE_GUID_PROPERTIES.IsEnable is TRUE.
The list will not include kernel providers.
Examples
The following example shows you how to call this function.
#define MAX_SESSIONS 64
PTRACE_GUID_PROPERTIES pProviders[MAX_SESSIONS]; //Array of pointers to property structures
PTRACE_GUID_PROPERTIES pBuffer = NULL; //Buffer that contains all the property structures
ULONG RegisteredProviderCount = 0; //Actual number of providers registered on the computer
ULONG rc = ERROR_SUCCESS;
ULONG BufferSize = sizeof(TRACE_GUID_PROPERTIES) * MAX_SESSIONS;
WCHAR ProviderGuid[50];
pBuffer = (PTRACE_GUID_PROPERTIES) malloc(BufferSize);
if (NULL == pBuffer)
{
wprintf(L"Error allocating memory for properties.\\n");
goto cleanup;
}
ZeroMemory(pBuffer, BufferSize);
for (USHORT i=0; i < MAX_SESSIONS; i++)
{
pProviders[i] = pBuffer+i;
}
rc = EnumerateTraceGuids(pProviders, (ULONG)MAX_SESSIONS, &RegisteredProviderCount);
if (ERROR_SUCCESS == rc || ERROR_MORE_DATA == rc)
{
wprintf(L"Requested provider count, %d. Registered provider count, %d.\\n", MAX_SESSIONS, RegisteredProviderCount);
for (USHORT i=0; i < RegisteredProviderCount && i < MAX_SESSIONS; i++)
{
StringFromGUID2(pProviders[i]->Guid, ProviderGuid, sizeof(ProviderGuid)),
wprintf(L"Provider #%d\\nGuid: %s\\nEnabled: %s\\n",
i,
ProviderGuid,
(pProviders[i]->IsEnable) ? L"TRUE" : L"FALSE");
if (pProviders[i]->IsEnable)
{
wprintf(L"Session ID: %ld\\nEnable level: %ld\\nEnable flags: %ld\\n",
pProviders[i]->LoggerId,
pProviders[i]->EnableLevel,
pProviders[i]->EnableFlags);
}

wprintf(L"\\n");
}
}
else
{
wprintf(L"Error calling EnumerateTraceGuids, %d.\\n", rc);
goto cleanup;
}
cleanup:
if (pBuffer)
free(pBuffer);
Requirements
Minimum supported clientWindows XP
Minimum supported serverWindows Server 2003
HeaderEvntrace.h
LibraryAdvapi32.lib
DLLAdvapi32.dll
See Also
EnumerateTraceGuidsEx
QueryAllTraces
RegisterTraceGuids
TRACE_GUID_PROPERTIES
Send comments about this topic to Microsoft
Build date: 7/30/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa363713(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:26