#ifndef _NTIOAPI_H
//
// Wait completion packet
//
#if (PHNT_VERSION >= PHNT_WINDOWS_8)
/**
* Creates a reusable object for a one-shot association between a waitable target
* and an I/O completion port. Associate it with NtAssociateWaitCompletionPacket;
* creation alone does not queue a notification or begin waiting on a target.
*
* \param[out] WaitCompletionPacketHandle Receives a caller-owned handle; close with NtClose.
* \param[in] DesiredAccess WAIT_COMPLETION_PACKET_SET_STATE (0x1) permits association
* and cancellation. WAIT_COMPLETION_PACKET_ALL_ACCESS is 0x000F0001, without SYNCHRONIZE.
* \param[in, optional] ObjectAttributes Optional name and object attributes; NULL
* creates an unnamed packet, suitable for process-owned completion notifications.
* \return NTSTATUS indicating whether the object was created.
* \remarks This object is distinct from the MemoryReserveIoCompletion object
* accepted by NtSetIoCompletionEx; do not substitute one handle type for the other.
* \sa https://learn.microsoft.com/en-us/windows/win32/devnotes/ntcreatewaitcompletionpacket
*/
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtCreateWaitCompletionPacket(
_Out_ PHANDLE WaitCompletionPacketHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ PCOBJECT_ATTRIBUTES ObjectAttributes
);
View code on GitHub#ifndef _NTZWAPI_H
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwCreateWaitCompletionPacket(
_Out_ PHANDLE WaitCompletionPacketHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ PCOBJECT_ATTRIBUTES ObjectAttributes
);
View code on GitHubNTSTATUS NtCreateWaitCompletionPacket (
_Out_ PHANDLE WaitCompletionPacketHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ POBJECT_ATTRIBUTES ObjectAttributes
)
View the official Win32 development documentationThis function is documented in Windows SDK.
Creates a wait completion packet object with the specified access rights and attributes.
A pointer to a variable that receives the wait completion packet handle.
The desired types of access for the wait completion packet.
A pointer to an object attributes structure.
An NTSTATUS code. For more information, see Using NTSTATUS values.
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.
| Requirement | Value |
|---|---|
| DLL | ntdll.dll |