Author: tkreuzer
Date: Sat Oct 18 20:06:30 2008
New Revision: 36820
URL:
http://svn.reactos.org/svn/reactos?rev=36820&view=rev
Log:
Win32 structure cleanup (WIP):
- use rpdeskParent instead of Desktop in WINDOWCLASS
- use PDESKTOP instead of DESKTOPINFO in several places
Modified:
trunk/reactos/include/reactos/win32k/ntuser.h
trunk/reactos/subsystems/win32/win32k/include/class.h
trunk/reactos/subsystems/win32/win32k/include/desktop.h
trunk/reactos/subsystems/win32/win32k/ntuser/class.c
trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
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] Sat Oct 18 20:06:30 2008
@@ -73,7 +73,6 @@
struct _WINDOWCLASS *Next;
struct _WINDOWCLASS *Clone;
struct _WINDOWCLASS *Base;
- PDESKTOPINFO Desktop;
struct _DESKTOP *rpdeskParent;
RTL_ATOM Atom;
ULONG Windows;
Modified: trunk/reactos/subsystems/win32/win32k/include/class.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/class.h [iso-8859-1] Sat Oct 18 20:06:30
2008
@@ -2,6 +2,7 @@
#define _WIN32K_CLASS_H
#include <include/win32.h>
+#include <include/desktop.h>
#define IS_ATOM(x) \
(((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000))
@@ -46,7 +47,7 @@
PWINDOWCLASS
IntReferenceClass(IN OUT PWINDOWCLASS BaseClass,
IN OUT PWINDOWCLASS *ClassLink,
- IN PDESKTOPINFO Desktop);
+ IN PDESKTOP Desktop);
VOID
IntDereferenceClass(IN OUT PWINDOWCLASS Class,
@@ -95,7 +96,7 @@
OUT RTL_ATOM *Atom);
BOOL
-IntCheckProcessDesktopClasses(IN PDESKTOPINFO Desktop,
+IntCheckProcessDesktopClasses(IN PDESKTOP Desktop,
IN BOOL FreeOnFailure);
#endif /* _WIN32K_CLASS_H */
Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Sat Oct 18
20:06:30 2008
@@ -136,31 +136,31 @@
static __inline PVOID
-DesktopHeapAlloc(IN PDESKTOPINFO Desktop,
+DesktopHeapAlloc(IN PDESKTOP Desktop,
IN SIZE_T Bytes)
{
- return RtlAllocateHeap(Desktop->hKernelHeap,
+ return RtlAllocateHeap(Desktop->DesktopInfo->hKernelHeap,
HEAP_NO_SERIALIZE,
Bytes);
}
static __inline BOOL
-DesktopHeapFree(IN PDESKTOPINFO Desktop,
+DesktopHeapFree(IN PDESKTOP Desktop,
IN PVOID lpMem)
{
- return RtlFreeHeap(Desktop->hKernelHeap,
+ return RtlFreeHeap(Desktop->DesktopInfo->hKernelHeap,
HEAP_NO_SERIALIZE,
lpMem);
}
static __inline PVOID
-DesktopHeapReAlloc(IN PDESKTOPINFO Desktop,
+DesktopHeapReAlloc(IN PDESKTOP Desktop,
IN PVOID lpMem,
IN SIZE_T Bytes)
{
#if 0
/* NOTE: ntoskrnl doesn't export RtlReAllocateHeap... */
- return RtlReAllocateHeap(Desktop->hKernelHeap,
+ return RtlReAllocateHeap(Desktop->DesktopInfo->hKernelHeap,
HEAP_NO_SERIALIZE,
lpMem,
Bytes);
@@ -168,14 +168,14 @@
SIZE_T PrevSize;
PVOID pNew;
- PrevSize = RtlSizeHeap(Desktop->hKernelHeap,
+ PrevSize = RtlSizeHeap(Desktop->DesktopInfo->hKernelHeap,
HEAP_NO_SERIALIZE,
lpMem);
if (PrevSize == Bytes)
return lpMem;
- pNew = RtlAllocateHeap(Desktop->hKernelHeap,
+ pNew = RtlAllocateHeap(Desktop->DesktopInfo->hKernelHeap,
HEAP_NO_SERIALIZE,
Bytes);
if (pNew != NULL)
@@ -187,7 +187,7 @@
lpMem,
Bytes);
- RtlFreeHeap(Desktop->hKernelHeap,
+ RtlFreeHeap(Desktop->DesktopInfo->hKernelHeap,
HEAP_NO_SERIALIZE,
lpMem);
}
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] Sat Oct 18 20:06:30
2008
@@ -85,9 +85,9 @@
}
/* free the structure */
- if (Class->Desktop != NULL)
- {
- DesktopHeapFree(Class->Desktop,
+ if (Class->rpdeskParent != NULL)
+ {
+ DesktopHeapFree(Class->rpdeskParent,
Class);
}
else
@@ -395,7 +395,7 @@
static PWINDOWCLASS
IntGetClassForDesktop(IN OUT PWINDOWCLASS BaseClass,
IN OUT PWINDOWCLASS *ClassLink,
- IN PDESKTOPINFO Desktop)
+ IN PDESKTOP Desktop)
{
SIZE_T ClassSize;
PWINDOWCLASS Class;
@@ -403,7 +403,7 @@
ASSERT(Desktop != NULL);
ASSERT(BaseClass->Base == BaseClass);
- if (BaseClass->Desktop == Desktop)
+ if (BaseClass->rpdeskParent == Desktop)
{
/* it is most likely that a window is created on the same
desktop as the window class. */
@@ -411,7 +411,7 @@
return BaseClass;
}
- if (BaseClass->Desktop == NULL)
+ if (BaseClass->rpdeskParent == NULL)
{
ASSERT(BaseClass->Windows == 0);
ASSERT(BaseClass->Clone == NULL);
@@ -430,7 +430,7 @@
Class = BaseClass->Clone;
while (Class != NULL)
{
- if (Class->Desktop == Desktop)
+ if (Class->rpdeskParent == Desktop)
{
ASSERT(Class->Base == BaseClass);
ASSERT(Class->Clone == NULL);
@@ -457,10 +457,10 @@
ClassSize);
/* update some pointers and link the class */
- Class->Desktop = Desktop;
+ Class->rpdeskParent = Desktop;
Class->Windows = 0;
- if (BaseClass->Desktop == NULL)
+ if (BaseClass->rpdeskParent == NULL)
{
/* we don't really need the base class on the shared
heap anymore, delete it so the only class left is
@@ -502,7 +502,7 @@
PWINDOWCLASS
IntReferenceClass(IN OUT PWINDOWCLASS BaseClass,
IN OUT PWINDOWCLASS *ClassLink,
- IN PDESKTOPINFO Desktop)
+ IN PDESKTOP Desktop)
{
PWINDOWCLASS Class;
@@ -528,9 +528,9 @@
ASSERT(Class->Base != Class);
ASSERT(Class->Base->Clone != NULL);
- ASSERT(Class->Desktop != NULL);
+ ASSERT(Class->rpdeskParent != NULL);
ASSERT(Class->Windows != 0);
- ASSERT(Class->Base->Desktop != NULL);
+ ASSERT(Class->Base->rpdeskParent != NULL);
ASSERT(Class->Base->Windows == 0);
/* unlink the clone */
@@ -648,7 +648,7 @@
SIZE_T ClassSize;
ASSERT(Class->Base == Class);
- ASSERT(Class->Desktop != NULL);
+ ASSERT(Class->rpdeskParent != NULL);
ASSERT(Class->Windows == 0);
ASSERT(Class->Clone == NULL);
@@ -662,7 +662,7 @@
Class,
ClassSize);
- NewClass->Desktop = NULL;
+ NewClass->rpdeskParent = NULL;
NewClass->Base = NewClass;
/* replace the class in the list */
@@ -680,7 +680,7 @@
}
static VOID
-IntCheckDesktopClasses(IN PDESKTOPINFO Desktop,
+IntCheckDesktopClasses(IN PDESKTOP Desktop,
IN OUT PWINDOWCLASS *ClassList,
IN BOOL FreeOnFailure,
OUT BOOL *Ret)
@@ -704,7 +704,7 @@
ASSERT(Class->Base == Class);
- if (Class->Desktop == Desktop &&
+ if (Class->rpdeskParent == Desktop &&
Class->Windows == 0)
{
/* there shouldn't be any clones around anymore! */
@@ -749,7 +749,7 @@
}
BOOL
-IntCheckProcessDesktopClasses(IN PDESKTOPINFO Desktop,
+IntCheckProcessDesktopClasses(IN PDESKTOP Desktop,
IN BOOL FreeOnFailure)
{
PW32PROCESSINFO pi;
@@ -792,7 +792,7 @@
IN PUNICODE_STRING MenuName,
IN WNDPROC wpExtra,
IN DWORD dwFlags,
- IN PDESKTOPINFO Desktop,
+ IN PDESKTOP Desktop,
IN PW32PROCESSINFO pi)
{
SIZE_T ClassSize;
@@ -838,7 +838,7 @@
RtlZeroMemory(Class,
ClassSize);
- Class->Desktop = Desktop;
+ Class->rpdeskParent = Desktop;
Class->Base = Class;
Class->Atom = Atom;
@@ -1131,6 +1131,7 @@
IN WNDPROC wpExtra,
IN DWORD dwFlags)
{
+ PTHREADINFO pti;
PW32THREADINFO ti;
PW32PROCESSINFO pi;
PWINDOWCLASS Class;
@@ -1139,6 +1140,7 @@
/* NOTE: Accessing the buffers in ClassName and MenuName may raise exceptions! */
+ pti = PsGetCurrentThreadWin32Thread();
ti = GetW32ThreadInfo();
if (ti == NULL || !ti->kpi->RegisteredSysClasses)
{
@@ -1180,7 +1182,7 @@
MenuName,
wpExtra,
dwFlags,
- ti->Desktop,
+ pti->Desktop,
pi);
if (Class != NULL)
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] Sat Oct 18
20:06:30 2008
@@ -1914,7 +1914,7 @@
}
if (OldDesktop != NULL &&
- !IntCheckProcessDesktopClasses(OldDesktop->DesktopInfo,
+ !IntCheckProcessDesktopClasses(OldDesktop,
FreeOnFailure))
{
DPRINT1("Failed to move process classes to shared heap!\n");
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] Sat Oct 18 20:06:30
2008
@@ -343,12 +343,12 @@
{
Wnd->WindowName.Length = 0;
Wnd->WindowName.MaximumLength = 0;
- DesktopHeapFree(Wnd->pdesktop->DesktopInfo,
+ DesktopHeapFree(Wnd->pdesktop,
Wnd->WindowName.Buffer);
Wnd->WindowName.Buffer = NULL;
}
- DesktopHeapFree(Wnd->pdesktop->DesktopInfo, Wnd);
+ DesktopHeapFree(Wnd->pdesktop, Wnd);
WindowObject->Wnd = NULL;
}
@@ -1601,7 +1601,7 @@
Class = IntReferenceClass(Class,
ClassLink,
- pti->Desktop->DesktopInfo);
+ pti->Desktop);
if (Class == NULL)
{
DPRINT1("Failed to reference window class!\n");
@@ -1619,7 +1619,7 @@
otWindow, sizeof(WINDOW_OBJECT));
if (Window)
{
- Window->Wnd = DesktopHeapAlloc(pti->Desktop->DesktopInfo,
+ Window->Wnd = DesktopHeapAlloc(pti->Desktop,
sizeof(WINDOW) + Class->WndExtra);
if (!Window->Wnd)
goto AllocErr;
@@ -1719,7 +1719,7 @@
if (NULL != WindowName->Buffer && WindowName->Length > 0)
{
- Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop->DesktopInfo,
+ Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop,
WindowName->Length +
sizeof(UNICODE_NULL));
if (Wnd->WindowName.Buffer == NULL)
{
@@ -4592,11 +4592,11 @@
Wnd->WindowName.Buffer = NULL;
if (buf != NULL)
{
- DesktopHeapFree(Wnd->pdesktop->DesktopInfo,
+ DesktopHeapFree(Wnd->pdesktop,
buf);
}
- Wnd->WindowName.Buffer =
DesktopHeapAlloc(Wnd->pdesktop->DesktopInfo,
+ Wnd->WindowName.Buffer = DesktopHeapAlloc(Wnd->pdesktop,
SafeText.Length +
sizeof(UNICODE_NULL));
if (Wnd->WindowName.Buffer != NULL)
{