NtSetThreadExecutionState - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTPOAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
NtSetThreadExecutionState(
    _In_ EXECUTION_STATE NewFlags, // ES_* flags
    _Out_ EXECUTION_STATE *PreviousFlags
    );

#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwSetThreadExecutionState(
    _In_ EXECUTION_STATE NewFlags, // ES_* flags
    _Out_ EXECUTION_STATE *PreviousFlags
    );

#endif

View code on GitHub

Sets the execution state for the current thread and manages the corresponding power requests that prevent the system from dimming the display or entering sleep.

Parameters

Supported flags

Remarks

You can view the power requests created via this and other APIs via powercfg /requests.

Related Win32 API

See also