- More movement to WND with updates to related files. Added new scroll and get/post message routines. In the mix we did moved to the MONITOR structure.

svn path=/trunk/; revision=45042
This commit is contained in:
James Tabor 2010-01-11 07:36:48 +00:00
parent 9da88c7fda
commit 24533102e6
15 changed files with 448 additions and 228 deletions

View file

@ -1,35 +1,36 @@
#ifndef _WIN32K_MONITOR_H #ifndef _WIN32K_MONITOR_H
#define _WIN32K_MONITOR_H #define _WIN32K_MONITOR_H
//struct PDEVOBJ;
/* monitor object */ /* monitor object */
typedef struct _MONITOR_OBJECT typedef struct _MONITOR
{ {
HANDLE Handle; /* system object handle */ HEAD head;
FAST_MUTEX Lock; /* R/W lock */ //
FAST_MUTEX Lock; /* R/W lock */
BOOL IsPrimary; /* wether this is the primary monitor */ UNICODE_STRING DeviceName; /* name of the monitor */
UNICODE_STRING DeviceName; /* name of the monitor */ PDEVOBJ *GdiDevice; /* pointer to the GDI device to
PDEVOBJ *GdiDevice; /* pointer to the GDI device to which this monitor is attached */
which this monitor is attached */ // This is the structure Windows uses:
struct _MONITOR_OBJECT *Prev, *Next; /* doubly linked list */ // struct _MONITOR* pMonitorNext;
union {
// This is the structure Windows uses: DWORD dwMONFlags;
// HEAD head; struct {
// struct _MONITOR_OBJECT *pMonitorNext; DWORD IsVisible:1;
// DWORD dwMONFlags; DWORD IsPalette:1;
DWORD IsPrimary:1; /* wether this is the primary monitor */
};};
RECT rcMonitor; RECT rcMonitor;
RECT rcWork; RECT rcWork;
// HRGN hrgnMonitor; HRGN hrgnMonitor;
// SHORT Spare0; SHORT Spare0;
// SHORT cWndStack; SHORT cWndStack;
// HDEV hDev; HDEV hDev;
// HDEV hDevReal; HDEV hDevReal;
// BYTE DockTargets[4][7]; // BYTE DockTargets[4][7];
// struct _MONITOR_OBJECT* Flink; // Use LIST_ENTRY
// struct _MONITOR_OBJECT* Blink; struct _MONITOR* Next; //Flink;
} MONITOR_OBJECT, *PMONITOR_OBJECT; struct _MONITOR* Prev; //Blink;
} MONITOR, *PMONITOR;
/* functions */ /* functions */
NTSTATUS InitMonitorImpl(); NTSTATUS InitMonitorImpl();
@ -37,7 +38,8 @@ NTSTATUS CleanupMonitorImpl();
NTSTATUS IntAttachMonitor(PDEVOBJ *pGdiDevice, ULONG DisplayNumber); NTSTATUS IntAttachMonitor(PDEVOBJ *pGdiDevice, ULONG DisplayNumber);
NTSTATUS IntDetachMonitor(PDEVOBJ *pGdiDevice); NTSTATUS IntDetachMonitor(PDEVOBJ *pGdiDevice);
PMONITOR_OBJECT FASTCALL UserGetMonitorObject(IN HMONITOR); PMONITOR FASTCALL UserGetMonitorObject(IN HMONITOR);
PMONITOR FASTCALL IntGetPrimaryMonitor(VOID);
#endif /* _WIN32K_MONITOR_H */ #endif /* _WIN32K_MONITOR_H */

View file

@ -1,6 +1,50 @@
#ifndef _WIN32K_SCROLL_H #ifndef _WIN32K_SCROLL_H
#define _WIN32K_SCROLL_H #define _WIN32K_SCROLL_H
typedef struct tagSBCALC
{
INT posMin;
INT posMax;
INT page;
INT pos;
INT pxTop;
INT pxBottom;
INT pxLeft;
INT pxRight;
INT cpxThumb;
INT pxUpArrow;
INT pxDownArrow;
INT pxStart;
INT pxThumbBottom;
INT pxThumbTop;
INT cpx;
INT pxMin;
} SBCALC, *PSBCALC;
typedef VOID (NEAR NTAPI *PFN_SCROLLBAR)(PWND, UINT, WPARAM, LPARAM, PSBCALC);
typedef struct tagSBTRACK
{
ULONG fHitOld:1;
ULONG fTrackVert:1;
ULONG fCtlSB:1;
ULONG fTrackRecalc:1;
PWND spwndTrack;
PWND spwndSB;
PWND spwndSBNotify;
RECT rcTrack;
PFN_SCROLLBAR xxxpfnSB;
UINT cmdSB;
UINT_PTR hTimerSB;
INT dpxThumb;
INT pxOld;
INT posOld;
INT posNew;
INT nBar;
PSBCALC pSBCalc;
} SBTRACK, *PSBTRACK;
typedef struct _SBINFOEX typedef struct _SBINFOEX
{ {
SCROLLBARINFO ScrollBarInfo; SCROLLBARINFO ScrollBarInfo;

View file

@ -88,6 +88,11 @@ typedef struct _THREADINFO
PTHREADINFO ptiSibling; PTHREADINFO ptiSibling;
ULONG fsHooks; ULONG fsHooks;
PHOOK sphkCurrent; PHOOK sphkCurrent;
LPARAM lParamHkCurrent;
WPARAM wParamHkCurrent;
struct tagSBTRACK* pSBTrack;
HANDLE hEventQueueClient;
PKEVENT pEventQueueServer;
LIST_ENTRY PtiLink; LIST_ENTRY PtiLink;
CLIENTTHREADINFO cti; // Used only when no Desktop or pcti NULL. CLIENTTHREADINFO cti; // Used only when no Desktop or pcti NULL.
@ -108,6 +113,23 @@ typedef struct _W32HEAP_USER_MAPPING
ULONG Count; ULONG Count;
} W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING; } W32HEAP_USER_MAPPING, *PW32HEAP_USER_MAPPING;
/*
Information from STARTUPINFOW, psdk/winbase.h.
Set from PsGetCurrentProcess()->Peb->ProcessParameters.
*/
typedef struct tagUSERSTARTUPINFO
{
ULONG cb;
DWORD dwX; // STARTF_USEPOSITION StartupInfo->dwX/Y
DWORD dwY;
DWORD dwXSize; // STARTF_USESIZE StartupInfo->dwX/YSize
DWORD dwYSize;
DWORD dwFlags; // STARTF_ StartupInfo->dwFlags
WORD wShowWindow; // StartupInfo->wShowWindow
USHORT cbReserved2;
} USERSTARTUPINFO, *PUSERSTARTUPINFO;
typedef struct _W32PROCESS typedef struct _W32PROCESS
{ {
PEPROCESS peProcess; PEPROCESS peProcess;
@ -130,10 +152,17 @@ typedef struct _W32PROCESS
typedef struct _PROCESSINFO typedef struct _PROCESSINFO
{ {
W32PROCESS; W32PROCESS;
PTHREADINFO ptiList;
PTHREADINFO ptiMainThread;
struct _DESKTOP* rpdeskStartup;
PCLS pclsPrivateList; PCLS pclsPrivateList;
PCLS pclsPublicList; PCLS pclsPublicList;
HMONITOR hMonitor;
USERSTARTUPINFO usi;
ULONG Flags;
DWORD dwLayout;
DWORD dwRegisteredClasses; DWORD dwRegisteredClasses;
/* ReactOS */ /* ReactOS */
LIST_ENTRY ClassList; LIST_ENTRY ClassList;

View file

@ -39,8 +39,6 @@ typedef struct _WINDOW_OBJECT
HANDLE hrgnUpdate; HANDLE hrgnUpdate;
/* Handle of the window region. */ /* Handle of the window region. */
HANDLE hrgnClip; HANDLE hrgnClip;
/* Pointer to the owning thread's message queue. */
PUSER_MESSAGE_QUEUE MessageQueue;
struct _WINDOW_OBJECT* spwndChild; struct _WINDOW_OBJECT* spwndChild;
struct _WINDOW_OBJECT* spwndNext; struct _WINDOW_OBJECT* spwndNext;
struct _WINDOW_OBJECT* spwndPrev; struct _WINDOW_OBJECT* spwndPrev;
@ -54,9 +52,7 @@ typedef struct _WINDOW_OBJECT
PDCE Dce; PDCE Dce;
/* Scrollbar info */ /* Scrollbar info */
PSBINFOEX pSBInfo; // convert to PSBINFO PSBINFOEX pSBInfo; // convert to PSBINFO
PETHREAD OwnerThread; // Use Wnd->head.pti PETHREAD OwnerThread; // Use Wnd->head.pti->pEThread
/* counter for tiled child windows */
ULONG TiledCounter;
/* WNDOBJ list */ /* WNDOBJ list */
LIST_ENTRY WndObjListHead; // Use Props LIST_ENTRY WndObjListHead; // Use Props
} WINDOW_OBJECT; /* PWINDOW_OBJECT already declared at top of file */ } WINDOW_OBJECT; /* PWINDOW_OBJECT already declared at top of file */

View file

@ -67,7 +67,7 @@ IntClientShutdown(
co_IntSendMessage(WndChild->hSelf, WM_ENDSESSION, KillTimers, lParams); co_IntSendMessage(WndChild->hSelf, WM_ENDSESSION, KillTimers, lParams);
if (KillTimers) if (KillTimers)
{ {
MsqRemoveTimersWindow(WndChild->MessageQueue, WndChild->hSelf); MsqRemoveTimersWindow(WndChild->pti->MessageQueue, WndChild->hSelf);
} }
lResult = MCSR_SHUTDOWNFINISHED; lResult = MCSR_SHUTDOWNFINISHED;
} }
@ -90,7 +90,7 @@ IntClientShutdown(
co_IntSendMessage(pWindow->hSelf, WM_ENDSESSION, KillTimers, lParams); co_IntSendMessage(pWindow->hSelf, WM_ENDSESSION, KillTimers, lParams);
if (KillTimers) if (KillTimers)
{ {
MsqRemoveTimersWindow(pWindow->MessageQueue, pWindow->hSelf); MsqRemoveTimersWindow(pWindow->pti->MessageQueue, pWindow->hSelf);
} }
lResult = MCSR_SHUTDOWNFINISHED; lResult = MCSR_SHUTDOWNFINISHED;
} }

View file

@ -235,26 +235,26 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin
return TRUE; return TRUE;
} }
hWndFocusPrev = (PrevForegroundQueue == FocusWindow->MessageQueue hWndFocusPrev = (PrevForegroundQueue == FocusWindow->pti->MessageQueue
? FocusWindow->MessageQueue->FocusWindow : NULL); ? FocusWindow->pti->MessageQueue->FocusWindow : NULL);
/* FIXME: Call hooks. */ /* FIXME: Call hooks. */
co_IntSendDeactivateMessages(hWndPrev, hWnd); co_IntSendDeactivateMessages(hWndPrev, hWnd);
co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus); co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus);
IntSetFocusMessageQueue(Window->MessageQueue); IntSetFocusMessageQueue(Window->pti->MessageQueue);
if (Window->MessageQueue) if (Window->pti->MessageQueue)
{ {
Window->MessageQueue->ActiveWindow = hWnd; Window->pti->MessageQueue->ActiveWindow = hWnd;
} }
if (FocusWindow->MessageQueue) if (FocusWindow->pti->MessageQueue)
{ {
FocusWindow->MessageQueue->FocusWindow = hWndFocus; FocusWindow->pti->MessageQueue->FocusWindow = hWndFocus;
} }
if (PrevForegroundQueue != Window->MessageQueue) if (PrevForegroundQueue != Window->pti->MessageQueue)
{ {
/* FIXME: Send WM_ACTIVATEAPP to all thread windows. */ /* FIXME: Send WM_ACTIVATEAPP to all thread windows. */
} }
@ -482,7 +482,7 @@ NtUserSetActiveWindow(HWND hWnd)
pti = PsGetCurrentThreadWin32Thread(); pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue; ThreadQueue = pti->MessageQueue;
if (Window->MessageQueue != ThreadQueue) if (Window->pti->MessageQueue != ThreadQueue)
{ {
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
RETURN( 0); RETURN( 0);
@ -546,7 +546,7 @@ NtUserSetCapture(HWND hWnd)
if((Window = UserGetWindowObject(hWnd))) if((Window = UserGetWindowObject(hWnd)))
{ {
if(Window->MessageQueue != ThreadQueue) if(Window->pti->MessageQueue != ThreadQueue)
{ {
RETURN(NULL); RETURN(NULL);
} }
@ -596,7 +596,7 @@ HWND FASTCALL co_UserSetFocus(PWINDOW_OBJECT Window OPTIONAL)
return( (ThreadQueue ? ThreadQueue->FocusWindow : 0)); return( (ThreadQueue ? ThreadQueue->FocusWindow : 0));
} }
if (Window->MessageQueue != ThreadQueue) if (Window->pti->MessageQueue != ThreadQueue)
{ {
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return( 0); return( 0);

View file

@ -458,7 +458,7 @@ IntKeyboardSendWinKeyMsg()
Mesg.lParam = 0; Mesg.lParam = 0;
/* The QS_HOTKEY is just a guess */ /* The QS_HOTKEY is just a guess */
MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY); MsqPostMessage(Window->pti->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
} }
static VOID APIENTRY static VOID APIENTRY

View file

@ -541,7 +541,7 @@ co_IntTranslateMouseMessage(
UserRefObjectCo(Window, &Ref); UserRefObjectCo(Window, &Ref);
if ( ThreadQueue == Window->MessageQueue && if ( ThreadQueue == Window->pti->MessageQueue &&
ThreadQueue->CaptureWindow != Window->hSelf) ThreadQueue->CaptureWindow != Window->hSelf)
{ {
/* only send WM_NCHITTEST messages if we're not capturing the window! */ /* only send WM_NCHITTEST messages if we're not capturing the window! */
@ -559,7 +559,7 @@ co_IntTranslateMouseMessage(
UserRefObjectCo(DesktopWindow, &DesktopRef); UserRefObjectCo(DesktopWindow, &DesktopRef);
co_WinPosWindowFromPoint(DesktopWindow, Window->MessageQueue, &Msg->pt, &Wnd); co_WinPosWindowFromPoint(DesktopWindow, Window->pti->MessageQueue, &Msg->pt, &Wnd);
if (Wnd) if (Wnd)
{ {
if (Wnd != Window) if (Wnd != Window)
@ -568,7 +568,7 @@ co_IntTranslateMouseMessage(
Msg->hwnd = Wnd->hSelf; Msg->hwnd = Wnd->hSelf;
if(!(Wnd->state & WINDOWSTATUS_DESTROYING)) if(!(Wnd->state & WINDOWSTATUS_DESTROYING))
{ {
MsqPostMessage(Wnd->MessageQueue, Msg, FALSE, MsqPostMessage(Wnd->pti->MessageQueue, Msg, FALSE,
Msg->message == WM_MOUSEMOVE ? QS_MOUSEMOVE : Msg->message == WM_MOUSEMOVE ? QS_MOUSEMOVE :
QS_MOUSEBUTTON); QS_MOUSEBUTTON);
} }
@ -671,9 +671,27 @@ co_IntPeekMessage( PUSER_MESSAGE Msg,
ThreadQueue = pti->MessageQueue; ThreadQueue = pti->MessageQueue;
/* Inspect RemoveMsg flags */ /* Inspect RemoveMsg flags */
/* FIXME: The only flag we process is PM_REMOVE - processing of others must still be implemented */ /* Note:
The only flag we process is PM_REMOVE.
Processing (High word) PM_QS_Xx Is needed. This and MsgFilterXxx can result
with QS_Xx flags to be used to isolate which message check to test for.
ATM, we look at all messages and the filters are sent to co_MsqFindMessage
and there, it is cross checked.
Example: Wine server/queue.c is_keyboard_msg, check_msg_filter and
filter_contains_hw_range.
*/
RemoveMessages = RemoveMsg & PM_REMOVE; RemoveMessages = RemoveMsg & PM_REMOVE;
/*
If no filter is specified, messages are processed in the following order:
* Sent messages
* Posted messages
* Input (hardware) messages and system internal events
* Sent messages (again)
* WM_PAINT messages
* WM_TIMER messages
*/
CheckMessages: CheckMessages:
Present = FALSE; Present = FALSE;
@ -834,7 +852,8 @@ MessageFound:
goto MsgExit; goto MsgExit;
} }
if ( ( Msg->Msg.hwnd && Msg->Msg.message >= WM_MOUSEFIRST && if ( ( Msg->Msg.hwnd &&
Msg->Msg.message >= WM_MOUSEFIRST &&
Msg->Msg.message <= WM_MOUSELAST ) && Msg->Msg.message <= WM_MOUSELAST ) &&
co_IntTranslateMouseMessage( ThreadQueue, co_IntTranslateMouseMessage( ThreadQueue,
&Msg->Msg, &Msg->Msg,
@ -908,58 +927,6 @@ MsgExit:
return Present; return Present;
} }
BOOL FASTCALL
co_IntGetPeekMessage( PMSG pMsg,
HWND hWnd,
UINT MsgFilterMin,
UINT MsgFilterMax,
UINT RemoveMsg,
BOOL bGMSG )
{
return FALSE;
}
static BOOL FASTCALL
co_IntWaitMessage( PWINDOW_OBJECT Window,
UINT MsgFilterMin,
UINT MsgFilterMax )
{
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
NTSTATUS Status = STATUS_SUCCESS;
USER_MESSAGE Msg;
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
do
{
if ( co_IntPeekMessage( &Msg,
Window,
MsgFilterMin,
MsgFilterMax,
PM_NOREMOVE))
{
return TRUE;
}
/* Nothing found. Wait for new messages. */
Status = co_MsqWaitForNewMessages( ThreadQueue,
Window,
MsgFilterMin,
MsgFilterMax);
}
while ( (STATUS_WAIT_0 <= Status && Status <= STATUS_WAIT_63) ||
STATUS_TIMEOUT == Status );
SetLastNtError(Status);
DPRINT1("Exit co_IntWaitMessage on error!\n");
return FALSE;
}
static NTSTATUS FASTCALL static NTSTATUS FASTCALL
CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry) CopyMsgToKernelMem(MSG *KernelModeMsg, MSG *UserModeMsg, PMSGMEMORY MsgMemoryEntry)
{ {
@ -1054,6 +1021,121 @@ CopyMsgToUserMem(MSG *UserModeMsg, MSG *KernelModeMsg)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static BOOL FASTCALL
co_IntWaitMessage( PWINDOW_OBJECT Window,
UINT MsgFilterMin,
UINT MsgFilterMax )
{
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
NTSTATUS Status = STATUS_SUCCESS;
USER_MESSAGE Msg;
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
do
{
if ( co_IntPeekMessage( &Msg,
Window,
MsgFilterMin,
MsgFilterMax,
PM_NOREMOVE))
{
return TRUE;
}
/* Nothing found. Wait for new messages. */
Status = co_MsqWaitForNewMessages( ThreadQueue,
Window,
MsgFilterMin,
MsgFilterMax);
}
while ( (STATUS_WAIT_0 <= Status && Status <= STATUS_WAIT_63) ||
STATUS_TIMEOUT == Status );
SetLastNtError(Status);
DPRINT1("Exit co_IntWaitMessage on error!\n");
return FALSE;
}
BOOL FASTCALL
co_IntGetPeekMessage( PMSG pMsg,
HWND hWnd,
UINT MsgFilterMin,
UINT MsgFilterMax,
UINT RemoveMsg,
BOOL bGMSG )
{
BOOL Present;
PWINDOW_OBJECT Window;
USER_MESSAGE Msg;
if ( hWnd == HWND_TOPMOST ||
hWnd == HWND_BROADCAST )
hWnd = HWND_BOTTOM;
/* Validate input */
if (hWnd && hWnd != HWND_BOTTOM)
{
if (!(Window = UserGetWindowObject(hWnd)))
{
if (bGMSG)
return -1;
else
return FALSE;
}
}
else
{
Window = (PWINDOW_OBJECT)hWnd;
}
if (MsgFilterMax < MsgFilterMin)
{
MsgFilterMin = 0;
MsgFilterMax = 0;
}
do
{
Present = co_IntPeekMessage( &Msg,
Window,
MsgFilterMin,
MsgFilterMax,
RemoveMsg );
if (Present)
{
RtlCopyMemory( pMsg, &Msg.Msg, sizeof(MSG));
if (bGMSG)
return (WM_QUIT != pMsg->message);
else
return TRUE;
}
if ( bGMSG && !co_IntWaitMessage(Window, MsgFilterMin, MsgFilterMax) )
{
return -1;
}
else
{
if (!(RemoveMsg & PM_NOYIELD))
{
// Yield this thread!
UserLeave();
ZwYieldExecution();
UserEnterExclusive();
// Fall through to fail.
}
}
}
while( bGMSG && !Present );
return FALSE;
}
BOOL FASTCALL BOOL FASTCALL
UserPostThreadMessage( DWORD idThread, UserPostThreadMessage( DWORD idThread,
UINT Msg, UINT Msg,
@ -1079,7 +1161,9 @@ UserPostThreadMessage( DWORD idThread,
if( Status == STATUS_SUCCESS ) if( Status == STATUS_SUCCESS )
{ {
pThread = (PTHREADINFO)peThread->Tcb.Win32Thread; pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
if( !pThread || !pThread->MessageQueue || (pThread->TIF_flags & TIF_INCLEANUP)) if( !pThread ||
!pThread->MessageQueue ||
(pThread->TIF_flags & TIF_INCLEANUP))
{ {
ObDereferenceObject( peThread ); ObDereferenceObject( peThread );
return FALSE; return FALSE;
@ -1168,7 +1252,7 @@ UserPostMessage( HWND Wnd,
if (WM_QUIT == Msg) if (WM_QUIT == Msg)
{ {
MsqPostQuitMessage(Window->MessageQueue, wParam); MsqPostQuitMessage(Window->pti->MessageQueue, wParam);
} }
else else
{ {
@ -1179,7 +1263,7 @@ UserPostMessage( HWND Wnd,
Message.pt = gpsi->ptCursor; Message.pt = gpsi->ptCursor;
KeQueryTickCount(&LargeTickCount); KeQueryTickCount(&LargeTickCount);
pti->timeLast = Message.time = MsqCalculateMessageTime(&LargeTickCount); pti->timeLast = Message.time = MsqCalculateMessageTime(&LargeTickCount);
MsqPostMessage(Window->MessageQueue, &Message, FALSE, QS_POSTMESSAGE); MsqPostMessage(Window->pti->MessageQueue, &Message, FALSE, QS_POSTMESSAGE);
} }
} }
return TRUE; return TRUE;
@ -1232,7 +1316,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
IntCallWndProc( Window, hWnd, Msg, wParam, lParam); IntCallWndProc( Window, hWnd, Msg, wParam, lParam);
if ( NULL != Win32Thread && if ( NULL != Win32Thread &&
Window->MessageQueue == Win32Thread->MessageQueue) Window->pti->MessageQueue == Win32Thread->MessageQueue)
{ {
if (Win32Thread->TIF_flags & TIF_INCLEANUP) if (Win32Thread->TIF_flags & TIF_INCLEANUP)
{ {
@ -1280,7 +1364,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
RETURN( TRUE); RETURN( TRUE);
} }
if (uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->MessageQueue)) if (uFlags & SMTO_ABORTIFHUNG && MsqIsHung(Window->pti->MessageQueue))
{ {
/* FIXME - Set a LastError? */ /* FIXME - Set a LastError? */
RETURN( FALSE); RETURN( FALSE);
@ -1295,19 +1379,19 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
do do
{ {
Status = co_MsqSendMessage( Window->MessageQueue, Status = co_MsqSendMessage( Window->pti->MessageQueue,
hWnd, hWnd,
Msg, Msg,
wParam, wParam,
lParam, lParam,
uTimeout, uTimeout,
(uFlags & SMTO_BLOCK), (uFlags & SMTO_BLOCK),
MSQ_NORMAL, MSQ_NORMAL,
uResult ); uResult );
} }
while ((STATUS_TIMEOUT == Status) && while ((STATUS_TIMEOUT == Status) &&
(uFlags & SMTO_NOTIMEOUTIFNOTHUNG) && (uFlags & SMTO_NOTIMEOUTIFNOTHUNG) &&
!MsqIsHung(Window->MessageQueue)); !MsqIsHung(Window->pti->MessageQueue));
IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
@ -1404,7 +1488,7 @@ co_IntPostOrSendMessage( HWND hWnd,
pti = PsGetCurrentThreadWin32Thread(); pti = PsGetCurrentThreadWin32Thread();
if ( Window->MessageQueue != pti->MessageQueue && if ( Window->pti->MessageQueue != pti->MessageQueue &&
FindMsgMemory(Msg) == 0 ) FindMsgMemory(Msg) == 0 )
{ {
Result = UserPostMessage(hWnd, Msg, wParam, lParam); Result = UserPostMessage(hWnd, Msg, wParam, lParam);
@ -1464,7 +1548,7 @@ co_IntDoSendMessage( HWND hWnd,
// This is checked in user mode!!!!!!! // This is checked in user mode!!!!!!!
if ( HWND_BROADCAST != hWnd && if ( HWND_BROADCAST != hWnd &&
NULL != pti && NULL != pti &&
Window->MessageQueue == pti->MessageQueue && Window->pti->MessageQueue == pti->MessageQueue &&
!ISITHOOKED(WH_CALLWNDPROC) && !ISITHOOKED(WH_CALLWNDPROC) &&
!ISITHOOKED(WH_CALLWNDPROCRET) && !ISITHOOKED(WH_CALLWNDPROCRET) &&
( Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST ) ) ( Msg < WM_DDE_FIRST || Msg > WM_DDE_LAST ) )
@ -1585,7 +1669,7 @@ UserSendNotifyMessage( HWND hWnd,
pti = PsGetCurrentThreadWin32Thread(); pti = PsGetCurrentThreadWin32Thread();
if (Window->MessageQueue != pti->MessageQueue) if (Window->pti->MessageQueue != pti->MessageQueue)
{ // Send message w/o waiting for it. { // Send message w/o waiting for it.
Result = UserPostMessage(hWnd, Msg, wParam, lParam); Result = UserPostMessage(hWnd, Msg, wParam, lParam);
} }
@ -1926,6 +2010,8 @@ NtUserGetMessageX(
RETURN( Ret); RETURN( Ret);
} }
RtlZeroMemory(&Msg, sizeof(MSG));
Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE); Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, PM_REMOVE, TRUE);
if (Ret) if (Ret)
@ -2072,6 +2158,8 @@ NtUserPeekMessageX(
RETURN( Ret); RETURN( Ret);
} }
RtlZeroMemory(&Msg, sizeof(MSG));
Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE); Ret = co_IntGetPeekMessage(&Msg, hWnd, MsgFilterMin, MsgFilterMax, RemoveMsg, FALSE);
if (Ret) if (Ret)

View file

@ -41,7 +41,7 @@
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
/* list of monitors */ /* list of monitors */
static PMONITOR_OBJECT gMonitorList = NULL; static PMONITOR gMonitorList = NULL;
/* INITALIZATION FUNCTIONS ****************************************************/ /* INITALIZATION FUNCTIONS ****************************************************/
@ -76,26 +76,26 @@ CleanupMonitorImpl()
/* IntCreateMonitorObject /* IntCreateMonitorObject
* *
* Creates a MONITOR_OBJECT * Creates a MONITOR
* *
* Return value * Return value
* If the function succeeds a pointer to a MONITOR_OBJECT is returned. On failure * If the function succeeds a pointer to a MONITOR is returned. On failure
* NULL is returned. * NULL is returned.
*/ */
static static
PMONITOR_OBJECT PMONITOR
IntCreateMonitorObject() IntCreateMonitorObject()
{ {
HANDLE Handle; HANDLE Handle;
PMONITOR_OBJECT Monitor; PMONITOR Monitor;
Monitor = UserCreateObject(gHandleTable, &Handle, otMonitor, sizeof (MONITOR_OBJECT)); Monitor = UserCreateObject(gHandleTable, &Handle, otMonitor, sizeof (MONITOR));
if (Monitor == NULL) if (Monitor == NULL)
{ {
return NULL; return NULL;
} }
Monitor->Handle = Handle; Monitor->head.h = Handle;
ExInitializeFastMutex(&Monitor->Lock); ExInitializeFastMutex(&Monitor->Lock);
return Monitor; return Monitor;
@ -103,27 +103,27 @@ IntCreateMonitorObject()
/* IntDestroyMonitorObject /* IntDestroyMonitorObject
* *
* Destroys a MONITOR_OBJECT * Destroys a MONITOR
* You have to be the owner of the monitors lock to safely destroy it. * You have to be the owner of the monitors lock to safely destroy it.
* *
* Arguments * Arguments
* *
* pMonitor * pMonitor
* Pointer to the MONITOR_OBJECT which shall be deleted * Pointer to the MONITOR which shall be deleted
*/ */
static static
void void
IntDestroyMonitorObject(IN PMONITOR_OBJECT pMonitor) IntDestroyMonitorObject(IN PMONITOR pMonitor)
{ {
RtlFreeUnicodeString(&pMonitor->DeviceName); RtlFreeUnicodeString(&pMonitor->DeviceName);
UserDereferenceObject(pMonitor); UserDereferenceObject(pMonitor);
} }
PMONITOR_OBJECT FASTCALL PMONITOR FASTCALL
UserGetMonitorObject(IN HMONITOR hMonitor) UserGetMonitorObject(IN HMONITOR hMonitor)
{ {
PMONITOR_OBJECT Monitor; PMONITOR Monitor;
if (!hMonitor) if (!hMonitor)
{ {
@ -132,7 +132,7 @@ UserGetMonitorObject(IN HMONITOR hMonitor)
} }
Monitor = (PMONITOR_OBJECT)UserGetObject(gHandleTable, hMonitor, otMonitor); Monitor = (PMONITOR)UserGetObject(gHandleTable, hMonitor, otMonitor);
if (!Monitor) if (!Monitor)
{ {
SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE); SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE);
@ -147,7 +147,7 @@ UserGetMonitorObject(IN HMONITOR hMonitor)
/* IntAttachMonitor /* IntAttachMonitor
* *
* Creates a new MONITOR_OBJECT and appends it to the list of monitors. * Creates a new MONITOR and appends it to the list of monitors.
* *
* Arguments * Arguments
* *
@ -161,7 +161,7 @@ NTSTATUS
IntAttachMonitor(IN PDEVOBJ *pGdiDevice, IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
IN ULONG DisplayNumber) IN ULONG DisplayNumber)
{ {
PMONITOR_OBJECT Monitor; PMONITOR Monitor;
WCHAR Buffer[CCHDEVICENAME]; WCHAR Buffer[CCHDEVICENAME];
DPRINT("Attaching monitor...\n"); DPRINT("Attaching monitor...\n");
@ -179,11 +179,18 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
{ {
DPRINT("Couldn't duplicate monitor name!\n"); DPRINT("Couldn't duplicate monitor name!\n");
UserDereferenceObject(Monitor); UserDereferenceObject(Monitor);
UserDeleteObject(Monitor->Handle, otMonitor); UserDeleteObject(Monitor->head.h, otMonitor);
return STATUS_INSUFFICIENT_RESOURCES; return STATUS_INSUFFICIENT_RESOURCES;
} }
Monitor->GdiDevice = pGdiDevice; Monitor->GdiDevice = pGdiDevice;
Monitor->rcMonitor.left = 0;
Monitor->rcMonitor.top = 0;
Monitor->rcMonitor.right = Monitor->rcMonitor.left + pGdiDevice->gdiinfo.ulHorzRes;
Monitor->rcMonitor.bottom = Monitor->rcMonitor.top + pGdiDevice->gdiinfo.ulVertRes;
Monitor->rcWork = Monitor->rcMonitor;
Monitor->cWndStack = 0;
if (gMonitorList == NULL) if (gMonitorList == NULL)
{ {
DPRINT("Primary monitor is beeing attached\n"); DPRINT("Primary monitor is beeing attached\n");
@ -192,7 +199,7 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
} }
else else
{ {
PMONITOR_OBJECT p; PMONITOR p;
DPRINT("Additional monitor is beeing attached\n"); DPRINT("Additional monitor is beeing attached\n");
for (p = gMonitorList; p->Next != NULL; p = p->Next) for (p = gMonitorList; p->Next != NULL; p = p->Next)
{ {
@ -206,7 +213,7 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
/* IntDetachMonitor /* IntDetachMonitor
* *
* Deletes a MONITOR_OBJECT and removes it from the list of monitors. * Deletes a MONITOR and removes it from the list of monitors.
* *
* Arguments * Arguments
* *
@ -218,7 +225,7 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
NTSTATUS NTSTATUS
IntDetachMonitor(IN PDEVOBJ *pGdiDevice) IntDetachMonitor(IN PDEVOBJ *pGdiDevice)
{ {
PMONITOR_OBJECT Monitor; PMONITOR Monitor;
for (Monitor = gMonitorList; Monitor != NULL; Monitor = Monitor->Next) for (Monitor = gMonitorList; Monitor != NULL; Monitor = Monitor->Next)
{ {
@ -234,7 +241,7 @@ IntDetachMonitor(IN PDEVOBJ *pGdiDevice)
if (Monitor->IsPrimary && (Monitor->Next != NULL || Monitor->Prev != NULL)) if (Monitor->IsPrimary && (Monitor->Next != NULL || Monitor->Prev != NULL))
{ {
PMONITOR_OBJECT NewPrimaryMonitor = (Monitor->Prev != NULL) ? (Monitor->Prev) : (Monitor->Next); PMONITOR NewPrimaryMonitor = (Monitor->Prev != NULL) ? (Monitor->Prev) : (Monitor->Next);
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&NewPrimaryMonitor->Lock); ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&NewPrimaryMonitor->Lock);
NewPrimaryMonitor->IsPrimary = TRUE; NewPrimaryMonitor->IsPrimary = TRUE;
@ -261,16 +268,16 @@ IntDetachMonitor(IN PDEVOBJ *pGdiDevice)
/* IntGetPrimaryMonitor /* IntGetPrimaryMonitor
* *
* Returns a PMONITOR_OBJECT for the primary monitor * Returns a PMONITOR for the primary monitor
* *
* Return value * Return value
* PMONITOR_OBJECT * PMONITOR
*/ */
static PMONITOR
PMONITOR_OBJECT FASTCALL
IntGetPrimaryMonitor() IntGetPrimaryMonitor()
{ {
PMONITOR_OBJECT Monitor; PMONITOR Monitor;
for (Monitor = gMonitorList; Monitor != NULL; Monitor = Monitor->Next) for (Monitor = gMonitorList; Monitor != NULL; Monitor = Monitor->Next)
{ {
@ -321,7 +328,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
OPTIONAL IN DWORD listSize, OPTIONAL IN DWORD listSize,
OPTIONAL IN DWORD flags) OPTIONAL IN DWORD flags)
{ {
PMONITOR_OBJECT Monitor, NearestMonitor = NULL, PrimaryMonitor = NULL; PMONITOR Monitor, NearestMonitor = NULL, PrimaryMonitor = NULL;
UINT iCount = 0; UINT iCount = 0;
LONG iNearestDistanceX = 0x7fffffff, iNearestDistanceY = 0x7fffffff; LONG iNearestDistanceX = 0x7fffffff, iNearestDistanceY = 0x7fffffff;
@ -391,7 +398,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
if (iCount < listSize) if (iCount < listSize)
{ {
if (hMonitorList != NULL) if (hMonitorList != NULL)
hMonitorList[iCount] = Monitor->Handle; hMonitorList[iCount] = Monitor->head.h;
if (monitorRectList != NULL) if (monitorRectList != NULL)
monitorRectList[iCount] = IntersectionRect; monitorRectList[iCount] = IntersectionRect;
} }
@ -403,7 +410,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
if (iCount < listSize) if (iCount < listSize)
{ {
if (hMonitorList != NULL) if (hMonitorList != NULL)
hMonitorList[iCount] = NearestMonitor->Handle; hMonitorList[iCount] = NearestMonitor->head.h;
} }
iCount++; iCount++;
} }
@ -412,7 +419,7 @@ IntGetMonitorsFromRect(OPTIONAL IN LPCRECTL pRect,
if (iCount < listSize) if (iCount < listSize)
{ {
if (hMonitorList != NULL) if (hMonitorList != NULL)
hMonitorList[iCount] = PrimaryMonitor->Handle; hMonitorList[iCount] = PrimaryMonitor->head.h;
} }
iCount++; iCount++;
} }
@ -628,7 +635,7 @@ NtUserGetMonitorInfo(
IN HMONITOR hMonitor, IN HMONITOR hMonitor,
OUT LPMONITORINFO pMonitorInfo) OUT LPMONITORINFO pMonitorInfo)
{ {
PMONITOR_OBJECT Monitor; PMONITOR Monitor;
MONITORINFOEXW MonitorInfo; MONITORINFOEXW MonitorInfo;
NTSTATUS Status; NTSTATUS Status;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
@ -746,9 +753,9 @@ NtUserMonitorFromPoint(
{ {
if (dwFlags == MONITOR_DEFAULTTOPRIMARY) if (dwFlags == MONITOR_DEFAULTTOPRIMARY)
{ {
PMONITOR_OBJECT MonitorObj = IntGetPrimaryMonitor(); PMONITOR MonitorObj = IntGetPrimaryMonitor();
if (MonitorObj) if (MonitorObj)
hMonitor = MonitorObj->Handle; hMonitor = MonitorObj->head.h;
} }
else if (dwFlags == MONITOR_DEFAULTTONEAREST) else if (dwFlags == MONITOR_DEFAULTTONEAREST)
{ {
@ -811,9 +818,9 @@ NtUserMonitorFromRect(
{ {
if (dwFlags == MONITOR_DEFAULTTOPRIMARY) if (dwFlags == MONITOR_DEFAULTTOPRIMARY)
{ {
PMONITOR_OBJECT monitorObj = IntGetPrimaryMonitor(); PMONITOR monitorObj = IntGetPrimaryMonitor();
if (monitorObj) if (monitorObj)
return monitorObj->Handle; return monitorObj->head.h;
} }
else if (dwFlags == MONITOR_DEFAULTTONEAREST) else if (dwFlags == MONITOR_DEFAULTTONEAREST)
{ {

View file

@ -395,7 +395,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
return(FALSE); return(FALSE);
} }
if (CaptureWindow->MessageQueue != MessageQueue) if (CaptureWindow->pti->MessageQueue != MessageQueue)
{ {
if (! FromGlobalQueue) if (! FromGlobalQueue)
{ {
@ -418,34 +418,34 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
/* lock the destination message queue, so we don't get in trouble with other /* lock the destination message queue, so we don't get in trouble with other
threads, messing with it at the same time */ threads, messing with it at the same time */
IntLockHardwareMessageQueue(CaptureWindow->MessageQueue); IntLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
InsertTailList(&CaptureWindow->MessageQueue->HardwareMessagesListHead, InsertTailList(&CaptureWindow->pti->MessageQueue->HardwareMessagesListHead,
&Message->ListEntry); &Message->ListEntry);
if(Message->Msg.message == WM_MOUSEMOVE) if(Message->Msg.message == WM_MOUSEMOVE)
{ {
if(CaptureWindow->MessageQueue->MouseMoveMsg) if(CaptureWindow->pti->MessageQueue->MouseMoveMsg)
{ {
/* remove the old WM_MOUSEMOVE message, we're processing a more recent /* remove the old WM_MOUSEMOVE message, we're processing a more recent
one */ one */
RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry); RemoveEntryList(&CaptureWindow->pti->MessageQueue->MouseMoveMsg->ListEntry);
ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg); ExFreePool(CaptureWindow->pti->MessageQueue->MouseMoveMsg);
} }
/* save the pointer to the WM_MOUSEMOVE message in the new queue */ /* save the pointer to the WM_MOUSEMOVE message in the new queue */
CaptureWindow->MessageQueue->MouseMoveMsg = Message; CaptureWindow->pti->MessageQueue->MouseMoveMsg = Message;
CaptureWindow->MessageQueue->QueueBits |= QS_MOUSEMOVE; CaptureWindow->pti->MessageQueue->QueueBits |= QS_MOUSEMOVE;
CaptureWindow->MessageQueue->ChangedBits |= QS_MOUSEMOVE; CaptureWindow->pti->MessageQueue->ChangedBits |= QS_MOUSEMOVE;
if (CaptureWindow->MessageQueue->WakeMask & QS_MOUSEMOVE) if (CaptureWindow->pti->MessageQueue->WakeMask & QS_MOUSEMOVE)
KeSetEvent(CaptureWindow->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(CaptureWindow->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
} }
else else
{ {
CaptureWindow->MessageQueue->QueueBits |= QS_MOUSEBUTTON; CaptureWindow->pti->MessageQueue->QueueBits |= QS_MOUSEBUTTON;
CaptureWindow->MessageQueue->ChangedBits |= QS_MOUSEBUTTON; CaptureWindow->pti->MessageQueue->ChangedBits |= QS_MOUSEBUTTON;
if (CaptureWindow->MessageQueue->WakeMask & QS_MOUSEBUTTON) if (CaptureWindow->pti->MessageQueue->WakeMask & QS_MOUSEBUTTON)
KeSetEvent(CaptureWindow->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); KeSetEvent(CaptureWindow->pti->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE);
} }
IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue); IntUnLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
*Freed = FALSE; *Freed = FALSE;
UserDereferenceObject(CaptureWindow); UserDereferenceObject(CaptureWindow);
@ -466,21 +466,21 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
/* Lock the message queue so no other thread can mess with it. /* Lock the message queue so no other thread can mess with it.
Our own message queue is not locked while fetching from the global Our own message queue is not locked while fetching from the global
queue, so we have to make sure nothing interferes! */ queue, so we have to make sure nothing interferes! */
IntLockHardwareMessageQueue(CaptureWindow->MessageQueue); IntLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
/* if we're from the global queue, we need to add our message to our /* if we're from the global queue, we need to add our message to our
private queue so we don't loose it! */ private queue so we don't loose it! */
InsertTailList(&CaptureWindow->MessageQueue->HardwareMessagesListHead, InsertTailList(&CaptureWindow->pti->MessageQueue->HardwareMessagesListHead,
&Message->ListEntry); &Message->ListEntry);
} }
if (Message->Msg.message == WM_MOUSEMOVE) if (Message->Msg.message == WM_MOUSEMOVE)
{ {
if(CaptureWindow->MessageQueue->MouseMoveMsg && if(CaptureWindow->pti->MessageQueue->MouseMoveMsg &&
(CaptureWindow->MessageQueue->MouseMoveMsg != Message)) (CaptureWindow->pti->MessageQueue->MouseMoveMsg != Message))
{ {
/* delete the old message */ /* delete the old message */
RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry); RemoveEntryList(&CaptureWindow->pti->MessageQueue->MouseMoveMsg->ListEntry);
ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg); ExFreePool(CaptureWindow->pti->MessageQueue->MouseMoveMsg);
if (!FromGlobalQueue) if (!FromGlobalQueue)
{ {
// We might have deleted the next one in our queue, so fix next // We might have deleted the next one in our queue, so fix next
@ -489,11 +489,11 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
} }
/* always save a pointer to this WM_MOUSEMOVE message here because we're /* always save a pointer to this WM_MOUSEMOVE message here because we're
sure that the message is in the private queue */ sure that the message is in the private queue */
CaptureWindow->MessageQueue->MouseMoveMsg = Message; CaptureWindow->pti->MessageQueue->MouseMoveMsg = Message;
} }
if(FromGlobalQueue) if(FromGlobalQueue)
{ {
IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue); IntUnLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
} }
UserDereferenceObject(CaptureWindow); UserDereferenceObject(CaptureWindow);
@ -516,22 +516,22 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
/* Lock the message queue so no other thread can mess with it. /* Lock the message queue so no other thread can mess with it.
Our own message queue is not locked while fetching from the global Our own message queue is not locked while fetching from the global
queue, so we have to make sure nothing interferes! */ queue, so we have to make sure nothing interferes! */
IntLockHardwareMessageQueue(CaptureWindow->MessageQueue); IntLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
if(CaptureWindow->MessageQueue->MouseMoveMsg) if(CaptureWindow->pti->MessageQueue->MouseMoveMsg)
{ {
/* delete the WM_(NC)MOUSEMOVE message in the private queue, we're dealing /* delete the WM_(NC)MOUSEMOVE message in the private queue, we're dealing
with one that's been sent later */ with one that's been sent later */
RemoveEntryList(&CaptureWindow->MessageQueue->MouseMoveMsg->ListEntry); RemoveEntryList(&CaptureWindow->pti->MessageQueue->MouseMoveMsg->ListEntry);
ExFreePool(CaptureWindow->MessageQueue->MouseMoveMsg); ExFreePool(CaptureWindow->pti->MessageQueue->MouseMoveMsg);
/* our message is not in the private queue so we can remove the pointer /* our message is not in the private queue so we can remove the pointer
instead of setting it to the current message we're processing */ instead of setting it to the current message we're processing */
CaptureWindow->MessageQueue->MouseMoveMsg = NULL; CaptureWindow->pti->MessageQueue->MouseMoveMsg = NULL;
} }
IntUnLockHardwareMessageQueue(CaptureWindow->MessageQueue); IntUnLockHardwareMessageQueue(CaptureWindow->pti->MessageQueue);
} }
else if (CaptureWindow->MessageQueue->MouseMoveMsg == Message) else if (CaptureWindow->pti->MessageQueue->MouseMoveMsg == Message)
{ {
CaptureWindow->MessageQueue->MouseMoveMsg = NULL; CaptureWindow->pti->MessageQueue->MouseMoveMsg = NULL;
} }
} }
@ -884,7 +884,7 @@ MsqPostHotKeyMessage(PVOID Thread, HWND hWnd, WPARAM wParam, LPARAM lParam)
KeQueryTickCount(&LargeTickCount); KeQueryTickCount(&LargeTickCount);
Mesg.time = MsqCalculateMessageTime(&LargeTickCount); Mesg.time = MsqCalculateMessageTime(&LargeTickCount);
Mesg.pt = gpsi->ptCursor; Mesg.pt = gpsi->ptCursor;
MsqPostMessage(Window->MessageQueue, &Mesg, FALSE, QS_HOTKEY); MsqPostMessage(Window->pti->MessageQueue, &Mesg, FALSE, QS_HOTKEY);
UserDereferenceObject(Window); UserDereferenceObject(Window);
ObDereferenceObject (Thread); ObDereferenceObject (Thread);
@ -1057,7 +1057,7 @@ MsqRemoveWindowMessagesFromQueue(PVOID pWindow)
ASSERT(Window); ASSERT(Window);
MessageQueue = Window->MessageQueue; MessageQueue = Window->pti->MessageQueue;
ASSERT(MessageQueue); ASSERT(MessageQueue);
/* remove the posted messages for this window */ /* remove the posted messages for this window */
@ -1363,9 +1363,12 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
if (Hardware) if (Hardware)
{ {
return(co_MsqPeekHardwareMessage(MessageQueue, Window, return(co_MsqPeekHardwareMessage( MessageQueue,
MsgFilterLow, MsgFilterHigh, Window,
Remove, Message)); MsgFilterLow,
MsgFilterHigh,
Remove,
Message));
} }
CurrentEntry = MessageQueue->PostedMessagesListHead.Flink; CurrentEntry = MessageQueue->PostedMessagesListHead.Flink;
@ -1374,10 +1377,12 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
{ {
CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE, CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE,
ListEntry); ListEntry);
if ((!Window || PtrToInt(Window) == 1 || Window->hSelf == CurrentMessage->Msg.hwnd) && if ( ( !Window ||
((MsgFilterLow == 0 && MsgFilterHigh == 0) || PtrToInt(Window) == 1 ||
(MsgFilterLow <= CurrentMessage->Msg.message && Window->hSelf == CurrentMessage->Msg.hwnd ) &&
MsgFilterHigh >= CurrentMessage->Msg.message))) ( (MsgFilterLow == 0 && MsgFilterHigh == 0) ||
( MsgFilterLow <= CurrentMessage->Msg.message &&
MsgFilterHigh >= CurrentMessage->Msg.message ) ) )
{ {
if (Remove) if (Remove)
{ {

View file

@ -196,7 +196,7 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate)
GreDeleteObject(Window->hrgnUpdate); GreDeleteObject(Window->hrgnUpdate);
Window->hrgnUpdate = NULL; Window->hrgnUpdate = NULL;
if (!(Window->state & WINDOWOBJECT_NEED_INTERNALPAINT)) if (!(Window->state & WINDOWOBJECT_NEED_INTERNALPAINT))
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->pti->MessageQueue);
} }
} }
@ -248,7 +248,7 @@ co_IntPaintWindows(PWINDOW_OBJECT Window, ULONG Flags, BOOL Recurse)
{ {
TempRegion = IntGetNCUpdateRgn(Window, TRUE); TempRegion = IntGetNCUpdateRgn(Window, TRUE);
Window->state &= ~WINDOWOBJECT_NEED_NCPAINT; Window->state &= ~WINDOWOBJECT_NEED_NCPAINT;
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->pti->MessageQueue);
co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0); co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)TempRegion, 0);
if ((HANDLE) 1 != TempRegion && NULL != TempRegion) if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
{ {
@ -465,17 +465,17 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
if (HasPaintMessage != HadPaintMessage) if (HasPaintMessage != HadPaintMessage)
{ {
if (HadPaintMessage) if (HadPaintMessage)
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->pti->MessageQueue);
else else
MsqIncPaintCountQueue(Window->MessageQueue); MsqIncPaintCountQueue(Window->pti->MessageQueue);
} }
if (HasNCPaintMessage != HadNCPaintMessage) if (HasNCPaintMessage != HadNCPaintMessage)
{ {
if (HadNCPaintMessage) if (HadNCPaintMessage)
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->pti->MessageQueue);
else else
MsqIncPaintCountQueue(Window->MessageQueue); MsqIncPaintCountQueue(Window->pti->MessageQueue);
} }
} }
@ -776,7 +776,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
hRgn = IntGetNCUpdateRgn(Window, FALSE); hRgn = IntGetNCUpdateRgn(Window, FALSE);
Window->state &= ~WINDOWOBJECT_NEED_NCPAINT; Window->state &= ~WINDOWOBJECT_NEED_NCPAINT;
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->pti->MessageQueue);
co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)hRgn, 0); co_IntSendMessage(hWnd, WM_NCPAINT, (WPARAM)hRgn, 0);
if (hRgn != (HANDLE)1 && hRgn != NULL) if (hRgn != (HANDLE)1 && hRgn != NULL)
{ {
@ -795,7 +795,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
if (Window->hrgnUpdate != NULL) if (Window->hrgnUpdate != NULL)
{ {
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->pti->MessageQueue);
GdiGetClipBox(Ps.hdc, &Ps.rcPaint); GdiGetClipBox(Ps.hdc, &Ps.rcPaint);
GDIOBJ_SetOwnership(Window->hrgnUpdate, PsGetCurrentProcess()); GDIOBJ_SetOwnership(Window->hrgnUpdate, PsGetCurrentProcess());
/* The region is part of the dc now and belongs to the process! */ /* The region is part of the dc now and belongs to the process! */
@ -804,7 +804,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
else else
{ {
if (Window->state & WINDOWOBJECT_NEED_INTERNALPAINT) if (Window->state & WINDOWOBJECT_NEED_INTERNALPAINT)
MsqDecPaintCountQueue(Window->MessageQueue); MsqDecPaintCountQueue(Window->pti->MessageQueue);
IntGetClientRect(Window, &Ps.rcPaint); IntGetClientRect(Window, &Ps.rcPaint);
} }

View file

@ -230,6 +230,53 @@ co_IntGetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPSCROLLINFO lpsi)
return TRUE; return TRUE;
} }
BOOL FASTCALL
NEWco_IntGetScrollInfo(
PWND pWnd,
INT nBar,
PSBDATA pSBData,
LPSCROLLINFO lpsi)
{
UINT Mask;
PSBTRACK pSBTrack = pWnd->head.pti->pSBTrack;
if (!SBID_IS_VALID(nBar))
{
SetLastWin32Error(ERROR_INVALID_PARAMETER);
DPRINT1("Trying to get scrollinfo for unknown scrollbar type %d\n", nBar);
return FALSE;
}
Mask = lpsi->fMask;
if (0 != (Mask & SIF_PAGE))
{
lpsi->nPage = pSBData->page;
}
if (0 != (Mask & SIF_POS))
{
lpsi->nPos = pSBData->pos;
}
if (0 != (Mask & SIF_RANGE))
{
lpsi->nMin = pSBData->posMin;
lpsi->nMax = pSBData->posMax;
}
if (0 != (Mask & SIF_TRACKPOS))
{
if ( pSBTrack &&
pSBTrack->nBar == nBar &&
pSBTrack->spwndTrack == pWnd )
lpsi->nTrackPos = pSBTrack->posNew;
else
lpsi->nTrackPos = pSBData->pos;
}
return (Mask & SIF_ALL) !=0;
}
static DWORD FASTCALL static DWORD FASTCALL
co_IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) co_IntSetScrollInfo(PWINDOW_OBJECT Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw)
{ {

View file

@ -427,7 +427,7 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
} }
Ret = IDEvent; Ret = IDEvent;
MessageQueue = Window->MessageQueue; MessageQueue = Window->pti->MessageQueue;
} }
#if 0 #if 0
@ -489,7 +489,7 @@ IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER)) IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
{ {
// Give it another chance to find the timer. // Give it another chance to find the timer.
if (Window && !( MsqKillTimer(Window->MessageQueue, Wnd, if (Window && !( MsqKillTimer(Window->pti->MessageQueue, Wnd,
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))) IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER)))
{ {
DPRINT1("Unable to locate timer in message queue for Window.\n"); DPRINT1("Unable to locate timer in message queue for Window.\n");

View file

@ -1608,28 +1608,31 @@ NtUserChildWindowFromPointEx(HWND hwndParent,
* calculates the default position of a window * calculates the default position of a window
*/ */
BOOL FASTCALL BOOL FASTCALL
IntCalcDefPosSize(PWINDOW_OBJECT Parent, PWINDOW_OBJECT Window, RECTL *rc, BOOL IncPos) IntCalcDefPosSize(PWINDOW_OBJECT Parent, RECTL *rc, BOOL IncPos)
{ {
SIZE Sz; SIZE Sz;
PMONITOR pMonitor;
POINT Pos = {0, 0}; POINT Pos = {0, 0};
pMonitor = IntGetPrimaryMonitor();
if(Parent != NULL) if(Parent != NULL)
{ {
RECTL_bIntersectRect(rc, rc, &Parent->Wnd->rcClient); RECTL_bIntersectRect(rc, rc, &pMonitor->rcMonitor);
if(IncPos) if(IncPos)
{ {
Pos.x = Parent->TiledCounter * (UserGetSystemMetrics(SM_CXSIZE) + UserGetSystemMetrics(SM_CXFRAME)); Pos.x = pMonitor->cWndStack * (UserGetSystemMetrics(SM_CXSIZE) + UserGetSystemMetrics(SM_CXFRAME));
Pos.y = Parent->TiledCounter * (UserGetSystemMetrics(SM_CYSIZE) + UserGetSystemMetrics(SM_CYFRAME)); Pos.y = pMonitor->cWndStack * (UserGetSystemMetrics(SM_CYSIZE) + UserGetSystemMetrics(SM_CYFRAME));
if(Pos.x > ((rc->right - rc->left) / 4) || if (Pos.x > ((rc->right - rc->left) / 4) ||
Pos.y > ((rc->bottom - rc->top) / 4)) Pos.y > ((rc->bottom - rc->top) / 4))
{ {
/* reset counter and position */ /* reset counter and position */
Pos.x = 0; Pos.x = 0;
Pos.y = 0; Pos.y = 0;
Parent->TiledCounter = 0; pMonitor->cWndStack = 0;
} }
Parent->TiledCounter++; pMonitor->cWndStack++;
} }
Pos.x += rc->left; Pos.x += rc->left;
Pos.y += rc->top; Pos.y += rc->top;
@ -1857,8 +1860,7 @@ AllocErr:
Wnd->hModule = hInstance; Wnd->hModule = hInstance;
Window->hSelf = hWnd; Window->hSelf = hWnd;
Window->MessageQueue = pti->MessageQueue; IntReferenceMessageQueue(Window->pti->MessageQueue);
IntReferenceMessageQueue(Window->MessageQueue);
Window->spwndParent = ParentWindow; Window->spwndParent = ParentWindow;
Wnd->spwndParent = ParentWindow ? ParentWindow->Wnd : NULL; Wnd->spwndParent = ParentWindow ? ParentWindow->Wnd : NULL;
if (Wnd->spwndParent != NULL && hWndParent != 0) if (Wnd->spwndParent != NULL && hWndParent != 0)
@ -2112,7 +2114,7 @@ AllocErr:
if(x == CW_USEDEFAULT || x == CW_USEDEFAULT16) if(x == CW_USEDEFAULT || x == CW_USEDEFAULT16)
{ {
CalculatedDefPosSize = IntCalcDefPosSize(ParentWindow, Window, &rc, TRUE); CalculatedDefPosSize = IntCalcDefPosSize(ParentWindow, &rc, TRUE);
if(ProcessParams->WindowFlags & STARTF_USEPOSITION) if(ProcessParams->WindowFlags & STARTF_USEPOSITION)
{ {
@ -2156,7 +2158,7 @@ AllocErr:
{ {
if(!CalculatedDefPosSize) if(!CalculatedDefPosSize)
{ {
IntCalcDefPosSize(ParentWindow, Window, &rc, FALSE); IntCalcDefPosSize(ParentWindow, &rc, FALSE);
} }
if(ProcessParams->WindowFlags & STARTF_USESIZE) if(ProcessParams->WindowFlags & STARTF_USESIZE)
{ {
@ -2646,14 +2648,14 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
} }
} }
if (Window->MessageQueue->ActiveWindow == Window->hSelf) if (Window->pti->MessageQueue->ActiveWindow == Window->hSelf)
Window->MessageQueue->ActiveWindow = NULL; Window->pti->MessageQueue->ActiveWindow = NULL;
if (Window->MessageQueue->FocusWindow == Window->hSelf) if (Window->pti->MessageQueue->FocusWindow == Window->hSelf)
Window->MessageQueue->FocusWindow = NULL; Window->pti->MessageQueue->FocusWindow = NULL;
if (Window->MessageQueue->CaptureWindow == Window->hSelf) if (Window->pti->MessageQueue->CaptureWindow == Window->hSelf)
Window->MessageQueue->CaptureWindow = NULL; Window->pti->MessageQueue->CaptureWindow = NULL;
IntDereferenceMessageQueue(Window->MessageQueue); IntDereferenceMessageQueue(Window->pti->MessageQueue);
IntEngWindowChanged(Window, WOC_DELETE); IntEngWindowChanged(Window, WOC_DELETE);
isChild = (0 != (Wnd->style & WS_CHILD)); isChild = (0 != (Wnd->style & WS_CHILD));
@ -4197,7 +4199,7 @@ NtUserQueryWindow(HWND hWnd, DWORD Index)
break; break;
case QUERY_WINDOW_ISHUNG: case QUERY_WINDOW_ISHUNG:
Result = (DWORD)MsqIsHung(Window->MessageQueue); Result = (DWORD)MsqIsHung(Window->pti->MessageQueue);
break; break;
case QUERY_WINDOW_REAL_ID: case QUERY_WINDOW_REAL_ID:
@ -5111,7 +5113,7 @@ NtUserValidateHandleSecure(
} }
case otMonitor: case otMonitor:
{ {
PMONITOR_OBJECT Monitor; PMONITOR Monitor;
if ((Monitor = UserGetMonitorObject((HMONITOR) handle))) return TRUE; if ((Monitor = UserGetMonitorObject((HMONITOR) handle))) return TRUE;
return FALSE; return FALSE;
} }

View file

@ -1612,7 +1612,7 @@ co_WinPosSearchChildren(
UserRefObjectCo(Current, &Ref); UserRefObjectCo(Current, &Ref);
if (OnlyHitTests && (Current->MessageQueue == OnlyHitTests)) if (OnlyHitTests && (Current->pti->MessageQueue == OnlyHitTests))
{ {
*HitTest = co_IntSendMessage(Current->hSelf, WM_NCHITTEST, 0, *HitTest = co_IntSendMessage(Current->hSelf, WM_NCHITTEST, 0,
MAKELONG(Point->x, Point->y)); MAKELONG(Point->x, Point->y));