#ifndef _NTEXAPI_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)
// Thread execution
NTSYSCALLAPI
NTSTATUS
NTAPI
NtDelayExecution(
_In_ BOOLEAN Alertable,
_In_ PLARGE_INTEGER DelayInterval
);
View code on GitHub
#ifndef _NTZWAPI_H
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwDelayExecution(
_In_ BOOLEAN Alertable,
_In_ PLARGE_INTEGER DelayInterval
);
View code on GitHub
Initiates a sleep on the current thread.
Alertable
- determines whether the sleep should be altertable. This allows external triggers (such as APCs or calls to NtAlertThread
) to interrupt sleep prematurely.DelayInterval
- a pointer to a variable that stores the wait internal. A negative value indicates relative timeout for the specified number of 100-nanosecond intervals. To sleep for a specific number of milliseconds, multiply them by -10,000
. Positive values indicate an absolute time.STATUS_SUCCESS
- the thread woke due to the timeout.STATUS_USER_APC
- the sleep was interrupted by an APC.STATUS_ALERTED
- the sleep was interrupted by a call to NtAlertThread
.STATUS_NO_YIELD_PERFORMED
- a zero-timeout sleep did not cause switching to other threads.Despite the name, NtAlertThreadByThreadId
is unrelated to alertable sleeps and cannot interrupt them.