ReactOS  0.4.15-dev-4934-gfd1e799
gui.c File Reference
#include "msgina.h"
#include <wingdi.h>
#include <winnls.h>
#include <winreg.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
 

Typedefs

typedef struct _DISPLAYSTATUSMSG DISPLAYSTATUSMSG
 
typedef struct _DISPLAYSTATUSMSGPDISPLAYSTATUSMSG
 
typedef struct _LEGALNOTICEDATA LEGALNOTICEDATA
 
typedef struct _LEGALNOTICEDATAPLEGALNOTICEDATA
 
typedef struct _DLG_DATA DLG_DATA
 
typedef struct _DLG_DATAPDLG_DATA
 

Functions

static PDLG_DATA DlgData_Create (HWND hwndDlg, PGINA_CONTEXT pgContext)
 
static VOID DlgData_LoadBitmaps (_Inout_ PDLG_DATA pDlgData)
 
static VOID DlgData_Destroy (_Inout_ HWND hwndDlg)
 
static BOOL GUIInitialize (IN OUT PGINA_CONTEXT pgContext)
 
static VOID SetWelcomeText (HWND hWnd)
 
static VOID AdjustStatusMessageWindow (HWND hwndDlg, PDLG_DATA pDlgData)
 
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 (HWND hwnd, 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)
 
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

GINA_UI GinaGraphicalUI
 

Macro Definition Documentation

◆ IDT_BAR

#define IDT_BAR   1

Definition at line 32 of file gui.c.

Typedef Documentation

◆ DISPLAYSTATUSMSG

◆ DLG_DATA

◆ LEGALNOTICEDATA

◆ PDISPLAYSTATUSMSG

◆ PDLG_DATA

◆ PLEGALNOTICEDATA

Function Documentation

◆ AdjustStatusMessageWindow()

static VOID AdjustStatusMessageWindow ( HWND  hwndDlg,
PDLG_DATA  pDlgData 
)
static

Definition at line 185 of file gui.c.

186 {
187  INT xOld, yOld, cxOld, cyOld;
188  INT xNew, yNew, cxNew, cyNew;
189  INT cxLabel, cyLabel, dyLabel;
190  RECT rc, rcBar, rcLabel, rcWnd;
191  BITMAP bmLogo, bmBar;
192  DWORD style, exstyle;
193  HWND hwndLogo = GetDlgItem(hwndDlg, IDC_ROSLOGO);
194  HWND hwndBar = GetDlgItem(hwndDlg, IDC_BAR);
195  HWND hwndLabel = GetDlgItem(hwndDlg, IDC_STATUS_MESSAGE);
196 
197  /* This adjustment is for CJK only */
199  {
200  case LANG_CHINESE:
201  case LANG_JAPANESE:
202  case LANG_KOREAN:
203  break;
204 
205  default:
206  return;
207  }
208 
209  if (!GetObjectW(pDlgData->hLogoBitmap, sizeof(BITMAP), &bmLogo) ||
210  !GetObjectW(pDlgData->hBarBitmap, sizeof(BITMAP), &bmBar))
211  {
212  return;
213  }
214 
215  GetWindowRect(hwndBar, &rcBar);
216  MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcBar, 2);
217  dyLabel = bmLogo.bmHeight - rcBar.top;
218 
219  GetWindowRect(hwndLabel, &rcLabel);
220  MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rcLabel, 2);
221  cxLabel = rcLabel.right - rcLabel.left;
222  cyLabel = rcLabel.bottom - rcLabel.top;
223 
224  MoveWindow(hwndLogo, 0, 0, bmLogo.bmWidth, bmLogo.bmHeight, TRUE);
225  MoveWindow(hwndBar, 0, bmLogo.bmHeight, bmLogo.bmWidth, bmBar.bmHeight, TRUE);
226  MoveWindow(hwndLabel, rcLabel.left, rcLabel.top + dyLabel, cxLabel, cyLabel, TRUE);
227 
228  GetWindowRect(hwndDlg, &rcWnd);
229  xOld = rcWnd.left;
230  yOld = rcWnd.top;
231  cxOld = rcWnd.right - rcWnd.left;
232  cyOld = rcWnd.bottom - rcWnd.top;
233 
234  GetClientRect(hwndDlg, &rc);
235  SetRect(&rc, 0, 0, bmLogo.bmWidth, rc.bottom - rc.top); /* new client size */
236 
237  style = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_STYLE);
238  exstyle = (DWORD)GetWindowLongPtrW(hwndDlg, GWL_EXSTYLE);
239  AdjustWindowRectEx(&rc, style, FALSE, exstyle);
240 
241  cxNew = rc.right - rc.left;
242  cyNew = (rc.bottom - rc.top) + dyLabel;
243  xNew = xOld - (cxNew - cxOld) / 2;
244  yNew = yOld - (cyNew - cyOld) / 2;
245  MoveWindow(hwndDlg, xNew, yNew, cxNew, cyNew, TRUE);
246 }
#define IDC_ROSLOGO
Definition: resource.h:69
HBITMAP hBarBitmap
Definition: gui.c:38
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:307
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define GWL_EXSTYLE
Definition: winuser.h:845
#define GetWindowLongPtrW
Definition: winuser.h:4809
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
#define LANG_JAPANESE
Definition: nls.h:76
#define FALSE
Definition: types.h:117
static INT cxOld
Definition: eventvwr.c:4291
#define IDC_BAR
Definition: resource.h:70
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_STATUS_MESSAGE
Definition: resource.h:6
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define GWL_STYLE
Definition: winuser.h:846
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
Definition: bl.h:1330
#define NULL
Definition: types.h:112
#define LANG_CHINESE
Definition: nls.h:42
LONG bottom
Definition: windef.h:309
#define LANG_KOREAN
Definition: nls.h:84
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:738
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
Arabic default style
Definition: afstyles.h:93
HBITMAP hLogoBitmap
Definition: gui.c:37
static INT cyOld
Definition: eventvwr.c:4291
#define PRIMARYLANGID(l)
Definition: nls.h:16

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 744 of file gui.c.

749 {
750  PGINA_CONTEXT pgContext;
751 
752  pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
753 
754  switch (uMsg)
755  {
756  case WM_INITDIALOG:
757  {
758  pgContext = (PGINA_CONTEXT)lParam;
759  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
760 
761  SetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, pgContext->UserName);
765  return TRUE;
766  }
767 
768  case WM_COMMAND:
769  switch (LOWORD(wParam))
770  {
771  case IDOK:
772  if (DoChangePassword(pgContext, hwndDlg))
773  {
774  EndDialog(hwndDlg, TRUE);
775  }
776  else
777  {
781  }
782  return TRUE;
783 
784  case IDCANCEL:
785  EndDialog(hwndDlg, FALSE);
786  return TRUE;
787  }
788  break;
789 
790  case WM_CLOSE:
791  EndDialog(hwndDlg, FALSE);
792  return TRUE;
793  }
794 
795  return FALSE;
796 }
WCHAR DomainName[256]
Definition: msgina.h:51
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
#define IDC_CHANGEPWD_DOMAIN
Definition: resource.h:36
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4809
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
struct GINA_CONTEXT * PGINA_CONTEXT
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_CHANGEPWD_USERNAME
Definition: resource.h:35
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
#define CB_ADDSTRING
Definition: winuser.h:1923
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR UserName[256]
Definition: msgina.h:50
static BOOL DoChangePassword(IN PGINA_CONTEXT pgContext, IN HWND hwndDlg)
Definition: gui.c:589
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1608
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_CHANGEPWD_OLDPWD
Definition: resource.h:37
#define CB_SETCURSEL
Definition: winuser.h:1948
#define WM_COMMAND
Definition: winuser.h:1727
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define IDC_CHANGEPWD_NEWPWD2
Definition: resource.h:39
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_CHANGEPWD_NEWPWD1
Definition: resource.h:38

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 GWLP_USERDATA
Definition: treelist.c:63
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
PGINA_CONTEXT pgContext
Definition: gui.c:36
Definition: gui.c:34
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define SetWindowLongPtrW
Definition: winuser.h:5326

Referenced by LockedDialogProc(), LogonDialogProc(), StatusDialogProc(), UnlockDialogProc(), and WelcomeDialogProc().

◆ DlgData_Destroy()

static VOID DlgData_Destroy ( _Inout_ HWND  hwndDlg)
static

Definition at line 90 of file gui.c.

91 {
92  PDLG_DATA pDlgData;
93 
94  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
95  if (!pDlgData)
96  {
97  return;
98  }
99 
101 
102  if (pDlgData->hBarBitmap)
103  {
104  DeleteObject(pDlgData->hBarBitmap);
105  }
106 
107  if (pDlgData->hLogoBitmap)
108  {
109  DeleteObject(pDlgData->hLogoBitmap);
110  }
111 
112  HeapFree(GetProcessHeap(), 0, pDlgData);
113 }
struct _DLG_DATA * PDLG_DATA
HBITMAP hBarBitmap
Definition: gui.c:38
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GetWindowLongPtrW
Definition: winuser.h:4809
#define GWLP_USERDATA
Definition: treelist.c:63
#define GetProcessHeap()
Definition: compat.h:595
Definition: gui.c:34
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define HeapFree(x, y, z)
Definition: compat.h:594
HBITMAP hLogoBitmap
Definition: gui.c:37

