WSAGetServiceClassNameByClassIdW

The WSAGetServiceClassNameByClassId function retrieves the name of the service associated with the specified type. This name is the generic service name, like FTP or SNA, and not the name of a specific instance of that service.

Syntax

INT WSAGetServiceClassNameByClassIdW(
         LPGUID lpServiceClassId,
         LPWSTR lpszServiceClassName,
         LPDWORD lpdwBufferLength
)  

Parameters

lpServiceClassId
Type: LPGUID 

[in]

A pointer to the GUID for the service class.

lpszServiceClassName
Type: LPWSTR 

[out]

A pointer to the service name.

lpdwBufferLength
Type: LPDWORD 

[in, out]

On input, the length of the buffer returned by lpszServiceClassName, in characters. On output, the length of the service name copied into lpszServiceClassName, in characters.

Return value

Type: INT 

The WSAGetServiceClassNameByClassId function returns a value of zero if successful. Otherwise, the value SOCKET_ERROR is returned, and a specific error number can be retrieved by calling WSAGetLastError.

Return codes
Return code Description
WSA_INVALID_PARAMETER The lpServiceClassId parameter specified is invalid.
WSA_NOT_ENOUGH_MEMORY There was insufficient memory to perform the operation.
WSAEACCES The calling routine does not have sufficient privileges to access the information.
WSAEFAULT The specified buffer pointed to by lpszServiceClassName is too small. Pass in a larger buffer.
WSAENOBUFS No buffer space available.
WSAEOPNOTSUPP The operation is not supported for the type of object referenced. This error is returned by some namespace providers that do not support getting service class information.
WSANO_DATA The lpServiceClassId is valid, but no data of the requested type was found.
WSANOTINITIALISED The WS2_32.DLL has not been initialized. The application must first call WSAStartup before calling any Windows Sockets functions.

Requirements

Header: Declared in winsock2.h.

Library: Use ws2_32.lib.