Make Object Type creation compatible with OB 2.0 from the caller's point of view. Use real structures for Object Type and ObjectType Initializer. Added two more hacks that I'll remove in the next commit
Modified: trunk/reactos/include/ddk/pstypes.h
Modified: trunk/reactos/ntoskrnl/cm/registry.c
Modified: trunk/reactos/ntoskrnl/ex/callback.c
Modified: trunk/reactos/ntoskrnl/ex/event.c
Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
Modified: trunk/reactos/ntoskrnl/ex/mutant.c
Modified: trunk/reactos/ntoskrnl/ex/profile.c
Modified: trunk/reactos/ntoskrnl/ex/sem.c
Modified: trunk/reactos/ntoskrnl/ex/timer.c
Modified: trunk/reactos/ntoskrnl/ex/win32k.c
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
Modified: trunk/reactos/ntoskrnl/include/internal/port.h
Modified: trunk/reactos/ntoskrnl/io/driver.c
Modified: trunk/reactos/ntoskrnl/io/file.c
Modified: trunk/reactos/ntoskrnl/io/iocomp.c
Modified: trunk/reactos/ntoskrnl/io/iomgr.c
Modified: trunk/reactos/ntoskrnl/io/share.c
Modified: trunk/reactos/ntoskrnl/ke/wait.c
Modified: trunk/reactos/ntoskrnl/lpc/close.c
Modified: trunk/reactos/ntoskrnl/lpc/port.c
Modified: trunk/reactos/ntoskrnl/mm/section.c
Modified: trunk/reactos/ntoskrnl/ob/dirobj.c
Modified: trunk/reactos/ntoskrnl/ob/handle.c
Modified: trunk/reactos/ntoskrnl/ob/namespc.c
Modified: trunk/reactos/ntoskrnl/ob/object.c
Modified: trunk/reactos/ntoskrnl/ob/security.c
Modified: trunk/reactos/ntoskrnl/ob/symlink.c
Modified: trunk/reactos/ntoskrnl/ob/wait.c
Modified: trunk/reactos/ntoskrnl/ps/cid.c
Modified: trunk/reactos/ntoskrnl/ps/job.c
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/ntoskrnl/ps/win32.c
Modified: trunk/reactos/ntoskrnl/se/token.c

Modified: trunk/reactos/include/ddk/pstypes.h
--- trunk/reactos/include/ddk/pstypes.h	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/include/ddk/pstypes.h	2005-05-15 17:59:33 UTC (rev 15317)
@@ -66,48 +66,79 @@
 typedef NTSTATUS STDCALL_FUNC
 (*PW32_THREAD_CALLBACK)(struct _ETHREAD *Thread,
 			BOOLEAN Create);
-            
+        
+typedef enum _OB_OPEN_REASON
+{    
+    ObCreateHandle,
+    ObOpenHandle,
+    ObDuplicateHandle,
+    ObInheritHandle,
+    ObMaxOpenReason
+} OB_OPEN_REASON;
+    
 /* 
  * Callbacks used for Win32 objects... this define won't be needed after the Object Manager
  * rewrite -- Alex
  */
- 
+  
 /* TEMPORARY HACK */
 typedef NTSTATUS STDCALL_FUNC
-(*OBJECT_CREATE_ROUTINE)(PVOID ObjectBody,
-                         PVOID Parent,
-                         PWSTR RemainingPath,
-                         struct _OBJECT_ATTRIBUTES* ObjectAttributes);
+(*OB_CREATE_METHOD)(PVOID ObjectBody,
+                     PVOID Parent,
+                     PWSTR RemainingPath,
+                     struct _OBJECT_ATTRIBUTES* ObjectAttributes);
                          
 typedef NTSTATUS STDCALL_FUNC
-(*OBJECT_OPEN_ROUTINE)(ULONG Reason,
-                       PVOID ObjectBody,
-                       PEPROCESS Process,
-                       ULONG HandleCount,
-                       ACCESS_MASK GrantedAccess);
+(*OB_OPEN_METHOD)(OB_OPEN_REASON Reason,
+                  PVOID ObjectBody,
+                  PEPROCESS Process,
+                  ULONG HandleCount,
+                  ACCESS_MASK GrantedAccess);
 
 typedef NTSTATUS STDCALL_FUNC
-(*OBJECT_PARSE_ROUTINE)(PVOID Object,
-                        PVOID *NextObject,
-                        PUNICODE_STRING FullPath,
-                        PWSTR *Path,
-                        ULONG Attributes);
+(*OB_PARSE_METHOD)(PVOID Object,
+                    PVOID *NextObject,
+                    PUNICODE_STRING FullPath,
+                    PWSTR *Path,
+                    ULONG Attributes);
                         
 typedef VOID STDCALL_FUNC
-(*OBJECT_DELETE_ROUTINE)(PVOID DeletedObject);
+(*OB_DELETE_METHOD)(PVOID DeletedObject);
 
+typedef VOID STDCALL_FUNC
+(*OB_CLOSE_METHOD)(PVOID ClosedObject, ULONG HandleCount);
+
+typedef VOID STDCALL_FUNC
+(*OB_DUMP_METHOD)(VOID);
+
+typedef NTSTATUS STDCALL_FUNC
+(*OB_OKAYTOCLOSE_METHOD)(VOID);
+
+typedef NTSTATUS STDCALL_FUNC
+(*OB_QUERYNAME_METHOD)(PVOID ObjectBody,
+                        POBJECT_NAME_INFORMATION ObjectNameInfo,
+                        ULONG Length,
+                        PULONG ReturnLength);
+
 typedef PVOID STDCALL_FUNC
