GetNameByTypeA function (nspapi.h)
The GetNameByType function retrieves the name of a network service for the specified service type.
Syntax
INT GetNameByTypeA(
[in] LPGUID lpServiceType,
[out] LPSTR lpServiceName,
[in] DWORD dwNameLength
);
Parameters
[in] lpServiceType
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.
[out] lpServiceName
A pointer to a buffer to receive a zero-terminated string that uniquely represents the name of the network service.
[in] dwNameLength
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.
Remarks
Note
The nspapi.h header defines GetNameByType as an alias that 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 is 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 |