PerfDeleteInstance function (perflib.h)

Deletes an instance of the counter set created by the PerfCreateInstance function. Providers use this function.


ULONG PerfDeleteInstance(
  [in] HANDLE                    Provider,


[in] Provider

The handle of the provider. Use the handle variable that the CTRPP tool generated for you. For the name of the variable, see the symbol attribute of the provider element.

Windows Vista:  The PerfStartProvider function returns the handle.

[in] InstanceBlock

A PERF_COUNTERSET_INSTANCE structure that contains the instance of the counter set to delete.

Return value

If the function succeeds, it returns ERROR_SUCCESS.

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


If the provider process terminates abnormally, all allocated instances will be released.

The provider determines when it deletes an instance. If the counter data is more static, the provider can delete an instance at cleanup time. For example, the number of processors on a computer would be considered static, so a provider that provides counter data for processors could delete an instance for each processor on the computer at cleanup time. For counters that are more dynamic, such as disk or process counters, the providers would delete the instances in response to a USB device being removed or a process being terminated.


Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header perflib.h
Library Advapi32.lib
DLL Advapi32.dll

See also