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;
|
|
|
|
PAGED_CODE();
|
|
|
|
LPCTRACE(LPC_LISTEN_DEBUG, "Handle: %lx\n", PortHandle);
|
|
|
|
|
|
|
|
/* Wait forever for a connection request. */
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
/* Do the wait */
|
|
|
|
Status = NtReplyWaitReceivePort(PortHandle,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
ConnectMessage);
|
|
|
|
|
|
|
|
/* Accept only LPC_CONNECTION_REQUEST requests. */
|
|
|
|
if ((Status != STATUS_SUCCESS) ||
|
|
|
|
(LpcpGetMessageType(ConnectMessage) == LPC_CONNECTION_REQUEST))
|
2007-01-10 04:27:40 +00:00
|
|
|
{
|
2007-01-21 17:21:42 +00:00
|
|
|
/* Break out */
|
|
|
|
break;
|
2007-01-10 04:27:40 +00:00
|
|
|
}
|
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 */
|