[NTUSER] Some lifting for the Int/UserGet[Active|Capture|Foreground|ThreadFocus]Window() functions

This commit is contained in:
Hermès Bélusca-Maïto
2025-08-31 17:19:45 +02:00
parent 999502cfc4
commit 6a6ed54495
2 changed files with 24 additions and 29 deletions

View File

@@ -1403,7 +1403,6 @@ HWND FASTCALL IntGetDesktopWindow(VOID)
PWND FASTCALL UserGetDesktopWindow(VOID)
{
PDESKTOP pdo = IntGetActiveDesktop();
if (!pdo)
{
TRACE("No active desktop\n");
@@ -1416,7 +1415,6 @@ PWND FASTCALL UserGetDesktopWindow(VOID)
HWND FASTCALL IntGetMessageWindow(VOID)
{
PDESKTOP pdo = IntGetActiveDesktop();
if (!pdo)
{
TRACE("No active desktop\n");
@@ -1429,7 +1427,6 @@ HWND FASTCALL IntGetMessageWindow(VOID)
PWND FASTCALL UserGetMessageWindow(VOID)
{
PDESKTOP pdo = IntGetActiveDesktop();
if (!pdo)
{
TRACE("No active desktop\n");
@@ -1442,7 +1439,7 @@ HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID)
{
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
PDESKTOP pdo = pti->rpdesk;
if (NULL == pdo)
if (!pdo)
{
ERR("Thread doesn't have a desktop\n");
return NULL;

View File

@@ -19,35 +19,34 @@ PTHREADINFO ptiLastInput = NULL;
HWND ghwndOldFullscreen = NULL;
/*
Check locking of a process or one or more menus are active.
*/
* Check locking of a process or one or more menus are active.
*/
BOOL FASTCALL
IsFGLocked(VOID)
{
return (gppiLockSFW || guSFWLockCount);
return (gppiLockSFW || guSFWLockCount);
}
/*
Get capture window via foreground Queue.
*/
* Get capture window via foreground Queue.
*/
HWND FASTCALL
IntGetCaptureWindow(VOID)
{
PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
return ( ForegroundQueue ? (ForegroundQueue->spwndCapture ? UserHMGetHandle(ForegroundQueue->spwndCapture) : 0) : 0);
PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
if (!ForegroundQueue)
return NULL;
return (ForegroundQueue->spwndCapture ? UserHMGetHandle(ForegroundQueue->spwndCapture) : NULL);
}
HWND FASTCALL
IntGetThreadFocusWindow(VOID)
{
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
if (!ThreadQueue)
return NULL;
return ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : 0;
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
PUSER_MESSAGE_QUEUE ThreadQueue = pti->MessageQueue;
if (!ThreadQueue)
return NULL;
return (ThreadQueue->spwndFocus ? UserHMGetHandle(ThreadQueue->spwndFocus) : NULL);
}
BOOL FASTCALL IntIsWindowFullscreen(PWND Window)
@@ -1423,20 +1422,19 @@ co_UserSetFocus(PWND Window)
HWND FASTCALL
UserGetForegroundWindow(VOID)
{
PUSER_MESSAGE_QUEUE ForegroundQueue;
ForegroundQueue = IntGetFocusMessageQueue();
return( ForegroundQueue ? (ForegroundQueue->spwndActive ? UserHMGetHandle(ForegroundQueue->spwndActive) : 0) : 0);
PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue();
if (!ForegroundQueue)
return NULL;
return (ForegroundQueue->spwndActive ? UserHMGetHandle(ForegroundQueue->spwndActive) : NULL);
}
HWND FASTCALL UserGetActiveWindow(VOID)
{
PTHREADINFO pti;
PUSER_MESSAGE_QUEUE ThreadQueue;
pti = PsGetCurrentThreadWin32Thread();
ThreadQueue = pti->MessageQueue;
return( ThreadQueue ? (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : 0) : 0);
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
PUSER_MESSAGE_QUEUE ThreadQueue = pti->MessageQueue;
if (!ThreadQueue)
return NULL;
return (ThreadQueue->spwndActive ? UserHMGetHandle(ThreadQueue->spwndActive) : NULL);
}
HWND APIENTRY