?? iocreatenotificationevent.txt
字號:
以下是DDK文檔中的關于IoCreateNotificationEvent的描述
這段話中:BasedNamedObjects是錯的,應該改為:
BaseNamedObject
剛剛看了遍,解決了另外的一個疑問
IoCreateNotificationEvent
IoCreateNotificationEvent creates or opens a named notification event used to notify one or more threads of execution that an event has occurred.
PKEVENT
IoCreateNotificationEvent(
IN PUNICODE_STRING EventName,
OUT PHANDLE EventHandle
);
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.
Headers
Declared in wdm.h and ntddk.h. Include wdm.h or ntddk.h.
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.
When a notification event is set to the Signaled state it remains in that state until it is explicitly cleared.
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:
Open the notification event with IoCreateNotificationEvent. Identify the event with the EventName string.
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.
Close the handle to the notification event with ZwClose when access to the event is no longer needed.
Sharing event objects between user mode and kernel mode requires care. The system creates user-mode event objects relative to the \\BasedNamedObjects object directory, and only those event objects are visible to user-mode programs. The Xxx user-mode event corresponds to the \\BasedNamedObjects\Xxx kernel-mode event. The preferred method to share event objects between user mode and kernel mode is for the user-mode program to create the event object and pass it to the driver through an IOCTL. The \\BasedNamedObjects object directory is not created until the Win32® system initializes. Therefore, drivers that are loaded at boot time cannot create event objects in their DriverEntry routines that are visible to user-mode programs.
Callers of IoCreateNotificationEvent must be running at IRQL PASSIVE_LEVEL.
See Also
IoCreateSynchronizationEvent, KeClearEvent, KeResetEvent, KeSetEvent, KeWaitForSingleObject, RtlInitUnicodeString, ZwClose
Built on Wednesday, October 03, 2001
Contact Us | E-Mail this Page | MSDN Flash Newsletter
© 2002 Microsoft Corporation. All rights reserved. Terms of Use Privacy Statement Accessibility
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -