ReactOS 0.4.17-dev-934-g091855f
gui.c File Reference
#include "msgina.h"
#include <wingdi.h>
#include <winnls.h>
#include <ndk/exfuncs.h>
#include <reactos/rosbrand.h>
Include dependency graph for gui.c:

Go to the source code of this file.

Classes

struct  _DISPLAYSTATUSMSG
 
struct  _LEGALNOTICEDATA
 
struct  _DLG_DATA
 

Macros

#define IDT_BAR   1
 
#define ISKEYDOWN(x)   (GetKeyState(x) & 0x8000)
 

Typedefs

typedef struct _DISPLAYSTATUSMSG DISPLAYSTATUSMSG
 
typedef struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
 
typedef struct _LEGALNOTICEDATA LEGALNOTICEDATA
 
typedef struct _LEGALNOTICEDATA * PLEGALNOTICEDATA
 
typedef struct _DLG_DATA DLG_DATA
 
typedef struct _DLG_DATA * PDLG_DATA
 

Functions

static PDLG_DATA DlgData_Create (HWND hwndDlg, PGINA_CONTEXT pgContext)
 
static VOID DlgData_Destroy (_Inout_ HWND hwndDlg)
 
static VOID LoadBrandingBitmaps (VOID)
 
BOOL DrawBrandingBitmap (_Inout_ LPDRAWITEMSTRUCT DrawItem, _Inout_ HBITMAP *BitmapHandle)
 
BOOL DrawScrollingBrandingBitmap (_Inout_ LPDRAWITEMSTRUCT DrawItem, _Inout_ HBITMAP *BitmapHandle, _In_ PDWORD ScrollCounter)
 
static BOOL GUIInitialize (IN OUT PGINA_CONTEXT pgContext)
 
static VOID SetWelcomeText (HWND hWnd)
 
static VOID AdjustStatusMessageWindow (HWND hwndDlg)
 
static INT_PTR CALLBACK StatusDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static DWORD WINAPI StartupWindowThread (LPVOID lpParam)
 
static BOOL GUIDisplayStatusMessage (IN PGINA_CONTEXT pgContext, IN HDESK hDesktop, IN DWORD dwOptions, IN PWSTR pTitle, IN PWSTR pMessage)
 
static BOOL GUIRemoveStatusMessage (IN PGINA_CONTEXT pgContext)
 
static INT_PTR CALLBACK WelcomeDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID GUIDisplaySASNotice (IN OUT PGINA_CONTEXT pgContext)
 
static BOOL GetTextboxText (IN HWND hwndDlg, IN INT TextboxId, OUT LPWSTR *pText)
 
static INT ResourceMessageBox (IN PGINA_CONTEXT pgContext, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
 
static BOOL DoChangePassword (IN PGINA_CONTEXT pgContext, IN HWND hwndDlg)
 
static INT_PTR CALLBACK ChangePasswordDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID OnInitSecurityDlg (_In_ HWND hwnd, _In_ PGINA_CONTEXT pgContext)
 
static BOOL OnChangePassword (IN HWND hwnd, IN PGINA_CONTEXT pgContext)
 
static INT_PTR CALLBACK LogOffDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT OnLogOff (IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
 
static INT OnShutDown (_In_ HWND hwndDlg, _In_ PGINA_CONTEXT pgContext, _In_ DWORD dwExcludeOptions)
 
static INT_PTR CALLBACK SecurityDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT GUILoggedOnSAS (IN OUT PGINA_CONTEXT pgContext, IN DWORD dwSasType)
 
static BOOL DoLogon (IN HWND hwndDlg, IN OUT PGINA_CONTEXT pgContext)
 
static VOID SetDomainComboBox (HWND hwndDomainComboBox, PGINA_CONTEXT pgContext)
 
static INT_PTR CALLBACK LogonDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT_PTR CALLBACK LegalNoticeDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT GUILoggedOutSAS (IN OUT PGINA_CONTEXT pgContext)
 
static VOID SetLockMessage (HWND hwnd, INT nDlgItem, PGINA_CONTEXT pgContext)
 
static BOOL DoUnlock (IN HWND hwndDlg, IN PGINA_CONTEXT pgContext, OUT LPINT Action)
 
static INT_PTR CALLBACK UnlockDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static INT GUILockedSAS (IN OUT PGINA_CONTEXT pgContext)
 
static INT_PTR CALLBACK LockedDialogProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID GUIDisplayLockedNotice (IN OUT PGINA_CONTEXT pgContext)
 

Variables

HBITMAP hBanner = NULL
 
HBITMAP hBannerLine = NULL
 
GINA_UI GinaGraphicalUI
 

Macro Definition Documentation

◆ IDT_BAR

#define IDT_BAR   1

Definition at line 33 of file gui.c.

◆ ISKEYDOWN

#define ISKEYDOWN (   x)    (GetKeyState(x) & 0x8000)

Definition at line 35 of file gui.c.

Typedef Documentation

◆ DISPLAYSTATUSMSG

◆ DLG_DATA

◆ LEGALNOTICEDATA

◆ PDISPLAYSTATUSMSG

◆ PDLG_DATA

◆ PLEGALNOTICEDATA

Function Documentation

◆ AdjustStatusMessageWindow()

static VOID AdjustStatusMessageWindow ( HWND  hwndDlg)
static

Definition at line 224 of file gui.c.

225{
226 INT xOld, yOld, cxOld, cyOld;
227 INT xNew, yNew, cxNew, cyNew;
228 INT cxLabel, cyLabel, dyLabel;
229 RECT rc, rcBar, rcLabel, rcWnd;
230 BITMAP bmLogo, bmBar;
231 DWORD style, exstyle;
232 HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
233 HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
234 HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUS_MESSAGE);
235
236 /* This adjustment is for CJK only */
238 {
239 case LANG_CHINESE:
240 case LANG_JAPANESE:
241 case LANG_KOREAN:
242 break;
243
244 default:
245 return;
246 }
247
248 if (!GetObjectW(hBanner, sizeof(BITMAP), &bmLogo) ||
249 !GetObjectW(hBannerLine, sizeof(BITMAP), &bmBar))
250 {
251 return;
252 }
253
254 GetWindowRect(hwndBar, &rcBar);
255 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
256 dyLabel = bmLogo.bmHeight - rcBar.top;
257
258 GetWindowRect(hwndLabel, &rcLabel);
259 MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
260 cxLabel = rcLabel.right - rcLabel.left;
261 cyLabel = rcLabel.bottom - rcLabel.top;
262
263 MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
264 MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
265 MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
266
267 GetWindowRect(hwndDlg, &rcWnd);
268 xOld = rcWnd.left;
269 yOld = rcWnd.top;
270 cxOld = rcWnd.right - rcWnd.left;
271 cyOld = rcWnd.bottom - rcWnd.top;
272
273 GetClientRect(hwndDlg, &rc);
274 SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
275
277 exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
278 AdjustWindowRectEx(&rc, style, FALSE, exstyle);
279
280 cxNew = rc.right - rc.left;
281 cyNew = (rc.bottom - rc.top) + dyLabel;
282 xNew = xOld - (cxNew - cxOld) / 2;
283 yNew = yOld - (cyNew - cyOld) / 2;
284 MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
285}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1182
HBITMAP hBannerLine
Definition: gui.c:45
HBITMAP hBanner
Definition: gui.c:44
#define IDC_ROSLOGO
Definition: resource.h:69
#define IDC_STATUS_MESSAGE
Definition: resource.h:6
#define IDC_BAR
Definition: resource.h:70
static INT cxOld
Definition: eventvwr.c:4341
static INT cyOld
Definition: eventvwr.c:4341
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DWORD
Definition: nt_native.h:44
#define GetWindowLongPtrW
Definition: winuser.h:4983
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define GWL_EXSTYLE
Definition: winuser.h:862
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
Definition: style.c:91
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
int32_t INT
Definition: typedefs.h:58
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

Referenced by StatusDialogProc().

◆ ChangePasswordDialogProc()

static INT_PTR CALLBACK ChangePasswordDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 765 of file gui.c.

770{
771 PGINA_CONTEXT pgContext;
772
773 pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
774
775 switch (uMsg)
776 {
777 case WM_INITDIALOG:
778 {
779 pgContext = (PGINA_CONTEXT)lParam;
780 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
781
782 SetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, pgContext->UserName);
786 return FALSE; // Default focus is changed.
787 }
788
789 case WM_DRAWITEM:
790 {
792 if (lpDis->CtlID == IDC_ROSLOGO)
793 return DrawBrandingBitmap(lpDis, &hBanner);
794 /* This dialog doesn't have IDC_BAR */
795 return FALSE;
796 }
797
798 case WM_COMMAND:
799 switch (LOWORD(wParam))
800 {
801 case IDOK:
802 if (DoChangePassword(pgContext, hwndDlg))
803 {
804 EndDialog(hwndDlg, TRUE);
805 }
806 else
807 {
812 }
813 return TRUE;
814
815 case IDCANCEL:
816 EndDialog(hwndDlg, FALSE);
817 return TRUE;
818 }
819 break;
820
821 case WM_CLOSE:
822 EndDialog(hwndDlg, FALSE);
823 return TRUE;
824 }
825
826 return FALSE;
827}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
BOOL DrawBrandingBitmap(_Inout_ LPDRAWITEMSTRUCT DrawItem, _Inout_ HBITMAP *BitmapHandle)
Definition: gui.c:95
static BOOL DoChangePassword(IN PGINA_CONTEXT pgContext, IN HWND hwndDlg)
Definition: gui.c:596
#define IDC_CHANGEPWD_USERNAME
Definition: resource.h:35
#define IDC_CHANGEPWD_OLDPWD
Definition: resource.h:37
#define IDC_CHANGEPWD_DOMAIN
Definition: resource.h:36
#define IDC_CHANGEPWD_NEWPWD2
Definition: resource.h:39
#define IDC_CHANGEPWD_NEWPWD1
Definition: resource.h:38
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
struct GINA_CONTEXT * PGINA_CONTEXT
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define WM_CLOSE
Definition: winuser.h:1649
#define IDCANCEL
Definition: winuser.h:842
#define WM_COMMAND
Definition: winuser.h:1768
#define CB_SETCURSEL
Definition: winuser.h:1990
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_INITDIALOG
Definition: winuser.h:1767
#define IDOK
Definition: winuser.h:841
#define WM_DRAWITEM
Definition: winuser.h:1673
#define WM_NEXTDLGCTL
Definition: winuser.h:1671
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define CB_ADDSTRING
Definition: winuser.h:1965
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WCHAR DomainName[256]
Definition: msgina.h:52
WCHAR UserName[256]
Definition: msgina.h:51
#define GWLP_USERDATA
Definition: treelist.c:63

