PdhGetDataSourceTimeRangeA function (pdh.h)

Determines the time range, number of entries and, if applicable, the size of the buffer containing the performance data from the specified input source.

To use handles to data sources, use the PdhGetDataSourceTimeRangeH function.

Syntax

PDH_FUNCTION PdhGetDataSourceTimeRangeA(
  [in]  LPCSTR         szDataSource,
  [out] LPDWORD        pdwNumEntries,
  [out] PPDH_TIME_INFO pInfo,
  [in]  LPDWORD        pdwBufferSize
);

Parameters

[in] szDataSource

Null-terminated string that specifies the name of a log file from which the time range information is retrieved.

[out] pdwNumEntries

Number of structures in the pInfo buffer. This function collects information for only one time range, so the value is typically 1, or zero if an error occurred.

[out] pInfo

A PDH_TIME_INFO structure that receives the time range.

[in] pdwBufferSize

Size of the PDH_TIME_INFO structure, in bytes.

Return value

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_INVALID_ARGUMENT
A parameter is not valid or is incorrectly formatted.
PDH_INVALID_HANDLE
The counter handle is not valid.
PDH_DATA_SOURCE_IS_REAL_TIME
The current data source is a real-time data source.

Remarks

Note

The pdh.h header defines PdhGetDataSourceTimeRange as an alias that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header pdh.h
Library Pdh.lib
DLL Pdh.dll

See also

PdhGetDataSourceTimeRangeH

PdhSetQueryTimeRange