<div class="content"><p> </p><p>The NetprNameCanonicalize method converts a name to the
canonical format for the specified type.</p><dl>
<dd>
<div><pre> NET_API_STATUS NetprNameCanonicalize(
   [in, string, unique] SRVSVC_HANDLE ServerName,
   [in, string] WCHAR* Name,
   [out, size_is(OutbufLen)] WCHAR* Outbuf,
   [in, range(0,64000)] DWORD OutbufLen,
   [in] DWORD NameType,
   [in] DWORD Flags
 );
</pre></div>
</dd></dl><p><b>ServerName: </b>An <span><a href="5f8329ee-1965-4ea1-ad35-3b29fbb63232" data-linktype="relative-path">SRVSVC_HANDLE (section 2.2.1.1)</a></span>
pointer that identifies the <span><a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_434b0234-e970-4e8c-bdfa-e16a30d96703" data-linktype="relative-path">server</a></span>. The <span><a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_60e0e1fa-66fe-41e1-b5e3-ceab97e53506" data-linktype="relative-path">client</a></span>
MUST map this structure to an <span><a href="1709f6a7-efb8-4ded-b7ae-5cee9ee36320#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a></span> binding handle
(see <span><a href="https://go.microsoft.com/fwlink/?LinkId=89824" data-linktype="external">[C706]</a></span> sections
4.3.5 and 5.1.5.2). The server MUST ignore this parameter.</p><p><b>Name: </b>A pointer to a null-terminated UTF-16
string specifying the name to canonicalize.</p><p><b>Outbuf: </b>A pointer to a null-terminated UTF-16 string
that is the buffer where the canonicalized name is returned.</p><p><b>OutbufLen: </b>The length of output buffer <i>Outbuf</i>.
The value of this field MUST be within the range 0 through 64,000, inclusive.</p><p><b>NameType: </b>The type of <i>Name</i>, as
specified in section <span><a href="2e2d2fb6-3448-4213-94b3-89dcb772d3e6" data-linktype="relative-path">2.2.2.8</a></span>.</p><p><b>Flags: </b>A bitmask that MUST contain the bitwise
OR of zero or more of the following values that specify controlling flags.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x80000000</p>
  </td>
  <td>
  <p>LM2.x compatible name canonicalization.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x00000001</p>
  </td>
  <td>
  <p>If set, the method requires the length of the output
  buffer to be sufficient to hold any name of the specified type. Otherwise,
  the buffer length only needs to be large enough to hold the canonicalized
  version of the input name that is specified in this invocation of the method.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>Return Values: </b>The method returns 0x00000000
