PerfDeleteCounters function (perflib.h)

Removes the specified performance counter specifications from the specified query.


ULONG PerfDeleteCounters(
  [in]      HANDLE                   hQuery,
  [in, out] PPERF_COUNTER_IDENTIFIER pCounters,
            DWORD                    cbCounters


[in] hQuery

A handle to the query from which you want to remove performance counter specifications.

[in, out] pCounters

A pointer to the performance counter specifications that you want to remove.


The size of the buffer that the pCounters parameter specifies, in bytes.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code.


The pCounters parameter should point to a sequence of PERF_COUNTER_IDENTIFIER blocks. Each PERF_COUNTER_IDENTIFIER block consists of a PERF_COUNTER_IDENTIFIER structure, optionally followed by a null-terminated UTF-16LE instance name string, followed by padding that makes the size of the block a multiple of 8 bytes.

Configure each PERF_COUNTER_IDENTIFIER block in the same way as described in the Remarks for PerfAddCounters.

PerfDeleteCounters attempts to remove one counter specification from the query for each PERF_COUNTER_IDENTIFIER block, and updates the Status member of the PERF_COUNTER_IDENTIFIER structure in each block with the result of the attempt.


Requirement Value
Minimum supported client Windows 10, version 1607 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header perflib.h
Library AdvAPI32.lib
DLL AdvAPI32.dll

See also