<div class="content" name="LsarQuerySecret" uuid="e36cfffa-fd53-437e-a5a7-1a95cfdda4c1"><p>The LsarQuerySecret method is invoked to retrieve the
current and old (or previous) value of the <span><a href="31ca2a31-0be4-4773-bcef-05ad6cd3ccfb#gt_9720ddb8-c802-40b7-8dba-5e7520c3396d" data-linktype="relative-path">secret object</a></span>.</p><dl>
<dd>
<div><pre> NTSTATUS LsarQuerySecret(
   [in] LSAPR_HANDLE SecretHandle,
   [in, out, unique] PLSAPR_CR_CIPHER_VALUE* EncryptedCurrentValue,
   [in, out, unique] PLARGE_INTEGER CurrentValueSetTime,
   [in, out, unique] PLSAPR_CR_CIPHER_VALUE* EncryptedOldValue,
   [in, out, unique] PLARGE_INTEGER OldValueSetTime
 );
</pre></div>
</dd></dl><p><b>SecretHandle:</b> An open secret object handle.</p><p><b>EncryptedCurrentValue: </b>Used to return the
encrypted current value of the secret object.</p><p><b>CurrentValueSetTime: </b>Used to return the time
when the current value was set.</p><p><b>EncryptedOldValue: </b>A BLOB representing the
encrypted old value. It is valid for this parameter to be NULL, in which case
the current value in the policy database is copied.</p><p><b>OldValueSetTime: </b>The time corresponding to the
instant that the old value was last changed.</p><p><b>Return Values: </b>The following is a summary of
the return values that an implementation MUST return, as specified by the
message processing that follows.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 STATUS_SUCCESS</td>
  <td>The request was successfully completed.</td>
 </tr><tr>
  <td>0xC0000022 STATUS_ACCESS_DENIED</td>
  <td>The caller does not have the permissions to perform this operation.</td>
 </tr><tr>
  <td>0xC0000008 STATUS_INVALID_HANDLE</td>
  <td>SecretHandle is not a valid handle.</td>
 </tr></tbody></table>
</dd></dl><p>Processing:</p><p>This message takes five arguments:</p><p><i>SecretHandle</i>: An open handle to a secret object. If
the handle is not a valid context handle to a secret object or <i>SecretHandle</i>.HandleType
does not equal &#34;Secret&#34;, the server MUST return
STATUS_INVALID_HANDLE. The server MUST verify that <i>SecretHandle</i> grants
access as specified in section <span><a href="d1c2802a-70d5-4f81-843c-6523ab0c5e03" data-linktype="relative-path">3.1.4.2.2</a></span> with
RequiredAccess set to SECRET_QUERY_VALUE.<a id="Appendix_A_Target_84"></a><a aria-label="Product behavior note 84" href="2a769a08-e023-459f-aebe-4fb3f595c0b7#Appendix_A_84" data-linktype="relative-path">&lt;84&gt;</a></p><p><i>EncryptedCurrentValue</i>: Used to return the current
value of the secret, encrypted as specified in section <span><a href="cce8ae78-0138-4129-954e-c65e0c0bffed" data-linktype="relative-path">5.1.2</a></span>.
This parameter can be NULL if the caller is not interested in this information.<a id="Appendix_A_Target_85"></a><a aria-label="Product behavior note 85" href="2a769a08-e023-459f-aebe-4fb3f595c0b7#Appendix_A_85" data-linktype="relative-path">&lt;85&gt;</a></p><p><i>CurrentValueSetTime: </i> The time corresponding to the
instant that the current value was last changed. This parameter can be NULL if
the caller is not interested in this information.</p><p><i>EncryptedOldValue</i>: Used to return the old value of
the secret, encrypted as specified in section 5.1.2. This parameter can be NULL
if the caller is not interested in this information.<a id="Appendix_A_Target_86"></a><a aria-label="Product behavior note 86" href="2a769a08-e023-459f-aebe-4fb3f595c0b7#Appendix_A_86" data-linktype="relative-path">&lt;86&gt;</a></p><p><i>OldValueSetTime</i>: The time corresponding to the
instance that the old value was last changed. This parameter can be NULL if the
caller is not interested in this information.</p></div>