mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 12:04:51 +00:00
- Return more correct error codes from NtUserRegisterClassExWOW.
- Delete atom in NtUserUnregisterClass. - Corrected DC locking in NtGdiSetDIBColorTable. - Check region handles in NtGdiPaintRgn. svn path=/trunk/; revision=8153
This commit is contained in:
parent
d54eeab6a3
commit
ca73abde9a
3 changed files with 64 additions and 44 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: class.c,v 1.45 2003/12/22 15:30:21 navaraf Exp $
|
/* $Id: class.c,v 1.46 2004/02/11 17:56:29 navaraf Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -282,6 +282,7 @@ IntCreateClass(CONST WNDCLASSEXW *lpwcx,
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ObmDereferenceObject(ClassObject);
|
ObmDereferenceObject(ClassObject);
|
||||||
|
SetLastWin32Error(ERROR_CLASS_ALREADY_EXISTS);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,6 +291,7 @@ IntCreateClass(CONST WNDCLASSEXW *lpwcx,
|
||||||
ClassObject = ObmCreateObject(NULL, NULL, otClass, objectSize);
|
ClassObject = ObmCreateObject(NULL, NULL, otClass, objectSize);
|
||||||
if (ClassObject == 0)
|
if (ClassObject == 0)
|
||||||
{
|
{
|
||||||
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +415,6 @@ NtUserRegisterClassExWOW(
|
||||||
}
|
}
|
||||||
ObDereferenceObject(WinStaObject);
|
ObDereferenceObject(WinStaObject);
|
||||||
DPRINT("Failed creating window class object\n");
|
DPRINT("Failed creating window class object\n");
|
||||||
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
|
|
||||||
return((RTL_ATOM)0);
|
return((RTL_ATOM)0);
|
||||||
}
|
}
|
||||||
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock);
|
ExAcquireFastMutex(&PsGetWin32Process()->ClassListLock);
|
||||||
|
@ -607,34 +608,47 @@ NtUserSetClassWord(DWORD Unknown0,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserUnregisterClass(LPCWSTR ClassNameOrAtom,
|
NtUserUnregisterClass(
|
||||||
|
LPCWSTR ClassNameOrAtom,
|
||||||
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
||||||
DWORD Unknown)
|
DWORD Unknown)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWNDCLASS_OBJECT Class;
|
PWNDCLASS_OBJECT Class;
|
||||||
|
PWINSTATION_OBJECT WinStaObject;
|
||||||
|
|
||||||
if(!ClassNameOrAtom)
|
if (!ClassNameOrAtom)
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = IntValidateWindowStationHandle(
|
||||||
|
PROCESS_WINDOW_STATION(),
|
||||||
|
KernelMode,
|
||||||
|
0,
|
||||||
|
&WinStaObject);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
Status = ClassReferenceClassByNameOrAtom(&Class, ClassNameOrAtom);
|
Status = ClassReferenceClassByNameOrAtom(&Class, ClassNameOrAtom);
|
||||||
if(!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Class->hInstance && (Class->hInstance != hInstance))
|
if (Class->hInstance && Class->hInstance != hInstance)
|
||||||
{
|
{
|
||||||
ObmDereferenceObject(Class);
|
ObmDereferenceObject(Class);
|
||||||
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ObmGetReferenceCount(Class) > 2)
|
if (ObmGetReferenceCount(Class) > 2)
|
||||||
{
|
{
|
||||||
ObmDereferenceObject(Class);
|
ObmDereferenceObject(Class);
|
||||||
SetLastWin32Error(ERROR_CLASS_HAS_WINDOWS);
|
SetLastWin32Error(ERROR_CLASS_HAS_WINDOWS);
|
||||||
|
@ -646,7 +660,8 @@ NtUserUnregisterClass(LPCWSTR ClassNameOrAtom,
|
||||||
|
|
||||||
RemoveEntryList(&Class->ListEntry);
|
RemoveEntryList(&Class->ListEntry);
|
||||||
|
|
||||||
/* FIXME - delete the atom? */
|
RtlDeleteAtomFromAtomTable(WinStaObject->AtomTable, Class->Atom);
|
||||||
|
ObDereferenceObject(WinStaObject);
|
||||||
|
|
||||||
/* Free the object */
|
/* Free the object */
|
||||||
ObmDereferenceObject(Class);
|
ObmDereferenceObject(Class);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Id: dib.c,v 1.40 2004/01/16 19:32:00 gvg Exp $
|
* $Id: dib.c,v 1.41 2004/02/11 17:56:29 navaraf Exp $
|
||||||
*
|
*
|
||||||
* ReactOS W32 Subsystem
|
* ReactOS W32 Subsystem
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
||||||
|
@ -48,11 +48,11 @@ UINT STDCALL NtGdiSetDIBColorTable(HDC hDC,
|
||||||
PPALGDI palette;
|
PPALGDI palette;
|
||||||
const RGBQUAD *end;
|
const RGBQUAD *end;
|
||||||
|
|
||||||
if (!(dc = (PDC)AccessUserObject((ULONG)hDC))) return 0;
|
if (!(dc = DC_LockDc(hDC))) return 0;
|
||||||
|
|
||||||
if (!(palette = PALETTE_LockPalette((ULONG)dc->DevInfo->hpalDefault)))
|
if (!(palette = PALETTE_LockPalette((ULONG)dc->DevInfo->hpalDefault)))
|
||||||
{
|
{
|
||||||
// GDI_ReleaseObj( hdc );
|
DC_UnlockDc(hDC);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ UINT STDCALL NtGdiSetDIBColorTable(HDC hDC,
|
||||||
}
|
}
|
||||||
|
|
||||||
PALETTE_UnlockPalette(dc->DevInfo->hpalDefault);
|
PALETTE_UnlockPalette(dc->DevInfo->hpalDefault);
|
||||||
// GDI_ReleaseObj(hdc);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
return Entries;
|
return Entries;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: region.c,v 1.40 2003/12/13 11:15:06 weiden Exp $ */
|
/* $Id: region.c,v 1.41 2004/02/11 17:56:29 navaraf Exp $ */
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
@ -2011,6 +2011,11 @@ NtGdiPaintRgn(HDC hDC,
|
||||||
|
|
||||||
//visrgn = RGNDATA_LockRgn(tmpVisRgn);
|
//visrgn = RGNDATA_LockRgn(tmpVisRgn);
|
||||||
visrgn = RGNDATA_LockRgn(hRgn);
|
visrgn = RGNDATA_LockRgn(hRgn);
|
||||||
|
if (visrgn == NULL)
|
||||||
|
{
|
||||||
|
DC_UnlockDc( hDC );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ClipRegion = IntEngCreateClipRegion (
|
ClipRegion = IntEngCreateClipRegion (
|
||||||
visrgn->rdh.nCount, (PRECTL)visrgn->Buffer, visrgn->rdh.rcBound );
|
visrgn->rdh.nCount, (PRECTL)visrgn->Buffer, visrgn->rdh.rcBound );
|
||||||
|
|
Loading…
Reference in a new issue