From a0cd9969492a036a25585587d7c46d8645e297ae Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sat, 18 Oct 2008 19:54:59 +0000 Subject: [PATCH] Win32 structure cleanup (WIP): - Add ppi to THREADINFO and initialize it - Initialize THREADINFO.PtiLink and DESKTOP.PtiList and link the thread to it's desktop svn path=/trunk/; revision=36810 --- reactos/subsystems/win32/win32k/include/win32.h | 1 + reactos/subsystems/win32/win32k/main/dllmain.c | 2 ++ reactos/subsystems/win32/win32k/ntuser/desktop.c | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/reactos/subsystems/win32/win32k/include/win32.h b/reactos/subsystems/win32/win32k/include/win32.h index 0c2ec105d8d..386fc48d15d 100644 --- a/reactos/subsystems/win32/win32k/include/win32.h +++ b/reactos/subsystems/win32/win32k/include/win32.h @@ -27,6 +27,7 @@ typedef struct _W32THREAD typedef struct _THREADINFO { W32THREAD W32Thread; + PVOID ppi; // FIXME: use PPROCESSINFO PDESKTOPINFO pDeskInfo; PCLIENTINFO pClientInfo; LIST_ENTRY PtiLink; diff --git a/reactos/subsystems/win32/win32k/main/dllmain.c b/reactos/subsystems/win32/win32k/main/dllmain.c index 7598cf4c15b..a22c35506f1 100644 --- a/reactos/subsystems/win32/win32k/main/dllmain.c +++ b/reactos/subsystems/win32/win32k/main/dllmain.c @@ -212,6 +212,7 @@ Win32kThreadCallback(struct _ETHREAD *Thread, InitializeListHead(&Win32Thread->WindowListHead); InitializeListHead(&Win32Thread->W32CallbackListHead); + InitializeListHead(&Win32Thread->PtiLink); /* * inherit the thread desktop and process window station (if not yet inherited) from the process startup @@ -268,6 +269,7 @@ Win32kThreadCallback(struct _ETHREAD *Thread, } Win32Thread->IsExiting = FALSE; co_IntDestroyCaret(Win32Thread); + Win32Thread->ppi = PsGetCurrentProcessWin32Process(); Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread); Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout(); if (Win32Thread->ThreadInfo) diff --git a/reactos/subsystems/win32/win32k/ntuser/desktop.c b/reactos/subsystems/win32/win32k/ntuser/desktop.c index 77b2e405e65..e0b89772bb2 100644 --- a/reactos/subsystems/win32/win32k/ntuser/desktop.c +++ b/reactos/subsystems/win32/win32k/ntuser/desktop.c @@ -1022,6 +1022,7 @@ NtUserCreateDesktop( IntGetDesktopWorkArea(DesktopObject, NULL); /* Initialize some local (to win32k) desktop state. */ + InitializeListHead(&DesktopObject->PtiList); DesktopObject->ActiveMessageQueue = NULL; ExFreePoolWithTag(DesktopName.Buffer, TAG_STRING); @@ -1918,9 +1919,14 @@ IntSetThreadDesktop(IN PDESKTOP DesktopObject, return FALSE; } + /* Remove the thread from the old desktop's list */ + RemoveEntryList(&W32Thread->PtiLink); + if (DesktopObject != NULL) { ObReferenceObject(DesktopObject); + /* Insert into new desktop's list */ + InsertTailList(&DesktopObject->PtiList, &W32Thread->PtiLink); } if (OldDesktop != NULL) -- 2.17.1