1 /* $Id: create.c,v 1.3 2001/01/29 00:13:22 ea Exp $
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/ob.h>
16 #include <internal/port.h>
17 #include <internal/dbg.h>
20 #include <internal/debug.h>
23 NTSTATUS STDCALL
VerifyCreateParameters (
24 IN PHANDLE PortHandle
,
25 IN POBJECT_ATTRIBUTES ObjectAttributes
,
26 IN ULONG MaxConnectInfoLength
,
27 IN ULONG MaxDataLength
,
31 if (NULL
== PortHandle
)
33 return (STATUS_INVALID_PARAMETER_1
);
35 if (NULL
== ObjectAttributes
)
37 return (STATUS_INVALID_PARAMETER_2
);
39 if ( (ObjectAttributes
->Attributes
& OBJ_OPENLINK
)
40 || (ObjectAttributes
->Attributes
& OBJ_OPENIF
)
41 || (ObjectAttributes
->Attributes
& OBJ_EXCLUSIVE
)
42 || (ObjectAttributes
->Attributes
& OBJ_PERMANENT
)
43 || (ObjectAttributes
->Attributes
& OBJ_INHERIT
)
44 // || (ObjectAttributes->Attributes & OBJ_KERNEL_HANDLE)
47 return (STATUS_INVALID_PORT_ATTRIBUTES
);
49 if (MaxConnectInfoLength
> 0x104) /* FIXME: use a macro! */
51 return (STATUS_INVALID_PARAMETER_3
);
53 if (MaxDataLength
> 0x148) /* FIXME: use a macro! */
55 return (STATUS_INVALID_PARAMETER_4
);
57 /* FIXME: some checking is done also on Reserved */
58 return (STATUS_SUCCESS
);
67 POBJECT_ATTRIBUTES ObjectAttributes
72 if (RemainingPath
== NULL
)
74 return (STATUS_SUCCESS
);
77 if (wcschr(RemainingPath
+1, '\\') != NULL
)
79 return (STATUS_UNSUCCESSFUL
);
82 Status
= ObReferenceObjectByPointer (
84 STANDARD_RIGHTS_REQUIRED
,
88 if (!NT_SUCCESS(Status
))
98 ObDereferenceObject (Parent
);
100 return (STATUS_SUCCESS
);
104 /**********************************************************************
113 * MaxConnectInfoLength,
125 POBJECT_ATTRIBUTES ObjectAttributes
,
126 ULONG MaxConnectInfoLength
,
134 DPRINT("NtCreatePort() Name %x\n", ObjectAttributes
->ObjectName
->Buffer
);
136 /* Verify parameters */
137 Status
= VerifyCreateParameters (
140 MaxConnectInfoLength
,
144 if (STATUS_SUCCESS
!= Status
)
148 /* Ask Ob to create the object */
149 Port
= ObCreateObject (
157 return (STATUS_UNSUCCESSFUL
);
160 Status
= NiInitializePort (Port
);
161 Port
->MaxConnectInfoLength
= 260; /* FIXME: use a macro! */
162 Port
->MaxDataLength
= 328; /* FIXME: use a macro! */
164 ObDereferenceObject (Port
);
169 /**********************************************************************
171 * NtCreateWaitablePort@20
174 * Waitable ports can be connected to with NtSecureConnectPort.
175 * No port interface can be used with waitable ports but
176 * NtReplyWaitReceivePort and NtReplyWaitReceivePortEx.
177 * Present only in w2k+.
182 * MaxConnectInfoLength,
192 NtCreateWaitablePort (
193 OUT PHANDLE PortHandle
,
194 IN POBJECT_ATTRIBUTES ObjectAttributes
,
195 IN ULONG MaxConnectInfoLength
,
196 IN ULONG MaxDataLength
,
202 /* Verify parameters */
203 Status
= VerifyCreateParameters (
206 MaxConnectInfoLength
,
210 if (STATUS_SUCCESS
!= Status
)
215 return (STATUS_NOT_IMPLEMENTED
);