3.1.4.1.5 PerflibV2QueryCounterInfo (Opnum 5)

The PerflibV2QueryCounterInfo method returns information on the performance counters that belong to the performance counter query associated with the RPC_HQUERY; these performance counters are associated with RPC_HQUERY by calling the PerflibV2ValidateCounters method. The server MUST return performance counter metadata information, stored in a _PERF_COUNTER_IDENTIFIER structure for each performance counter, for the performance counters that are associated with the RPC_HQUERY handle.

 error_status_t PerflibV2QueryCounterInfo(
   [in] RPC_HQUERY hQuery,
   [in, range(0, 67108864)] DWORD dwInSize,
   [out] DWORD* pdwOutSize,
   [out] DWORD* pdwRtnSize,
   [out, size_is(dwInSize), length_is(*pdwOutSize)] 
     unsigned char* lpData
 );

hQuery: The handle returned by the PerflibV2OpenQueryHandle method; an exception is thrown or an error is returned by RPC if the handle did not originate from the PerflibV2OpenQueryHandle method.

dwInSize: The size, in bytes, of the buffer.

pdwOutSize: The size, in bytes, of the data that is written to the buffer.

pdwRtnSize: The necessary size, in bytes, to retrieve all the requested data.

lpData: The buffer that contains the requested counter information.

Return Values: This method MUST return zero (ERROR_SUCCESS) for success; otherwise, it MUST return one of the standard Windows errors, as specified in [MS-ERREF] section 2.2.

Return value/code

Description

0x00000000

ERROR_SUCCESS

The return value indicates success.

0x00000005

ERROR_ACCESS_DENIED

The server returns this value to the client if the authentication level of the client is less than RPC_C_AUTHN_LEVEL_PKT_PRIVACY.

0x00000008

ERROR_NOT_ENOUGH_MEMORY

The server will return this value if the buffer pointed to by lpData is not of sufficient size to return the requested information back to the client.

The server MUST return a data array in which each element is a _PERF_COUNTER_IDENTIFIER structure that is followed by a null-terminated Unicode string instance name. The index field of the _PERF_COUNTER_IDENTIFIER structure MUST indicate the position of the corresponding _PERF_COUNTER_HEADER block in the array of returned _PERF_COUNTER_HEADER blocks by subsequent PerflibV2QueryCounterData method calls associated with the RPC_HQUERY handle.

The status field of the _PERF_COUNTER_IDENTIFIER structure SHOULD be set to a Win32 error code by the server and MUST be ignored by the client. The size field of the _PERF_COUNTER_IDENTIFIER structure MUST be an 8-byte multiple.

PerflibV2QueryCounterInfo return

Figure 4: PerflibV2QueryCounterInfo return

The following diagram illustrates data size, alignment, and endianness. In this example, information about two counters is returned by the server. The first instance name is 6 bytes in length, and the second instance name is 8 bytes in length. The two bytes in padding between the end of the first instance name string and the beginning of the next _PERF_COUNTER_IDENTIFIER structure MUST be set to 0 by the server and MUST be ignored by the client.


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

_PERF_COUNTER_IDENTIFIER (row 1, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 2, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 3, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 4, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 5, Status)

_PERF_COUNTER_IDENTIFIER (row 6, Size)

_PERF_COUNTER_IDENTIFIER (row 7, CounterId)

_PERF_COUNTER_IDENTIFIER (row 8, InstanceId)

_PERF_COUNTER_IDENTIFIER (row 9, Index)

_PERF_COUNTER_IDENTIFIER (row 10, Reserved)

Unicode string of Instance Name (row 1)

Instance Name (row 2)

Padding (MUST be set to 0)

_PERF_COUNTER_IDENTIFIER (row 1, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 2, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 3, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 4, CounterSetGuid)

_PERF_COUNTER_IDENTIFIER (row 5, Status)

_PERF_COUNTER_IDENTIFIER (row 6, Size)

_PERF_COUNTER_IDENTIFIER (row 7, CounterId)

_PERF_COUNTER_IDENTIFIER (row 8, InstanceId)

_PERF_COUNTER_IDENTIFIER (row 9, Index)

_PERF_COUNTER_IDENTIFIER (row 10, Reserved)

Unicode string of Instance Name (row 1)

Instance Name (row 2)