大网数据广告活动
性能与资源

CounterInitialize function

· 52CE 我爱测

Registers the provider and initializes the counter sets.

Registers the provider and initializes the counter sets.

Syntax

ULONG WINAPI CounterInitialize(void);

Parameters

This function has no parameters.

Return value

Returns ERROR_SUCCESS on success; otherwise, a standard Win32 error code.

Remarks

Your provider calls this function. The function includes calls to the PerfStartProvider function and the PerfSetCounterSetInfo function.

The CTRPP tool generates this inline function when you specify the -o argument. The function's name include a prefix string if you specify the -prefix argument.

If you specify the -MemoryRoutines or -NotificationCallback arguments (or specify the callback attribute for the provider element), the CounterInitialize signature changes to the following:

ULONG WINAPI CounterInitialize(
    __in_opt PERFLIBREQUEST NotificationCallback,
    __in_opt PERF_MEM_ALLOC MemoryAllocationFunction,
    __in_opt PERF_MEM_FREE MemoryFreeFunction,
    __inout_opt PVOID MemoryFunctionContext
);

where,

NotificationCallback

The name of your ControlCallback callback function that you implement to receive notification of consumer requests (for example, requests to add or remove counters from the query). Set to NULL if you do not implement the ControlCallback callback function.

MemoryAllocationFunction

The name of your AllocateMemory callback function that PERFLIB calls to allocate memory. Set to NULL if you did not specify the -MemoryRoutines argument.

MemoryFreeFunction

The name of your FreeMemory callback function that PERFLIB calls to free the memory allocated using the AllocateMemory function. Set to NULL if MemoryAllocationFunction is NULL.

MemoryFunctionContext

Context information to pass to your memory allocation and free routines. Can be NULL.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 07/14/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。