Skip to content

Latest commit

 

History

History
174 lines (133 loc) · 5.63 KB

nf-pdh-pdhmakecounterpatha.md

File metadata and controls

174 lines (133 loc) · 5.63 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:pdh.PdhMakeCounterPathA
PdhMakeCounterPathA function (pdh.h)
Creates a full counter path using the members specified in the PDH_COUNTER_PATH_ELEMENTS structure. (ANSI)
0
PDH_PATH_WBEM_INPUT
PDH_PATH_WBEM_RESULT
PdhMakeCounterPathA
pdh/PdhMakeCounterPathA
perf\pdhmakecounterpath.htm
perf
f2dc5f77-9f9e-4290-95fa-ce2f1e81fc69
12/05/2018
0, PDH_PATH_WBEM_INPUT, PDH_PATH_WBEM_RESULT, PdhMakeCounterPath, PdhMakeCounterPath function [Perf], PdhMakeCounterPathA, PdhMakeCounterPathW, _win32_pdhmakecounterpath, base.pdhmakecounterpath, pdh/PdhMakeCounterPath, pdh/PdhMakeCounterPathA, pdh/PdhMakeCounterPathW, perf.pdhmakecounterpath
pdh.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
PdhMakeCounterPathW (Unicode) and PdhMakeCounterPathA (ANSI)
Pdh.lib
Pdh.dll
Windows
19H1
PdhMakeCounterPathA
pdh/PdhMakeCounterPathA
c++
APIRef
kbSyntax
DllExport
Pdh.dll
PdhMakeCounterPath
PdhMakeCounterPathA
PdhMakeCounterPathW

PdhMakeCounterPathA function

-description

Creates a full counter path using the members specified in the PDH_COUNTER_PATH_ELEMENTS structure.

-parameters

-param pCounterPathElements [in]

A PDH_COUNTER_PATH_ELEMENTS structure that contains the members used to make up the path. Only the szObjectName and szCounterName members are required, the others are optional.

If the instance name member is NULL, the path will not contain an instance reference and the szParentInstance and dwInstanceIndex members will be ignored.

-param szFullPathBuffer [out]

Caller-allocated buffer that receives a null-terminated counter path. The maximum length of a counter path is PDH_MAX_COUNTER_PATH. Set to NULL if pcchBufferSize is zero.

-param pcchBufferSize [in, out]

Size of the szFullPathBuffer buffer, in TCHARs. If zero on input, the function returns PDH_MORE_DATA and sets this parameter to the required buffer size. If the buffer is larger than the required size, the function sets this parameter to the actual size of the buffer that was used. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer.

-param dwFlags [in]

Format of the input and output counter values. You can specify one of the following values.

Value Meaning
PDH_PATH_WBEM_RESULT
Converts a PDH path to the WMI class and property name format.
PDH_PATH_WBEM_INPUT
Converts the WMI class and property name to a PDH path.
0
Returns the path in the PDH format, for example, \\computer\object(parent/instance#index)\counter.

-returns

If the function succeeds, it returns ERROR_SUCCESS.

If the function fails, the return value is a system error code or a PDH error code. The following are possible values.

Return code Description
PDH_MORE_DATA
The szFullPathBuffer buffer is too small to contain the counter name. This return value is expected if pcchBufferSize is zero on input. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer.
PDH_INVALID_ARGUMENT
A parameter is not valid or is incorrectly formatted. For example, on some releases you could receive this error if the specified size on input is greater than zero but less than the required size.

-remarks

You should call this function twice, the first time to get the required buffer size (set szFullPathBuffer to NULL and pcchBufferSize to 0), and the second time to get the data.

Note

The pdh.h header defines PdhMakeCounterPath as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

PDH_COUNTER_PATH_ELEMENTS

PdhParseCounterPath