WSAGetServiceClassNameByClassIdW function (winsock2.h)

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 WSAAPI WSAGetServiceClassNameByClassIdW(
  LPGUID  lpServiceClassId,
  LPWSTR  lpszServiceClassName,
  LPDWORD lpdwBufferLength
);

Parameters

lpServiceClassId

A pointer to the GUID for the service class.

lpszServiceClassName

A pointer to the service name.

lpdwBufferLength

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

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.

Error code Meaning
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.

Remarks

Note

The winsock2.h header defines WSAGetServiceClassNameByClassId as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header winsock2.h
Library Ws2_32.lib
DLL Ws2_32.dll

See also

WSAStartup

Winsock Functions

Winsock Reference