Partager via


3.1.4.20 RGetServiceDisplayNameW (Opnum 20)

The RGetServiceDisplayNameW method returns the display name of the specified service.

 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
 );

hSCManager: An SC_RPC_HANDLE (section 2.2.4) data type that defines the handle to the SCM database, created using one of the open methods specified in section 3.1.4.

lpServiceName: A pointer to a null-terminated UNICODE string that specifies the service name.

The forward slash, back slash, comma, and space characters are illegal in service names.

lpDisplayName: A pointer to a buffer that receives the null-terminated UNICODE string that contains the service display name.

lpcchBuffer: A DWORD data type that defines the pointer to a variable that specifies the size, in wchar_ts, of the buffer. On output, this variable receives the size of the service's display name, excluding the terminating null character.

Return Values: The method returns 0x00000000 (ERROR_SUCCESS) on success; otherwise, it returns one of the following error codes.

Return value/code

Description

122

ERROR_INSUFFICIENT_BUFFER

The display name does not fit in the buffer.

123

ERROR_INVALID_NAME

The specified service name is invalid.

1060

ERROR_SERVICE_DOES_NOT_EXIST

The service record with the specified ServiceName does not exist in the SCM database identified by the hSCManager parameter.

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 lpServiceName in the SCM database identified by the hSCManager parameter. The server MUST return the DisplayName from the found service record in the lpDisplayName parameter and set the size in wchar_ts of the display name excluding the terminating null character in lpcchBuffer.

If the lpDisplayName 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 lpcchBuffer. If the size is sufficient for data returned, the server also returns the required size, in bytes.