2007-01-10 04:27:40 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Kernel
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
2000-06-04 17:27:39 +00:00
|
|
|
* FILE: ntoskrnl/lpc/listen.c
|
2007-01-10 04:27:40 +00:00
|
|
|
* PURPOSE: Local Procedure Call: Listening
|
|
|
|
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
2000-06-04 17:27:39 +00:00
|
|
|
*/
|
|
|
|
|
2001-12-02 23:34:43 +00:00
|
|
|
/* INCLUDES ******************************************************************/
|
2000-06-04 17:27:39 +00:00
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
2000-06-04 17:27:39 +00:00
|
|
|
#define NDEBUG
|
2007-01-10 06:09:57 +00:00
|
|
|
#include <debug.h>
|
2000-06-04 17:27:39 +00:00
|
|
|
|
2007-01-10 04:27:40 +00:00
|
|
|
/* PUBLIC FUNCTIONS **********************************************************/
|
2000-06-04 17:27:39 +00:00
|
|
|
|
2007-01-10 04:27:40 +00:00
|
|
|
/*
|
|
|
|
* @implemented
|
2000-06-04 17:27:39 +00:00
|
|
|
*/
|
2007-01-10 04:27:40 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
NtListenPort(IN HANDLE PortHandle,
|
|
|
|
OUT PPORT_MESSAGE ConnectMessage)
|
2000-06-04 17:27:39 +00:00
|
|
|
{
|
2007-01-21 17:21:42 +00:00
|
|
|
NTSTATUS Status;
|
2016-11-07 00:55:34 +00:00
|
|
|
|
2007-01-21 17:21:42 +00:00
|
|
|
PAGED_CODE();
|
2013-08-31 16:02:13 +00:00
|
|
|
LPCTRACE(LPC_LISTEN_DEBUG, "Handle: %p\n", PortHandle);
|
2007-01-21 17:21:42 +00:00
|
|
|
|
2016-11-07 00:55:34 +00:00
|
|
|
/* Wait forever for a connection request */
|
2007-01-21 17:21:42 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
/* Do the wait */
|
|
|
|
Status = NtReplyWaitReceivePort(PortHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
ConnectMessage);
|
|
|
|
|
2016-11-07 01:24:24 +00:00
|
|
|
_SEH2_TRY
|
2007-01-10 04:27:40 +00:00
|
|
|
{
|
2016-11-07 01:24:24 +00:00
|
|
|
/* Accept only LPC_CONNECTION_REQUEST requests */
|
|
|
|
if ((Status != STATUS_SUCCESS) ||
|
|
|
|
(LpcpGetMessageType(ConnectMessage) == LPC_CONNECTION_REQUEST))
|
|
|
|
{
|
|
|
|
/* Break out */
|
|
|
|
_SEH2_YIELD(break);
|
|
|
|
}
|
2007-01-10 04:27:40 +00:00
|
|
|
}
|
2016-11-07 01:24:24 +00:00
|
|
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
|
|
|
{
|
|
|
|
Status = _SEH2_GetExceptionCode();
|
|
|
|
_SEH2_YIELD(break);
|
|
|
|
}
|
|
|
|
_SEH2_END;
|
2007-01-21 17:21:42 +00:00
|
|
|
}
|
2007-01-10 04:27:40 +00:00
|
|
|
|
2007-01-21 17:21:42 +00:00
|
|
|
/* Return status */
|
|
|
|
return Status;
|
2000-06-04 17:27:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|