From d67caa6f8c977fcfe1527abea5e6a6c244be21f9 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Wed, 13 May 2009 21:32:10 +0000 Subject: [PATCH] - Migration changes from W32THREADINFO to use ThreadInfo for kernel space and user space pointer reference, and use ClientInfo from TEB for user space. Next change will have the full removal of W32THREADINFO. svn path=/trunk/; revision=40916 --- reactos/dll/win32/user32/include/user32.h | 2 +- reactos/subsystems/win32/win32k/ntuser/misc.c | 48 +++++++++++-------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/reactos/dll/win32/user32/include/user32.h b/reactos/dll/win32/user32/include/user32.h index cdc325ffec4..9fac57e4f4d 100644 --- a/reactos/dll/win32/user32/include/user32.h +++ b/reactos/dll/win32/user32/include/user32.h @@ -103,7 +103,7 @@ GetThreadDesktopInfo(VOID) ti = GetW32ThreadInfo(); if (ti != NULL) - di = DesktopPtrToUser(ti->pDeskInfo); + di = GetWin32ClientInfo()->pDeskInfo; return di; } diff --git a/reactos/subsystems/win32/win32k/ntuser/misc.c b/reactos/subsystems/win32/win32k/ntuser/misc.c index 3bcce70b1d9..9b79d8d6da7 100644 --- a/reactos/subsystems/win32/win32k/ntuser/misc.c +++ b/reactos/subsystems/win32/win32k/ntuser/misc.c @@ -504,17 +504,18 @@ GetW32ThreadInfo(VOID) { PTEB Teb; PW32THREADINFO ti; - PCLIENTINFO ci; - PTHREADINFO W32Thread = PsGetCurrentThreadWin32Thread(); + PPROCESSINFO ppi; + PCLIENTINFO pci; + PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); - if (W32Thread == NULL) + if (pti == NULL) { /* FIXME - temporary hack for system threads... */ return NULL; } /* allocate a THREADINFO structure if neccessary */ - if (W32Thread->ThreadInfo == NULL) + if (pti->ThreadInfo == NULL) { ti = UserHeapAlloc(sizeof(W32THREADINFO)); if (ti != NULL) @@ -523,33 +524,42 @@ GetW32ThreadInfo(VOID) sizeof(W32THREADINFO)); /* initialize it */ - ti->ppi = GetW32ProcessInfo(); - ti->fsHooks = W32Thread->fsHooks; - W32Thread->pcti = &W32Thread->cti; // FIXME - if (W32Thread->Desktop != NULL) + ti->ppi = ppi = GetW32ProcessInfo(); + ti->fsHooks = pti->fsHooks; + pti->pcti = &pti->cti; // FIXME Need to set it in desktop.c! + if (pti->Desktop != NULL) { - ti->pDeskInfo = W32Thread->Desktop->DesktopInfo; + pti->pDeskInfo = ti->pDeskInfo = pti->Desktop->DesktopInfo; } else { - ti->pDeskInfo = NULL; + pti->pDeskInfo = ti->pDeskInfo = NULL; } - W32Thread->ThreadInfo = ti; + pti->ThreadInfo = ti; /* update the TEB */ Teb = NtCurrentTeb(); - ci = GetWin32ClientInfo(); - W32Thread->pClientInfo = ci; + pci = GetWin32ClientInfo(); + pti->pClientInfo = pci; _SEH2_TRY { ProbeForWrite(Teb, sizeof(TEB), sizeof(ULONG)); - // FIXME PLEASE! it's a ref pointer and not user data! Use ClientThreadInfo! - Teb->Win32ThreadInfo = UserHeapAddressToUser(W32Thread->ThreadInfo); -// ci->pClientThreadInfo = &ti->ClientThreadInfo; // FIXME! - ci->pClientThreadInfo = NULL; - ci->ppi = ti->ppi; + + Teb->Win32ThreadInfo = UserHeapAddressToUser(pti->ThreadInfo); + + pci->pClientThreadInfo = NULL; // FIXME Need to set it in desktop.c! + pci->ppi = ppi; + pci->fsHooks = pti->fsHooks; + /* CI may not have been initialized. */ + if (!pci->pDeskInfo && pti->pDeskInfo) + { + if (!pci->ulClientDelta) pci->ulClientDelta = DesktopHeapGetUserDelta(); + + pci->pDeskInfo = + (PVOID)((ULONG_PTR)pti->pDeskInfo - pci->ulClientDelta); + } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -563,7 +573,7 @@ GetW32ThreadInfo(VOID) } } - return W32Thread->ThreadInfo; + return pti->ThreadInfo; }