#define NDEBUG
#include <internal/debug.h>
+#if defined (ALLOC_PRAGMA)
+#pragma alloc_text(INIT, LpcpInitSystem)
+#endif
+
/* GLOBALS *******************************************************************/
ULONG LpcpNextMessageId = 0; /* 0 is not a valid ID */
FAST_MUTEX LpcpLock; /* global internal sync in LPC facility */
-static GENERIC_MAPPING ExpPortMapping = {
- STANDARD_RIGHTS_READ,
- STANDARD_RIGHTS_WRITE,
- 0,
- PORT_ALL_ACCESS};
+static GENERIC_MAPPING LpcpPortMapping =
+{
+ STANDARD_RIGHTS_READ,
+ STANDARD_RIGHTS_WRITE,
+ 0,
+ PORT_ALL_ACCESS
+};
/* FUNCTIONS *****************************************************************/
-NTSTATUS INIT_FUNCTION
+NTSTATUS
+INIT_FUNCTION
+NTAPI
LpcpInitSystem (VOID)
{
- /* Allocate Memory for the LPC Object */
- LpcPortObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
- RtlZeroMemory (LpcPortObjectType, sizeof (OBJECT_TYPE));
-
- RtlInitUnicodeString(&LpcPortObjectType->TypeName,L"Port");
-
- LpcPortObjectType->Tag = TAG('L', 'P', 'R', 'T');
- LpcPortObjectType->PeakObjects = 0;
- LpcPortObjectType->PeakHandles = 0;
- LpcPortObjectType->TotalObjects = 0;
- LpcPortObjectType->TotalHandles = 0;
- LpcPortObjectType->PagedPoolCharge = 0;
- LpcPortObjectType->NonpagedPoolCharge = sizeof(EPORT);
- LpcPortObjectType->Mapping = &ExpPortMapping;
- LpcPortObjectType->Dump = NULL;
- LpcPortObjectType->Open = NULL;
- LpcPortObjectType->Close = NiClosePort;
- LpcPortObjectType->Delete = NiDeletePort;
- LpcPortObjectType->Parse = NULL;
- LpcPortObjectType->Security = NULL;
- LpcPortObjectType->QueryName = NULL;
- LpcPortObjectType->Open = NULL;
- LpcPortObjectType->OkayToClose = NULL;
-
- ObpCreateTypeObject(LpcPortObjectType);
-
- LpcpNextMessageId = 0;
-
- ExInitializeFastMutex (& LpcpLock);
-
- return(STATUS_SUCCESS);
+ OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+ UNICODE_STRING Name;
+
+ DPRINT("Creating Port Object Type\n");
+
+ /* Create the Port Object Type */
+ RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+ RtlInitUnicodeString(&Name, L"Port");
+ ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+ ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(EPORT);
+ ObjectTypeInitializer.GenericMapping = LpcpPortMapping;
+ ObjectTypeInitializer.PoolType = NonPagedPool;
+ ObjectTypeInitializer.UseDefaultObject = TRUE;
+ ObjectTypeInitializer.CloseProcedure = LpcpClosePort;
+ ObjectTypeInitializer.DeleteProcedure = LpcpDeletePort;
+ ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &LpcPortObjectType);
+
+ LpcpNextMessageId = 0;
+ ExInitializeFastMutex (& LpcpLock);
+
+ return(STATUS_SUCCESS);
}
}
memset (Port, 0, sizeof(EPORT));
KeInitializeSpinLock (& Port->Lock);
- KeInitializeSemaphore( &Port->Semaphore, 0, LONG_MAX );
+ KeInitializeSemaphore( &Port->Semaphore, 0, MAXLONG );
Port->RequestPort = Parent;
Port->OtherPort = NULL;
Port->QueueLength = 0;
*/
NTSTATUS STDCALL
NtImpersonateClientOfPort (HANDLE PortHandle,
- PLPC_MESSAGE ClientMessage)
+ PPORT_MESSAGE ClientMessage)
{
UNIMPLEMENTED;
return(STATUS_NOT_IMPLEMENTED);