Referenced by LockedDialogProc(), LogonDialogProc(), StatusDialogProc(), UnlockDialogProc(), and WelcomeDialogProc().

◆ DlgData_LoadBitmaps()

static VOID DlgData_LoadBitmaps ( _Inout_ PDLG_DATA  pDlgData)
static

Definition at line 60 of file gui.c.

61 {
62  BITMAP bm;
63 
64  if (!pDlgData)
65  {
66  return;
67  }
68 
69  pDlgData->hLogoBitmap = LoadImageW(pDlgData->pgContext->hDllInstance,
71  0, 0, LR_DEFAULTCOLOR);
72  if (pDlgData->hLogoBitmap)
73  {
74  GetObject(pDlgData->hLogoBitmap, sizeof(bm), &bm);
75  pDlgData->LogoWidth = bm.bmWidth;
76  pDlgData->LogoHeight = bm.bmHeight;
77  }
78 
79  pDlgData->hBarBitmap = LoadImageW(hDllInstance, MAKEINTRESOURCEW(IDI_BAR),
81  if (pDlgData->hBarBitmap)
82  {
83  GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
84  pDlgData->BarWidth = bm.bmWidth;
85  pDlgData->BarHeight = bm.bmHeight;
86  }
87 }
#define IDI_ROSLOGO
Definition: resource.h:42
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
static HINSTANCE hDllInstance
Definition: clb.c:30
#define GetObject
Definition: wingdi.h:4468
#define IDI_BAR
Definition: resource.h:76
Definition: bl.h:1330
#define IMAGE_BITMAP
Definition: winuser.h:211
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081

Referenced by LockedDialogProc(), LogonDialogProc(), StatusDialogProc(), UnlockDialogProc(), and WelcomeDialogProc().

◆ DoChangePassword()

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

Definition at line 589 of file gui.c.

592 {
593  WCHAR UserName[256];
594  WCHAR Domain[256];
595  WCHAR OldPassword[256];
596  WCHAR NewPassword1[256];
597  WCHAR NewPassword2[256];
598  PMSV1_0_CHANGEPASSWORD_REQUEST RequestBuffer = NULL;
599  PMSV1_0_CHANGEPASSWORD_RESPONSE ResponseBuffer = NULL;
600  ULONG RequestBufferSize;
601  ULONG ResponseBufferSize = 0;
602  LPWSTR Ptr;
603  BOOL res = FALSE;
606 
607  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, UserName, _countof(UserName));
608  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_DOMAIN, Domain, _countof(Domain));
609  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_OLDPWD, OldPassword, _countof(OldPassword));
610  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD1, NewPassword1, _countof(NewPassword1));
611  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD2, NewPassword2, _countof(NewPassword2));
612 
613  /* Compare the two passwords and fail if they do not match */
614  if (wcscmp(NewPassword1, NewPassword2) != 0)
615  {
616  ResourceMessageBox(pgContext,
617  hwndDlg,
621  return FALSE;
622  }
623 
624  /* Calculate the request buffer size */
625  RequestBufferSize = sizeof(MSV1_0_CHANGEPASSWORD_REQUEST) +
626  ((wcslen(Domain) + 1) * sizeof(WCHAR)) +
627  ((wcslen(UserName) + 1) * sizeof(WCHAR)) +
628  ((wcslen(OldPassword) + 1) * sizeof(WCHAR)) +
629  ((wcslen(NewPassword1) + 1) * sizeof(WCHAR));
630 
631  /* Allocate the request buffer */
632  RequestBuffer = HeapAlloc(GetProcessHeap(),
634  RequestBufferSize);
635  if (RequestBuffer == NULL)
636  {
637  ERR("HeapAlloc failed\n");
638  return FALSE;
639  }
640 
641  /* Initialize the request buffer */
642  RequestBuffer->MessageType = MsV1_0ChangePassword;
643  RequestBuffer->Impersonating = TRUE;
644 
645  Ptr = (LPWSTR)((ULONG_PTR)RequestBuffer + sizeof(MSV1_0_CHANGEPASSWORD_REQUEST));
646 
647  /* Pack the domain name */
648  RequestBuffer->DomainName.Length = (USHORT)wcslen(Domain) * sizeof(WCHAR);
649  RequestBuffer->DomainName.MaximumLength = RequestBuffer->DomainName.Length + sizeof(WCHAR);
650  RequestBuffer->DomainName.Buffer = Ptr;
651 
652  RtlCopyMemory(RequestBuffer->DomainName.Buffer,
653  Domain,
654  RequestBuffer->DomainName.MaximumLength);
655 
656  Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->DomainName.MaximumLength);
657 
658  /* Pack the user name */
659  RequestBuffer->AccountName.Length = (USHORT)wcslen(UserName) * sizeof(WCHAR);
660  RequestBuffer->AccountName.MaximumLength = RequestBuffer->AccountName.Length + sizeof(WCHAR);
661  RequestBuffer->AccountName.Buffer = Ptr;
662 
663  RtlCopyMemory(RequestBuffer->AccountName.Buffer,
664  UserName,
665  RequestBuffer->AccountName.MaximumLength);
666 
667  Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->AccountName.MaximumLength);
668 
669  /* Pack the old password */
670  RequestBuffer->OldPassword.Length = (USHORT)wcslen(OldPassword) * sizeof(WCHAR);
671  RequestBuffer->OldPassword.MaximumLength = RequestBuffer->OldPassword.Length + sizeof(WCHAR);
672  RequestBuffer->OldPassword.Buffer = Ptr;
673 
674  RtlCopyMemory(RequestBuffer->OldPassword.Buffer,
675  OldPassword,
676  RequestBuffer->OldPassword.MaximumLength);
677 
678  Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->OldPassword.MaximumLength);
679 
680  /* Pack the new password */
681  RequestBuffer->NewPassword.Length = (USHORT)wcslen(NewPassword1) * sizeof(WCHAR);
682  RequestBuffer->NewPassword.MaximumLength = RequestBuffer->NewPassword.Length + sizeof(WCHAR);
683  RequestBuffer->NewPassword.Buffer = Ptr;
684 
685  RtlCopyMemory(RequestBuffer->NewPassword.Buffer,
686  NewPassword1,
687  RequestBuffer->NewPassword.MaximumLength);
688 
689  /* Connect to the LSA server */
690  if (ConnectToLsa(pgContext) != ERROR_SUCCESS)
691  {
692  ERR("ConnectToLsa() failed\n");
693  goto done;
694  }
695 
696  /* Call the authentication package */
697  Status = LsaCallAuthenticationPackage(pgContext->LsaHandle,
698  pgContext->AuthenticationPackage,
699  RequestBuffer,
700  RequestBufferSize,
701  (PVOID*)&ResponseBuffer,
702  &ResponseBufferSize,
703  &ProtocolStatus);
704  if (!NT_SUCCESS(Status))
705  {
706  ERR("LsaCallAuthenticationPackage failed (Status 0x%08lx)\n", Status);
707  goto done;
708  }
709 
711  {
712  TRACE("LsaCallAuthenticationPackage failed (ProtocolStatus 0x%08lx)\n", ProtocolStatus);
713  goto done;
714  }
715 
716  res = TRUE;
717 
718  ResourceMessageBox(pgContext,
719  hwndDlg,
723 
724  if ((wcscmp(UserName, pgContext->UserName) == 0) &&
725  (wcscmp(Domain, pgContext->DomainName) == 0) &&
726  (wcscmp(OldPassword, pgContext->Password) == 0))
727  {
728  ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
729  wcscpy(pgContext->Password, NewPassword1);
730  }
731 
732 done:
733  if (RequestBuffer != NULL)
734  HeapFree(GetProcessHeap(), 0, RequestBuffer);
735 
736  if (ResponseBuffer != NULL)
737  LsaFreeReturnBuffer(ResponseBuffer);
738 
739  return res;
740 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
struct _MSV1_0_CHANGEPASSWORD_REQUEST MSV1_0_CHANGEPASSWORD_REQUEST
#define ERROR_SUCCESS
Definition: deptool.c:10
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define TRUE
Definition: types.h:120
NTSTATUS ConnectToLsa(PGINA_CONTEXT pgContext)
Definition: lsa.c:11
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define IDC_CHANGEPWD_DOMAIN
Definition: resource.h:36
LONG NTSTATUS
Definition: precomp.h:26
#define ZeroMemory
Definition: winbase.h:1667
static INT ResourceMessageBox(IN PGINA_CONTEXT pgContext, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
Definition: gui.c:566
UNICODE_STRING AccountName
Definition: ntsecapi.h:513
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define IDC_CHANGEPWD_USERNAME
Definition: resource.h:35
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
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_PASSWORDCHANGED
Definition: resource.h:102
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define _countof(array)
Definition: sndvol32.h:68
UNICODE_STRING NewPassword
Definition: ntsecapi.h:515
#define IDS_NONMATCHINGPASSWORDS
Definition: resource.h:101
#define IDC_CHANGEPWD_OLDPWD
Definition: resource.h:37
#define MB_ICONINFORMATION
Definition: winuser.h:796
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define ERR(fmt,...)
Definition: debug.h:110
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
unsigned short USHORT
Definition: pedump.c:61
#define IDS_CHANGEPWDTITLE
Definition: resource.h:100
MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType
Definition: ntsecapi.h:511
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define IDC_CHANGEPWD_NEWPWD2
Definition: resource.h:39
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID)
UNICODE_STRING OldPassword
Definition: ntsecapi.h:514
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
WCHAR * LPWSTR
Definition: xmlstorage.h:184
NTSTATUS NTAPI LsaCallAuthenticationPackage(HANDLE, ULONG, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS)
#define HeapFree(x, y, z)
Definition: compat.h:594
#define IDC_CHANGEPWD_NEWPWD1
Definition: resource.h:38

Referenced by ChangePasswordDialogProc().

◆ DoLogon()

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

Definition at line 1063 of file gui.c.

1066 {
1067  LPWSTR UserName = NULL;
1068  LPWSTR Password = NULL;
1069  LPWSTR Domain = NULL;
1070  BOOL result = FALSE;
1072 
1073  if (GetTextboxText(hwndDlg, IDC_LOGON_USERNAME, &UserName) && *UserName == '\0')
1074  goto done;
1075 
1076  if (GetTextboxText(hwndDlg, IDC_LOGON_DOMAIN, &Domain) && *Domain == '\0')
1077  goto done;
1078 
1079  if (!GetTextboxText(hwndDlg, IDC_LOGON_PASSWORD, &Password))
1080  goto done;
1081 
1082  Status = DoLoginTasks(pgContext, UserName, Domain, Password, &SubStatus);
1084  {
1085  ResourceMessageBox(pgContext,
1086  hwndDlg,
1090  goto done;
1091  }
1092  else if (Status == STATUS_ACCOUNT_RESTRICTION)
1093  {
1094  TRACE("DoLoginTasks failed! Status 0x%08lx SubStatus 0x%08lx\n", Status, SubStatus);
1095 
1097  {
1098  ResourceMessageBox(pgContext,
1099  hwndDlg,
1103  goto done;
1104  }
1106  {
1107  TRACE("Account locked!\n");
1108  ResourceMessageBox(pgContext,
1109  hwndDlg,
1110  MB_OK | MB_ICONERROR,
1113  goto done;
1114  }
1115  else if ((SubStatus == STATUS_PASSWORD_MUST_CHANGE) ||
1117  {
1119  ResourceMessageBox(pgContext,
1120  hwndDlg,
1121  MB_OK | MB_ICONSTOP,
1124  else
1125  ResourceMessageBox(pgContext,
1126  hwndDlg,
1127  MB_OK | MB_ICONSTOP,
1130 
1131  if (!OnChangePassword(hwndDlg,
1132  pgContext))
1133  goto done;
1134 
1135  Status = DoLoginTasks(pgContext,
1136  pgContext->UserName,
1137  pgContext->DomainName,
1138  pgContext->Password,
1139  &SubStatus);
1140  if (!NT_SUCCESS(Status))
1141  {
1142  TRACE("Login after password change failed! (Status 0x%08lx)\n", Status);
1143 
1144  goto done;
1145  }
1146  }
1147  else if (SubStatus == STATUS_ACCOUNT_EXPIRED)
1148  {
1149  ResourceMessageBox(pgContext,
1150  hwndDlg,
1154  }
1156  {
1157  ResourceMessageBox(pgContext,
1158  hwndDlg,
1159  MB_OK | MB_ICONERROR,
1162  goto done;
1163  }
1165  {
1166  ResourceMessageBox(pgContext,
1167  hwndDlg,
1168  MB_OK | MB_ICONERROR,
1171  goto done;
1172  }
1173  else
1174  {
1175  TRACE("Other error!\n");
1176  ResourceMessageBox(pgContext,
1177  hwndDlg,
1178  MB_OK | MB_ICONERROR,
1181  goto done;
1182  }
1183  }
1184  else if (!NT_SUCCESS(Status))
1185  {
1186  TRACE("DoLoginTasks failed! Status 0x%08lx\n", Status);
1187  goto done;
1188  }
1189 
1190  if (!CreateProfile(pgContext, UserName, Domain, Password))
1191  {
1192  ERR("Failed to create the profile!\n");
1193  goto done;
1194  }
1195 
1196  ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
1197  wcscpy(pgContext->Password, Password);
1198 
1199  result = TRUE;
1200 
1201 done:
1202  pgContext->bAutoAdminLogon = FALSE;
1203 
1204  if (UserName != NULL)
1205  HeapFree(GetProcessHeap(), 0, UserName);
1206 
1207  if (Password != NULL)
1209 
1210  if (Domain != NULL)
1211  HeapFree(GetProcessHeap(), 0, Domain);
1212 
1213  return result;
1214 }
#define IDS_PASSWORDEXPIRED
Definition: resource.h:107
#define IDC_LOGON_PASSWORD
Definition: resource.h:13
GLuint64EXT * result
Definition: glext.h:11304
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define ZeroMemory
Definition: winbase.h:1667
#define IDS_LOGONTITLE
Definition: resource.h:103
#define STATUS_ACCOUNT_LOCKED_OUT
Definition: ntstatus.h:696
#define MB_ICONSTOP
Definition: winuser.h:797
static BOOL OnChangePassword(IN HWND hwnd, IN PGINA_CONTEXT pgContext)
Definition: gui.c:833
#define IDS_ACCOUNTEXPIRED
Definition: resource.h:108
static INT ResourceMessageBox(IN PGINA_CONTEXT pgContext, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
Definition: gui.c:566
#define STATUS_ACCOUNT_EXPIRED
Definition: ntstatus.h:636
#define IDS_ACCOUNTRESTRICTION
Definition: resource.h:112
#define STATUS_INVALID_LOGON_HOURS
Definition: ntstatus.h:347
#define STATUS_ACCOUNT_RESTRICTION
Definition: ntstatus.h:346
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define IDC_LOGON_DOMAIN
Definition: resource.h:14
#define FALSE
Definition: types.h:117
_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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_ACCOUNTLOCKED
Definition: resource.h:109
NTSTATUS DoLoginTasks(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password, OUT PNTSTATUS SubStatus)
Definition: msgina.c:752
#define IDS_INVALIDWORKSTATION
Definition: resource.h:111
Status
Definition: gdiplustypes.h:24
#define STATUS_ACCOUNT_DISABLED
Definition: ntstatus.h:350
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
#define STATUS_PASSWORD_EXPIRED
Definition: ntstatus.h:349
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IDS_INVALIDLOGONHOURS
Definition: resource.h:110
#define IDC_LOGON_USERNAME
Definition: resource.h:12
#define IDS_LOGONWRONGUSERORPWD
Definition: resource.h:104
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define MB_ICONERROR
Definition: winuser.h:781
#define ERR(fmt,...)
Definition: debug.h:110
#define STATUS_INVALID_WORKSTATION
Definition: ntstatus.h:348
#define STATUS_PASSWORD_MUST_CHANGE
Definition: ntstatus.h:680
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define IDS_PASSWORDMUSTCHANGE
Definition: resource.h:106
#define IDS_LOGONUSERDISABLED
Definition: resource.h:105
static BOOL GetTextboxText(IN HWND hwndDlg, IN INT TextboxId, OUT LPWSTR *pText)
Definition: gui.c:542
#define STATUS_SUCCESS
Definition: shellext.h:65
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define STATUS_LOGON_FAILURE
Definition: ntstatus.h:345
BOOL CreateProfile(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:785

Referenced by LogonDialogProc().

◆ DoUnlock()

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

Definition at line 1462 of file gui.c.

1466 {
1467  WCHAR Buffer1[256];
1468  WCHAR Buffer2[256];
1469  LPWSTR UserName = NULL;
1470  LPWSTR Password = NULL;
1471  BOOL res = FALSE;
1472 
1473  if (GetTextboxText(hwndDlg, IDC_UNLOCK_USERNAME, &UserName) && *UserName == '\0')
1474  {
1475  HeapFree(GetProcessHeap(), 0, UserName);
1476  return FALSE;
1477  }
1478 
1480  {
1481  if (UserName != NULL && Password != NULL &&
1482  wcscmp(UserName, pgContext->UserName) == 0 &&
1483  wcscmp(Password, pgContext->Password) == 0)
1484  {
1486  res = TRUE;
1487  }
1488  else if (wcscmp(UserName, pgContext->UserName) == 0 &&
1489  wcscmp(Password, pgContext->Password) != 0)
1490  {
1491  /* Wrong Password */
1492  LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGPASSWORD, Buffer2, _countof(Buffer2));
1493  LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, _countof(Buffer1));
1494  MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
1495  }
1496  else
1497  {
1498  /* Wrong user name */
1499  if (DoAdminUnlock(pgContext, UserName, NULL, Password))
1500  {
1502  res = TRUE;
1503  }
1504  else
1505  {
1506  LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGUSER, Buffer1, _countof(Buffer1));
1507  wsprintfW(Buffer2, Buffer1, pgContext->DomainName, pgContext->UserName);
1508  LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, _countof(Buffer1));
1509  MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
1510  }
1511  }
1512  }
1513 
1514  if (UserName != NULL)
1515  HeapFree(GetProcessHeap(), 0, UserName);
1516 
1517  if (Password != NULL)
1519 
1520  return res;
1521 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define TRUE
Definition: types.h:120
BOOL DoAdminUnlock(IN PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:665
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WLX_SAS_ACTION_UNLOCK_WKSTA
Definition: winwlx.h:60
#define GetProcessHeap()
Definition: compat.h:595
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define IDC_UNLOCK_PASSWORD
Definition: resource.h:32
#define IDS_LOCKEDWRONGPASSWORD
Definition: resource.h:98
#define IDC_UNLOCK_USERNAME
Definition: resource.h:31
#define MB_ICONERROR
Definition: winuser.h:781
#define IDS_LOCKEDWRONGUSER
Definition: resource.h:99
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
static BOOL GetTextboxText(IN HWND hwndDlg, IN INT TextboxId, OUT LPWSTR *pText)
Definition: gui.c:542
#define IDS_COMPUTERLOCKED
Definition: resource.h:97
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by UnlockDialogProc().

◆ GetTextboxText()

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

Definition at line 542 of file gui.c.

546 {
547  LPWSTR Text;
548  int Count;
549 
550  Count = GetWindowTextLength(GetDlgItem(hwndDlg, TextboxId));
551  Text = HeapAlloc(GetProcessHeap(), 0, (Count + 1) * sizeof(WCHAR));
552  if (!Text)
553  return FALSE;
554  if (Count != GetWindowTextW(GetDlgItem(hwndDlg, TextboxId), Text, Count + 1))
555  {
557  return FALSE;
558  }
559  *pText = Text;
560  return TRUE;
561 }
LPCSTR pText
Definition: txtscale.cpp:79
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
int Count
Definition: noreturn.cpp:7
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
#define GetWindowTextLength
Definition: winuser.h:5779
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
char * Text
Definition: combotst.c:136

Referenced by DoLogon(), and DoUnlock().

◆ GUIDisplayLockedNotice()

static VOID GUIDisplayLockedNotice ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1670 of file gui.c.

1672 {
1673  TRACE("GUIdisplayLockedNotice()\n");
1674 
1675  pgContext->pWlxFuncs->WlxDialogBoxParam(
1676  pgContext->hWlx,
1677  pgContext->hDllInstance,
1679  GetDesktopWindow(),
1681  (LPARAM)pgContext);
1682 }
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
static INT_PTR CALLBACK LockedDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1622
#define IDD_LOCKED
Definition: resource.h:26
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ GUIDisplaySASNotice()

static VOID GUIDisplaySASNotice ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 525 of file gui.c.

527 {
528  TRACE("GUIDisplaySASNotice()\n");
529 
530  /* Display the notice window */
531  pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
532  pgContext->hDllInstance,
536  (LPARAM)pgContext);
537 }
#define IDD_WELCOME
Definition: resource.h:8
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
static INT_PTR CALLBACK WelcomeDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:482
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ GUIDisplayStatusMessage()

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

Definition at line 394 of file gui.c.

400 {
402  HANDLE Thread;
403  DWORD ThreadId;
404 
405  TRACE("GUIDisplayStatusMessage(%ws)\n", pMessage);
406 
407  if (!pgContext->hStatusWindow)
408  {
409  /*
410  * If everything goes correctly, 'msg' is freed
411  * by the 'StartupWindowThread' thread.
412  */
415  sizeof(*msg));
416  if(!msg)
417  return FALSE;
418 
419  msg->Context = pgContext;
420  msg->dwOptions = dwOptions;
421  msg->pTitle = pTitle;
422  msg->pMessage = pMessage;
423  msg->hDesktop = hDesktop;
424 
425  msg->StartupEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
426 
427  if (!msg->StartupEvent)
428  {
429  HeapFree(GetProcessHeap(), 0, msg);
430  return FALSE;
431  }
432 
434  0,
436  (PVOID)msg,
437  0,
438  &ThreadId);
439  if (Thread)
440  {
441  /* 'msg' will be freed by 'StartupWindowThread' */
442 
444  WaitForSingleObject(msg->StartupEvent, INFINITE);
445  CloseHandle(msg->StartupEvent);
446  return TRUE;
447  }
448  else
449  {
450  /*
451  * The 'StartupWindowThread' thread couldn't be created,
452  * so we need to free the allocated 'msg'.
453  */
454  HeapFree(GetProcessHeap(), 0, msg);
455  }
456 
457  return FALSE;
458  }
459 
460  if (pTitle)
461  SetWindowTextW(pgContext->hStatusWindow, pTitle);
462 
463  SetDlgItemTextW(pgContext->hStatusWindow, IDC_STATUS_MESSAGE, pMessage);
464 
465  return TRUE;
466 }
DWORD dwOptions
Definition: solitaire.cpp:24
#define CloseHandle
Definition: compat.h:598
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
#define TRUE
Definition: types.h:120
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
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
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
#define IDC_STATUS_MESSAGE
Definition: resource.h:6
static DWORD WINAPI StartupWindowThread(LPVOID lpParam)
Definition: gui.c:355
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define msg(x)
Definition: auth_time.c:54
#define INFINITE
Definition: serial.h:102
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ GUIInitialize()

static BOOL GUIInitialize ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 116 of file gui.c.

118 {
119  TRACE("GUIInitialize(%p)\n", pgContext);
120  return TRUE;
121 }
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4

◆ GUILockedSAS()

static INT GUILockedSAS ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1595 of file gui.c.

1597 {
1598  int result;
1599 
1600  TRACE("GUILockedSAS()\n");
1601 
1602  result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1603  pgContext->hWlx,
1604  pgContext->hDllInstance,
1606  GetDesktopWindow(),
1608  (LPARAM)pgContext);
1609  if (result >= WLX_SAS_ACTION_LOGON &&
1611  {
1612  WARN("GUILockedSAS() returns 0x%x\n", result);
1613  return result;
1614  }
1615 
1616  WARN("GUILockedSAS() failed (0x%x)\n", result);
1617  return WLX_SAS_ACTION_NONE;
1618 }
#define IDD_UNLOCK
Definition: resource.h:29
GLuint64EXT * result
Definition: glext.h:11304
#define WARN(fmt,...)
Definition: debug.h:112
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK UnlockDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1527
#define TRACE(s)
Definition: solgame.cpp:4
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
#define WLX_SAS_ACTION_SWITCH_CONSOLE
Definition: winwlx.h:69
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ GUILoggedOnSAS()

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

Definition at line 1019 of file gui.c.

1022 {
1023  INT result;
1024 
1025  TRACE("GUILoggedOnSAS()\n");
1026 
1027  if (dwSasType != WLX_SAS_TYPE_CTRL_ALT_DEL)
1028  {
1029  /* Nothing to do for WLX_SAS_TYPE_TIMEOUT ; the dialog will
1030  * close itself thanks to the use of WlxDialogBoxParam */
1031  return WLX_SAS_ACTION_NONE;
1032  }
1033 
1034  pgContext->pWlxFuncs->WlxSwitchDesktopToWinlogon(
1035  pgContext->hWlx);
1036 
1037  result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1038  pgContext->hWlx,
1039  pgContext->hDllInstance,
1041  GetDesktopWindow(),
1043  (LPARAM)pgContext);
1044 
1045  if (result < WLX_SAS_ACTION_LOGON ||
1047  {
1049  }
1050 
1051  if (result == WLX_SAS_ACTION_NONE)
1052  {
1053  pgContext->pWlxFuncs->WlxSwitchDesktopToUser(
1054  pgContext->hWlx);
1055  }
1056 
1057  return result;
1058 }
GLuint64EXT * result
Definition: glext.h:11304
int32_t INT
Definition: typedefs.h:58
static INT_PTR CALLBACK SecurityDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:956
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_SECURITY
Definition: inetcpl.h:83
#define TRACE(s)
Definition: solgame.cpp:4
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
#define WLX_SAS_ACTION_SWITCH_CONSOLE
Definition: winwlx.h:69
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ GUILoggedOutSAS()

static INT GUILoggedOutSAS ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1378 of file gui.c.

1380 {
1381  LEGALNOTICEDATA LegalNotice = {NULL, NULL};
1382  HKEY hKey = NULL;
1383  LONG rc;
1384  int result;
1385 
1386  TRACE("GUILoggedOutSAS()\n");
1387 
1389  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1390  0,
1392  &hKey);
1393  if (rc == ERROR_SUCCESS)
1394  {
1396  L"LegalNoticeCaption",
1397  &LegalNotice.pszCaption);
1398 
1400  L"LegalNoticeText",
1401  &LegalNotice.pszText);
1402 
1403  RegCloseKey(hKey);
1404  }
1405 
1406  if (LegalNotice.pszCaption != NULL && wcslen(LegalNotice.pszCaption) != 0 &&
1407  LegalNotice.pszText != NULL && wcslen(LegalNotice.pszText) != 0)
1408  {
1409  pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
1410  pgContext->hDllInstance,
1412  GetDesktopWindow(),
1414  (LPARAM)&LegalNotice);
1415  }
1416 
1417  if (LegalNotice.pszCaption != NULL)
1418  HeapFree(GetProcessHeap(), 0, LegalNotice.pszCaption);
1419 
1420  if (LegalNotice.pszText != NULL)
1421  HeapFree(GetProcessHeap(), 0, LegalNotice.pszText);
1422 
1423  result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1424  pgContext->hWlx,
1425  pgContext->hDllInstance,
1427  GetDesktopWindow(),
1429  (LPARAM)pgContext);
1430  if (result >= WLX_SAS_ACTION_LOGON &&
1432  {
1433  WARN("WlxLoggedOutSAS() returns 0x%x\n", result);
1434  return result;
1435  }
1436 
1437  WARN("WlxDialogBoxParam() failed (0x%x)\n", result);
1438  return WLX_SAS_ACTION_NONE;
1439 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint64EXT * result
Definition: glext.h:11304
#define IDD_LEGALNOTICE
Definition: resource.h:66
static INT_PTR CALLBACK LegalNoticeDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1343
#define WARN(fmt,...)
Definition: debug.h:112
LONG ReadRegSzValue(IN HKEY hKey, IN LPCWSTR pszValue, OUT LPWSTR *pValue)
Definition: msgina.c:60
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LPWSTR pszCaption
Definition: gui.c:27
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_LOGON
Definition: resource.h:141
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
static INT_PTR CALLBACK LogonDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1254
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
#define WLX_SAS_ACTION_SWITCH_CONSOLE
Definition: winwlx.h:69
FxAutoRegKey hKey
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LPWSTR pszText
Definition: gui.c:28
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ GUIRemoveStatusMessage()

static BOOL GUIRemoveStatusMessage ( IN PGINA_CONTEXT  pgContext)
static

Definition at line 469 of file gui.c.

471 {
472  if (pgContext->hStatusWindow)
473  {
474  EndDialog(pgContext->hStatusWindow, 0);
475  pgContext->hStatusWindow = NULL;
476  }
477 
478  return TRUE;
479 }
#define TRUE
Definition: types.h:120
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define NULL
Definition: types.h:112

◆ LegalNoticeDialogProc()

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

Definition at line 1343 of file gui.c.

1348 {
1349  PLEGALNOTICEDATA pLegalNotice;
1350 
1351  switch (uMsg)
1352  {
1353  case WM_INITDIALOG:
1354  pLegalNotice = (PLEGALNOTICEDATA)lParam;
1355  SetWindowTextW(hwndDlg, pLegalNotice->pszCaption);
1356  SetDlgItemTextW(hwndDlg, IDC_LEGALNOTICE_TEXT, pLegalNotice->pszText);
1357  return TRUE;
1358 
1359  case WM_COMMAND:
1360  switch (LOWORD(wParam))
1361  {
1362  case IDOK:
1363  EndDialog(hwndDlg, 0);
1364  return TRUE;
1365 
1366  case IDCANCEL:
1367  EndDialog(hwndDlg, 0);
1368  return TRUE;
1369  }
1370  break;
1371  }
1372 
1373  return FALSE;
1374 }
struct _LEGALNOTICEDATA * PLEGALNOTICEDATA
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDC_LEGALNOTICE_TEXT
Definition: resource.h:67
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define FALSE
Definition: types.h:117
LPWSTR pszCaption
Definition: gui.c:27
#define WM_COMMAND
Definition: winuser.h:1727
LPWSTR pszText
Definition: gui.c:28
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by GUILoggedOutSAS().

◆ LockedDialogProc()

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

Definition at line 1622 of file gui.c.

1627 {
1628  PDLG_DATA pDlgData;
1629 
1630  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1631 
1632  switch (uMsg)
1633  {
1634  case WM_INITDIALOG:
1635  {
1636  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
1637  if (pDlgData == NULL)
1638  return FALSE;
1639 
1640  DlgData_LoadBitmaps(pDlgData);
1641 
1642  SetWelcomeText(hwndDlg);
1643 
1644  SetLockMessage(hwndDlg, IDC_LOCKED_MESSAGE, pDlgData->pgContext);
1645  return TRUE;
1646  }
1647  case WM_PAINT:
1648  {
1649  PAINTSTRUCT ps;
1650  if (pDlgData && pDlgData->hLogoBitmap)
1651  {
1652  BeginPaint(hwndDlg, &ps);
1653  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
1654  EndPaint(hwndDlg, &ps);
1655  }
1656  return TRUE;
1657  }
1658  case WM_DESTROY:
1659  {
1660  DlgData_Destroy(hwndDlg);
1661  return TRUE;
1662  }
1663  }
1664 
1665  return FALSE;
1666 }
struct _DLG_DATA * PDLG_DATA
static VOID SetLockMessage(HWND hwnd, INT nDlgItem, PGINA_CONTEXT pgContext)
Definition: gui.c:1443
#define TRUE
Definition: types.h:120
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4809
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define IDC_LOCKED_MESSAGE
Definition: resource.h:27
#define FALSE
Definition: types.h:117
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_DESTROY
Definition: winuser.h:1596
#define WM_PAINT
Definition: winuser.h:1607
PGINA_CONTEXT pgContext
Definition: gui.c:36
static VOID DlgData_Destroy(_Inout_ HWND hwndDlg)
Definition: gui.c:90
BOOL WINAPI DrawStateW(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
static VOID DlgData_LoadBitmaps(_Inout_ PDLG_DATA pDlgData)
Definition: gui.c:60
Definition: gui.c:34
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:48
#define NULL
Definition: types.h:112
#define DST_BITMAP
Definition: winuser.h:516
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:125
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
HBITMAP hLogoBitmap
Definition: gui.c:37

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 856 of file gui.c.

861 {
862  switch (uMsg)
863  {
864  case WM_INITDIALOG:
865  return TRUE;
866 
867  case WM_COMMAND:
868  switch (LOWORD(wParam))
869  {
870  case IDYES:
871  EndDialog(hwndDlg, IDYES);
872  return TRUE;
873 
874  case IDNO:
875  EndDialog(hwndDlg, IDNO);
876  return TRUE;
877  }
878  break;
879 
880  case WM_CLOSE:
881  EndDialog(hwndDlg, IDNO);
882  return TRUE;
883  }
884 
885  return FALSE;
886 }
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define WM_CLOSE
Definition: winuser.h:1608
#define WM_COMMAND
Definition: winuser.h:1727
#define IDNO
Definition: winuser.h:830
#define WM_INITDIALOG
Definition: winuser.h:1726
#define LOWORD(l)
Definition: pedump.c:82

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 1254 of file gui.c.

1259 {
1260  PDLG_DATA pDlgData;
1261 
1262  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1263 
1264  switch (uMsg)
1265  {
1266  case WM_INITDIALOG:
1267  {
1268  /* FIXME: take care of NoDomainUI */
1269  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
1270  if (pDlgData == NULL)
1271  return FALSE;
1272 
1273  DlgData_LoadBitmaps(pDlgData);
1274 
1275  SetWelcomeText(hwndDlg);
1276 
1277  if (pDlgData->pgContext->bAutoAdminLogon ||
1278  !pDlgData->pgContext->bDontDisplayLastUserName)
1279  SetDlgItemTextW(hwndDlg, IDC_LOGON_USERNAME, pDlgData->pgContext->UserName);
1280 
1281  if (pDlgData->pgContext->bAutoAdminLogon)
1282  SetDlgItemTextW(hwndDlg, IDC_LOGON_PASSWORD, pDlgData->pgContext->Password);
1283 
1285 
1286  if (pDlgData->pgContext->bDisableCAD)
1287  EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
1288 
1289  if (!pDlgData->pgContext->bShutdownWithoutLogon)
1291 
1293 
1294  if (pDlgData->pgContext->bAutoAdminLogon)
1295  PostMessage(GetDlgItem(hwndDlg, IDOK), BM_CLICK, 0, 0);
1296 
1297  return TRUE;
1298  }
1299 
1300  case WM_PAINT:
1301  {
1302  PAINTSTRUCT ps;
1303  if (pDlgData && pDlgData->hLogoBitmap)
1304  {
1305  BeginPaint(hwndDlg, &ps);
1306  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
1307  EndPaint(hwndDlg, &ps);
1308  }
1309  return TRUE;
1310  }
1311 
1312  case WM_DESTROY:
1313  DlgData_Destroy(hwndDlg);
1314  return TRUE;
1315 
1316  case WM_COMMAND:
1317  switch (LOWORD(wParam))
1318  {
1319  case IDOK:
1320  if (DoLogon(hwndDlg, pDlgData->pgContext))
1321  EndDialog(hwndDlg, WLX_SAS_ACTION_LOGON);
1322  return TRUE;
1323 
1324  case IDCANCEL:
1325  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
1326  return TRUE;
1327 
1328  case IDC_LOGON_SHUTDOWN:
1329  if (OnShutDown(hwndDlg, pDlgData->pgContext) == IDOK)
1330  EndDialog(hwndDlg, pDlgData->pgContext->nShutdownAction);
1331  return TRUE;
1332  }
1333  break;
1334  }
1335 
1336  return FALSE;
1337 }
struct _DLG_DATA * PDLG_DATA
#define IDC_LOGON_SHUTDOWN
Definition: resource.h:15
#define IDOK
Definition: winuser.h:824
#define IDC_LOGON_PASSWORD
Definition: resource.h:13
#define TRUE
Definition: types.h:120
BOOL bDontDisplayLastUserName
Definition: msgina.h:43
static INT OnShutDown(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:907
HWND WINAPI SetFocus(_In_opt_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4809
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_LOGON_DOMAIN
Definition: resource.h:14
ULONG nShutdownAction
Definition: msgina.h:47
#define FALSE
Definition: types.h:117
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR UserName[256]
Definition: msgina.h:50
#define WM_DESTROY
Definition: winuser.h:1596
#define PostMessage
Definition: winuser.h:5812
#define BM_CLICK
Definition: winuser.h:1904
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL bShutdownWithoutLogon
Definition: msgina.h:44
static VOID SetDomainComboBox(HWND hwndDomainComboBox, PGINA_CONTEXT pgContext)
Definition: gui.c:1219
#define IDC_LOGON_USERNAME
Definition: resource.h:12
#define WM_PAINT
Definition: winuser.h:1607
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
PGINA_CONTEXT pgContext
Definition: gui.c:36
static BOOL DoLogon(IN HWND hwndDlg, IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1063
static VOID DlgData_Destroy(_Inout_ HWND hwndDlg)
Definition: gui.c:90
BOOL WINAPI DrawStateW(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_COMMAND
Definition: winuser.h:1727
static VOID DlgData_LoadBitmaps(_Inout_ PDLG_DATA pDlgData)
Definition: gui.c:60
Definition: gui.c:34
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL bAutoAdminLogon
Definition: msgina.h:42
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:48
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define NULL
Definition: types.h:112
#define DST_BITMAP
Definition: winuser.h:516
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:125
#define IDCANCEL
Definition: winuser.h:825
WCHAR Password[256]
Definition: msgina.h:52
BOOL bDisableCAD
Definition: msgina.h:41
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
HBITMAP hLogoBitmap
Definition: gui.c:37

Referenced by GUILoggedOutSAS().

◆ OnChangePassword()

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

Definition at line 833 of file gui.c.

836 {
837  INT res;
838 
839  TRACE("OnChangePassword()\n");
840 
841  res = pgContext->pWlxFuncs->WlxDialogBoxParam(
842  pgContext->hWlx,
843  pgContext->hDllInstance,
845  hwnd,
847  (LPARAM)pgContext);
848 
849  TRACE("Result: %x\n", res);
850 
851  return FALSE;
852 }
#define IDD_CHANGEPWD
Definition: resource.h:34
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
static INT_PTR CALLBACK ChangePasswordDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:744
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
GLuint res
Definition: glext.h:9613
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by DoLogon(), and SecurityDialogProc().

◆ OnInitSecurityDlg()

static VOID OnInitSecurityDlg ( HWND  hwnd,
PGINA_CONTEXT  pgContext 
)
static

Definition at line 800 of file gui.c.

802 {
803  WCHAR Buffer1[256];
804  WCHAR Buffer2[256];
805  WCHAR Buffer3[256];
806  WCHAR Buffer4[512];
807 
808  LoadStringW(pgContext->hDllInstance, IDS_LOGONMSG, Buffer1, _countof(Buffer1));
809 
810  wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
811  wsprintfW(Buffer4, Buffer1, Buffer2);
812 
814 
815  LoadStringW(pgContext->hDllInstance, IDS_LOGONDATE, Buffer1, _countof(Buffer1));
816 
818  (SYSTEMTIME*)&pgContext->LogonTime, NULL, Buffer2, _countof(Buffer2));
819 
821  (SYSTEMTIME*)&pgContext->LogonTime, NULL, Buffer3, _countof(Buffer3));
822 
823  wsprintfW(Buffer4, Buffer1, Buffer2, Buffer3);
824 
826 
827  if (pgContext->bAutoAdminLogon)
829 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
WCHAR DomainName[256]
Definition: msgina.h:51
#define IDC_SECURITY_MESSAGE
Definition: resource.h:18
#define LOCALE_USER_DEFAULT
#define DATE_SHORTDATE
Definition: winnls.h:196
HANDLE hDllInstance
Definition: msgina.h:37
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define IDC_SECURITY_LOGONDATE
Definition: resource.h:19
WCHAR UserName[256]
Definition: msgina.h:50
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
SYSTEMTIME LogonTime
Definition: msgina.h:53
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
#define IDS_LOGONMSG
Definition: resource.h:95
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL bAutoAdminLogon
Definition: msgina.h:42
#define NULL
Definition: types.h:112
#define IDC_SECURITY_LOGOFF
Definition: resource.h:21
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1079
#define IDS_LOGONDATE
Definition: resource.h:96

Referenced by SecurityDialogProc().

◆ OnLogOff()

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

Definition at line 891 of file gui.c.

894 {
895  return pgContext->pWlxFuncs->WlxDialogBoxParam(
896  pgContext->hWlx,
897  pgContext->hDllInstance,
899  hwndDlg,
901  (LPARAM)pgContext);
902 }
#define IDD_LOGOFF
Definition: resource.h:41
LONG_PTR LPARAM
Definition: windef.h:208
static INT_PTR CALLBACK LogOffDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:856
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by SecurityDialogProc().

◆ OnShutDown()

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

Definition at line 907 of file gui.c.

910 {
911  INT ret;
912  DWORD ShutdownOptions;
913 
914  TRACE("OnShutDown(%p %p)\n", hwndDlg, pgContext);
915 
916  pgContext->nShutdownAction = GetDefaultShutdownSelState();
917  ShutdownOptions = GetDefaultShutdownOptions();
918 
919  if (pgContext->UserToken != NULL)
920  {
921  if (ImpersonateLoggedOnUser(pgContext->UserToken))
922  {
923  pgContext->nShutdownAction = LoadShutdownSelState();
924  ShutdownOptions = GetAllowedShutdownOptions();
925  RevertToSelf();
926  }
927  else
928  {
929  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
930  }
931  }
932 
933  ret = ShutdownDialog(hwndDlg, ShutdownOptions, pgContext);
934 
935  if (ret == IDOK)
936  {
937  if (pgContext->UserToken != NULL)
938  {
939  if (ImpersonateLoggedOnUser(pgContext->UserToken))
940  {
941  SaveShutdownSelState(pgContext->nShutdownAction);
942  RevertToSelf();
943  }
944  else
945  {
946  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
947  }
948  }
949  }
950 
951  return ret;
952 }
#define IDOK
Definition: winuser.h:824
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1610
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
DWORD GetDefaultShutdownOptions(VOID)
Definition: shutdown.c:764
int32_t INT
Definition: typedefs.h:58
DWORD GetDefaultShutdownSelState(VOID)
Definition: shutdown.c:427
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD LoadShutdownSelState(VOID)
Definition: shutdown.c:433
#define ERR(fmt,...)
Definition: debug.h:110
INT_PTR ShutdownDialog(IN HWND hwndDlg, IN DWORD ShutdownOptions, IN PGINA_CONTEXT pgContext)
Definition: shutdown.c:1189
#define NULL
Definition: types.h:112
VOID SaveShutdownSelState(DWORD ShutdownCode)
DWORD GetAllowedShutdownOptions(VOID)
Definition: shutdown.c:770

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 566 of file gui.c.

572 {
573  WCHAR szCaption[256];
574  WCHAR szText[256];
575 
576  LoadStringW(pgContext->hDllInstance, uCaption, szCaption, _countof(szCaption));
577  LoadStringW(pgContext->hDllInstance, uText, szText, _countof(szText));
578 
579  return pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx,
580  hwnd,
581  szText,
582  szCaption,
583  uType);
584 }
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by DoChangePassword(), and DoLogon().

◆ SecurityDialogProc()

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

Definition at line 956 of file gui.c.

961 {
962  PGINA_CONTEXT pgContext;
963 
964  pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
965 
966  switch (uMsg)
967  {
968  case WM_INITDIALOG:
969  {
970  pgContext = (PGINA_CONTEXT)lParam;
971  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
972 
973  SetWelcomeText(hwndDlg);
974 
976  SetFocus(GetDlgItem(hwndDlg, IDNO));
977  return TRUE;
978  }
979 
980  case WM_COMMAND:
981  {
982  switch (LOWORD(wParam))
983  {
984  case IDC_SECURITY_LOCK:
986  return TRUE;
987  case IDC_SECURITY_LOGOFF:
988  if (OnLogOff(hwndDlg, pgContext) == IDYES)
990  return TRUE;
992  if (OnShutDown(hwndDlg, pgContext) == IDOK)
993  EndDialog(hwndDlg, pgContext->nShutdownAction);
994  return TRUE;
996  if (OnChangePassword(hwndDlg, pgContext))
998  return TRUE;
1001  return TRUE;
1002  case IDCANCEL:
1003  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
1004  return TRUE;
1005  }
1006  break;
1007  }
1008  case WM_CLOSE:
1009  {
1010  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
1011  return TRUE;
1012  }
1013  }
1014 
1015  return FALSE;
1016 }
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
#define IDOK
Definition: winuser.h:824
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
static VOID OnInitSecurityDlg(HWND hwnd, PGINA_CONTEXT pgContext)
Definition: gui.c:800
static INT OnShutDown(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:907
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4809
static BOOL OnChangePassword(IN HWND hwnd, IN PGINA_CONTEXT pgContext)
Definition: gui.c:833
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
struct GINA_CONTEXT * PGINA_CONTEXT
ULONG nShutdownAction
Definition: msgina.h:47
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1608
#define IDC_SECURITY_TASKMGR
Definition: resource.h:24
#define WM_COMMAND
Definition: winuser.h:1727
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WLX_SAS_ACTION_PWD_CHANGED
Definition: winwlx.h:58
#define WLX_SAS_ACTION_TASKLIST
Definition: winwlx.h:59
#define IDC_SECURITY_LOGOFF
Definition: resource.h:21
#define IDC_SECURITY_SHUTDOWN
Definition: resource.h:22
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:125
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define IDNO
Definition: winuser.h:830
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_SECURITY_LOCK
Definition: resource.h:20
static INT OnLogOff(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:891
#define IDC_SECURITY_CHANGEPWD
Definition: resource.h:23

Referenced by GUILoggedOnSAS().

◆ SetDomainComboBox()

static VOID SetDomainComboBox ( HWND  hwndDomainComboBox,
PGINA_CONTEXT  pgContext 
)
static

Definition at line 1219 of file gui.c.

1222 {
1223  WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
1224  DWORD dwComputerNameLength;
1225  LONG lIndex = 0;
1226  LONG lFindIndex;
1227 
1228  SendMessageW(hwndDomainComboBox, CB_RESETCONTENT, 0, 0);
1229 
1230  dwComputerNameLength = _countof(szComputerName);
1231  if (GetComputerNameW(szComputerName, &dwComputerNameLength))
1232  {
1233  lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)szComputerName);
1234  }
1235 
1236  if (wcslen(pgContext->DomainName) != 0)
1237  {
1238  lFindIndex = SendMessageW(hwndDomainComboBox, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pgContext->DomainName);
1239  if (lFindIndex == CB_ERR)
1240  {
1241  lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)pgContext->DomainName);
1242  }
1243  else
1244  {
1245  lIndex = lFindIndex;
1246  }
1247  }
1248 
1249  SendMessageW(hwndDomainComboBox, CB_SETCURSEL, lIndex, 0);
1250 }
WCHAR DomainName[256]
Definition: msgina.h:51
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
long LONG
Definition: pedump.c:60
#define CB_ADDSTRING
Definition: winuser.h:1923
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1946
#define CB_ERR
Definition: winuser.h:2415
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CB_SETCURSEL
Definition: winuser.h:1948
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1927

Referenced by LogonDialogProc().

◆ SetLockMessage()

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

Definition at line 1443 of file gui.c.

1446 {
1447  WCHAR Buffer1[256];
1448  WCHAR Buffer2[256];
1449  WCHAR Buffer3[512];
1450 
1451  LoadStringW(pgContext->hDllInstance, IDS_LOCKMSG, Buffer1, _countof(Buffer1));
1452 
1453  wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
1454  wsprintfW(Buffer3, Buffer1, Buffer2);
1455 
1456  SetDlgItemTextW(hwnd, nDlgItem, Buffer3);
1457 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
WCHAR DomainName[256]
Definition: msgina.h:51
HANDLE hDllInstance
Definition: msgina.h:37
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define L(x)
Definition: ntvdm.h:50
WCHAR UserName[256]
Definition: msgina.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define IDS_LOCKMSG
Definition: resource.h:94
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022

Referenced by LockedDialogProc(), and UnlockDialogProc().

◆ SetWelcomeText()

static VOID SetWelcomeText ( HWND  hWnd)
static

Definition at line 125 of file gui.c.

126 {
127  PWCHAR pBuffer = NULL, p;
128  HKEY hKey;
129  DWORD BufSize, dwType, dwWelcomeSize, dwTitleLength;
130  LONG rc;
131 
132  TRACE("SetWelcomeText(%p)\n", hWnd);
133 
134  /* Open the Winlogon key */
136  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
137  0,
139  &hKey);
140  if (rc != ERROR_SUCCESS)
141  {
142  WARN("RegOpenKeyExW() failed with error %lu\n", rc);
143  return;
144  }
145 
146  /* Get the size of the Welcome value */
147  dwWelcomeSize = 0;
148  rc = RegQueryValueExW(hKey,
149  L"Welcome",
150  NULL,
151  &dwType,
152  NULL,
153  &dwWelcomeSize);
154  if (rc == ERROR_FILE_NOT_FOUND || dwWelcomeSize == 0 || dwType != REG_SZ)
155  goto done;
156 
157  dwTitleLength = GetWindowTextLengthW(hWnd);
158  BufSize = dwWelcomeSize + ((dwTitleLength + 1) * sizeof(WCHAR));
159 
161  if (pBuffer == NULL)
162  goto done;
163 
164  GetWindowTextW(hWnd, pBuffer, BufSize / sizeof(WCHAR));
165  wcscat(pBuffer, L" ");
166  p = &pBuffer[dwTitleLength + 1];
167 
169  L"Welcome",
170  NULL,
171  &dwType,
172  (PBYTE)p,
173  &dwWelcomeSize);
174 
176 
177 done:
178  if (pBuffer != NULL)
180 
181  RegCloseKey(hKey);
182 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WARN(fmt,...)
Definition: debug.h:112
HWND hWnd
Definition: settings.c:17
uint16_t * PWCHAR
Definition: typedefs.h:56
#define L(x)
Definition: ntvdm.h:50
long LONG
Definition: pedump.c:60
PVOID pBuffer
#define BufSize
Definition: FsRtlTunnel.c:28
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
unsigned long DWORD
Definition: ntddk_ex.h:95
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
FxAutoRegKey hKey
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define SetWindowText
Definition: winuser.h:5837
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
GLfloat GLfloat p
Definition: glext.h:8902
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

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

◆ StartupWindowThread()

static DWORD WINAPI StartupWindowThread ( LPVOID  lpParam)
static

Definition at line 355 of file gui.c.

356 {
357  HDESK hDesk;
359 
360  /* When SetThreadDesktop is called the system closes the desktop handle when needed
361  so we have to create a new handle because this handle may still be in use by winlogon */
363  msg->hDesktop,
365  (HANDLE*)&hDesk,
366  0,
367  FALSE,
369  {
370  ERR("Duplicating handle failed!\n");
371  HeapFree(GetProcessHeap(), 0, lpParam);
372  return FALSE;
373  }
374 
375  if(!SetThreadDesktop(hDesk))
376  {
377  ERR("Setting thread desktop failed!\n");
378  HeapFree(GetProcessHeap(), 0, lpParam);
379  return FALSE;
380  }
381 
383  hDllInstance,
387  (LPARAM)lpParam);
388 
389  HeapFree(GetProcessHeap(), 0, lpParam);
390  return TRUE;
391 }
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
#define TRUE
Definition: types.h:120
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
#define DUPLICATE_SAME_ACCESS
#define FALSE
Definition: types.h:117
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LONG_PTR LPARAM
Definition: windef.h:208
static HINSTANCE hDllInstance
Definition: clb.c:30
#define GetProcessHeap()
Definition: compat.h:595
static INT_PTR CALLBACK StatusDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:249
#define GetCurrentProcess()
Definition: compat.h:618
#define ERR(fmt,...)
Definition: debug.h:110
#define IDD_STATUS
Definition: resource.h:22
#define msg(x)
Definition: auth_time.c:54
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define HeapFree(x, y, z)
Definition: compat.h:594
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

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 249 of file gui.c.

254 {
255  PDLG_DATA pDlgData;
257 
258  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
259 
260  switch (uMsg)
261  {
262  case WM_INITDIALOG:
263  {
265  if (!msg)
266  return FALSE;
267 
268  msg->Context->hStatusWindow = hwndDlg;
269 
270  if (msg->pTitle)
271  SetWindowTextW(hwndDlg, msg->pTitle);
272  SetDlgItemTextW(hwndDlg, IDC_STATUS_MESSAGE, msg->pMessage);
273  SetEvent(msg->StartupEvent);
274 
275  pDlgData = DlgData_Create(hwndDlg, msg->Context);
276  if (pDlgData == NULL)
277  return FALSE;
278 
279  DlgData_LoadBitmaps(pDlgData);
280  if (pDlgData->hBarBitmap)
281  {
282  if (SetTimer(hwndDlg, IDT_BAR, 20, NULL) == 0)
283  {
284  ERR("SetTimer(IDT_BAR) failed: %d\n", GetLastError());
285  }
286  else
287  {
288  /* Get the animation bar control */
289  pDlgData->hWndBarCtrl = GetDlgItem(hwndDlg, IDC_BAR);
290  }
291  }
292 
293  AdjustStatusMessageWindow(hwndDlg, pDlgData);
294  return TRUE;
295  }
296 
297  case WM_TIMER:
298  {
299  if (pDlgData && pDlgData->hBarBitmap)
300  {
301  /*
302  * Default rotation bar image width is 413 (same as logo)
303  * We can divide 413 by 7 without remainder
304  */
305  pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
306  InvalidateRect(pDlgData->hWndBarCtrl, NULL, FALSE);
307  UpdateWindow(pDlgData->hWndBarCtrl);
308  }
309  return TRUE;
310  }
311 
312  case WM_DRAWITEM:
313  {
315 
316  if (lpDis->CtlID != IDC_BAR)
317  {
318  return FALSE;
319  }
320 
321  if (pDlgData && pDlgData->hBarBitmap)
322  {
323  HDC hdcMem;
324  HGDIOBJ hOld;
325  DWORD off = pDlgData->BarCounter;
326  DWORD iw = pDlgData->BarWidth;
327  DWORD ih = pDlgData->BarHeight;
328 
329  hdcMem = CreateCompatibleDC(lpDis->hDC);
330  hOld = SelectObject(hdcMem, pDlgData->hBarBitmap);
331  BitBlt(lpDis->hDC, off, 0, iw - off, ih, hdcMem, 0, 0, SRCCOPY);
332  BitBlt(lpDis->hDC, 0, 0, off, ih, hdcMem, iw - off, 0, SRCCOPY);
333  SelectObject(hdcMem, hOld);
334  DeleteDC(hdcMem);
335 
336  return TRUE;
337  }
338  return FALSE;
339  }
340 
341  case WM_DESTROY:
342  {
343  if (pDlgData && pDlgData->hBarBitmap)
344  {
345  KillTimer(hwndDlg, IDT_BAR);
346  }
347  DlgData_Destroy(hwndDlg);
348  return TRUE;
349  }
350  }
351  return FALSE;
352 }
struct _DLG_DATA * PDLG_DATA
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
HBITMAP hBarBitmap
Definition: gui.c:38
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
DWORD BarWidth
Definition: gui.c:43
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
static HDC
Definition: imagelist.c:92
BOOL WINAPI UpdateWindow(_In_ HWND)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4809
HWND hWndBarCtrl
Definition: gui.c:39
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define FALSE
Definition: types.h:117
#define GWLP_USERDATA
Definition: treelist.c:63
#define IDT_BAR
Definition: gui.c:32
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1596
DWORD BarCounter
Definition: gui.c:40
#define IDC_BAR
Definition: resource.h:70
static VOID AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
Definition: gui.c:185
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_TIMER
Definition: winuser.h:1729
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_STATUS_MESSAGE
Definition: resource.h:6
DWORD BarHeight
Definition: gui.c:44
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
static VOID DlgData_Destroy(_Inout_ HWND hwndDlg)
Definition: gui.c:90
static VOID DlgData_LoadBitmaps(_Inout_ PDLG_DATA pDlgData)
Definition: gui.c:60
Definition: gui.c:34
#define ERR(fmt,...)
Definition: debug.h:110
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:48
BOOL WINAPI DeleteDC(_In_ HDC)
#define NULL
Definition: types.h:112
#define WM_DRAWITEM
Definition: winuser.h:1632
#define msg(x)
Definition: auth_time.c:54
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define SRCCOPY
Definition: wingdi.h:333
HDC hdcMem
Definition: welcome.c:104
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49

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 1527 of file gui.c.

1532 {
1533  PDLG_DATA pDlgData;
1535 
1536  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1537 
1538  switch (uMsg)
1539  {
1540  case WM_INITDIALOG:
1541  {
1542  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
1543  if (pDlgData == NULL)
1544  return FALSE;
1545 
1546  SetWelcomeText(hwndDlg);
1547 
1548  SetLockMessage(hwndDlg, IDC_UNLOCK_MESSAGE, pDlgData->pgContext);
1549 
1550  SetDlgItemTextW(hwndDlg, IDC_UNLOCK_USERNAME, pDlgData->pgContext->UserName);
1552 
1553  if (pDlgData->pgContext->bDisableCAD)
1554  EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
1555 
1556  DlgData_LoadBitmaps(pDlgData);
1557  return TRUE;
1558  }
1559 
1560  case WM_PAINT:
1561  {
1562  PAINTSTRUCT ps;
1563  if (pDlgData && pDlgData->hLogoBitmap)
1564  {
1565  BeginPaint(hwndDlg, &ps);
1566  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
1567  EndPaint(hwndDlg, &ps);
1568  }
1569  return TRUE;
1570  }
1571  case WM_DESTROY:
1572  DlgData_Destroy(hwndDlg);
1573  return TRUE;
1574 
1575  case WM_COMMAND:
1576  switch (LOWORD(wParam))
1577  {
1578  case IDOK:
1579  if (DoUnlock(hwndDlg, pDlgData->pgContext, &result))
1580  EndDialog(hwndDlg, result);
1581  return TRUE;
1582 
1583  case IDCANCEL:
1584  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
1585  return TRUE;
1586  }
1587  break;
1588  }
1589 
1590  return FALSE;
1591 }
struct _DLG_DATA * PDLG_DATA
static VOID SetLockMessage(HWND hwnd, INT nDlgItem, PGINA_CONTEXT pgContext)
Definition: gui.c:1443
#define IDOK
Definition: winuser.h:824
GLuint64EXT * result
Definition: glext.h:11304
static BOOL DoUnlock(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext, OUT LPINT Action)
Definition: gui.c:1462
#define TRUE
Definition: types.h:120
HWND WINAPI SetFocus(_In_opt_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4809
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define FALSE
Definition: types.h:117
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR UserName[256]
Definition: msgina.h:50
#define WM_DESTROY
Definition: winuser.h:1596
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_UNLOCK_PASSWORD
Definition: resource.h:32
#define WM_PAINT
Definition: winuser.h:1607
PGINA_CONTEXT pgContext
Definition: gui.c:36
static VOID DlgData_Destroy(_Inout_ HWND hwndDlg)
Definition: gui.c:90
#define IDC_UNLOCK_USERNAME
Definition: resource.h:31
BOOL WINAPI DrawStateW(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WM_COMMAND
Definition: winuser.h:1727
static VOID DlgData_LoadBitmaps(_Inout_ PDLG_DATA pDlgData)
Definition: gui.c:60
Definition: gui.c:34
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:48
#define IDC_UNLOCK_MESSAGE
Definition: resource.h:30
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define NULL
Definition: types.h:112
#define DST_BITMAP
Definition: winuser.h:516
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:125
#define IDCANCEL
Definition: winuser.h:825
BOOL bDisableCAD
Definition: msgina.h:41
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
HBITMAP hLogoBitmap
Definition: gui.c:37

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 482 of file gui.c.

487 {
488  PDLG_DATA pDlgData;
489 
490  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
491 
492  switch (uMsg)
493  {
494  case WM_INITDIALOG:
495  {
496  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
497  if (pDlgData == NULL)
498  return FALSE;
499 
500  DlgData_LoadBitmaps(pDlgData);
501  return TRUE;
502  }
503 
504  case WM_PAINT:
505  {
506  PAINTSTRUCT ps;
507  if (pDlgData && pDlgData->hLogoBitmap)
508  {
509  BeginPaint(hwndDlg, &ps);
510  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
511  EndPaint(hwndDlg, &ps);
512  }
513  return TRUE;
514  }
515  case WM_DESTROY:
516  {
517  DlgData_Destroy(hwndDlg);
518  return TRUE;
519  }
520  }
521  return FALSE;
522 }
struct _DLG_DATA * PDLG_DATA
#define TRUE
Definition: types.h:120
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4809
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define FALSE
Definition: types.h:117
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_DESTROY
Definition: winuser.h:1596
#define WM_PAINT
Definition: winuser.h:1607
static VOID DlgData_Destroy(_Inout_ HWND hwndDlg)
Definition: gui.c:90
BOOL WINAPI DrawStateW(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
static VOID DlgData_LoadBitmaps(_Inout_ PDLG_DATA pDlgData)
Definition: gui.c:60
Definition: gui.c:34
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:48
#define NULL
Definition: types.h:112
#define DST_BITMAP
Definition: winuser.h:516
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
HBITMAP hLogoBitmap
Definition: gui.c:37

Referenced by GUIDisplaySASNotice().

Variable Documentation

◆ GinaGraphicalUI

GINA_UI GinaGraphicalUI
Initial value:
= {
}
static INT GUILockedSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1595
static INT GUILoggedOutSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1378
static BOOL GUIDisplayStatusMessage(IN PGINA_CONTEXT pgContext, IN HDESK hDesktop, IN DWORD dwOptions, IN PWSTR pTitle, IN PWSTR pMessage)
Definition: gui.c:394
static INT GUILoggedOnSAS(IN OUT PGINA_CONTEXT pgContext, IN DWORD dwSasType)
Definition: gui.c:1019
static BOOL GUIInitialize(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:116
static BOOL GUIRemoveStatusMessage(IN PGINA_CONTEXT pgContext)
Definition: gui.c:469
static VOID GUIDisplaySASNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:525
static VOID GUIDisplayLockedNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1670

Definition at line 1684 of file gui.c.

Referenced by ChooseGinaUI().