WSAEnumNameSpaceProvidersExA function (winsock2.h)
The WSAEnumNameSpaceProvidersEx function retrieves information on available namespace providers.
Syntax
INT WSAAPI WSAEnumNameSpaceProvidersExA(
[in, out] LPDWORD lpdwBufferLength,
[out] LPWSANAMESPACE_INFOEXA lpnspBuffer
);
Parameters
[in, out] lpdwBufferLength
On input, the number of bytes contained in the buffer pointed to by lpnspBuffer. On output (if the function fails, and the error is WSAEFAULT), the minimum number of bytes to allocate for the lpnspBuffer buffer to allow it to retrieve all the requested information. The buffer passed to WSAEnumNameSpaceProvidersEx must be sufficient to hold all of the namespace information.
[out] lpnspBuffer
A buffer that is filled with WSANAMESPACE_INFOEX structures. The returned structures are located consecutively at the head of the buffer. Variable sized information referenced by pointers in the structures point to locations within the buffer located between the end of the fixed sized structures and the end of the buffer. The number of structures filled in is the return value of WSAEnumNameSpaceProvidersEx.
Return value
The WSAEnumNameSpaceProvidersEx function returns the number of WSANAMESPACE_INFOEX structures copied into lpnspBuffer. Otherwise, the value SOCKET_ERROR is returned, and a specific error number can be retrieved by calling WSAGetLastError.
Error code | Meaning |
---|---|
The lpnspBuffer parameter was a NULL pointer or the buffer length, lpdwBufferLength, was too small to receive all the relevant WSANAMESPACE_INFOEX structures and associated information. When this error is returned, the buffer length required is returned in the lpdwBufferLength parameter. | |
The WS2_32.DLL has not been initialized. The application must first call WSAStartup before calling any Windows Sockets functions. | |
There was insufficient memory to perform the operation. |
Remarks
The WSAEnumNameSpaceProvidersEx function is an enhanced version of the WSAEnumNameSpaceProviders function. The provider-specific data blob associated with the namespace entry passed in the lpProviderInfo parameter to the WSCInstallNameSpaceEx function can be queried using WSAEnumNameSpaceProvidersEx function.
Currently, the only namespace provider included with Windows that sets information in the ProviderSpecific member of the WSANAMESPACE_INFOEX structure is the NS_EMAIL provider. The format of the ProviderSpecific member for an NS_EMAIL namespace provider is a NAPI_PROVIDER_INSTALLATION_BLOB structure.
When UNICODE or _UNICODE is defined, WSAEnumNameSpaceProvidersEx is defined to WSAEnumNameSpaceProvidersExW, the Unicode version of this function. The lpnspBuffer parameter is defined to the LPSAWSANAMESPACE_INFOEXW data type and WSANAMESPACE_INFOEXW structures are returned on success.
When UNICODE or _UNICODE is not defined, WSAEnumNameSpaceProvidersEx is defined to WSAEnumNameSpaceProvidersExA, the ANSI version of this function. The lpnspBuffer parameter is defined to the LPSAWSANAMESPACE_INFOEXA data type and WSANAMESPACE_INFOEXA structures are returned on success.
Windows 8.1 and Windows Server 2012 R2: The WSAEnumNameSpaceProvidersExW function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.
Note
The winsock2.h header defines WSAEnumNameSpaceProvidersEx 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 8.1, Windows Vista [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | winsock2.h |
Library | Ws2_32.lib |
DLL | Ws2_32.dll |