NtRemoveIoCompletion - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTIOAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
NtRemoveIoCompletion(
    _In_ HANDLE IoCompletionHandle,
    _Out_ PVOID *KeyContext,
    _Out_ PVOID *ApcContext,
    _Out_ PIO_STATUS_BLOCK IoStatusBlock,
    _In_opt_ PLARGE_INTEGER Timeout
    );

#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwRemoveIoCompletion(
    _In_ HANDLE IoCompletionHandle,
    _Out_ PVOID *KeyContext,
    _Out_ PVOID *ApcContext,
    _Out_ PIO_STATUS_BLOCK IoStatusBlock,
    _In_opt_ PLARGE_INTEGER Timeout
    );

#endif

View code on GitHub
NTSTATUS NtRemoveIoCompletion (
    __in HANDLE IoCompletionHandle,
    __out PVOID *KeyContext,
    __out PVOID *ApcContext,
    __out PIO_STATUS_BLOCK IoStatusBlock,
    __in_opt PLARGE_INTEGER Timeout
    )
View the official Win32 development documentation

NtDoc

No description available.

Win32 development documentation (ntremoveiocompletion)

NtRemoveIoCompletion function

Removes an entry from an I/O completion object. If there are currently no entries available, then the calling thread waits for an entry.

Parameters

IoCompletionHandle [in]

A handle to an I/O completion object.

KeyContext [out]

A pointer to a variable that receives the key context that was specified when the I/O completion object was associated with a file object.

ApcContext [out]

A pointer to a variable that receives the context that was specified when the I/O operation was issued.

IoStatusBlock [out]

A pointer to a variable that receives the I/O completion status.

Timeout [in, optional]

A pointer to an optional time out value.

Return value

An NTSTATUS code. For more information, see Using NTSTATUS values.

Remarks

IO_STATUS_BLOCK has the following definition.

typedef struct _IO_STATUS_BLOCK {
    union {
        NTSTATUS Status;
        PVOID Pointer;
    } DUMMYUNIONNAME;

    ULONG_PTR Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;

This function has no associated import library or header file; you must call it using the LoadLibrary and GetProcAddress functions. The API is exported from ntdll.dll.

Requirements

Requirement Value
DLL ntdll.dll

NTinternals.net (undocumented.ntinternals.net)

This function is documented in Windows SDK.


Function NtRemoveIoCompletion is one of waiting calls and it's finished when at least one completion record will be available in specified Io Completion object. Records are added when I/O operation is finished, but previously File object have to been associated with Io Completion object.
Association between File and Io Completion objects is added by call to NtSetInformationFile
with FileCompletionInformation information class. Additionally every association have to have unique Key defined. This functionality allows to use one Io Completion object with different File objects.
Every one File object can have only one Io Completion associated with it.

I/O operations won't be appended to Io Completion object except file operations will be called with non-zero value in ApcContext parameters.

IoCompletionHandle

HANDLE to previously created or opened Io Completion object.

CompletionKey

Receives completion Key informing about File object who finishes I/O.

CompletionValue

Value of ApcContext file operation parameter. CompletionValue informs about operation finished.

IoStatusBlock

Io status of finished operation.

Timeout

Optionally pointer to time out value.

Documented by

See also