Referenced by OnChangePassword().

◆ DlgData_Create()

static PDLG_DATA DlgData_Create ( HWND  hwndDlg,
PGINA_CONTEXT  pgContext 
)
static

Definition at line 48 of file gui.c.

49{
50 PDLG_DATA pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pDlgData));
51 if (pDlgData)
52 {
53 pDlgData->pgContext = pgContext;
54 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
55 }
56 return pDlgData;
57}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
Definition: gui.c:38
PGINA_CONTEXT pgContext
Definition: gui.c:39

Referenced by StatusDialogProc().

◆ DlgData_Destroy()

static VOID DlgData_Destroy ( _Inout_ HWND  hwndDlg)
static

Definition at line 60 of file gui.c.

61{
62 PDLG_DATA pDlgData;
63
64 pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
65 if (!pDlgData)
66 {
67 return;
68 }
69
71
72 HeapFree(GetProcessHeap(), 0, pDlgData);
73}
#define HeapFree(x, y, z)
Definition: compat.h:735
struct _DLG_DATA * PDLG_DATA

Referenced by StatusDialogProc().

◆ DoChangePassword()

static BOOL DoChangePassword ( IN PGINA_CONTEXT  pgContext,
IN HWND  hwndDlg 
)
static

Definition at line 596 of file gui.c.

