make classes use session wide atom table. should fix bug 899

svn path=/trunk/; revision=18427
This commit is contained in:
Gunnar Dalsnes 2005-10-13 12:44:58 +00:00
parent 64cd53d0d2
commit 85d5b2ea3f
5 changed files with 66 additions and 32 deletions

View file

@ -73,12 +73,9 @@ ObmDeleteObject(HANDLE h, USER_OBJECT_TYPE type );
#define UserDerefObject(o) ObmDereferenceObject(o)
BOOL FASTCALL ObmCreateHandleTable();
extern USER_HANDLE_TABLE gHandleTable;
/******************** HANDLE.C ***************/
extern USER_HANDLE_TABLE gHandleTable;
PUSER_HANDLE_ENTRY handle_to_entry(PUSER_HANDLE_TABLE ht, HANDLE handle );
VOID UserInitHandleTable(PUSER_HANDLE_TABLE ht, PVOID mem, ULONG bytes);
@ -120,6 +117,13 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags);
DWORD FASTCALL
UserGetWindowDC(PWINDOW_OBJECT Wnd);
/*************** SESSION.C ***************/
extern PRTL_ATOM_TABLE gAtomTable;
NTSTATUS FASTCALL InitSessionImpl(VOID);
/*************** METRIC.C ***************/
ULONG FASTCALL

View file

@ -48,7 +48,6 @@ CleanupClassImpl(VOID)
}
/* return TRUE if class became destroyed */
inline VOID FASTCALL
ClassDerefObject(PWNDCLASS_OBJECT Class)
{
@ -67,22 +66,10 @@ ClassRefObject(PWNDCLASS_OBJECT Class)
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 @@ ClassGetClassByAtom(RTL_ATOM Atom, HINSTANCE hInstance)
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 @@ NtUserRegisterClassExWOW(
*/
{
WNDCLASSEXW SafeClass;
PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
RTL_ATOM Atom;
DECLARE_RETURN(RTL_ATOM);
@ -485,14 +468,12 @@ NtUserRegisterClassExWOW(
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 @@ NtUserRegisterClassExWOW(
{
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 @@ NtUserGetClassName (
{
PWINDOW_OBJECT Window;
DECLARE_RETURN(DWORD);
PWINSTATION_OBJECT WinSta;
NTSTATUS Status;
UserEnterShared();
@ -728,12 +708,10 @@ NtUserGetClassName (
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))

View file

@ -46,6 +46,7 @@ DWORD _locked=0;
NTSTATUS FASTCALL InitUserImpl(VOID)
{
//PVOID mem;
NTSTATUS Status;
// DPRINT("Enter InitUserImpl\n");
// ExInitializeResourceLite(&UserLock);
@ -58,6 +59,13 @@ NTSTATUS FASTCALL InitUserImpl(VOID)
return STATUS_INSUFFICIENT_RESOURCES;
}
Status = InitSessionImpl();
if (!NT_SUCCESS(Status))
{
DPRINT1("Error init session impl.\n");
return Status;
}
return STATUS_SUCCESS;
}

View file

@ -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);
}

View file

@ -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>