<div class="content" name="R_DhcpSetSubnetInfo" uuid="6549f5e9-2b6b-40b3-8902-9ae9a93b541a"><p>The <b>R_DhcpSetSubnetInfo</b> method sets/modifies the
information about an IPv4 subnet defined on the DHCPv4 server.</p><dl>
<dd>
<div><pre> DWORD R_DhcpSetSubnetInfo(
   [in, unique, string] DHCP_SRV_HANDLE ServerIpAddress,
   [in] DHCP_IP_ADDRESS SubnetAddress,
   [in, ref] LPDHCP_SUBNET_INFO SubnetInfo
 );
</pre></div>
</dd></dl><p><b>ServerIpAddress: </b>The IP address/host name of
the DHCP server. This parameter is unused. </p><p><b>SubnetAddress: </b>This is of type <a href="5122557b-b85d-4982-8ffb-98d8d934e353" data-linktype="relative-path">DHCP_IP_ADDRESS</a>, a <a href="../ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2" data-linktype="relative-path">DWORD</a>
structure containing the IPv4 subnet ID for which the subnet information is
modified.</p><p><b>SubnetInfo: </b>This is a pointer to a <a href="e25ab58d-3e8b-4530-8ed8-8338850278ef" data-linktype="relative-path">DHCP_SUBNET_INFO (section 2.2.1.2.8)</a>
structure that contains the information of the IPv4 subnet that is modified in
the existing IPv4 subnet identified by <i>SubnetAddress</i>. The <a href="51e16f4a-cb1d-400a-85c7-defe4cba1609" data-linktype="relative-path">DHCP_HOST_INFO (section 2.2.1.2.7)</a>
structure (referred by <b>PrimaryHost</b>) stored in <i>SubnetInfo</i> MUST be
ignored by both the caller and the server.</p><dl>
<dd>
<p>This method does not perform any checks to ensure
that the <b>SubnetState</b> field in <b>SubnetInfo</b> is as specified in <a href="03ebc39d-3f99-4b33-9f57-2f00ae9d3e33" data-linktype="relative-path">DHCP_SUBNET_STATE (section 2.2.1.1.2)</a>.
It is the caller&#39;s responsibility to ensure that a valid <b>SubnetState</b>
value is passed to this method in <b>SubnetInfo</b>. If <b>SubnetState</b> does
not contain a valid value, as specified in DHCP_SUBNET_STATE), the behavior is
undefined.</p>
</dd></dl><p><b>Return Values: </b>A 32-bit unsigned integer value
that indicates the return status. A return value of ERROR_SUCCESS (0x00000000)
indicates that the operation was completed successfully, else 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>0x00004E2D ERROR_DHCP_JET_ERROR</td>
  <td>An error occurred while accessing the DHCP server database.</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 1.</p><p>When processing this call, the DHCP server MUST do the
following:</p><ul><li><p><span><span> 
</span></span>Validate whether this method is authorized for read/write access
per section <a href="38840bd0-0a5a-47ed-bc69-0dd870d33aec" data-linktype="relative-path">3.5.5</a>. If
not, return ERROR_ACCESS_DENIED.</p>
</li><li><p><span><span> 
</span></span>If the <i>SubnetInfo</i> input parameter is NULL, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the <i>SubnetAddress</i> input field is not the same as the <b>SubnetAddress</b>
member of the <i>SubnetInfo</i> input field, return ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>If the bitwise AND operation of the <i>SubnetAddress</i> input
field with the <b>SubnetMask</b> member of the <i>SubnetInfo</i> input field is
not the same as <i>SubnetAddress</i> input field, return
ERROR_INVALID_PARAMETER.</p>
</li><li><p><span><span> 
</span></span>Retrieve the server ADM element <b>DHCPv4Scope</b> entry
corresponding to the <i>SubnetAddress</i> from the <b>DHCPv4ScopesList</b>
server ADM element.</p>
</li><li><p><span><span> 
</span></span>If the <b>DHCPv4Scope</b> entry corresponding to <i>SubnetAddress</i>
is not found, return ERROR_DHCP_SUBNET_NOT_PRESENT.</p>
</li><li><p><span><span> 
</span></span>Modify the <b>DHCPv4Scope.ScopeInfo</b> ADM element with
information in <i>SubnetInfo</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>