Skip to main content
NSPv2Cleanup function

The NSPv2Cleanup function notifies a namespace service provider version-2 (NSPv2) provider that a client session has terminated.

Syntax


int WSAAPI NSPv2Cleanup(
  _In_  LPGUID lpProviderId,
  _In_  LPVOID pvClientSessionArg
);

Parameters

lpProviderId [in]

A pointer to the GUID of the namespace provider to be notified.

pvClientSessionArg [in]

A pointer to the client session.

Return value

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

Error codeMeaning
WSA_NOT_ENOUGH_MEMORY

There is not enough memory available to perform this operation.

WSAEACCES

The calling routine does not have sufficient privileges to initialize the service.

WSAEINVAL

One or more parameters were invalid, or missing, for this provider.

WSAEOPNOTSUPP

The operation is not supported. This error is returned if the namespace provider does not implement this function.

WSASERVICE_NOT_FOUND

Service is unknown. The service cannot be found in the specified namespace.

 

Remarks

The NSPv2Cleanup 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 NSPv2Cleanup function can only be used for operations on NS_EMAIL namespace providers.

The NSPv2Startup function is called each time a new client process begins using namespace provider. Providers may use the client session argument pointed to by the ppvClientSessionArg parameter to store information about this session. If a value was specified for the client session argument in the call to the NSPv2Startup function, then this same client session argument can be passed in the pvClientSessionArg parameter to the NSPv2Cleanup function to notify namespace provider that the client session has terminated.

The NSPv2Cleanup function is called when an application is finished using a Windows Sockets namespace service provider. The NSPv2Cleanup allows the namespace provider to free any of namespace provider resources that were allocated for the client session.

The NSPv2Startup function must be called successfully before calling the NSPv2Cleanup function. It is permissible to make more than one NSPv2Startup call. However, for each NSPv2Startup call, a corresponding NSPv2Cleanup call must also be issued. Only the final NSPv2Cleanup for the service provider does the actual cleanup; the preceding calls decrement an internal reference count in the service provider.

The NSPv2Startup, NSPv2ClientSessionRundown, and NSPv2Cleanup functions are optional, dependent on the requirements of the NSPv2 provider.

If the NSPv2Cleanup function isn't implemented, then calls to that function should be intercepted by a stub function that returns WSAEOPNOTSUPP. The NSPv2 function pointer to the unimplemented NSPv2Cleanup function in the NSPV2_ROUTINE structure should point be to the stub function.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Ws2spi.h

See also

NSPV2_ROUTINE
NSPv2ClientSessionRundown
NSPv2LookupServiceBegin
NSPv2LookupServiceEnd
NSPv2LookupServiceNextEx
NSPv2SetServiceEx
NSPv2Startup
WSAQUERYSET2
WSASetLastError