- Do not try to initialize thread info in UserGetWindowObject. Do it in thread callout. Removing this hack is needed in order to use UserPostMessage in ProcessCallout when a process is terminating
- Notify winlogon that the shell is exiting in order to restart the shell

svn path=/trunk/; revision=51519
This commit is contained in:
Giannis Adamopoulos 2011-05-01 09:20:15 +00:00
parent 4f0424990b
commit 5f8889d8b2
5 changed files with 35 additions and 14 deletions

View file

@ -185,6 +185,13 @@ PsGetProcessInheritedFromUniqueProcessId(
IN PEPROCESS Process IN PEPROCESS Process
); );
NTKERNELAPI
NTSTATUS
NTAPI
PsGetProcessExitStatus(
PEPROCESS Process
);
// //
// Quota Functions // Quota Functions
// //

View file

@ -77,6 +77,7 @@
// //
// Definitions used by WM_LOGONNOTIFY // Definitions used by WM_LOGONNOTIFY
// //
#define LN_SHELL_EXITED 0x2
#define LN_START_TASK_MANAGER 0x4 #define LN_START_TASK_MANAGER 0x4
#define LN_LOCK_WORKSTATION 0x5 #define LN_LOCK_WORKSTATION 0x5
#define LN_UNLOCK_WORKSTATION 0x6 #define LN_UNLOCK_WORKSTATION 0x6

View file

@ -65,6 +65,8 @@ typedef struct _DESKTOPINFO
HWND hProgmanWindow; HWND hProgmanWindow;
HWND hShellWindow; HWND hShellWindow;
PPROCESSINFO ppiShellProcess;
union union
{ {
UINT Dummy; UINT Dummy;

View file

@ -128,6 +128,23 @@ Win32kProcessCallback(struct _EPROCESS *Process,
DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql()); DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql());
Win32Process->W32PF_flags |= W32PF_TERMINATED; Win32Process->W32PF_flags |= W32PF_TERMINATED;
/* Notify logon application to restart shell if needed */
if(Win32Process->rpdeskStartup->pDeskInfo)
{
if(Win32Process->rpdeskStartup->pDeskInfo->ppiShellProcess == Win32Process)
{
DWORD ExitCode;
ExitCode = PsGetProcessExitStatus(Win32Process->peProcess);
DPRINT1("Shell process is exiting (%d)\n", ExitCode);
UserPostMessage(hwndSAS,
WM_LOGONNOTIFY,
LN_SHELL_EXITED,
ExitCode);
}
}
if (Win32Process->InputIdleEvent) if (Win32Process->InputIdleEvent)
{ {
EngFreeMem((PVOID)Win32Process->InputIdleEvent); EngFreeMem((PVOID)Win32Process->InputIdleEvent);
@ -243,6 +260,7 @@ Win32kThreadCallback(struct _ETHREAD *Thread,
} }
Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread); Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread);
Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout(); Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout();
Win32Thread->pEThread = Thread;
/* HAAAAAAAACK! This should go to Win32kProcessCallback */ /* HAAAAAAAACK! This should go to Win32kProcessCallback */
if(Win32Thread->ppi->hdeskStartup == NULL) if(Win32Thread->ppi->hdeskStartup == NULL)
@ -322,7 +340,7 @@ Win32kThreadCallback(struct _ETHREAD *Thread,
// System thread running! Now SendMessage should be okay. // System thread running! Now SendMessage should be okay.
Win32Thread->pcti = &Win32Thread->cti; Win32Thread->pcti = &Win32Thread->cti;
} }
Win32Thread->pEThread = Thread; GetW32ThreadInfo();
} }
else else
{ {

View file

@ -101,18 +101,7 @@ PWND FASTCALL IntGetWindowObject(HWND hWnd)
/* temp hack */ /* temp hack */
PWND FASTCALL UserGetWindowObject(HWND hWnd) PWND FASTCALL UserGetWindowObject(HWND hWnd)
{ {
PTHREADINFO ti; PWND Window;
PWND Window;
if (PsGetCurrentProcess() != PsInitialSystemProcess)
{
ti = GetW32ThreadInfo();
if (ti == NULL)
{
EngSetLastError(ERROR_ACCESS_DENIED);
return NULL;
}
}
if (!hWnd) if (!hWnd)
{ {
@ -3308,7 +3297,11 @@ NtUserSetShellWindowEx(HWND hwndShell, HWND hwndListView)
WinStaObject->ShellListView = hwndListView; WinStaObject->ShellListView = hwndListView;
ti = GetW32ThreadInfo(); ti = GetW32ThreadInfo();
if (ti->pDeskInfo) ti->pDeskInfo->hShellWindow = hwndShell; if (ti->pDeskInfo)
{
ti->pDeskInfo->hShellWindow = hwndShell;
ti->pDeskInfo->ppiShellProcess = ti->ppi;
}
UserDerefObjectCo(WndShell); UserDerefObjectCo(WndShell);