WSCEnumNameSpaceProviders32 function (ws2spi.h)

The WSCEnumNameSpaceProviders32 function returns information on available 32-bit namespace providers.

Note  This call is a strictly 32-bit version of WSAEnumNameSpaceProviders for use on 64-bit platforms. It is provided to allow 64-bit processes to access the 32-bit catalogs.



INT WSAAPI WSCEnumNameSpaceProviders32(
  [in, out] LPDWORD              lpdwBufferLength,
  [out]     LPWSANAMESPACE_INFOW lpnspBuffer


[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 WSCEnumNameSpaceProviders32 must be sufficient to hold all of the namespace information.

[out] lpnspBuffer

A buffer that is filled with WSANAMESPACE_INFOW 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 WSCEnumNameSpaceProviders32.

Return value

The WSCEnumNameSpaceProviders32 function returns the number of WSANAMESPACE_INFOW 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_INFOW 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.


WSCEnumNameSpaceProviders32 is a strictly 32-bit version of WSAEnumNameSpaceProviders. On a 64-bit computer, all calls not specifically 32-bit (for example, all functions that do not end in "32") operate on the native 64-bit catalog. Processes that execute on a 64-bit computer must use the specific 32-bit function calls to operate on a strictly 32-bit catalog and preserve compatibility. The definitions and semantics of the specific 32-bit calls are the same as their native counterparts.

The 32-bit SPI function is equivalent to the native API function (WSAEnumNameSpaceProviders) because there is no concept of a "hidden" namespace provider.

The WSCEnumNameSpaceProviders32 function is a Unicode only function and returns WSANAMESPACE_INFOEXW structures.


Minimum supported client Windows Vista, Windows XP Professional x64 Edition [desktop apps only]
Minimum supported server Windows Server 2008, Windows Server 2003 x64 Edition [desktop apps only]
Target Platform Windows
Header ws2spi.h
Library Ws2_32.lib
DLL Ws2_32.dll

See also