Author: ekohl
Date: Sat Jan 11 16:20:31 2014
New Revision: 61585

URL: http://svn.reactos.org/svn/reactos?rev=61585&view=rev
Log:
[WINLOGON]
- Implement a global dialog tracking list.
- Close the SAS notice dialog before the logon dialog is created and create a 
new SAS notice dialog when the user cancels the logon dialog. This prevents the 
creation of multiple SAS notice dialogs below the logon dialog.

Modified:
    trunk/reactos/base/system/winlogon/sas.c
    trunk/reactos/base/system/winlogon/winlogon.c
    trunk/reactos/base/system/winlogon/winlogon.h
    trunk/reactos/base/system/winlogon/wlx.c

Modified: trunk/reactos/base/system/winlogon/sas.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/sas.c?rev=61585&r1=61584&r2=61585&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/sas.c    [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/sas.c    [iso-8859-1] Sat Jan 11 
16:20:31 2014
@@ -845,6 +845,7 @@
                 
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
             break;
         case WLX_SAS_ACTION_NONE: /* 0x02 */
+            Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
             break;
         case WLX_SAS_ACTION_LOCK_WKSTA: /* 0x03 */
             if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context))
@@ -923,6 +924,13 @@
             default:
             {
                 PSID LogonSid = NULL; /* FIXME */
+                HWND hwnd;
+
+                hwnd = GetTopDialogWindow();
+                if (hwnd != NULL)
+                {
+                    SendMessage(hwnd, WM_USER, 0, 0);
+                }
 
                 Session->Options = 0;
 

Modified: trunk/reactos/base/system/winlogon/winlogon.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlogon.c?rev=61585&r1=61584&r2=61585&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.c       [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/winlogon.c       [iso-8859-1] Sat Jan 11 
16:20:31 2014
@@ -334,6 +334,9 @@
     ZeroMemory(WLSession, sizeof(WLSESSION));
     WLSession->DialogTimeout = 120; /* 2 minutes */
 
+    /* Initialize the dialog tracking list */
+    InitDialogListHead();
+
     if (!CreateWindowStationAndDesktops(WLSession))
     {
         ERR("WL: Could not create window station and desktops\n");

Modified: trunk/reactos/base/system/winlogon/winlogon.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlogon.h?rev=61585&r1=61584&r2=61585&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.h       [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/winlogon.h       [iso-8859-1] Sat Jan 11 
16:20:31 2014
@@ -189,17 +189,17 @@
  */
 typedef enum _LOGON_STATE
 {
-    STATE_INIT,            // not user yet
+    STATE_INIT,            // not used yet
     STATE_LOGGED_OFF,
-    STATE_LOGGED_OFF_SAS,  // not user yet
+    STATE_LOGGED_OFF_SAS,  // not used yet
     STATE_LOGGED_ON,
-    STATE_LOGGED_ON_SAS,   // not user yet
-    STATE_SCREENSAVER,     // not user yet
+    STATE_LOGGED_ON_SAS,   // not used yet
+    STATE_SCREENSAVER,     // not used yet
     STATE_LOCKED,
-    STATE_LOCKED_SAS,      // not user yet
-    STATE_LOGGING_OFF,     // not user yet
-    STATE_SHUTTING_DOWN,   // not user yet
-    STATE_SHUT_DOWN        // not user yet
+    STATE_LOCKED_SAS,      // not used yet
+    STATE_LOGGING_OFF,     // not used yet
+    STATE_SHUTTING_DOWN,   // not used yet
+    STATE_SHUT_DOWN        // not used yet
 } LOGON_STATE, *PLOGON_STATE;
 
 #define LockWorkstation(Session)
@@ -291,6 +291,12 @@
 RemoveStatusMessage(IN PWLSESSION Session);
 
 /* wlx.c */
+VOID
+InitDialogListHead(VOID);
+
+HWND
+GetTopDialogWindow(VOID);
+
 BOOL
 GinaInit(IN OUT PWLSESSION Session);
 

Modified: trunk/reactos/base/system/winlogon/wlx.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/wlx.c?rev=61585&r1=61584&r2=61585&view=diff
==============================================================================
--- trunk/reactos/base/system/winlogon/wlx.c    [iso-8859-1] (original)
+++ trunk/reactos/base/system/winlogon/wlx.c    [iso-8859-1] Sat Jan 11 
16:20:31 2014
@@ -26,12 +26,106 @@
 #define GENERIC_ACCESS (GENERIC_READ | GENERIC_WRITE | \
     GENERIC_EXECUTE | GENERIC_ALL)
 
+typedef struct _DIALOG_LIST_ENTRY
+{
+    LIST_ENTRY Entry;
+    HWND hWnd;
+    DLGPROC DlgProc;
+    LPARAM lParam;
+} DIALOG_LIST_ENTRY, *PDIALOG_LIST_ENTRY;
+
 /* GLOBALS ******************************************************************/
 
-static DLGPROC PreviousWindowProc;
-static UINT_PTR IdTimer;
+//static UINT_PTR IdTimer;
+static LIST_ENTRY DialogListHead;
 
 /* FUNCTIONS ****************************************************************/
+
+VOID
+InitDialogListHead(VOID)
+{
+    InitializeListHead(&DialogListHead);
+}
+
+
+static
+PDIALOG_LIST_ENTRY
+AddDialogListEntry(VOID)
+{
+    PDIALOG_LIST_ENTRY ListEntry;
+
+    ListEntry = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, 
sizeof(DIALOG_LIST_ENTRY));
+    if (ListEntry == NULL)
+        return NULL;
+
+    TRACE("Add entry %p\n", ListEntry);
+
+    InsertHeadList(&DialogListHead,
+                   &ListEntry->Entry);
+
+    return ListEntry;
+}
+
+
+static
+VOID
+RemoveDialogListEntry(PDIALOG_LIST_ENTRY ListEntry)
+{
+    TRACE("Remove entry %p\n", ListEntry);
+
+    RemoveEntryList(&ListEntry->Entry);
+    RtlFreeHeap(RtlGetProcessHeap(), 0, ListEntry);
+}
+
+
+static
+PDIALOG_LIST_ENTRY
+GetDialogListEntry(HWND hwndDlg)
+{
+    PDIALOG_LIST_ENTRY Current;
+    PLIST_ENTRY ListEntry;
+
+    ListEntry = DialogListHead.Flink;
+    while (ListEntry != &DialogListHead)
+    {
+        Current = CONTAINING_RECORD(ListEntry,
+                                    DIALOG_LIST_ENTRY,
+                                    Entry);
+        if (Current->hWnd == hwndDlg)
+        {
+            TRACE("Found entry: %p\n", Current);
+            return Current;
+        }
+
+        ListEntry = ListEntry->Flink;
+    }
+
+    TRACE("Found no entry!\n");
+    return NULL;
+}
+
+
+HWND
+GetTopDialogWindow(VOID)
+{
+    PDIALOG_LIST_ENTRY Current;
+    PLIST_ENTRY ListEntry;
+
+    ListEntry = DialogListHead.Flink;
+    if (ListEntry != &DialogListHead)
+    {
+        Current = CONTAINING_RECORD(ListEntry,
+                                    DIALOG_LIST_ENTRY,
+                                    Entry);
+
+        TRACE("Found entry: %p window %p\n", Current, Current->hWnd);
+        return Current->hWnd;
+    }
+
+    TRACE("Found no window\n");
+    return NULL;
+}
+
 
 static
 INT_PTR
@@ -42,6 +136,36 @@
     IN WPARAM wParam,
     IN LPARAM lParam)
 {
+    PDIALOG_LIST_ENTRY ListEntry;
+    INT_PTR ret;
+
+    if (uMsg == WM_INITDIALOG)
+    {
+        ListEntry = (PDIALOG_LIST_ENTRY)lParam;
+
+        TRACE("Set dialog handle: %p\n", hwndDlg);
+        ListEntry->hWnd = hwndDlg;
+        lParam = ListEntry->lParam;
+//        SetTopTimeout(hWnd);
+    }
+    else
+    {
+        ListEntry = GetDialogListEntry(hwndDlg);
+        if (ListEntry == NULL)
+            return FALSE;
+    }
+
+    if (uMsg == WM_USER)
+    {
+        EndDialog(hwndDlg, 0);
+        return 0;
+    }
+
+    ret = ListEntry->DlgProc(hwndDlg, uMsg, wParam, lParam);
+
+    return ret;
+
+/*
     if (uMsg == WM_TIMER && (UINT_PTR)wParam == IdTimer)
     {
         EndDialog(hwndDlg, -1);
@@ -64,6 +188,7 @@
     {
         return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
     }
+*/
 }
 
 /*
@@ -186,10 +311,7 @@
 
     TRACE("WlxDialogBox()\n");
 
-    if (PreviousWindowProc != NULL)
-        return -1;
-    PreviousWindowProc = dlgprc;
-    return (int)DialogBoxW((HINSTANCE) hInst, lpszTemplate, hwndOwner, 
DefaultWlxWindowProc);
+    return (int)WlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, 
dlgprc, 0);
 }
 
 /*
@@ -205,14 +327,25 @@
     DLGPROC dlgprc,
     LPARAM dwInitParam)
 {
+    PDIALOG_LIST_ENTRY ListEntry;
+    int ret;
+
     UNREFERENCED_PARAMETER(hWlx);
 
     TRACE("WlxDialogBoxParam()\n");
 
-    if (PreviousWindowProc != NULL)
+    ListEntry = AddDialogListEntry();
+    if (ListEntry == NULL)
         return -1;
-    PreviousWindowProc = dlgprc;
-    return (int)DialogBoxParamW(hInst, lpszTemplate, hwndOwner, 
DefaultWlxWindowProc, dwInitParam);
+
+    ListEntry->DlgProc = dlgprc;
+    ListEntry->lParam = dwInitParam;
+
+    ret = (int)DialogBoxParamW(hInst, lpszTemplate, hwndOwner, 
DefaultWlxWindowProc, (LPARAM)ListEntry);
+
+    RemoveDialogListEntry(ListEntry);
+
+    return ret;
 }
 
 /*
@@ -231,10 +364,7 @@
 
     TRACE("WlxDialogBoxIndirect()\n");
 
-    if (PreviousWindowProc != NULL)
-        return -1;
-    PreviousWindowProc = dlgprc;
-    return (int)DialogBoxIndirectW(hInst, hDialogTemplate, hwndOwner, 
DefaultWlxWindowProc);
+    return (int)WlxDialogBoxIndirectParam(hWlx, hInst, hDialogTemplate, 
hwndOwner, dlgprc, 0);
 }
 
 /*
@@ -250,14 +380,25 @@
     DLGPROC dlgprc,
     LPARAM dwInitParam)
 {
+    PDIALOG_LIST_ENTRY ListEntry;
+    int ret;
+
     UNREFERENCED_PARAMETER(hWlx);
 
     TRACE("WlxDialogBoxIndirectParam()\n");
 
-    if (PreviousWindowProc != NULL)
+    ListEntry = AddDialogListEntry();
+    if (ListEntry == NULL)
         return -1;
-    PreviousWindowProc = dlgprc;
-    return (int)DialogBoxIndirectParamW(hInst, hDialogTemplate, hwndOwner, 
DefaultWlxWindowProc, dwInitParam);
+
+    ListEntry->DlgProc = dlgprc;
+    ListEntry->lParam = dwInitParam;
+
+    ret = (int)DialogBoxIndirectParamW(hInst, hDialogTemplate, hwndOwner, 
DefaultWlxWindowProc, (LPARAM)ListEntry);
+
+    RemoveDialogListEntry(ListEntry);
+
+    return ret;
 }
 
 /*
@@ -789,7 +930,6 @@
     Session->Gina.Version = GinaDllVersion;
     Session->Gina.UseCtrlAltDelete = FALSE;
     Session->SuppressStatus = FALSE;
-    PreviousWindowProc = NULL;
 
     TRACE("Calling WlxInitialize(\"%S\")\n", 
Session->InteractiveWindowStationName);
     return Session->Gina.Functions.WlxInitialize(


Reply via email to