Removed incorrect Create/DuplicationNotify callbacks and replaced by a more correct Open callback which is what a windows driver would get. This is needed because of some changes I'm trying to make to get Parse routines to work properly, so I had to add two hacks for now, they will be removed within 2-3 commits
Modified: trunk/reactos/include/ddk/pstypes.h
Modified: trunk/reactos/ntoskrnl/cm/cm.h
Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c
Modified: trunk/reactos/ntoskrnl/cm/registry.c
Modified: trunk/reactos/ntoskrnl/cm/regobj.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/ob.h
Modified: trunk/reactos/ntoskrnl/io/driver.c
Modified: trunk/reactos/ntoskrnl/io/iocomp.c
Modified: trunk/reactos/ntoskrnl/io/iomgr.c
Modified: trunk/reactos/ntoskrnl/ldr/init.c
Modified: trunk/reactos/ntoskrnl/lpc/create.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/symlink.c
Modified: trunk/reactos/ntoskrnl/ps/job.c
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/ntoskrnl/ps/security.c
Modified: trunk/reactos/ntoskrnl/ps/win32.c
Modified: trunk/reactos/ntoskrnl/se/token.c
Modified: trunk/reactos/subsys/win32k/include/desktop.h
Modified: trunk/reactos/subsys/win32k/include/winsta.h
Modified: trunk/reactos/subsys/win32k/main/dllmain.c
Modified: trunk/reactos/subsys/win32k/ntuser/desktop.c
Modified: trunk/reactos/subsys/win32k/ntuser/winsta.c

Modified: trunk/reactos/include/ddk/pstypes.h
--- trunk/reactos/include/ddk/pstypes.h	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/include/ddk/pstypes.h	2005-05-15 04:56:52 UTC (rev 15293)
@@ -71,11 +71,20 @@
  * 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);
+                         
+typedef NTSTATUS STDCALL_FUNC
+(*OBJECT_OPEN_ROUTINE)(ULONG Reason,
+                       PVOID ObjectBody,
+                       PEPROCESS Process,
+                       ULONG HandleCount,
+                       ACCESS_MASK GrantedAccess);
 
 typedef NTSTATUS STDCALL_FUNC
 (*OBJECT_PARSE_ROUTINE)(PVOID Object,
@@ -93,7 +102,7 @@
                        ULONG Attributes);
                        
 typedef struct _W32_OBJECT_CALLBACK {
-    OBJECT_CREATE_ROUTINE WinStaCreate;
+    OBJECT_OPEN_ROUTINE WinStaCreate;
     OBJECT_PARSE_ROUTINE WinStaParse;
     OBJECT_DELETE_ROUTINE WinStaDelete;
     OBJECT_FIND_ROUTINE WinStaFind;

Modified: trunk/reactos/ntoskrnl/cm/cm.h
--- trunk/reactos/ntoskrnl/cm/cm.h	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/cm/cm.h	2005-05-15 04:56:52 UTC (rev 15293)
@@ -489,12 +489,6 @@
 	       IN OUT PWSTR *Path,
 	       IN ULONG Attribute);
 
-NTSTATUS STDCALL
-CmiObjectCreate(PVOID ObjectBody,
-		PVOID Parent,
-		PWSTR RemainingPath,
-		POBJECT_ATTRIBUTES ObjectAttributes);
-
 VOID STDCALL
 CmiObjectDelete(PVOID  DeletedObject);
 

Modified: trunk/reactos/ntoskrnl/cm/ntfunc.c
--- trunk/reactos/ntoskrnl/cm/ntfunc.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/cm/ntfunc.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -225,13 +225,13 @@
       if (Disposition)
 	*Disposition = REG_OPENED_EXISTING_KEY;
 
-      Status = ObCreateHandle(PsGetCurrentProcess(),
+      Status = ObpCreateHandle(PsGetCurrentProcess(),
 			      Object,
 			      DesiredAccess,
 			      TRUE,
 			      KeyHandle);
 
-      DPRINT("ObCreateHandle failed Status 0x%x\n", Status);
+      DPRINT("ObpCreateHandle failed Status 0x%x\n", Status);
       ObDereferenceObject(Object);
       RtlFreeUnicodeString(&RemainingPath);
       return Status;
@@ -1182,7 +1182,7 @@
 	  goto openkey_cleanup;
     }
 
-  Status = ObCreateHandle(PsGetCurrentProcess(),
+  Status = ObpCreateHandle(PsGetCurrentProcess(),
 			  Object,
 			  DesiredAccess,
 			  TRUE,

Modified: trunk/reactos/ntoskrnl/cm/registry.c
--- trunk/reactos/ntoskrnl/cm/registry.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/cm/registry.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -366,8 +366,6 @@
   CmiKeyType->Security = CmiObjectSecurity;
   CmiKeyType->QueryName = CmiObjectQueryName;
   CmiKeyType->OkayToClose = NULL;
-  CmiKeyType->Create = CmiObjectCreate;
-  CmiKeyType->DuplicationNotify = NULL;
   RtlInitUnicodeString(&CmiKeyType->TypeName, L"Key");
 
   ObpCreateTypeObject (CmiKeyType);

Modified: trunk/reactos/ntoskrnl/cm/regobj.c
--- trunk/reactos/ntoskrnl/cm/regobj.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/cm/regobj.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -263,35 +263,6 @@
   return(STATUS_SUCCESS);
 }
 
-
-NTSTATUS STDCALL
-CmiObjectCreate(PVOID ObjectBody,
-		PVOID Parent,
-		PWSTR RemainingPath,
-		POBJECT_ATTRIBUTES ObjectAttributes)
-{
-  PKEY_OBJECT KeyObject = ObjectBody;
-  PWSTR Start;
-
-  KeyObject->ParentKey = Parent;
-  if (RemainingPath)
-    {
-      Start = RemainingPath;
-      if(*Start == L'\\')
-	Start++;
-      RtlpCreateUnicodeString(&KeyObject->Name,
-              Start, NonPagedPool);
-    }
-   else
-    {
-      RtlInitUnicodeString(&KeyObject->Name,
-			   NULL);
-    }
-
-  return STATUS_SUCCESS;
-}
-
-
 VOID STDCALL
 CmiObjectDelete(PVOID DeletedObject)
 {

Modified: trunk/reactos/ntoskrnl/ex/callback.c
--- trunk/reactos/ntoskrnl/ex/callback.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/callback.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -65,9 +65,7 @@
    ExCallbackObjectType->Parse = NULL;
    ExCallbackObjectType->Security = NULL;
    ExCallbackObjectType->QueryName = NULL;
-   ExCallbackObjectType->DuplicationNotify = NULL;
    ExCallbackObjectType->OkayToClose = NULL;
-   ExCallbackObjectType->Create = NULL;
    ExCallbackObjectType->Mapping = &ExpCallbackMapping;
    ExCallbackObjectType->NonpagedPoolCharge = sizeof(_INT_CALLBACK_OBJECT);
    Status = ObpCreateTypeObject(ExCallbackObjectType);

Modified: trunk/reactos/ntoskrnl/ex/event.c
--- trunk/reactos/ntoskrnl/ex/event.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/event.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -55,8 +55,6 @@
     ExEventObjectType->Security = NULL;
     ExEventObjectType->QueryName = NULL;
     ExEventObjectType->OkayToClose = NULL;
-    ExEventObjectType->Create = NULL;
-    ExEventObjectType->DuplicationNotify = NULL;
     ObpCreateTypeObject(ExEventObjectType);
 }
 

Modified: trunk/reactos/ntoskrnl/ex/evtpair.c
--- trunk/reactos/ntoskrnl/ex/evtpair.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/evtpair.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -52,8 +52,6 @@
     ExEventPairObjectType->Security = NULL;
     ExEventPairObjectType->QueryName = NULL;
     ExEventPairObjectType->OkayToClose = NULL;
-    ExEventPairObjectType->Create = NULL;
-    ExEventPairObjectType->DuplicationNotify = NULL;
     ObpCreateTypeObject(ExEventPairObjectType);
 }
 

Modified: trunk/reactos/ntoskrnl/ex/mutant.c
--- trunk/reactos/ntoskrnl/ex/mutant.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/mutant.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -68,11 +68,10 @@
     ExMutantObjectType->Close = NULL;
     ExMutantObjectType->Delete = ExpDeleteMutant;
     ExMutantObjectType->Parse = NULL;
+    ExMutantObjectType->Open = NULL;
     ExMutantObjectType->Security = NULL;
     ExMutantObjectType->QueryName = NULL;
     ExMutantObjectType->OkayToClose = NULL;
-    ExMutantObjectType->Create = NULL;
-    ExMutantObjectType->DuplicationNotify = NULL;
     ObpCreateTypeObject(ExMutantObjectType);
 }
 

Modified: trunk/reactos/ntoskrnl/ex/profile.c
--- trunk/reactos/ntoskrnl/ex/profile.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/profile.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -94,10 +94,10 @@
     ExProfileObjectType->Close = NULL;
     ExProfileObjectType->Delete = ExpDeleteProfile;
     ExProfileObjectType->Parse = NULL;
+    ExProfileObjectType->Open = NULL;
     ExProfileObjectType->Security = NULL;
     ExProfileObjectType->QueryName = NULL;
     ExProfileObjectType->OkayToClose = NULL;
-    ExProfileObjectType->Create = NULL;
     ObpCreateTypeObject(ExProfileObjectType);
 }
 

Modified: trunk/reactos/ntoskrnl/ex/sem.c
--- trunk/reactos/ntoskrnl/ex/sem.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/sem.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -54,8 +54,6 @@
     ExSemaphoreObjectType->Security = NULL;
     ExSemaphoreObjectType->QueryName = NULL;
     ExSemaphoreObjectType->OkayToClose = NULL;
