[NTUSER] VerifyWnd: Remove pointless SEH and simplify the function (#5125)

This commit is contained in:
Thamatip Chitpong 2023-03-23 16:22:10 +07:00 committed by GitHub
parent d09072626b
commit 640e2283d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 24 deletions

View File

@ -85,34 +85,22 @@ PWND FASTCALL IntGetWindowObject(HWND hWnd)
PWND FASTCALL VerifyWnd(PWND pWnd)
{
HWND hWnd;
UINT State, State2;
ULONG Error;
ULONG Error;
if (!pWnd) return NULL;
if (!pWnd ||
(pWnd->state & WNDS_DESTROYED) ||
(pWnd->state2 & WNDS2_INDESTROY))
{
return NULL;
}
Error = EngGetLastError();
Error = EngGetLastError();
_SEH2_TRY
{
hWnd = UserHMGetHandle(pWnd);
State = pWnd->state;
State2 = pWnd->state2;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
EngSetLastError(Error);
_SEH2_YIELD(return NULL);
}
_SEH2_END
if (UserObjectInDestroy(UserHMGetHandle(pWnd)))
pWnd = NULL;
if ( UserObjectInDestroy(hWnd) ||
State & WNDS_DESTROYED ||
State2 & WNDS2_INDESTROY )
pWnd = NULL;
EngSetLastError(Error);
return pWnd;
EngSetLastError(Error);
return pWnd;
}
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)