The ZwOpenEvent routine opens a handle to an existing named event object with the specified desired access.
NTSYSCALLAPI NTSTATUS ZwOpenEvent( PHANDLE EventHandle, ACCESS_MASK DesiredAccess, POBJECT_ATTRIBUTES ObjectAttributes );
A pointer to a variable that will receive the event object handle. The handle includes bookkeeping information, such as a reference count and security context.
The ACCESS_MASK value that represents the desired types of access for the event object. The following table contains the event-specific ACCESS_MASK values.
|EVENT_QUERY_STATE||Query the state of the event object.|
|EVENT_MODIFY_STATE||Modify the state of the event object.|
|EVENT_ALL_ACCESS||All possible access rights to the event object.|
A pointer to the object attributes structure that the caller supplied to be used for the specified object. These attributes would include the ObjectName and the handle attributes, for example. This parameter is initialized by calling the InitializeObjectAttributes macro.
ZwOpenEvent returns STATUS_SUCCESS or an appropriate error status. This routine might return one of the following error status codes:
||Resources that this function requires could not be allocated.|
||The ObjectAttributes structure was not supplied or contained an invalid parameter value.|
||The ObjectAttributes parameter contained an ObjectName in the OBJECT_ATTRIBUTES structure that was invalid.|
||The object path contained incorrect syntax. For example, the ObjectAttributes parameter does not contain a RootDirectory member, but the ObjectName member in the OBJECT_ATTRIBUTES structure is an empty string or does not start with an OBJECT_NAME_PATH_SEPARATOR character.|
||The path to the object was not found, indicating that it does not exist.|
||The object name was not found, indicating that the object does not exist.|
||The caller did not have the required privilege to create a handle with the access specified in the DesiredAccess parameter.|
ZwOpenEvent opens an existing named event object and creates a handle to the object with the specified desired access.
ZwOpenEvent can open either notification or synchronization events.
Events are used to coordinate execution. File system drivers can use events to enable a caller to wait for completion of the requested operation until the given event is set to the Signaled state.
Notification events can be used to notify one or more threads of execution that an event has occurred. Synchonization events can be used in the serialization of access to hardware between two otherwise unrelated drivers.
|Minimum supported client||Available starting with Windows Server 2003.|
|Header||wdm.h (include Wdm.h)|
|DDI compliance rules||PowerIrpDDis, HwStorPortProhibitedDDIs|