CounterInitialize function

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]