IoCreateNotificationEvent

PKEVENT
    IoCreateNotificationEvent(

        IN PUNICODE_STRING  EventName,
        OUT PHANDLE  EventHandle
        );

IoCreateNotificationEvent creates or opens a named notification event used to notify one or more threads of execution that an event has occurred. When a notification event is set to the Signaled state it remains in that state until it is explicitly cleared.

Parameters

EventName
Points to a buffer containing a zero-terminated Unicode string that names the event.
EventHandle
Points to a location in which to return a handle for the event object. The handle includes bookkeeping information, such as a reference count and security context.

Return Value

IoCreateNotificationEvent returns a pointer to the created or opened event object or NULL if the event object could not be created or opened.

Comments

IoCreateNotificationEvent creates and opens the event object if it does not already exist. IoCreateNotificationEvent sets the state of a new notification event to Signaled. If the event object already exists, IoCreateNotificationEvent just opens the event object.

Notification events, like synchronization events, are used to coordinate execution. Unlike a synchronization event, a notification event is not auto-resetting. Once a notification event is in the Signaled state, it remains in that state until it is explicitly reset (with a call to KeClearEvent or KeResetEvent).

To synchronize on a notification event:

  1. Open the notification event with IoCreateNotificationEvent. Identify the event with the EventName string.

  2. Wait for the event to be signaled by calling KeWaitForSingleObject with the PKEVENT returned by IoCreateNotificationEvent. More than one thread of execution can wait on a given notification event. To poll instead of stall, specify a Timeout of zero to KeWaitForSingleObject.

  3. Close the handle to the notification event with ZwClose when access to the event is no longer needed.

Callers of IoCreateNotificationEvent must be running at IRQL PASSIVE_LEVEL.

See Also

IoCreateSynchronizationEvent, KeClearEvent, KeResetEvent, KeSetEvent, KeWaitForSingleObject, RtlInitUnicodeString, ZwClose