[WIN32K:NTUSER] Add diagnostic asserts in IntLinkWindow() and IntUnlinkWindow(). Don't link a window to itself in IntLinkWindow()! Add diagnostic traces for this situation, as well as in IntLinkHwnd().

Helps in correctly fixing CORE-12071 and CORE-12085.
This commit is contained in:
Hermès Bélusca-Maïto 2018-07-08 02:24:13 +02:00
parent 4d057cf626
commit ee0511b49d
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -861,19 +861,28 @@ IntLinkWindow(
PWND WndInsertAfter /* Set to NULL if top sibling */ PWND WndInsertAfter /* Set to NULL if top sibling */
) )
{ {
if (Wnd == WndInsertAfter)
{
ERR("IntLinkWindow -- Trying to link window 0x%p to itself!!\n", Wnd);
return;
}
Wnd->spwndPrev = WndInsertAfter; Wnd->spwndPrev = WndInsertAfter;
if (Wnd->spwndPrev) if (Wnd->spwndPrev)
{ {
/* Link after WndInsertAfter */ /* Link after WndInsertAfter */
ASSERT(Wnd != WndInsertAfter->spwndNext);
Wnd->spwndNext = WndInsertAfter->spwndNext; Wnd->spwndNext = WndInsertAfter->spwndNext;
if (Wnd->spwndNext) if (Wnd->spwndNext)
Wnd->spwndNext->spwndPrev = Wnd; Wnd->spwndNext->spwndPrev = Wnd;
ASSERT(Wnd != Wnd->spwndPrev);
Wnd->spwndPrev->spwndNext = Wnd; Wnd->spwndPrev->spwndNext = Wnd;
} }
else else
{ {
/* Link at the top */ /* Link at the top */
ASSERT(Wnd != Wnd->spwndParent->spwndChild);
Wnd->spwndNext = Wnd->spwndParent->spwndChild; Wnd->spwndNext = Wnd->spwndParent->spwndChild;
if (Wnd->spwndNext) if (Wnd->spwndNext)
Wnd->spwndNext->spwndPrev = Wnd; Wnd->spwndNext->spwndPrev = Wnd;
@ -956,6 +965,8 @@ VOID FASTCALL IntLinkHwnd(PWND Wnd, HWND hWndPrev)
return; return;
} }
if (Wnd == WndInsertAfter)
ERR("IntLinkHwnd -- Trying to link window 0x%p to itself!!\n", Wnd);
IntLinkWindow(Wnd, WndInsertAfter); IntLinkWindow(Wnd, WndInsertAfter);
/* Fix the WS_EX_TOPMOST flag */ /* Fix the WS_EX_TOPMOST flag */
@ -1254,6 +1265,9 @@ co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
VOID FASTCALL VOID FASTCALL
IntUnlinkWindow(PWND Wnd) IntUnlinkWindow(PWND Wnd)
{ {
ASSERT(Wnd != Wnd->spwndNext);
ASSERT(Wnd != Wnd->spwndPrev);
if (Wnd->spwndNext) if (Wnd->spwndNext)
Wnd->spwndNext->spwndPrev = Wnd->spwndPrev; Wnd->spwndNext->spwndPrev = Wnd->spwndPrev;