599{
600 WCHAR UserName[256];
601 WCHAR Domain[256];
602 WCHAR OldPassword[256];
603 WCHAR NewPassword1[256];
604 WCHAR NewPassword2[256];
605 PMSV1_0_CHANGEPASSWORD_REQUEST RequestBuffer = NULL;
606 PMSV1_0_CHANGEPASSWORD_RESPONSE ResponseBuffer = NULL;
607 ULONG RequestBufferSize;
608 ULONG ResponseBufferSize = 0;
609 LPWSTR Ptr;
610 BOOL res = FALSE;
613
614 GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, UserName, _countof(UserName));
616 GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_OLDPWD, OldPassword, _countof(OldPassword));
617 GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD1, NewPassword1, _countof(NewPassword1));
618 GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD2, NewPassword2, _countof(NewPassword2));
619
620 /* Compare the two passwords and fail if they do not match */
621 if (wcscmp(NewPassword1, NewPassword2) != 0)
622 {
623 ResourceMessageBox(pgContext,
624 hwndDlg,
628 goto done;
629 }
630
631 /* Calculate the request buffer size */
632 RequestBufferSize = sizeof(MSV1_0_CHANGEPASSWORD_REQUEST) +
633 ((wcslen(Domain) + 1) * sizeof(WCHAR)) +
634 ((wcslen(UserName) + 1) * sizeof(WCHAR)) +
635 ((wcslen(OldPassword) + 1) * sizeof(WCHAR)) +
636 ((wcslen(NewPassword1) + 1) * sizeof(WCHAR));
637
638 /* Allocate the request buffer */
639 RequestBuffer = HeapAlloc(GetProcessHeap(),
641 RequestBufferSize);
642 if (RequestBuffer == NULL)
643 {
644 ERR("HeapAlloc failed\n");
645 goto done;
646 }
647
648 /* Initialize the request buffer */
649 RequestBuffer->MessageType = MsV1_0ChangePassword;
650 RequestBuffer->Impersonating = TRUE;
651
652 Ptr = (LPWSTR)((ULONG_PTR)RequestBuffer + sizeof(MSV1_0_CHANGEPASSWORD_REQUEST));
653
654 /* Pack the domain name */
655 RequestBuffer->DomainName.Length = (USHORT)wcslen(Domain) * sizeof(WCHAR);
656 RequestBuffer->DomainName.MaximumLength = RequestBuffer->DomainName.Length + sizeof(WCHAR);
657 RequestBuffer->DomainName.Buffer = Ptr;
658
659 RtlCopyMemory(RequestBuffer->DomainName.Buffer,
660 Domain,
661 RequestBuffer->DomainName.MaximumLength);
662
663 Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->DomainName.MaximumLength);
664
665 /* Pack the user name */
666 RequestBuffer->AccountName.Length = (USHORT)wcslen(UserName) * sizeof(WCHAR);
667 RequestBuffer->AccountName.MaximumLength = RequestBuffer->AccountName.Length + sizeof(WCHAR);
668 RequestBuffer->AccountName.Buffer = Ptr;
669
670 RtlCopyMemory(RequestBuffer->AccountName.Buffer,
671 UserName,
672 RequestBuffer->AccountName.MaximumLength);
673
674 Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->AccountName.MaximumLength);
675
676 /* Pack the old password */
677 RequestBuffer->OldPassword.Length = (USHORT)wcslen(OldPassword) * sizeof(WCHAR);
678 RequestBuffer->OldPassword.MaximumLength = RequestBuffer->OldPassword.Length + sizeof(WCHAR);
679 RequestBuffer->OldPassword.Buffer = Ptr;
680
681 RtlCopyMemory(RequestBuffer->OldPassword.Buffer,
682 OldPassword,
683 RequestBuffer->OldPassword.MaximumLength);
684
685 Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->OldPassword.MaximumLength);
686
687 /* Pack the new password */
688 RequestBuffer->NewPassword.Length = (USHORT)wcslen(NewPassword1) * sizeof(WCHAR);
689 RequestBuffer->NewPassword.MaximumLength = RequestBuffer->NewPassword.Length + sizeof(WCHAR);
690 RequestBuffer->NewPassword.Buffer = Ptr;
691
692 RtlCopyMemory(RequestBuffer->NewPassword.Buffer,
693 NewPassword1,
694 RequestBuffer->NewPassword.MaximumLength);
695
696 /* Connect to the LSA server */
697 if (ConnectToLsa(pgContext) != ERROR_SUCCESS)
698 {
699 ERR("ConnectToLsa() failed\n");
700 goto done;
701 }
702
703 /* Call the authentication package */
704 Status = LsaCallAuthenticationPackage(pgContext->LsaHandle,
705 pgContext->AuthenticationPackage,
706 RequestBuffer,
707 RequestBufferSize,
708 (PVOID*)&ResponseBuffer,
709 &ResponseBufferSize,
711 if (!NT_SUCCESS(Status))
712 {
713 ERR("LsaCallAuthenticationPackage failed (Status 0x%08lx)\n", Status);
714 goto done;
715 }
716
718 {
719 TRACE("LsaCallAuthenticationPackage failed (ProtocolStatus 0x%08lx)\n", ProtocolStatus);
720 goto done;
721 }
722
723 res = TRUE;
724
725 ResourceMessageBox(pgContext,
726 hwndDlg,
730
731 if ((wcscmp(UserName, pgContext->UserName) == 0) &&
732 (wcscmp(Domain, pgContext->DomainName) == 0) &&
733 (wcscmp(OldPassword, pgContext->Password) == 0))
734 {
735 SecureZeroMemory(pgContext->Password, sizeof(pgContext->Password));
736 wcscpy(pgContext->Password, NewPassword1);
737 }
738
739done:
740 /* Zero out the password buffers */
741 SecureZeroMemory(&OldPassword, sizeof(OldPassword));
742 SecureZeroMemory(&NewPassword1, sizeof(NewPassword1));
743 SecureZeroMemory(&NewPassword2, sizeof(NewPassword2));
744
745 if (RequestBuffer != NULL)
746 {
747 /* Zero out the password buffers before freeing them */
748 SecureZeroMemory(RequestBuffer->OldPassword.Buffer,
749 RequestBuffer->OldPassword.MaximumLength);
750 SecureZeroMemory(&RequestBuffer->OldPassword, sizeof(RequestBuffer->OldPassword));
751 SecureZeroMemory(RequestBuffer->NewPassword.Buffer,
752 RequestBuffer->NewPassword.MaximumLength);
753 SecureZeroMemory(&RequestBuffer->NewPassword, sizeof(RequestBuffer->NewPassword));
754 HeapFree(GetProcessHeap(), 0, RequestBuffer);
755 }
756
757 if (ResponseBuffer != NULL)
758 LsaFreeReturnBuffer(ResponseBuffer);
759
760 return res;
761}
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
static INT ResourceMessageBox(IN PGINA_CONTEXT pgContext, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
Definition: gui.c:573
NTSTATUS ConnectToLsa(PGINA_CONTEXT pgContext)
Definition: lsa.c:11
#define IDS_CHANGEPWDTITLE
Definition: resource.h:97
#define IDS_NONMATCHINGPASSWORDS
Definition: resource.h:98
#define IDS_PASSWORDCHANGED
Definition: resource.h:99
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
unsigned int BOOL
Definition: ntddk_ex.h:94
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
Status
Definition: gdiplustypes.h:24
GLuint res
Definition: glext.h:9613
VOID NTAPI ProtocolStatus(NDIS_HANDLE BindingContext, NDIS_STATUS GenerelStatus, PVOID StatusBuffer, UINT StatusBufferSize)
Called by NDIS when the underlying driver has changed state.
Definition: lan.c:461
_In_ ULONG Domain
Definition: haltypes.h:1814
short WCHAR
Definition: pedump.c:58
unsigned short USHORT
Definition: pedump.c:61
struct _MSV1_0_CHANGEPASSWORD_REQUEST MSV1_0_CHANGEPASSWORD_REQUEST
@ MsV1_0ChangePassword
Definition: ntsecapi.h:223
NTSTATUS NTAPI LsaCallAuthenticationPackage(HANDLE, ULONG, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS)
NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID)
#define MB_ICONEXCLAMATION
Definition: winuser.h:796
#define MB_OK
Definition: winuser.h:801
#define MB_ICONINFORMATION
Definition: winuser.h:813
wcscpy
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
USHORT MaximumLength
Definition: ntsecapi.h:164
MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType
Definition: ntsecapi.h:511
UNICODE_STRING AccountName
Definition: ntsecapi.h:513
UNICODE_STRING NewPassword
Definition: ntsecapi.h:515
UNICODE_STRING OldPassword
Definition: ntsecapi.h:514
uint16_t * LPWSTR
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2283
#define SecureZeroMemory
Definition: winbase.h:1441

Referenced by ChangePasswordDialogProc().

◆ DoLogon()

static BOOL DoLogon ( IN HWND  hwndDlg,
IN OUT PGINA_CONTEXT  pgContext 
)
static

Definition at line 1186 of file gui.c.

1189{
1190 LPWSTR UserName = NULL;
1192 LPWSTR Domain = NULL;
1193 BOOL result = FALSE;
1195
1196 if (GetTextboxText(hwndDlg, IDC_LOGON_USERNAME, &UserName) && *UserName == '\0')
1197 goto done;
1198
1199 if (GetTextboxText(hwndDlg, IDC_LOGON_DOMAIN, &Domain) && *Domain == '\0')
1200 goto done;
1201
1203 goto done;
1204
1205 Status = DoLoginTasks(pgContext, UserName, Domain, Password, &SubStatus);
1207 {
1208 ResourceMessageBox(pgContext,
1209 hwndDlg,
1213 goto done;
1214 }
1216 {
1217 TRACE("DoLoginTasks failed! Status 0x%08lx SubStatus 0x%08lx\n", Status, SubStatus);
1218
1220 {
1221 ResourceMessageBox(pgContext,
1222 hwndDlg,
1226 goto done;
1227 }
1229 {
1230 TRACE("Account locked!\n");
1231 ResourceMessageBox(pgContext,
1232 hwndDlg,
1236 goto done;
1237 }
1238 else if ((SubStatus == STATUS_PASSWORD_MUST_CHANGE) ||
1240 {
1242 {
1243 ResourceMessageBox(pgContext,
1244 hwndDlg,
1248 }
1249 else
1250 {
1251 ResourceMessageBox(pgContext,
1252 hwndDlg,
1256 }
1257
1258 if (!OnChangePassword(hwndDlg, pgContext))
1259 goto done;
1260
1261 Status = DoLoginTasks(pgContext,
1262 pgContext->UserName,
1263 pgContext->DomainName,
1264 pgContext->Password,
1265 &SubStatus);
1266 if (!NT_SUCCESS(Status))
1267 {
1268 TRACE("Login after password change failed! (Status 0x%08lx)\n", Status);
1269 goto done;
1270 }
1271 }
1273 {
1274 ResourceMessageBox(pgContext,
1275 hwndDlg,
1279 }
1281 {
1282 ResourceMessageBox(pgContext,
1283 hwndDlg,
1287 goto done;
1288 }
1290 {
1291 ResourceMessageBox(pgContext,
1292 hwndDlg,
1296 goto done;
1297 }
1298 else
1299 {
1300 TRACE("Other error!\n");
1301 ResourceMessageBox(pgContext,
1302 hwndDlg,
1306 goto done;
1307 }
1308 }
1309 else if (!NT_SUCCESS(Status))
1310 {
1311 TRACE("DoLoginTasks failed! Status 0x%08lx\n", Status);
1312 goto done;
1313 }
1314
1315 if (!CreateProfile(pgContext, UserName, Domain, Password))
1316 {
1317 ERR("Failed to create the profile!\n");
1318 goto done;
1319 }
1320
1321 SecureZeroMemory(pgContext->Password, sizeof(pgContext->Password));
1322 wcscpy(pgContext->Password, Password);
1323
1324 result = TRUE;
1325
1326done:
1327 pgContext->bAutoAdminLogon = FALSE;
1328
1329 if (UserName != NULL)
1330 HeapFree(GetProcessHeap(), 0, UserName);
1331
1332 if (Password != NULL)
1333 {
1334 /* Zero out the password buffer before freeing it */
1335 SIZE_T pwdLen = (wcslen(Password) + 1) * sizeof(WCHAR);
1336 SecureZeroMemory(Password, pwdLen);
1338 }
1339
1340 if (Domain != NULL)
1342
1343 return result;
1344}
static BOOL GetTextboxText(IN HWND hwndDlg, IN INT TextboxId, OUT LPWSTR *pText)
Definition: gui.c:549
static BOOL OnChangePassword(IN HWND hwnd, IN PGINA_CONTEXT pgContext)
Definition: gui.c:934
#define IDS_ACCOUNTLOCKED
Definition: resource.h:106
#define IDS_INVALIDLOGONHOURS
Definition: resource.h:107
#define IDS_LOGONWRONGUSERORPWD
Definition: resource.h:101
#define IDS_PASSWORDMUSTCHANGE
Definition: resource.h:103
#define IDS_LOGONTITLE
Definition: resource.h:100
#define IDS_INVALIDWORKSTATION
Definition: resource.h:108
#define IDC_LOGON_DOMAIN
Definition: resource.h:14
#define IDS_PASSWORDEXPIRED
Definition: resource.h:104
#define IDC_LOGON_PASSWORD
Definition: resource.h:13
#define IDS_LOGONUSERDISABLED
Definition: resource.h:102
#define IDS_ACCOUNTEXPIRED
Definition: resource.h:105
#define IDC_LOGON_USERNAME
Definition: resource.h:12
#define IDS_ACCOUNTRESTRICTION
Definition: resource.h:109
GLuint64EXT * result
Definition: glext.h:11304
BOOL CreateProfile(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:759
NTSTATUS DoLoginTasks(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password, OUT PNTSTATUS SubStatus)
Definition: msgina.c:726
_IRQL_requires_same_ _In_ PLSA_STRING _In_ SECURITY_LOGON_TYPE _In_ ULONG _In_ ULONG _In_opt_ PTOKEN_GROUPS _In_ PTOKEN_SOURCE _Out_ PVOID _Out_ PULONG _Inout_ PLUID _Out_ PHANDLE _Out_ PQUOTA_LIMITS _Out_ PNTSTATUS SubStatus
#define STATUS_INVALID_LOGON_HOURS
Definition: ntstatus.h:441
#define STATUS_ACCOUNT_DISABLED
Definition: ntstatus.h:444
#define STATUS_PASSWORD_MUST_CHANGE
Definition: ntstatus.h:802
#define STATUS_PASSWORD_EXPIRED
Definition: ntstatus.h:443
#define STATUS_INVALID_WORKSTATION
Definition: ntstatus.h:442
#define STATUS_ACCOUNT_EXPIRED
Definition: ntstatus.h:730
#define STATUS_ACCOUNT_LOCKED_OUT
Definition: ntstatus.h:818
#define STATUS_LOGON_FAILURE
Definition: ntstatus.h:439
#define STATUS_ACCOUNT_RESTRICTION
Definition: ntstatus.h:440
#define MB_ICONERROR
Definition: winuser.h:798
#define MB_ICONSTOP
Definition: winuser.h:814
#define STATUS_SUCCESS
Definition: shellext.h:65
@ Password
Definition: telnetd.h:67
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by LogonDialogProc().

◆ DoUnlock()

static BOOL DoUnlock ( IN HWND  hwndDlg,
IN PGINA_CONTEXT  pgContext,
OUT LPINT  Action 
)
static

Definition at line 1605 of file gui.c.

1609{
1610 WCHAR Buffer1[256];
1611 WCHAR Buffer2[256];
1612 LPWSTR UserName = NULL;
1614 BOOL res = FALSE;
1615
1616 if (GetTextboxText(hwndDlg, IDC_UNLOCK_USERNAME, &UserName) && *UserName == '\0')
1617 {
1618 HeapFree(GetProcessHeap(), 0, UserName);
1619 return FALSE;
1620 }
1621
1623 {
1624 if (UserName != NULL && Password != NULL &&
1625 wcscmp(UserName, pgContext->UserName) == 0 &&
1626 wcscmp(Password, pgContext->Password) == 0)
1627 {
1629 res = TRUE;
1630 }
1631 else if (wcscmp(UserName, pgContext->UserName) == 0 &&
1632 wcscmp(Password, pgContext->Password) != 0)
1633 {
1634 /* Wrong Password */
1635 LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGPASSWORD, Buffer2, _countof(Buffer2));
1636 LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, _countof(Buffer1));
1637 MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
1638 }
1639 else
1640 {
1641 /* Wrong user name */
1642 if (DoAdminUnlock(pgContext, UserName, NULL, Password))
1643 {
1645 res = TRUE;
1646 }
1647 else
1648 {
1649 LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGUSER, Buffer1, _countof(Buffer1));
1650 wsprintfW(Buffer2, Buffer1, pgContext->DomainName, pgContext->UserName);
1651 LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, _countof(Buffer1));
1652 MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
1653 }
1654 }
1655 }
1656
1657 if (UserName != NULL)
1658 HeapFree(GetProcessHeap(), 0, UserName);
1659
1660 if (Password != NULL)
1661 {
1662 /* Zero out the password buffer before freeing it */
1663 SIZE_T pwdLen = (wcslen(Password) + 1) * sizeof(WCHAR);
1664 SecureZeroMemory(Password, pwdLen);
1666 }
1667
1668 return res;
1669}
#define IDS_COMPUTERLOCKED
Definition: resource.h:94
#define IDS_LOCKEDWRONGUSER
Definition: resource.h:96
#define IDC_UNLOCK_USERNAME
Definition: resource.h:31
#define IDS_LOCKEDWRONGPASSWORD
Definition: resource.h:95
#define IDC_UNLOCK_PASSWORD
Definition: resource.h:32
BOOL DoAdminUnlock(IN PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:639
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define LoadStringW
Definition: utils.h:64
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
#define WLX_SAS_ACTION_UNLOCK_WKSTA
Definition: winwlx.h:60

Referenced by UnlockDialogProc().

◆ DrawBrandingBitmap()

BOOL DrawBrandingBitmap ( _Inout_ LPDRAWITEMSTRUCT  DrawItem,
_Inout_ HBITMAP *  BitmapHandle 
)

Definition at line 95 of file gui.c.

98{
99 HGDIOBJ hOld;
100 HDC hdcMem;
101 BITMAP bm;
102
103 if (!*BitmapHandle)
104 {
106 if (!*BitmapHandle)
107 return FALSE;
108 }
109
110 hdcMem = CreateCompatibleDC(DrawItem->hDC);
111 if (!hdcMem)
112 return FALSE;
113
114 GetObject(*BitmapHandle, sizeof(bm), &bm);
115 hOld = SelectObject(hdcMem, *BitmapHandle);
116 BitBlt(DrawItem->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
117 SelectObject(hdcMem, hOld);
119 return TRUE;
120}
static VOID LoadBrandingBitmaps(VOID)
Definition: gui.c:76
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
static HDC
Definition: imagelist.c:88
HDC hdcMem
Definition: welcome.c:104
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define SRCCOPY
Definition: wingdi.h:333
#define GetObject
Definition: wingdi.h:4914
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by ChangePasswordDialogProc(), LegalNoticeDialogProc(), LockedDialogProc(), LogOffDialogProc(), LogonDialogProc(), SecurityDialogProc(), ShutdownDialogProc(), StatusDialogProc(), UnlockDialogProc(), and WelcomeDialogProc().

◆ DrawScrollingBrandingBitmap()

BOOL DrawScrollingBrandingBitmap ( _Inout_ LPDRAWITEMSTRUCT  DrawItem,
_Inout_ HBITMAP *  BitmapHandle,
_In_ PDWORD  ScrollCounter 
)

Definition at line 123 of file gui.c.

128{
129 HGDIOBJ hOld;
130 HDC hdcMem;
131 BITMAP bm;
132
133 if (!*BitmapHandle)
134 {
136 if (!*BitmapHandle)
137 return FALSE;
138 }
139
140 if (GetObject(*BitmapHandle, sizeof(bm), &bm) != sizeof(bm))
141 return FALSE;
142
143 hdcMem = CreateCompatibleDC(DrawItem->hDC);
144 if (!hdcMem)
145 return FALSE;
146
147 *ScrollCounter %= bm.bmWidth;
148 hOld = SelectObject(hdcMem, *BitmapHandle);
149 BitBlt(DrawItem->hDC, *ScrollCounter, 0, bm.bmWidth - *ScrollCounter, bm.bmHeight, hdcMem, 0, 0, SRCCOPY);
150 BitBlt(DrawItem->hDC, 0, 0, *ScrollCounter, bm.bmHeight, hdcMem, bm.bmWidth - *ScrollCounter, 0, SRCCOPY);
151 SelectObject(hdcMem, hOld);
153 return TRUE;
154}
static CHAR ScrollCounter
Definition: mouse.c:42

Referenced by StatusDialogProc().

◆ GetTextboxText()

static BOOL GetTextboxText ( IN HWND  hwndDlg,
IN INT  TextboxId,
OUT LPWSTR *  pText 
)
static

Definition at line 549 of file gui.c.

553{
554 LPWSTR Text;
555 int Count;
556
557 Count = GetWindowTextLength(GetDlgItem(hwndDlg, TextboxId));
558 Text = HeapAlloc(GetProcessHeap(), 0, (Count + 1) * sizeof(WCHAR));
559 if (!Text)
560 return FALSE;
561 if (Count != GetWindowTextW(GetDlgItem(hwndDlg, TextboxId), Text, Count + 1))
562 {
564 return FALSE;
565 }
566 *pText = Text;
567 return TRUE;
568}
char * Text
Definition: combotst.c:136
int Count
Definition: noreturn.cpp:7
#define GetWindowTextLength
Definition: winuser.h:5965
LPCSTR pText
Definition: txtscale.cpp:79
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382

Referenced by DoLogon(), and DoUnlock().

◆ GUIDisplayLockedNotice()

static VOID GUIDisplayLockedNotice ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1811 of file gui.c.

1813{
1814 pgContext->pWlxFuncs->WlxDialogBoxParam(
1815 pgContext->hWlx,
1816 pgContext->hDllInstance,
1820 (LPARAM)pgContext);
1821}
static INT_PTR CALLBACK LockedDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1770
#define IDD_LOCKED
Definition: resource.h:26
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ GUIDisplaySASNotice()

static VOID GUIDisplaySASNotice ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 534 of file gui.c.

536{
537 /* Display the notice window */
538 pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
539 pgContext->hDllInstance,
543 (LPARAM)pgContext);
544}
static INT_PTR CALLBACK WelcomeDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:508
#define IDD_WELCOME
Definition: resource.h:8

◆ GUIDisplayStatusMessage()

static BOOL GUIDisplayStatusMessage ( IN PGINA_CONTEXT  pgContext,
IN HDESK  hDesktop,
IN DWORD  dwOptions,
IN PWSTR  pTitle,
IN PWSTR  pMessage 
)
static

Definition at line 420 of file gui.c.

426{
429 DWORD ThreadId;
430
431 TRACE("GUIDisplayStatusMessage(%ws)\n", pMessage);
432
433 if (!pgContext->hStatusWindow)
434 {
435 /*
436 * If everything goes correctly, 'msg' is freed
437 * by the 'StartupWindowThread' thread.
438 */
441 sizeof(*msg));
442 if(!msg)
443 return FALSE;
444
445 msg->Context = pgContext;
446 msg->dwOptions = dwOptions;
447 msg->pTitle = pTitle;
448 msg->pMessage = pMessage;
449 msg->hDesktop = hDesktop;
450
451 msg->StartupEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
452
453 if (!msg->StartupEvent)
454 {
456 return FALSE;
457 }
458
460 0,
462 (PVOID)msg,
463 0,
464 &ThreadId);
465 if (Thread)
466 {
467 /* 'msg' will be freed by 'StartupWindowThread' */
468
470 WaitForSingleObject(msg->StartupEvent, INFINITE);
471 CloseHandle(msg->StartupEvent);
472 return TRUE;
473 }
474 else
475 {
476 /*
477 * The 'StartupWindowThread' thread couldn't be created,
478 * so we need to free the allocated 'msg'.
479 */
481 }
482
483 return FALSE;
484 }
485
486 if (pTitle)
487 SetWindowTextW(pgContext->hStatusWindow, pTitle);
488
489 SetDlgItemTextW(pgContext->hStatusWindow, IDC_STATUS_MESSAGE, pMessage);
490
491 return TRUE;
492}
#define msg(x)
Definition: auth_time.c:54
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
static DWORD WINAPI StartupWindowThread(LPVOID lpParam)
Definition: gui.c:381
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
#define INFINITE
Definition: serial.h:102
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
DWORD dwOptions
Definition: solitaire.cpp:25
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587

◆ GUIInitialize()

static BOOL GUIInitialize ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 157 of file gui.c.

159{
160 TRACE("GUIInitialize(%p)\n", pgContext);
161 return TRUE;
162}

◆ GUILockedSAS()

static INT GUILockedSAS ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1743 of file gui.c.

1745{
1746 int result;
1747
1748 TRACE("GUILockedSAS()\n");
1749
1750 result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1751 pgContext->hWlx,
1752 pgContext->hDllInstance,
1756 (LPARAM)pgContext);
1759 {
1760 WARN("GUILockedSAS() returns 0x%x\n", result);
1761 return result;
1762 }
1763
1764 WARN("GUILockedSAS() failed (0x%x)\n", result);
1765 return WLX_SAS_ACTION_NONE;
1766}
#define WARN(fmt,...)
Definition: precomp.h:61
static INT_PTR CALLBACK UnlockDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1675
#define IDD_UNLOCK
Definition: resource.h:29
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define WLX_SAS_ACTION_SWITCH_CONSOLE
Definition: winwlx.h:69
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53

◆ GUILoggedOnSAS()

static INT GUILoggedOnSAS ( IN OUT PGINA_CONTEXT  pgContext,
IN DWORD  dwSasType 
)
static

Definition at line 1153 of file gui.c.

1156{
1157 INT result;
1158
1159 if (dwSasType != WLX_SAS_TYPE_CTRL_ALT_DEL)
1160 {
1161 /* Nothing to do for WLX_SAS_TYPE_TIMEOUT; the dialog will
1162 * close itself thanks to the use of WlxDialogBoxParam */
1163 return WLX_SAS_ACTION_NONE;
1164 }
1165
1166 result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1167 pgContext->hWlx,
1168 pgContext->hDllInstance,
1172 (LPARAM)pgContext);
1173
1176 {
1178 }
1179
1180 return result;
1181}
static INT_PTR CALLBACK SecurityDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1052
#define IDD_SECURITY
Definition: inetcpl.h:83
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36

◆ GUILoggedOutSAS()

static INT GUILoggedOutSAS ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1521 of file gui.c.

1523{
1524 LEGALNOTICEDATA LegalNotice = {NULL, NULL};
1525 HKEY hKey = NULL;
1526 LONG rc;
1527 int result;
1528
1529 TRACE("GUILoggedOutSAS()\n");
1530
1532 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1533 0,
1535 &hKey);
1536 if (rc == ERROR_SUCCESS)
1537 {
1539 L"LegalNoticeCaption",
1540 &LegalNotice.pszCaption);
1541
1543 L"LegalNoticeText",
1544 &LegalNotice.pszText);
1545
1547 }
1548
1549 if (LegalNotice.pszCaption != NULL && LegalNotice.pszCaption[0] &&
1550 LegalNotice.pszText != NULL && LegalNotice.pszText[0])
1551 {
1552 pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
1553 pgContext->hDllInstance,
1557 (LPARAM)&LegalNotice);
1558 }
1559
1560 if (LegalNotice.pszCaption != NULL)
1561 HeapFree(GetProcessHeap(), 0, LegalNotice.pszCaption);
1562
1563 if (LegalNotice.pszText != NULL)
1564 HeapFree(GetProcessHeap(), 0, LegalNotice.pszText);
1565
1566 result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1567 pgContext->hWlx,
1568 pgContext->hDllInstance,
1572 (LPARAM)pgContext);
1575 {
1576 WARN("WlxLoggedOutSAS() returns 0x%x\n", result);
1577 return result;
1578 }
1579
1580 WARN("WlxDialogBoxParam() failed (0x%x)\n", result);
1581 return WLX_SAS_ACTION_NONE;
1582}
#define IDD_LOGON
Definition: resource.h:141
#define RegCloseKey(hKey)
Definition: registry.h:49
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
static INT_PTR CALLBACK LogonDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1384
static INT_PTR CALLBACK LegalNoticeDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1479
#define IDD_LEGALNOTICE
Definition: resource.h:66
#define L(x)
Definition: resources.c:13
FxAutoRegKey hKey
LONG ReadRegSzValue(_In_ HKEY hKey, _In_ PCWSTR pszValue, _Out_ PWSTR *pValue)
Definition: utils.c:57
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
long LONG
Definition: pedump.c:60
LPWSTR pszText
Definition: gui.c:29
LPWSTR pszCaption
Definition: gui.c:28
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ GUIRemoveStatusMessage()

