Author: greatlrd
Date: Wed Apr 5 14:33:55 2006
New Revision: 21462
URL:
http://svn.reactos.ru/svn/reactos?rev=21462&view=rev
Log:
patch from w3seek fixing windows handles
Modified:
trunk/reactos/subsystems/win32/win32k/include/class.h
trunk/reactos/subsystems/win32/win32k/ntuser/class.c
trunk/reactos/subsystems/win32/win32k/ntuser/window.c
Modified: trunk/reactos/subsystems/win32/win32k/include/class.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/class.h (original)
+++ trunk/reactos/subsystems/win32/win32k/include/class.h Wed Apr 5 14:33:55 2006
@@ -32,7 +32,8 @@
DestroyProcessClasses(PW32PROCESS Process );
PWINDOWCLASS
-IntReferenceClass(IN PWINDOWCLASS BaseClass,
+IntReferenceClass(IN OUT PWINDOWCLASS BaseClass,
+ IN OUT PWINDOWCLASS *ClassLink,
IN PDESKTOP Desktop);
VOID
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/class.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c Wed Apr 5 14:33:55 2006
@@ -361,7 +361,8 @@
}
static PWINDOWCLASS
-IntGetClassForDesktop(IN PWINDOWCLASS BaseClass,
+IntGetClassForDesktop(IN OUT PWINDOWCLASS BaseClass,
+ IN OUT PWINDOWCLASS *ClassLink,
IN PDESKTOP Desktop)
{
SIZE_T ClassSize;
@@ -380,6 +381,8 @@
if (BaseClass->Desktop == NULL)
{
+ ASSERT(BaseClass->Windows == 0);
+
/* Classes are also located in the shared heap when the class
was created before the thread attached to a desktop. As soon
as a window is created for such a class located on the shared
@@ -424,11 +427,22 @@
/* update some pointers and link the class */
Class->Next = BaseClass->Clone;
Class->Clone = NULL;
- Class->Base = BaseClass;
Class->Desktop = Desktop;
Class->Windows = 0;
- (void)InterlockedExchangePointer(&BaseClass->Clone,
- Class);
+
+ if (BaseClass->Desktop == NULL)
+ {
+ /* replace the base class */
+ Class->Base = BaseClass;
+ /* FIXME */
+ }
+ else
+ {
+ /* link in the clone */
+ Class->Base = BaseClass;
+ (void)InterlockedExchangePointer(&BaseClass->Clone,
+ Class);
+ }
}
else
{
@@ -440,12 +454,14 @@
}
PWINDOWCLASS
-IntReferenceClass(IN PWINDOWCLASS BaseClass,
+IntReferenceClass(IN OUT PWINDOWCLASS BaseClass,
+ IN OUT PWINDOWCLASS *ClassLink,
IN PDESKTOP Desktop)
{
PWINDOWCLASS Class;
Class = IntGetClassForDesktop(BaseClass,
+ ClassLink,
Desktop);
if (Class != NULL)
{
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Wed Apr 5 14:33:55 2006
@@ -1394,7 +1394,7 @@
BOOL bUnicodeWindow)
{
PWINSTATION_OBJECT WinSta;
- PWINDOWCLASS Class = NULL;
+ PWINDOWCLASS *ClassLink, Class = NULL;
RTL_ATOM ClassAtom;
PWINDOW_OBJECT Window = NULL;
PWINDOW_OBJECT ParentWindow = NULL, OwnerWindow;
@@ -1475,7 +1475,7 @@
hInstance,
ti->kpi,
&Class,
- NULL);
+ &ClassLink);
if (ClassAtom == (RTL_ATOM)0)
{
@@ -1493,6 +1493,7 @@
}
Class = IntReferenceClass(Class,
+ ClassLink,
ti->Desktop);
if (Class == NULL)
{