2005-03-14 02:08:17 +00:00
|
|
|
/*
|
2005-01-07 06:54:27 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
2005-12-29 18:03:24 +00:00
|
|
|
* PROJECT: ReactOS Kernel
|
2005-01-07 06:54:27 +00:00
|
|
|
* FILE: ntoskrnl/ex/evtpair.c
|
|
|
|
* PURPOSE: Support for event pairs
|
2005-12-29 18:03:24 +00:00
|
|
|
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
|
|
|
* Thomas Weidenmueller
|
2005-01-07 06:54:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
|
|
|
#include <ntoskrnl.h>
|
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2005-01-07 06:54:27 +00:00
|
|
|
|
2005-11-28 23:25:31 +00:00
|
|
|
#if defined (ALLOC_PRAGMA)
|
|
|
|
#pragma alloc_text(INIT, ExpInitializeEventPairImplementation)
|
|
|
|
#endif
|
|
|
|
|
2005-01-07 06:54:27 +00:00
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
2005-06-21 23:42:58 +00:00
|
|
|
POBJECT_TYPE ExEventPairObjectType = NULL;
|
2005-01-07 06:54:27 +00:00
|
|
|
|
2005-12-29 18:03:24 +00:00
|
|
|
GENERIC_MAPPING ExEventPairMapping =
|
|
|
|
{
|
2012-09-02 22:06:42 +00:00
|
|
|
STANDARD_RIGHTS_READ | SYNCHRONIZE,
|
|
|
|
STANDARD_RIGHTS_WRITE | SYNCHRONIZE,
|
2005-03-14 02:08:17 +00:00
|
|
|
STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE,
|
2005-12-29 18:03:24 +00:00
|
|
|
EVENT_PAIR_ALL_ACCESS
|
|
|
|
};
|
2005-01-07 06:54:27 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2012-09-03 01:12:58 +00:00
|
|
|
BOOLEAN
|
2005-03-14 02:08:17 +00:00
|
|
|
INIT_FUNCTION
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
ExpInitializeEventPairImplementation(VOID)
|
|
|
|
{
|
2005-12-29 18:03:24 +00:00
|
|
|
OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
|
|
|
|
UNICODE_STRING Name;
|
2012-09-03 01:12:58 +00:00
|
|
|
NTSTATUS Status;
|
2005-12-29 18:03:24 +00:00
|
|
|
DPRINT("Creating Event Pair Object Type\n");
|
|
|
|
|
|
|
|
/* Create the Event Pair Object Type */
|
|
|
|
RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
|
|
|
|
RtlInitUnicodeString(&Name, L"EventPair");
|
|
|
|
ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
|
|
|
|
ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEVENT_PAIR);
|
|
|
|
ObjectTypeInitializer.GenericMapping = ExEventPairMapping;
|
|
|
|
ObjectTypeInitializer.PoolType = NonPagedPool;
|
|
|
|
ObjectTypeInitializer.ValidAccessMask = EVENT_PAIR_ALL_ACCESS;
|
|
|
|
ObjectTypeInitializer.UseDefaultObject = TRUE;
|
2012-09-02 22:06:42 +00:00
|
|
|
ObjectTypeInitializer.InvalidAttributes = OBJ_OPENLINK;
|
2012-09-03 01:12:58 +00:00
|
|
|
Status = ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &ExEventPairObjectType);
|
|
|
|
if (!NT_SUCCESS(Status)) return FALSE;
|
|
|
|
return TRUE;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
NTSTATUS
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtCreateEventPair(OUT PHANDLE EventPairHandle,
|
2005-03-14 02:08:17 +00:00
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
2005-01-07 06:54:27 +00:00
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
PKEVENT_PAIR EventPair;
|
|
|
|
HANDLE hEventPair;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
2009-08-26 17:31:02 +00:00
|
|
|
NTSTATUS Status;
|
2005-03-14 02:08:17 +00:00
|
|
|
PAGED_CODE();
|
2005-07-04 22:11:00 +00:00
|
|
|
DPRINT("NtCreateEventPair: 0x%p\n", EventPairHandle);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-12-29 18:03:24 +00:00
|
|
|
/* Check if we were called from user-mode */
|
2009-08-26 17:31:02 +00:00
|
|
|
if (PreviousMode != KernelMode)
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
|
|
|
/* Enter SEH Block */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
|
|
|
/* Check handle pointer */
|
2005-08-21 17:38:07 +00:00
|
|
|
ProbeForWriteHandle(EventPairHandle);
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2009-08-26 17:31:02 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Return the exception code */
|
|
|
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2005-03-14 02:08:17 +00:00
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Create the Object */
|
|
|
|
DPRINT("Creating EventPair\n");
|
|
|
|
Status = ObCreateObject(PreviousMode,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
ObjectAttributes,
|
|
|
|
PreviousMode,
|
|
|
|
NULL,
|
|
|
|
sizeof(KEVENT_PAIR),
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
(PVOID*)&EventPair);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Check for Success */
|
2009-08-26 17:31:02 +00:00
|
|
|
if (NT_SUCCESS(Status))
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2013-04-04 20:11:17 +00:00
|
|
|
/* Initialize the Event */
|
2005-03-14 02:08:17 +00:00
|
|
|
DPRINT("Initializing EventPair\n");
|
|
|
|
KeInitializeEventPair(EventPair);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Insert it */
|
|
|
|
Status = ObInsertObject((PVOID)EventPair,
|
|
|
|
NULL,
|
|
|
|
DesiredAccess,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
&hEventPair);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Check for success */
|
|
|
|
if (NT_SUCCESS(Status))
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Enter SEH */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Return the handle */
|
2005-03-14 02:08:17 +00:00
|
|
|
*EventPairHandle = hEventPair;
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Get the exception code */
|
2008-11-24 13:40:26 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2005-03-14 02:08:17 +00:00
|
|
|
}
|
|
|
|
}
|
2005-02-28 17:40:15 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return Status */
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
NTSTATUS
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtOpenEventPair(OUT PHANDLE EventPairHandle,
|
2005-03-14 02:08:17 +00:00
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
2005-01-07 06:54:27 +00:00
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
HANDLE hEventPair;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
2009-08-26 17:31:02 +00:00
|
|
|
NTSTATUS Status;
|
2005-03-14 02:08:17 +00:00
|
|
|
PAGED_CODE();
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-12-29 18:03:24 +00:00
|
|
|
/* Check if we were called from user-mode */
|
2009-08-26 17:31:02 +00:00
|
|
|
if (PreviousMode != KernelMode)
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
|
|
|
/* Enter SEH Block */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
|
|
|
/* Check handle pointer */
|
2005-08-21 17:38:07 +00:00
|
|
|
ProbeForWriteHandle(EventPairHandle);
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2009-08-26 17:31:02 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Return the exception code */
|
|
|
|
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2005-03-14 02:08:17 +00:00
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Open the Object */
|
|
|
|
Status = ObOpenObjectByName(ObjectAttributes,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
PreviousMode,
|
2006-05-25 20:50:58 +00:00
|
|
|
NULL,
|
2005-03-14 02:08:17 +00:00
|
|
|
DesiredAccess,
|
|
|
|
NULL,
|
|
|
|
&hEventPair);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Check for success */
|
|
|
|
if (NT_SUCCESS(Status))
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Enter SEH */
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_TRY
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Return the handle */
|
2005-03-14 02:08:17 +00:00
|
|
|
*EventPairHandle = hEventPair;
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_EXCEPT(ExSystemExceptionFilter())
|
2005-12-29 18:03:24 +00:00
|
|
|
{
|
2009-08-26 17:31:02 +00:00
|
|
|
/* Get the exception code */
|
2008-11-24 13:40:26 +00:00
|
|
|
Status = _SEH2_GetExceptionCode();
|
2005-12-29 18:03:24 +00:00
|
|
|
}
|
2008-11-24 13:40:26 +00:00
|
|
|
_SEH2_END;
|
2005-03-14 02:08:17 +00:00
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
NTSTATUS
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtSetHighEventPair(IN HANDLE EventPairHandle)
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
PKEVENT_PAIR EventPair;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
2005-07-04 22:11:00 +00:00
|
|
|
DPRINT("NtSetHighEventPair(EventPairHandle 0x%p)\n", EventPairHandle);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Open the Object */
|
|
|
|
Status = ObReferenceObjectByHandle(EventPairHandle,
|
|
|
|
SYNCHRONIZE,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
PreviousMode,
|
|
|
|
(PVOID*)&EventPair,
|
|
|
|
NULL);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Check for Success */
|
2005-12-29 18:03:24 +00:00
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Set the Event */
|
|
|
|
KeSetEvent(&EventPair->HighEvent, EVENT_INCREMENT, FALSE);
|
|
|
|
|
|
|
|
/* Dereference Object */
|
|
|
|
ObDereferenceObject(EventPair);
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
NTSTATUS
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle)
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
PKEVENT_PAIR EventPair;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
2005-12-29 18:03:24 +00:00
|
|
|
DPRINT("NtSetHighWaitLowEventPair(Handle 0x%p)\n", EventPairHandle);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Open the Object */
|
|
|
|
Status = ObReferenceObjectByHandle(EventPairHandle,
|
|
|
|
SYNCHRONIZE,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
PreviousMode,
|
|
|
|
(PVOID*)&EventPair,
|
|
|
|
NULL);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Check for Success */
|
2005-12-29 18:03:24 +00:00
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Set the Event */
|
|
|
|
KeSetEvent(&EventPair->HighEvent, EVENT_INCREMENT, FALSE);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Wait for the Other one */
|
|
|
|
KeWaitForSingleObject(&EventPair->LowEvent,
|
|
|
|
WrEventPair,
|
|
|
|
PreviousMode,
|
|
|
|
FALSE,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Dereference Object */
|
|
|
|
ObDereferenceObject(EventPair);
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
NTSTATUS
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtSetLowEventPair(IN HANDLE EventPairHandle)
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
PKEVENT_PAIR EventPair;
|
2005-12-29 18:03:24 +00:00
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
2005-03-14 02:08:17 +00:00
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
2005-07-04 22:11:00 +00:00
|
|
|
DPRINT1("NtSetHighEventPair(EventPairHandle 0x%p)\n", EventPairHandle);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Open the Object */
|
|
|
|
Status = ObReferenceObjectByHandle(EventPairHandle,
|
|
|
|
SYNCHRONIZE,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
PreviousMode,
|
|
|
|
(PVOID*)&EventPair,
|
|
|
|
NULL);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Check for Success */
|
2005-12-29 18:03:24 +00:00
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Set the Event */
|
|
|
|
KeSetEvent(&EventPair->LowEvent, EVENT_INCREMENT, FALSE);
|
|
|
|
|
|
|
|
/* Dereference Object */
|
|
|
|
ObDereferenceObject(EventPair);
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2005-12-29 18:03:24 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle)
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
PKEVENT_PAIR EventPair;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
2005-12-29 18:03:24 +00:00
|
|
|
DPRINT("NtSetHighWaitLowEventPair(Handle 0x%p)\n", EventPairHandle);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Open the Object */
|
|
|
|
Status = ObReferenceObjectByHandle(EventPairHandle,
|
|
|
|
SYNCHRONIZE,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
PreviousMode,
|
|
|
|
(PVOID*)&EventPair,
|
|
|
|
NULL);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Check for Success */
|
2005-12-29 18:03:24 +00:00
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Set the Event */
|
|
|
|
KeSetEvent(&EventPair->LowEvent, EVENT_INCREMENT, FALSE);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Wait for the Other one */
|
|
|
|
KeWaitForSingleObject(&EventPair->HighEvent,
|
|
|
|
WrEventPair,
|
|
|
|
PreviousMode,
|
|
|
|
FALSE,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Dereference Object */
|
|
|
|
ObDereferenceObject(EventPair);
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
NTSTATUS
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtWaitLowEventPair(IN HANDLE EventPairHandle)
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
PKEVENT_PAIR EventPair;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
|
|
|
NTSTATUS Status;
|
|
|
|
PAGED_CODE();
|
2005-12-29 18:03:24 +00:00
|
|
|
DPRINT("NtSetHighWaitLowEventPair(Handle 0x%p)\n", EventPairHandle);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Open the Object */
|
|
|
|
Status = ObReferenceObjectByHandle(EventPairHandle,
|
|
|
|
SYNCHRONIZE,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
PreviousMode,
|
|
|
|
(PVOID*)&EventPair,
|
|
|
|
NULL);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Check for Success */
|
2005-12-29 18:03:24 +00:00
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Wait for the Event */
|
|
|
|
KeWaitForSingleObject(&EventPair->LowEvent,
|
|
|
|
WrEventPair,
|
|
|
|
PreviousMode,
|
|
|
|
FALSE,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Dereference Object */
|
|
|
|
ObDereferenceObject(EventPair);
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2005-01-07 06:54:27 +00:00
|
|
|
}
|
|
|
|
|
2005-05-09 01:38:29 +00:00
|
|
|
NTSTATUS
|
2005-12-29 18:03:24 +00:00
|
|
|
NTAPI
|
2005-01-07 06:54:27 +00:00
|
|
|
NtWaitHighEventPair(IN HANDLE EventPairHandle)
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
PKEVENT_PAIR EventPair;
|
|
|
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
|
|
|
NTSTATUS Status;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
PAGED_CODE();
|
2005-12-29 18:03:24 +00:00
|
|
|
DPRINT("NtSetHighWaitLowEventPair(Handle 0x%p)\n", EventPairHandle);
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Open the Object */
|
|
|
|
Status = ObReferenceObjectByHandle(EventPairHandle,
|
|
|
|
SYNCHRONIZE,
|
|
|
|
ExEventPairObjectType,
|
|
|
|
PreviousMode,
|
|
|
|
(PVOID*)&EventPair,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Check for Success */
|
2005-12-29 18:03:24 +00:00
|
|
|
if(NT_SUCCESS(Status))
|
|
|
|
{
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Wait for the Event */
|
|
|
|
KeWaitForSingleObject(&EventPair->HighEvent,
|
|
|
|
WrEventPair,
|
|
|
|
PreviousMode,
|
|
|
|
FALSE,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Dereference Object */
|
|
|
|
ObDereferenceObject(EventPair);
|
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-03-14 02:08:17 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2005-02-28 17:40:15 +00:00
|
|
|
}
|
|
|
|
|
2005-01-07 06:54:27 +00:00
|
|
|
/* EOF */
|