<div class="content" name="NetrGetJoinInformation" uuid="12d7af34-9efc-4f39-ab88-a8d8e7bcbdc2"><p>The <b>NetrGetJoinInformation</b> method retrieves details
about the workgroup or <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_b0276eb2-4e65-4cf1-a718-e0920a614aca" data-linktype="relative-path">domain</a>
to which the specified computer is joined.</p><dl>
<dd>
<div><pre> unsigned long NetrGetJoinInformation(
   [in, string, unique] WKSSVC_IMPERSONATE_HANDLE ServerName,
   [in, out, string] wchar_t** NameBuffer,
   [out] PNETSETUP_JOIN_STATUS BufferType
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>A <b>WKSSVC_IMPERSONATE_HANDLE</b>
structure (section <a href="2427e140-22b3-45f8-9e12-1b3593308e46" data-linktype="relative-path">2.2.2.2</a>)
that specifies the <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server
(2)</a>. The <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_60e0e1fa-66fe-41e1-b5e3-ceab97e53506" data-linktype="relative-path">client</a> MUST
map this structure to an <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a>
binding <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_5044babb-08e3-4bb9-bc12-fe8f542b05ee" data-linktype="relative-path">handle</a> (<a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a> sections 4.3.5
and 5.1.5.2). The server MUST ignore this parameter.</p><p><b>NameBuffer: </b>A pointer to the address of the
buffer that receives the name of the domain or workgroup to which the computer
is joined, and that also specifies the <a href="3acf0e02-9bbd-4ce0-a7a0-586bc72d3ef4#gt_9a7bc8b3-3374-4608-8f73-be20a90b898b" data-linktype="relative-path">computer name</a> as input. The
server MUST ignore this parameter on input.</p><p><b>BufferType: </b>A pointer to a value from the <b>NETSETUP_JOIN_STATUS</b>
enumeration (section <a href="64c07967-1eb9-4021-a9a9-fe9995c906e1" data-linktype="relative-path">2.2.3.1</a>)
that specifies the status of a workstation.</p><p><b>Return Values: </b>When the message processing
result meets the description in column two of the following table, this method
MUST return one of the following values (<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>Value/code</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>NERR_Success 0x00000000</td>
  <td>The operation completed successfully.</td>
 </tr><tr>
  <td>ERROR_ACCESS_DENIED 0x00000005</td>
  <td>Access is denied.</td>
 </tr><tr>
  <td>RPC_S_PROTSEQ_NOT_SUPPORTED 0x000006A7</td>
  <td>The RPC protocol sequence is not supported.</td>
 </tr></tbody></table>
</dd></dl><p>Any other return value MUST conform to the error code
requirements in <b>Protocol Details</b> (section <a href="aeea622a-ea3e-40cc-a9b1-b4a2a3b2bf6b" data-linktype="relative-path">3</a>).</p><p>The following statements define the sequence of
message-processing operations.</p><ol><li><p><span>    </span>The server (2)
MUST retrieve the RPC protocol sequence used for the current call (<a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>
section <a href="../ms-rpce/0ceefe4c-0d7a-423f-bcd0-54e821767f89" data-linktype="relative-path">3.1.3.4.1</a>),
specifying the server binding handle maintained by the RPC runtime ([C706]
section 6.2.1). If that RPC protocol sequence is not <b>NCACN_NP</b>, the
server SHOULD return <b>RPC_S_PROTSEQ_NOT_SUPPORTED</b>.<a id="Appendix_A_Target_56"></a><a aria-label="Product behavior note 56" href="def80006-2495-4571-8a93-1668e0f8af31#Appendix_A_56" data-linktype="relative-path">&lt;56&gt;</a></p>
</li><li><p><span>    </span>The server MUST
check that the caller has been granted access rights using the algorithm in the
<b>Access Control Abstract Data Model</b> (section <a href="c5b75090-3de2-404f-8de1-d5ca3fc38a70" data-linktype="relative-path">3.2.1.1</a>), with <i>Access
Request mask</i> initialized to <b>WKSTA_NETAPI_QUERY</b>; if not, the server
MUST return ERROR_ACCESS_DENIED.</p>
</li><li><p><span>    </span>The server MUST
impersonate the client by invoking the <b>StartImpersonatingClient</b> task
(section <a href="719ae534-d5d7-4c42-9989-d63e0676fad1" data-linktype="relative-path">3.2.4.29.6</a>).
If this operation fails, the server MUST return an error.</p>
</li><li><p><span>    </span>The server MUST
compute the response in the following way.</p>
<ul><li><p><span><span>  </span></span>If <b>DomainNameFQDN</b>
(section <a href="e0b508bc-764d-48b7-b44b-4f93c3d5cf8c" data-linktype="relative-path">3.2.1.5</a>) is
set to NULL, <i>BufferType</i> is set to NetSetupUnjoined, and <i>NameBuffer</i>
is set to NULL.</p>
</li><li><p><span><span>  </span></span>Else
if <b>DomainSid</b> is set to NULL, <i>BufferType</i> is set to <b>NetSetupWorkgroupName</b>
(section 2.2.3.1) and <i>NameBuffer</i> is set to <b>DomainNameNetBIOS</b>
(section 3.2.1.5).</p>
</li><li><p><span><span>  </span></span>Else
<i>BufferType</i> is set to <b>NetSetupDomainName</b> (section 2.2.3.1) and <i>NameBuffer</i>
is set to <b>DomainNameFQDN</b>.</p>
</li></ul></li><li><p><span>    </span>The server MUST
stop impersonating the client by invoking the <b>StopImpersonatingClient</b>
task (section <a href="cf258b4a-d66b-4407-85f7-aac7823ec0aa" data-linktype="relative-path">3.2.4.29.7</a>).</p>
</li></ol><p>If no errors occur, the server MUST return NERR_Success.</p></div>