<div class="content" name="RGetServiceDisplayNameW" uuid="48b42c4a-26b7-4d59-9b7a-98533ebeb730"><p>The RGetServiceDisplayNameW method returns the display name
of the specified service.</p><dl>
<dd>
<div><pre> DWORD RGetServiceDisplayNameW(
   [in] SC_RPC_HANDLE hSCManager,
   [in, string, range(0, SC_MAX_NAME_LENGTH)] 
     wchar_t* lpServiceName,
   [out, string, range(1, 4*1024+1), size_is(*               lpcchBuffer +1)] 
     wchar_t* lpDisplayName,
   [in, out] DWORD* lpcchBuffer
 );
</pre></div>
</dd></dl><p><b>hSCManager: </b>An <span><a href="b5f0a0a8-887c-4097-af1c-71ef9f214ce4" data-linktype="relative-path">SC_RPC_HANDLE (section 2.2.4)</a></span>
data type that defines the handle to the <span><a href="4f66d32e-2f4f-4482-998e-e5ccbb445223#gt_afc3f782-a908-486d-9c05-8a054cd9cc84" data-linktype="relative-path">SCM</a></span> database,
created using one of the open methods specified in section <span><a href="0d7a7011-9f41-470d-ad52-8535b47ac282" data-linktype="relative-path">3.1.4</a></span>.</p><p><b>lpServiceName: </b>A pointer to a null-terminated <b>UNICODE</b>
string that specifies the service name.</p><dl>
<dd>
<p>The forward slash, back slash, comma, and space
characters are illegal in service names.</p>
</dd></dl><p><b>lpDisplayName: </b>A pointer to a buffer that
receives the null-terminated <b>UNICODE</b> string that contains the service
display name.</p><p><b>lpcchBuffer: </b>A <b>DWORD</b> data type that
defines the pointer to a variable that specifies the size, in <span><a href="../ms-dtyp/9e7d8bfc-016c-48b7-95ae-666e103eead4" data-linktype="relative-path">wchar_t</a></span>s,
of the buffer. On output, this variable receives the size of the service&#39;s
display name, excluding the terminating null character.</p><p><b>Return Values: </b>The method returns 0x00000000
(ERROR_SUCCESS) on success; otherwise, it returns one of the following error
codes.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>122 ERROR_INSUFFICIENT_BUFFER</td>
  <td>The display name does not fit in the buffer.</td>
 </tr><tr>
  <td>123 ERROR_INVALID_NAME</td>
  <td>The specified service name is invalid.</td>
 </tr><tr>
  <td>1060 ERROR_SERVICE_DOES_NOT_EXIST</td>
  <td>The service record with the specified ServiceName does not exist in the SCM database identified by the hSCManager parameter.</td>
 </tr></tbody></table>
</dd></dl><p>In response to this request from the client, for a
successful operation the server MUST look up the service record with the
ServiceName matching the specified <i>lpServiceName</i> in the SCM database
identified by the <i>hSCManager</i> parameter. The server MUST return the
DisplayName from the found service record in the <i>lpDisplayName</i> parameter
and set the size in wchar_ts of the display name excluding the terminating null
character in <i>lpcchBuffer</i>.</p><p>If the <i>lpDisplayName</i> buffer is insufficient to hold
the complete display name of the service, the server MUST fail the call with
ERROR_INSUFFICIENT_BUFFER (122) and set the size in wchar_ts of the display
name excluding the terminating null character in <i>lpcchBuffer</i>. If the
size is sufficient for data returned, the server also returns the required size,
in bytes.</p></div>