The WSAEnumNameSpaceProviders function retrieves information on available namespace providers.
INT WSAEnumNameSpaceProvidersW(
LPDWORD lpdwBufferLength,
LPWSANAMESPACE_INFOW lpnspBuffer
)
lpdwBufferLength
Type: LPDWORD
[in, out] 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 pass for the lpnspBuffer to retrieve all the requested information. The buffer passed to WSAEnumNameSpaceProviders must be sufficient to hold all of the namespace information.
lpnspBuffer
Type: LPWSANAMESPACE_INFOW
[out] A buffer that is filled with WSANAMESPACE_INFO 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 WSAEnumNameSpaceProviders.
Type: INT
The WSAEnumNameSpaceProviders function returns the number of WSANAMESPACE_INFO structures copied into lpnspBuffer. Otherwise, the value SOCKET_ERROR is returned, and a specific error number can be retrieved by calling WSAGetLastError.
| Return code | Description |
|---|---|
| WSAEFAULT | The lpnspBuffer parameter was a NULL pointer or the buffer length, lpdwBufferLength, was too small to receive all the relevant WSANAMESPACE_INFO structures and associated information. When this error is returned, the buffer length required is returned in the lpdwBufferLength parameter. |
| WSANOTINITIALISED | The WS2_32.DLL has not been initialized. The application must first call WSAStartup before calling any Windows Sockets functions. |
| WSA_NOT_ENOUGH_MEMORY | There was insufficient memory to perform the operation. |
The WSAEnumNameSpaceProviders function returns information on available namespace providers in the buffer pointed to by the lpnspBuffer parameter. The returned buffer contains an array of WSANAMESPACE_INFO structures located consecutively at the head of the buffer. Variable sized information referenced by pointers in the WSANAMESPACE_INFO structures point to locations within the buffer located between the end of the fixed WSANAMESPACE_INFO structures and the end of the buffer. The number of WSANAMESPACE_INFO structures filled in is returned by the WSAEnumNameSpaceProviders function.
Each WSANAMESPACE_INFO structure entry contains the provider-specific information on the namespace entry passed to the WSCInstallNameSpace and WSCInstallNameSpace32 functions when the namespace provider was installed.
The WSAEnumNameSpaceProvidersEx function is an enhanced version of the WSAEnumNameSpaceProviders function. The WSCEnumNameSpaceProvidersEx32 function is an enhanced version of the WSAEnumNameSpaceProviders function that returns information on available 32-bit namespace providers for use on 64-bit platforms.
The following example demonstrates the use of the WSAEnumNameSpaceProviders function to retrieve information on available namespace providers.
Windows Phone 8: This API is supported.
Header: Declared in winsock2.h.
Library: Use ws2_32.lib.