mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Implemented NtSignalAndWaitForSingleObject()
svn path=/trunk/; revision=1491
This commit is contained in:
parent
240c9da1da
commit
58f7f41275
2 changed files with 112 additions and 40 deletions
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
/* $Id: zw.h,v 1.39 2000/12/23 02:37:36 dwelch Exp $
|
/* $Id: zw.h,v 1.40 2001/01/02 00:46:10 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -4844,31 +4844,30 @@ ZwUnmapViewOfSection(
|
||||||
/* --- OBJECT SYNCHRONIZATION --- */
|
/* --- OBJECT SYNCHRONIZATION --- */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Signals an event and wait for it to be signaled again.
|
* FUNCTION: Signals an object and wait for an other one.
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
* EventHandle = Handle to the event that should be signaled
|
* SignalObject = Handle to the object that should be signaled
|
||||||
* Alertable = True if the wait is alertable
|
* WaitObject = Handle to the object that should be waited for
|
||||||
|
* Alertable = True if the wait is alertable
|
||||||
* Time = The time to wait
|
* Time = The time to wait
|
||||||
* NumberOfWaitingThreads = Number of waiting threads
|
|
||||||
* RETURNS: Status
|
* RETURNS: Status
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtSignalAndWaitForSingleObject(
|
NtSignalAndWaitForSingleObject(
|
||||||
IN HANDLE EventHandle,
|
IN HANDLE SignalObject,
|
||||||
IN BOOLEAN Alertable,
|
IN HANDLE WaitObject,
|
||||||
IN PLARGE_INTEGER Time,
|
IN BOOLEAN Alertable,
|
||||||
PULONG NumberOfWaitingThreads OPTIONAL
|
IN PLARGE_INTEGER Time
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
ZwSignalAndWaitForSingleObject(
|
NtSignalAndWaitForSingleObject(
|
||||||
IN HANDLE EventHandle,
|
IN HANDLE SignalObject,
|
||||||
IN BOOLEAN Alertable,
|
IN HANDLE WaitObject,
|
||||||
IN PLARGE_INTEGER Time,
|
IN BOOLEAN Alertable,
|
||||||
PULONG NumberOfWaitingThreads OPTIONAL
|
IN PLARGE_INTEGER Time
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4880,7 +4879,7 @@ ZwSignalAndWaitForSingleObject(
|
||||||
* Alertable = If true the wait is alertable.
|
* Alertable = If true the wait is alertable.
|
||||||
* Time = The maximum wait time.
|
* Time = The maximum wait time.
|
||||||
* REMARKS:
|
* REMARKS:
|
||||||
* This function maps to the win32 WaitForMultipleObjectEx.
|
* This function maps to the win32 WaitForMultipleObjectEx.
|
||||||
* RETURNS: Status
|
* RETURNS: Status
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -4902,6 +4901,7 @@ ZwWaitForMultipleObjects (
|
||||||
IN BOOLEAN Alertable,
|
IN BOOLEAN Alertable,
|
||||||
IN PLARGE_INTEGER Time
|
IN PLARGE_INTEGER Time
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Waits for an object to become signalled.
|
* FUNCTION: Waits for an object to become signalled.
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -4909,7 +4909,7 @@ ZwWaitForMultipleObjects (
|
||||||
* Alertable = If true the wait is alertable.
|
* Alertable = If true the wait is alertable.
|
||||||
* Time = The maximum wait time.
|
* Time = The maximum wait time.
|
||||||
* REMARKS:
|
* REMARKS:
|
||||||
* This function maps to the win32 WaitForSingleObjectEx.
|
* This function maps to the win32 WaitForSingleObjectEx.
|
||||||
* RETURNS: Status
|
* RETURNS: Status
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -4949,7 +4949,12 @@ ZwWaitHighEventPair(
|
||||||
IN HANDLE EventPairHandle
|
IN HANDLE EventPairHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FUNCTION: Waits for the low part of an eventpair to become signalled
|
||||||
|
* ARGUMENTS:
|
||||||
|
* EventPairHandle = Handle to the event pair.
|
||||||
|
* RETURNS: Status
|
||||||
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
NtWaitLowEventPair(
|
NtWaitLowEventPair(
|
||||||
|
|
|
@ -677,11 +677,78 @@ NTSTATUS STDCALL NtWaitForSingleObject (IN HANDLE Object,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL NtSignalAndWaitForSingleObject (IN HANDLE EventHandle,
|
NTSTATUS STDCALL
|
||||||
IN BOOLEAN Alertable,
|
NtSignalAndWaitForSingleObject(IN HANDLE SignalObject,
|
||||||
IN PLARGE_INTEGER Time,
|
IN HANDLE WaitObject,
|
||||||
PULONG
|
IN BOOLEAN Alertable,
|
||||||
NumberOfWaitingThreads OPTIONAL)
|
IN PLARGE_INTEGER Time)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
KPROCESSOR_MODE ProcessorMode;
|
||||||
|
DISPATCHER_HEADER* hdr;
|
||||||
|
PVOID SignalObj;
|
||||||
|
PVOID WaitObj;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
ProcessorMode = CURRENT_KPCR->CurrentThread->PreviousMode;
|
||||||
|
Status = ObReferenceObjectByHandle(SignalObject,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
ProcessorMode,
|
||||||
|
&SignalObj,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ObReferenceObjectByHandle(WaitObject,
|
||||||
|
SYNCHRONIZE,
|
||||||
|
NULL,
|
||||||
|
ProcessorMode,
|
||||||
|
&WaitObj,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(SignalObj);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
hdr = (DISPATCHER_HEADER *)SignalObj;
|
||||||
|
switch (hdr->Type)
|
||||||
|
{
|
||||||
|
case InternalNotificationEvent:
|
||||||
|
case InternalSynchronizationEvent:
|
||||||
|
KeSetEvent(SignalObj,
|
||||||
|
EVENT_INCREMENT,
|
||||||
|
TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case InternalMutexType:
|
||||||
|
KeReleaseMutex(SignalObj,
|
||||||
|
TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case InternalSemaphoreType:
|
||||||
|
KeReleaseSemaphore(SignalObj,
|
||||||
|
SEMAPHORE_INCREMENT,
|
||||||
|
1,
|
||||||
|
TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ObDereferenceObject(SignalObj);
|
||||||
|
ObDereferenceObject(WaitObj);
|
||||||
|
return STATUS_OBJECT_TYPE_MISMATCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = KeWaitForSingleObject(WaitObj,
|
||||||
|
UserRequest,
|
||||||
|
ProcessorMode,
|
||||||
|
Alertable,
|
||||||
|
Time);
|
||||||
|
|
||||||
|
ObDereferenceObject(SignalObj);
|
||||||
|
ObDereferenceObject(WaitObj);
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue