Expand Minimize

GetNameByType function

The GetNameByType function retrieves the name of a network service for the specified service type.

Note  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 as follows.

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

Syntax


INT GetNameByType(
  _In_   LPGUID lpServiceType,
  _Out_  LPTSTR lpServiceName,
  _In_   DWORD dwNameLength
);

Parameters

lpServiceType [in]

A pointer to a globally unique identifier (GUID) that specifies the type of the network service. The Svcguid.h header file includes definitions of several GUID service types, and macros for working with them.

The Svcguid.h header file is not automatically included by the Winsock2.h header file.

lpServiceName [out]

A pointer to a buffer to receive a zero-terminated string that uniquely represents the name of the network service.

dwNameLength [in]

A pointer to a variable that, on input, specifies the size, in bytes, of the buffer pointed to by lpServiceName. On output, the variable contains the actual size of the service name string, in bytes.

Return value

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.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Nspapi.h

Library

Mswsock.lib

DLL

Mswsock.dll

Unicode and ANSI names

GetNameByTypeW (Unicode) and GetNameByTypeA (ANSI)

See also

Winsock Reference
Winsock Functions
GetTypeByName

 

 

Community Additions

ADD
Show:
© 2014 Microsoft