Use free Windows DDK and compile with latest MinGW releases.
[reactos.git] / reactos / ntoskrnl / lpc / port.c
1 /* $Id: port.c,v 1.10 2002/09/07 15:12:58 chorns Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/port.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
8 * UPDATE HISTORY:
9 * Created 22/05/98
10 *
11 * 2000-06-04 (ea)
12 * ntoskrnl/nt/port.c moved in ntoskrnl/lpc/port.c
13 */
14
15 /* INCLUDES *****************************************************************/
16
17 #include <ntoskrnl.h>
18
19 #define NDEBUG
20 #include <internal/debug.h>
21
22
23 /* GLOBALS *******************************************************************/
24
25 POBJECT_TYPE ExPortType = NULL;
26 ULONG EiNextLpcMessageId = 0;
27
28 static GENERIC_MAPPING ExpPortMapping = {
29 STANDARD_RIGHTS_READ,
30 STANDARD_RIGHTS_WRITE,
31 0,
32 PORT_ALL_ACCESS};
33
34 /* FUNCTIONS *****************************************************************/
35
36
37 NTSTATUS NiInitPort (VOID)
38 {
39 ExPortType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
40
41 RtlInitUnicodeStringFromLiteral(&ExPortType->TypeName,L"Port");
42
43 ExPortType->Tag = TAG('L', 'P', 'R', 'T');
44 ExPortType->MaxObjects = ULONG_MAX;
45 ExPortType->MaxHandles = ULONG_MAX;
46 ExPortType->TotalObjects = 0;
47 ExPortType->TotalHandles = 0;
48 ExPortType->PagedPoolCharge = 0;
49 ExPortType->NonpagedPoolCharge = sizeof(EPORT);
50 ExPortType->Mapping = &ExpPortMapping;
51 ExPortType->Dump = NULL;
52 ExPortType->Open = NULL;
53 ExPortType->Close = NiClosePort;
54 ExPortType->Delete = NiDeletePort;
55 ExPortType->Parse = NULL;
56 ExPortType->Security = NULL;
57 ExPortType->QueryName = NULL;
58 ExPortType->OkayToClose = NULL;
59 ExPortType->Create = NiCreatePort;
60 ExPortType->DuplicationNotify = NULL;
61
62 EiNextLpcMessageId = 0;
63
64 return(STATUS_SUCCESS);
65 }
66
67
68 /**********************************************************************
69 * NAME INTERNAL
70 * NiInitializePort
71 *
72 * DESCRIPTION
73 * Initialize the EPORT object attributes. The Port
74 * object enters the inactive state.
75 *
76 * ARGUMENTS
77 * Port Pointer to an EPORT object to initialize.
78 *
79 * RETURN VALUE
80 * STATUS_SUCCESS if initialization succedeed. An error code
81 * otherwise.
82 */
83 NTSTATUS STDCALL
84 NiInitializePort (IN OUT PEPORT Port)
85 {
86 memset (Port, 0, sizeof(EPORT));
87 KeInitializeSpinLock (& Port->Lock);
88 KeInitializeSemaphore( &Port->Semaphore, 0, LONG_MAX );
89 Port->OtherPort = NULL;
90 Port->QueueLength = 0;
91 Port->ConnectQueueLength = 0;
92 Port->State = EPORT_INACTIVE;
93 InitializeListHead (& Port->QueueListHead);
94 InitializeListHead (& Port->ConnectQueueListHead);
95
96 return (STATUS_SUCCESS);
97 }
98
99
100 /* MISCELLANEA SYSTEM SERVICES */
101
102
103 /**********************************************************************
104 * NAME SYSTEM
105 * NtImpersonateClientOfPort@8
106 *
107 * DESCRIPTION
108 *
109 * ARGUMENTS
110 * PortHandle,
111 * ClientMessage
112 *
113 * RETURN VALUE
114 *
115 */
116 NTSTATUS STDCALL
117 NtImpersonateClientOfPort (HANDLE PortHandle,
118 PLPC_MESSAGE ClientMessage)
119 {
120 UNIMPLEMENTED;
121 }
122
123
124
125 /* EOF */