From 35fe207a58f938c3fb0392c8abe91ec84d8846c8 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 18 Oct 2008 20:34:36 +0000 Subject: [PATCH] Change return type of PsGetCurrentProcessWin32Process to PVOID. svn path=/trunk/; revision=36811 --- reactos/include/ndk/psfuncs.h | 2 +- reactos/ntoskrnl/ps/process.c | 4 ++-- .../subsystems/win32/win32k/eng/driverobj.c | 24 ++++++++++++------- .../subsystems/win32/win32k/include/desktop.h | 8 +++++-- .../subsystems/win32/win32k/ntuser/desktop.c | 12 ++++++++-- reactos/subsystems/win32/win32k/ntuser/menu.c | 8 +++++-- reactos/subsystems/win32/win32k/w32k.h | 3 ++- 7 files changed, 42 insertions(+), 19 deletions(-) diff --git a/reactos/include/ndk/psfuncs.h b/reactos/include/ndk/psfuncs.h index e8fa9ebd47f..96288083229 100644 --- a/reactos/include/ndk/psfuncs.h +++ b/reactos/include/ndk/psfuncs.h @@ -42,7 +42,7 @@ PsGetCurrentThreadWin32Thread( ); NTKERNELAPI -struct _W32PROCESS* +PVOID NTAPI PsGetCurrentProcessWin32Process( VOID diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index ecdf48b045a..33767f45475 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -1118,11 +1118,11 @@ PsGetProcessSessionId(PEPROCESS Process) /* * @implemented */ -struct _W32PROCESS* +PVOID NTAPI PsGetCurrentProcessWin32Process(VOID) { - return (struct _W32PROCESS*)PsGetCurrentProcess()->Win32Process; + return PsGetCurrentProcess()->Win32Process; } /* diff --git a/reactos/subsystems/win32/win32k/eng/driverobj.c b/reactos/subsystems/win32/win32k/eng/driverobj.c index 13e981c14f9..46f0b5fa9d4 100644 --- a/reactos/subsystems/win32/win32k/eng/driverobj.c +++ b/reactos/subsystems/win32/win32k/eng/driverobj.c @@ -43,17 +43,19 @@ IntEngCleanupDriverObjs(struct _EPROCESS *Process, PW32PROCESS Win32Process) { PDRIVERGDI DrvObjInt; + PW32PROCESS CurrentWin32Process; - IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); + CurrentWin32Process = PsGetCurrentProcessWin32Process(); + IntEngLockProcessDriverObjs(CurrentWin32Process); while (!IsListEmpty(&Win32Process->DriverObjListHead)) { DrvObjInt = CONTAINING_RECORD(Win32Process->DriverObjListHead.Flink, DRIVERGDI, ListEntry); - IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); + IntEngUnLockProcessDriverObjs(CurrentWin32Process); EngDeleteDriverObj((HDRVOBJ)(&DrvObjInt->DriverObj), TRUE, FALSE); - IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); + IntEngLockProcessDriverObjs(CurrentWin32Process); } - IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); + IntEngUnLockProcessDriverObjs(CurrentWin32Process); } @@ -70,6 +72,7 @@ EngCreateDriverObj( { PDRIVERGDI DrvObjInt; PDRIVEROBJ DrvObjUser; + PW32PROCESS CurrentWin32Process; /* Create DRIVEROBJ */ DrvObjInt = EngAllocMem(0, sizeof (DRIVERGDI), TAG_DRIVEROBJ); @@ -88,9 +91,10 @@ EngCreateDriverObj( /* fill internal object */ ExInitializeFastMutex(&DrvObjInt->Lock); - IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); - InsertTailList(&PsGetCurrentProcessWin32Process()->DriverObjListHead, &DrvObjInt->ListEntry); - IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); + CurrentWin32Process = PsGetCurrentProcessWin32Process(); + IntEngLockProcessDriverObjs(CurrentWin32Process); + InsertTailList(&CurrentWin32Process->DriverObjListHead, &DrvObjInt->ListEntry); + IntEngUnLockProcessDriverObjs(CurrentWin32Process); return (HDRVOBJ)DrvObjUser; } @@ -109,6 +113,7 @@ EngDeleteDriverObj( { PDRIVEROBJ DrvObjUser = (PDRIVEROBJ)hdo; PDRIVERGDI DrvObjInt = ObjToGDI(DrvObjUser, DRIVER); + PW32PROCESS CurrentWin32Process; /* Make sure the obj is locked */ if (!bLocked) @@ -129,9 +134,10 @@ EngDeleteDriverObj( } /* Free the DRIVEROBJ */ - IntEngLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); + CurrentWin32Process = PsGetCurrentProcessWin32Process(); + IntEngLockProcessDriverObjs(CurrentWin32Process); RemoveEntryList(&DrvObjInt->ListEntry); - IntEngUnLockProcessDriverObjs(PsGetCurrentProcessWin32Process()); + IntEngUnLockProcessDriverObjs(CurrentWin32Process); EngFreeMem(DrvObjInt); return TRUE; diff --git a/reactos/subsystems/win32/win32k/include/desktop.h b/reactos/subsystems/win32/win32k/include/desktop.h index b362d442017..2eac22e2409 100644 --- a/reactos/subsystems/win32/win32k/include/desktop.h +++ b/reactos/subsystems/win32/win32k/include/desktop.h @@ -201,6 +201,7 @@ DesktopHeapGetUserDelta(VOID) { PW32HEAP_USER_MAPPING Mapping; PTHREADINFO pti; + PW32PROCESS W32Process; HANDLE hDesktopHeap; ULONG_PTR Delta = 0; @@ -210,7 +211,8 @@ DesktopHeapGetUserDelta(VOID) hDesktopHeap = pti->Desktop->hDesktopHeap; - Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next; + W32Process = PsGetCurrentProcessWin32Process(); + Mapping = W32Process->HeapMappings.Next; while (Mapping != NULL) { if (Mapping->KernelMapping == (PVOID)hDesktopHeap) @@ -229,8 +231,10 @@ static __inline PVOID DesktopHeapAddressToUser(PVOID lpMem) { PW32HEAP_USER_MAPPING Mapping; + PW32PROCESS W32Process; - Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next; + W32Process = PsGetCurrentProcessWin32Process(); + Mapping = W32Process->HeapMappings.Next; while (Mapping != NULL) { if ((ULONG_PTR)lpMem >= (ULONG_PTR)Mapping->KernelMapping && diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index e0b89772bb2..0ebe8252815 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -1732,11 +1732,15 @@ static NTSTATUS IntUnmapDesktopView(IN PDESKTOP DesktopObject) { PW32THREADINFO ti; - PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next; + PW32PROCESS CurrentWin32Process; + PW32HEAP_USER_MAPPING HeapMapping, *PrevLink; NTSTATUS Status = STATUS_SUCCESS; TRACE("DO %p\n"); + CurrentWin32Process = PsGetCurrentProcessWin32Process(); + PrevLink = &CurrentWin32Process->HeapMappings.Next; + /* unmap if we're the last thread using the desktop */ HeapMapping = *PrevLink; while (HeapMapping != NULL) @@ -1780,12 +1784,16 @@ static NTSTATUS IntMapDesktopView(IN PDESKTOP DesktopObject) { PW32THREADINFO ti; - PW32HEAP_USER_MAPPING HeapMapping, *PrevLink = &PsGetCurrentProcessWin32Process()->HeapMappings.Next; + PW32PROCESS CurrentWin32Process; + PW32HEAP_USER_MAPPING HeapMapping, *PrevLink; PVOID UserBase = NULL; SIZE_T ViewSize = 0; LARGE_INTEGER Offset; NTSTATUS Status; + CurrentWin32Process = PsGetCurrentProcessWin32Process(); + PrevLink = &CurrentWin32Process->HeapMappings.Next; + /* find out if another thread already mapped the desktop heap */ HeapMapping = *PrevLink; while (HeapMapping != NULL) diff --git a/reactos/subsystems/win32/win32k/ntuser/menu.c b/reactos/subsystems/win32/win32k/ntuser/menu.c index a7b1edae481..a14a8e149e6 100644 --- a/reactos/subsystems/win32/win32k/ntuser/menu.c +++ b/reactos/subsystems/win32/win32k/ntuser/menu.c @@ -313,6 +313,7 @@ PMENU_OBJECT FASTCALL IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar) { PMENU_OBJECT Menu; + PW32PROCESS CurrentWin32Process; Menu = (PMENU_OBJECT)UserCreateObject( gHandleTable, Handle, @@ -346,7 +347,8 @@ IntCreateMenu(PHANDLE Handle, BOOL IsMenuBar) Menu->MenuItemList = NULL; /* Insert menu item into process menu handle list */ - InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry); + CurrentWin32Process = PsGetCurrentProcessWin32Process(); + InsertTailList(&CurrentWin32Process->MenuListHead, &Menu->ListEntry); return Menu; } @@ -416,6 +418,7 @@ IntCloneMenuItems(PMENU_OBJECT Destination, PMENU_OBJECT Source) PMENU_OBJECT FASTCALL IntCloneMenu(PMENU_OBJECT Source) { + PW32PROCESS CurrentWin32Process; HANDLE hMenu; PMENU_OBJECT Menu; @@ -450,7 +453,8 @@ IntCloneMenu(PMENU_OBJECT Source) Menu->MenuItemList = NULL; /* Insert menu item into process menu handle list */ - InsertTailList(&PsGetCurrentProcessWin32Process()->MenuListHead, &Menu->ListEntry); + CurrentWin32Process = PsGetCurrentProcessWin32Process(); + InsertTailList(&CurrentWin32Process->MenuListHead, &Menu->ListEntry); IntCloneMenuItems(Menu, Source); diff --git a/reactos/subsystems/win32/win32k/w32k.h b/reactos/subsystems/win32/win32k/w32k.h index 7e8ad00fc35..44f22996af3 100644 --- a/reactos/subsystems/win32/win32k/w32k.h +++ b/reactos/subsystems/win32/win32k/w32k.h @@ -137,8 +137,9 @@ UserHeapReAlloc(PVOID lpMem, static __inline PVOID UserHeapAddressToUser(PVOID lpMem) { + PW32PROCESS W32Process = PsGetCurrentProcessWin32Process(); return (PVOID)(((ULONG_PTR)lpMem - (ULONG_PTR)GlobalUserHeap) + - (ULONG_PTR)PsGetCurrentProcessWin32Process()->HeapMappings.UserMapping); + (ULONG_PTR)W32Process->HeapMappings.UserMapping); } #endif /* __W32K_H */