3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/create.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
15 #include <internal/port.h>
16 #include <internal/dbg.h>
19 #include <internal/debug.h>
21 STATIC NTSTATUS STDCALL
22 VerifyCreateParameters (IN PHANDLE PortHandle,
23 IN POBJECT_ATTRIBUTES ObjectAttributes,
24 IN ULONG MaxConnectInfoLength,
25 IN ULONG MaxDataLength,
28 if (NULL == PortHandle)
30 return (STATUS_INVALID_PARAMETER_1);
32 if (NULL == ObjectAttributes)
34 return (STATUS_INVALID_PARAMETER_2);
36 if ((ObjectAttributes->Attributes & OBJ_OPENLINK)
37 || (ObjectAttributes->Attributes & OBJ_OPENIF)
38 || (ObjectAttributes->Attributes & OBJ_EXCLUSIVE)
39 || (ObjectAttributes->Attributes & OBJ_PERMANENT)
40 || (ObjectAttributes->Attributes & OBJ_INHERIT))
42 return (STATUS_INVALID_PORT_ATTRIBUTES);
44 if (MaxConnectInfoLength > 0x104) /* FIXME: use a macro! */
46 return (STATUS_INVALID_PARAMETER_3);
48 if (MaxDataLength > 0x148) /* FIXME: use a macro! */
50 return (STATUS_INVALID_PARAMETER_4);
52 /* FIXME: some checking is done also on Reserved */
53 return (STATUS_SUCCESS);
58 NiCreatePort (PVOID ObjectBody,
61 POBJECT_ATTRIBUTES ObjectAttributes)
63 if (RemainingPath == NULL)
65 return (STATUS_SUCCESS);
68 if (wcschr(RemainingPath+1, '\\') != NULL)
70 return (STATUS_UNSUCCESSFUL);
73 return (STATUS_SUCCESS);
77 /**********************************************************************
86 * MaxConnectInfoLength,
93 EXPORTED NTSTATUS STDCALL
94 NtCreatePort (PHANDLE PortHandle,
95 POBJECT_ATTRIBUTES ObjectAttributes,
96 ULONG MaxConnectInfoLength,
103 DPRINT("NtCreatePort() Name %x\n", ObjectAttributes->ObjectName->Buffer);
105 /* Verify parameters */
106 Status = VerifyCreateParameters (PortHandle,
108 MaxConnectInfoLength,
111 if (!NT_SUCCESS(Status))
115 /* Ask Ob to create the object */
116 Status = ObCreateObject (PortHandle,
121 if (!NT_SUCCESS(Status))
126 Status = NiInitializePort (Port);
127 Port->MaxConnectInfoLength = 260; /* FIXME: use a macro! */
128 Port->MaxDataLength = 328; /* FIXME: use a macro! */
130 ObDereferenceObject (Port);
135 /**********************************************************************
137 * NtCreateWaitablePort@20
140 * Waitable ports can be connected to with NtSecureConnectPort.
141 * No port interface can be used with waitable ports but
142 * NtReplyWaitReceivePort and NtReplyWaitReceivePortEx.
143 * Present only in w2k+.
148 * MaxConnectInfoLength,
155 EXPORTED NTSTATUS STDCALL
156 NtCreateWaitablePort (OUT PHANDLE PortHandle,
157 IN POBJECT_ATTRIBUTES ObjectAttributes,
158 IN ULONG MaxConnectInfoLength,
159 IN ULONG MaxDataLength,
164 /* Verify parameters */
165 Status = VerifyCreateParameters (PortHandle,
167 MaxConnectInfoLength,
170 if (STATUS_SUCCESS != Status)
175 return (STATUS_NOT_IMPLEMENTED);