-    ExSemaphoreObjectType->Create = NULL;
-    ExSemaphoreObjectType->DuplicationNotify = NULL;
     ObpCreateTypeObject(ExSemaphoreObjectType);
 }
 

Modified: trunk/reactos/ntoskrnl/ex/timer.c
--- trunk/reactos/ntoskrnl/ex/timer.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/timer.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -244,10 +244,9 @@
     ExTimerType->Delete = ExpDeleteTimer;
     ExTimerType->Parse = NULL;
     ExTimerType->Security = NULL;
+    ExTimerType->Open = NULL;
     ExTimerType->QueryName = NULL;
     ExTimerType->OkayToClose = NULL;
-    ExTimerType->Create = NULL;
-    ExTimerType->DuplicationNotify = NULL;
     ObpCreateTypeObject(ExTimerType);
 
     /* Initialize the Wait List and Lock */

Modified: trunk/reactos/ntoskrnl/ex/win32k.c
--- trunk/reactos/ntoskrnl/ex/win32k.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ex/win32k.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -39,7 +39,7 @@
                                DESKTOP_READOBJECTS     | DESKTOP_SWITCHDESKTOP   | DESKTOP_WRITEOBJECTS
 };
 
-OBJECT_CREATE_ROUTINE ExpWindowStationObjectCreate = NULL;
+OBJECT_OPEN_ROUTINE ExpWindowStationObjectOpen = NULL;
 OBJECT_PARSE_ROUTINE ExpWindowStationObjectParse = NULL;
 OBJECT_DELETE_ROUTINE ExpWindowStationObjectDelete = NULL;
 OBJECT_FIND_ROUTINE ExpWindowStationObjectFind = NULL;
@@ -50,16 +50,18 @@
 
 NTSTATUS
 STDCALL
-ExpWinStaObjectCreate(PVOID ObjectBody,
-                      PVOID Parent,
-                      PWSTR RemainingPath,
-                      struct _OBJECT_ATTRIBUTES* ObjectAttributes)
+ExpWinStaObjectOpen(OB_OPEN_REASON Reason,
+                    PVOID ObjectBody,
+                    PEPROCESS Process,
+                    ULONG HandleCount,
+                    ACCESS_MASK GrantedAccess)
 {
     /* Call the Registered Callback */
-    return ExpWindowStationObjectCreate(ObjectBody,
-                                        Parent,
-                                        RemainingPath,
-                                        ObjectAttributes);
+    return ExpWindowStationObjectOpen(Reason,
+                                      ObjectBody,
+                                      Process,
+                                      HandleCount,
+                                      GrantedAccess);
 }
 
 VOID