static BOOL GUIRemoveStatusMessage ( IN PGINA_CONTEXT  pgContext)
static

Definition at line 495 of file gui.c.

497{
498 if (pgContext->hStatusWindow)
499 {
500 EndDialog(pgContext->hStatusWindow, 0);
501 pgContext->hStatusWindow = NULL;
502 }
503
504 return TRUE;
505}

◆ LegalNoticeDialogProc()

static INT_PTR CALLBACK LegalNoticeDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1479 of file gui.c.

1484{
1485 PLEGALNOTICEDATA pLegalNotice;
1486
1487 switch (uMsg)
1488 {
1489 case WM_INITDIALOG:
1490 pLegalNotice = (PLEGALNOTICEDATA)lParam;
1491 SetWindowTextW(hwndDlg, pLegalNotice->pszCaption);
1492 SetDlgItemTextW(hwndDlg, IDC_LEGALNOTICE_TEXT, pLegalNotice->pszText);
1493 return TRUE;
1494
1495 case WM_DRAWITEM:
1496 {
1498 if (lpDis->CtlID == IDC_ROSLOGO)
1499 return DrawBrandingBitmap(lpDis, &hBanner);
1500 if (lpDis->CtlID == IDC_BAR)
1501 return DrawBrandingBitmap(lpDis, &hBannerLine);
1502 return FALSE;
1503 }
1504
1505 case WM_COMMAND:
1506 switch (LOWORD(wParam))
1507 {
1508 case IDOK:
1509 case IDCANCEL:
1510 EndDialog(hwndDlg, 0);
1511 return TRUE;
1512 }
1513 break;
1514 }
1515
1516 return FALSE;
1517}
struct _LEGALNOTICEDATA * PLEGALNOTICEDATA
#define IDC_LEGALNOTICE_TEXT
Definition: resource.h:67

