LPNSPV2LOOKUPSERVICEEND callback function (ws2spi.h)

The NSPv2LookupServiceEnd function is called to free the handle after previous calls to NSPv2LookupServiceBegin and NSPv2LookupServiceNextEx.

Syntax

LPNSPV2LOOKUPSERVICEEND Lpnspv2lookupserviceend;

INT Lpnspv2lookupserviceend(
  [in] HANDLE hLookup
)
{...}

Parameters

[in] hLookup

The handle obtained previously by a call to
NSPv2LookupServiceBegin.

Return value

The function should return NO_ERROR (zero) if the routine succeeds. It should return SOCKET_ERROR (that is, 1) if the routine fails and it must set the appropriate error code using WSASetLastError.

Error code Meaning
WSA_INVALID_HANDLE
The handle is not valid.
WSA_NOT_ENOUGH_MEMORY
There is not enough memory available to perform this operation.

Remarks

The NSPv2LookupServiceEnd function is used as part of the namespace service provider version-2 (NSPv2) architecture available on Windows Vista and later.

On Windows Vista and Windows Server 2008, the NSPv2LookupServiceEnd function can only be used for operations on NS_EMAIL namespace providers.

It is possible to receive an NSPv2LookupServiceBegin function call on another thread while processing an NSPv2LookupServiceNextEx. This indicates that the client has canceled the request and the provider should close the handle and return from the NSPv2LookupServiceNextEx function call as well, setting the last error to WSA_E_CANCELLED.

In Windows Sockets 2, conflicting error codes are defined for WSAECANCELLED and WSA_E_CANCELLED. The error code WSAECANCELLED will be removed in a future version and only WSA_E_CANCELLED will remain. Namespace Providers should use the WSA_E_CANCELLED error code to maintain compatibility with the widest possible range of applications.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header ws2spi.h

See also

NSPV2_ROUTINE

NSPv2Cleanup

NSPv2ClientSessionRundown

NSPv2LookupServiceBegin

NSPv2LookupServiceNextEx

NSPv2SetServiceEx

NSPv2Startup

WSAQUERYSET2

WSASetLastError