Author: jimtabor
Date: Thu May 14 01:32:10 2009
New Revision: 40916
URL:
http://svn.reactos.org/svn/reactos?rev=40916&view=rev
Log:
- 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.
Modified:
trunk/reactos/dll/win32/user32/include/user32.h
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
Modified: trunk/reactos/dll/win32/user32/include/user32.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] Thu May 14 01:32:10 2009
@@ -103,7 +103,7 @@
ti = GetW32ThreadInfo();
if (ti != NULL)
- di = DesktopPtrToUser(ti->pDeskInfo);
+ di = GetWin32ClientInfo()->pDeskInfo;
return di;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Thu May 14 01:32:10
2009
@@ -504,17 +504,18 @@
{
PTEB Teb;
PW32THREADINFO ti;
- PCLIENTINFO ci;
- PTHREADINFO W32Thread = PsGetCurrentThreadWin32Thread();
-
- if (W32Thread == NULL)
+ PPROCESSINFO ppi;
+ PCLIENTINFO pci;
+ PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
+
+ 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 @@
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 @@
}
}
- return W32Thread->ThreadInfo;
+ return pti->ThreadInfo;
}