@@ -101,9 +103,9 @@
 NTSTATUS
 STDCALL
 ExpDesktopCreate(PVOID ObjectBody,
-                       PVOID Parent,
-                       PWSTR RemainingPath,
-                       struct _OBJECT_ATTRIBUTES* ObjectAttributes)
+                 PVOID Parent,
+                 PWSTR RemainingPath,
+                 struct _OBJECT_ATTRIBUTES* ObjectAttributes) 
 {
     /* Call the Registered Callback */
     return ExpDesktopObjectCreate(ObjectBody,
@@ -135,15 +137,13 @@
     ExWindowStationObjectType->NonpagedPoolCharge = sizeof(WINSTATION_OBJECT);
     ExWindowStationObjectType->Mapping = &ExpWindowStationMapping;
     ExWindowStationObjectType->Dump = NULL;
-    ExWindowStationObjectType->Open = NULL;
+    ExWindowStationObjectType->Open = ExpWinStaObjectOpen;
     ExWindowStationObjectType->Close = NULL;
     ExWindowStationObjectType->Delete = ExpWinStaObjectDelete;
     ExWindowStationObjectType->Parse = ExpWinStaObjectParse;
     ExWindowStationObjectType->Security = NULL;
     ExWindowStationObjectType->QueryName = NULL;
     ExWindowStationObjectType->OkayToClose = NULL;
-    ExWindowStationObjectType->Create = ExpWinStaObjectCreate;
-    ExWindowStationObjectType->DuplicationNotify = NULL;
     RtlInitUnicodeString(&ExWindowStationObjectType->TypeName, L"WindowStation");
     ObpCreateTypeObject(ExWindowStationObjectType);
 
@@ -165,8 +165,7 @@
     ExDesktopObjectType->Security = NULL;
     ExDesktopObjectType->QueryName = NULL;
     ExDesktopObjectType->OkayToClose = NULL;
-    ExDesktopObjectType->Create = ExpDesktopCreate;
-    ExDesktopObjectType->DuplicationNotify = NULL;
+   
     RtlInitUnicodeString(&ExDesktopObjectType->TypeName, L"Desktop");
     ObpCreateTypeObject(ExDesktopObjectType);
 }

Modified: trunk/reactos/ntoskrnl/include/internal/ob.h
--- trunk/reactos/ntoskrnl/include/internal/ob.h	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/include/internal/ob.h	2005-05-15 04:56:52 UTC (rev 15293)
@@ -16,6 +16,15 @@
 
 struct _EPROCESS;
 
+typedef enum _OB_OPEN_REASON
+{    
+    ObCreateHandle,
+    ObOpenHandle,
+    ObDuplicateHandle,
+    ObInheritHandle,
+    ObMaxOpenReason
+} OB_OPEN_REASON;
+
 typedef struct
 {
    CSHORT Type;
@@ -78,12 +87,6 @@
    */
   VOID STDCALL_FUNC (*Dump)(VOID);
 
-  /*
-   * PURPOSE: Opens the object
-   * NOTE: To be defined
-   */
-  VOID STDCALL_FUNC (*Open)(VOID);
-
    /*
     * PURPOSE: Called to close an object if OkayToClose returns true
     */
@@ -136,14 +139,11 @@
    */
   VOID STDCALL_FUNC (*OkayToClose)(VOID);
 
-  NTSTATUS STDCALL_FUNC (*Create)(PVOID ObjectBody,
-              PVOID Parent,
-              PWSTR RemainingPath,
-              struct _OBJECT_ATTRIBUTES* ObjectAttributes);
-
-  VOID STDCALL_FUNC (*DuplicationNotify)(PEPROCESS DuplicateTo,
-                PEPROCESS DuplicateFrom,
-                PVOID Object);
+  NTSTATUS STDCALL_FUNC (*Open)(OB_OPEN_REASON Reason,
+                                PVOID ObjectBody,
+                                PEPROCESS Process,
+                                ULONG HandleCount,
+                                ACCESS_MASK GrantedAccess);
 } OBJECT_TYPE;
 
 
@@ -259,7 +259,7 @@
 ObInitSymbolicLinkImplementation(VOID);
 
 
-NTSTATUS ObCreateHandle(struct _EPROCESS* Process,
+NTSTATUS ObpCreateHandle(struct _EPROCESS* Process,
 			PVOID ObjectBody,
 			ACCESS_MASK GrantedAccess,
 			BOOLEAN Inherit,

Modified: trunk/reactos/ntoskrnl/io/driver.c
--- trunk/reactos/ntoskrnl/io/driver.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/io/driver.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -80,13 +80,6 @@
 
 /* DECLARATIONS ***************************************************************/
 
-NTSTATUS STDCALL
-IopCreateDriver(
-   PVOID ObjectBody,
-   PVOID Parent,
-   PWSTR RemainingPath,
-   POBJECT_ATTRIBUTES ObjectAttributes);
-
 VOID STDCALL
 IopDeleteDriver(PVOID ObjectBody);
 
@@ -112,8 +105,6 @@
    IoDriverObjectType->Security = NULL;
    IoDriverObjectType->QueryName = NULL;
    IoDriverObjectType->OkayToClose = NULL;
-   IoDriverObjectType->Create = IopCreateDriver;
-   IoDriverObjectType->DuplicationNotify = NULL;
    RtlInitUnicodeString(&IoDriverObjectType->TypeName, L"Driver");
 
    ObpCreateTypeObject(IoDriverObjectType);
@@ -138,46 +129,6 @@
    return STATUS_INVALID_DEVICE_REQUEST;
 }
 
-NTSTATUS STDCALL
-IopCreateDriver(
-   PVOID ObjectBody,
-   PVOID Parent,
-   PWSTR RemainingPath,
-   POBJECT_ATTRIBUTES ObjectAttributes)
-{
-   PDRIVER_OBJECT Object = ObjectBody;
-   ULONG i;
-
-   DPRINT("IopCreateDriver(ObjectBody %x, Parent %x, RemainingPath %S)\n",
-      ObjectBody, Parent, RemainingPath);
-
-   if (RemainingPath != NULL && wcschr(RemainingPath + 1, '\\') != NULL)
-      return STATUS_UNSUCCESSFUL;
-
-   /* Create driver extension */
-   Object->DriverExtension = (PDRIVER_EXTENSION)
-      ExAllocatePoolWithTag(
-         NonPagedPool,
-         sizeof(DRIVER_EXTENSION),
-         TAG_DRIVER_EXTENSION);
-
-   if (Object->DriverExtension == NULL)
-   {
-      return STATUS_NO_MEMORY;
-   }
-
-   RtlZeroMemory(Object->DriverExtension, sizeof(DRIVER_EXTENSION));
-
-   Object->Type = IO_TYPE_DRIVER;
-
-   for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
-      Object->MajorFunction[i] = IopInvalidDeviceRequest;
-
-   Object->HardwareDatabase = &IopHardwareDatabaseKey;
-
-   return STATUS_SUCCESS;
-}
-
 VOID STDCALL
 IopDeleteDriver(PVOID ObjectBody)
 {
@@ -217,6 +168,7 @@
    UNICODE_STRING DriverName;
    OBJECT_ATTRIBUTES ObjectAttributes;
    NTSTATUS Status;
+   ULONG i;
    PWSTR Buffer = NULL;
 
    DPRINT("IopCreateDriverObject(%p '%wZ' %x %p %x)\n",
@@ -269,7 +221,28 @@
    {
       return Status;
    }
+   
+     /* Create driver extension */
+   Object->DriverExtension = (PDRIVER_EXTENSION)
+      ExAllocatePoolWithTag(
+         NonPagedPool,
+         sizeof(DRIVER_EXTENSION),
+         TAG_DRIVER_EXTENSION);
 
+   if (Object->DriverExtension == NULL)
+   {
+      return STATUS_NO_MEMORY;
+   }
+
+   RtlZeroMemory(Object->DriverExtension, sizeof(DRIVER_EXTENSION));
+
+   Object->Type = IO_TYPE_DRIVER;
+
+   for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
+      Object->MajorFunction[i] = IopInvalidDeviceRequest;
+
+   Object->HardwareDatabase = &IopHardwareDatabaseKey;
+
    Object->DriverStart = DriverImageStart;
    Object->DriverSize = DriverImageSize;
    if (Buffer)

Modified: trunk/reactos/ntoskrnl/io/iocomp.c
--- trunk/reactos/ntoskrnl/io/iocomp.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/io/iocomp.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -222,8 +222,6 @@
     ExIoCompletionType->Security = NULL;
     ExIoCompletionType->QueryName = NULL;
     ExIoCompletionType->OkayToClose = NULL;
-    ExIoCompletionType->Create = NULL;
-    ExIoCompletionType->DuplicationNotify = NULL;
 }
 
 NTSTATUS

Modified: trunk/reactos/ntoskrnl/io/iomgr.c
--- trunk/reactos/ntoskrnl/io/iomgr.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/io/iomgr.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -51,7 +51,7 @@
 NPAGED_LOOKASIDE_LIST IoSmallIrpLookaside;
 
 /* INIT FUNCTIONS ************************************************************/
-
+                                
 VOID
 INIT_FUNCTION
 IoInitCancelHandling(VOID)
@@ -217,8 +217,6 @@
   IoDeviceObjectType->Security = NULL;
   IoDeviceObjectType->QueryName = NULL;
   IoDeviceObjectType->OkayToClose = NULL;
-  IoDeviceObjectType->Create = NULL;
-  IoDeviceObjectType->DuplicationNotify = NULL;
 
   RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device");
 
@@ -246,8 +244,6 @@
   IoFileObjectType->Security = IopSecurityFile;
   IoFileObjectType->QueryName = IopQueryNameFile;
   IoFileObjectType->OkayToClose = NULL;
-  IoFileObjectType->Create = IopCreateFile;
-  IoFileObjectType->DuplicationNotify = NULL;
 
   RtlInitUnicodeString(&IoFileObjectType->TypeName, L"File");
 

Modified: trunk/reactos/ntoskrnl/ldr/init.c
--- trunk/reactos/ntoskrnl/ldr/init.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ldr/init.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -89,7 +89,7 @@
       L"\\SystemRoot\\system32\\smss.exe");
 
 
-   Status = ObCreateHandle(
+   Status = ObpCreateHandle(
       PsGetCurrentProcess(),
       PsInitialSystemProcess,
       PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION,

Modified: trunk/reactos/ntoskrnl/lpc/create.c
--- trunk/reactos/ntoskrnl/lpc/create.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/lpc/create.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -62,38 +62,7 @@
   return (STATUS_SUCCESS);
 }
 
-
 /**********************************************************************
- * NAME
- * 	NiCreatePort/4
- *
- * DESCRIPTION
- *
- * ARGUMENTS
- *
- * RETURN VALUE
- */
-NTSTATUS STDCALL
-NiCreatePort (PVOID			ObjectBody,
-	      PVOID			Parent,
-	      PWSTR			RemainingPath,
-	      POBJECT_ATTRIBUTES	ObjectAttributes)
-{
-  if (RemainingPath == NULL)
-    {
-      return (STATUS_SUCCESS);
-    }
-
-  if (wcschr(RemainingPath+1, '\\') != NULL)
-    {
-      return (STATUS_UNSUCCESSFUL);
-    }
-
-  return (STATUS_SUCCESS);
-}
-
-
-/**********************************************************************
  * NAME							EXPORTED
  * 	NtCreatePort/5
  *

Modified: trunk/reactos/ntoskrnl/lpc/port.c
--- trunk/reactos/ntoskrnl/lpc/port.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/lpc/port.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -54,9 +54,8 @@
    LpcPortObjectType->Parse = NULL;
    LpcPortObjectType->Security = NULL;
    LpcPortObjectType->QueryName = NULL;
+   LpcPortObjectType->Open = NULL;
    LpcPortObjectType->OkayToClose = NULL;
-   LpcPortObjectType->Create = NiCreatePort;
-   LpcPortObjectType->DuplicationNotify = NULL;
 
    ObpCreateTypeObject(LpcPortObjectType);
 

Modified: trunk/reactos/ntoskrnl/mm/section.c
--- trunk/reactos/ntoskrnl/mm/section.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/mm/section.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -2068,27 +2068,6 @@
           ObjectBody, HandleCount, ObGetObjectPointerCount(ObjectBody));
 }
 
-NTSTATUS STDCALL
-MmpCreateSection(PVOID ObjectBody,
-                 PVOID Parent,
-                 PWSTR RemainingPath,
-                 POBJECT_ATTRIBUTES ObjectAttributes)
-{
-   DPRINT("MmpCreateSection(ObjectBody %x, Parent %x, RemainingPath %S)\n",
-          ObjectBody, Parent, RemainingPath);
-
-   if (RemainingPath == NULL)
-   {
-      return(STATUS_SUCCESS);
-   }
-
-   if (wcschr(RemainingPath+1, L'\\') != NULL)
-   {
-      return(STATUS_UNSUCCESSFUL);
-   }
-   return(STATUS_SUCCESS);
-}
-
 NTSTATUS INIT_FUNCTION
 MmCreatePhysicalMemorySection(VOID)
 {
@@ -2145,11 +2124,10 @@
    MmSectionObjectType->Close = MmpCloseSection;
    MmSectionObjectType->Delete = MmpDeleteSection;
    MmSectionObjectType->Parse = NULL;
+   MmSectionObjectType->Open = NULL;
    MmSectionObjectType->Security = NULL;
    MmSectionObjectType->QueryName = NULL;
    MmSectionObjectType->OkayToClose = NULL;
-   MmSectionObjectType->Create = MmpCreateSection;
-   MmSectionObjectType->DuplicationNotify = NULL;
 
    /*
     * NOTE: Do not register the section object type here because

Modified: trunk/reactos/ntoskrnl/ob/dirobj.c
--- trunk/reactos/ntoskrnl/ob/dirobj.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ob/dirobj.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -475,6 +475,7 @@
                           0,
                           0,
                           (PVOID*)&Directory);
+
   if(NT_SUCCESS(Status))
   {
     Status = ObInsertObject((PVOID)Directory,

Modified: trunk/reactos/ntoskrnl/ob/handle.c
--- trunk/reactos/ntoskrnl/ob/handle.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ob/handle.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -459,11 +459,11 @@
                                ObjectType->Mapping);
            }
          }
-         Status = ObCreateHandle(TargetProcess,
-                                 ObjectBody,
-                                 DesiredAccess,
-                                 InheritHandle,
-                                 &hTarget);
+         Status = ObpCreateHandle(TargetProcess,
+                                  ObjectBody,
+                                  DesiredAccess,
+                                  InheritHandle,
+                                  &hTarget);
 
          ObDereferenceObject(ObjectBody);
 
@@ -586,7 +586,7 @@
 
 
 NTSTATUS
-ObCreateHandle(PEPROCESS Process,
+ObpCreateHandle(PEPROCESS Process,
 	       PVOID ObjectBody,
 	       ACCESS_MASK GrantedAccess,
 	       BOOLEAN Inherit,
@@ -605,7 +605,7 @@
 
    PAGED_CODE();
 
-   DPRINT("ObCreateHandle(Process %x, obj %x)\n",Process,ObjectBody);
+   DPRINT("ObpCreateHandle(Process %x, obj %x)\n",Process,ObjectBody);
 
    ASSERT(Process);
    ASSERT(ObjectBody);
@@ -941,7 +941,7 @@
   Access = DesiredAccess;
   ObjectHeader = BODY_TO_HEADER(Object);
 
-  return(ObCreateHandle(PsGetCurrentProcess(),
+  return(ObpCreateHandle(PsGetCurrentProcess(),
 			Object,
 			Access,
 			ObjectHeader->Inherit,

Modified: trunk/reactos/ntoskrnl/ob/namespc.c
--- trunk/reactos/ntoskrnl/ob/namespc.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ob/namespc.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -159,7 +159,7 @@
       return Status;
    }
 
-   Status = ObCreateHandle(PsGetCurrentProcess(),
+   Status = ObpCreateHandle(PsGetCurrentProcess(),
 			   Object,
 			   DesiredAccess,
 			   FALSE,
@@ -238,6 +238,24 @@
   KeReleaseSpinLock(&(Header->Parent->Lock),oldlvl);
 }
 
+NTSTATUS
+STDCALL
+ObpCreateDirectory(OB_OPEN_REASON Reason,
+                   PVOID ObjectBody,
+                   PEPROCESS Process,
+                   ULONG HandleCount,
+                   ACCESS_MASK GrantedAccess)
+{
+    PDIRECTORY_OBJECT Directory = ObjectBody;
+    
+    if (Reason == ObCreateHandle)
+    {
+        InitializeListHead(&Directory->head);
+        KeInitializeSpinLock(&Directory->Lock);
+    }
+    
+    return STATUS_SUCCESS;
+}
 
 PVOID
 ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
@@ -350,29 +368,6 @@
 }
 
 
-NTSTATUS STDCALL
-ObpCreateDirectory(PVOID ObjectBody,
-		   PVOID Parent,
-		   PWSTR RemainingPath,
-		   POBJECT_ATTRIBUTES ObjectAttributes)
-{
-  PDIRECTORY_OBJECT DirectoryObject = (PDIRECTORY_OBJECT)ObjectBody;
-
-  DPRINT("ObpCreateDirectory(ObjectBody %x, Parent %x, RemainingPath %S)\n",
-	 ObjectBody, Parent, RemainingPath);
-
-  if (RemainingPath != NULL && wcschr(RemainingPath+1, '\\') != NULL)
-    {
-      return(STATUS_UNSUCCESSFUL);
-    }
-
-  InitializeListHead(&DirectoryObject->head);
-  KeInitializeSpinLock(&DirectoryObject->Lock);
-
-  return(STATUS_SUCCESS);
-}
-
-
 VOID INIT_FUNCTION
 ObInit(VOID)
 /*
@@ -405,8 +400,7 @@
   ObDirectoryType->Security = NULL;
   ObDirectoryType->QueryName = NULL;
   ObDirectoryType->OkayToClose = NULL;
-  ObDirectoryType->Create = ObpCreateDirectory;
-  ObDirectoryType->DuplicationNotify = NULL;
+  ObDirectoryType->Open = ObpCreateDirectory;
 
   RtlInitUnicodeString(&ObDirectoryType->TypeName,
 		       L"Directory");
@@ -430,8 +424,6 @@
   ObTypeObjectType->Security = NULL;
   ObTypeObjectType->QueryName = NULL;
   ObTypeObjectType->OkayToClose = NULL;
-  ObTypeObjectType->Create = NULL;
-  ObTypeObjectType->DuplicationNotify = NULL;
 
   RtlInitUnicodeString(&ObTypeObjectType->TypeName,
 		       L"ObjectType");

Modified: trunk/reactos/ntoskrnl/ob/object.c
--- trunk/reactos/ntoskrnl/ob/object.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ob/object.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -22,7 +22,13 @@
   POBJECT_HEADER ObjectHeader;
 } RETENTION_CHECK_PARAMS, *PRETENTION_CHECK_PARAMS;
 
-
+/* TEMPORARY HACK. DO NOT REMOVE -- Alex */
+NTSTATUS
+STDCALL
+ExpDesktopCreate(PVOID ObjectBody,
+                 PVOID Parent,
+                 PWSTR RemainingPath,
+                 struct _OBJECT_ATTRIBUTES* ObjectAttributes);
 /* FUNCTIONS ************************************************************/
 
 NTSTATUS
@@ -733,6 +739,7 @@
       RtlInitUnicodeString(&RemainingPath, NULL);
     }
 
+    DPRINT("Allocating memory\n");
   Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool,
 						 OBJECT_ALLOC_SIZE(ObjectSize),
 						 Type->Tag);
@@ -786,14 +793,39 @@
       ObjectAttached = TRUE;
     }
 
