ZwSetEvent function (ntifs.h)

The ZwSetEvent routine sets an event object to a Signaled state and attempts to satisfy as many waits as possible.

Syntax

NTSYSAPI NTSTATUS ZwSetEvent(
  [in]            HANDLE EventHandle,
  [out, optional] PLONG  PreviousState
);

Parameters

[in] EventHandle

A handle to an event object.

[out, optional] PreviousState

An optional pointer to a variable where the previous state of the event object is stored on output.

Return value

ZwSetEvent returns STATUS_SUCCESS or an appropriate error status. Possible error status codes include the following:

Return code Description
STATUS_ACCESS_DENIED
The caller did not have the required privileges to modify the event specified by the EventHandle parameter.
STATUS_INSUFFICIENT_RESOURCES
Resources required by this function could not be allocated.
STATUS_INVALID_HANDLE
The supplied EventHandle parameter was invalid.

Remarks

ZwSetEvent sets an event object to a Signaled state and attempts to satisfy as many waits as possible.

Note  If the call to the ZwSetEvent function occurs in user mode, you should use the name "NtSetEvent" instead of "ZwSetEvent".
 
For calls from kernel-mode drivers, the NtXxx and ZwXxx versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the NtXxx and ZwXxx versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

Requirements

Requirement Value
Minimum supported client Windows XP
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL

See also

IoCreateNotificationEvent

IoCreateSynchronizationEvent

KeClearEvent

KeResetEvent

KeSetEvent

KeWaitForSingleObject

Using Nt and Zw Versions of the Native System Services Routines

ZwClose

ZwCreateEvent

ZwWaitForSingleObject