Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

lpclistn.c

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 lpclistn.c 00008 00009 Abstract: 00010 00011 Local Inter-Process Communication (LPC) connection system services. 00012 00013 Author: 00014 00015 Steve Wood (stevewo) 15-May-1989 00016 00017 Revision History: 00018 00019 --*/ 00020 00021 #include "lpcp.h" 00022 00023 #ifdef ALLOC_PRAGMA 00024 #pragma alloc_text(PAGE,NtListenPort) 00025 #endif 00026 00027 00028 NTSTATUS 00029 NtListenPort ( 00030 IN HANDLE PortHandle, 00031 OUT PPORT_MESSAGE ConnectionRequest 00032 ) 00033 00034 /*++ 00035 00036 Routine Description: 00037 00038 A server thread can listen for connection requests from client threads 00039 using the NtReplyWaitReceivePort service and looking for an 00040 LPC_CONNECTION_REQUEST message type. 00041 00042 This call will loop, calling the NtReplyWaitReceivePort service, and 00043 return when it sees a message of type LPC_CONNECTION_REQUEST 00044 00045 Arguments: 00046 00047 PortHandle - Specifies the connection port to listen for connection 00048 requests to. 00049 00050 ConnectionRequest - Pointer to a structure that describes the 00051 connection request the client is making: 00052 00053 Return Value: 00054 00055 NTSTATUS - An appropriate status value 00056 00057 --*/ 00058 00059 { 00060 NTSTATUS Status; 00061 00062 PAGED_CODE(); 00063 00064 // 00065 // Keep on looping until we get a connection request on the lpc port 00066 // 00067 00068 while (TRUE) { 00069 00070 Status = NtReplyWaitReceivePort( PortHandle, 00071 NULL, 00072 NULL, 00073 ConnectionRequest ); 00074 00075 // 00076 // We'll return from this procedure if ever we get back non success 00077 // or the message is a connection request. We still need to protect 00078 // the testing of ConnectionRequest because it is a user supplied 00079 // buffer. 00080 // 00081 00082 try { 00083 00084 if ((Status != STATUS_SUCCESS) || 00085 ((ConnectionRequest->u2.s2.Type & ~LPC_KERNELMODE_MESSAGE) == LPC_CONNECTION_REQUEST)) { 00086 00087 break; 00088 } 00089 00090 } except( EXCEPTION_EXECUTE_HANDLER ) { 00091 00092 Status = GetExceptionCode(); 00093 00094 break; 00095 } 00096 } 00097 00098 // 00099 // And return to our caller 00100 // 00101 00102 return Status; 00103 }

Generated on Sat May 15 19:40:39 2004 for test by doxygen 1.3.7