NtTestAlert - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTPSAPI_H
//
// Threads
//
#if (PHNT_MODE != PHNT_MODE_KERNEL)

/**
 * The NtTestAlert routine indicates whether the current thread has an alert pending
 * and executes asynchronous procedure calls (APCs) queued to the current thread.
 *
 * \return NTSTATUS Successful or errant status.
 * \remarks Tests/consumes the calling thread alert state and provides an opportunity for its pending user APC delivery.
 * The service returns STATUS_ALERTED (0x101) when KeTestAlertThread reports an alert, otherwise
 * STATUS_SUCCESS. It does not dispatch another thread APC merely because some unrelated process calls this
 * service.
 */
_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
NtTestAlert(
    VOID
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

_Kernel_entry_
NTSYSCALLAPI
NTSTATUS
NTAPI
ZwTestAlert(
    VOID
    );

#endif

View code on GitHub

NtDoc

No description available.

NTinternals.net (undocumented.ntinternals.net)

You can use NtTestAlert to empty APC queue for current thread. If APC queue was empty before call, NtTestAlert has no effect.

NtTestAlert is typical ntcall kernel routine, accessible via int 2Eh. It check thread APC queue, and call KiUserApcDispatcher.

Documented by

See also