Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
SetFileCompletionNotificationModes API causes an IO completion port not work correctly with a non-IFS LSP installed
Article ID: 2568167 - View products that this article applies to.
Some applications may conflict with non-IFS Winsock Base Service Providers (BSP)s or Layered Service Providers (LSPs). An application creates an I/O completion port and associates it with a socket, and calls SetFileCompletionNotificationModes with the flag FILE_SKIP_COMPLETION_PORT_ON_SUCCESS on the socket handle. For any subsequent asynchronous Winsock calls on that socket with an OVERLAPPED structure passed, the application will not see completions for those Winsock function calls over the associated I/O completion port.
Note: This issue only affects applications running on Windows Vista and higher, as this new IOCP flag (FILE_SKIP_COMPLETION_PORT_ON_SUCCESS) was only added in Vista.
Non-IFS Winsock BSPs or LSPs are not compatible with the FILE_SKIP_COMPLETION_PORT_ON_SUCCESS flag. The incompatibility results in any asynchronous Winsock calls used by the socket with OVERLAPPED passed to not work correctly when non-IFS Winsock BSPs or LSPs have been installed. All Winsock BSPs supplied by Microsoft use IFS handles and third-party BSPs are very uncommon. So this problem results primarily from non-IFS LSPs being installed.
Not specifying the FILE_SKIP_COMPLETION_PORT_ON_SUCCESS flag or removing any non-IFS Winsock LSPs installed.
Also moving from a non-IFS LSP to Windows Filter Platform (WFP) can resolve this issue.
To determine if a non-IFS BSP or LSP is installed, use the "netsh WinSock Show Catalog" command and look at every "Winsock Catalog Provider Entry" returned. If the "Service Flags" value has the 0x20000 bit set then the provider uses IFS handles and will work fine. If the 0x20000 bit is clear (not set), then it is a non-IFS BSP or LSP. To programmatically determine if a non-IFS BSP or LSP is installed, enumerate the available protocols using the WSCEnumerateProtocols function, and in each returned WSAPROTOCOL_INFO structure check the dwServiceFlag1 member and see if the XP1_IFS_HANDLES flag (0x20000) is set. The Windows SDK documentation for the WSCEnumProtocols function includes source code for an example program that shows how this can be done.
1. The "Service Flags" value was introduced in the netsh command on Windows 7 and Windows Server 2008 R2. Therefore the check using the netsh command doesn't work on Windows Vista or Windows Server 2008.
2. The WSCEnumerateProtocols function can be used to retrieve WSAPROTOCOL_INFOW structures and the dwServiceFlag1 member to discover if IFS/non-IFS BSPs or LSPs are installed. The WSCEnumerateProtocols function is supported on Windows 2000 and higher.
(http://go.microsoft.com/fwlink/?LinkId=151500)for other considerations.