<div class="content"><p> </p><p>The NetrDfsAddStdRoot (Opnum 12) method creates a new <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_701a2cc1-eb5a-400f-b394-5bad264ec8f6" data-linktype="relative-path">stand-alone
DFS namespace</a></span>.<a id="Appendix_A_Target_118"></a><a aria-label="Product behavior note 118" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_118" data-linktype="relative-path">&lt;118&gt;</a><a id="Appendix_A_Target_119"></a><a aria-label="Product behavior note 119" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_119" data-linktype="relative-path">&lt;119&gt;</a></p><p>The NetrDfsAddStdRoot method uses the following <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_9c5903c1-1477-4181-b451-3ba1e34a0c0c" data-linktype="relative-path">MIDL</a></span>
syntax.</p><dl>
<dd>
<div><pre> NET_API_STATUS NetrDfsAddStdRoot(
   [in, string] WCHAR* ServerName,
   [in, string] WCHAR* RootShare,
   [in, string] WCHAR* Comment,
   [in] DWORD ApiFlags
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>The pointer to a null-terminated <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_c305d0ab-8b94-461a-bd76-13b40cb8c4d8" data-linktype="relative-path">Unicode</a></span>
string. This is the host name of the new <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_ac90b498-3ba4-48d6-bcd6-5495f1654671" data-linktype="relative-path">DFS root target</a></span>. </p><p><b>RootShare: </b>The pointer to a null-terminated
Unicode string. This is the new DFS root target <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_3c179f10-1793-4268-96eb-de4d85a32060" data-linktype="relative-path">share name</a></span> as well
as the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_76c9958a-125f-41b6-ae65-6663f270f873" data-linktype="relative-path">DFS namespace name</a></span>.
The <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_a49a79ea-dac7-4016-9a84-cf87161db7e3" data-linktype="relative-path">share</a></span>
MUST already exist.</p><p><b>Comment: </b>The pointer to a null-terminated
Unicode string that contains a comment associated with the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_6a3f0be9-b9b4-49df-9d1c-a3b89e4e9890" data-linktype="relative-path">DFS
namespace</a></span>. Used for informational purposes, this string has no
protocol-specified restrictions on length or content. The comment is meant for
human consumption and does not affect server functionality. This parameter MAY
be a NULL pointer.</p><p><b>ApiFlags: </b>This parameter is reserved for
future use and is ignored by the server.</p><p><b>Return Values: </b>The method MUST return 0 on
success and a nonzero error code on failure. The method can return any specific
error code value, as specified in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>
section <span><a href="../ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d" data-linktype="relative-path">2.2</a></span>.
The most common error codes are listed in the following table.</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>Successful completion.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000005</p>
  <p>ERROR_ACCESS_DENIED</p>
  </td>
  <td>
  <p>Permission to perform the operation was denied.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000050</p>
  <p>ERROR_FILE_EXISTS</p>
  </td>
  <td>
  <p>The DFS namespace that the <i>ServerName</i> and <i>RootShare</i>
  parameters specify already exists.<a id="Appendix_A_Target_120"></a><a aria-label="Product behavior note 120" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_120" data-linktype="relative-path">&lt;120&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>0x000000B7</p>
  <p>ERROR_ALREADY_EXISTS</p>
  </td>
  <td>
  <p>The DFS namespace that the <i>ServerName</i> and <i>RootShare</i>
  parameters specify already exists.<a id="Appendix_A_Target_121"></a><a aria-label="Product behavior note 121" href="3a466440-1ef6-4439-b4e2-be9eaddeb511#Appendix_A_121" data-linktype="relative-path">&lt;121&gt;</a></p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000906</p>
  <p>NERR_NetNameNotFound</p>
  </td>
  <td>
  <p>The share that the <i>RootShare</i> parameter
  specifies does not already exist.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p>On receiving this method, the server MUST do the following:</p><ul><li><p><span><span> 
</span></span>If there is any entry in the <b>NamespaceList</b> with the <b>NamespaceName</b>
matching <i>RootShare</i>, then the <span><a href="a9bc4403-a862-48b9-b99b-1b44a887d177#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> method MUST fail
with either ERROR_FILE_EXISTS (0x00000050) or ERROR_ALREADY_EXISTS
(0x000000B7).</p>
</li><li><p><span><span> 
</span></span>If the share that the <i>RootShare</i> parameter specifies does
not already exist, the RPC method MUST fail with NERR_NetNameNotFound
(0x00000906).</p>
</li><li><p><span><span> 
</span></span>Create the <b>Namespace</b> object, and insert it into the <b>NamespaceList</b>.
The <b>Namespace</b> object MUST be initialized as follows.</p>
<ul><li><p><span><span>  </span></span><b>Namespace.NamespaceName</b>
is set to <i>RootShare</i>.</p>
</li><li><p><span><span>  </span></span><b>Namespace.NamespaceType</b>
is set to stand-alone.</p>
</li><li><p><span><span>  </span></span><b>Namespace.GenerationGUID</b>
is set with a GUID.</p>
</li><li><p><span><span>  </span></span>Create
a <b>NamespaceElement</b> object and insert it into <b>Namespace.NamespaceElementsList</b>.</p>
</li><li><p><span><span>  </span></span><b>NamespaceElementsList.NamespaceElement</b>
is initialized as follows.</p>
<ul><li><p><span><span> 
</span></span><b>NamespaceElement.Properties</b> is set to 0.</p>
</li><li><p><span><span> 
</span></span><b>NamespaceElement.State</b> is set to DFS_VOLUME_STATE_OK.</p>
</li><li><p><span><span> 
</span></span><b>NamespaceElement.Comment</b> is set to <b>Comment</b>.</p>
</li><li><p><span><span> 
</span></span><b>NamespaceElement.ReferralTTL</b> is set to 300 seconds.</p>
</li><li><p><span><span> 
</span></span><b>NamespaceElement.SecurityDescriptor</b> is set to none.</p>
</li><li><p><span><span> 
</span></span>Create a <b>Target</b> object, insert it into <b>NamespaceElement.TargetsList</b>
and update <b>TargetsList.TargetCount</b> to 1.</p>
</li><li><p><span><span> 
</span></span><b>TargetsList.Target</b> object is initialized as follows.</p>
<ul><li><p><span><span> 
</span></span><b>Target.PriorityRank</b> is set to 0.</p>
</li><li><p><span><span> 
</span></span><b>Target.PriorityClass</b> is set to DfsSiteCostNormalPriorityClass.</p>
</li><li><p><span><span> 
</span></span><b>Target.State</b> is set to DFS_STORAGE_STATE_ONLINE.</p>
</li><li><p><span><span> 
</span></span><b>Target.ServerName</b> is set to <i>ServerName</i>.</p>
</li><li><p><span><span> 
</span></span><b>Target.ShareName</b> is set to <i>RootShare</i>.</p>
</li></ul></li></ul></li></ul></li><li><p><span><span> 
</span></span>The server MUST synchronously insert the <b>Namespace</b> object
into the local information store.</p>
</li></ul></div>