-(*OBJECT_FIND_ROUTINE)(PVOID WinStaObject,
-                       PWSTR Name,
-                       ULONG Attributes);
+(*OB_FIND_METHOD)(PVOID WinStaObject,
+                   PWSTR Name,
+                   ULONG Attributes);
+
+typedef NTSTATUS STDCALL_FUNC
+(*OB_SECURITY_METHOD)(PVOID ObjectBody,
+                        SECURITY_OPERATION_CODE OperationCode,
+                        SECURITY_INFORMATION SecurityInformation,
+                        PSECURITY_DESCRIPTOR SecurityDescriptor,
+                        PULONG BufferLength);
                        
 typedef struct _W32_OBJECT_CALLBACK {
-    OBJECT_OPEN_ROUTINE WinStaCreate;
-    OBJECT_PARSE_ROUTINE WinStaParse;
-    OBJECT_DELETE_ROUTINE WinStaDelete;
-    OBJECT_FIND_ROUTINE WinStaFind;
-    OBJECT_CREATE_ROUTINE DesktopCreate;
-    OBJECT_DELETE_ROUTINE DesktopDelete;    
+    OB_OPEN_METHOD WinStaCreate;
+    OB_PARSE_METHOD WinStaParse;
+    OB_DELETE_METHOD WinStaDelete;
+    OB_FIND_METHOD WinStaFind;
+    OB_CREATE_METHOD DesktopCreate;
+    OB_DELETE_METHOD DesktopDelete;    
 } W32_OBJECT_CALLBACK, *PW32_OBJECT_CALLBACK;
 
 typedef struct _STACK_INFORMATION

Modified: trunk/reactos/ntoskrnl/cm/registry.c
--- trunk/reactos/ntoskrnl/cm/registry.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/cm/registry.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -331,7 +331,8 @@
     if (SetupBoot == FALSE) CmInit2((PCHAR)KeLoaderBlock.CommandLine);
 }
 
-VOID INIT_FUNCTION
+VOID 
+INIT_FUNCTION
 CmInitializeRegistry(VOID)
 {
   OBJECT_ATTRIBUTES ObjectAttributes;
@@ -346,29 +347,26 @@
   LARGE_INTEGER DueTime;
   HANDLE ThreadHandle;
   CLIENT_ID ThreadId;
+  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+  UNICODE_STRING Name;
 
+  DPRINT1("Creating Registry Object Type\n");
+  
   /*  Initialize the Key object type  */
-  CmiKeyType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-  ASSERT(CmiKeyType);
-  CmiKeyType->Tag = TAG('R', 'e', 'g', 'K');
-  CmiKeyType->TotalObjects = 0;
-  CmiKeyType->TotalHandles = 0;
-  CmiKeyType->PeakObjects = 0;
-  CmiKeyType->PeakHandles = 0;
-  CmiKeyType->PagedPoolCharge = 0;
-  CmiKeyType->NonpagedPoolCharge = sizeof(KEY_OBJECT);
-  CmiKeyType->Mapping = &CmiKeyMapping;
-  CmiKeyType->Dump = NULL;
-  CmiKeyType->Open = NULL;
-  CmiKeyType->Close = NULL;
-  CmiKeyType->Delete = CmiObjectDelete;
-  CmiKeyType->Parse = CmiObjectParse;
-  CmiKeyType->Security = CmiObjectSecurity;
-  CmiKeyType->QueryName = CmiObjectQueryName;
-  CmiKeyType->OkayToClose = NULL;
-  RtlInitUnicodeString(&CmiKeyType->TypeName, L"Key");
+  RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+  RtlInitUnicodeString(&Name, L"Key");
+  ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEY_OBJECT);
+  ObjectTypeInitializer.GenericMapping = CmiKeyMapping;
+  ObjectTypeInitializer.PoolType = NonPagedPool;
+  ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS;
+  ObjectTypeInitializer.UseDefaultObject = TRUE;
+  ObjectTypeInitializer.DeleteProcedure = CmiObjectDelete;
+  ObjectTypeInitializer.ParseProcedure = CmiObjectParse;
+  ObjectTypeInitializer.SecurityProcedure = CmiObjectSecurity;
+  ObjectTypeInitializer.QueryNameProcedure = CmiObjectQueryName;
 
-  ObpCreateTypeObject (CmiKeyType);
+  ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &CmiKeyType);
 
   /* Initialize the hive list */
   InitializeListHead(&CmiHiveListHead);

Modified: trunk/reactos/ntoskrnl/ex/callback.c
--- trunk/reactos/ntoskrnl/ex/callback.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/callback.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -42,34 +42,22 @@
    NTSTATUS Status;
    UNICODE_STRING DirName;
    UNICODE_STRING CallbackName;
+   UNICODE_STRING Name;
+   OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
    HANDLE DirectoryHandle;
    ULONG i;
 
-   /* Allocate memory for Object */
-   ExCallbackObjectType = ExAllocatePoolWithTag(NonPagedPool, sizeof(OBJECT_TYPE), CALLBACK_TAG);
+   /*  Initialize the Callback Object type  */
+   RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+   RtlInitUnicodeString(&Name, L"Callback");
+   ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+   ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(_INT_CALLBACK_OBJECT);
+   ObjectTypeInitializer.GenericMapping = ExpCallbackMapping;
+   ObjectTypeInitializer.PoolType = NonPagedPool;
+   ObjectTypeInitializer.UseDefaultObject = TRUE;
 
-   /* Initialize name */
-   RtlInitUnicodeString(&ExCallbackObjectType->TypeName, L"Callback");
+   Status = ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExCallbackObjectType);
 
