2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2000-03-26 19:38:32 +00:00
|
|
|
*
|
1998-08-25 04:27:26 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: ntoskrnl/io/event.c
|
|
|
|
* PURPOSE: Implements named events
|
2005-05-09 01:38:29 +00:00
|
|
|
*
|
2005-01-26 13:58:37 +00:00
|
|
|
* PROGRAMMERS: David Welch (welch@mcmail.com)
|
1998-08-25 04:27:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
1998-08-25 04:27:26 +00:00
|
|
|
#include <internal/debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2003-07-10 15:47:00 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2000-10-07 18:44:08 +00:00
|
|
|
PKEVENT STDCALL
|
2000-03-26 19:38:32 +00:00
|
|
|
IoCreateNotificationEvent(PUNICODE_STRING EventName,
|
2000-10-06 16:54:04 +00:00
|
|
|
PHANDLE EventHandle)
|
1998-08-25 04:27:26 +00:00
|
|
|
{
|
2000-10-06 16:54:04 +00:00
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
PKEVENT Event;
|
|
|
|
HANDLE Handle;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
EventName,
|
|
|
|
OBJ_OPENIF,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2005-01-22 12:20:12 +00:00
|
|
|
Status = ZwCreateEvent(&Handle,
|
2000-10-06 16:54:04 +00:00
|
|
|
EVENT_ALL_ACCESS,
|
|
|
|
&ObjectAttributes,
|
2004-10-24 15:26:14 +00:00
|
|
|
NotificationEvent,
|
2000-10-06 16:54:04 +00:00
|
|
|
TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
2000-10-07 18:44:08 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-10-06 16:54:04 +00:00
|
|
|
|
|
|
|
ObReferenceObjectByHandle(Handle,
|
|
|
|
0,
|
|
|
|
ExEventObjectType,
|
|
|
|
KernelMode,
|
2000-10-07 18:44:08 +00:00
|
|
|
(PVOID*)&Event,
|
2000-10-06 16:54:04 +00:00
|
|
|
NULL);
|
|
|
|
ObDereferenceObject(Event);
|
|
|
|
|
|
|
|
*EventHandle = Handle;
|
|
|
|
|
|
|
|
return Event;
|
1998-08-25 04:27:26 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 15:47:00 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2000-10-07 18:44:08 +00:00
|
|
|
PKEVENT STDCALL
|
2000-03-26 19:38:32 +00:00
|
|
|
IoCreateSynchronizationEvent(PUNICODE_STRING EventName,
|
2000-10-06 16:54:04 +00:00
|
|
|
PHANDLE EventHandle)
|
1998-08-25 04:27:26 +00:00
|
|
|
{
|
2000-10-06 16:54:04 +00:00
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
2005-01-22 12:20:12 +00:00
|
|
|
KPROCESSOR_MODE PreviousMode;
|
2000-10-06 16:54:04 +00:00
|
|
|
PKEVENT Event;
|
|
|
|
HANDLE Handle;
|
|
|
|
NTSTATUS Status;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-01-22 12:20:12 +00:00
|
|
|
PreviousMode = ExGetPreviousMode();
|
1998-08-25 04:27:26 +00:00
|
|
|
|
2000-10-06 16:54:04 +00:00
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
2005-01-22 13:34:27 +00:00
|
|
|
EventName,
|
2000-10-06 16:54:04 +00:00
|
|
|
OBJ_OPENIF,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
2005-01-22 12:20:12 +00:00
|
|
|
Status = ZwCreateEvent(&Handle,
|
2000-10-06 16:54:04 +00:00
|
|
|
EVENT_ALL_ACCESS,
|
|
|
|
&ObjectAttributes,
|
2004-10-24 15:26:14 +00:00
|
|
|
SynchronizationEvent,
|
2000-10-06 16:54:04 +00:00
|
|
|
TRUE);
|
2005-01-22 12:20:12 +00:00
|
|
|
|
2000-10-06 16:54:04 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
2000-10-07 18:44:08 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-10-06 16:54:04 +00:00
|
|
|
|
|
|
|
ObReferenceObjectByHandle(Handle,
|
|
|
|
0,
|
|
|
|
ExEventObjectType,
|
|
|
|
KernelMode,
|
2000-10-07 18:44:08 +00:00
|
|
|
(PVOID*)&Event,
|
2000-10-06 16:54:04 +00:00
|
|
|
NULL);
|
|
|
|
ObDereferenceObject(Event);
|
|
|
|
|
|
|
|
*EventHandle = Handle;
|
|
|
|
|
|
|
|
return Event;
|
|
|
|
}
|
2000-03-26 19:38:32 +00:00
|
|
|
|
|
|
|
/* EOF */
|