[WINLOGON]
[reactos.git] / reactos / dll / win32 / msgina / gui.c
index a8e2897..9609f06 100644 (file)
@@ -7,8 +7,6 @@
 
 #include "msgina.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(msgina);
-
 typedef struct _DISPLAYSTATUSMSG
 {
     PGINA_CONTEXT Context;
@@ -186,23 +184,15 @@ static VOID
 GUIDisplaySASNotice(
     IN OUT PGINA_CONTEXT pgContext)
 {
-    INT result;
-
     TRACE("GUIDisplaySASNotice()\n");
 
     /* Display the notice window */
-    result = DialogBoxParam(
-        pgContext->hDllInstance,
-        MAKEINTRESOURCE(IDD_NOTICE_DLG),
-        GetDesktopWindow(),
-        EmptyWindowProc,
-        (LPARAM)NULL);
-    if (result == -1)
-    {
-        /* Failed to display the window. Do as if the user
-         * already has pressed CTRL+ALT+DELETE */
-        pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
-    }
+    pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
+                                            pgContext->hDllInstance,
+                                            MAKEINTRESOURCEW(IDD_NOTICE_DLG),
+                                            GetDesktopWindow(),
+                                            EmptyWindowProc,
+                                            (LPARAM)NULL);
 }
 
 /* Get the text contained in a textbox. Allocates memory in pText
@@ -229,6 +219,42 @@ GetTextboxText(
     return TRUE;
 }
 
+
+static INT_PTR CALLBACK
+ChangePasswordDialogProc(
+    IN HWND hwndDlg,
+    IN UINT uMsg,
+    IN WPARAM wParam,
+    IN LPARAM lParam)
+{
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            FIXME("ChangePasswordDialogProc: WM_INITDLG\n");
+            return TRUE;
+
+        case WM_COMMAND:
+            switch (LOWORD(wParam))
+            {
+                case IDOK:
+                    EndDialog(hwndDlg, TRUE);
+                    return TRUE;
+
+                case IDCANCEL:
+                    EndDialog(hwndDlg, FALSE);
+                    return TRUE;
+            }
+            break;
+
+        case WM_CLOSE:
+            EndDialog(hwndDlg, FALSE);
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
+
 static VOID
 OnInitSecurityDlg(HWND hwnd,
                   PGINA_CONTEXT pgContext)
@@ -258,6 +284,30 @@ OnInitSecurityDlg(HWND hwnd,
     SetDlgItemTextW(hwnd, IDC_LOGONDATE, Buffer4);
 }
 
+
+static BOOL
+OnChangePassword(
+    IN HWND hwnd,
+    IN PGINA_CONTEXT pgContext)
+{
+    INT res;
+
+    FIXME("OnChangePassword()\n");
+
+    res = pgContext->pWlxFuncs->WlxDialogBoxParam(
+        pgContext->hWlx,
+        pgContext->hDllInstance,
+        MAKEINTRESOURCEW(IDD_CHANGE_PASSWORD),
+        hwnd,
+        ChangePasswordDialogProc,
+        (LPARAM)pgContext);
+
+    FIXME("Result: %x\n", res);
+
+    return FALSE;
+}
+
+
 static INT_PTR CALLBACK
 LoggedOnWindowProc(
     IN HWND hwndDlg,
@@ -265,10 +315,17 @@ LoggedOnWindowProc(
     IN WPARAM wParam,
     IN LPARAM lParam)
 {
+    PGINA_CONTEXT pgContext;
+
+    pgContext = (PGINA_CONTEXT)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+
     switch (uMsg)
     {
         case WM_INITDIALOG:
         {
+            pgContext = (PGINA_CONTEXT)lParam;
+            SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext);
+
             OnInitSecurityDlg(hwndDlg, (PGINA_CONTEXT)lParam);
             SetFocus(GetDlgItem(hwndDlg, IDNO));
             return TRUE;
@@ -287,6 +344,10 @@ LoggedOnWindowProc(
                 case IDC_SHUTDOWN:
                     EndDialog(hwndDlg, WLX_SAS_ACTION_SHUTDOWN_POWER_OFF);
                     return TRUE;
+                case IDC_CHANGEPWD:
+                    if (OnChangePassword(hwndDlg, pgContext))
+                        EndDialog(hwndDlg, WLX_SAS_ACTION_PWD_CHANGED);
+                    return TRUE;
                 case IDC_TASKMGR:
                     EndDialog(hwndDlg, WLX_SAS_ACTION_TASKLIST);
                     return TRUE;
@@ -322,7 +383,7 @@ GUILoggedOnSAS(
         return WLX_SAS_ACTION_NONE;
     }
 
-    result = pgContext->pWlxFuncs->WlxSwitchDesktopToWinlogon(
+    pgContext->pWlxFuncs->WlxSwitchDesktopToWinlogon(
         pgContext->hWlx);
 
     result = pgContext->pWlxFuncs->WlxDialogBoxParam(
@@ -341,7 +402,7 @@ GUILoggedOnSAS(
 
     if (result == WLX_SAS_ACTION_NONE)
     {
-        result = pgContext->pWlxFuncs->WlxSwitchDesktopToUser(
+        pgContext->pWlxFuncs->WlxSwitchDesktopToUser(
             pgContext->hWlx);
     }
 
@@ -366,6 +427,10 @@ LoggedOutWindowProc(
             /* FIXME: take care of DontDisplayLastUserName, NoDomainUI, ShutdownWithoutLogon */
             pgContext = (PGINA_CONTEXT)lParam;
             SetWindowLongPtr(hwndDlg, GWL_USERDATA, (DWORD_PTR)pgContext);
+
+            if (pgContext->bDisableCAD == TRUE)
+                EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
+
             SetFocus(GetDlgItem(hwndDlg, IDC_USERNAME));
 
             pgContext->hBitmap = LoadImage(hDllInstance, MAKEINTRESOURCE(IDI_ROSLOGO), IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);