<div class="content"><p>The PerflibV2QueryCounterInfo method returns information on the
<a href="da82a046-4e10-46ab-8da9-3d24bb48a2b2#gt_35645a67-9e0b-4c05-b2d9-3b2b25f2beac" data-linktype="relative-path">performance counters</a>
that belong to the performance counter query associated with the <a href="f9f8672c-41f4-43b7-a54c-9654227dede2" data-linktype="relative-path">RPC_HQUERY</a>; these
performance counters are associated with RPC_HQUERY by calling the <a href="894ec446-089e-4efb-a9cc-69c97083bd1d" data-linktype="relative-path">PerflibV2ValidateCounters</a>
method. The server MUST return performance counter metadata information, stored
in a <a href="4a5671fe-b75c-44ee-96da-edc9d51ee6a9" data-linktype="relative-path">_PERF_COUNTER_IDENTIFIER</a>
structure for each performance counter, for the performance counters that are
associated with the RPC_HQUERY handle. </p><dl>
<dd>
<div><pre> 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
 );
</pre></div>
</dd></dl><p><b>hQuery: </b>The handle returned by the <a href="89060095-8806-47ce-80da-9d03cedcb9a6" data-linktype="relative-path">PerflibV2OpenQueryHandle</a>
method; an exception is thrown or an error is returned by RPC if the handle did
not originate from the PerflibV2OpenQueryHandle method.</p><p><b>dwInSize: </b>The size, in bytes, of the buffer.</p><p><b>pdwOutSize: </b>The size, in bytes, of the data
that is written to the buffer.</p><p><b>pdwRtnSize: </b>The necessary size, in bytes, to
retrieve all the requested data.</p><p><b>lpData: </b>The buffer that contains the requested
counter information.</p><p><b>Return Values: </b>This method MUST return zero
(ERROR_SUCCESS) for success; otherwise, it MUST return one of the standard
Windows errors, as specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>
section <a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>ERROR_SUCCESS</p>
  </td>
  <td>
  <p>The return value indicates success.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000005</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>The server returns this value to the client if the
  authentication level of the client is less than
  RPC_C_AUTHN_LEVEL_PKT_PRIVACY. </p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000008</p>
  <p>ERROR_NOT_ENOUGH_MEMORY</p>
  </td>
  <td>
  <p>The server will return this value if the buffer
  pointed to by <b>lpData</b> is not of sufficient size to return the requested
  information back to the client.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>The server MUST return a data array in which each element is
a _PERF_COUNTER_IDENTIFIER structure that is followed by a null-terminated <a href="da82a046-4e10-46ab-8da9-3d24bb48a2b2#gt_b069acb4-e364-453e-ac83-42d469bb339e" data-linktype="relative-path">Unicode string</a> instance
name. The <b>index</b> 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.</p><p>The <b>status</b> 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.</p><p><img id="MS-PCQ_pict4ee057ae-90a0-3f64-6ff1-3f131f77aa06.png" src="ms-pcq_files/image004.png" alt="PerflibV2QueryCounterInfo return" title="PerflibV2QueryCounterInfo return" data-linktype="relative-path"/></p><p><b>Figure 4: PerflibV2QueryCounterInfo return</b></p><p>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.</p><table>
 <tbody><tr>
  <th><p><br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>1<br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>2<br/>0</p></th>
  <th><p><br/>1</p></th>
  <th><p><br/>2</p></th>
  <th><p><br/>3</p></th>
  <th><p><br/>4</p></th>
  <th><p><br/>5</p></th>
  <th><p><br/>6</p></th>
  <th><p><br/>7</p></th>
  <th><p><br/>8</p></th>
  <th><p><br/>9</p></th>
  <th><p>3<br/>0</p></th>
  <th><p><br/>1</p></th>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 1, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 2, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 3, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 4, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 5, <b>Status</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 6, <b>Size</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 7, <b>CounterId</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 8, <b>InstanceId</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 9, <b>Index</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 10, <b>Reserved</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">Unicode
  string of Instance Name (row 1)</p>
  </td>
 </tr>
 <tr>
  <td colspan="16">
  <p align="center">Instance
  Name (row 2)</p>
  </td>
  <td colspan="16">
  <p align="center">Padding
  (MUST be set to 0)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 1, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 2, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 3, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 4, <b>CounterSetGuid</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 5, <b>Status</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 6, <b>Size</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 7, <b>CounterId</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 8, <b>InstanceId</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 9, <b>Index</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">_PERF_COUNTER_IDENTIFIER
  (row 10, <b>Reserved</b>)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">Unicode
  string of Instance Name (row 1)</p>
  </td>
 </tr>
 <tr>
  <td colspan="32">
  <p align="center">Instance
  Name (row 2)</p>
  </td>
 </tr>
</tbody></table><p> </p></div>