Referenced by GUILoggedOutSAS().

◆ LoadBrandingBitmaps()

static VOID LoadBrandingBitmaps ( VOID  )
static

Definition at line 76 of file gui.c.

77{
78 HMODULE hBrand = LoadLibraryExW(L"rosbrand.dll", NULL, LOAD_LIBRARY_AS_DATAFILE);
79
80 if (!hBrand)
81 return;
82
83 hBanner = LoadImageW(hBrand,
86
87 hBannerLine = LoadImageW(hBrand,
90
91 FreeLibrary(hBrand);
92}
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
#define IMAGE_BITMAP
Definition: winuser.h:211
#define LR_CREATEDIBSECTION
Definition: winuser.h:1109
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define IDB_BRAND_BANNER
Definition: rosbrand.h:8
#define IDB_BRAND_BANNERLINE
Definition: rosbrand.h:9
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338

Referenced by DrawBrandingBitmap(), and DrawScrollingBrandingBitmap().

◆ LockedDialogProc()

static INT_PTR CALLBACK LockedDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1770 of file gui.c.

1775{
1776 PGINA_CONTEXT pgContext;
1777
1778 pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1779
1780 switch (uMsg)
1781 {
1782 case WM_INITDIALOG:
1783 {
1784 pgContext = (PGINA_CONTEXT)lParam;
1785 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
1786
1787 SetWelcomeText(hwndDlg);
1788
1789 SetLockMessage(hwndDlg, IDC_LOCKED_MESSAGE, pgContext);
1790 return TRUE;
1791 }
1792 case WM_DRAWITEM:
1793 {
1795 if (lpDis->CtlID == IDC_ROSLOGO)
1796 return DrawBrandingBitmap(lpDis, &hBanner);
1797 /* This dialog doesn't have IDC_BAR */
1798 return FALSE;
1799 }
1800 case WM_DESTROY:
1801 {
1802 return TRUE;
1803 }
1804 }
1805
1806 return FALSE;
1807}
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:166
static VOID SetLockMessage(HWND hwnd, INT nDlgItem, PGINA_CONTEXT pgContext)
Definition: gui.c:1586
#define IDC_LOCKED_MESSAGE
Definition: resource.h:27
#define WM_DESTROY
Definition: winuser.h:1637

Referenced by GUIDisplayLockedNotice().

◆ LogOffDialogProc()

static INT_PTR CALLBACK LogOffDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 957 of file gui.c.

962{
963 switch (uMsg)
964 {
965 case WM_INITDIALOG:
966 return TRUE;
967
968 case WM_DRAWITEM:
969 {
971 if (lpDis->CtlID == IDC_ROSLOGO)
972 return DrawBrandingBitmap(lpDis, &hBanner);
973 if (lpDis->CtlID == IDC_BAR)
974 return DrawBrandingBitmap(lpDis, &hBannerLine);
975 return FALSE;
976 }
977
978 case WM_COMMAND:
979 switch (LOWORD(wParam))
980 {
981 case IDOK:
982 case IDCANCEL:
983 EndDialog(hwndDlg, LOWORD(wParam));
984 return TRUE;
985 }
986 break;
987
988 case WM_CLOSE:
989 EndDialog(hwndDlg, IDCANCEL);
990 return TRUE;
991 }
992
993 return FALSE;
994}

Referenced by OnLogOff().

◆ LogonDialogProc()

static INT_PTR CALLBACK LogonDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1384 of file gui.c.

1389{
1390 PGINA_CONTEXT pgContext;
1391
1392 pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1393
1394 switch (uMsg)
1395 {
1396 case WM_INITDIALOG:
1397 {
1398 /* FIXME: take care of NoDomainUI */
1399 pgContext = (PGINA_CONTEXT)lParam;
1400 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
1401
1402 SetWelcomeText(hwndDlg);
1403
1404 if (pgContext->bAutoAdminLogon ||
1405 !pgContext->bDontDisplayLastUserName)
1406 {
1407 SetDlgItemTextW(hwndDlg, IDC_LOGON_USERNAME, pgContext->UserName);
1408 }
1409
1410 if (pgContext->bAutoAdminLogon)
1411 SetDlgItemTextW(hwndDlg, IDC_LOGON_PASSWORD, pgContext->Password);
1412
1413 SetDomainComboBox(GetDlgItem(hwndDlg, IDC_LOGON_DOMAIN), pgContext);
1414
1415 if (pgContext->bDisableCAD)
1417
1418 if (!pgContext->bShutdownWithoutLogon)
1420
1422
1423 if (pgContext->bAutoAdminLogon)
1424 PostMessage(GetDlgItem(hwndDlg, IDOK), BM_CLICK, 0, 0);
1425
1426 return FALSE; // Default focus is changed.
1427 }
1428
1429 case WM_DRAWITEM:
1430 {
1432 if (lpDis->CtlID == IDC_ROSLOGO)
1433 return DrawBrandingBitmap(lpDis, &hBanner);
1434 if (lpDis->CtlID == IDC_BAR)
1435 return DrawBrandingBitmap(lpDis, &hBannerLine);
1436 return FALSE;
1437 }
1438
1439 case WM_DESTROY:
1440 return TRUE;
1441
1442 case WM_COMMAND:
1443 switch (LOWORD(wParam))
1444 {
1445 case IDOK:
1446 if (DoLogon(hwndDlg, pgContext))
1447 {
1449 }
1450 else
1451 {
1454 }
1455 return TRUE;
1456
1457 case IDCANCEL:
1459 return TRUE;
1460
1461 case IDC_LOGON_SHUTDOWN:
1462 if (OnShutDown(hwndDlg, pgContext,
1464 {
1465 EndDialog(hwndDlg, pgContext->nShutdownAction);
1466 }
1467 return TRUE;
1468 }
1469 break;
1470 }
1471
1472 return FALSE;
1473}
static VOID SetDomainComboBox(HWND hwndDomainComboBox, PGINA_CONTEXT pgContext)
Definition: gui.c:1349
static BOOL DoLogon(IN HWND hwndDlg, IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1186
static INT OnShutDown(_In_ HWND hwndDlg, _In_ PGINA_CONTEXT pgContext, _In_ DWORD dwExcludeOptions)
Definition: gui.c:1015
#define IDC_LOGON_SHUTDOWN
Definition: resource.h:15
#define WLX_SHUTDOWN_STATE_LOGOFF
Shutdown state flags.
Definition: msgina.h:147
#define WLX_SHUTDOWN_STATE_DISCONNECT
"Disconnect" (only available in Terminal Services sessions)
Definition: msgina.h:154
#define BM_CLICK
Definition: winuser.h:1946
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define PostMessage
Definition: winuser.h:5998
BOOL bAutoAdminLogon
Definition: msgina.h:43
BOOL bDontDisplayLastUserName
Definition: msgina.h:44
BOOL bShutdownWithoutLogon
Definition: msgina.h:45
BOOL bDisableCAD
Definition: msgina.h:42
ULONG nShutdownAction
Definition: msgina.h:48
WCHAR Password[256]
Definition: msgina.h:53

Referenced by GUILoggedOutSAS().

◆ OnChangePassword()

static BOOL OnChangePassword ( IN HWND  hwnd,
IN PGINA_CONTEXT  pgContext 
)
static

Definition at line 934 of file gui.c.

937{
938 INT res;
939
940 TRACE("OnChangePassword()\n");
941
942 res = pgContext->pWlxFuncs->WlxDialogBoxParam(
943 pgContext->hWlx,
944 pgContext->hDllInstance,
946 hwnd,
948 (LPARAM)pgContext);
949
950 TRACE("Result: %x\n", res);
951
952 return FALSE;
953}
static INT_PTR CALLBACK ChangePasswordDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:765
#define IDD_CHANGEPWD
Definition: resource.h:34
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by DoLogon(), and SecurityDialogProc().

◆ OnInitSecurityDlg()

static VOID OnInitSecurityDlg ( _In_ HWND  hwnd,
_In_ PGINA_CONTEXT  pgContext 
)
static

Definition at line 831 of file gui.c.

834{
835 HKEY hKeyCurrentUser, hKey;
836 DWORD dwValue;
837 LONG lRet;
838
839 WCHAR Buffer1[256];
840 WCHAR Buffer2[256];
841 WCHAR Buffer3[256];
842 WCHAR Buffer4[512];
843
844 LoadStringW(pgContext->hDllInstance, IDS_LOGONMSG, Buffer1, _countof(Buffer1));
845
846 wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
847 wsprintfW(Buffer4, Buffer1, Buffer2);
848
850
851 LoadStringW(pgContext->hDllInstance, IDS_LOGONDATE, Buffer1, _countof(Buffer1));
852
854 (SYSTEMTIME*)&pgContext->LogonTime, NULL, Buffer2, _countof(Buffer2));
855
857 (SYSTEMTIME*)&pgContext->LogonTime, NULL, Buffer3, _countof(Buffer3));
858
859 wsprintfW(Buffer4, Buffer1, Buffer2, Buffer3);
860
862
864 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
865 0,
867 if (lRet == ERROR_SUCCESS)
868 {
869 lRet = ReadRegDwordValue(hKey, L"DisableLockWorkstation", &dwValue);
870 if ((lRet == ERROR_SUCCESS) && !!dwValue)
872
874 }
875
876 /* Open the per-user registry key */
877 lRet = RegOpenLoggedOnHKCU(pgContext->UserToken,
879 &hKeyCurrentUser);
880 if (lRet != ERROR_SUCCESS)
881 {
882 /* We couldn't, bail out */
883 return;
884 }
885
886 lRet = RegOpenKeyExW(hKeyCurrentUser,
887 L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
888 0,
890 if (lRet == ERROR_SUCCESS)
891 {
892 lRet = ReadRegDwordValue(hKey, L"DisableLockWorkstation", &dwValue);
893 if ((lRet == ERROR_SUCCESS) && !!dwValue)
895
896 lRet = ReadRegDwordValue(hKey, L"DisableChangePassword", &dwValue);
897 if ((lRet == ERROR_SUCCESS) && !!dwValue)
899
900 lRet = ReadRegDwordValue(hKey, L"DisableTaskMgr", &dwValue);
901 if ((lRet == ERROR_SUCCESS) && !!dwValue)
903
905 }
906
907 lRet = RegOpenKeyExW(hKeyCurrentUser,
908 L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
909 0,
911 if (lRet == ERROR_SUCCESS)
912 {
913 lRet = ReadRegDwordValue(hKey, L"NoLogoff", &dwValue);
914 if ((lRet == ERROR_SUCCESS) && !!dwValue)
916
917 // TODO: Disable also if "NoDisconnect" on Terminal Services
918 /* Disable the "Shutdown" button if the user doesn't have shutdown privilege */
919 lRet = ReadRegDwordValue(hKey, L"NoClose", &dwValue);
920 if (((lRet == ERROR_SUCCESS) && !!dwValue) ||
921 !TestTokenPrivilege(pgContext->UserToken, SE_SHUTDOWN_PRIVILEGE))
922 {
924 }
925
927 }
928
929 RegCloseKey(hKeyCurrentUser);
930}
#define IDC_SECURITY_TASKMGR
Definition: resource.h:24
#define IDC_SECURITY_CHANGEPWD
Definition: resource.h:23
#define IDC_SECURITY_SHUTDOWN
Definition: resource.h:22
#define IDC_SECURITY_MESSAGE
Definition: resource.h:18
#define IDC_SECURITY_LOGOFF
Definition: resource.h:21
#define IDC_SECURITY_LOGONDATE
Definition: resource.h:19
#define IDC_SECURITY_LOCK
Definition: resource.h:20
#define IDS_LOGONMSG
Definition: resource.h:92
#define IDS_LOGONDATE
Definition: resource.h:93
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1101
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:1001
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:573
BOOL TestTokenPrivilege(_In_opt_ HANDLE hToken, _In_ ULONG Privilege)
Verifies whether the specified token has the given privilege.
Definition: utils.c:140
LONG ReadRegDwordValue(_In_ HKEY hKey, _In_ PCWSTR pszValue, _Out_ PDWORD pValue)
Definition: utils.c:90
LONG RegOpenLoggedOnHKCU(_In_opt_ HANDLE hUserToken, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Opens and retrieves a handle to the HKEY_CURRENT_USER corresponding to the specified logged-on user.
Definition: utils.c:31
#define LOCALE_USER_DEFAULT
#define DATE_SHORTDATE
Definition: winnls.h:216

Referenced by SecurityDialogProc().

◆ OnLogOff()

static INT OnLogOff ( IN HWND  hwndDlg,
IN PGINA_CONTEXT  pgContext 
)
static

Definition at line 999 of file gui.c.

1002{
1003 return pgContext->pWlxFuncs->WlxDialogBoxParam(
1004 pgContext->hWlx,
1005 pgContext->hDllInstance,
1007 hwndDlg,
1009 (LPARAM)pgContext);
1010}
static INT_PTR CALLBACK LogOffDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:957
#define IDD_LOGOFF
Definition: resource.h:41

Referenced by SecurityDialogProc().

◆ OnShutDown()

static INT OnShutDown ( _In_ HWND  hwndDlg,
_In_ PGINA_CONTEXT  pgContext,
_In_ DWORD  dwExcludeOptions 
)
static

Definition at line 1015 of file gui.c.

1019{
1020 HKEY hKeyCurrentUser = NULL;
1021 DWORD ShutdownOptions = 0;
1022 INT ret;
1023
1024 /* Open the per-user registry key */
1025 if (RegOpenLoggedOnHKCU(pgContext->UserToken,
1027 &hKeyCurrentUser) != ERROR_SUCCESS)
1028 {
1029 ERR("RegOpenLoggedOnHKCU() failed with error %ld\n", GetLastError());
1030 }
1031 pgContext->nShutdownAction = 0;
1032 if (hKeyCurrentUser)
1033 {
1034 ShutdownOptions = GetAllowedShutdownOptions(hKeyCurrentUser, pgContext->UserToken);
1035 pgContext->nShutdownAction = LoadShutdownSelState(hKeyCurrentUser);
1036 }
1037 ShutdownOptions &= ~dwExcludeOptions;
1038
1039 ret = ShutdownDialog(hwndDlg, ShutdownOptions, pgContext);
1040
1041 if ((ret == IDOK) && hKeyCurrentUser)
1042 SaveShutdownSelState(hKeyCurrentUser, pgContext->nShutdownAction);
1043
1044 if (hKeyCurrentUser)
1045 RegCloseKey(hKeyCurrentUser);
1046
1047 return ret;
1048}
return ret
Definition: mutex.c:147
DWORD GetAllowedShutdownOptions(_In_opt_ HKEY hKeyCurrentUser, _In_opt_ HANDLE hUserToken)
Definition: shutdown.c:808
DWORD LoadShutdownSelState(_In_ HKEY hKeyCurrentUser)
Definition: shutdown.c:696
VOID SaveShutdownSelState(_In_ HKEY hKeyCurrentUser, _In_ DWORD ShutdownCode)
Definition: shutdown.c:759
INT_PTR ShutdownDialog(IN HWND hwndDlg, IN DWORD ShutdownOptions, IN PGINA_CONTEXT pgContext)
Definition: shutdown.c:1256
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1021
#define KEY_SET_VALUE
Definition: nt_native.h:1020
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by LogonDialogProc(), and SecurityDialogProc().

◆ ResourceMessageBox()

static INT ResourceMessageBox ( IN PGINA_CONTEXT  pgContext,
IN HWND  hwnd,
IN UINT  uType,
IN UINT  uCaption,
IN UINT  uText 
)
static

Definition at line 573 of file gui.c.

579{
580 WCHAR szCaption[256];
581 WCHAR szText[256];
582
583 LoadStringW(pgContext->hDllInstance, uCaption, szCaption, _countof(szCaption));
584 LoadStringW(pgContext->hDllInstance, uText, szText, _countof(szText));
585
586 return pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx,
587 hwnd,
588 szText,
589 szCaption,
590 uType);
591}

Referenced by DoChangePassword(), DoLogon(), and SecurityDialogProc().

◆ SecurityDialogProc()

static INT_PTR CALLBACK SecurityDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1052 of file gui.c.

1057{
1058 PGINA_CONTEXT pgContext;
1059
1060 pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1061
1062 switch (uMsg)
1063 {
1064 case WM_INITDIALOG:
1065 {
1066 pgContext = (PGINA_CONTEXT)lParam;
1067 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
1068
1069 SetWelcomeText(hwndDlg);
1070
1072 return TRUE;
1073 }
1074 case WM_DRAWITEM:
1075 {
1077 if (lpDis->CtlID == IDC_ROSLOGO)
1078 return DrawBrandingBitmap(lpDis, &hBanner);
1079 /* This dialog doesn't have IDC_BAR */
1080 return FALSE;
1081 }
1082 case WM_COMMAND:
1083 {
1084 switch (LOWORD(wParam))
1085 {
1086 case IDC_SECURITY_LOCK:
1088 return TRUE;
1090 if (ISKEYDOWN(VK_CONTROL))
1091 {
1092 if (ResourceMessageBox(pgContext,
1093 hwndDlg,
1097 {
1099 }
1100 }
1101 else if (OnLogOff(hwndDlg, pgContext) == IDOK)
1102 {
1104 }
1105 return TRUE;
1107 /* Emergency restart feature */
1108 if (ISKEYDOWN(VK_CONTROL))
1109 {
1110 if (ResourceMessageBox(pgContext,
1111 hwndDlg,
1115 {
1116 BOOLEAN Old;
1117
1118 ERR("Emergency restarting NT...\n");
1122 }
1123 }
1124 else if (OnShutDown(hwndDlg, pgContext, 0) == IDOK)
1125 {
1126 EndDialog(hwndDlg, pgContext->nShutdownAction);
1127 }
1128 return TRUE;
1130 if (OnChangePassword(hwndDlg, pgContext))
1132 return TRUE;
1135 return TRUE;
1136 case IDCANCEL:
1138 return TRUE;
1139 }
1140 break;
1141 }
1142 case WM_CLOSE:
1143 {
1145 return TRUE;
1146 }
1147 }
1148
1149 return FALSE;
1150}
unsigned char BOOLEAN
Definition: actypes.h:127
#define ISKEYDOWN(x)
Definition: gui.c:35
static VOID OnInitSecurityDlg(_In_ HWND hwnd, _In_ PGINA_CONTEXT pgContext)
Definition: gui.c:831
static INT OnLogOff(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:999
#define IDS_EMERGENCYRESTARTTITLE
Definition: resource.h:126
#define IDS_EMERGENCYLOGOFFTITLE
Definition: resource.h:124
#define IDS_EMERGENCYRESTART
Definition: resource.h:127
#define IDS_EMERGENCYLOGOFF
Definition: resource.h:125
@ ShutdownReboot
Definition: extypes.h:177
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
Definition: shutdown.c:43
#define VK_CONTROL
Definition: winuser.h:2239
#define MB_OKCANCEL
Definition: winuser.h:815
#define WLX_SAS_ACTION_FORCE_LOGOFF
Definition: winwlx.h:61
#define WLX_SAS_ACTION_PWD_CHANGED
Definition: winwlx.h:58
#define WLX_SAS_ACTION_TASKLIST
Definition: winwlx.h:59
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56

Referenced by GUILoggedOnSAS().

◆ SetDomainComboBox()

static VOID SetDomainComboBox ( HWND  hwndDomainComboBox,
PGINA_CONTEXT  pgContext 
)
static

Definition at line 1349 of file gui.c.

1352{
1353 WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
1354 DWORD dwComputerNameLength;
1355 LONG lIndex = 0;
1356 LONG lFindIndex;
1357
1358 SendMessageW(hwndDomainComboBox, CB_RESETCONTENT, 0, 0);
1359
1360 dwComputerNameLength = _countof(szComputerName);
1361 if (GetComputerNameW(szComputerName, &dwComputerNameLength))
1362 {
1363 lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)szComputerName);
1364 }
1365
1366 if (pgContext->DomainName[0])
1367 {
1368 lFindIndex = SendMessageW(hwndDomainComboBox, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pgContext->DomainName);
1369 if (lFindIndex == CB_ERR)
1370 {
1371 lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)pgContext->DomainName);
1372 }
1373 else
1374 {
1375 lIndex = lFindIndex;
1376 }
1377 }
1378
1379 SendMessageW(hwndDomainComboBox, CB_SETCURSEL, lIndex, 0);
1380}
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define CB_ERR
Definition: winuser.h:2471
#define CB_RESETCONTENT
Definition: winuser.h:1988
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1969
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:268

Referenced by LogonDialogProc().

◆ SetLockMessage()

static VOID SetLockMessage ( HWND  hwnd,
INT  nDlgItem,
PGINA_CONTEXT  pgContext 
)
static

Definition at line 1586 of file gui.c.

1589{
1590 WCHAR Buffer1[256];
1591 WCHAR Buffer2[256];
1592 WCHAR Buffer3[512];
1593
1594 LoadStringW(pgContext->hDllInstance, IDS_LOCKMSG, Buffer1, _countof(Buffer1));
1595
1596 wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
1597 wsprintfW(Buffer3, Buffer1, Buffer2);
1598
1599 SetDlgItemTextW(hwnd, nDlgItem, Buffer3);
1600}
#define IDS_LOCKMSG
Definition: resource.h:91
HANDLE hDllInstance
Definition: msgina.h:38

Referenced by LockedDialogProc(), and UnlockDialogProc().

◆ SetWelcomeText()

static VOID SetWelcomeText ( HWND  hWnd)
static

Definition at line 166 of file gui.c.

167{
168 PWCHAR pBuffer = NULL, p;
169 HKEY hKey;
170 DWORD BufSize, dwType, dwWelcomeSize, dwTitleLength;
171 LONG rc;
172
173 /* Open the Winlogon key */
175 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
176 0,
178 &hKey);
179 if (rc != ERROR_SUCCESS)
180 {
181 WARN("RegOpenKeyExW() failed with error %lu\n", rc);
182 return;
183 }
184
185 /* Get the size of the Welcome value */
186 dwWelcomeSize = 0;
188 L"Welcome",
189 NULL,
190 &dwType,
191 NULL,
192 &dwWelcomeSize);
193 if (rc == ERROR_FILE_NOT_FOUND || dwWelcomeSize == 0 || dwType != REG_SZ)
194 goto done;
195
196 dwTitleLength = GetWindowTextLengthW(hWnd);
197 BufSize = dwWelcomeSize + ((dwTitleLength + 1) * sizeof(WCHAR));
198
200 if (pBuffer == NULL)
201 goto done;
202
204 wcscat(pBuffer, L" ");
205 p = &pBuffer[dwTitleLength + 1];
206
208 L"Welcome",
209 NULL,
210 &dwType,
211 (PBYTE)p,
212 &dwWelcomeSize);
213
215
216done:
217 if (pBuffer != NULL)
219
221}
#define BufSize
Definition: FsRtlTunnel.c:28
#define REG_SZ
Definition: layer.c:22
HWND hWnd
Definition: settings.c:17
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
GLfloat GLfloat p
Definition: glext.h:8902
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
BYTE * PBYTE
Definition: pedump.c:66
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define SetWindowText
Definition: winuser.h:6023
PVOID pBuffer
wcscat
uint16_t * PWCHAR
Definition: typedefs.h:56

Referenced by LockedDialogProc(), LogonDialogProc(), SecurityDialogProc(), and UnlockDialogProc().

◆ StartupWindowThread()

static DWORD WINAPI StartupWindowThread ( LPVOID  lpParam)
static

Definition at line 381 of file gui.c.

382{
383 HDESK hDesk;
385
386 /* When SetThreadDesktop is called the system closes the desktop handle when needed
387 so we have to create a new handle because this handle may still be in use by winlogon */
389 msg->hDesktop,
391 (HANDLE*)&hDesk,
392 0,
393 FALSE,
395 {
396 ERR("Duplicating handle failed!\n");
397 HeapFree(GetProcessHeap(), 0, lpParam);
398 return FALSE;
399 }
400
401 if(!SetThreadDesktop(hDesk))
402 {
403 ERR("Setting thread desktop failed!\n");
404 HeapFree(GetProcessHeap(), 0, lpParam);
405 return FALSE;
406 }
407
413 (LPARAM)lpParam);
414
415 HeapFree(GetProcessHeap(), 0, lpParam);
416 return TRUE;
417}
static HINSTANCE hDllInstance
Definition: clb.c:9
#define IDD_STATUS
Definition: resource.h:25
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149
static INT_PTR CALLBACK StatusDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:288
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define DUPLICATE_SAME_ACCESS

Referenced by GUIDisplayStatusMessage().

◆ StatusDialogProc()

static INT_PTR CALLBACK StatusDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 288 of file gui.c.

293{
294 PDLG_DATA pDlgData;
296
297 pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
298
299 switch (uMsg)
300 {
301 case WM_INITDIALOG:
302 {
304 if (!msg)
305 return FALSE;
306
307 msg->Context->hStatusWindow = hwndDlg;
308
309 if (msg->pTitle)
310 SetWindowTextW(hwndDlg, msg->pTitle);
311 SetDlgItemTextW(hwndDlg, IDC_STATUS_MESSAGE, msg->pMessage);
312 SetEvent(msg->StartupEvent);
313
314 pDlgData = DlgData_Create(hwndDlg, msg->Context);
315 if (pDlgData == NULL)
316 return FALSE;
317
318 if (hBannerLine)
319 {
320 if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
321 {
322 ERR("SetTimer(IDT_BAR) failed: %d\n", GetLastError());
323 }
324 else
325 {
326 /* Get the animation bar control */
327 pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
328 }
329 }
330
332 return TRUE;
333 }
334
335 case WM_TIMER:
336 {
337 if (pDlgData && hBannerLine)
338 {
339 /*
340 * Default rotation bar image width is 413 (same as logo)
341 * We can divide 413 by 7 without remainder
342 * DrawScrollingBrandingBitmap() mods BarCounter to image width
343 */
344 pDlgData->BarCounter += 7;
346 UpdateWindow(pDlgData->hWndBarCtrl);
347 }
348 return TRUE;
349 }
350
351 case WM_DRAWITEM:
352 {
354 if (lpDis->CtlID == IDC_ROSLOGO)
355 {
356 return DrawBrandingBitmap(lpDis, &hBanner);
357 }
358 if (lpDis->CtlID == IDC_BAR)
359 {
360 return DrawScrollingBrandingBitmap(lpDis,
362 &(pDlgData->BarCounter));
363 }
364 return FALSE;
365 }
366
367 case WM_DESTROY:
368 {
369 if (pDlgData && hBannerLine)
370 {
371 KillTimer(hwndDlg, IDT_BAR);
372 }
373 DlgData_Destroy(hwndDlg);
374 return TRUE;
375 }
376 }
377 return FALSE;
378}
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:48
static VOID DlgData_Destroy(_Inout_ HWND hwndDlg)
Definition: gui.c:60
BOOL DrawScrollingBrandingBitmap(_Inout_ LPDRAWITEMSTRUCT DrawItem, _Inout_ HBITMAP *BitmapHandle, _In_ PDWORD ScrollCounter)
Definition: gui.c:123
static VOID AdjustStatusMessageWindow(HWND hwndDlg)
Definition: gui.c:224
#define IDT_BAR
Definition: gui.c:33
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_TIMER
Definition: winuser.h:1770
BOOL WINAPI UpdateWindow(_In_ HWND)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
HWND hWndBarCtrl
Definition: gui.c:40
DWORD BarCounter
Definition: gui.c:41
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669

Referenced by StartupWindowThread().

◆ UnlockDialogProc()

static INT_PTR CALLBACK UnlockDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1675 of file gui.c.

1680{
1681 PGINA_CONTEXT pgContext;
1683
1684 pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1685
1686 switch (uMsg)
1687 {
1688 case WM_INITDIALOG:
1689 {
1690 pgContext = (PGINA_CONTEXT)lParam;
1691 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
1692 SetWelcomeText(hwndDlg);
1693
1694 SetLockMessage(hwndDlg, IDC_UNLOCK_MESSAGE, pgContext);
1695 SetDlgItemTextW(hwndDlg, IDC_UNLOCK_USERNAME, pgContext->UserName);
1696
1697 if (pgContext->bDisableCAD)
1699
1701 return FALSE; // Default focus is changed.
1702 }
1703
1704 case WM_DRAWITEM:
1705 {
1707 if (lpDis->CtlID == IDC_ROSLOGO)
1708 return DrawBrandingBitmap(lpDis, &hBanner);
1709 /* This dialog doesn't have IDC_BAR */
1710 return FALSE;
1711 }
1712
1713 case WM_DESTROY:
1714 return TRUE;
1715
1716 case WM_COMMAND:
1717 switch (LOWORD(wParam))
1718 {
1719 case IDOK:
1720 if (DoUnlock(hwndDlg, pgContext, &result))
1721 {
1722 EndDialog(hwndDlg, result);
1723 }
1724 else
1725 {
1728 }
1729 return TRUE;
1730
1731 case IDCANCEL:
1733 return TRUE;
1734 }
1735 break;
1736 }
1737
1738 return FALSE;
1739}
static BOOL DoUnlock(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext, OUT LPINT Action)
Definition: gui.c:1605
#define IDC_UNLOCK_MESSAGE
Definition: resource.h:30

Referenced by GUILockedSAS().

◆ WelcomeDialogProc()

static INT_PTR CALLBACK WelcomeDialogProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 508 of file gui.c.

513{
514 switch (uMsg)
515 {
516 case WM_INITDIALOG:
517 return TRUE;
518 case WM_DRAWITEM:
519 {
521 if (lpDis->CtlID == IDC_ROSLOGO)
522 return DrawBrandingBitmap(lpDis, &hBanner);
523 if (lpDis->CtlID == IDC_BAR)
524 return DrawBrandingBitmap(lpDis, &hBannerLine);
525 return FALSE;
526 }
527 case WM_DESTROY:
528 return TRUE;
529 }
530 return FALSE;
531}

Referenced by GUIDisplaySASNotice().

Variable Documentation

◆ GinaGraphicalUI

GINA_UI GinaGraphicalUI
Initial value:
= {
}
static INT GUILoggedOnSAS(IN OUT PGINA_CONTEXT pgContext, IN DWORD dwSasType)
Definition: gui.c:1153
static BOOL GUIInitialize(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:157
static INT GUILockedSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1743
static INT GUILoggedOutSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1521
static BOOL GUIDisplayStatusMessage(IN PGINA_CONTEXT pgContext, IN HDESK hDesktop, IN DWORD dwOptions, IN PWSTR pTitle, IN PWSTR pMessage)
Definition: gui.c:420
static VOID GUIDisplayLockedNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1811
static BOOL GUIRemoveStatusMessage(IN PGINA_CONTEXT pgContext)
Definition: gui.c:495
static VOID GUIDisplaySASNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:534

Definition at line 1823 of file gui.c.

Referenced by ChooseGinaUI().

◆ hBanner

◆ hBannerLine