-   /* Create the Object Type */
-   ExCallbackObjectType->Tag = CALLBACK_TAG;
-   ExCallbackObjectType->TotalObjects = 0;
-   ExCallbackObjectType->TotalHandles = 0;
-   ExCallbackObjectType->PeakObjects = 0;
-   ExCallbackObjectType->PeakHandles = 0;
-   ExCallbackObjectType->PagedPoolCharge = 0;
-   ExCallbackObjectType->Dump = NULL;
-   ExCallbackObjectType->Open = NULL;
-   ExCallbackObjectType->Close = NULL;
-   ExCallbackObjectType->Delete = NULL;
-   ExCallbackObjectType->Parse = NULL;
-   ExCallbackObjectType->Security = NULL;
-   ExCallbackObjectType->QueryName = NULL;
-   ExCallbackObjectType->OkayToClose = NULL;
-   ExCallbackObjectType->Mapping = &ExpCallbackMapping;
-   ExCallbackObjectType->NonpagedPoolCharge = sizeof(_INT_CALLBACK_OBJECT);
-   Status = ObpCreateTypeObject(ExCallbackObjectType);
-
    /* Fail if it wasn't created successfully */
    if (!NT_SUCCESS(Status))
    {

Modified: trunk/reactos/ntoskrnl/ex/event.c
--- trunk/reactos/ntoskrnl/ex/event.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/event.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -36,26 +36,21 @@
 INIT_FUNCTION
 ExpInitializeEventImplementation(VOID)
 {
-    /* Create the Event Object Type */
-    ExEventObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
-    RtlInitUnicodeString(&ExEventObjectType->TypeName, L"Event");
-    ExEventObjectType->Tag = TAG('E', 'V', 'T', 'T');
-    ExEventObjectType->PeakObjects = 0;
-    ExEventObjectType->PeakHandles = 0;
-    ExEventObjectType->TotalObjects = 0;
-    ExEventObjectType->TotalHandles = 0;
-    ExEventObjectType->PagedPoolCharge = 0;
-    ExEventObjectType->NonpagedPoolCharge = sizeof(KEVENT);
-    ExEventObjectType->Mapping = &ExpEventMapping;
-    ExEventObjectType->Dump = NULL;
-    ExEventObjectType->Open = NULL;
-    ExEventObjectType->Close = NULL;
-    ExEventObjectType->Delete = NULL;
-    ExEventObjectType->Parse = NULL;
-    ExEventObjectType->Security = NULL;
-    ExEventObjectType->QueryName = NULL;
-    ExEventObjectType->OkayToClose = NULL;
-    ObpCreateTypeObject(ExEventObjectType);
+  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+  UNICODE_STRING Name;
+
+  DPRINT1("Creating Event Object Type\n");
+  
+  /* Create the Event Object Type */
+  RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+  RtlInitUnicodeString(&Name, L"Event");
+  ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEVENT);
+  ObjectTypeInitializer.GenericMapping = ExpEventMapping;
+  ObjectTypeInitializer.PoolType = NonPagedPool;
+  ObjectTypeInitializer.ValidAccessMask = EVENT_ALL_ACCESS;
+  ObjectTypeInitializer.UseDefaultObject = TRUE;
+  ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExEventObjectType);
 }
 
 /*

Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
--- trunk/reactos/ntoskrnl/ex/evtpair.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/evtpair.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -33,26 +33,21 @@
 INIT_FUNCTION
 ExpInitializeEventPairImplementation(VOID)
 {
-    /* Create the Event Pair Object Type */
-    ExEventPairObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
-    RtlInitUnicodeString(&ExEventPairObjectType->TypeName, L"EventPair");
-    ExEventPairObjectType->Tag = TAG('E', 'v', 'P', 'a');
-    ExEventPairObjectType->PeakObjects = 0;
-    ExEventPairObjectType->PeakHandles = 0;
-    ExEventPairObjectType->TotalObjects = 0;
-    ExEventPairObjectType->TotalHandles = 0;
-    ExEventPairObjectType->PagedPoolCharge = 0;
-    ExEventPairObjectType->NonpagedPoolCharge = sizeof(KEVENT_PAIR);
-    ExEventPairObjectType->Mapping = &ExEventPairMapping;
-    ExEventPairObjectType->Dump = NULL;
-    ExEventPairObjectType->Open = NULL;
-    ExEventPairObjectType->Close = NULL;
-    ExEventPairObjectType->Delete = NULL;
-    ExEventPairObjectType->Parse = NULL;
-    ExEventPairObjectType->Security = NULL;
-    ExEventPairObjectType->QueryName = NULL;
-    ExEventPairObjectType->OkayToClose = NULL;
-    ObpCreateTypeObject(ExEventPairObjectType);
+  OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+  UNICODE_STRING Name;
+
+  DPRINT1("Creating Event Pair Object Type\n");
+  
+  /* Create the Event Pair Object Type */
+  RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+  RtlInitUnicodeString(&Name, L"EventPair");
+  ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+  ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KEVENT_PAIR);
+  ObjectTypeInitializer.GenericMapping = ExEventPairMapping;
+  ObjectTypeInitializer.PoolType = NonPagedPool;
+  ObjectTypeInitializer.ValidAccessMask = EVENT_PAIR_ALL_ACCESS;
+  ObjectTypeInitializer.UseDefaultObject = TRUE;
+  ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExEventPairObjectType);
 }
 
 NTSTATUS

