#ifndef _NTOBAPI_H
//
// Objects, handles
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)
/**
* Signals or releases one object, then waits on another in one native call.
* This is not a transaction or an atomic handoff guarantee to other threads:
* a wait timeout or APC/alert does not roll back a completed signal operation.
*
* \param SignalHandle Event with EVENT_MODIFY_STATE (0x2), semaphore with
* SEMAPHORE_MODIFY_STATE (0x2), or a mutant owned by the calling thread. No specific
* granted access bit is required for the mutant's release, but ownership is required.
* \param WaitHandle Waitable-object handle requiring SYNCHRONIZE (0x00100000).
* \param Alertable TRUE permits an alert or ordinary user APC to interrupt the wait.
* \param Timeout Optional 100-nanosecond deadline: NULL for no deadline, pointed-to
* zero for polling, negative for a relative interval, positive for absolute NT system time.
* \return On a completed signal, the subsequent wait's status is returned. A signal
* failure such as STATUS_MUTANT_NOT_OWNED or STATUS_SEMAPHORE_LIMIT_EXCEEDED ends
* the call without waiting. Other signal-object types return STATUS_OBJECT_TYPE_MISMATCH.
* \remarks Both handles are referenced, and WaitHandle's SYNCHRONIZE access is
* checked, before signaling on x64. An invalid or inaccessible wait
* handle therefore does not signal the first object. Event signaling sets the event;
* semaphore signaling increments by 1; mutant signaling releases one acquisition.
*
* IMPORTANT: STATUS_ABANDONED (0x80) is ambiguous in this combined call. If the
* signal object is an abandoned mutant not owned by the caller, its release returns
* 0x80 and the wait is never entered: no ownership of the wait object is acquired.
* Alternatively, after a successful signal, waiting on an abandoned mutant returns
* 0x80 and DOES acquire that wait mutant. Do not infer wait-object acquisition from
* 0x80 without distinguishing these paths. STATUS_TIMEOUT (0x102), STATUS_USER_APC
* (0xC0) and STATUS_ALERTED (0x101) also do not prove wait-object acquisition.
* \sa https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-signalobjectandwait
*/
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtSignalAndWaitForSingleObject(
_In_ HANDLE SignalHandle,
_In_ HANDLE WaitHandle,
_In_ BOOLEAN Alertable,
_In_opt_ PLARGE_INTEGER Timeout
);
View code on GitHub#ifndef _NTZWAPI_H
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwSignalAndWaitForSingleObject(
_In_ HANDLE SignalHandle,
_In_ HANDLE WaitHandle,
_In_ BOOLEAN Alertable,
_In_opt_ PLARGE_INTEGER Timeout
);
View code on GitHubNo description available.
Function NtSignalAndWaitForSingleObject signals one object and wait for second object. See also Win32 API SignalObjectAndWait description in Microsoft SDK.
HANDLE to object to signal. Possible object's types are:
HANDLE to object to wait for. Can be any waitable object.
If set, APC Routine can break waiting.
Optionally pointer to LARGE_INTEGER value specifying time (absolute or relative) when function time outs (in 100-ns units). Negative value means relative time.