[ros-diffs] [tkreuzer] 36800: Win32 structure cleanup (WIP): - Use CLIENTINFO.ulClientDelta instead of W32THREADINFO.DesktopHeapDelta - Remove DesktopHeapDelta from W32THREADINFO- Add PtiList to DESKTOP - Add pClientInfo to THREADINFO

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri Oct 17 23:07:25 CEST 2008


Author: tkreuzer
Date: Fri Oct 17 16:07:24 2008
New Revision: 36800

URL: http://svn.reactos.org/svn/reactos?rev=36800&view=rev
Log:
Win32 structure cleanup (WIP):
- Use CLIENTINFO.ulClientDelta instead of W32THREADINFO.DesktopHeapDelta
- Remove DesktopHeapDelta from W32THREADINFO- Add PtiList to DESKTOP
- Add pClientInfo to THREADINFO

Modified:
    trunk/reactos/dll/win32/user32/include/user32.h
    trunk/reactos/include/reactos/win32k/ntuser.h
    trunk/reactos/subsystems/win32/win32k/include/desktop.h
    trunk/reactos/subsystems/win32/win32k/include/win32.h
    trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
    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/user32.h?rev=36800&r1=36799&r2=36800&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/include/user32.h [iso-8859-1] Fri Oct 17 16:07:24 2008
@@ -65,12 +65,14 @@
 DesktopPtrToUser(PVOID Ptr)
 {
     PW32THREADINFO ti = GetW32ThreadInfo();
+    PCLIENTINFO pci = GetWin32ClientInfo();
+
     ASSERT(Ptr != NULL);
     ASSERT(ti != NULL);
     if ((ULONG_PTR)Ptr >= (ULONG_PTR)ti->DesktopHeapBase &&
         (ULONG_PTR)Ptr < (ULONG_PTR)ti->DesktopHeapBase + ti->DesktopHeapLimit)
     {
-        return (PVOID)((ULONG_PTR)Ptr - ti->DesktopHeapDelta);
+        return (PVOID)((ULONG_PTR)Ptr - pci->ulClientDelta);
     }
     else
     {

Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntuser.h?rev=36800&r1=36799&r2=36800&view=diff
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Fri Oct 17 16:07:24 2008
@@ -312,7 +312,6 @@
     PDESKTOPINFO Desktop;
     PVOID DesktopHeapBase;
     ULONG_PTR DesktopHeapLimit;
-    ULONG_PTR DesktopHeapDelta;
     /* A mask of what hooks are currently active */
     ULONG Hooks;
     CLIENTTHREADINFO ClientThreadInfo;

Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/desktop.h?rev=36800&r1=36799&r2=36800&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Fri Oct 17 16:07:24 2008
@@ -9,6 +9,8 @@
     CSHORT Type;
     CSHORT Size;
     LIST_ENTRY ListEntry;
+
+    LIST_ENTRY PtiList;
 
     /* Pointer to the associated window station. */
     struct _WINSTATION_OBJECT *WindowStation;
@@ -203,7 +205,9 @@
     ULONG_PTR Delta = 0;
 
     pti = PsGetCurrentThreadWin32Thread();
-    ASSERT(pti->Desktop != NULL);
+    if (!pti->Desktop)
+        return 0;
+
     hDesktopHeap = pti->Desktop->hDesktopHeap;
 
     Mapping = PsGetCurrentProcessWin32Process()->HeapMappings.Next;

Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/win32.h?rev=36800&r1=36799&r2=36800&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Fri Oct 17 16:07:24 2008
@@ -28,6 +28,7 @@
 {
     W32THREAD W32Thread;
     PDESKTOPINFO pDeskInfo;
+    PCLIENTINFO pClientInfo;
     LIST_ENTRY PtiLink;
 
   struct _USER_MESSAGE_QUEUE* MessageQueue;

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c?rev=36800&r1=36799&r2=36800&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Fri Oct 17 16:07:24 2008
@@ -1768,9 +1768,9 @@
             ti->Desktop = NULL;
             ti->DesktopHeapBase = NULL;
             ti->DesktopHeapLimit = 0;
-            ti->DesktopHeapDelta = 0;
         }
     }
+    GetWin32ClientInfo()->ulClientDelta = 0;
 
     return Status;
 }
@@ -1846,9 +1846,9 @@
             ti->Desktop = DesktopObject->DesktopInfo;
             ti->DesktopHeapBase = DesktopObject->hDesktopHeap;
             ti->DesktopHeapLimit = ViewSize;
-            ti->DesktopHeapDelta = DesktopHeapGetUserDelta();
         }
     }
+    GetWin32ClientInfo()->ulClientDelta = DesktopHeapGetUserDelta();
 
     return STATUS_SUCCESS;
 }
@@ -1895,8 +1895,13 @@
             if (ti != NULL)
             {
                 ti->Desktop = NULL;
-                ti->DesktopHeapDelta = 0;
             }
+        }
+
+        /* Hack for system threads */
+        if (NtCurrentTeb())
+        {
+            GetWin32ClientInfo()->ulClientDelta = DesktopHeapGetUserDelta();
         }
 
         if (OldDesktop != NULL &&

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/misc.c?rev=36800&r1=36799&r2=36800&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c [iso-8859-1] Fri Oct 17 16:07:24 2008
@@ -464,14 +464,12 @@
                 ti->Desktop = W32Thread->Desktop->DesktopInfo;
                 ti->DesktopHeapBase = W32Thread->Desktop->DesktopInfo->hKernelHeap;
                 ti->DesktopHeapLimit = W32Thread->Desktop->DesktopInfo->HeapLimit;
-                ti->DesktopHeapDelta = DesktopHeapGetUserDelta();
             }
             else
             {
                 ti->Desktop = NULL;
                 ti->DesktopHeapBase = NULL;
                 ti->DesktopHeapLimit = 0;
-                ti->DesktopHeapDelta = 0;
             }
 
             W32Thread->ThreadInfo = ti;



More information about the Ros-diffs mailing list