Modified: trunk/reactos/ntoskrnl/ex/mutant.c
--- trunk/reactos/ntoskrnl/ex/mutant.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/mutant.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -49,30 +49,22 @@
 INIT_FUNCTION
 ExpInitializeMutantImplementation(VOID)
 {
+    OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+    UNICODE_STRING Name;
 
-    /* Allocate the Object Type */
-    ExMutantObjectType = ExAllocatePoolWithTag(NonPagedPool, sizeof(OBJECT_TYPE), TAG('M', 't', 'n', 't'));
-
-    /* Create the Object Type */
-    RtlInitUnicodeString(&ExMutantObjectType->TypeName, L"Mutant");
-    ExMutantObjectType->Tag = TAG('M', 't', 'n', 't');
-    ExMutantObjectType->PeakObjects = 0;
-    ExMutantObjectType->PeakHandles = 0;
-    ExMutantObjectType->TotalObjects = 0;
-    ExMutantObjectType->TotalHandles = 0;
-    ExMutantObjectType->PagedPoolCharge = 0;
-    ExMutantObjectType->NonpagedPoolCharge = sizeof(KMUTANT);
-    ExMutantObjectType->Mapping = &ExpMutantMapping;
-    ExMutantObjectType->Dump = NULL;
-    ExMutantObjectType->Open = NULL;
-    ExMutantObjectType->Close = NULL;
-    ExMutantObjectType->Delete = ExpDeleteMutant;
-    ExMutantObjectType->Parse = NULL;
-    ExMutantObjectType->Open = NULL;
-    ExMutantObjectType->Security = NULL;
-    ExMutantObjectType->QueryName = NULL;
-    ExMutantObjectType->OkayToClose = NULL;
-    ObpCreateTypeObject(ExMutantObjectType);
+    DPRINT1("Creating Mutant Object Type\n");
+  
+    /* Create the Event Pair Object Type */
+    RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+    RtlInitUnicodeString(&Name, L"Mutant");
+    ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+    ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KMUTANT);
+    ObjectTypeInitializer.GenericMapping = ExpMutantMapping;
+    ObjectTypeInitializer.PoolType = NonPagedPool;
+    ObjectTypeInitializer.DeleteProcedure = ExpDeleteMutant;
+    ObjectTypeInitializer.ValidAccessMask = MUTANT_ALL_ACCESS;
+    ObjectTypeInitializer.UseDefaultObject = TRUE;
+    ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExMutantObjectType);
 }
 
 /*

Modified: trunk/reactos/ntoskrnl/ex/profile.c
--- trunk/reactos/ntoskrnl/ex/profile.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/profile.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -75,30 +75,25 @@
 INIT_FUNCTION
 ExpInitializeProfileImplementation(VOID)
 {
+    OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+    UNICODE_STRING Name;
+  
     /* Initialize the Mutex to lock the States */
     KeInitializeMutex(&ExpProfileMutex, 0x40);
 
-    /* Create the Object Type */
-    ExProfileObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
-    RtlInitUnicodeString(&ExProfileObjectType->TypeName, L"Profile");
-    ExProfileObjectType->Tag = TAG('P', 'R', 'O', 'F');
-    ExProfileObjectType->PeakObjects = 0;
-    ExProfileObjectType->PeakHandles = 0;
-    ExProfileObjectType->TotalObjects = 0;
-    ExProfileObjectType->TotalHandles = 0;
-    ExProfileObjectType->PagedPoolCharge = 0;
-    ExProfileObjectType->NonpagedPoolCharge = sizeof(EPROFILE);
-    ExProfileObjectType->Mapping = &ExpProfileMapping;
-    ExProfileObjectType->Dump = NULL;
-    ExProfileObjectType->Open = NULL;
-    ExProfileObjectType->Close = NULL;
-    ExProfileObjectType->Delete = ExpDeleteProfile;
-    ExProfileObjectType->Parse = NULL;
-    ExProfileObjectType->Open = NULL;
-    ExProfileObjectType->Security = NULL;
-    ExProfileObjectType->QueryName = NULL;
-    ExProfileObjectType->OkayToClose = NULL;
-    ObpCreateTypeObject(ExProfileObjectType);
+    DPRINT1("Creating Profile Object Type\n");
+  
+    /* Create the Event Pair Object Type */
+    RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+    RtlInitUnicodeString(&Name, L"Profile");
+    ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+    ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KPROFILE);
+    ObjectTypeInitializer.GenericMapping = ExpProfileMapping;
+    ObjectTypeInitializer.PoolType = NonPagedPool;
+    ObjectTypeInitializer.DeleteProcedure = ExpDeleteProfile;
+    ObjectTypeInitializer.ValidAccessMask = STANDARD_RIGHTS_ALL;
+    ObjectTypeInitializer.UseDefaultObject = TRUE;
+    ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExProfileObjectType);
 }
 
 NTSTATUS

Modified: trunk/reactos/ntoskrnl/ex/sem.c
--- trunk/reactos/ntoskrnl/ex/sem.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/sem.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -34,27 +34,21 @@
 INIT_FUNCTION
 ExpInitializeSemaphoreImplementation(VOID)
 {
+    OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+    UNICODE_STRING Name;
 
-    /* Create the Semaphore Object */
-    ExSemaphoreObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-    RtlInitUnicodeString(&ExSemaphoreObjectType->TypeName, L"Semaphore");
-    ExSemaphoreObjectType->Tag = TAG('S', 'E', 'M', 'T');
-    ExSemaphoreObjectType->PeakObjects = 0;
-    ExSemaphoreObjectType->PeakHandles = 0;
-    ExSemaphoreObjectType->TotalObjects = 0;
-    ExSemaphoreObjectType->TotalHandles = 0;
-    ExSemaphoreObjectType->PagedPoolCharge = 0;
-    ExSemaphoreObjectType->NonpagedPoolCharge = sizeof(KSEMAPHORE);
-    ExSemaphoreObjectType->Mapping = &ExSemaphoreMapping;
-    ExSemaphoreObjectType->Dump = NULL;
-    ExSemaphoreObjectType->Open = NULL;
-    ExSemaphoreObjectType->Close = NULL;
-    ExSemaphoreObjectType->Delete = NULL;
-    ExSemaphoreObjectType->Parse = NULL;
-    ExSemaphoreObjectType->Security = NULL;
-    ExSemaphoreObjectType->QueryName = NULL;
-    ExSemaphoreObjectType->OkayToClose = NULL;
-    ObpCreateTypeObject(ExSemaphoreObjectType);
+    DPRINT1("Creating Semaphore Object Type\n");
+  
+    /* Create the Event Pair Object Type */
+    RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+    RtlInitUnicodeString(&Name, L"Semaphore");
+    ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+    ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KSEMAPHORE);
+    ObjectTypeInitializer.GenericMapping = ExSemaphoreMapping;
+    ObjectTypeInitializer.PoolType = NonPagedPool;
+    ObjectTypeInitializer.ValidAccessMask = SEMAPHORE_ALL_ACCESS;
+    ObjectTypeInitializer.UseDefaultObject = TRUE;
+    ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExSemaphoreObjectType);
 }
 
 /*

Modified: trunk/reactos/ntoskrnl/ex/timer.c
--- trunk/reactos/ntoskrnl/ex/timer.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/timer.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -223,32 +223,22 @@
 INIT_FUNCTION
 ExpInitializeTimerImplementation(VOID)
 {
-    DPRINT("ExpInitializeTimerImplementation()\n");
+    OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+    UNICODE_STRING Name;
 
-    /* Allocate Memory for the Timer */
-    ExTimerType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
+    DPRINT1("Creating Timer Object Type\n");
+  
+    /* Create the Event Pair Object Type */
+    RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+    RtlInitUnicodeString(&Name, L"Timer");
+    ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+    ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KTIMER);
+    ObjectTypeInitializer.GenericMapping = ExpTimerMapping;
+    ObjectTypeInitializer.PoolType = NonPagedPool;
+    ObjectTypeInitializer.ValidAccessMask = TIMER_ALL_ACCESS;
+    ObjectTypeInitializer.UseDefaultObject = TRUE;
+    ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExTimerType);
 
