Author: jimtabor
Date: Thu Apr 2 22:52:34 2009
New Revision: 40333
URL:
http://svn.reactos.org/svn/reactos?rev=40333&view=rev
Log:
- Migration changes from PPROCESSINFO and PTHREADINFO to use ClientInfo from TEB. I moved
kpi to ci->ppi, we still depend on it as a reference pointer.
- Added and changed structure types.
- Tested with old AbiWord, FireFox and explorer.
- Comment out TestWindowProcess until the rest is ready.
Modified:
trunk/reactos/dll/win32/user32/include/user32.h
trunk/reactos/dll/win32/user32/misc/misc.c
trunk/reactos/dll/win32/user32/windows/window.c
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/ntuser/class.c
trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
trunk/reactos/subsystems/win32/win32k/ntuser/message.c
trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.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 Apr 2 22:52:34 2009
@@ -93,7 +93,7 @@
static __inline BOOL
IsThreadHooked(PW32THREADINFO ti)
{
- return ti->Hooks != 0;
+ return ti->fsHooks != 0;
}
static __inline PDESKTOPINFO
@@ -104,7 +104,7 @@
ti = GetW32ThreadInfo();
if (ti != NULL)
- di = DesktopPtrToUser(ti->Desktop);
+ di = DesktopPtrToUser(ti->pDeskInfo);
return di;
}
Modified: trunk/reactos/dll/win32/user32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/misc…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/misc.c [iso-8859-1] Thu Apr 2 22:52:34 2009
@@ -431,7 +431,7 @@
ValidateCallProc(HANDLE hCallProc)
{
PCALLPROC CallProc = ValidateHandle(hCallProc, VALIDATE_TYPE_CALLPROC);
- if (CallProc != NULL ) //&& CallProc->pi == g_kpi)
+ if (CallProc != NULL && CallProc->pi == GetWin32ClientInfo()->ppi)
return CallProc;
return NULL;
Modified: trunk/reactos/dll/win32/user32/windows/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/w…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Thu Apr 2 22:52:34 2009
@@ -1126,7 +1126,8 @@
_SEH2_TRY
{
- if (TestWindowProcess( Wnd))// if (Wnd->pi != g_kpi)
+// if (TestWindowProcess( Wnd))
+ if (Wnd->pi != GetWin32ClientInfo()->ppi)
{
if (nMaxCount > 0)
{
@@ -1216,7 +1217,8 @@
_SEH2_TRY
{
- if (TestWindowProcess( Wnd)) //if (Wnd->pi != g_kpi)
+// if (TestWindowProcess( Wnd))
+ if (Wnd->pi != GetWin32ClientInfo()->ppi)
{
if (nMaxCount > 0)
{
Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntu…
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Thu Apr 2 22:52:34 2009
@@ -364,13 +364,12 @@
typedef struct _W32THREADINFO
{
- PPROCESSINFO pi; /* [USER] */
- PPROCESSINFO kpi; /* [KERNEL] */
- PDESKTOPINFO Desktop;
+ PPROCESSINFO ppi; /* [KERNEL] */
+ PDESKTOPINFO pDeskInfo;
// PVOID DesktopHeapBase;
// ULONG_PTR DesktopHeapLimit;
/* A mask of what hooks are currently active */
- ULONG Hooks;
+ ULONG fsHooks;
CLIENTTHREADINFO ClientThreadInfo;
} W32THREADINFO, *PW32THREADINFO;
@@ -424,7 +423,9 @@
USHORT CodePage;
USHORT achDbcsCF;
MSG msgDbcsCB;
- ULONG Win32ClientInfo3[29];
+ ULONG Win32ClientInfo3[28];
+/* It's just a pointer reference not to be used w the structure in user space. */
+ PPROCESSINFO ppi;
} CLIENTINFO, *PCLIENTINFO;
/* Make sure it fits exactly into the TEB */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Thu Apr 2 22:52:34
2009
@@ -1142,13 +1142,13 @@
pti = PsGetCurrentThreadWin32Thread();
ti = GetW32ThreadInfo();
- if (ti == NULL || !ti->kpi->RegisteredSysClasses)
+ if (ti == NULL || !ti->ppi->RegisteredSysClasses)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return (RTL_ATOM)0;
}
- pi = ti->kpi;
+ pi = ti->ppi;
/* try to find a previously registered class */
ClassAtom = IntGetClassAtom(ClassName,
@@ -2149,7 +2149,7 @@
Window = UserGetWindowObject(hWnd);
if (Window != NULL)
{
- if (Window->ti->kpi != pi)
+ if (Window->ti->ppi != pi)
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
goto Cleanup;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Thu Apr 2
22:52:34 2009
@@ -1748,9 +1748,9 @@
ti = GetW32ThreadInfo();
if (ti != NULL)
{
- if (ti->Desktop == DesktopObject->DesktopInfo)
+ if (ti->pDeskInfo == DesktopObject->DesktopInfo)
{
- ti->Desktop = NULL;
+ ti->pDeskInfo = NULL;
}
GetWin32ClientInfo()->pDeskInfo = NULL;
}
@@ -1830,11 +1830,11 @@
GetWin32ClientInfo()->ulClientDelta = DesktopHeapGetUserDelta();
if (ti != NULL)
{
- if (ti->Desktop == NULL)
+ if (ti->pDeskInfo == NULL)
{
- ti->Desktop = DesktopObject->DesktopInfo;
+ ti->pDeskInfo = DesktopObject->DesktopInfo;
GetWin32ClientInfo()->pDeskInfo =
- (PVOID)((ULONG_PTR)ti->Desktop -
GetWin32ClientInfo()->ulClientDelta);
+ (PVOID)((ULONG_PTR)ti->pDeskInfo -
GetWin32ClientInfo()->ulClientDelta);
}
}
@@ -1882,7 +1882,7 @@
PW32THREADINFO ti = GetW32ThreadInfo();
if (ti != NULL)
{
- ti->Desktop = NULL;
+ ti->pDeskInfo = NULL;
}
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Thu Apr 2 22:52:34
2009
@@ -113,7 +113,7 @@
GetWin32ClientInfo()->fsHooks = W32Thread->Hooks;
if (W32Thread->ThreadInfo != NULL)
- W32Thread->ThreadInfo->Hooks = W32Thread->Hooks;
+ W32Thread->ThreadInfo->fsHooks = W32Thread->Hooks;
}
RtlInitUnicodeString(&Hook->ModuleName, NULL);
@@ -227,7 +227,7 @@
GetWin32ClientInfo()->fsHooks = W32Thread->Hooks;
if (W32Thread->ThreadInfo != NULL)
- W32Thread->ThreadInfo->Hooks = W32Thread->Hooks;
+ W32Thread->ThreadInfo->fsHooks = W32Thread->Hooks;
if (0 != Table->Counts[HOOKID_TO_INDEX(Hook->HookId)])
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Thu Apr 2
22:52:34 2009
@@ -306,7 +306,7 @@
if (Window->ti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->ThreadInfo)
SameThread = TRUE;
- if ((!SameThread && (Window->ti->Hooks &
HOOKID_TO_FLAG(WH_CALLWNDPROC))) ||
+ if ((!SameThread && (Window->ti->fsHooks &
HOOKID_TO_FLAG(WH_CALLWNDPROC))) ||
(SameThread && ISITHOOKED(WH_CALLWNDPROC)) )
{
CWPSTRUCT CWP;
@@ -328,7 +328,7 @@
if (Window->ti == ((PTHREADINFO)PsGetCurrentThreadWin32Thread())->ThreadInfo)
SameThread = TRUE;
- if ((!SameThread && (Window->ti->Hooks &
HOOKID_TO_FLAG(WH_CALLWNDPROCRET))) ||
+ if ((!SameThread && (Window->ti->fsHooks &
HOOKID_TO_FLAG(WH_CALLWNDPROCRET))) ||
(SameThread && ISITHOOKED(WH_CALLWNDPROCRET)) )
{
CWPRETSTRUCT CWPR;
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 Apr 2 22:52:34
2009
@@ -91,9 +91,9 @@
/* FIXME should use UserEnterShared */
RETURN( (DWORD)IntGetCapture());
case THREADSTATE_PROGMANWINDOW:
- RETURN( (DWORD)GetW32ThreadInfo()->Desktop->hProgmanWindow);
+ RETURN( (DWORD)GetW32ThreadInfo()->pDeskInfo->hProgmanWindow);
case THREADSTATE_TASKMANWINDOW:
- RETURN( (DWORD)GetW32ThreadInfo()->Desktop->hTaskManWindow);
+ RETURN( (DWORD)GetW32ThreadInfo()->pDeskInfo->hTaskManWindow);
case THREADSTATE_ACTIVEWINDOW:
RETURN ( (DWORD)UserGetActiveWindow());
}
@@ -501,17 +501,16 @@
sizeof(W32THREADINFO));
/* initialize it */
- ti->kpi = GetW32ProcessInfo();
- ti->pi = UserHeapAddressToUser(ti->kpi);
- ti->Hooks = W32Thread->Hooks;
+ ti->ppi = GetW32ProcessInfo();
+ ti->fsHooks = W32Thread->Hooks;
W32Thread->pcti = &ti->ClientThreadInfo;
if (W32Thread->Desktop != NULL)
{
- ti->Desktop = W32Thread->Desktop->DesktopInfo;
+ ti->pDeskInfo = W32Thread->Desktop->DesktopInfo;
}
else
{
- ti->Desktop = NULL;
+ ti->pDeskInfo = NULL;
}
W32Thread->ThreadInfo = ti;
@@ -527,6 +526,7 @@
// FIXME PLEASE! it's a ref pointer and not user data! Use ClientThreadInfo!
Teb->Win32ThreadInfo =
UserHeapAddressToUser(W32Thread->ThreadInfo);
ci->pClientThreadInfo = &ti->ClientThreadInfo; // FIXME!
+ ci->ppi = ti->ppi;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Thu Apr 2
22:52:34 2009
@@ -79,7 +79,7 @@
if (Window && Window->ti)
{
- if (Window->ti->Hooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE))
+ if (Window->ti->fsHooks & HOOKID_TO_FLAG(WH_FOREGROUNDIDLE))
{
co_HOOK_CallHooks(WH_FOREGROUNDIDLE,HC_ACTION,0,0);
}
@@ -547,7 +547,7 @@
if (DesktopWindow)
{
UserRefObjectCo(DesktopWindow, &Ref);//can DesktopWindow be NULL?
- Desk = DesktopWindow->ti->Desktop;
+ Desk = DesktopWindow->ti->pDeskInfo;
}
/* Process messages in the message queue itself. */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Thu Apr 2
22:52:34 2009
@@ -376,7 +376,7 @@
RETURN(FALSE);
}
- if (InterlockedCompareExchangePointer(&ti->kpi->hModUser,
+ if (InterlockedCompareExchangePointer(&ti->ppi->hModUser,
(HINSTANCE)Param,
NULL) == NULL)
{
@@ -814,11 +814,11 @@
switch (Routine)
{
case HWNDOPT_ROUTINE_SETPROGMANWINDOW:
- GetW32ThreadInfo()->Desktop->hProgmanWindow = hWnd;
+ GetW32ThreadInfo()->pDeskInfo->hProgmanWindow = hWnd;
break;
case HWNDOPT_ROUTINE_SETTASKMANWINDOW:
- GetW32ThreadInfo()->Desktop->hTaskManWindow = hWnd;
+ GetW32ThreadInfo()->pDeskInfo->hTaskManWindow = hWnd;
break;
}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Thu Apr 2 22:52:34
2009
@@ -162,7 +162,7 @@
{
if ( (lParam == (LPARAM)pTmr->pfn) &&
(pTmr->flags & (TMRF_SYSTEM|TMRF_RIT)) &&
- (pTmr->pti->ThreadInfo->kpi == pti->ThreadInfo->kpi) )
+ (pTmr->pti->ThreadInfo->ppi == pti->ThreadInfo->ppi) )
break;
pTmr = (PTIMER)pTmr->ptmrList.Flink;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Apr 2 22:52:34
2009
@@ -499,8 +499,8 @@
/* dereference the class */
IntDereferenceClass(Wnd->Class,
- Window->ti->Desktop,
- Window->ti->kpi);
+ Window->ti->pDeskInfo,
+ Window->ti->ppi);
Wnd->Class = NULL;
if(Window->WindowRegion)
@@ -581,10 +581,10 @@
Wnd->Unicode);
if (NewCallProc == NULL)
{
- NewCallProc = CreateCallProc(Wnd->ti->Desktop,
+ NewCallProc = CreateCallProc(Wnd->ti->pDeskInfo,
Wnd->WndProc,
Wnd->Unicode,
- Wnd->ti->kpi);
+ Wnd->ti->ppi);
if (NewCallProc == NULL)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
@@ -1630,7 +1630,7 @@
ClassAtom = IntGetClassAtom(ClassName,
hInstance,
- ti->kpi,
+ ti->ppi,
&Class,
&ClassLink);
@@ -1679,7 +1679,7 @@
Wnd = Window->Wnd;
Wnd->ti = ti;
- Wnd->pi = ti->kpi;
+ Wnd->pi = ti->ppi;
Wnd->pdesktop = pti->Desktop;
Wnd->hWndLastActive = hWnd;
}
@@ -2245,8 +2245,8 @@
if (ClassAtom == 0XC007)
{
PCALLPROC CallProc;
- //CallProc = CreateCallProc(NULL, Wnd->WndProc, bUnicodeWindow,
Wnd->ti->kpi);
- CallProc = CreateCallProc(NULL, Wnd->WndProc, Wnd->Unicode ,
Wnd->ti->kpi);
+ //CallProc = CreateCallProc(NULL, Wnd->WndProc, bUnicodeWindow,
Wnd->ti->ppi);
+ CallProc = CreateCallProc(NULL, Wnd->WndProc, Wnd->Unicode ,
Wnd->ti->ppi);
if (!CallProc)
{
@@ -2279,8 +2279,8 @@
if (Class != NULL)
{
IntDereferenceClass(Class,
- ti->Desktop,
- ti->kpi);
+ ti->pDeskInfo,
+ ti->ppi);
}
}
END_CLEANUP;
@@ -3339,7 +3339,7 @@
WinStaObject->ShellListView = hwndListView;
ti = GetW32ThreadInfo();
- if (ti->Desktop) ti->Desktop->hShellWindow = hwndShell;
+ if (ti->pDeskInfo) ti->pDeskInfo->hShellWindow = hwndShell;
UserDerefObjectCo(WndShell);
@@ -3707,7 +3707,7 @@
CallProc = CreateCallProc(NULL,
Wnd->WndProc,
Wnd->Unicode,
- Wnd->ti->kpi);
+ Wnd->ti->ppi);
if (CallProc == NULL)
{
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);