From 1c378756d01147b34478bbbd3bbf84d3ab3d8a2f Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 8 Jun 2006 19:00:22 +0000 Subject: [PATCH] - Kill a bunch of deprecated hacks, because removing hacks is always cool! svn path=/trunk/; revision=22286 --- reactos/ntoskrnl/ex/sysinfo.c | 7 +-- reactos/ntoskrnl/ex/win32k.c | 24 -------- reactos/ntoskrnl/ob/obhandle.c | 27 --------- reactos/ntoskrnl/ob/obname.c | 55 +++++++------------ reactos/ntoskrnl/ps/win32.c | 2 - .../subsystems/win32/win32k/main/dllmain.c | 3 +- .../subsystems/win32/win32k/ntuser/winsta.c | 34 +++--------- 7 files changed, 30 insertions(+), 122 deletions(-) diff --git a/reactos/ntoskrnl/ex/sysinfo.c b/reactos/ntoskrnl/ex/sysinfo.c index 81d16d65efa..dfdf5635f20 100644 --- a/reactos/ntoskrnl/ex/sysinfo.c +++ b/reactos/ntoskrnl/ex/sysinfo.c @@ -839,11 +839,6 @@ QSI_DEF(SystemNonPagedPoolInformation) } -VOID -ObpGetNextHandleByProcessCount(PSYSTEM_HANDLE_TABLE_ENTRY_INFO pshi, - PEPROCESS Process, - int Count); - /* Class 16 - Handle Information */ QSI_DEF(SystemHandleInformation) { @@ -910,7 +905,7 @@ QSI_DEF(SystemHandleInformation) for (Count = 0; HandleCount > 0 ; HandleCount--) { - ObpGetNextHandleByProcessCount( &Shi->Handles[i], pr, Count); + Shi->Handles[i].UniqueProcessId = (ULONG)pr->UniqueProcessId; Count++; i++; } diff --git a/reactos/ntoskrnl/ex/win32k.c b/reactos/ntoskrnl/ex/win32k.c index 431cedf1d06..137f073d98d 100644 --- a/reactos/ntoskrnl/ex/win32k.c +++ b/reactos/ntoskrnl/ex/win32k.c @@ -35,34 +35,12 @@ GENERIC_MAPPING ExpDesktopMapping = STANDARD_RIGHTS_REQUIRED }; -PKWIN32_OPENMETHOD_CALLOUT ExpWindowStationObjectOpen = NULL; PKWIN32_PARSEMETHOD_CALLOUT ExpWindowStationObjectParse = NULL; PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete = NULL; PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL; /* FUNCTIONS ****************************************************************/ -NTSTATUS -STDCALL -ExpWinStaObjectOpen(OB_OPEN_REASON Reason, - PEPROCESS Process, - PVOID ObjectBody, - ACCESS_MASK GrantedAccess, - ULONG HandleCount) -{ - WIN32_OPENMETHOD_PARAMETERS Parameters; - - /* Fill out the callback structure */ - Parameters.OpenReason = Reason; - Parameters.Process = Process; - Parameters.Object = ObjectBody; - Parameters.GrantedAccess = GrantedAccess; - Parameters.HandleCount = HandleCount; - - /* Call the Registered Callback */ - return ExpWindowStationObjectOpen(&Parameters); -} - VOID STDCALL ExpWinStaObjectDelete(PVOID DeletedObject) @@ -134,7 +112,6 @@ ExpWin32kInit(VOID) ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer); ObjectTypeInitializer.GenericMapping = ExpWindowStationMapping; ObjectTypeInitializer.PoolType = NonPagedPool; - ObjectTypeInitializer.OpenProcedure = ExpWinStaObjectOpen; ObjectTypeInitializer.DeleteProcedure = ExpWinStaObjectDelete; ObjectTypeInitializer.ParseProcedure = ExpWinStaObjectParse; ObCreateObjectType(&Name, @@ -145,7 +122,6 @@ ExpWin32kInit(VOID) /* Create desktop object type */ RtlInitUnicodeString(&Name, L"Desktop"); ObjectTypeInitializer.GenericMapping = ExpDesktopMapping; - ObjectTypeInitializer.OpenProcedure = NULL; ObjectTypeInitializer.DeleteProcedure = ExpDesktopDelete; ObjectTypeInitializer.ParseProcedure = NULL; ObCreateObjectType(&Name, diff --git a/reactos/ntoskrnl/ob/obhandle.c b/reactos/ntoskrnl/ob/obhandle.c index 58ba28b691a..0a604ed366c 100644 --- a/reactos/ntoskrnl/ob/obhandle.c +++ b/reactos/ntoskrnl/ob/obhandle.c @@ -316,14 +316,12 @@ ObpIncrementHandleCount(IN PVOID Object, /* Check if we have an open procedure */ if (ObjectType->TypeInfo.OpenProcedure) { -#if 0 /* Call it */ ObjectType->TypeInfo.OpenProcedure(OpenReason, Process, Object, AccessState->PreviouslyGrantedAccess, ProcessHandleCount); -#endif } /* Increase total number of handles */ @@ -1459,31 +1457,6 @@ ObInsertObject(IN PVOID Object, return Status; } } - else - { - /* - * OK, if we got here then that means we don't have a name, - * so RemainingPath.Buffer/RemainingPath would've been NULL - * under the old implemetantation, so just use NULL. - * If remaining path wouldn't have been NULL, then we would've - * called ObFindObject which already has this code. - * We basically kill 3-4 hacks and add 2 new ones. - */ - if (Header->Type == IoFileObjectType) - { - DPRINT("About to call Open Routine\n"); - if (Header->Type == IoFileObjectType) - { - /* TEMPORARY HACK. DO NOT TOUCH -- Alex */ - DPRINT("Calling IopCreateFile: %x\n", FoundObject); - Status = IopCreateFile(&Header->Body, - FoundObject, - NULL, - NULL); - DPRINT("Called IopCreateFile: %x\n", Status); - } - } - } /* Now check if this object is being created */ if (FoundObject == Object) diff --git a/reactos/ntoskrnl/ob/obname.c b/reactos/ntoskrnl/ob/obname.c index bda6b61729d..0ef4abefac5 100644 --- a/reactos/ntoskrnl/ob/obname.c +++ b/reactos/ntoskrnl/ob/obname.c @@ -350,48 +350,33 @@ Next: ObjectAttached = TRUE; } - if ((Header->Type == IoFileObjectType) || - (Header->Type->TypeInfo.OpenProcedure != NULL)) - { - DPRINT("About to call Open Routine\n"); - if (Header->Type == IoFileObjectType) - { - /* TEMPORARY HACK. DO NOT TOUCH -- Alex */ - DPRINT("Calling IopCreateFile: %x\n", FoundObject); - Status = IopCreateFile(&Header->Body, - FoundObject, - RemainingPath->Buffer, - NULL); - DPRINT("Called IopCreateFile: %x\n", Status); + if (Header->Type == IoFileObjectType) + { + /* TEMPORARY HACK. DO NOT TOUCH -- Alex */ + DPRINT("Calling IopCreateFile: %p %p %wZ\n", &Header->Body, FoundObject, RemainingPath); + Status = IopCreateFile(&Header->Body, + FoundObject, + RemainingPath->Buffer, + NULL); + DPRINT("Called IopCreateFile: %x\n", Status); + } - } - else if (Header->Type->TypeInfo.OpenProcedure != NULL) + if (!NT_SUCCESS(Status)) + { + DPRINT("Create Failed\n"); + if (ObjectAttached == TRUE) { - DPRINT("Calling %x\n", Header->Type->TypeInfo.OpenProcedure); - Status = Header->Type->TypeInfo.OpenProcedure(ObCreateHandle, - NULL, - &Header->Body, - 0, - 0); + ObpDeleteEntryDirectory(Context); } - - if (!NT_SUCCESS(Status)) + if (FoundObject) { - DPRINT("Create Failed\n"); - if (ObjectAttached == TRUE) - { - ObpDeleteEntryDirectory(Context); - } - if (FoundObject) - { - ObDereferenceObject(FoundObject); - } - RtlFreeUnicodeString(RemainingPath); - return Status; + ObDereferenceObject(FoundObject); } + RtlFreeUnicodeString(RemainingPath); + return Status; } RtlFreeUnicodeString(RemainingPath); - *ReturnedObject = Insert; + *ReturnedObject = Insert; } else { diff --git a/reactos/ntoskrnl/ps/win32.c b/reactos/ntoskrnl/ps/win32.c index 703736f635f..f974e424301 100644 --- a/reactos/ntoskrnl/ps/win32.c +++ b/reactos/ntoskrnl/ps/win32.c @@ -18,7 +18,6 @@ static PKWIN32_PROCESS_CALLOUT PspWin32ProcessCallback = NULL; static PKWIN32_THREAD_CALLOUT PspWin32ThreadCallback = NULL; -extern PKWIN32_OPENMETHOD_CALLOUT ExpWindowStationObjectOpen; extern PKWIN32_PARSEMETHOD_CALLOUT ExpWindowStationObjectParse; extern PKWIN32_DELETEMETHOD_CALLOUT ExpWindowStationObjectDelete; extern PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete; @@ -56,7 +55,6 @@ PsEstablishWin32Callouts(PWIN32_CALLOUTS_FPNS CalloutData) { PspWin32ProcessCallback = CalloutData->ProcessCallout; PspWin32ThreadCallback = CalloutData->ThreadCallout; - ExpWindowStationObjectOpen = CalloutData->WindowStationOpenProcedure; ExpWindowStationObjectParse = CalloutData->WindowStationParseProcedure; ExpWindowStationObjectDelete = CalloutData->WindowStationDeleteProcedure; ExpDesktopObjectDelete = CalloutData->DesktopDeleteProcedure; diff --git a/reactos/subsystems/win32/win32k/main/dllmain.c b/reactos/subsystems/win32/win32k/main/dllmain.c index 7270ea2a58e..158dad2808b 100644 --- a/reactos/subsystems/win32/win32k/main/dllmain.c +++ b/reactos/subsystems/win32/win32k/main/dllmain.c @@ -359,7 +359,7 @@ DriverEntry ( { NTSTATUS Status; BOOLEAN Result; - WIN32_CALLOUTS_FPNS CalloutData; + WIN32_CALLOUTS_FPNS CalloutData = {0}; PVOID GlobalUserHeapBase = NULL; /* @@ -380,7 +380,6 @@ DriverEntry ( /* * Register Object Manager Callbacks */ - CalloutData.WindowStationOpenProcedure = IntWinStaObjectOpen; CalloutData.WindowStationParseProcedure = IntWinStaObjectParse; CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete; CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete; diff --git a/reactos/subsystems/win32/win32k/ntuser/winsta.c b/reactos/subsystems/win32/win32k/ntuser/winsta.c index b2cbe138cd6..e2c9941007d 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winsta.c +++ b/reactos/subsystems/win32/win32k/ntuser/winsta.c @@ -94,32 +94,6 @@ CleanupWindowStationImpl(VOID) /* OBJECT CALLBACKS **********************************************************/ -NTSTATUS -STDCALL -IntWinStaObjectOpen(PWIN32_OPENMETHOD_PARAMETERS Parameters) -{ - PWINSTATION_OBJECT WinSta = (PWINSTATION_OBJECT)Parameters->Object; - OB_OPEN_REASON Reason = Parameters->OpenReason; - NTSTATUS Status; - - if (Reason == ObCreateHandle) - { - DPRINT("Creating window station (0x%X)\n", WinSta); - - KeInitializeSpinLock(&WinSta->Lock); - - InitializeListHead(&WinSta->DesktopListHead); - - WinSta->AtomTable = NULL; - Status = RtlCreateAtomTable(37, &WinSta->AtomTable); - WinSta->SystemMenuTemplate = (HANDLE)0; - - DPRINT("Window station successfully created.\n"); - } - - return STATUS_SUCCESS; -} - VOID STDCALL IntWinStaObjectDelete(PWIN32_DELETEMETHOD_PARAMETERS Parameters) { @@ -485,6 +459,14 @@ NtUserCreateWindowStation( return 0; } + KeInitializeSpinLock(&WindowStationObject->Lock); + + InitializeListHead(&WindowStationObject->DesktopListHead); + + WindowStationObject->AtomTable = NULL; + Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable); + WindowStationObject->SystemMenuTemplate = (HANDLE)0; + WindowStationObject->Name = WindowStationName; Status = ObInsertObject(