-  DPRINT("About to call Create Routine\n");
-  if (Header->ObjectType->Create != NULL)
-    {
-      DPRINT("Calling %x\n", Header->ObjectType->Create);
-      Status = Header->ObjectType->Create(HEADER_TO_BODY(Header),
-					  Parent,
-					  RemainingPath.Buffer,
-					  ObjectAttributes);
+    if ((Header->ObjectType == IoFileObjectType) ||
+        (Header->ObjectType == ExDesktopObjectType) ||
+        (Header->ObjectType->Open != NULL))
+    {    
+     DPRINT("About to call Open Routine\n");
+     if (Header->ObjectType == IoFileObjectType)
+     {
+         /* TEMPORARY HACK. DO NOT TOUCH -- Alex */
+         DPRINT("Calling IopCreateFile\n");
+         Status = IopCreateFile(HEADER_TO_BODY(Header),
+                                Parent,
+                                RemainingPath.Buffer,            
+                                ObjectAttributes);
+     }
+     else if (Header->ObjectType == ExDesktopObjectType)
+     {
+         /* TEMPORARY HACK. DO NOT TOUCH -- Alex */
+         DPRINT("Calling ExpDesktopCreate\n");
+         Status = ExpDesktopCreate(HEADER_TO_BODY(Header),
+                                   Parent,
+                                   RemainingPath.Buffer,            
+                                   ObjectAttributes);
+     }
+     else if (Header->ObjectType->Open != NULL)
+     {
+      DPRINT("Calling %x\n", Header->ObjectType->Open);
+      Status = Header->ObjectType->Open(ObCreateHandle,
+                                        HEADER_TO_BODY(Header),
+                                        NULL,
+                                        0,
+                                        0);
+     }
+
       if (!NT_SUCCESS(Status))
 	{
 	  if (ObjectAttached == TRUE)
@@ -810,7 +842,8 @@
 	  DPRINT("Create Failed\n");
 	  return Status;
 	}
-    }
+  }
+
   RtlFreeUnicodeString(&RemainingPath);
 
   SeCaptureSubjectContext(&SubjectContext);
