Author: gadamopoulos
Date: Sun May  1 09:20:15 2011
New Revision: 51519

URL: http://svn.reactos.org/svn/reactos?rev=51519&view=rev
Log:
[win32k]
- 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

Modified:
    trunk/reactos/include/ndk/psfuncs.h
    trunk/reactos/include/reactos/undocuser.h
    trunk/reactos/include/reactos/win32k/ntuser.h
    trunk/reactos/subsystems/win32/win32k/main/dllmain.c
    trunk/reactos/subsystems/win32/win32k/ntuser/window.c

Modified: trunk/reactos/include/ndk/psfuncs.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/psfuncs.h?rev=51519&r1=51518&r2=51519&view=diff
==============================================================================
--- trunk/reactos/include/ndk/psfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/psfuncs.h [iso-8859-1] Sun May  1 09:20:15 2011
@@ -183,6 +183,13 @@
 NTAPI
 PsGetProcessInheritedFromUniqueProcessId(
     IN PEPROCESS Process
+);
+
+NTKERNELAPI
+NTSTATUS
+NTAPI
+PsGetProcessExitStatus(
+    PEPROCESS Process
 );
 
 //

Modified: trunk/reactos/include/reactos/undocuser.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/undocuser.h?rev=51519&r1=51518&r2=51519&view=diff
==============================================================================
--- trunk/reactos/include/reactos/undocuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/undocuser.h [iso-8859-1] Sun May  1 09:20:15 
2011
@@ -77,6 +77,7 @@
 //
 // Definitions used by WM_LOGONNOTIFY
 //
+#define LN_SHELL_EXITED       0x2
 #define LN_START_TASK_MANAGER 0x4
 #define LN_LOCK_WORKSTATION   0x5
 #define LN_UNLOCK_WORKSTATION 0x6

Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntuser.h?rev=51519&r1=51518&r2=51519&view=diff
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sun May  1 
09:20:15 2011
@@ -64,6 +64,8 @@
     HWND hTaskManWindow;
     HWND hProgmanWindow;
     HWND hShellWindow;
+
+    PPROCESSINFO ppiShellProcess;
 
     union
     {

Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/main/dllmain.c?rev=51519&r1=51518&r2=51519&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Sun May  
1 09:20:15 2011
@@ -128,6 +128,23 @@
         DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", 
Process->UniqueProcessId, KeGetCurrentIrql());
         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)
         {
            EngFreeMem((PVOID)Win32Process->InputIdleEvent);
@@ -243,6 +260,7 @@
         }
         Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread);
         Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout();
+        Win32Thread->pEThread = Thread;
 
         /* HAAAAAAAACK! This should go to Win32kProcessCallback */
         if(Win32Thread->ppi->hdeskStartup == NULL)
@@ -322,7 +340,7 @@
            // System thread running! Now SendMessage should be okay.
            Win32Thread->pcti = &Win32Thread->cti;
         }
-        Win32Thread->pEThread = Thread;
+        GetW32ThreadInfo();
     }
     else
     {

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/window.c?rev=51519&r1=51518&r2=51519&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Sun May  
1 09:20:15 2011
@@ -101,18 +101,7 @@
 /* temp hack */
 PWND FASTCALL UserGetWindowObject(HWND hWnd)
 {
-   PTHREADINFO ti;
-   PWND Window;
-
-   if (PsGetCurrentProcess() != PsInitialSystemProcess)
-   {
-       ti = GetW32ThreadInfo();
-       if (ti == NULL)
-       {
-          EngSetLastError(ERROR_ACCESS_DENIED);
-          return NULL;
-       }
-   }
+    PWND Window;
 
    if (!hWnd)
    {
@@ -3308,7 +3297,11 @@
    WinStaObject->ShellListView = hwndListView;
 
    ti = GetW32ThreadInfo();
-   if (ti->pDeskInfo) ti->pDeskInfo->hShellWindow = hwndShell;
+   if (ti->pDeskInfo) 
+   {
+       ti->pDeskInfo->hShellWindow = hwndShell;
+       ti->pDeskInfo->ppiShellProcess = ti->ppi;
+   }
 
    UserDerefObjectCo(WndShell);
 


Reply via email to