SetFileCompletionNotificationModes function (winbase.h)

Sets the notification modes for a file handle, allowing you to specify how completion notifications work for the specified file.


BOOL SetFileCompletionNotificationModes(
  [in] HANDLE FileHandle,
  [in] UCHAR  Flags


[in] FileHandle

A handle to the file.

[in] Flags

The modes to be set. One or more modes can be set at the same time; however, after a mode has been set for a file handle, it cannot be removed.

Value Meaning
If the following three conditions are true, the I/O Manager does not queue a completion entry to the port, when it would ordinarily do so. The conditions are:
  • A completion port is associated with the file handle.
  • The file is opened for asynchronous I/O.
  • A request returns success immediately without returning ERROR_PENDING.

When the FileHandle parameter is a socket, this mode is only compatible with Layered Service Providers (LSP) that return Installable File Systems (IFS) handles. To detect whether a non-IFS LSP is installed, use the WSAEnumProtocols function and examine the dwServiceFlag1 member in each returned WSAPROTOCOL_INFO structure. If the XP1_IFS_HANDLES (0x20000) bit is cleared then the specified LSP is not an IFS LSP. Vendors that have non-IFS LSPs are encouraged to migrate to the Windows Filtering Platform (WFP).

The I/O Manager does not set the event for the file object if a request returns with a success code, or the error returned is ERROR_PENDING and the function that is called is not a synchronous function.

If an explicit event is provided for the request, it is still signaled.

Return value

Returns nonzero if successful or zero otherwise.

To get extended error information, call GetLastError.


To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0600 or later. For more information, see Using the Windows Headers.

In Windows 8 and Windows Server 2012, this function is supported by the following technologies.

Technology Supported
Server Message Block (SMB) 3.0 protocol Yes
SMB 3.0 Transparent Failover (TFO) Yes
SMB 3.0 with Scale-out File Shares (SO) Yes
Cluster Shared Volume File System (CsvFS) Yes
Resilient File System (ReFS) Yes


Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

File Management Functions