(NERR_Success) to indicate success; otherwise, it returns a nonzero error code.
The method can take 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>.
</p><p>In response to a NetprNameCanonicalize message, the server
MUST convert the value of the <i>Name</i> parameter to one of the canonical
forms that are defined in section 2.2.2.8.</p><p>The <i>NameType</i> parameter determines what needs to be
done on the name that is specified by the <i>Name</i> parameter to convert it
to a canonical format. Valid values for the <i>NameType</i> parameter are as
specified in Name Types (section 2.2.2.8). If the <i>NameType</i>
parameter does not have a valid value, the server MUST fail the call with an
ERROR_INVALID_PARAMETER error code.</p><p>The <i>Flags</i> parameter is a bitmask that specifies
certain controlling flags that affect how the server processes this message.
The valid bits are 0x80000000 and 0x1. If any other bit is set, the server MUST
fail the call with an ERROR_INVALID_PARAMETER error code.</p><p>If (<i>Flags</i> &amp; 0x80000000) is true, it implies that
the server MUST perform an NTLM version 2.x–compatible canonicalization. As the
following table specifies, some <i>NameTypes</i> have different rules about how
to define a canonical name for those types on NTLM version 2.x. </p><p>The server MUST validate the <i>Name</i> (as specified by
the <span><a href="218631f6-d0fa-40d9-b454-c25bf4306dcf" data-linktype="relative-path">NetprNameValidate</a></span>
method) to ensure that it is a valid name of type <i>NameType</i>. If
validation fails, the server MUST fail the call with ERROR_INVALID_NAME. </p><p>The server MUST use the <i>NameType</i> parameter to
determine the maximum length of any name for that type (as specified in the
following table). If (Flags &amp; 0x1) is true and the length of the output
buffer specified by the <i>OutBufLen</i> parameter is not greater than or equal
to the maximum length of any name for that type, the server MUST fail the call
with an NERR_BufTooSmall error code.</p><p>The canonicalization process then truncates the <i>Name</i>
so that the length is no greater than the maximum length for that type,
converting the name to uppercase if needed. The following table specifies the
maximum length for each NameType and whether the server converts names to
uppercase. The second column in the table specifies the behavior when (Flags
&amp; 0x80000000) is true, and the third column specifies the behavior when it
is false.</p><table><thead>
  <tr>
   <th>
   <p>NameType</p>
   </th>
   <th>
   <p>Max name length for NTLM 2.x mode / Uppercase</p>
   </th>
   <th>
   <p>Max name length otherwise / Uppercase</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>NAMETYPE_USER</p>
  <p>1</p>
  </td>
  <td>
  <p>20/YES</p>
  </td>
  <td>
  <p>256/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_PASSWORD</p>
  <p>2</p>
  </td>
  <td>
  <p>14/NO</p>
  </td>
  <td>
  <p>256/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_GROUP</p>
  <p>3</p>
  </td>
  <td>
  <p>20/YES</p>
  </td>
  <td>
  <p>256/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_COMPUTER</p>
  <p>4</p>
  </td>
  <td>
  <p>15/YES</p>
  </td>
  <td>
  <p>259/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_EVENT</p>
  <p>5</p>
  </td>
  <td>
  <p>16/YES</p>
  </td>
  <td>
  <p>16/YES</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_DOMAIN</p>
  <p>6</p>
  </td>
  <td>
  <p>15/YES</p>
  </td>
  <td>
  <p>15/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_SERVICE</p>
  <p>7</p>
  </td>
  <td>
  <p>15/YES</p>
  </td>
  <td>
  <p>80/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_NET</p>
  <p>8</p>
  </td>
  <td>
  <p>259/YES</p>
  </td>
  <td>
  <p>259/YES</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_SHARE</p>
  <p>9</p>
  </td>
  <td>
  <p>12/YES</p>
  </td>
  <td>
  <p>80/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_MESSAGE</p>
  <p>10</p>
  </td>
  <td>
  <p>259/YES</p>
  </td>
  <td>
  <p>259/YES</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_MESSAGEDEST</p>
  <p>11</p>
  </td>
  <td>
  <p>259/YES</p>
  </td>
  <td>
  <p>259/YES</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_SHAREPASSWORD</p>
  <p>12</p>
  </td>
  <td>
  <p>8/NO</p>
  </td>
  <td>
  <p>8/NO</p>
  </td>
 </tr><tr>
  <td>
  <p>NAMETYPE_WORKGROUP</p>
  <p>13</p>
  </td>
  <td>
  <p>15/YES</p>
  </td>
  <td>
  <p>15/NO</p>
  </td>
 </tr></tbody></table><p>The server MAY<a id="Appendix_A_Target_122"></a><a aria-label="Product behavior note 122" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_122" data-linktype="relative-path">&lt;122&gt;</a>
enforce security measures to verify that the caller has the required
permissions to execute this call. If the server enforces these security
measures and the caller does not have the required credentials, the server
SHOULD<a id="Appendix_A_Target_123"></a><a aria-label="Product behavior note 123" href="ebb74ff2-abb1-4e1b-a76a-563a5cbbea9a#Appendix_A_123" data-linktype="relative-path">&lt;123&gt;</a> fail the call.</p></div>