PDH_COUNTER_INFO_A structure (pdh.h)

The PDH_COUNTER_INFO structure contains information describing the properties of a counter. This information also includes the counter path.

Syntax

typedef struct _PDH_COUNTER_INFO_A {
  DWORD     dwLength;
  DWORD     dwType;
  DWORD     CVersion;
  DWORD     CStatus;
  LONG      lScale;
  LONG      lDefaultScale;
  DWORD_PTR dwUserData;
  DWORD_PTR dwQueryUserData;
  LPSTR     szFullPath;
  union {
    PDH_DATA_ITEM_PATH_ELEMENTS_A DataItemPath;
    PDH_COUNTER_PATH_ELEMENTS_A   CounterPath;
    struct {
      LPSTR szMachineName;
      LPSTR szObjectName;
      LPSTR szInstanceName;
      LPSTR szParentInstance;
      DWORD dwInstanceIndex;
      LPSTR szCounterName;
    };
  };
  LPSTR     szExplainText;
  DWORD     DataBuffer[1];
} PDH_COUNTER_INFO_A, *PPDH_COUNTER_INFO_A;

Members

dwLength

Size of the structure, including the appended strings, in bytes.

dwType

Counter type. For a list of counter types, see the Counter Types section of the Windows Server 2003 Deployment Kit. The counter type constants are defined in Winperf.h.

CVersion

Counter version information. Not used.

CStatus

Counter status that indicates if the counter value is valid. For a list of possible values, see Checking PDH Interface Return Values.

lScale

Scale factor to use when computing the displayable value of the counter. The scale factor is a power of ten. The valid range of this parameter is PDH_MIN_SCALE (–7) (the returned value is the actual value times 10⁷) to PDH_MAX_SCALE (+7) (the returned value is the actual value times 10⁺⁷). A value of zero will set the scale to one, so that the actual value is returned

lDefaultScale

Default scale factor as suggested by the counter's provider.

dwUserData

The value passed in the dwUserData parameter when calling PdhAddCounter.

dwQueryUserData

The value passed in the dwUserData parameter when calling PdhOpenQuery.

szFullPath

Null-terminated string that specifies the full counter path. The string follows this structure in memory.

DataItemPath

A PDH_DATA_ITEM_PATH_ELEMENTS structure. Not used.

CounterPath

A PDH_COUNTER_PATH_ELEMENTS structure.

szMachineName

Null-terminated string that contains the name of the computer specified in the counter path. Is NULL, if the path does not specify a computer. The string follows this structure in memory.

szObjectName

Null-terminated string that contains the name of the performance object specified in the counter path. The string follows this structure in memory.

szInstanceName

Null-terminated string that contains the name of the object instance specified in the counter path. Is NULL, if the path does not specify an instance. The string follows this structure in memory.

szParentInstance

Null-terminated string that contains the name of the parent instance specified in the counter path. Is NULL, if the path does not specify a parent instance. The string follows this structure in memory.

dwInstanceIndex

Instance index specified in the counter path. Is 0, if the path does not specify an instance index.

szCounterName

Null-terminated string that contains the counter name. The string follows this structure in memory.

szExplainText

Help text that describes the counter. Is NULL if the source is a log file.

DataBuffer[1]

Start of the string data that is appended to the structure.

Remarks

When you allocate memory for this structure, allocate enough memory for the member strings, such as szCounterName, that are appended to the end of this structure.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header pdh.h

See also

PDH_COUNTER_PATH_ELEMENTS

PDH_DATA_ITEM_PATH_ELEMENTS

PdhGetCounterInfo