[NTUSER] Cleanup the window lists (#4346)

Cleanup the window lists that are no longer needed at the thread / process termination.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-02-08 12:21:05 +09:00 committed by GitHub
parent ce306b83db
commit 61d4b5fd6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -180,6 +180,12 @@ UserProcessDestroy(PEPROCESS Process)
if (ppiScrnSaver == ppiCurrent)
ppiScrnSaver = NULL;
if (gpwlCache)
{
ExFreePoolWithTag(gpwlCache, USERTAG_WINDOWLIST);
gpwlCache = NULL;
}
/* Destroy user objects */
UserDestroyObjectsForOwner(gHandleTable, ppiCurrent);
@ -697,6 +703,7 @@ ExitThreadCallback(PETHREAD Thread)
PPROCESSINFO ppiCurrent;
PEPROCESS Process;
PTHREADINFO ptiCurrent;
PWINDOWLIST pwl, pwlNext;
Process = Thread->ThreadsProcess;
@ -714,6 +721,16 @@ ExitThreadCallback(PETHREAD Thread)
IsRemoveAttachThread(ptiCurrent);
if (gpwlList)
{
for (pwl = gpwlList; pwl; pwl = pwlNext)
{
pwlNext = pwl->pNextList;
if (pwl->pti == ptiCurrent)
IntFreeHwndList(pwl);
}
}
ptiCurrent->TIF_flags |= TIF_DONTATTACHQUEUE;
ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;

View file

@ -90,6 +90,9 @@ typedef struct tagWINDOWLIST
HWND ahwnd[ANYSIZE_ARRAY]; /* Terminated by HWND_TERMINATOR */
} WINDOWLIST, *PWINDOWLIST;
extern PWINDOWLIST gpwlList;
extern PWINDOWLIST gpwlCache;
#define WL_IS_BAD(pwl) ((pwl)->phwndEnd <= (pwl)->phwndLast)
#define WL_CAPACITY(pwl) ((pwl)->phwndEnd - &((pwl)->ahwnd[0]))