<div class="content" name="PerflibV2QueryCounterInfo" uuid="b8f656a1-919d-437c-a4e2-1f1822322696"><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>0x00000000 ERROR_SUCCESS</td>
  <td>The return value indicates success.</td>
 </tr><tr>
  <td>0x00000005 ERROR_ACCESS_DENIED</td>
  <td>The server returns this value to the client if the authentication level of the client is less than RPC_C_AUTHN_LEVEL_PKT_PRIVACY.</td>
 </tr><tr>
  <td>0x00000008 ERROR_NOT_ENOUGH_MEMORY</td>
  <td>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.</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">_PERF_COUNTER_IDENTIFIER (row 1, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 2, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 3, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 4, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 5, Status)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 6, Size)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 7, CounterId)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 8, InstanceId)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 9, Index)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 10, Reserved)</td>
 </tr>
 <tr>
  <td colspan="32">Unicode string of Instance Name (row 1)</td>
 </tr>
 <tr>
  <td colspan="16">Instance Name (row 2)</td>
  <td colspan="16">Padding (MUST be set to 0)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 1, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 2, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 3, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 4, CounterSetGuid)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 5, Status)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 6, Size)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 7, CounterId)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 8, InstanceId)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 9, Index)</td>
 </tr>
 <tr>
  <td colspan="32">_PERF_COUNTER_IDENTIFIER (row 10, Reserved)</td>
 </tr>
 <tr>
  <td colspan="32">Unicode string of Instance Name (row 1)</td>
 </tr>
 <tr>
  <td colspan="32">Instance Name (row 2)</td>
 </tr>
</tbody></table><p> </p></div>