2 * PROJECT: ReactOS msgina.dll
3 * FILE: dll/win32/msgina/gui.c
4 * PURPOSE: ReactOS Logon GINA DLL
5 * PROGRAMMER: Hervé Poussineau (hpoussin@reactos.org)
13 typedef struct _DISPLAYSTATUSMSG
15 PGINA_CONTEXT Context
;
21 } DISPLAYSTATUSMSG
, *PDISPLAYSTATUSMSG
;
25 IN OUT PGINA_CONTEXT pgContext
)
27 TRACE("GUIInitialize(%p)\n", pgContext
);
31 static INT_PTR CALLBACK
32 StatusMessageWindowProc(
38 UNREFERENCED_PARAMETER(wParam
);
44 PDISPLAYSTATUSMSG msg
= (PDISPLAYSTATUSMSG
)lParam
;
48 msg
->Context
->hStatusWindow
= hwndDlg
;
51 SetWindowTextW(hwndDlg
, msg
->pTitle
);
52 SetDlgItemTextW(hwndDlg
, IDC_STATUSLABEL
, msg
->pMessage
);
53 SetEvent(msg
->StartupEvent
);
61 StartupWindowThread(LPVOID lpParam
)
64 PDISPLAYSTATUSMSG msg
= (PDISPLAYSTATUSMSG
)lpParam
;
66 /* When SetThreadDesktop is called the system closes the desktop handle when needed
67 so we have to create a new handle because this handle may still be in use by winlogon */
68 if (!DuplicateHandle ( GetCurrentProcess(),
74 DUPLICATE_SAME_ACCESS
))
76 HeapFree(GetProcessHeap(), 0, lpParam
);
80 if(!SetThreadDesktop(hDesk
))
82 HeapFree(GetProcessHeap(), 0, lpParam
);
88 MAKEINTRESOURCE(IDD_STATUSWINDOW_DLG
),
90 StatusMessageWindowProc
,
93 HeapFree(GetProcessHeap(), 0, lpParam
);
98 GUIDisplayStatusMessage(
99 IN PGINA_CONTEXT pgContext
,
105 PDISPLAYSTATUSMSG msg
;
109 TRACE("GUIDisplayStatusMessage(%ws)\n", pMessage
);
111 if (!pgContext
->hStatusWindow
)
113 msg
= (PDISPLAYSTATUSMSG
)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(DISPLAYSTATUSMSG
));
117 msg
->Context
= pgContext
;
118 msg
->dwOptions
= dwOptions
;
119 msg
->pTitle
= pTitle
;
120 msg
->pMessage
= pMessage
;
121 msg
->hDesktop
= hDesktop
;
123 msg
->StartupEvent
= CreateEventW(
129 if (!msg
->StartupEvent
)
132 Thread
= CreateThread(
142 WaitForSingleObject(msg
->StartupEvent
, INFINITE
);
143 CloseHandle(msg
->StartupEvent
);
151 SetWindowTextW(pgContext
->hStatusWindow
, pTitle
);
153 SetDlgItemTextW(pgContext
->hStatusWindow
, IDC_STATUSLABEL
, pMessage
);
159 GUIRemoveStatusMessage(
160 IN PGINA_CONTEXT pgContext
)
162 if (pgContext
->hStatusWindow
)
164 EndDialog(pgContext
->hStatusWindow
, 0);
165 pgContext
->hStatusWindow
= NULL
;
171 static INT_PTR CALLBACK
178 PGINA_CONTEXT pgContext
;
180 pgContext
= (PGINA_CONTEXT
)GetWindowLongPtr(hwndDlg
, GWL_USERDATA
);
186 pgContext
->hBitmap
= LoadImage(hDllInstance
, MAKEINTRESOURCE(IDI_ROSLOGO
), IMAGE_BITMAP
, 0, 0, LR_DEFAULTCOLOR
);
192 if (pgContext
->hBitmap
)
194 hdc
= BeginPaint(hwndDlg
, &ps
);
195 DrawStateW(hdc
, NULL
, NULL
, (LPARAM
)pgContext
->hBitmap
, (WPARAM
)0, 0, 0, 0, 0, DST_BITMAP
);
196 EndPaint(hwndDlg
, &ps
);
202 DeleteObject(pgContext
->hBitmap
);
211 IN OUT PGINA_CONTEXT pgContext
)
213 TRACE("GUIDisplaySASNotice()\n");
215 /* Display the notice window */
216 pgContext
->pWlxFuncs
->WlxDialogBoxParam(pgContext
->hWlx
,
217 pgContext
->hDllInstance
,
218 MAKEINTRESOURCEW(IDD_NOTICE_DLG
),
224 /* Get the text contained in a textbox. Allocates memory in pText
225 * to contain the text. Returns TRUE in case of success */
235 Count
= GetWindowTextLength(GetDlgItem(hwndDlg
, TextboxId
));
236 Text
= HeapAlloc(GetProcessHeap(), 0, (Count
+ 1) * sizeof(WCHAR
));
239 if (Count
!= GetWindowTextW(GetDlgItem(hwndDlg
, TextboxId
), Text
, Count
+ 1))
241 HeapFree(GetProcessHeap(), 0, Text
);
252 IN PGINA_CONTEXT pgContext
,
258 WCHAR szCaption
[256];
261 LoadStringW(pgContext
->hDllInstance
, uCaption
, szCaption
, 256);
262 LoadStringW(pgContext
->hDllInstance
, uText
, szText
, 256);
264 return pgContext
->pWlxFuncs
->WlxMessageBox(pgContext
->hWlx
,
275 IN PGINA_CONTEXT pgContext
,
279 WCHAR DomainName
[256];
280 WCHAR OldPassword
[256];
281 WCHAR NewPassword1
[256];
282 WCHAR NewPassword2
[256];
283 PMSV1_0_CHANGEPASSWORD_REQUEST RequestBuffer
= NULL
;
284 PMSV1_0_CHANGEPASSWORD_RESPONSE ResponseBuffer
= NULL
;
285 ULONG RequestBufferSize
;
286 ULONG ResponseBufferSize
= 0;
289 NTSTATUS ProtocolStatus
;
292 GetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_USERNAME
, UserName
, 256);
293 GetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_DOMAIN
, DomainName
, 256);
294 GetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_OLDPWD
, OldPassword
, 256);
295 GetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_NEWPWD1
, NewPassword1
, 256);
296 GetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_NEWPWD2
, NewPassword2
, 256);
298 /* Compare the two passwords and fail if they do not match */
299 if (wcscmp(NewPassword1
, NewPassword2
) != 0)
301 ResourceMessageBox(pgContext
,
303 MB_OK
| MB_ICONEXCLAMATION
,
305 IDS_NONMATCHINGPASSWORDS
);
309 /* Calculate the request buffer size */
310 RequestBufferSize
= sizeof(MSV1_0_CHANGEPASSWORD_REQUEST
) +
311 ((wcslen(DomainName
) + 1) * sizeof(WCHAR
)) +
312 ((wcslen(UserName
) + 1) * sizeof(WCHAR
)) +
313 ((wcslen(OldPassword
) + 1) * sizeof(WCHAR
)) +
314 ((wcslen(NewPassword1
) + 1) * sizeof(WCHAR
));
316 /* Allocate the request buffer */
317 RequestBuffer
= HeapAlloc(GetProcessHeap(),
320 if (RequestBuffer
== NULL
)
322 ERR("HeapAlloc failed\n");
326 /* Initialize the request buffer */
327 RequestBuffer
->MessageType
= MsV1_0ChangePassword
;
328 RequestBuffer
->Impersonating
= TRUE
;
330 Ptr
= (LPWSTR
)((ULONG_PTR
)RequestBuffer
+ sizeof(MSV1_0_CHANGEPASSWORD_REQUEST
));
332 /* Pack the domain name */
333 RequestBuffer
->DomainName
.Length
= wcslen(DomainName
) * sizeof(WCHAR
);
334 RequestBuffer
->DomainName
.MaximumLength
= RequestBuffer
->DomainName
.Length
+ sizeof(WCHAR
);
335 RequestBuffer
->DomainName
.Buffer
= Ptr
;
337 RtlCopyMemory(RequestBuffer
->DomainName
.Buffer
,
339 RequestBuffer
->DomainName
.MaximumLength
);
341 Ptr
= (LPWSTR
)((ULONG_PTR
)Ptr
+ RequestBuffer
->DomainName
.MaximumLength
);
343 /* Pack the user name */
344 RequestBuffer
->AccountName
.Length
= wcslen(UserName
) * sizeof(WCHAR
);
345 RequestBuffer
->AccountName
.MaximumLength
= RequestBuffer
->AccountName
.Length
+ sizeof(WCHAR
);
346 RequestBuffer
->AccountName
.Buffer
= Ptr
;
348 RtlCopyMemory(RequestBuffer
->AccountName
.Buffer
,
350 RequestBuffer
->AccountName
.MaximumLength
);
352 Ptr
= (LPWSTR
)((ULONG_PTR
)Ptr
+ RequestBuffer
->AccountName
.MaximumLength
);
354 /* Pack the old password */
355 RequestBuffer
->OldPassword
.Length
= wcslen(OldPassword
) * sizeof(WCHAR
);
356 RequestBuffer
->OldPassword
.MaximumLength
= RequestBuffer
->OldPassword
.Length
+ sizeof(WCHAR
);
357 RequestBuffer
->OldPassword
.Buffer
= Ptr
;
359 RtlCopyMemory(RequestBuffer
->OldPassword
.Buffer
,
361 RequestBuffer
->OldPassword
.MaximumLength
);
363 Ptr
= (LPWSTR
)((ULONG_PTR
)Ptr
+ RequestBuffer
->OldPassword
.MaximumLength
);
365 /* Pack the new password */
366 RequestBuffer
->NewPassword
.Length
= wcslen(NewPassword1
) * sizeof(WCHAR
);
367 RequestBuffer
->NewPassword
.MaximumLength
= RequestBuffer
->NewPassword
.Length
+ sizeof(WCHAR
);
368 RequestBuffer
->NewPassword
.Buffer
= Ptr
;
370 RtlCopyMemory(RequestBuffer
->NewPassword
.Buffer
,
372 RequestBuffer
->NewPassword
.MaximumLength
);
374 /* Connect to the LSA server */
375 if (!ConnectToLsa(pgContext
))
377 ERR("ConnectToLsa() failed\n");
381 /* Call the authentication package */
382 Status
= LsaCallAuthenticationPackage(pgContext
->LsaHandle
,
383 pgContext
->AuthenticationPackage
,
386 (PVOID
*)&ResponseBuffer
,
389 if (!NT_SUCCESS(Status
))
391 ERR("LsaCallAuthenticationPackage failed (Status 0x%08lx)\n", Status
);
395 if (!NT_SUCCESS(ProtocolStatus
))
397 TRACE("LsaCallAuthenticationPackage failed (ProtocolStatus 0x%08lx)\n", ProtocolStatus
);
403 ResourceMessageBox(pgContext
,
405 MB_OK
| MB_ICONINFORMATION
,
407 IDS_PASSWORDCHANGED
);
410 if (RequestBuffer
!= NULL
)
411 HeapFree(GetProcessHeap(), 0, RequestBuffer
);
413 if (ResponseBuffer
!= NULL
)
414 LsaFreeReturnBuffer(ResponseBuffer
);
420 static INT_PTR CALLBACK
421 ChangePasswordDialogProc(
427 PGINA_CONTEXT pgContext
;
429 pgContext
= (PGINA_CONTEXT
)GetWindowLongPtr(hwndDlg
, GWL_USERDATA
);
434 pgContext
= (PGINA_CONTEXT
)lParam
;
435 SetWindowLongPtr(hwndDlg
, GWL_USERDATA
, (DWORD_PTR
)pgContext
);
437 SetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_USERNAME
, pgContext
->UserName
);
438 SendDlgItemMessageW(hwndDlg
, IDC_CHANGEPWD_DOMAIN
, CB_ADDSTRING
, 0, (LPARAM
)pgContext
->Domain
);
439 SendDlgItemMessageW(hwndDlg
, IDC_CHANGEPWD_DOMAIN
, CB_SETCURSEL
, 0, 0);
440 SetFocus(GetDlgItem(hwndDlg
, IDC_CHANGEPWD_OLDPWD
));
444 switch (LOWORD(wParam
))
447 if (DoChangePassword(pgContext
, hwndDlg
))
449 EndDialog(hwndDlg
, TRUE
);
453 SetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_NEWPWD1
, NULL
);
454 SetDlgItemTextW(hwndDlg
, IDC_CHANGEPWD_NEWPWD2
, NULL
);
455 SetFocus(GetDlgItem(hwndDlg
, IDC_CHANGEPWD_OLDPWD
));
460 EndDialog(hwndDlg
, FALSE
);
466 EndDialog(hwndDlg
, FALSE
);
475 OnInitSecurityDlg(HWND hwnd
,
476 PGINA_CONTEXT pgContext
)
483 LoadStringW(pgContext
->hDllInstance
, IDS_LOGONMSG
, Buffer1
, 256);
485 wsprintfW(Buffer2
, L
"%s\\%s", pgContext
->Domain
, pgContext
->UserName
);
486 wsprintfW(Buffer4
, Buffer1
, Buffer2
);
488 SetDlgItemTextW(hwnd
, IDC_LOGONMSG
, Buffer4
);
490 LoadStringW(pgContext
->hDllInstance
, IDS_LOGONDATE
, Buffer1
, 256);
492 GetDateFormatW(LOCALE_USER_DEFAULT
, DATE_SHORTDATE
,
493 (SYSTEMTIME
*)&pgContext
->LogonTime
, NULL
, Buffer2
, 256);
495 GetTimeFormatW(LOCALE_USER_DEFAULT
, 0,
496 (SYSTEMTIME
*)&pgContext
->LogonTime
, NULL
, Buffer3
, 256);
498 wsprintfW(Buffer4
, Buffer1
, Buffer2
, Buffer3
);
500 SetDlgItemTextW(hwnd
, IDC_LOGONDATE
, Buffer4
);
502 if (pgContext
->bAutoAdminLogon
== TRUE
)
503 EnableWindow(GetDlgItem(hwnd
, IDC_LOGOFF
), FALSE
);
510 IN PGINA_CONTEXT pgContext
)
514 TRACE("OnChangePassword()\n");
516 res
= pgContext
->pWlxFuncs
->WlxDialogBoxParam(
518 pgContext
->hDllInstance
,
519 MAKEINTRESOURCEW(IDD_CHANGE_PASSWORD
),
521 ChangePasswordDialogProc
,
524 TRACE("Result: %x\n", res
);
530 static INT_PTR CALLBACK
543 switch (LOWORD(wParam
))
546 EndDialog(hwndDlg
, IDYES
);
550 EndDialog(hwndDlg
, IDNO
);
556 EndDialog(hwndDlg
, IDNO
);
568 IN PGINA_CONTEXT pgContext
)
570 return pgContext
->pWlxFuncs
->WlxDialogBoxParam(
572 pgContext
->hDllInstance
,
573 MAKEINTRESOURCEW(IDD_LOGOFF_DLG
),
580 static INT_PTR CALLBACK
587 PGINA_CONTEXT pgContext
;
589 pgContext
= (PGINA_CONTEXT
)GetWindowLongPtr(hwndDlg
, GWL_USERDATA
);
595 pgContext
= (PGINA_CONTEXT
)lParam
;
596 SetWindowLongPtr(hwndDlg
, GWL_USERDATA
, (DWORD_PTR
)pgContext
);
598 OnInitSecurityDlg(hwndDlg
, (PGINA_CONTEXT
)lParam
);
599 SetFocus(GetDlgItem(hwndDlg
, IDNO
));
605 switch (LOWORD(wParam
))
608 EndDialog(hwndDlg
, WLX_SAS_ACTION_LOCK_WKSTA
);
611 if (OnLogOff(hwndDlg
, pgContext
) == IDYES
)
612 EndDialog(hwndDlg
, WLX_SAS_ACTION_LOGOFF
);
615 EndDialog(hwndDlg
, WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
);
618 if (OnChangePassword(hwndDlg
, pgContext
))
619 EndDialog(hwndDlg
, WLX_SAS_ACTION_PWD_CHANGED
);
622 EndDialog(hwndDlg
, WLX_SAS_ACTION_TASKLIST
);
625 EndDialog(hwndDlg
, WLX_SAS_ACTION_NONE
);
632 EndDialog(hwndDlg
, WLX_SAS_ACTION_NONE
);
642 IN OUT PGINA_CONTEXT pgContext
,
647 TRACE("GUILoggedOnSAS()\n");
649 if (dwSasType
!= WLX_SAS_TYPE_CTRL_ALT_DEL
)
651 /* Nothing to do for WLX_SAS_TYPE_TIMEOUT ; the dialog will
652 * close itself thanks to the use of WlxDialogBoxParam */
653 return WLX_SAS_ACTION_NONE
;
656 pgContext
->pWlxFuncs
->WlxSwitchDesktopToWinlogon(
659 result
= pgContext
->pWlxFuncs
->WlxDialogBoxParam(
661 pgContext
->hDllInstance
,
662 MAKEINTRESOURCEW(IDD_LOGGEDON_DLG
),
667 if (result
< WLX_SAS_ACTION_LOGON
||
668 result
> WLX_SAS_ACTION_SWITCH_CONSOLE
)
670 result
= WLX_SAS_ACTION_NONE
;
673 if (result
== WLX_SAS_ACTION_NONE
)
675 pgContext
->pWlxFuncs
->WlxSwitchDesktopToUser(
682 static INT_PTR CALLBACK
689 PGINA_CONTEXT pgContext
;
691 pgContext
= (PGINA_CONTEXT
)GetWindowLongPtr(hwndDlg
, GWL_USERDATA
);
697 /* FIXME: take care of NoDomainUI */
698 pgContext
= (PGINA_CONTEXT
)lParam
;
699 SetWindowLongPtr(hwndDlg
, GWL_USERDATA
, (DWORD_PTR
)pgContext
);
701 if (pgContext
->bDontDisplayLastUserName
== FALSE
)
702 SetDlgItemTextW(hwndDlg
, IDC_USERNAME
, pgContext
->UserName
);
704 if (pgContext
->bDisableCAD
== TRUE
)
705 EnableWindow(GetDlgItem(hwndDlg
, IDCANCEL
), FALSE
);
707 if (pgContext
->bShutdownWithoutLogon
== FALSE
)
708 EnableWindow(GetDlgItem(hwndDlg
, IDC_SHUTDOWN
), FALSE
);
710 SetFocus(GetDlgItem(hwndDlg
, pgContext
->bDontDisplayLastUserName
? IDC_USERNAME
: IDC_PASSWORD
));
712 pgContext
->hBitmap
= LoadImage(hDllInstance
, MAKEINTRESOURCE(IDI_ROSLOGO
), IMAGE_BITMAP
, 0, 0, LR_DEFAULTCOLOR
);
719 if (pgContext
->hBitmap
)
721 hdc
= BeginPaint(hwndDlg
, &ps
);
722 DrawStateW(hdc
, NULL
, NULL
, (LPARAM
)pgContext
->hBitmap
, (WPARAM
)0, 0, 0, 0, 0, DST_BITMAP
);
723 EndPaint(hwndDlg
, &ps
);
729 DeleteObject(pgContext
->hBitmap
);
734 switch (LOWORD(wParam
))
738 LPWSTR UserName
= NULL
, Password
= NULL
;
739 INT result
= WLX_SAS_ACTION_NONE
;
741 if (GetTextboxText(hwndDlg
, IDC_USERNAME
, &UserName
) && *UserName
== '\0')
743 if (GetTextboxText(hwndDlg
, IDC_PASSWORD
, &Password
) &&
744 DoLoginTasks(pgContext
, UserName
, NULL
, Password
))
746 pgContext
->Password
= HeapAlloc(GetProcessHeap(),
748 (wcslen(Password
) + 1) * sizeof(WCHAR
));
749 if (pgContext
->Password
!= NULL
)
750 wcscpy(pgContext
->Password
, Password
);
752 result
= WLX_SAS_ACTION_LOGON
;
754 HeapFree(GetProcessHeap(), 0, UserName
);
755 HeapFree(GetProcessHeap(), 0, Password
);
756 EndDialog(hwndDlg
, result
);
761 EndDialog(hwndDlg
, WLX_SAS_ACTION_NONE
);
766 EndDialog(hwndDlg
, WLX_SAS_ACTION_SHUTDOWN
);
779 IN OUT PGINA_CONTEXT pgContext
)
783 TRACE("GUILoggedOutSAS()\n");
785 result
= pgContext
->pWlxFuncs
->WlxDialogBoxParam(
787 pgContext
->hDllInstance
,
788 MAKEINTRESOURCEW(IDD_LOGGEDOUT_DLG
),
792 if (result
>= WLX_SAS_ACTION_LOGON
&&
793 result
<= WLX_SAS_ACTION_SWITCH_CONSOLE
)
795 WARN("WlxLoggedOutSAS() returns 0x%x\n", result
);
799 WARN("WlxDialogBoxParam() failed (0x%x)\n", result
);
800 return WLX_SAS_ACTION_NONE
;
805 SetLockMessage(HWND hwnd
,
807 PGINA_CONTEXT pgContext
)
813 LoadStringW(pgContext
->hDllInstance
, IDS_LOCKMSG
, Buffer1
, 256);
815 wsprintfW(Buffer2
, L
"%s\\%s", pgContext
->Domain
, pgContext
->UserName
);
816 wsprintfW(Buffer3
, Buffer1
, Buffer2
);
818 SetDlgItemTextW(hwnd
, nDlgItem
, Buffer3
);
826 IN PGINA_CONTEXT pgContext
,
831 LPWSTR UserName
= NULL
;
832 LPWSTR Password
= NULL
;
835 if (GetTextboxText(hwndDlg
, IDC_USERNAME
, &UserName
) && *UserName
== '\0')
838 if (GetTextboxText(hwndDlg
, IDC_PASSWORD
, &Password
))
840 if (UserName
!= NULL
&& Password
!= NULL
&&
841 wcscmp(UserName
, pgContext
->UserName
) == 0 &&
842 wcscmp(Password
, pgContext
->Password
) == 0)
844 *Action
= WLX_SAS_ACTION_UNLOCK_WKSTA
;
847 else if (wcscmp(UserName
, pgContext
->UserName
) == 0 &&
848 wcscmp(Password
, pgContext
->Password
) != 0)
851 LoadStringW(pgContext
->hDllInstance
, IDS_LOCKEDWRONGPASSWORD
, Buffer2
, 256);
852 LoadStringW(pgContext
->hDllInstance
, IDS_COMPUTERLOCKED
, Buffer1
, 256);
853 MessageBoxW(hwndDlg
, Buffer2
, Buffer1
, MB_OK
| MB_ICONERROR
);
857 /* Wrong user name */
858 if (DoAdminUnlock(pgContext
, UserName
, NULL
, Password
))
860 *Action
= WLX_SAS_ACTION_UNLOCK_WKSTA
;
865 LoadStringW(pgContext
->hDllInstance
, IDS_LOCKEDWRONGUSER
, Buffer1
, 256);
866 wsprintfW(Buffer2
, Buffer1
, pgContext
->Domain
, pgContext
->UserName
);
867 LoadStringW(pgContext
->hDllInstance
, IDS_COMPUTERLOCKED
, Buffer1
, 256);
868 MessageBoxW(hwndDlg
, Buffer2
, Buffer1
, MB_OK
| MB_ICONERROR
);
873 if (UserName
!= NULL
)
874 HeapFree(GetProcessHeap(), 0, UserName
);
876 if (Password
!= NULL
)
877 HeapFree(GetProcessHeap(), 0, Password
);
892 PGINA_CONTEXT pgContext
;
893 INT result
= WLX_SAS_ACTION_NONE
;
895 pgContext
= (PGINA_CONTEXT
)GetWindowLongPtr(hwndDlg
, GWL_USERDATA
);
900 pgContext
= (PGINA_CONTEXT
)lParam
;
901 SetWindowLongPtr(hwndDlg
, GWL_USERDATA
, (DWORD_PTR
)pgContext
);
903 SetLockMessage(hwndDlg
, IDC_LOCKMSG
, pgContext
);
905 SetDlgItemTextW(hwndDlg
, IDC_USERNAME
, pgContext
->UserName
);
906 SetFocus(GetDlgItem(hwndDlg
, IDC_PASSWORD
));
908 if (pgContext
->bDisableCAD
== TRUE
)
909 EnableWindow(GetDlgItem(hwndDlg
, IDCANCEL
), FALSE
);
911 pgContext
->hBitmap
= LoadImage(hDllInstance
, MAKEINTRESOURCE(IDI_ROSLOGO
), IMAGE_BITMAP
, 0, 0, LR_DEFAULTCOLOR
);
918 if (pgContext
->hBitmap
)
920 hdc
= BeginPaint(hwndDlg
, &ps
);
921 DrawStateW(hdc
, NULL
, NULL
, (LPARAM
)pgContext
->hBitmap
, (WPARAM
)0, 0, 0, 0, 0, DST_BITMAP
);
922 EndPaint(hwndDlg
, &ps
);
927 DeleteObject(pgContext
->hBitmap
);
931 switch (LOWORD(wParam
))
934 if (DoUnlock(hwndDlg
, pgContext
, &result
))
935 EndDialog(hwndDlg
, result
);
939 EndDialog(hwndDlg
, WLX_SAS_ACTION_NONE
);
951 IN OUT PGINA_CONTEXT pgContext
)
955 TRACE("GUILockedSAS()\n");
957 result
= pgContext
->pWlxFuncs
->WlxDialogBoxParam(
959 pgContext
->hDllInstance
,
960 MAKEINTRESOURCEW(IDD_UNLOCK_DLG
),
964 if (result
>= WLX_SAS_ACTION_LOGON
&&
965 result
<= WLX_SAS_ACTION_SWITCH_CONSOLE
)
967 WARN("GUILockedSAS() returns 0x%x\n", result
);
971 WARN("GUILockedSAS() failed (0x%x)\n", result
);
972 return WLX_SAS_ACTION_NONE
;
976 static INT_PTR CALLBACK
983 PGINA_CONTEXT pgContext
;
985 pgContext
= (PGINA_CONTEXT
)GetWindowLongPtr(hwndDlg
, GWL_USERDATA
);
991 pgContext
= (PGINA_CONTEXT
)lParam
;
992 SetWindowLongPtr(hwndDlg
, GWL_USERDATA
, (DWORD_PTR
)pgContext
);
994 pgContext
->hBitmap
= LoadImage(hDllInstance
, MAKEINTRESOURCE(IDI_ROSLOGO
), IMAGE_BITMAP
, 0, 0, LR_DEFAULTCOLOR
);
995 SetLockMessage(hwndDlg
, IDC_LOCKMSG
, pgContext
);
1002 if (pgContext
->hBitmap
)
1004 hdc
= BeginPaint(hwndDlg
, &ps
);
1005 DrawStateW(hdc
, NULL
, NULL
, (LPARAM
)pgContext
->hBitmap
, (WPARAM
)0, 0, 0, 0, 0, DST_BITMAP
);
1006 EndPaint(hwndDlg
, &ps
);
1012 DeleteObject(pgContext
->hBitmap
);
1022 GUIDisplayLockedNotice(
1023 IN OUT PGINA_CONTEXT pgContext
)
1025 TRACE("GUIdisplayLockedNotice()\n");
1027 pgContext
->pWlxFuncs
->WlxDialogBoxParam(
1029 pgContext
->hDllInstance
,
1030 MAKEINTRESOURCEW(IDD_LOCKED_DLG
),
1036 GINA_UI GinaGraphicalUI
= {
1038 GUIDisplayStatusMessage
,
1039 GUIRemoveStatusMessage
,
1040 GUIDisplaySASNotice
,
1044 GUIDisplayLockedNotice
,