@@ -960,7 +993,7 @@
 	return Status;
      }
 
-   Status = ObCreateHandle(PsGetCurrentProcess(),
+   Status = ObpCreateHandle(PsGetCurrentProcess(),
 			   Object,
 			   DesiredAccess,
 			   (BOOLEAN)(HandleAttributes & OBJ_INHERIT),

Modified: trunk/reactos/ntoskrnl/ob/symlink.c
--- trunk/reactos/ntoskrnl/ob/symlink.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ob/symlink.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -33,29 +33,6 @@
 
 /**********************************************************************
  * NAME							INTERNAL
- *	ObpCreateSymbolicLink
- *
- * DESCRIPTION
- *
- * ARGUMENTS
- *
- * RETURNN VALUE
- *	Status.
- *
- * REVISIONS
- */
-NTSTATUS STDCALL
-ObpCreateSymbolicLink(PVOID Object,
-		      PVOID Parent,
-		      PWSTR RemainingPath,
-		      POBJECT_ATTRIBUTES ObjectAttributes)
-{
-  return(STATUS_SUCCESS);
-}
-
-
-/**********************************************************************
- * NAME							INTERNAL
  *	ObpDeleteSymbolicLink
  *
  * DESCRIPTION
@@ -175,10 +152,9 @@
   ObSymbolicLinkType->Delete = ObpDeleteSymbolicLink;
   ObSymbolicLinkType->Parse = ObpParseSymbolicLink;
   ObSymbolicLinkType->Security = NULL;
+  ObSymbolicLinkType->Open = NULL;
   ObSymbolicLinkType->QueryName = NULL;
   ObSymbolicLinkType->OkayToClose = NULL;
-  ObSymbolicLinkType->Create = ObpCreateSymbolicLink;
-  ObSymbolicLinkType->DuplicationNotify = NULL;
 
   RtlInitUnicodeString(&ObSymbolicLinkType->TypeName,
 		       L"SymbolicLink");

Modified: trunk/reactos/ntoskrnl/ps/job.c
--- trunk/reactos/ntoskrnl/ps/job.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ps/job.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -78,8 +78,7 @@
     PsJobType->Security = NULL;
     PsJobType->QueryName = NULL;
     PsJobType->OkayToClose = NULL;
-    PsJobType->Create = NULL;
-    PsJobType->DuplicationNotify = NULL;
+    PsJobType->Open = NULL;
 
     RtlInitUnicodeString(&PsJobType->TypeName, L"Job");
 

Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
--- trunk/reactos/ntoskrnl/ps/psmgr.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -97,8 +97,7 @@
    PsThreadType->Security = NULL;
    PsThreadType->QueryName = NULL;
    PsThreadType->OkayToClose = NULL;
-   PsThreadType->Create = NULL;
-   PsThreadType->DuplicationNotify = NULL;
+   PsThreadType->Open = NULL;
 
    RtlInitUnicodeString(&PsThreadType->TypeName, L"Thread");
 
@@ -149,8 +148,7 @@
    PsProcessType->Security = NULL;
    PsProcessType->QueryName = NULL;
    PsProcessType->OkayToClose = NULL;
-   PsProcessType->Create = NULL;
-   PsProcessType->DuplicationNotify = NULL;
+   PsProcessType->Open = NULL;
 
    RtlInitUnicodeString(&PsProcessType->TypeName, L"Process");
 

Modified: trunk/reactos/ntoskrnl/ps/security.c
--- trunk/reactos/ntoskrnl/ps/security.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ps/security.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -99,7 +99,7 @@
 				 &Token);
    if(NT_SUCCESS(Status))
    {
-     Status = ObCreateHandle(PsGetCurrentProcess(),
+     Status = ObpCreateHandle(PsGetCurrentProcess(),
 			     Token,
 			     DesiredAccess,
 			     FALSE,

Modified: trunk/reactos/ntoskrnl/ps/win32.c
--- trunk/reactos/ntoskrnl/ps/win32.c	2005-05-14 22:55:21 UTC (rev 15292)
+++ trunk/reactos/ntoskrnl/ps/win32.c	2005-05-15 04:56:52 UTC (rev 15293)
@@ -21,7 +21,7 @@
 static ULONG PspWin32ProcessSize = 0;
 static ULONG PspWin32ThreadSize = 0;
 
-extern OBJECT_CREATE_ROUTINE ExpWindowStationObjectCreate;
+extern OBJECT_OPEN_ROUTINE ExpWindowStationObjectOpen;
 extern OBJECT_PARSE_ROUTINE ExpWindowStationObjectParse;
 extern OBJECT_DELETE_ROUTINE ExpWindowStationObjectDelete;
 extern OBJECT_FIND_ROUTINE ExpWindowStationObjectFind;
@@ -92,7 +92,7 @@
[truncated at 1000 lines; 230 more skipped]