-    /* Create the Executive Timer Object */
-    RtlInitUnicodeString(&ExTimerType->TypeName, L"Timer");
-    ExTimerType->Tag = TAG('T', 'I', 'M', 'T');
-    ExTimerType->PeakObjects = 0;
-    ExTimerType->PeakHandles = 0;
-    ExTimerType->TotalObjects = 0;
-    ExTimerType->TotalHandles = 0;
-    ExTimerType->PagedPoolCharge = 0;
-    ExTimerType->NonpagedPoolCharge = sizeof(ETIMER);
-    ExTimerType->Mapping = &ExpTimerMapping;
-    ExTimerType->Dump = NULL;
-    ExTimerType->Open = NULL;
-    ExTimerType->Close = NULL;
-    ExTimerType->Delete = ExpDeleteTimer;
-    ExTimerType->Parse = NULL;
-    ExTimerType->Security = NULL;
-    ExTimerType->Open = NULL;
-    ExTimerType->QueryName = NULL;
-    ExTimerType->OkayToClose = NULL;
-    ObpCreateTypeObject(ExTimerType);
-
     /* Initialize the Wait List and Lock */
     KeInitializeSpinLock(&ExpWakeListLock);
     InitializeListHead(&ExpWakeList);

Modified: trunk/reactos/ntoskrnl/ex/win32k.c
--- trunk/reactos/ntoskrnl/ex/win32k.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/ex/win32k.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -39,12 +39,12 @@
                                DESKTOP_READOBJECTS     | DESKTOP_SWITCHDESKTOP   | DESKTOP_WRITEOBJECTS
 };
 
-OBJECT_OPEN_ROUTINE ExpWindowStationObjectOpen = NULL;
-OBJECT_PARSE_ROUTINE ExpWindowStationObjectParse = NULL;
-OBJECT_DELETE_ROUTINE ExpWindowStationObjectDelete = NULL;
-OBJECT_FIND_ROUTINE ExpWindowStationObjectFind = NULL;
-OBJECT_CREATE_ROUTINE ExpDesktopObjectCreate = NULL;
-OBJECT_DELETE_ROUTINE ExpDesktopObjectDelete = NULL;
+OB_OPEN_METHOD ExpWindowStationObjectOpen = NULL;
+OB_PARSE_METHOD ExpWindowStationObjectParse = NULL;
+OB_DELETE_METHOD ExpWindowStationObjectDelete = NULL;
+OB_FIND_METHOD ExpWindowStationObjectFind = NULL;
+OB_CREATE_METHOD ExpDesktopObjectCreate = NULL;
+OB_DELETE_METHOD ExpDesktopObjectDelete = NULL;
 
 /* FUNCTIONS ****************************************************************/
 
@@ -126,48 +126,33 @@
 INIT_FUNCTION
 ExpWin32kInit(VOID)
 {
-    /* Create window station object type */
-    ExWindowStationObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-    ExWindowStationObjectType->Tag = TAG('W', 'I', 'N', 'S');
-    ExWindowStationObjectType->TotalObjects = 0;
-    ExWindowStationObjectType->TotalHandles = 0;
-    ExWindowStationObjectType->PeakObjects = 0;
-    ExWindowStationObjectType->PeakHandles = 0;
-    ExWindowStationObjectType->PagedPoolCharge = 0;
-    ExWindowStationObjectType->NonpagedPoolCharge = sizeof(WINSTATION_OBJECT);
-    ExWindowStationObjectType->Mapping = &ExpWindowStationMapping;
-    ExWindowStationObjectType->Dump = NULL;
-    ExWindowStationObjectType->Open = ExpWinStaObjectOpen;
-    ExWindowStationObjectType->Close = NULL;
-    ExWindowStationObjectType->Delete = ExpWinStaObjectDelete;
-    ExWindowStationObjectType->Parse = ExpWinStaObjectParse;
-    ExWindowStationObjectType->Security = NULL;
-    ExWindowStationObjectType->QueryName = NULL;
-    ExWindowStationObjectType->OkayToClose = NULL;
-    RtlInitUnicodeString(&ExWindowStationObjectType->TypeName, L"WindowStation");
-    ObpCreateTypeObject(ExWindowStationObjectType);
+    OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+    UNICODE_STRING Name;
 
+    DPRINT1("Creating window station  Object Type\n");
+  
+    /* Create the window station Object Type */
+    RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+    RtlInitUnicodeString(&Name, L"WindowStation");
+    ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+    ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(WINSTATION_OBJECT);
+    ObjectTypeInitializer.GenericMapping = ExpWindowStationMapping;
+    ObjectTypeInitializer.PoolType = NonPagedPool;
+    ObjectTypeInitializer.UseDefaultObject = TRUE;
+    ObjectTypeInitializer.OpenProcedure = ExpWinStaObjectOpen;
+    ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete;
+    ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse;
+    ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExWindowStationObjectType);
+
     /* Create desktop object type */
