<div class="content" name="R_DhcpV4QueryPolicyEnforcement" uuid="948d06f5-efd7-42f9-a596-fa216a113e0b"><p>The <b>R_DhcpV4QueryPolicyEnforcement</b> method is used to
retrieve the state (enabled/disabled) of policy enforcement on the server or
the specified IPv4 subnet.</p><dl>
<dd>
<div><pre> DWORD R_DhcpV4QueryPolicyEnforcement(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] BOOL ServerPolicy,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [out] BOOL* Enabled
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused.</p><p><b>ServerPolicy: </b>This Boolean type indicates if
the policy enforcement state of the server can be returned.</p><p><b>SubnetAddress: </b>This is of type <a href="5122557b-b85d-4982-8ffb-98d8d934e353" data-linktype="relative-path">DHCP_IP_ADDRESS (section 2.2.1.2.1)</a>,
which contains the IPv4 subnet ID for which the policy enforcement state can be
returned. This parameter is ignored if <i>ServerPolicy</i> parameter is TRUE.</p><p><b>Enabled: </b>This out parameter is a pointer to a
Boolean type and indicates the state of policy enforcement. The memory for this
must be allocated by the caller.</p><p><b>Return Values: </b>A 32-bit unsigned integer value
that indicates return status. A return value ERROR_SUCCESS (0x00000000)
indicates operation was completed successfully. Otherwise, it contains a Win32
error code, as specified in <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.
This error code value can correspond to a DHCP specific failure, which takes a
value between 20000 and 20099, or any generic failure.</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 call was successful.</td>
 </tr><tr>
  <td>0x00004E25 ERROR_DHCP_SUBNET_NOT_PRESENT</td>
  <td>The specified IPv4 subnet does not exist.</td>
 </tr></tbody></table>
</dd></dl><p>The opnum field value for this method is 106.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>If <i>ServerPolicy</i> parameter is TRUE and the <i>SubnetAddress</i>
parameter is not NULL or if the <i>ServerPolicy</i> parameter is FALSE and the <i>SubnetAddress</i>
parameter is NULL, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Validate whether this method is authorized for read access as
specified in section <a href="baec2112-1146-4c42-b77e-b706e170a590" data-linktype="relative-path">3.5.4</a>.
If not, return ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>If <i>ServerPolicy</i> parameter is TRUE retrieve the server ADM
element <b>DHCPv4ServerPolicyEnforcement</b>. Assign the value in the <b>DHCPv4PolicyEnforcement</b>
ADM element to the out parameter <i>Enabled</i>. Return ERROR_SUCCESS.</p>
</li><li><p><span><span> 
</span></span>If <i>ServerPolicy</i> parameter is FALSE, retrieve the server
ADM element <b>DHCPv4ScopesList</b>. Retrieve the <b>DHCPv4Scope</b> ADM
element entry corresponding to the <i>SubnetAddress</i> parameter from <b>DHCPv4ScopesList</b>
ADM element. If the <b>DHCPv4Scope</b> ADM element entry is not present, return
ERROR_DHCP_SUBNET_NOT_PRESENT.</p>
</li><li><p><span><span> 
</span></span>Retrieve the <b>DHCPv4Scope.DHCPv4ScopePolicyEnforcement</b> ADM
element for the retrieved <b>DHCPv4Scope</b> ADM element. Assign the value in <b>DHCPv4ScopePolicyEnforcement</b>
ADM element to the out parameter <i>Enabled</i></p>
</li><li><p><span><span> 
</span></span>Return ERROR_SUCCESS.</p>
</li></ul><p><b>Exceptions Thrown:</b> No exceptions are thrown beyond
those thrown by the underlying RPC protocol specified in <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p></div>