GetNameByType

Important The GetNameByType function is a Microsoft-specific extension to the Windows Sockets 1.1 specification. This function is obsolete. For the convenience of Windows Sockets 1.1 developers, the reference material is below.

The functions detailed in Protocol-Independent Name Resolution provide equivalent functionality in Windows Sockets 2.

The GetNameByType function obtains the name of a network service. The network service is specified by its service type.

INT GetNameByType(
  LPGUID lpServiceType,  // points to network service type GUID
  LPTSTR lpServiceName,  // points to buffer to receive name of 
                         // network service
  DWORD dwNameLength     // points to variable that specifies buffer 
                         // size
);
 

Parameters

lpServiceType
Points to a globally unique identifier (GUID) that specifies the type of the network service. The header file SVCGUID.H includes definitions of several GUID service types, and macros for working with them.
lpServiceName
Points to a buffer to receive a zero-terminated string that uniquely represents the name of the network service.
dwNameLength
Points to a variable that, on input, specifies the size of the buffer pointed to by lpServiceName. On output, the variable contains the actual size of the service name string.

Return Values

If the function succeeds, the return value is not SOCKET_ERROR ( –1).

If the function fails, the return value is SOCKET_ERROR ( –1). To get extended error information, call GetLastError.

QuickInfo

  Windows NT: Yes
  Windows CE: Unsupported.
  Header: Declared in nspapi.h.
  Import Library: Link with wsock32.lib.

See Also

GetTypeByName