WSPDeregisterMemory function

WSPDeregisterMemory releases a buffer that was registered by a previous call to the WSPRegisterMemory function.

Syntax

int WSPDeregisterMemory(
  _In_  SOCKET s,
  _In_  HANDLE Handle,
  _Out_ LPINT  lpErrno
);

Parameters

  • s [in]
    Descriptor that identifies a connected socket.

  • Handle [in]
    Handle to the memory buffer that was previously registered.

  • lpErrno [out]
    Pointer to a variable that receives the error code.

Return value

Returns zero if successful; otherwise, returns SOCKET_ERROR and, at lpErrno, the following error code:

Return code Description
WSAEINVAL

The specified handle to the memory buffer does not represent a previously registered memory buffer, or the SAN service provider cannot release the memory, because the memory is currently being used in a data transfer operation.

 

Remarks

The Windows Sockets switch calls the WSPDeregisterMemory function to release a memory buffer that it previously registered in a call to the WSPRegisterMemory function. In the call to WSPDeregisterMemory, the switch passes the same socket descriptor that it supplied to the WSPRegisterMemory function.

A SAN service provider is not required to return a different handle to a memory buffer when the switch makes an additional call to the WSPRegisterMemory function to register that memory buffer for use by another socket. However, the SAN service provider should maintain an internal reference count of the number of registered instances of that memory buffer. Each time that it is called, the WSPDeregisterMemory function should decrement this internal reference count. Only the final call to the WSPDeregisterMemory function, which causes the function to decrement the internal reference count for the buffer to zero, releases all resources that the SAN service provider used to register the memory buffer.

Requirements

Target platform

Desktop

Version

Requires Windows Sockets version 2.2.

Header

Ws2san.h (include Ws2san.h)

See also

WSPMemoryRegistrationCacheCallback

WSPRegisterMemory

 

 

Send comments about this topic to Microsoft