[csrsrv]
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Sat, 2 Mar 2013 22:22:56 +0000 (22:22 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Sat, 2 Mar 2013 22:22:56 +0000 (22:22 +0000)
- Remove CsrSetLogonNotifyWindow
- Use a reactos only TWOPARAM_ROUTINE_EXITREACTOS call in order to start the shut down process in winlogon
- Use a NOPARAM_ROUTINE_ISCONSOLEMODE call in DtbgIsDesktopVisible to fix detecting console mode in gui-on-demand mode

svn path=/trunk/; revision=58411

reactos/win32ss/include/ntuser.h
reactos/win32ss/pch.h
reactos/win32ss/user/ntuser/simplecall.c
reactos/win32ss/user/win32csr/desktopbg.c
reactos/win32ss/user/win32csr/exitros.c

index be749e2..c123cc7 100644 (file)
@@ -3301,12 +3301,14 @@ typedef struct tagKMDDELPARAM
  * ReactOS-specific NtUser calls and their related structures, both which shouldn't exist.
  */
 
+#define NOPARAM_ROUTINE_ISCONSOLEMODE         0xffff0001
 #define NOPARAM_ROUTINE_GETMESSAGEEXTRAINFO   0xffff0005
 #define ONEPARAM_ROUTINE_CSRSS_GUICHECK       0xffff0008
 #define ONEPARAM_ROUTINE_SWITCHCARETSHOWING   0xfffe0008
 #define ONEPARAM_ROUTINE_ENABLEPROCWNDGHSTING 0xfffe000d
 #define ONEPARAM_ROUTINE_GETDESKTOPMAPPING    0xfffe000e
 #define TWOPARAM_ROUTINE_SETMENUBARHEIGHT   0xfffd0050
+#define TWOPARAM_ROUTINE_EXITREACTOS        0xfffd0051
 #define TWOPARAM_ROUTINE_SETGUITHRDHANDLE   0xfffd0052
   #define MSQ_STATE_CAPTURE    0x1
   #define MSQ_STATE_ACTIVE     0x2
index 4368acc..67ba984 100644 (file)
@@ -86,6 +86,7 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
 
 /* Undocumented user definitions */
 #include <undocuser.h>
+#include <winlogon.h>
 
 /* Freetype headers */
 #include <ft2build.h>
index 9f8e698..42eb591 100644 (file)
@@ -129,6 +129,10 @@ NtUserCallNoParam(DWORD Routine)
          RETURN(0);
       }
 
+      /* this is a Reactos only case and is needed for gui-on-demand */
+      case NOPARAM_ROUTINE_ISCONSOLEMODE:
+          RETURN( ScreenDeviceContext == NULL );
+
       default:
          ERR("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine);
          EngSetLastError(ERROR_INVALID_PARAMETER);
@@ -473,6 +477,13 @@ NtUserCallTwoParam(
 
       case TWOPARAM_ROUTINE_UNHOOKWINDOWSHOOK:
          RETURN( IntUnhookWindowsHook((int)Param1, (HOOKPROC)Param2));
+      case TWOPARAM_ROUTINE_EXITREACTOS:
+          if(hwndSAS == NULL)
+          {
+              ASSERT(hwndSAS);
+              RETURN(STATUS_NOT_FOUND);
+          }
+         RETURN( co_IntSendMessage (hwndSAS, PM_WINLOGON_EXITWINDOWS, (WPARAM) Param1, (LPARAM)Param2));
    }
    ERR("Calling invalid routine number 0x%x in NtUserCallTwoParam(), Param1=0x%x Parm2=0x%x\n",
            Routine, Param1, Param2);
index 4fef393..c6ba490 100644 (file)
@@ -21,15 +21,7 @@ CSR_API(CsrHideDesktop)
 BOOL
 FASTCALL DtbgIsDesktopVisible(VOID)
 {
-    HWND VisibleDesktopWindow = GetDesktopWindow(); // DESKTOPWNDPROC
-
-    if (VisibleDesktopWindow != NULL &&
-            !IsWindowVisible(VisibleDesktopWindow))
-    {
-        VisibleDesktopWindow = NULL;
-    }
-
-    return VisibleDesktopWindow != NULL;
+    return !((BOOL)NtUserCallNoParam(NOPARAM_ROUTINE_ISCONSOLEMODE));
 }
 
 /* EOF */
index fd11c16..c0008ac 100644 (file)
@@ -13,7 +13,6 @@
 #include "resource.h"
 #include <debug.h>
 
-static HWND LogonNotifyWindow = NULL;
 static HANDLE LogonProcess = NULL;
 
 CSR_API(CsrRegisterLogonProcess)
@@ -42,22 +41,6 @@ CSR_API(CsrRegisterLogonProcess)
 
 CSR_API(CsrSetLogonNotifyWindow)
 {
-    DWORD WindowCreator;
-
-    if (0 == GetWindowThreadProcessId(Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow,
-                                      &WindowCreator))
-    {
-        DPRINT1("Can't get window creator\n");
-        return STATUS_INVALID_HANDLE;
-    }
-    if (WindowCreator != (DWORD_PTR)LogonProcess)
-    {
-        DPRINT1("Trying to register window not created by winlogon as notify window\n");
-        return STATUS_ACCESS_DENIED;
-    }
-
-    LogonNotifyWindow = Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow;
-
     return STATUS_SUCCESS;
 }
 
@@ -888,16 +871,9 @@ UserExitReactos(DWORD UserProcessId, UINT Flags)
 {
     NTSTATUS Status;
 
-    if (NULL == LogonNotifyWindow)
-    {
-        DPRINT1("No LogonNotifyWindow registered\n");
-        return STATUS_NOT_FOUND;
-    }
-
     /* FIXME Inside 2000 says we should impersonate the caller here */
-    Status = SendMessageW(LogonNotifyWindow, PM_WINLOGON_EXITWINDOWS,
-                          (WPARAM) UserProcessId,
-                          (LPARAM) Flags);
+    Status = NtUserCallTwoParam (UserProcessId, Flags, TWOPARAM_ROUTINE_EXITREACTOS);
+
     /* If the message isn't handled, the return value is 0, so 0 doesn't indicate
        success. Success is indicated by a 1 return value, if anything besides 0
        or 1 it's a NTSTATUS value */