[NTUSER] Add locking at IntSendFocusMessage (#4468)

Fix access violation on IntFocusSetInputContext.
- Add locking on pWndPrev.
CORE-18163
This commit is contained in:
Katayama Hirofumi MZ 2022-04-25 11:36:00 +09:00 committed by GitHub
parent 74efe979a8
commit 0b0e73d66e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -617,6 +617,7 @@ IntSendFocusMessages( PTHREADINFO pti, PWND pWnd)
PWND pWndPrev;
PUSER_MESSAGE_QUEUE ThreadQueue = pti->MessageQueue; // Queue can change...
HWND hwndPrev;
USER_REFERENCE_ENTRY Ref;
ThreadQueue->QF_flags &= ~QF_FOCUSNULLSINCEACTIVE;
if (!pWnd && ThreadQueue->spwndActive)
@ -625,6 +626,8 @@ IntSendFocusMessages( PTHREADINFO pti, PWND pWnd)
}
pWndPrev = ThreadQueue->spwndFocus;
if (pWndPrev)
UserRefObjectCo(pWndPrev, &Ref);
/* check if the specified window can be set in the input data of a given queue */
if (!pWnd || ThreadQueue == pWnd->head.pti->MessageQueue)
@ -667,6 +670,9 @@ IntSendFocusMessages( PTHREADINFO pti, PWND pWnd)
}
}
}
if (pWndPrev)
UserDerefObjectCo(pWndPrev);
}
BOOL FASTCALL