2000-10-06 16:54:04 +00:00
|
|
|
/* $Id: event.c,v 1.3 2000/10/06 16:54:04 ekohl Exp $
|
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
|
|
|
|
* PROGRAMMER: David Welch (welch@mcmail.com)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* Created 22/05/98
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
|
|
|
#include <ddk/ntddk.h>
|
2000-10-06 16:54:04 +00:00
|
|
|
#include <ntos.h>
|
1998-08-25 04:27:26 +00:00
|
|
|
|
|
|
|
#include <internal/debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2000-03-26 19:38:32 +00:00
|
|
|
PKEVENT
|
|
|
|
STDCALL
|
|
|
|
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);
|
|
|
|
|
|
|
|
Status = NtCreateEvent(&Handle,
|
|
|
|
EVENT_ALL_ACCESS,
|
|
|
|
&ObjectAttributes,
|
|
|
|
FALSE,
|
|
|
|
TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ObReferenceObjectByHandle(Handle,
|
|
|
|
0,
|
|
|
|
ExEventObjectType,
|
|
|
|
KernelMode,
|
|
|
|
&Event,
|
|
|
|
NULL);
|
|
|
|
ObDereferenceObject(Event);
|
|
|
|
|
|
|
|
*EventHandle = Handle;
|
|
|
|
|
|
|
|
return Event;
|
1998-08-25 04:27:26 +00:00
|
|
|
}
|
|
|
|
|
2000-03-26 19:38:32 +00:00
|
|
|
PKEVENT
|
|
|
|
STDCALL
|
|
|
|
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;
|
|
|
|
PKEVENT Event;
|
|
|
|
HANDLE Handle;
|
|
|
|
NTSTATUS Status;
|
1998-08-25 04:27:26 +00:00
|
|
|
|
2000-10-06 16:54:04 +00:00
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
EventName,
|
|
|
|
OBJ_OPENIF,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
Status = NtCreateEvent(&Handle,
|
|
|
|
EVENT_ALL_ACCESS,
|
|
|
|
&ObjectAttributes,
|
|
|
|
TRUE,
|
|
|
|
TRUE);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
ObReferenceObjectByHandle(Handle,
|
|
|
|
0,
|
|
|
|
ExEventObjectType,
|
|
|
|
KernelMode,
|
|
|
|
&Event,
|
|
|
|
NULL);
|
|
|
|
ObDereferenceObject(Event);
|
|
|
|
|
|
|
|
*EventHandle = Handle;
|
|
|
|
|
|
|
|
return Event;
|
|
|
|
}
|
2000-03-26 19:38:32 +00:00
|
|
|
|
|
|
|
/* EOF */
|