Platform SDK: Performance Monitoring |
The PdhExpandWildCardPath function expands any wildcard characters in the specified counter path string and returns the matching counter paths.
PDH_STATUS PdhExpandWildCardPath( LPCTSTR szDataSource, LPCTSTR szWildCardPath, LPTSTR mszExpandedPathList, LPDWORD pcchPathListLength, DWORD dwFlags );
Windows NT 4.0: [in] Reserved. Must be NULL.
If the buffer that mszExpandedPathList points to is too small to receive the entire list, PdhExpandWildCardPath returns PDH_MORE_DATA. The pcchPathListLength parameter receives the length required for the returned path strings.
Value | Meaning |
---|---|
PDH_NOEXPANDCOUNTERS | Wildcard characters in the counter names specified in the counter path list are not expanded. |
PDH_NOEXPANDINSTANCES | Wildcard characters in the instance names specified in the counter path list are not expanded. |
If the function succeeds, it returns PDH_CSTATUS_VALID_DATA.
If the function fails, the return value is a PDH error status defined in PDHMsg.h.
PdhExpandWildCardPath differs from PdhExpandCounterPath in three ways:
The general counter path format is as follows:
\\machine\object(parent/instance#index)\counter
The parent, instance, index, and counter components of the format may contain either a valid name or a wildcard character. The machine, parent, instance, and index components are not necessary for all counters.
You determine the counter paths to use based on the counter itself. For example, the LogicalDisk object has an instance index, so you must provide the #index or a wildcard. Therefore, you could use the following format:
\LogicalDisk(*/*#*)\*
In comparison, the Process object does not require an instance index. Therefore, you could use the following format:
\Process(*)\ID Process
The following is a list of the possible formats:
If a wildcard character is specified in the parent name, all instances of the specified object that match the specified instance and counter fields will be returned.
If a wildcard character is specified in the instance name, all instances of the specified object and parent object will be returned if all instance names corresponding to the specified index match the wildcard character.
If a wildcard character is specified in the counter name, all counters of the specified object are returned.
Partial counter path string matches (for example, "pro*") are not supported.
Windows NT/2000: Requires Windows 2000.
Header: Declared in Pdh.h.
Library: Use Pdh.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows 2000.