PostQueuedCompletionStatus function (Windows)

Switch View :
ScriptFree
PostQueuedCompletionStatus function

Applies to: desktop apps only

Posts an I/O completion packet to an I/O completion port.

Syntax

BOOL WINAPI PostQueuedCompletionStatus(
  __in      HANDLE CompletionPort,
  __in      DWORD dwNumberOfBytesTransferred,
  __in      ULONG_PTR dwCompletionKey,
  __in_opt  LPOVERLAPPED lpOverlapped
);

Parameters

CompletionPort [in]

A handle to an I/O completion port to which the I/O completion packet is to be posted.

dwNumberOfBytesTransferred [in]

The value to be returned through the lpNumberOfBytesTransferred parameter of the GetQueuedCompletionStatus function.

dwCompletionKey [in]

The value to be returned through the lpCompletionKey parameter of the GetQueuedCompletionStatus function.

lpOverlapped [in, optional]

The value to be returned through the lpOverlapped parameter of the GetQueuedCompletionStatus function.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError .

Remarks

The I/O completion packet will satisfy an outstanding call to the GetQueuedCompletionStatus function. This function returns with the three values passed as the second, third, and fourth parameters of the call to PostQueuedCompletionStatus. The system does not use or validate these values. In particular, the lpOverlapped parameter need not point to an OVERLAPPED structure.

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Header

IoAPI.h (include Windows.h);
WinBase.h on Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

CreateIoCompletionPort
File Management Functions
GetQueuedCompletionStatus
OVERLAPPED

 

 

Send comments about this topic to Microsoft

Build date: 4/17/2012

Community Content

MicioMax
Wrong values returned by GetQueuedCompletionStatus
<p>The I/O completion packet will satisfy an outstanding call to the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa364986%28v=vs.85%29.aspx"><strong>GetQueuedCompletionStatus</strong></a> function. This function returns with the three values passed as the second, third, and fourth parameters of the call to <strong>PostQueuedCompletionStatus</strong></p><p>is pleinty wrong, GetQueuedCompletionStatus returns 0 for number of bytes (even if specified a different number) and the OVERLAPPED parameter returns non null even if NULL was specified, as least on windows XP.</p><p>The only parameter returned correctly is the key.<strong></strong></p>