From 036efb7e10c213418570d6abf4495933aedbdca7 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sun, 15 May 2005 04:56:52 +0000 Subject: [PATCH] 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 svn path=/trunk/; revision=15293 --- reactos/include/ddk/pstypes.h | 11 +++- reactos/ntoskrnl/cm/cm.h | 6 --- reactos/ntoskrnl/cm/ntfunc.c | 6 +-- reactos/ntoskrnl/cm/registry.c | 2 - reactos/ntoskrnl/cm/regobj.c | 29 ---------- reactos/ntoskrnl/ex/callback.c | 2 - reactos/ntoskrnl/ex/event.c | 2 - reactos/ntoskrnl/ex/evtpair.c | 2 - reactos/ntoskrnl/ex/mutant.c | 3 +- reactos/ntoskrnl/ex/profile.c | 2 +- reactos/ntoskrnl/ex/sem.c | 2 - reactos/ntoskrnl/ex/timer.c | 3 +- reactos/ntoskrnl/ex/win32k.c | 33 ++++++------ reactos/ntoskrnl/include/internal/ob.h | 30 +++++------ reactos/ntoskrnl/io/driver.c | 71 ++++++++----------------- reactos/ntoskrnl/io/iocomp.c | 2 - reactos/ntoskrnl/io/iomgr.c | 6 +-- reactos/ntoskrnl/ldr/init.c | 2 +- reactos/ntoskrnl/lpc/create.c | 31 ----------- reactos/ntoskrnl/lpc/port.c | 3 +- reactos/ntoskrnl/mm/section.c | 24 +-------- reactos/ntoskrnl/ob/dirobj.c | 1 + reactos/ntoskrnl/ob/handle.c | 16 +++--- reactos/ntoskrnl/ob/namespc.c | 48 +++++++---------- reactos/ntoskrnl/ob/object.c | 55 +++++++++++++++---- reactos/ntoskrnl/ob/symlink.c | 26 +-------- reactos/ntoskrnl/ps/job.c | 3 +- reactos/ntoskrnl/ps/psmgr.c | 6 +-- reactos/ntoskrnl/ps/security.c | 2 +- reactos/ntoskrnl/ps/win32.c | 4 +- reactos/ntoskrnl/se/token.c | 3 +- reactos/subsys/win32k/include/desktop.h | 11 ++-- reactos/subsys/win32k/include/winsta.h | 9 ++-- reactos/subsys/win32k/main/dllmain.c | 13 ++++- reactos/subsys/win32k/ntuser/desktop.c | 3 +- reactos/subsys/win32k/ntuser/winsta.c | 55 +++++++------------ 36 files changed, 195 insertions(+), 332 deletions(-) diff --git a/reactos/include/ddk/pstypes.h b/reactos/include/ddk/pstypes.h index 7b31e080fcc..2cca0ef4cb2 100644 --- a/reactos/include/ddk/pstypes.h +++ b/reactos/include/ddk/pstypes.h @@ -71,11 +71,20 @@ typedef NTSTATUS STDCALL_FUNC * 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 @@ typedef PVOID STDCALL_FUNC 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; diff --git a/reactos/ntoskrnl/cm/cm.h b/reactos/ntoskrnl/cm/cm.h index ff2f45033d5..15630cdbfce 100644 --- a/reactos/ntoskrnl/cm/cm.h +++ b/reactos/ntoskrnl/cm/cm.h @@ -489,12 +489,6 @@ CmiObjectParse(IN PVOID ParsedObject, IN OUT PWSTR *Path, IN ULONG Attribute); -NTSTATUS STDCALL -CmiObjectCreate(PVOID ObjectBody, - PVOID Parent, - PWSTR RemainingPath, - POBJECT_ATTRIBUTES ObjectAttributes); - VOID STDCALL CmiObjectDelete(PVOID DeletedObject); diff --git a/reactos/ntoskrnl/cm/ntfunc.c b/reactos/ntoskrnl/cm/ntfunc.c index ea3de91a9f7..22f84ed0718 100644 --- a/reactos/ntoskrnl/cm/ntfunc.c +++ b/reactos/ntoskrnl/cm/ntfunc.c @@ -225,13 +225,13 @@ NtCreateKey(OUT PHANDLE KeyHandle, 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 @@ NtOpenKey(OUT PHANDLE KeyHandle, goto openkey_cleanup; } - Status = ObCreateHandle(PsGetCurrentProcess(), + Status = ObpCreateHandle(PsGetCurrentProcess(), Object, DesiredAccess, TRUE, diff --git a/reactos/ntoskrnl/cm/registry.c b/reactos/ntoskrnl/cm/registry.c index a11f1da1de3..bd1d810fb14 100644 --- a/reactos/ntoskrnl/cm/registry.c +++ b/reactos/ntoskrnl/cm/registry.c @@ -366,8 +366,6 @@ CmInitializeRegistry(VOID) CmiKeyType->Security = CmiObjectSecurity; CmiKeyType->QueryName = CmiObjectQueryName; CmiKeyType->OkayToClose = NULL; - CmiKeyType->Create = CmiObjectCreate; - CmiKeyType->DuplicationNotify = NULL; RtlInitUnicodeString(&CmiKeyType->TypeName, L"Key"); ObpCreateTypeObject (CmiKeyType); diff --git a/reactos/ntoskrnl/cm/regobj.c b/reactos/ntoskrnl/cm/regobj.c index 97d2ec75c55..15191076476 100644 --- a/reactos/ntoskrnl/cm/regobj.c +++ b/reactos/ntoskrnl/cm/regobj.c @@ -263,35 +263,6 @@ CmiObjectParse(PVOID ParsedObject, 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) { diff --git a/reactos/ntoskrnl/ex/callback.c b/reactos/ntoskrnl/ex/callback.c index a9eadb94a70..3b017429181 100644 --- a/reactos/ntoskrnl/ex/callback.c +++ b/reactos/ntoskrnl/ex/callback.c @@ -65,9 +65,7 @@ ExpInitializeCallbacks(VOID) 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); diff --git a/reactos/ntoskrnl/ex/event.c b/reactos/ntoskrnl/ex/event.c index b5011bba773..45220e187ab 100644 --- a/reactos/ntoskrnl/ex/event.c +++ b/reactos/ntoskrnl/ex/event.c @@ -55,8 +55,6 @@ ExpInitializeEventImplementation(VOID) ExEventObjectType->Security = NULL; ExEventObjectType->QueryName = NULL; ExEventObjectType->OkayToClose = NULL; - ExEventObjectType->Create = NULL; - ExEventObjectType->DuplicationNotify = NULL; ObpCreateTypeObject(ExEventObjectType); } diff --git a/reactos/ntoskrnl/ex/evtpair.c b/reactos/ntoskrnl/ex/evtpair.c index a7af0db2b32..43c0dd97adb 100644 --- a/reactos/ntoskrnl/ex/evtpair.c +++ b/reactos/ntoskrnl/ex/evtpair.c @@ -52,8 +52,6 @@ ExpInitializeEventPairImplementation(VOID) ExEventPairObjectType->Security = NULL; ExEventPairObjectType->QueryName = NULL; ExEventPairObjectType->OkayToClose = NULL; - ExEventPairObjectType->Create = NULL; - ExEventPairObjectType->DuplicationNotify = NULL; ObpCreateTypeObject(ExEventPairObjectType); } diff --git a/reactos/ntoskrnl/ex/mutant.c b/reactos/ntoskrnl/ex/mutant.c index 5431b11a32d..978a7514064 100644 --- a/reactos/ntoskrnl/ex/mutant.c +++ b/reactos/ntoskrnl/ex/mutant.c @@ -68,11 +68,10 @@ ExpInitializeMutantImplementation(VOID) 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); } diff --git a/reactos/ntoskrnl/ex/profile.c b/reactos/ntoskrnl/ex/profile.c index 7ef0cb74a7f..6863bc4ce97 100644 --- a/reactos/ntoskrnl/ex/profile.c +++ b/reactos/ntoskrnl/ex/profile.c @@ -94,10 +94,10 @@ ExpInitializeProfileImplementation(VOID) 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); } diff --git a/reactos/ntoskrnl/ex/sem.c b/reactos/ntoskrnl/ex/sem.c index c8d5ece3d70..cc69a8131a5 100644 --- a/reactos/ntoskrnl/ex/sem.c +++ b/reactos/ntoskrnl/ex/sem.c @@ -54,8 +54,6 @@ ExpInitializeSemaphoreImplementation(VOID) ExSemaphoreObjectType->Security = NULL; ExSemaphoreObjectType->QueryName = NULL; ExSemaphoreObjectType->OkayToClose = NULL; - ExSemaphoreObjectType->Create = NULL; - ExSemaphoreObjectType->DuplicationNotify = NULL; ObpCreateTypeObject(ExSemaphoreObjectType); } diff --git a/reactos/ntoskrnl/ex/timer.c b/reactos/ntoskrnl/ex/timer.c index 67cdadb157e..43878f4fc53 100644 --- a/reactos/ntoskrnl/ex/timer.c +++ b/reactos/ntoskrnl/ex/timer.c @@ -244,10 +244,9 @@ ExpInitializeTimerImplementation(VOID) 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 */ diff --git a/reactos/ntoskrnl/ex/win32k.c b/reactos/ntoskrnl/ex/win32k.c index 4de1504836f..15f645f4bb6 100644 --- a/reactos/ntoskrnl/ex/win32k.c +++ b/reactos/ntoskrnl/ex/win32k.c @@ -39,7 +39,7 @@ static GENERIC_MAPPING ExpDesktopMapping = { 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 @@ OBJECT_DELETE_ROUTINE ExpDesktopObjectDelete = NULL; 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 @@ ExpWinStaObjectParse(PVOID Object, 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 @@ ExpWin32kInit(VOID) 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 @@ ExpWin32kInit(VOID) ExDesktopObjectType->Security = NULL; ExDesktopObjectType->QueryName = NULL; ExDesktopObjectType->OkayToClose = NULL; - ExDesktopObjectType->Create = ExpDesktopCreate; - ExDesktopObjectType->DuplicationNotify = NULL; + RtlInitUnicodeString(&ExDesktopObjectType->TypeName, L"Desktop"); ObpCreateTypeObject(ExDesktopObjectType); } diff --git a/reactos/ntoskrnl/include/internal/ob.h b/reactos/ntoskrnl/include/internal/ob.h index 939052c639d..82ee74a9dfb 100644 --- a/reactos/ntoskrnl/include/internal/ob.h +++ b/reactos/ntoskrnl/include/internal/ob.h @@ -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 @@ typedef struct _OBJECT_TYPE */ 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 @@ typedef struct _OBJECT_TYPE */ 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 @@ VOID ObInitSymbolicLinkImplementation(VOID); -NTSTATUS ObCreateHandle(struct _EPROCESS* Process, +NTSTATUS ObpCreateHandle(struct _EPROCESS* Process, PVOID ObjectBody, ACCESS_MASK GrantedAccess, BOOLEAN Inherit, diff --git a/reactos/ntoskrnl/io/driver.c b/reactos/ntoskrnl/io/driver.c index 0123602d6d9..a1260b7644b 100644 --- a/reactos/ntoskrnl/io/driver.c +++ b/reactos/ntoskrnl/io/driver.c @@ -80,13 +80,6 @@ POBJECT_TYPE EXPORTED IoDriverObjectType = NULL; /* DECLARATIONS ***************************************************************/ -NTSTATUS STDCALL -IopCreateDriver( - PVOID ObjectBody, - PVOID Parent, - PWSTR RemainingPath, - POBJECT_ATTRIBUTES ObjectAttributes); - VOID STDCALL IopDeleteDriver(PVOID ObjectBody); @@ -112,8 +105,6 @@ IopInitDriverImplementation(VOID) 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 @@ IopInvalidDeviceRequest( 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 @@ IopCreateDriverObject( UNICODE_STRING DriverName; OBJECT_ATTRIBUTES ObjectAttributes; NTSTATUS Status; + ULONG i; PWSTR Buffer = NULL; DPRINT("IopCreateDriverObject(%p '%wZ' %x %p %x)\n", @@ -269,6 +221,27 @@ IopCreateDriverObject( { 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; diff --git a/reactos/ntoskrnl/io/iocomp.c b/reactos/ntoskrnl/io/iocomp.c index 298ace65982..03ad5ed3203 100644 --- a/reactos/ntoskrnl/io/iocomp.c +++ b/reactos/ntoskrnl/io/iocomp.c @@ -222,8 +222,6 @@ IopInitIoCompletionImplementation(VOID) ExIoCompletionType->Security = NULL; ExIoCompletionType->QueryName = NULL; ExIoCompletionType->OkayToClose = NULL; - ExIoCompletionType->Create = NULL; - ExIoCompletionType->DuplicationNotify = NULL; } NTSTATUS diff --git a/reactos/ntoskrnl/io/iomgr.c b/reactos/ntoskrnl/io/iomgr.c index 95e119abda4..a8f06dfef24 100644 --- a/reactos/ntoskrnl/io/iomgr.c +++ b/reactos/ntoskrnl/io/iomgr.c @@ -51,7 +51,7 @@ NPAGED_LOOKASIDE_LIST IoLargeIrpLookaside; NPAGED_LOOKASIDE_LIST IoSmallIrpLookaside; /* INIT FUNCTIONS ************************************************************/ - + VOID INIT_FUNCTION IoInitCancelHandling(VOID) @@ -217,8 +217,6 @@ IoInit (VOID) IoDeviceObjectType->Security = NULL; IoDeviceObjectType->QueryName = NULL; IoDeviceObjectType->OkayToClose = NULL; - IoDeviceObjectType->Create = NULL; - IoDeviceObjectType->DuplicationNotify = NULL; RtlInitUnicodeString(&IoDeviceObjectType->TypeName, L"Device"); @@ -246,8 +244,6 @@ IoInit (VOID) IoFileObjectType->Security = IopSecurityFile; IoFileObjectType->QueryName = IopQueryNameFile; IoFileObjectType->OkayToClose = NULL; - IoFileObjectType->Create = IopCreateFile; - IoFileObjectType->DuplicationNotify = NULL; RtlInitUnicodeString(&IoFileObjectType->TypeName, L"File"); diff --git a/reactos/ntoskrnl/ldr/init.c b/reactos/ntoskrnl/ldr/init.c index d68f3535723..ff9d849a628 100644 --- a/reactos/ntoskrnl/ldr/init.c +++ b/reactos/ntoskrnl/ldr/init.c @@ -89,7 +89,7 @@ LdrLoadInitialProcess(PHANDLE ProcessHandle, L"\\SystemRoot\\system32\\smss.exe"); - Status = ObCreateHandle( + Status = ObpCreateHandle( PsGetCurrentProcess(), PsInitialSystemProcess, PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION, diff --git a/reactos/ntoskrnl/lpc/create.c b/reactos/ntoskrnl/lpc/create.c index 9d2339025a5..e5d5c6b6f71 100644 --- a/reactos/ntoskrnl/lpc/create.c +++ b/reactos/ntoskrnl/lpc/create.c @@ -62,37 +62,6 @@ LpcpVerifyCreateParameters (IN PHANDLE PortHandle, 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 diff --git a/reactos/ntoskrnl/lpc/port.c b/reactos/ntoskrnl/lpc/port.c index 60d4ed816f8..bcba731d9d1 100644 --- a/reactos/ntoskrnl/lpc/port.c +++ b/reactos/ntoskrnl/lpc/port.c @@ -54,9 +54,8 @@ LpcpInitSystem (VOID) LpcPortObjectType->Parse = NULL; LpcPortObjectType->Security = NULL; LpcPortObjectType->QueryName = NULL; + LpcPortObjectType->Open = NULL; LpcPortObjectType->OkayToClose = NULL; - LpcPortObjectType->Create = NiCreatePort; - LpcPortObjectType->DuplicationNotify = NULL; ObpCreateTypeObject(LpcPortObjectType); diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 9080e9f6bb4..5a9f74dc0e0 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -2068,27 +2068,6 @@ MmpCloseSection(PVOID ObjectBody, 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 @@ MmInitSectionImplementation(VOID) 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 diff --git a/reactos/ntoskrnl/ob/dirobj.c b/reactos/ntoskrnl/ob/dirobj.c index ca0b805e6a6..ac6a02aa4d6 100644 --- a/reactos/ntoskrnl/ob/dirobj.c +++ b/reactos/ntoskrnl/ob/dirobj.c @@ -475,6 +475,7 @@ NtCreateDirectoryObject (OUT PHANDLE DirectoryHandle, 0, 0, (PVOID*)&Directory); + if(NT_SUCCESS(Status)) { Status = ObInsertObject((PVOID)Directory, diff --git a/reactos/ntoskrnl/ob/handle.c b/reactos/ntoskrnl/ob/handle.c index fc0ddeb4ced..9d5bd4c9a68 100644 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@ -459,11 +459,11 @@ NtDuplicateObject (IN HANDLE SourceProcessHandle, ObjectType->Mapping); } } - Status = ObCreateHandle(TargetProcess, - ObjectBody, - DesiredAccess, - InheritHandle, - &hTarget); + Status = ObpCreateHandle(TargetProcess, + ObjectBody, + DesiredAccess, + InheritHandle, + &hTarget); ObDereferenceObject(ObjectBody); @@ -586,7 +586,7 @@ ObKillProcess(PEPROCESS Process) NTSTATUS -ObCreateHandle(PEPROCESS Process, +ObpCreateHandle(PEPROCESS Process, PVOID ObjectBody, ACCESS_MASK GrantedAccess, BOOLEAN Inherit, @@ -605,7 +605,7 @@ ObCreateHandle(PEPROCESS Process, 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 @@ ObInsertObject(IN PVOID Object, Access = DesiredAccess; ObjectHeader = BODY_TO_HEADER(Object); - return(ObCreateHandle(PsGetCurrentProcess(), + return(ObpCreateHandle(PsGetCurrentProcess(), Object, Access, ObjectHeader->Inherit, diff --git a/reactos/ntoskrnl/ob/namespc.c b/reactos/ntoskrnl/ob/namespc.c index 34cb5d5c479..71253568016 100644 --- a/reactos/ntoskrnl/ob/namespc.c +++ b/reactos/ntoskrnl/ob/namespc.c @@ -159,7 +159,7 @@ ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, return Status; } - Status = ObCreateHandle(PsGetCurrentProcess(), + Status = ObpCreateHandle(PsGetCurrentProcess(), Object, DesiredAccess, FALSE, @@ -238,6 +238,24 @@ ObpRemoveEntryDirectory(POBJECT_HEADER Header) 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 @@ ObpParseDirectory(PVOID Object, } -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 @@ ObInit(VOID) 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 @@ ObInit(VOID) ObTypeObjectType->Security = NULL; ObTypeObjectType->QueryName = NULL; ObTypeObjectType->OkayToClose = NULL; - ObTypeObjectType->Create = NULL; - ObTypeObjectType->DuplicationNotify = NULL; RtlInitUnicodeString(&ObTypeObjectType->TypeName, L"ObjectType"); diff --git a/reactos/ntoskrnl/ob/object.c b/reactos/ntoskrnl/ob/object.c index e96d541891c..df546a495c9 100644 --- a/reactos/ntoskrnl/ob/object.c +++ b/reactos/ntoskrnl/ob/object.c @@ -22,7 +22,13 @@ typedef struct _RETENTION_CHECK_PARAMS 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 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL, RtlInitUnicodeString(&RemainingPath, NULL); } + DPRINT("Allocating memory\n"); Header = (POBJECT_HEADER)ExAllocatePoolWithTag(NonPagedPool, OBJECT_ALLOC_SIZE(ObjectSize), Type->Tag); @@ -786,14 +793,39 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL, 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 @@ ObCreateObject (IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL, DPRINT("Create Failed\n"); return Status; } - } + } + RtlFreeUnicodeString(&RemainingPath); SeCaptureSubjectContext(&SubjectContext); @@ -960,7 +993,7 @@ ObOpenObjectByPointer(IN POBJECT Object, return Status; } - Status = ObCreateHandle(PsGetCurrentProcess(), + Status = ObpCreateHandle(PsGetCurrentProcess(), Object, DesiredAccess, (BOOLEAN)(HandleAttributes & OBJ_INHERIT), diff --git a/reactos/ntoskrnl/ob/symlink.c b/reactos/ntoskrnl/ob/symlink.c index 9872e5b3332..e7da98edb79 100644 --- a/reactos/ntoskrnl/ob/symlink.c +++ b/reactos/ntoskrnl/ob/symlink.c @@ -31,29 +31,6 @@ static GENERIC_MAPPING ObpSymbolicLinkMapping = { /* FUNCTIONS ****************************************************************/ -/********************************************************************** - * 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 @@ -175,10 +152,9 @@ ObInitSymbolicLinkImplementation (VOID) 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"); diff --git a/reactos/ntoskrnl/ps/job.c b/reactos/ntoskrnl/ps/job.c index 7115be5c2ce..f3cbc510b21 100644 --- a/reactos/ntoskrnl/ps/job.c +++ b/reactos/ntoskrnl/ps/job.c @@ -78,8 +78,7 @@ PsInitJobManagment ( VOID ) PsJobType->Security = NULL; PsJobType->QueryName = NULL; PsJobType->OkayToClose = NULL; - PsJobType->Create = NULL; - PsJobType->DuplicationNotify = NULL; + PsJobType->Open = NULL; RtlInitUnicodeString(&PsJobType->TypeName, L"Job"); diff --git a/reactos/ntoskrnl/ps/psmgr.c b/reactos/ntoskrnl/ps/psmgr.c index 51af275d573..164fdd94274 100644 --- a/reactos/ntoskrnl/ps/psmgr.c +++ b/reactos/ntoskrnl/ps/psmgr.c @@ -97,8 +97,7 @@ PsInitThreadManagment(VOID) 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 @@ PsInitProcessManagment(VOID) PsProcessType->Security = NULL; PsProcessType->QueryName = NULL; PsProcessType->OkayToClose = NULL; - PsProcessType->Create = NULL; - PsProcessType->DuplicationNotify = NULL; + PsProcessType->Open = NULL; RtlInitUnicodeString(&PsProcessType->TypeName, L"Process"); diff --git a/reactos/ntoskrnl/ps/security.c b/reactos/ntoskrnl/ps/security.c index 31190e1a4e6..5429dee7942 100644 --- a/reactos/ntoskrnl/ps/security.c +++ b/reactos/ntoskrnl/ps/security.c @@ -99,7 +99,7 @@ NtOpenProcessTokenEx(IN HANDLE ProcessHandle, &Token); if(NT_SUCCESS(Status)) { - Status = ObCreateHandle(PsGetCurrentProcess(), + Status = ObpCreateHandle(PsGetCurrentProcess(), Token, DesiredAccess, FALSE, diff --git a/reactos/ntoskrnl/ps/win32.c b/reactos/ntoskrnl/ps/win32.c index 50ce36fc887..4ccf9f06df2 100644 --- a/reactos/ntoskrnl/ps/win32.c +++ b/reactos/ntoskrnl/ps/win32.c @@ -21,7 +21,7 @@ static PW32_THREAD_CALLBACK PspWin32ThreadCallback = NULL; 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 @@ PsEstablishWin32Callouts (PW32_PROCESS_CALLBACK W32ProcessCallback, PspWin32ProcessSize = W32ProcessSize; PspWin32ThreadSize = W32ThreadSize; - ExpWindowStationObjectCreate = W32ObjectCallback->WinStaCreate; + ExpWindowStationObjectOpen = W32ObjectCallback->WinStaCreate; ExpWindowStationObjectParse = W32ObjectCallback->WinStaParse; ExpWindowStationObjectDelete = W32ObjectCallback->WinStaDelete; ExpWindowStationObjectFind = W32ObjectCallback->WinStaFind; diff --git a/reactos/ntoskrnl/se/token.c b/reactos/ntoskrnl/se/token.c index c9d77236de2..523190737b3 100644 --- a/reactos/ntoskrnl/se/token.c +++ b/reactos/ntoskrnl/se/token.c @@ -580,8 +580,7 @@ SepInitializeTokenImplementation(VOID) SepTokenObjectType->Security = NULL; SepTokenObjectType->QueryName = NULL; SepTokenObjectType->OkayToClose = NULL; - SepTokenObjectType->Create = NULL; - SepTokenObjectType->DuplicationNotify = NULL; + SepTokenObjectType->Open = NULL; RtlInitUnicodeString(&SepTokenObjectType->TypeName, L"Token"); ObpCreateTypeObject (SepTokenObjectType); diff --git a/reactos/subsys/win32k/include/desktop.h b/reactos/subsys/win32k/include/desktop.h index c19e407bb56..fb02d862a59 100644 --- a/reactos/subsys/win32k/include/desktop.h +++ b/reactos/subsys/win32k/include/desktop.h @@ -25,13 +25,12 @@ InitDesktopImpl(VOID); NTSTATUS FASTCALL CleanupDesktopImpl(VOID); - -NTSTATUS -STDCALL + +NTSTATUS STDCALL IntDesktopObjectCreate(PVOID ObjectBody, - PVOID Parent, - PWSTR RemainingPath, - struct _OBJECT_ATTRIBUTES* ObjectAttributes); + PVOID Parent, + PWSTR RemainingPath, + struct _OBJECT_ATTRIBUTES* ObjectAttributes); VOID STDCALL IntDesktopObjectDelete(PVOID DeletedObject); diff --git a/reactos/subsys/win32k/include/winsta.h b/reactos/subsys/win32k/include/winsta.h index e150daeb1b4..d3307ed0e15 100644 --- a/reactos/subsys/win32k/include/winsta.h +++ b/reactos/subsys/win32k/include/winsta.h @@ -25,10 +25,11 @@ CleanupWindowStationImpl(VOID); NTSTATUS STDCALL -IntWinStaObjectCreate(PVOID ObjectBody, - PVOID Parent, - PWSTR RemainingPath, - struct _OBJECT_ATTRIBUTES* ObjectAttributes); +IntWinStaObjectOpen(ULONG Reason, + PVOID ObjectBody, + PEPROCESS Process, + ULONG HandleCount, + ACCESS_MASK GrantedAccess); VOID STDCALL IntWinStaObjectDelete(PVOID DeletedObject); diff --git a/reactos/subsys/win32k/main/dllmain.c b/reactos/subsys/win32k/main/dllmain.c index 23deca941db..aa31657cc38 100644 --- a/reactos/subsys/win32k/main/dllmain.c +++ b/reactos/subsys/win32k/main/dllmain.c @@ -39,12 +39,21 @@ typedef NTSTATUS (STDCALL *PW32_THREAD_CALLBACK)( * 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, PVOID *NextObject, @@ -61,7 +70,7 @@ typedef PVOID STDCALL_FUNC 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; @@ -309,7 +318,7 @@ DllMain ( /* * Register Object Manager Callbacks */ - Win32kObjectCallbacks.WinStaCreate = IntWinStaObjectCreate; + Win32kObjectCallbacks.WinStaCreate = IntWinStaObjectOpen; Win32kObjectCallbacks.WinStaParse = IntWinStaObjectParse; Win32kObjectCallbacks.WinStaDelete = IntWinStaObjectDelete; Win32kObjectCallbacks.WinStaFind = IntWinStaObjectFind; diff --git a/reactos/subsys/win32k/ntuser/desktop.c b/reactos/subsys/win32k/ntuser/desktop.c index 5abdab0d647..3a6d1f00d82 100644 --- a/reactos/subsys/win32k/ntuser/desktop.c +++ b/reactos/subsys/win32k/ntuser/desktop.c @@ -77,6 +77,7 @@ IntDesktopObjectCreate(PVOID ObjectBody, PDESKTOP_OBJECT Desktop = (PDESKTOP_OBJECT)ObjectBody; UNICODE_STRING UnicodeString; + DPRINT("Creating desktop (0x%X) Name (%S)\n", Desktop, RemainingPath); if (RemainingPath == NULL) { return STATUS_SUCCESS; @@ -89,7 +90,7 @@ IntDesktopObjectCreate(PVOID ObjectBody, RtlInitUnicodeString(&UnicodeString, (RemainingPath + 1)); - DPRINT("Creating desktop (0x%X) Name (%wZ)\n", Desktop, &UnicodeString); + KeInitializeSpinLock(&Desktop->Lock); InitializeListHead(&Desktop->ShellHookWindows); diff --git a/reactos/subsys/win32k/ntuser/winsta.c b/reactos/subsys/win32k/ntuser/winsta.c index f5a979c8785..0e290d20cca 100644 --- a/reactos/subsys/win32k/ntuser/winsta.c +++ b/reactos/subsys/win32k/ntuser/winsta.c @@ -84,51 +84,31 @@ CleanupWindowStationImpl(VOID) NTSTATUS STDCALL -IntWinStaObjectCreate(PVOID ObjectBody, - PVOID Parent, - PWSTR RemainingPath, - struct _OBJECT_ATTRIBUTES* ObjectAttributes) +IntWinStaObjectOpen(ULONG Reason, + PVOID ObjectBody, + PEPROCESS Process, + ULONG HandleCount, + ACCESS_MASK GrantedAccess) { PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)ObjectBody; - UNICODE_STRING UnicodeString; NTSTATUS Status; - if (RemainingPath == NULL) - { - return STATUS_SUCCESS; - } - - if (wcschr((RemainingPath + 1), '\\') != NULL) - { - return STATUS_UNSUCCESSFUL; - } - - RtlInitUnicodeString(&UnicodeString, (RemainingPath + 1)); - - DPRINT("Creating window station (0x%X) Name (%wZ)\n", WinSta, &UnicodeString); - - Status = RtlCreateUnicodeString(&WinSta->Name, UnicodeString.Buffer); - if (!NT_SUCCESS(Status)) + if (Reason == ObCreateHandle) { - return Status; - } + DPRINT("Creating window station (0x%X)\n", WinSta); - KeInitializeSpinLock(&WinSta->Lock); + KeInitializeSpinLock(&WinSta->Lock); - InitializeListHead(&WinSta->DesktopListHead); + InitializeListHead(&WinSta->DesktopListHead); - WinSta->AtomTable = NULL; + WinSta->AtomTable = NULL; - Status = RtlCreateAtomTable(37, &WinSta->AtomTable); - if (!NT_SUCCESS(Status)) - { - RtlFreeUnicodeString(&WinSta->Name); - return Status; - } + Status = RtlCreateAtomTable(37, &WinSta->AtomTable); - WinSta->SystemMenuTemplate = (HANDLE)0; + WinSta->SystemMenuTemplate = (HANDLE)0; - DPRINT("Window station successfully created. Name (%wZ)\n", &WinSta->Name); + DPRINT("Window station successfully created.\n"); + } return STATUS_SUCCESS; } @@ -508,6 +488,8 @@ NtUserCreateWindowStation( SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); return 0; } + + WindowStationObject->Name = *lpszWindowStationName; Status = ObInsertObject( (PVOID)WindowStationObject, @@ -519,7 +501,7 @@ NtUserCreateWindowStation( if (!NT_SUCCESS(Status)) { - DPRINT("Failed creating window station (%wZ)\n", &WindowStationName); + DPRINT1("Failed creating window station (%wZ)\n", &WindowStationName); ExFreePool(WindowStationName.Buffer); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); ObDereferenceObject(WindowStationObject); @@ -575,9 +557,8 @@ NtUserCreateWindowStation( /* FIXME: Complain more loudly? */ } - DPRINT("Window station successfully created (%wZ)\n", &WindowStationName); + DPRINT("Window station successfully created (%wZ)\n", lpszWindowStationName); ExFreePool(WindowStationName.Buffer); - return WindowStation; }