2011-09-20 19:41:33 +00:00
|
|
|
/*
|
2001-06-12 17:51:51 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: GUI state check
|
2015-11-10 17:41:55 +00:00
|
|
|
* FILE: win32ss/user/ntuser/guicheck.c
|
2001-06-12 17:51:51 +00:00
|
|
|
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
|
|
|
* NOTES: The GuiCheck() function performs a few delayed operations:
|
|
|
|
* 1) A GUI process is assigned a window station
|
|
|
|
* 2) A message queue is created for a GUI thread before use
|
|
|
|
* 3) The system window classes are registered for a process
|
|
|
|
*/
|
2002-01-13 22:52:08 +00:00
|
|
|
|
2010-04-26 13:58:46 +00:00
|
|
|
#include <win32k.h>
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2002-09-17 23:43:29 +00:00
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
2004-08-08 17:57:34 +00:00
|
|
|
static LONG NrGuiAppsRunning = 0;
|
2002-09-17 23:43:29 +00:00
|
|
|
|
2002-01-13 22:52:08 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
2001-06-12 17:51:51 +00:00
|
|
|
|
2003-12-07 23:02:57 +00:00
|
|
|
static BOOL FASTCALL
|
2009-07-26 16:17:50 +00:00
|
|
|
co_AddGuiApp(PPROCESSINFO W32Data)
|
2003-12-07 23:02:57 +00:00
|
|
|
{
|
2020-04-26 17:10:48 +00:00
|
|
|
W32Data->W32PF_flags |= W32PF_CREATEDWINORDC;
|
|
|
|
if (InterlockedIncrement(&NrGuiAppsRunning) == 1)
|
|
|
|
{
|
|
|
|
BOOL Initialized;
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2020-04-26 17:10:48 +00:00
|
|
|
Initialized = co_IntInitializeDesktopGraphics();
|
2005-05-08 02:11:54 +00:00
|
|
|
|
2020-04-26 17:10:48 +00:00
|
|
|
if (!Initialized)
|
|
|
|
{
|
|
|
|
W32Data->W32PF_flags &= ~W32PF_CREATEDWINORDC;
|
|
|
|
InterlockedDecrement(&NrGuiAppsRunning);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
2003-12-07 23:02:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void FASTCALL
|
2009-07-26 16:17:50 +00:00
|
|
|
RemoveGuiApp(PPROCESSINFO W32Data)
|
2003-12-07 23:02:57 +00:00
|
|
|
{
|
2020-04-26 17:10:48 +00:00
|
|
|
W32Data->W32PF_flags &= ~W32PF_CREATEDWINORDC;
|
|
|
|
if (InterlockedDecrement(&NrGuiAppsRunning) == 0)
|
|
|
|
{
|
|
|
|
IntEndDesktopGraphics();
|
|
|
|
}
|
2003-12-07 23:02:57 +00:00
|
|
|
}
|
|
|
|
|
2003-11-25 22:06:31 +00:00
|
|
|
BOOL FASTCALL
|
2005-09-05 21:19:23 +00:00
|
|
|
co_IntGraphicsCheck(BOOL Create)
|
2001-06-12 17:51:51 +00:00
|
|
|
{
|
2020-04-26 17:10:48 +00:00
|
|
|
PPROCESSINFO W32Data;
|
2003-11-25 22:06:31 +00:00
|
|
|
|
2020-04-26 17:10:48 +00:00
|
|
|
W32Data = PsGetCurrentProcessWin32Process();
|
|
|
|
if (Create)
|
|
|
|
{
|
|
|
|
if (!(W32Data->W32PF_flags & W32PF_CREATEDWINORDC) && !(W32Data->W32PF_flags & W32PF_MANUALGUICHECK))
|
|
|
|
{
|
|
|
|
return co_AddGuiApp(W32Data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((W32Data->W32PF_flags & W32PF_CREATEDWINORDC) && !(W32Data->W32PF_flags & W32PF_MANUALGUICHECK))
|
|
|
|
{
|
|
|
|
RemoveGuiApp(W32Data);
|
|
|
|
}
|
|
|
|
}
|
2003-11-25 22:06:31 +00:00
|
|
|
|
2020-04-26 17:10:48 +00:00
|
|
|
return TRUE;
|
2002-09-17 23:43:29 +00:00
|
|
|
}
|
|
|
|
|
2008-04-12 23:22:58 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
2014-12-01 09:38:04 +00:00
|
|
|
co_IntUserManualGuiCheck(BOOL Create)
|
2003-12-03 21:50:50 +00:00
|
|
|
{
|
2020-04-26 17:10:48 +00:00
|
|
|
PPROCESSINFO W32Data = (PPROCESSINFO)PsGetCurrentProcessWin32Process();
|
|
|
|
W32Data->W32PF_flags |= W32PF_MANUALGUICHECK;
|
2005-09-07 21:25:42 +00:00
|
|
|
|
2020-04-26 17:10:48 +00:00
|
|
|
if (Create)
|
|
|
|
{
|
|
|
|
co_AddGuiApp(W32Data);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RemoveGuiApp(W32Data);
|
|
|
|
}
|
2003-12-03 21:50:50 +00:00
|
|
|
}
|
|
|
|
|
2001-06-12 17:51:51 +00:00
|
|
|
/* EOF */
|