mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[WIN32K:NTUSER] Add a temporary winsta/desktop-connection hack for CSRSS/USERSRV (connection to WinSta0).
Normally CSRSS must not be connected to any winsta or desktop by default. It should manually connect to a winsta/desktop only when it has to do some GUI operations, and then disconnect afterwards. [USERSRV] Temporarily hackfix the harderror dialog display to the current input desktop.
This commit is contained in:
parent
fd39f92fcb
commit
3270979327
2 changed files with 24 additions and 1 deletions
|
@ -577,7 +577,8 @@ InitThreadCallback(PETHREAD Thread)
|
|||
*/
|
||||
// if (ptiCurrent->ppi->hdeskStartup == NULL && InputWindowStation != NULL)
|
||||
/* Last things to do only if we are not a SYSTEM or CSRSS thread */
|
||||
if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) &&
|
||||
// HACK Part #1: Temporarily disabled to have our current USERSRV running, but normally this is its duty to connect itself to the required desktop!
|
||||
if (// !(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)) &&
|
||||
/**/ptiCurrent->ppi->hdeskStartup == NULL &&/**/
|
||||
InputWindowStation != NULL)
|
||||
{
|
||||
|
@ -586,6 +587,10 @@ InitThreadCallback(PETHREAD Thread)
|
|||
UNICODE_STRING DesktopPath;
|
||||
PDESKTOP pdesk;
|
||||
|
||||
// HACK Part #2: We force USERSRV to connect to WinSta0 by setting the STARTF_INHERITDESKTOP flag.
|
||||
if (ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD))
|
||||
ProcessParams->WindowFlags |= STARTF_INHERITDESKTOP;
|
||||
|
||||
/*
|
||||
* Inherit the thread desktop and process window station (if not yet inherited)
|
||||
* from the process startup info structure. See documentation of CreateProcess().
|
||||
|
|
|
@ -1012,16 +1012,34 @@ UserpMessageBox(
|
|||
IN ULONG Timeout)
|
||||
{
|
||||
ULONG MessageBoxResponse;
|
||||
HDESK hDesk, hOldDesk;
|
||||
|
||||
DPRINT("Text = '%S', Caption = '%S', Type = 0x%lx\n",
|
||||
TextStringU->Buffer, CaptionStringU->Buffer, Type);
|
||||
|
||||
// TEMPORARY HACK to fix desktop assignment for harderror message boxes.
|
||||
hDesk = OpenInputDesktop(0, FALSE, GENERIC_WRITE);
|
||||
if (!hDesk)
|
||||
return ResponseNotHandled;
|
||||
|
||||
/* Assign the desktop to this thread */
|
||||
hOldDesk = GetThreadDesktop(GetCurrentThreadId());
|
||||
if (!SetThreadDesktop(hDesk))
|
||||
{
|
||||
CloseDesktop(hDesk);
|
||||
return ResponseNotHandled;
|
||||
}
|
||||
|
||||
/* Display a message box */
|
||||
MessageBoxResponse = MessageBoxTimeoutW(NULL,
|
||||
TextStringU->Buffer,
|
||||
CaptionStringU->Buffer,
|
||||
Type, 0, Timeout);
|
||||
|
||||
/* Restore the original desktop */
|
||||
SetThreadDesktop(hOldDesk);
|
||||
CloseDesktop(hDesk);
|
||||
|
||||
/* Return response value */
|
||||
switch (MessageBoxResponse)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue