2006-06-30 16:56:18 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
1998-08-25 04:27:26 +00:00
|
|
|
* FILE: ntoskrnl/io/event.c
|
2006-06-30 16:56:18 +00:00
|
|
|
* PURPOSE: I/O Wrappers for the Executive Event Functions
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
|
|
|
* Eric Kohl
|
1998-08-25 04:27:26 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
1998-08-25 04:27:26 +00:00
|
|
|
|
2006-06-30 16:56:18 +00:00
|
|
|
/* PRIVATE FUNCTIONS *********************************************************/
|
|
|
|
|
|
|
|
PKEVENT
|
|
|
|
NTAPI
|
|
|
|
IopCreateEvent(IN PUNICODE_STRING EventName,
|
|
|
|
IN PHANDLE EventHandle,
|
|
|
|
IN EVENT_TYPE Type)
|
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
|
|
PKEVENT Event;
|
|
|
|
HANDLE Handle;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
|
|
|
|
|
|
|
/* Initialize the object attributes */
|
|
|
|
InitializeObjectAttributes(&ObjectAttributes,
|
|
|
|
EventName,
|
2008-05-12 13:42:05 +00:00
|
|
|
OBJ_OPENIF | OBJ_KERNEL_HANDLE,
|
2006-06-30 16:56:18 +00:00
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Create the event */
|
|
|
|
Status = ZwCreateEvent(&Handle,
|
|
|
|
EVENT_ALL_ACCESS,
|
|
|
|
&ObjectAttributes,
|
|
|
|
Type,
|
|
|
|
TRUE);
|
|
|
|
if (!NT_SUCCESS(Status)) return NULL;
|
|
|
|
|
|
|
|
/* Get a handle to it */
|
[NTOSKRNL]
Coverity code defects fixes :
- Cache: CID 701441
- Config: CIDs 716570, 716669, 716760
- Dbgk: Kdbg: CIDs 716571, 515128/9, 500432
- Ex: CIDs 500156/7, 515122, 716200/67, 701301, 514669
- Fsrtl: Fstub: CIDs 701341/2, 701288, 716770, 701302, and CIDs 716576/7/8 + 514636 + 716805 thanks to Thomas Faber
- Io: CIDs 514576, 514643, 514672/3, 716203, 716269, 716581, 716591, 716713
- Ke: CIDs 515125, 716592
- Ps: CIDs 716603/4, 701422
- Ob: Po: CIDs 514671/680, 701419/420/421, 716763, 716601/2
All the details are given in the different bug reports.
CORE-6677 CORE-6679 CORE-6680 CORE-6683 CORE-6686 CORE-6692 CORE-6693 CORE-6694 CORE-6695 CORE-6696 #comment Committed in rev.57400 #resolve #close
svn path=/trunk/; revision=57400
2012-09-27 17:16:31 +00:00
|
|
|
Status = ObReferenceObjectByHandle(Handle,
|
|
|
|
0,
|
|
|
|
ExEventObjectType,
|
|
|
|
KernelMode,
|
|
|
|
(PVOID*)&Event,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
ZwClose(Handle);
|
|
|
|
return NULL;
|
|
|
|
}
|
2006-06-30 16:56:18 +00:00
|
|
|
|
|
|
|
/* Dereference the extra count, and return the handle */
|
|
|
|
ObDereferenceObject(Event);
|
|
|
|
*EventHandle = Handle;
|
|
|
|
return Event;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PUBLIC FUNCTIONS **********************************************************/
|
1998-08-25 04:27:26 +00:00
|
|
|
|
2003-07-10 15:47:00 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2006-06-30 16:56:18 +00:00
|
|
|
PKEVENT
|
|
|
|
NTAPI
|
|
|
|
IoCreateNotificationEvent(IN PUNICODE_STRING EventName,
|
|
|
|
IN PHANDLE EventHandle)
|
1998-08-25 04:27:26 +00:00
|
|
|
{
|
2006-06-30 16:56:18 +00:00
|
|
|
/* Call the internal API */
|
|
|
|
return IopCreateEvent(EventName, EventHandle, NotificationEvent);
|
1998-08-25 04:27:26 +00:00
|
|
|
}
|
|
|
|
|
2003-07-10 15:47:00 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2006-06-30 16:56:18 +00:00
|
|
|
PKEVENT
|
|
|
|
NTAPI
|
|
|
|
IoCreateSynchronizationEvent(IN PUNICODE_STRING EventName,
|
|
|
|
IN PHANDLE EventHandle)
|
1998-08-25 04:27:26 +00:00
|
|
|
{
|
2006-06-30 16:56:18 +00:00
|
|
|
/* Call the internal API */
|
|
|
|
return IopCreateEvent(EventName, EventHandle, SynchronizationEvent);
|
2000-10-06 16:54:04 +00:00
|
|
|
}
|
2000-03-26 19:38:32 +00:00
|
|
|
|
|
|
|
/* EOF */
|