While Windows Sockets service providers are encouraged to implement sockets as installable file system (IFS) objects, the Windows Sockets architecture also accommodates service providers whose socket handles are not IFS objects. Providers with IFS handles indicate this via the XP1_IFS_HANDLES attribute bit in the WSAPROTOCOL_INFOW struct. (Note: the XP1_IFS_HANDLES attribute bit was not included in release 2.0.8 of the API specification, but has since been added via the errata mechanism.) Windows Sockets SPI clients may take advantage of providers whose socket descriptors are IFS handles by using these descriptors with standard Win32 I/O facilities such as ReadFile and WriteFile.
Whenever an IFS provider creates a new socket descriptor, it is mandatory that the provider call WPUModifyIFSHandle prior to supplying the new handle to a Windows Sockets SPI client. This function takes a provider ID and a proposed IFS handle from the provider as input and returns a (possibly) modified handle. The IFS provider must supply only the modified handle to its client, and all requests from the client will reference only this modified handle. The modified handle is guaranteed to be indistinguishable from the proposed handle as far as the operating system is concerned. Thus in most instances, the service provider will simply choose to use only the modified handle in all of its internal processing. The purpose of this modification function is to allow the WS2_32.DLL to greatly streamline the process of identifying the service provider associated with a given socket.
Providers that do not return IFS handles must obtain a valid handle from the WS2_32.DLLvia the WPUCreateSocketHandle call. The non-IFS provider must offer only a WinSock 2 DLL-supplied handle to its client, and all requests from the client will reference only these handles. As a convenience to service provider implementors, one of the input parameters supplied by a provider in WPUCreateSocketHandle is a DWORD context value. The WS2_32.DLLassociates this context value with the allocated socket handle and allows a service provider to retrieve the context value at any time via the WPUQuerySocketHandleContext call. A typical use for this context value would be to store a pointer to a service provider maintained data structure used to store socket state information.