make classes use session wide atom table. should fix bug 899
Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
Modified: trunk/reactos/subsys/win32k/ntuser/class.c
Modified: trunk/reactos/subsys/win32k/ntuser/ntuser.c
Added: trunk/reactos/subsys/win32k/ntuser/session.c
Modified: trunk/reactos/subsys/win32k/win32k.xml
_____
Modified: trunk/reactos/subsys/win32k/include/userfuncs.h
--- trunk/reactos/subsys/win32k/include/userfuncs.h 2005-10-13
10:55:16 UTC (rev 18426)
+++ trunk/reactos/subsys/win32k/include/userfuncs.h 2005-10-13
12:44:58 UTC (rev 18427)
@@ -73,13 +73,10 @@
#define UserDerefObject(o) ObmDereferenceObject(o)
BOOL FASTCALL ObmCreateHandleTable();
+/******************** HANDLE.C ***************/
extern USER_HANDLE_TABLE gHandleTable;
-
-/******************** HANDLE.C ***************/
-
-
PUSER_HANDLE_ENTRY handle_to_entry(PUSER_HANDLE_TABLE ht, HANDLE handle
);
VOID UserInitHandleTable(PUSER_HANDLE_TABLE ht, PVOID mem, ULONG
bytes);
HANDLE UserAllocHandle(PUSER_HANDLE_TABLE ht, PVOID object,
USER_OBJECT_TYPE type );
@@ -120,6 +117,13 @@
DWORD FASTCALL
UserGetWindowDC(PWINDOW_OBJECT Wnd);
+
+/*************** SESSION.C ***************/
+
+extern PRTL_ATOM_TABLE gAtomTable;
+
+NTSTATUS FASTCALL InitSessionImpl(VOID);
+
/*************** METRIC.C ***************/
ULONG FASTCALL
_____
Modified: trunk/reactos/subsys/win32k/ntuser/class.c
--- trunk/reactos/subsys/win32k/ntuser/class.c 2005-10-13 10:55:16 UTC
(rev 18426)
+++ trunk/reactos/subsys/win32k/ntuser/class.c 2005-10-13 12:44:58 UTC
(rev 18427)
@@ -48,7 +48,6 @@
}
-/* return TRUE if class became destroyed */
inline VOID FASTCALL
ClassDerefObject(PWNDCLASS_OBJECT Class)
{
@@ -67,22 +66,10 @@
VOID FASTCALL DestroyClass(PWNDCLASS_OBJECT Class)
{
- PWINSTATION_OBJECT WinSta;
-
ASSERT(Class->refs == 0);
+
RemoveEntryList(&Class->ListEntry);
-
- /* FIXME See bug 899 */
- if (NULL != PsGetWin32Thread())
- {
- WinSta = PsGetWin32Thread()->Desktop->WindowStation;
- //FIXME: release ATOM
- RtlDeleteAtomFromAtomTable(WinSta->AtomTable, Class->Atom);
- }
- else
- {
- DPRINT1("Can't locate window station, see bug 899\n");
- }
+ RtlDeleteAtomFromAtomTable(gAtomTable, Class->Atom);
ExFreePool(Class);
}
@@ -122,17 +109,14 @@
PWNDCLASS_OBJECT FASTCALL
ClassGetClassByName(LPCWSTR ClassName, HINSTANCE hInstance)
{
- PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
RTL_ATOM Atom;
if (!ClassName || !PsGetWin32Thread()->Desktop)
return FALSE;
- WinSta = PsGetWin32Thread()->Desktop->WindowStation;
-
Status = RtlLookupAtomInAtomTable(
- WinSta->AtomTable,
+ gAtomTable,
(LPWSTR)ClassName,
&Atom);
@@ -445,7 +429,6 @@
*/
{
WNDCLASSEXW SafeClass;
- PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
RTL_ATOM Atom;
DECLARE_RETURN(RTL_ATOM);
@@ -485,14 +468,12 @@
RETURN( (RTL_ATOM)0);
}
- WinSta = PsGetWin32Thread()->Desktop->WindowStation;
-
//FIXME: make ClassName ptr the atom, not buffer
if (ClassName->Length > 0)
{
DPRINT("NtUserRegisterClassExWOW(%S)\n", ClassName->Buffer);
/* FIXME - Safely copy/verify the buffer first!!! */
- Status = RtlAddAtomToAtomTable(WinSta->AtomTable,
+ Status = RtlAddAtomToAtomTable(gAtomTable,
ClassName->Buffer,
&Atom);
if (!NT_SUCCESS(Status))
@@ -518,7 +499,7 @@
{
if (ClassName->Length)
{
- RtlDeleteAtomFromAtomTable(WinSta->AtomTable, Atom);
+ RtlDeleteAtomFromAtomTable(gAtomTable, Atom);
}
DPRINT("Failed creating window class object\n");
RETURN((RTL_ATOM)0);
@@ -717,7 +698,6 @@
{
PWINDOW_OBJECT Window;
DECLARE_RETURN(DWORD);
- PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
UserEnterShared();
@@ -728,12 +708,10 @@
RETURN(0);
}
- WinSta = PsGetWin32Thread()->Desktop->WindowStation;
-
nMaxCount *= sizeof(WCHAR);
//FIXME: wrap in SEH to protect lpClassName access
- Status = RtlQueryAtomInAtomTable(WinSta->AtomTable,
+ Status = RtlQueryAtomInAtomTable(gAtomTable,
Window->Class->Atom, NULL, NULL,
lpClassName, &nMaxCount);
if (!NT_SUCCESS(Status))
_____
Modified: trunk/reactos/subsys/win32k/ntuser/ntuser.c
--- trunk/reactos/subsys/win32k/ntuser/ntuser.c 2005-10-13 10:55:16 UTC
(rev 18426)
+++ trunk/reactos/subsys/win32k/ntuser/ntuser.c 2005-10-13 12:44:58 UTC
(rev 18427)
@@ -46,6 +46,7 @@
NTSTATUS FASTCALL InitUserImpl(VOID)
{
//PVOID mem;
+ NTSTATUS Status;
// DPRINT("Enter InitUserImpl\n");
// ExInitializeResourceLite(&UserLock);
@@ -58,6 +59,13 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
+ Status = InitSessionImpl();
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Error init session impl.\n");
+ return Status;
+ }
+
return STATUS_SUCCESS;
}
_____
Added: trunk/reactos/subsys/win32k/ntuser/session.c
--- trunk/reactos/subsys/win32k/ntuser/session.c 2005-10-13
10:55:16 UTC (rev 18426)
+++ trunk/reactos/subsys/win32k/ntuser/session.c 2005-10-13
12:44:58 UTC (rev 18427)
@@ -0,0 +1,43 @@
+/*
+ * ReactOS W32 Subsystem
+ * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
+ *
+ * This program is free software; you can redistribute it and/or
modify
+ * it under the terms of the GNU General Public License as published
by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * PURPOSE: Session stuff
+ * FILE: subsys/win32k/ntuser/session.c
+ * PROGRAMER: Gunnar
+ */
+
+#include <w32k.h>
+
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS
*******************************************************************/
+
+PRTL_ATOM_TABLE gAtomTable = NULL;
+
+/* FUNCTIONS
*******************************************************************/
+
+NTSTATUS FASTCALL
+InitSessionImpl(VOID)
+{
+ return RtlCreateAtomTable(37, &gAtomTable);
+}
+
_____
Modified: trunk/reactos/subsys/win32k/win32k.xml
--- trunk/reactos/subsys/win32k/win32k.xml 2005-10-13 10:55:16 UTC
(rev 18426)
+++ trunk/reactos/subsys/win32k/win32k.xml 2005-10-13 12:44:58 UTC
(rev 18427)
@@ -89,6 +89,7 @@
<file>painting.c</file>
<file>prop.c</file>
<file>scrollbar.c</file>
+ <file>session.c</file>
<file>stubs.c</file>
<file>timer.c</file>
<file>useratom.c</file>