GetTypeByNameA function (nspapi.h)

The GetTypeByName function retrieves a service type GUID for a network service specified by name.

Note  The GetTypeByName 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, this reference material is included. The functions detailed in Protocol-Independent Name Resolution provide equivalent functionality in Windows Sockets 2.
 

Syntax

INT GetTypeByNameA(
  [in]      LPSTR  lpServiceName,
  [in, out] LPGUID lpServiceType
);

Parameters

[in] lpServiceName

A pointer to a zero-terminated string that uniquely represents the name of the service. For example, "MY SNA SERVER."

[in, out] lpServiceType

A pointer to a variable to receive 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.

Return value

If the function succeeds, the return value is zero.

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

Value Meaning
ERROR_SERVICE_DOES_NOT_EXIST
The specified service type is unknown.

Remarks

Note

The nspapi.h header defines GetTypeByName 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

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header nspapi.h
Library Mswsock.lib
DLL Mswsock.dll

See also

GetNameByType

Winsock Functions

Winsock Reference