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 #define NTOS_MODE_KERNEL
16 #include <internal/port.h>
17 #include <internal/dbg.h>
20 #include <internal/debug.h>
22 STATIC NTSTATUS STDCALL
23 VerifyCreateParameters (IN PHANDLE PortHandle,
24 IN POBJECT_ATTRIBUTES ObjectAttributes,
25 IN ULONG MaxConnectInfoLength,
26 IN ULONG MaxDataLength,
29 if (NULL == PortHandle)
31 return (STATUS_INVALID_PARAMETER_1);
33 if (NULL == ObjectAttributes)
35 return (STATUS_INVALID_PARAMETER_2);
37 if ((ObjectAttributes->Attributes & OBJ_OPENLINK)
38 || (ObjectAttributes->Attributes & OBJ_OPENIF)
39 || (ObjectAttributes->Attributes & OBJ_EXCLUSIVE)
40 || (ObjectAttributes->Attributes & OBJ_PERMANENT)
41 || (ObjectAttributes->Attributes & OBJ_INHERIT))
43 return (STATUS_INVALID_PORT_ATTRIBUTES);
45 if (MaxConnectInfoLength > 0x104) /* FIXME: use a macro! */
47 return (STATUS_INVALID_PARAMETER_3);
49 if (MaxDataLength > 0x148) /* FIXME: use a macro! */
51 return (STATUS_INVALID_PARAMETER_4);
53 /* FIXME: some checking is done also on Reserved */
54 return (STATUS_SUCCESS);
59 NiCreatePort (PVOID ObjectBody,
62 POBJECT_ATTRIBUTES ObjectAttributes)
64 if (RemainingPath == NULL)
66 return (STATUS_SUCCESS);
69 if (wcschr(RemainingPath+1, '\\') != NULL)
71 return (STATUS_UNSUCCESSFUL);
74 return (STATUS_SUCCESS);
78 /**********************************************************************
87 * 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 = ObRosCreateObject (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,
154 EXPORTED NTSTATUS STDCALL
155 NtCreateWaitablePort (OUT PHANDLE PortHandle,
156 IN POBJECT_ATTRIBUTES ObjectAttributes,
157 IN ULONG MaxConnectInfoLength,
158 IN ULONG MaxDataLength,
163 /* Verify parameters */
164 Status = VerifyCreateParameters (PortHandle,
166 MaxConnectInfoLength,
169 if (STATUS_SUCCESS != Status)
174 return (STATUS_NOT_IMPLEMENTED);