NtWaitForSingleObject function (winternl.h)

Deprecated. Waits until the specified object attains a state of signaled. NtWaitForSingleObject is superseded by WaitForSingleObject.


NTSTATUS NtWaitForSingleObject(
  [in] HANDLE         Handle,
  [in] BOOLEAN        Alertable,
  [in] PLARGE_INTEGER Timeout


[in] Handle

The handle to the wait object.

[in] Alertable

Specifies whether an alert can be delivered when the object is waiting.


The alert can be delivered.


The alert cannot be delivered.

[in] Timeout

A pointer to an absolute or relative time over which the wait is to occur. Can be null. If a timeout is specified, and the object has not attained a state of signaled when the timeout expires, then the wait is automatically satisfied. If an explicit timeout value of zero is specified, then no wait occurs if the wait cannot be satisfied immediately.

Return value

The wait completion status. The various NTSTATUS values are defined in NTSTATUS.H, which is distributed with the Windows DDK.

Return code Description
The specified object satisfied the wait.
A timeout occurred.
The wait was aborted to deliver an alert to the current thread.
The wait was aborted to deliver a user Asynchronous Procedure Call (APC) to the current thread.


Because there is no import library for this function, you must use GetProcAddress.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winternl.h
DLL Ntdll.dll