ReactOS 0.4.16-dev-197-g92996da
listen.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/lpc/listen.c
5 * PURPOSE: Local Procedure Call: Listening
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <ntoskrnl.h>
12#define NDEBUG
13#include <debug.h>
14
15/* PUBLIC FUNCTIONS **********************************************************/
16
17/*
18 * @implemented
19 */
23 OUT PPORT_MESSAGE ConnectMessage)
24{
26
27 PAGED_CODE();
28 LPCTRACE(LPC_LISTEN_DEBUG, "Handle: %p\n", PortHandle);
29
30 /* Wait forever for a connection request */
31 for (;;)
32 {
33 /* Do the wait */
34 Status = NtReplyWaitReceivePort(PortHandle,
35 NULL,
36 NULL,
37 ConnectMessage);
38
40 {
41 /* Accept only LPC_CONNECTION_REQUEST requests */
42 if ((Status != STATUS_SUCCESS) ||
43 (LpcpGetMessageType(ConnectMessage) == LPC_CONNECTION_REQUEST))
44 {
45 /* Break out */
46 _SEH2_YIELD(break);
47 }
48 }
50 {
52 _SEH2_YIELD(break);
53 }
55 }
56
57 /* Return status */
58 return Status;
59}
60
61/* EOF */
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define LPCTRACE(x, fmt,...)
Definition: lpc.h:49
#define LPC_LISTEN_DEBUG
Definition: lpc.h:20
#define LpcpGetMessageType(x)
Definition: lpc_x.h:12
#define LPC_CONNECTION_REQUEST
Definition: port.c:102
NTSTATUS NTAPI NtListenPort(IN HANDLE PortHandle, OUT PPORT_MESSAGE ConnectMessage)
Definition: listen.c:22
NTSTATUS NTAPI NtReplyWaitReceivePort(IN HANDLE PortHandle, OUT PVOID *PortContext OPTIONAL, IN PPORT_MESSAGE ReplyMessage OPTIONAL, OUT PPORT_MESSAGE ReceiveMessage)
Definition: reply.c:743
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define STATUS_SUCCESS
Definition: shellext.h:65
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40