mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
-W32k/NtUser separation
-Introduce new WinSta lock to replace most others svn path=/trunk/; revision=5380
This commit is contained in:
parent
0eec40929a
commit
59caa89d83
6 changed files with 103 additions and 45 deletions
14
reactos/subsys/win32k/include/prop.h
Normal file
14
reactos/subsys/win32k/include/prop.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef _WIN32K_PROP_H
|
||||||
|
#define _WIN32K_PROP_H
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
W32kSetProp(struct _WINDOW_OBJECT* Wnd, ATOM Atom, HANDLE Data);
|
||||||
|
|
||||||
|
struct _PROPERTY* FASTCALL
|
||||||
|
W32kGetProp(struct _WINDOW_OBJECT* WindowObject, ATOM Atom);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _WIN32K_PROP_H */
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
#ifndef __WIN32K_WINDOW_H
|
#ifndef __WIN32K_WINDOW_H
|
||||||
#define __WIN32K_WINDOW_H
|
#define __WIN32K_WINDOW_H
|
||||||
|
|
||||||
|
struct _PROPERTY;
|
||||||
|
struct _WINDOW_OBJECT;
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <include/class.h>
|
#include <include/class.h>
|
||||||
#include <include/msgqueue.h>
|
#include <include/msgqueue.h>
|
||||||
#include <include/winsta.h>
|
#include <include/winsta.h>
|
||||||
#include <include/dce.h>
|
#include <include/dce.h>
|
||||||
|
#include <include/prop.h>
|
||||||
|
|
||||||
typedef struct _PROPERTY
|
typedef struct _PROPERTY
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,10 @@ W32kGetCaptureWindow(VOID);
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
W32kSetCaptureWindow(struct _WINDOW_OBJECT* Window);
|
W32kSetCaptureWindow(struct _WINDOW_OBJECT* Window);
|
||||||
|
|
||||||
|
inline VOID W32kAcquireWinStaLockShared();
|
||||||
|
inline VOID W32kAcquireWinStaLockExclusive();
|
||||||
|
inline VOID W32kReleaseWinStaLock();
|
||||||
|
|
||||||
#endif /* __WIN32K_WINSTA_H */
|
#endif /* __WIN32K_WINSTA_H */
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -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: prop.c,v 1.2 2003/05/18 17:16:17 ea Exp $
|
/* $Id: prop.c,v 1.3 2003/08/02 16:32:18 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -83,10 +83,10 @@ NtUserRemoveProp(HWND hWnd, ATOM Atom)
|
||||||
PPROPERTY Prop;
|
PPROPERTY Prop;
|
||||||
HANDLE Data;
|
HANDLE Data;
|
||||||
|
|
||||||
WindowObject = W32kGetWindowObject(hWnd);
|
if (!(WindowObject = W32kGetWindowObject(hWnd)))
|
||||||
if (WindowObject == NULL)
|
|
||||||
{
|
{
|
||||||
return(NULL);
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Prop = W32kGetProp(WindowObject, Atom);
|
Prop = W32kGetProp(WindowObject, Atom);
|
||||||
|
@ -109,10 +109,13 @@ NtUserGetProp(HWND hWnd, ATOM Atom)
|
||||||
PPROPERTY Prop;
|
PPROPERTY Prop;
|
||||||
HANDLE Data = NULL;
|
HANDLE Data = NULL;
|
||||||
|
|
||||||
WindowObject = W32kGetWindowObject(hWnd);
|
W32kAcquireWinStaLockShared();
|
||||||
if (WindowObject == NULL)
|
|
||||||
|
if (!(WindowObject = W32kGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
return(FALSE);
|
W32kReleaseWinStaLock();
|
||||||
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Prop = W32kGetProp(WindowObject, Atom);
|
Prop = W32kGetProp(WindowObject, Atom);
|
||||||
|
@ -120,36 +123,51 @@ NtUserGetProp(HWND hWnd, ATOM Atom)
|
||||||
{
|
{
|
||||||
Data = Prop->Data;
|
Data = Prop->Data;
|
||||||
}
|
}
|
||||||
W32kReleaseWindowObject(WindowObject);
|
|
||||||
|
W32kReleaseWinStaLock();
|
||||||
|
|
||||||
return(Data);
|
return(Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
W32kSetProp(PWINDOW_OBJECT Wnd, ATOM Atom, HANDLE Data)
|
||||||
|
{
|
||||||
|
PPROPERTY Prop;
|
||||||
|
|
||||||
|
Prop = W32kGetProp(Wnd, Atom);
|
||||||
|
|
||||||
|
if (Prop == NULL)
|
||||||
|
{
|
||||||
|
Prop = ExAllocatePool(PagedPool, sizeof(PROPERTY));
|
||||||
|
if (Prop == NULL) return FALSE;
|
||||||
|
Prop->Atom = Atom;
|
||||||
|
InsertTailList(&Wnd->PropListHead, &Prop->PropListEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
Prop->Data = Data;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)
|
NtUserSetProp(HWND hWnd, ATOM Atom, HANDLE Data)
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT WindowObject;
|
PWINDOW_OBJECT Wnd;
|
||||||
PPROPERTY Prop;
|
BOOL ret;
|
||||||
|
|
||||||
WindowObject = W32kGetWindowObject(hWnd);
|
W32kAcquireWinStaLockExclusive();
|
||||||
if (WindowObject == NULL)
|
|
||||||
|
if (!(Wnd = W32kGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
return(FALSE);
|
W32kReleaseWinStaLock();
|
||||||
|
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Prop = W32kGetProp(WindowObject, Atom);
|
ret = W32kSetProp(Wnd, Atom, Data);
|
||||||
if (Prop == NULL)
|
|
||||||
{
|
W32kReleaseWinStaLock();
|
||||||
Prop = ExAllocatePool(PagedPool, sizeof(PROPERTY));
|
return ret;
|
||||||
if (Prop == NULL)
|
|
||||||
{
|
|
||||||
W32kReleaseWindowObject(WindowObject);
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
Prop->Atom = Atom;
|
|
||||||
InsertTailList(&WindowObject->PropListHead, &Prop->PropListEntry);
|
|
||||||
}
|
|
||||||
Prop->Data = Data;
|
|
||||||
W32kReleaseWindowObject(WindowObject);
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -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: winpos.c,v 1.18 2003/08/01 14:38:51 dwelch Exp $
|
/* $Id: winpos.c,v 1.19 2003/08/02 16:32:18 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -117,8 +117,7 @@ WinPosCreateIconTitle(PWINDOW_OBJECT WindowObject)
|
||||||
BOOL STATIC FASTCALL
|
BOOL STATIC FASTCALL
|
||||||
WinPosShowIconTitle(PWINDOW_OBJECT WindowObject, BOOL Show)
|
WinPosShowIconTitle(PWINDOW_OBJECT WindowObject, BOOL Show)
|
||||||
{
|
{
|
||||||
PINTERNALPOS InternalPos = NtUserGetProp(WindowObject->Self,
|
PINTERNALPOS InternalPos = W32kGetProp(WindowObject, AtomInternalPos);
|
||||||
AtomInternalPos);
|
|
||||||
PWINDOW_OBJECT IconWindow;
|
PWINDOW_OBJECT IconWindow;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
@ -161,13 +160,12 @@ WinPosShowIconTitle(PWINDOW_OBJECT WindowObject, BOOL Show)
|
||||||
PINTERNALPOS STATIC STDCALL
|
PINTERNALPOS STATIC STDCALL
|
||||||
WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
|
WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
|
||||||
{
|
{
|
||||||
PINTERNALPOS InternalPos = NtUserGetProp(WindowObject->Self,
|
PINTERNALPOS InternalPos = W32kGetProp(WindowObject, AtomInternalPos);
|
||||||
AtomInternalPos);
|
|
||||||
if (InternalPos == NULL)
|
if (InternalPos == NULL)
|
||||||
{
|
{
|
||||||
InternalPos =
|
InternalPos =
|
||||||
ExAllocatePool(NonPagedPool, sizeof(INTERNALPOS));
|
ExAllocatePool(NonPagedPool, sizeof(INTERNALPOS));
|
||||||
NtUserSetProp(WindowObject->Self, AtomInternalPos, InternalPos);
|
W32kSetProp(WindowObject, AtomInternalPos, InternalPos);
|
||||||
InternalPos->IconTitle = 0;
|
InternalPos->IconTitle = 0;
|
||||||
InternalPos->NormalRect = WindowObject->WindowRect;
|
InternalPos->NormalRect = WindowObject->WindowRect;
|
||||||
InternalPos->IconPos.x = InternalPos->MaxPos.x = 0xFFFFFFFF;
|
InternalPos->IconPos.x = InternalPos->MaxPos.x = 0xFFFFFFFF;
|
||||||
|
@ -327,7 +325,7 @@ WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos,
|
||||||
MinMax.ptMaxSize.x += 2 * XInc;
|
MinMax.ptMaxSize.x += 2 * XInc;
|
||||||
MinMax.ptMaxSize.y += 2 * YInc;
|
MinMax.ptMaxSize.y += 2 * YInc;
|
||||||
|
|
||||||
Pos = NtUserGetProp(Window->Self, AtomInternalPos);
|
Pos = W32kGetProp(Window, AtomInternalPos);
|
||||||
if (Pos != NULL)
|
if (Pos != NULL)
|
||||||
{
|
{
|
||||||
MinMax.ptMaxPosition = Pos->MaxPos;
|
MinMax.ptMaxPosition = Pos->MaxPos;
|
||||||
|
|
|
@ -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: winsta.c,v 1.20 2003/07/27 21:35:50 dwelch Exp $
|
/* $Id: winsta.c,v 1.21 2003/08/02 16:32:18 gdalsnes Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -68,6 +68,25 @@ static HDC ScreenDeviceContext = NULL;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
inline VOID W32kAcquireWinStaLockShared()
|
||||||
|
{
|
||||||
|
ExAcquireResourceExclusiveLite(&(PsGetWin32Process()->WindowStation->Resource),
|
||||||
|
TRUE /*Wait*/
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VOID W32kAcquireWinStaLockExclusive()
|
||||||
|
{
|
||||||
|
ExAcquireResourceSharedLite(&(PsGetWin32Process()->WindowStation->Resource),
|
||||||
|
TRUE /*Wait*/
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline VOID W32kReleaseWinStaLock()
|
||||||
|
{
|
||||||
|
ExReleaseResourceLite( &(PsGetWin32Process()->WindowStation->Resource) );
|
||||||
|
}
|
||||||
|
|
||||||
PDESKTOP_OBJECT FASTCALL
|
PDESKTOP_OBJECT FASTCALL
|
||||||
W32kGetActiveDesktop(VOID)
|
W32kGetActiveDesktop(VOID)
|
||||||
{
|
{
|
||||||
|
@ -340,6 +359,7 @@ NtUserCreateWindowStation(PUNICODE_STRING lpszWindowStationName,
|
||||||
return (HWINSTA)0;
|
return (HWINSTA)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExInitializeResourceLite(&WinStaObject->Resource);
|
||||||
WinStaObject->HandleTable = ObmCreateHandleTable();
|
WinStaObject->HandleTable = ObmCreateHandleTable();
|
||||||
if (!WinStaObject->HandleTable)
|
if (!WinStaObject->HandleTable)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue