mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
[Win32k]
- Fix crash when sending activate application message and check if thread is in cleanup. Use kernel functions for thread data types. svn path=/trunk/; revision=56538
This commit is contained in:
parent
0ea604d8d6
commit
98fe9f7db3
3 changed files with 27 additions and 12 deletions
|
@ -84,6 +84,7 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
|
||||||
USER_REFERENCE_ENTRY Ref, RefPrev;
|
USER_REFERENCE_ENTRY Ref, RefPrev;
|
||||||
PWND Window, WindowPrev = NULL;
|
PWND Window, WindowPrev = NULL;
|
||||||
HANDLE OldTID, NewTID;
|
HANDLE OldTID, NewTID;
|
||||||
|
PTHREADINFO ptiOld, ptiNew;
|
||||||
|
|
||||||
if ((Window = UserGetWindowObject(hWnd)))
|
if ((Window = UserGetWindowObject(hWnd)))
|
||||||
{
|
{
|
||||||
|
@ -127,6 +128,8 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
|
||||||
|
|
||||||
OldTID = WindowPrev ? IntGetWndThreadId(WindowPrev) : NULL;
|
OldTID = WindowPrev ? IntGetWndThreadId(WindowPrev) : NULL;
|
||||||
NewTID = Window ? IntGetWndThreadId(Window) : NULL;
|
NewTID = Window ? IntGetWndThreadId(Window) : NULL;
|
||||||
|
ptiOld = WindowPrev ? WindowPrev->head.pti : NULL;
|
||||||
|
ptiNew = Window ? Window->head.pti : NULL;
|
||||||
|
|
||||||
TRACE("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID);
|
TRACE("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID);
|
||||||
|
|
||||||
|
@ -136,27 +139,26 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
|
||||||
HWND *List, *phWnd;
|
HWND *List, *phWnd;
|
||||||
|
|
||||||
List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow()));
|
List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow()));
|
||||||
if (List)
|
if ( List )
|
||||||
{
|
{
|
||||||
if (OldTID)
|
if ( OldTid )
|
||||||
{
|
{
|
||||||
for (phWnd = List; *phWnd; ++phWnd)
|
for (phWnd = List; *phWnd; ++phWnd)
|
||||||
{
|
{
|
||||||
cWindow = UserGetWindowObject(*phWnd);
|
cWindow = UserGetWindowObject(*phWnd);
|
||||||
|
if (cWindow && cWindow->head.pti == ptiOld)
|
||||||
if (cWindow && (IntGetWndThreadId(cWindow) == OldTID))
|
|
||||||
{ // FALSE if the window is being deactivated,
|
{ // FALSE if the window is being deactivated,
|
||||||
// ThreadId that owns the window being activated.
|
// ThreadId that owns the window being activated.
|
||||||
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
|
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NewTID)
|
if ( NewTID )
|
||||||
{
|
{
|
||||||
for (phWnd = List; *phWnd; ++phWnd)
|
for (phWnd = List; *phWnd; ++phWnd)
|
||||||
{
|
{
|
||||||
cWindow = UserGetWindowObject(*phWnd);
|
cWindow = UserGetWindowObject(*phWnd);
|
||||||
if (cWindow && (IntGetWndThreadId(cWindow) == NewTID))
|
if (cWindow && cWindow->head.pti == ptiNew)
|
||||||
{ // TRUE if the window is being activated,
|
{ // TRUE if the window is being activated,
|
||||||
// ThreadId that owns the window being deactivated.
|
// ThreadId that owns the window being deactivated.
|
||||||
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
|
co_IntSendMessageNoWait(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
|
||||||
|
@ -306,9 +308,14 @@ co_IntSetForegroundAndFocusWindow(PWND Wnd, BOOL MouseActivate)
|
||||||
IntSetFocusMessageQueue(Wnd->head.pti->MessageQueue);
|
IntSetFocusMessageQueue(Wnd->head.pti->MessageQueue);
|
||||||
gptiForeground = Wnd->head.pti;
|
gptiForeground = Wnd->head.pti;
|
||||||
fgRet = TRUE;
|
fgRet = TRUE;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
//// Fix FG Bounce with regedit but breaks test_SFW todos
|
Fix FG Bounce with regedit but breaks test_SFW todos:
|
||||||
|
Henri Verbeet,
|
||||||
|
What happens is that we get the WM_WINE_SETACTIVEWINDOW message sent by the
|
||||||
|
other thread after we already changed the foreground window back to our own
|
||||||
|
window.
|
||||||
|
*/
|
||||||
if (hWndPrev != hWnd )
|
if (hWndPrev != hWnd )
|
||||||
{
|
{
|
||||||
if (PrevForegroundQueue &&
|
if (PrevForegroundQueue &&
|
||||||
|
@ -316,6 +323,13 @@ co_IntSetForegroundAndFocusWindow(PWND Wnd, BOOL MouseActivate)
|
||||||
Wnd->head.pti->MessageQueue != PrevForegroundQueue &&
|
Wnd->head.pti->MessageQueue != PrevForegroundQueue &&
|
||||||
PrevForegroundQueue->spwndActive)
|
PrevForegroundQueue->spwndActive)
|
||||||
{
|
{
|
||||||
|
//ERR("SFGW: Send NULL to 0x%x\n",hWndPrev);
|
||||||
|
if (pti->MessageQueue == PrevForegroundQueue)
|
||||||
|
{
|
||||||
|
//ERR("SFGW: TI same as Prev TI\n");
|
||||||
|
co_IntSetActiveWindow(NULL, NULL, FALSE, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
co_IntSendMessageNoWait(hWndPrev, WM_ASYNC_SETACTIVEWINDOW, 0, 0 );
|
co_IntSendMessageNoWait(hWndPrev, WM_ASYNC_SETACTIVEWINDOW, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1498,7 +1498,8 @@ co_IntSendMessageWithCallBack( HWND hWnd,
|
||||||
|
|
||||||
Win32Thread = PsGetCurrentThreadWin32Thread();
|
Win32Thread = PsGetCurrentThreadWin32Thread();
|
||||||
|
|
||||||
if (Win32Thread == NULL)
|
if (Win32Thread == NULL ||
|
||||||
|
Win32Thread->TIF_flags & TIF_INCLEANUP)
|
||||||
{
|
{
|
||||||
RETURN(FALSE);
|
RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,10 +29,10 @@ extern ATOM AtomFlashWndState;
|
||||||
((WndObj->head.pti) && (WndObj->head.pti == W32Thread))
|
((WndObj->head.pti) && (WndObj->head.pti == W32Thread))
|
||||||
|
|
||||||
#define IntGetWndThreadId(WndObj) \
|
#define IntGetWndThreadId(WndObj) \
|
||||||
WndObj->head.pti->pEThread->Cid.UniqueThread
|
PsGetThreadId(WndObj->head.pti->pEThread)
|
||||||
|
|
||||||
#define IntGetWndProcessId(WndObj) \
|
#define IntGetWndProcessId(WndObj) \
|
||||||
WndObj->head.pti->pEThread->ThreadsProcess->UniqueProcessId
|
PsGetProcessId(WndObj->head.pti->ppi->peProcess)
|
||||||
|
|
||||||
|
|
||||||
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam);
|
BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam);
|
||||||
|
|
Loading…
Reference in a new issue