-    ExDesktopObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-    ExDesktopObjectType->Tag = TAG('D', 'E', 'S', 'K');
-    ExDesktopObjectType->TotalObjects = 0;
-    ExDesktopObjectType->TotalHandles = 0;
-    ExDesktopObjectType->PeakObjects = 0;
-    ExDesktopObjectType->PeakHandles = 0;
-    ExDesktopObjectType->PagedPoolCharge = 0;
-    ExDesktopObjectType->NonpagedPoolCharge = sizeof(DESKTOP_OBJECT);
-    ExDesktopObjectType->Mapping = &ExpDesktopMapping;
-    ExDesktopObjectType->Dump = NULL;
-    ExDesktopObjectType->Open = NULL;
-    ExDesktopObjectType->Close = NULL;
-    ExDesktopObjectType->Delete = ExpDesktopDelete;
-    ExDesktopObjectType->Parse = NULL;
-    ExDesktopObjectType->Security = NULL;
-    ExDesktopObjectType->QueryName = NULL;
-    ExDesktopObjectType->OkayToClose = NULL;
+    RtlInitUnicodeString(&Name, L"Desktop");
+    ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DESKTOP_OBJECT);
+    ObjectTypeInitializer.GenericMapping = ExpDesktopMapping;
+    ObjectTypeInitializer.OpenProcedure = NULL;
+    ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete;
+    ObjectTypeInitializer.ParseProcedure = NULL;
    
-    RtlInitUnicodeString(&ExDesktopObjectType->TypeName, L"Desktop");
-    ObpCreateTypeObject(ExDesktopObjectType);
+    ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &ExDesktopObjectType);
 }
 
 /* EOF */

Modified: trunk/reactos/ntoskrnl/include/internal/io.h
--- trunk/reactos/ntoskrnl/include/internal/io.h	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/include/internal/io.h	2005-05-15 17:59:33 UTC (rev 15317)
@@ -42,6 +42,7 @@
 #define IO_METHOD_FROM_CTL_CODE(ctlCode) (ctlCode&0x00000003)
 
 struct _DEVICE_OBJECT_POWER_EXTENSION;
+extern POBJECT_TYPE IoCompletionType;
 
 /* This is like the IRP Overlay so we can optimize its insertion */
 typedef struct _IO_COMPLETION_PACKET

Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
--- trunk/reactos/ntoskrnl/include/internal/ob.h	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/include/internal/ob.h	2005-05-15 17:59:33 UTC (rev 15317)
@@ -16,15 +16,6 @@
 
 struct _EPROCESS;
 
-typedef enum _OB_OPEN_REASON
-{    
-    ObCreateHandle,
-    ObOpenHandle,
-    ObDuplicateHandle,
-    ObInheritHandle,
-    ObMaxOpenReason
-} OB_OPEN_REASON;
-
 typedef struct
 {
    CSHORT Type;
@@ -33,121 +24,46 @@
 
 typedef PVOID POBJECT;
 
+typedef struct _OBJECT_TYPE_INITIALIZER
+{
+    WORD Length;
+    UCHAR UseDefaultObject;
+    UCHAR CaseInsensitive;
+    ULONG InvalidAttributes;
+    GENERIC_MAPPING GenericMapping;
+    ULONG ValidAccessMask;
+    UCHAR SecurityRequired;
+    UCHAR MaintainHandleCount;
+    UCHAR MaintainTypeList;
+    POOL_TYPE PoolType;
+    ULONG DefaultPagedPoolCharge;
+    ULONG DefaultNonPagedPoolCharge;
+    OB_DUMP_METHOD DumpProcedure;
+    OB_OPEN_METHOD OpenProcedure;
+    OB_CLOSE_METHOD CloseProcedure;
+    OB_DELETE_METHOD DeleteProcedure;
+    OB_PARSE_METHOD ParseProcedure;
+    OB_SECURITY_METHOD SecurityProcedure;
+    OB_QUERYNAME_METHOD QueryNameProcedure;
+    OB_OKAYTOCLOSE_METHOD OkayToCloseProcedure;
+} OBJECT_TYPE_INITIALIZER, *POBJECT_TYPE_INITIALIZER;
 
 typedef struct _OBJECT_TYPE
 {
-  /*
-   * PURPOSE: Tag to be used when allocating objects of this type
-   */
-  ULONG Tag;
-
-  /*
-   * PURPOSE: Name of the type
-   */
-  UNICODE_STRING TypeName;
-
-  /*
-   * PURPOSE: Total number of objects of this type
-   */
-  ULONG TotalObjects;
-
-  /*
-   * PURPOSE: Total number of handles of this type
-   */
-  ULONG TotalHandles;
-
-  /*
-   * PURPOSE: Peak objects of this type
-   */
-  ULONG PeakObjects;
-
-   /*
-    * PURPOSE: Peak handles of this type
-    */
-  ULONG PeakHandles;
-
-  /*
-   * PURPOSE: Paged pool charge
-   */
-   ULONG PagedPoolCharge;
-
-  /*
-   * PURPOSE: Nonpaged pool charge
-   */
-  ULONG NonpagedPoolCharge;
-
-  /*
-   * PURPOSE: Mapping of generic access rights
-   */
-  PGENERIC_MAPPING Mapping;
-
-  /*
-   * PURPOSE: Dumps the object
-   * NOTE: To be defined
-   */
-  VOID STDCALL_FUNC (*Dump)(VOID);
-
-   /*
-    * PURPOSE: Called to close an object if OkayToClose returns true
-    */
-  VOID STDCALL_FUNC (*Close)(PVOID ObjectBody,
-         ULONG HandleCount);
-
-  /*
-   * PURPOSE: Called to delete an object when the last reference is removed
-   */
-  VOID STDCALL_FUNC (*Delete)(PVOID ObjectBody);
-
-  /*
-   * PURPOSE: Called when an open attempts to open a file apparently
-   * residing within the object
-   * RETURNS
-   *     STATUS_SUCCESS       NextObject was found
-   *     STATUS_UNSUCCESSFUL  NextObject not found
-   *     STATUS_REPARSE       Path changed, restart parsing the path
-   */
-   NTSTATUS STDCALL_FUNC (*Parse)(PVOID ParsedObject,
-              PVOID *NextObject,
-              PUNICODE_STRING FullPath,
-              PWSTR *Path,
-              ULONG Attributes);
-
-  /*
-   * PURPOSE: Called to set, query, delete or assign a security-descriptor
-   * to the object
-   * RETURNS
-   *     STATUS_SUCCESS       NextObject was found
-   */
-  NTSTATUS STDCALL_FUNC (*Security)(PVOID ObjectBody,
-                SECURITY_OPERATION_CODE OperationCode,
-                SECURITY_INFORMATION SecurityInformation,
-                PSECURITY_DESCRIPTOR SecurityDescriptor,
-                PULONG BufferLength);
-
-  /*
-   * PURPOSE: Called to query the name of the object
-   * RETURNS
-   *     STATUS_SUCCESS       NextObject was found
-   */
-  NTSTATUS STDCALL_FUNC (*QueryName)(PVOID ObjectBody,
-                 POBJECT_NAME_INFORMATION ObjectNameInfo,
-                 ULONG Length,
-                 PULONG ReturnLength);
-
-  /*
-   * PURPOSE: Called when a process asks to close the object
-   */
-  VOID STDCALL_FUNC (*OkayToClose)(VOID);
-
-  NTSTATUS STDCALL_FUNC (*Open)(OB_OPEN_REASON Reason,
-                                PVOID ObjectBody,
-                                PEPROCESS Process,
-                                ULONG HandleCount,
-                                ACCESS_MASK GrantedAccess);
+    ERESOURCE Mutex;                    /* Used to lock the Object Type */
+    LIST_ENTRY TypeList;                /* Links all the Types Together for Debugging */
+    UNICODE_STRING Name;                /* Name of the Type */
+    PVOID DefaultObject;                /* What Object to use during a Wait (ie, FileObjects wait on FileObject->Event) */
+    ULONG Index;                        /* Index of this Type in the Object Directory */
+    ULONG TotalNumberOfObjects;         /* Total number of objects of this type */
+    ULONG TotalNumberOfHandles;         /* Total number of handles of this type */
+    ULONG HighWaterNumberOfObjects;     /* Peak number of objects of this type */
+    ULONG HighWaterNumberOfHandles;     /* Peak number of handles of this type */
+    OBJECT_TYPE_INITIALIZER TypeInfo;   /* Information captured during type creation */
+    ULONG Key;                          /* Key to use when allocating objects of this type */
+    ERESOURCE ObjectLocks[4];           /* Locks for locking the Objects */
 } OBJECT_TYPE;
 
-
-
 typedef struct _OBJECT_HEADER
 /*
  * PURPOSE: Header for every object managed by the object manager
@@ -281,7 +197,9 @@
 		       POBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo);
 
 NTSTATUS
-ObpCreateTypeObject(POBJECT_TYPE ObjectType);
+ObpCreateTypeObject(POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, 
+                    PUNICODE_STRING TypeName, 
+                    POBJECT_TYPE *ObjectType);
 
 ULONG
 ObGetObjectHandleCount(PVOID Object);

Modified: trunk/reactos/ntoskrnl/include/internal/port.h
--- trunk/reactos/ntoskrnl/include/internal/port.h	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/include/internal/port.h	2005-05-15 17:59:33 UTC (rev 15317)
@@ -98,10 +98,10 @@
 /* Code in ntoskrnl/lpc/close.h */
 
 VOID STDCALL
-NiClosePort (PVOID	ObjectBody,
+LpcpClosePort (PVOID	ObjectBody,
 	     ULONG	HandleCount);
 VOID STDCALL
-NiDeletePort (IN	PVOID	ObjectBody);
+LpcpDeletePort (IN	PVOID	ObjectBody);
 
 /* Code in ntoskrnl/lpc/queue.c */
 

Modified: trunk/reactos/ntoskrnl/io/driver.c
--- trunk/reactos/ntoskrnl/io/driver.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/io/driver.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -85,30 +85,26 @@
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
-VOID INIT_FUNCTION
+VOID 
+INIT_FUNCTION
 IopInitDriverImplementation(VOID)
 {
-   /* Register the process object type */
-   IoDriverObjectType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-   IoDriverObjectType->Tag = TAG('D', 'R', 'V', 'R');
-   IoDriverObjectType->TotalObjects = 0;
-   IoDriverObjectType->TotalHandles = 0;
-   IoDriverObjectType->PeakObjects = 0;
-   IoDriverObjectType->PeakHandles = 0;
-   IoDriverObjectType->PagedPoolCharge = 0;
-   IoDriverObjectType->NonpagedPoolCharge = sizeof(DRIVER_OBJECT);
-   IoDriverObjectType->Dump = NULL;
-   IoDriverObjectType->Open = NULL;
-   IoDriverObjectType->Close = NULL;
-   IoDriverObjectType->Delete = IopDeleteDriver;
-   IoDriverObjectType->Parse = NULL;
-   IoDriverObjectType->Security = NULL;
-   IoDriverObjectType->QueryName = NULL;
-   IoDriverObjectType->OkayToClose = NULL;
-   RtlInitUnicodeString(&IoDriverObjectType->TypeName, L"Driver");
+   OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+   UNICODE_STRING Name;
 
-   ObpCreateTypeObject(IoDriverObjectType);
+   DPRINT1("Creating Registry Object Type\n");
+  
+   /* Initialize the Driver object type  */
+   RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+   RtlInitUnicodeString(&Name, L"Driver");
+   ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+   ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(DRIVER_OBJECT);
+   ObjectTypeInitializer.PoolType = NonPagedPool;
+   ObjectTypeInitializer.UseDefaultObject = TRUE;
+   ObjectTypeInitializer.DeleteProcedure = IopDeleteDriver;
 
+   ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &IoDriverObjectType);
+
    InitializeListHead(&DriverReinitListHead);
    KeInitializeSpinLock(&DriverReinitListLock);
    DriverReinitTailEntry = NULL;

Modified: trunk/reactos/ntoskrnl/io/file.c
--- trunk/reactos/ntoskrnl/io/file.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/io/file.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -776,7 +776,7 @@
       }
    }
    RtlMapGenericMask(&DesiredAccess,
-                      BODY_TO_HEADER(FileObject)->ObjectType->Mapping);
+                      &BODY_TO_HEADER(FileObject)->ObjectType->TypeInfo.GenericMapping);
 
    Status = ObInsertObject ((PVOID)FileObject,
        NULL,
@@ -2695,7 +2695,7 @@
             /* Reference the Port */
             Status = ObReferenceObjectByHandle(CompletionInfo->IoCompletionHandle,
                                                IO_COMPLETION_MODIFY_STATE,
-                                               ExIoCompletionType,
+                                               IoCompletionType,
                                                PreviousMode,
                                                (PVOID*)&Queue,
                                                NULL);

Modified: trunk/reactos/ntoskrnl/io/iocomp.c
--- trunk/reactos/ntoskrnl/io/iocomp.c	2005-05-15 16:09:13 UTC (rev 15316)
+++ trunk/reactos/ntoskrnl/io/iocomp.c	2005-05-15 17:59:33 UTC (rev 15317)
@@ -15,11 +15,11 @@
 
 #define IOC_TAG   TAG('I', 'O', 'C', 'T')
 
-POBJECT_TYPE ExIoCompletionType;
+POBJECT_TYPE IoCompletionType;
 
 NPAGED_LOOKASIDE_LIST IoCompletionPacketLookaside;
 
-static GENERIC_MAPPING ExIoCompletionMapping =
+static GENERIC_MAPPING IopCompletionMapping =
 {
     STANDARD_RIGHTS_READ    | IO_COMPLETION_QUERY_STATE,
     STANDARD_RIGHTS_WRITE   | IO_COMPLETION_MODIFY_STATE,
@@ -27,7 +27,7 @@
     IO_COMPLETION_ALL_ACCESS
 };
 
-static const INFORMATION_CLASS_INFO ExIoCompletionInfoClass[] = {
+static const INFORMATION_CLASS_INFO IoCompletionInfoClass[] = {
 
      /* IoCompletionBasicInformation */
     ICI_SQ_SAME( sizeof(IO_COMPLETION_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ),
@@ -203,25 +203,22 @@
 FASTCALL
 IopInitIoCompletionImplementation(VOID)
 {
-    /* Create the IO Completion Type */
-    ExIoCompletionType = ExAllocatePool(NonPagedPool, sizeof(OBJECT_TYPE));
-    RtlInitUnicodeString(&ExIoCompletionType->TypeName, L"IoCompletion");
-    ExIoCompletionType->Tag = IOC_TAG;
-    ExIoCompletionType->PeakObjects = 0;
-    ExIoCompletionType->PeakHandles = 0;
-    ExIoCompletionType->TotalObjects = 0;
-    ExIoCompletionType->TotalHandles = 0;
-    ExIoCompletionType->PagedPoolCharge = 0;
-    ExIoCompletionType->NonpagedPoolCharge = sizeof(KQUEUE);
-    ExIoCompletionType->Mapping = &ExIoCompletionMapping;
-    ExIoCompletionType->Dump = NULL;
-    ExIoCompletionType->Open = NULL;
-    ExIoCompletionType->Close = NULL;
-    ExIoCompletionType->Delete = IopDeleteIoCompletion;
-    ExIoCompletionType->Parse = NULL;
-    ExIoCompletionType->Security = NULL;
-    ExIoCompletionType->QueryName = NULL;
-    ExIoCompletionType->OkayToClose = NULL;
+    OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
+    UNICODE_STRING Name;
+
+    DPRINT1("Creating IoCompletion Object Type\n");
+  
+    /* Initialize the Driver object type  */
+    RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
+    RtlInitUnicodeString(&Name, L"IoCompletion");
+    ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
+    ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(KQUEUE);
+    ObjectTypeInitializer.PoolType = NonPagedPool;
+    ObjectTypeInitializer.ValidAccessMask = IO_COMPLETION_ALL_ACCESS;
+    ObjectTypeInitializer.UseDefaultObject = TRUE;
+    ObjectTypeInitializer.GenericMapping = IopCompletionMapping;
+    ObjectTypeInitializer.DeleteProcedure = IopDeleteIoCompletion;
+    ObpCreateTypeObject(&ObjectTypeInitializer, &Name, &IoCompletionType);
 }
 
 NTSTATUS
@@ -258,7 +255,7 @@
 
     /* Create the Object */
     Status = ObCreateObject(PreviousMode,
-                            ExIoCompletionType,
+                            IoCompletionType,
                             ObjectAttributes,
                             PreviousMode,
                             NULL,
@@ -330,7 +327,7 @@
 
     /* Open the Object */
     Status = ObOpenObjectByName(ObjectAttributes,
-                                ExIoCompletionType,
+                                IoCompletionType,
                                 NULL,
                                 PreviousMode,
                                 DesiredAccess,
@@ -369,7 +366,7 @@
 
     /* Check buffers and parameters */
     DefaultQueryInfoBufferCheck(IoCompletionInformationClass,
-                                ExIoCompletionInfoClass,
+                                IoCompletionInfoClass,
                                 IoCompletionInformation,
                                 IoCompletionInformationLength,
                                 ResultLength,
@@ -384,7 +381,7 @@
     /* Get the Object */
     Status = ObReferenceObjectByHandle(IoCompletionHandle,
                                        IO_COMPLETION_QUERY_STATE,
-                                       ExIoCompletionType,
+                                       IoCompletionType,
                                        PreviousMode,
[truncated at 1000 lines; 1142 more skipped]