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)

/**
 * Tests whether the current thread has an alert pending.
 *
 * @return NTSTATUS Successful or errant status.
 */
NTSYSCALLAPI
NTSTATUS
NTAPI
NtTestAlert(
    VOID
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwTestAlert(
    VOID
    );

#endif

View code on GitHub

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