ReactOS  0.4.14-dev-1256-g2125fec
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
 

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 BOOL DlgData_LoadBitmaps (PDLG_DATA pDlgData)
 
static void DlgData_Destroy (PDLG_DATA pDlgData)
 
static BOOL GUIInitialize (IN OUT PGINA_CONTEXT pgContext)
 
static VOID SetWelcomeText (HWND hWnd)
 
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
 

Typedef Documentation

◆ DISPLAYSTATUSMSG

◆ DLG_DATA

◆ LEGALNOTICEDATA

◆ PDISPLAYSTATUSMSG

◆ PDLG_DATA

◆ PLEGALNOTICEDATA

Function Documentation

◆ ChangePasswordDialogProc()

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

Definition at line 646 of file gui.c.

651 {
652  PGINA_CONTEXT pgContext;
653 
654  pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
655 
656  switch (uMsg)
657  {
658  case WM_INITDIALOG:
659  {
660  pgContext = (PGINA_CONTEXT)lParam;
661  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
662 
663  SetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, pgContext->UserName);
667  return TRUE;
668  }
669 
670  case WM_COMMAND:
671  switch (LOWORD(wParam))
672  {
673  case IDOK:
674  if (DoChangePassword(pgContext, hwndDlg))
675  {
676  EndDialog(hwndDlg, TRUE);
677  }
678  else
679  {
683  }
684  return TRUE;
685 
686  case IDCANCEL:
687  EndDialog(hwndDlg, FALSE);
688  return TRUE;
689  }
690  break;
691 
692  case WM_CLOSE:
693  EndDialog(hwndDlg, FALSE);
694  return TRUE;
695  }
696 
697  return FALSE;
698 }
WCHAR DomainName[256]
Definition: msgina.h:51
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDC_CHANGEPWD_DOMAIN
Definition: resource.h:36
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4804
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 GWLP_USERDATA
Definition: treelist.c:63
#define CB_ADDSTRING
Definition: winuser.h:1918
smooth NULL
Definition: ftsmooth.c:416
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:491
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_CLOSE
Definition: winuser.h:1603
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:1943
#define WM_COMMAND
Definition: winuser.h:1722
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IDC_CHANGEPWD_NEWPWD2
Definition: resource.h:39
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
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 45 of file gui.c.

46 {
47  PDLG_DATA pDlgData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pDlgData));
48  if (pDlgData)
49  {
50  pDlgData->pgContext = pgContext;
51  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pDlgData);
52  }
53  return pDlgData;
54 }
#define GWLP_USERDATA
Definition: treelist.c:63
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
PGINA_CONTEXT pgContext
Definition: gui.c:33
Definition: gui.c:31
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define SetWindowLongPtrW
Definition: winuser.h:5321

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

◆ DlgData_Destroy()

static void DlgData_Destroy ( PDLG_DATA  pDlgData)
static

Definition at line 81 of file gui.c.

82 {
83  if (!pDlgData)
84  return;
85 
86  DeleteObject(pDlgData->hLogoBitmap);
87  DeleteObject(pDlgData->hBarBitmap);
88  HeapFree(GetProcessHeap(), 0, pDlgData);
89 }
HBITMAP hBarBitmap
Definition: gui.c:35
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402
HBITMAP hLogoBitmap
Definition: gui.c:34

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

◆ DlgData_LoadBitmaps()

static BOOL DlgData_LoadBitmaps ( PDLG_DATA  pDlgData)
static

Definition at line 57 of file gui.c.

58 {
59  BITMAP bm;
60 
61  if (!pDlgData)
62  return FALSE;
63 
64  pDlgData->hLogoBitmap = LoadImageW(pDlgData->pgContext->hDllInstance,
66  0, 0, LR_DEFAULTCOLOR);
67  GetObject(pDlgData->hLogoBitmap, sizeof(bm), &bm);
68  pDlgData->LogoWidth = bm.bmWidth;
69  pDlgData->LogoHeight = bm.bmHeight;
70 
73  GetObject(pDlgData->hBarBitmap, sizeof(bm), &bm);
74  pDlgData->BarWidth = bm.bmWidth;
75  pDlgData->BarHeight = bm.bmHeight;
76 
77  return (pDlgData->hLogoBitmap != NULL && pDlgData->hBarBitmap != NULL);
78 }
#define IDI_ROSLOGO
Definition: resource.h:42
HBITMAP hBarBitmap
Definition: gui.c:35
DWORD BarWidth
Definition: gui.c:40
HANDLE hDllInstance
Definition: msgina.h:37
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
DWORD LogoHeight
Definition: gui.c:39
smooth NULL
Definition: ftsmooth.c:416
static HINSTANCE hDllInstance
Definition: clb.c:30
DWORD BarHeight
Definition: gui.c:41
#define GetObject
Definition: wingdi.h:4467
PGINA_CONTEXT pgContext
Definition: gui.c:33
#define IDI_BAR
Definition: resource.h:62
Definition: bl.h:1331
#define IMAGE_BITMAP
Definition: winuser.h:211
DWORD LogoWidth
Definition: gui.c:38
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
HBITMAP hLogoBitmap
Definition: gui.c:34

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

◆ DoChangePassword()

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

Definition at line 491 of file gui.c.

494 {
495  WCHAR UserName[256];
496  WCHAR Domain[256];
497  WCHAR OldPassword[256];
498  WCHAR NewPassword1[256];
499  WCHAR NewPassword2[256];
500  PMSV1_0_CHANGEPASSWORD_REQUEST RequestBuffer = NULL;
501  PMSV1_0_CHANGEPASSWORD_RESPONSE ResponseBuffer = NULL;
502  ULONG RequestBufferSize;
503  ULONG ResponseBufferSize = 0;
504  LPWSTR Ptr;
505  BOOL res = FALSE;
508 
509  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_USERNAME, UserName, _countof(UserName));
510  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_DOMAIN, Domain, _countof(Domain));
511  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_OLDPWD, OldPassword, _countof(OldPassword));
512  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD1, NewPassword1, _countof(NewPassword1));
513  GetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD2, NewPassword2, _countof(NewPassword2));
514 
515  /* Compare the two passwords and fail if they do not match */
516  if (wcscmp(NewPassword1, NewPassword2) != 0)
517  {
518  ResourceMessageBox(pgContext,
519  hwndDlg,
523  return FALSE;
524  }
525 
526  /* Calculate the request buffer size */
527  RequestBufferSize = sizeof(MSV1_0_CHANGEPASSWORD_REQUEST) +
528  ((wcslen(Domain) + 1) * sizeof(WCHAR)) +
529  ((wcslen(UserName) + 1) * sizeof(WCHAR)) +
530  ((wcslen(OldPassword) + 1) * sizeof(WCHAR)) +
531  ((wcslen(NewPassword1) + 1) * sizeof(WCHAR));
532 
533  /* Allocate the request buffer */
534  RequestBuffer = HeapAlloc(GetProcessHeap(),
536  RequestBufferSize);
537  if (RequestBuffer == NULL)
538  {
539  ERR("HeapAlloc failed\n");
540  return FALSE;
541  }
542 
543  /* Initialize the request buffer */
544  RequestBuffer->MessageType = MsV1_0ChangePassword;
545  RequestBuffer->Impersonating = TRUE;
546 
547  Ptr = (LPWSTR)((ULONG_PTR)RequestBuffer + sizeof(MSV1_0_CHANGEPASSWORD_REQUEST));
548 
549  /* Pack the domain name */
550  RequestBuffer->DomainName.Length = wcslen(Domain) * sizeof(WCHAR);
551  RequestBuffer->DomainName.MaximumLength = RequestBuffer->DomainName.Length + sizeof(WCHAR);
552  RequestBuffer->DomainName.Buffer = Ptr;
553 
554  RtlCopyMemory(RequestBuffer->DomainName.Buffer,
555  Domain,
556  RequestBuffer->DomainName.MaximumLength);
557 
558  Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->DomainName.MaximumLength);
559 
560  /* Pack the user name */
561  RequestBuffer->AccountName.Length = wcslen(UserName) * sizeof(WCHAR);
562  RequestBuffer->AccountName.MaximumLength = RequestBuffer->AccountName.Length + sizeof(WCHAR);
563  RequestBuffer->AccountName.Buffer = Ptr;
564 
565  RtlCopyMemory(RequestBuffer->AccountName.Buffer,
566  UserName,
567  RequestBuffer->AccountName.MaximumLength);
568 
569  Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->AccountName.MaximumLength);
570 
571  /* Pack the old password */
572  RequestBuffer->OldPassword.Length = wcslen(OldPassword) * sizeof(WCHAR);
573  RequestBuffer->OldPassword.MaximumLength = RequestBuffer->OldPassword.Length + sizeof(WCHAR);
574  RequestBuffer->OldPassword.Buffer = Ptr;
575 
576  RtlCopyMemory(RequestBuffer->OldPassword.Buffer,
577  OldPassword,
578  RequestBuffer->OldPassword.MaximumLength);
579 
580  Ptr = (LPWSTR)((ULONG_PTR)Ptr + RequestBuffer->OldPassword.MaximumLength);
581 
582  /* Pack the new password */
583  RequestBuffer->NewPassword.Length = wcslen(NewPassword1) * sizeof(WCHAR);
584  RequestBuffer->NewPassword.MaximumLength = RequestBuffer->NewPassword.Length + sizeof(WCHAR);
585  RequestBuffer->NewPassword.Buffer = Ptr;
586 
587  RtlCopyMemory(RequestBuffer->NewPassword.Buffer,
588  NewPassword1,
589  RequestBuffer->NewPassword.MaximumLength);
590 
591  /* Connect to the LSA server */
592  if (ConnectToLsa(pgContext) != ERROR_SUCCESS)
593  {
594  ERR("ConnectToLsa() failed\n");
595  goto done;
596  }
597 
598  /* Call the authentication package */
599  Status = LsaCallAuthenticationPackage(pgContext->LsaHandle,
600  pgContext->AuthenticationPackage,
601  RequestBuffer,
602  RequestBufferSize,
603  (PVOID*)&ResponseBuffer,
604  &ResponseBufferSize,
605  &ProtocolStatus);
606  if (!NT_SUCCESS(Status))
607  {
608  ERR("LsaCallAuthenticationPackage failed (Status 0x%08lx)\n", Status);
609  goto done;
610  }
611 
613  {
614  TRACE("LsaCallAuthenticationPackage failed (ProtocolStatus 0x%08lx)\n", ProtocolStatus);
615  goto done;
616  }
617 
618  res = TRUE;
619 
620  ResourceMessageBox(pgContext,
621  hwndDlg,
625 
626  if ((wcscmp(UserName, pgContext->UserName) == 0) &&
627  (wcscmp(Domain, pgContext->DomainName) == 0) &&
628  (wcscmp(OldPassword, pgContext->Password) == 0))
629  {
630  ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
631  wcscpy(pgContext->Password, NewPassword1);
632  }
633 
634 done:
635  if (RequestBuffer != NULL)
636  HeapFree(GetProcessHeap(), 0, RequestBuffer);
637 
638  if (ResponseBuffer != NULL)
639  LsaFreeReturnBuffer(ResponseBuffer);
640 
641  return res;
642 }
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2265
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
struct _MSV1_0_CHANGEPASSWORD_REQUEST MSV1_0_CHANGEPASSWORD_REQUEST
#define ERROR_SUCCESS
Definition: deptool.c:10
USHORT MaximumLength
Definition: env_spec_w32.h:370
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:1648
static INT ResourceMessageBox(IN PGINA_CONTEXT pgContext, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
Definition: gui.c:468
UNICODE_STRING AccountName
Definition: ntsecapi.h:513
uint32_t ULONG_PTR
Definition: typedefs.h:64
#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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define IDS_PASSWORDCHANGED
Definition: resource.h:85
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
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:84
#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)
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define IDS_CHANGEPWDTITLE
Definition: resource.h:83
MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType
Definition: ntsecapi.h:511
#define MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define IDC_CHANGEPWD_NEWPWD2
Definition: resource.h:39
NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID)
UNICODE_STRING OldPassword
Definition: ntsecapi.h:514
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
WCHAR * LPWSTR
Definition: xmlstorage.h:184
NTSTATUS NTAPI LsaCallAuthenticationPackage(HANDLE, ULONG, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
#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 965 of file gui.c.

968 {
969  LPWSTR UserName = NULL;
970  LPWSTR Password = NULL;
971  LPWSTR Domain = NULL;
972  BOOL result = FALSE;
974 
975  if (GetTextboxText(hwndDlg, IDC_LOGON_USERNAME, &UserName) && *UserName == '\0')
976  goto done;
977 
978  if (GetTextboxText(hwndDlg, IDC_LOGON_DOMAIN, &Domain) && *Domain == '\0')
979  goto done;
980 
981  if (!GetTextboxText(hwndDlg, IDC_LOGON_PASSWORD, &Password))
982  goto done;
983 
984  Status = DoLoginTasks(pgContext, UserName, Domain, Password, &SubStatus);
986  {
987  ResourceMessageBox(pgContext,
988  hwndDlg,
992  goto done;
993  }
995  {
996  TRACE("DoLoginTasks failed! Status 0x%08lx SubStatus 0x%08lx\n", Status, SubStatus);
997 
999  {
1000  ResourceMessageBox(pgContext,
1001  hwndDlg,
1005  goto done;
1006  }
1008  {
1009  TRACE("Account locked!\n");
1010  ResourceMessageBox(pgContext,
1011  hwndDlg,
1012  MB_OK | MB_ICONERROR,
1015  goto done;
1016  }
1017  else if ((SubStatus == STATUS_PASSWORD_MUST_CHANGE) ||
1019  {
1021  ResourceMessageBox(pgContext,
1022  hwndDlg,
1023  MB_OK | MB_ICONSTOP,
1026  else
1027  ResourceMessageBox(pgContext,
1028  hwndDlg,
1029  MB_OK | MB_ICONSTOP,
1032 
1033  if (!OnChangePassword(hwndDlg,
1034  pgContext))
1035  goto done;
1036 
1037  Status = DoLoginTasks(pgContext,
1038  pgContext->UserName,
1039  pgContext->DomainName,
1040  pgContext->Password,
1041  &SubStatus);
1042  if (!NT_SUCCESS(Status))
1043  {
1044  TRACE("Login after password change failed! (Status 0x%08lx)\n", Status);
1045 
1046  goto done;
1047  }
1048  }
1049  else if (SubStatus == STATUS_ACCOUNT_EXPIRED)
1050  {
1051  ResourceMessageBox(pgContext,
1052  hwndDlg,
1056  }
1058  {
1059  ResourceMessageBox(pgContext,
1060  hwndDlg,
1061  MB_OK | MB_ICONERROR,
1064  goto done;
1065  }
1067  {
1068  ResourceMessageBox(pgContext,
1069  hwndDlg,
1070  MB_OK | MB_ICONERROR,
1073  goto done;
1074  }
1075  else
1076  {
1077  TRACE("Other error!\n");
1078  ResourceMessageBox(pgContext,
1079  hwndDlg,
1080  MB_OK | MB_ICONERROR,
1083  goto done;
1084  }
1085  }
1086  else if (!NT_SUCCESS(Status))
1087  {
1088  TRACE("DoLoginTasks failed! Status 0x%08lx\n", Status);
1089  goto done;
1090  }
1091 
1092  if (!CreateProfile(pgContext, UserName, Domain, Password))
1093  {
1094  ERR("Failed to create the profile!\n");
1095  goto done;
1096  }
1097 
1098  ZeroMemory(pgContext->Password, sizeof(pgContext->Password));
1099  wcscpy(pgContext->Password, Password);
1100 
1101  result = TRUE;
1102 
1103 done:
1104  pgContext->bAutoAdminLogon = FALSE;
1105 
1106  if (UserName != NULL)
1107  HeapFree(GetProcessHeap(), 0, UserName);
1108 
1109  if (Password != NULL)
1111 
1112  if (Domain != NULL)
1113  HeapFree(GetProcessHeap(), 0, Domain);
1114 
1115  return result;
1116 }
#define IDS_PASSWORDEXPIRED
Definition: resource.h:90
#define TRUE
Definition: types.h:120
#define IDC_LOGON_PASSWORD
Definition: resource.h:13
LONG NTSTATUS
Definition: precomp.h:26
#define ZeroMemory
Definition: winbase.h:1648
#define IDS_LOGONTITLE
Definition: resource.h:86
#define STATUS_ACCOUNT_LOCKED_OUT
Definition: ntstatus.h:682
#define MB_ICONSTOP
Definition: winuser.h:797
static BOOL OnChangePassword(IN HWND hwnd, IN PGINA_CONTEXT pgContext)
Definition: gui.c:735
#define IDS_ACCOUNTEXPIRED
Definition: resource.h:91
static INT ResourceMessageBox(IN PGINA_CONTEXT pgContext, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
Definition: gui.c:468
#define STATUS_ACCOUNT_EXPIRED
Definition: ntstatus.h:622
#define IDS_ACCOUNTRESTRICTION
Definition: resource.h:95
#define STATUS_INVALID_LOGON_HOURS
Definition: ntstatus.h:333
#define STATUS_ACCOUNT_RESTRICTION
Definition: ntstatus.h:332
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define IDC_LOGON_DOMAIN
Definition: resource.h:14
_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:92
smooth NULL
Definition: ftsmooth.c:416
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:94
#define STATUS_ACCOUNT_DISABLED
Definition: ntstatus.h:336
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define STATUS_PASSWORD_EXPIRED
Definition: ntstatus.h:335
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define IDS_INVALIDLOGONHOURS
Definition: resource.h:93
#define IDC_LOGON_USERNAME
Definition: resource.h:12
#define IDS_LOGONWRONGUSERORPWD
Definition: resource.h:87
_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
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
#define STATUS_INVALID_WORKSTATION
Definition: ntstatus.h:334
#define STATUS_PASSWORD_MUST_CHANGE
Definition: ntstatus.h:666
#define MB_OK
Definition: winuser.h:784
#define IDS_PASSWORDMUSTCHANGE
Definition: resource.h:89
#define IDS_LOGONUSERDISABLED
Definition: resource.h:88
static BOOL GetTextboxText(IN HWND hwndDlg, IN INT TextboxId, OUT LPWSTR *pText)
Definition: gui.c:444
WCHAR * LPWSTR
Definition: xmlstorage.h:184
return STATUS_SUCCESS
Definition: btrfs.c:2938
GLuint64EXT * result
Definition: glext.h:11304
#define HeapFree(x, y, z)
Definition: compat.h:402
#define STATUS_LOGON_FAILURE
Definition: ntstatus.h:331
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 1364 of file gui.c.

1368 {
1369  WCHAR Buffer1[256];
1370  WCHAR Buffer2[256];
1371  LPWSTR UserName = NULL;
1372  LPWSTR Password = NULL;
1373  BOOL res = FALSE;
1374 
1375  if (GetTextboxText(hwndDlg, IDC_UNLOCK_USERNAME, &UserName) && *UserName == '\0')
1376  {
1377  HeapFree(GetProcessHeap(), 0, UserName);
1378  return FALSE;
1379  }
1380 
1382  {
1383  if (UserName != NULL && Password != NULL &&
1384  wcscmp(UserName, pgContext->UserName) == 0 &&
1385  wcscmp(Password, pgContext->Password) == 0)
1386  {
1388  res = TRUE;
1389  }
1390  else if (wcscmp(UserName, pgContext->UserName) == 0 &&
1391  wcscmp(Password, pgContext->Password) != 0)
1392  {
1393  /* Wrong Password */
1394  LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGPASSWORD, Buffer2, _countof(Buffer2));
1395  LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, _countof(Buffer1));
1396  MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
1397  }
1398  else
1399  {
1400  /* Wrong user name */
1401  if (DoAdminUnlock(pgContext, UserName, NULL, Password))
1402  {
1404  res = TRUE;
1405  }
1406  else
1407  {
1408  LoadStringW(pgContext->hDllInstance, IDS_LOCKEDWRONGUSER, Buffer1, _countof(Buffer1));
1409  wsprintfW(Buffer2, Buffer1, pgContext->DomainName, pgContext->UserName);
1410  LoadStringW(pgContext->hDllInstance, IDS_COMPUTERLOCKED, Buffer1, _countof(Buffer1));
1411  MessageBoxW(hwndDlg, Buffer2, Buffer1, MB_OK | MB_ICONERROR);
1412  }
1413  }
1414  }
1415 
1416  if (UserName != NULL)
1417  HeapFree(GetProcessHeap(), 0, UserName);
1418 
1419  if (Password != NULL)
1421 
1422  return res;
1423 }
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)
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WLX_SAS_ACTION_UNLOCK_WKSTA
Definition: winwlx.h:60
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
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
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
#define IDC_UNLOCK_PASSWORD
Definition: resource.h:32
#define IDS_LOCKEDWRONGPASSWORD
Definition: resource.h:81
#define IDC_UNLOCK_USERNAME
Definition: resource.h:31
#define MB_ICONERROR
Definition: winuser.h:781
#define IDS_LOCKEDWRONGUSER
Definition: resource.h:82
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define MB_OK
Definition: winuser.h:784
static BOOL GetTextboxText(IN HWND hwndDlg, IN INT TextboxId, OUT LPWSTR *pText)
Definition: gui.c:444
#define IDS_COMPUTERLOCKED
Definition: resource.h:80
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by UnlockDialogProc().

◆ GetTextboxText()

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

Definition at line 444 of file gui.c.

448 {
449  LPWSTR Text;
450  int Count;
451 
452  Count = GetWindowTextLength(GetDlgItem(hwndDlg, TextboxId));
453  Text = HeapAlloc(GetProcessHeap(), 0, (Count + 1) * sizeof(WCHAR));
454  if (!Text)
455  return FALSE;
456  if (Count != GetWindowTextW(GetDlgItem(hwndDlg, TextboxId), Text, Count + 1))
457  {
459  return FALSE;
460  }
461  *pText = Text;
462  return TRUE;
463 }
#define TRUE
Definition: types.h:120
LPCSTR pText
Definition: txtscale.cpp:79
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define GetProcessHeap()
Definition: compat.h:403
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:5774
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402
char * Text
Definition: combotst.c:136

Referenced by DoLogon(), and DoUnlock().

◆ GUIDisplayLockedNotice()

static VOID GUIDisplayLockedNotice ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1572 of file gui.c.

1574 {
1575  TRACE("GUIdisplayLockedNotice()\n");
1576 
1577  pgContext->pWlxFuncs->WlxDialogBoxParam(
1578  pgContext->hWlx,
1579  pgContext->hDllInstance,
1581  GetDesktopWindow(),
1583  (LPARAM)pgContext);
1584 }
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:1524
#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 427 of file gui.c.

429 {
430  TRACE("GUIDisplaySASNotice()\n");
431 
432  /* Display the notice window */
433  pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
434  pgContext->hDllInstance,
438  (LPARAM)pgContext);
439 }
#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:384
#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 296 of file gui.c.

302 {
304  HANDLE Thread;
305  DWORD ThreadId;
306 
307  TRACE("GUIDisplayStatusMessage(%ws)\n", pMessage);
308 
309  if (!pgContext->hStatusWindow)
310  {
311  /*
312  * If everything goes correctly, 'msg' is freed
313  * by the 'StartupWindowThread' thread.
314  */
317  sizeof(*msg));
318  if(!msg)
319  return FALSE;
320 
321  msg->Context = pgContext;
322  msg->dwOptions = dwOptions;
323  msg->pTitle = pTitle;
324  msg->pMessage = pMessage;
325  msg->hDesktop = hDesktop;
326 
327  msg->StartupEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
328 
329  if (!msg->StartupEvent)
330  {
331  HeapFree(GetProcessHeap(), 0, msg);
332  return FALSE;
333  }
334 
336  0,
338  (PVOID)msg,
339  0,
340  &ThreadId);
341  if (Thread)
342  {
343  /* 'msg' will be freed by 'StartupWindowThread' */
344 
346  WaitForSingleObject(msg->StartupEvent, INFINITE);
347  CloseHandle(msg->StartupEvent);
348  return TRUE;
349  }
350  else
351  {
352  /*
353  * The 'StartupWindowThread' thread couldn't be created,
354  * so we need to free the allocated 'msg'.
355  */
356  HeapFree(GetProcessHeap(), 0, msg);
357  }
358 
359  return FALSE;
360  }
361 
362  if (pTitle)
363  SetWindowTextW(pgContext->hStatusWindow, pTitle);
364 
365  SetDlgItemTextW(pgContext->hStatusWindow, IDC_STATUS_MESSAGE, pMessage);
366 
367  return TRUE;
368 }
DWORD dwOptions
Definition: solitaire.cpp:23
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
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
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:136
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
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:2653
#define IDC_STATUS_MESSAGE
Definition: resource.h:6
static DWORD WINAPI StartupWindowThread(LPVOID lpParam)
Definition: gui.c:257
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define msg(x)
Definition: auth_time.c:54
#define INFINITE
Definition: serial.h:102
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ GUIInitialize()

static BOOL GUIInitialize ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 92 of file gui.c.

94 {
95  TRACE("GUIInitialize(%p)\n", pgContext);
96  return TRUE;
97 }
#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 1497 of file gui.c.

1499 {
1500  int result;
1501 
1502  TRACE("GUILockedSAS()\n");
1503 
1504  result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1505  pgContext->hWlx,
1506  pgContext->hDllInstance,
1508  GetDesktopWindow(),
1510  (LPARAM)pgContext);
1511  if (result >= WLX_SAS_ACTION_LOGON &&
1513  {
1514  WARN("GUILockedSAS() returns 0x%x\n", result);
1515  return result;
1516  }
1517 
1518  WARN("GUILockedSAS() failed (0x%x)\n", result);
1519  return WLX_SAS_ACTION_NONE;
1520 }
#define IDD_UNLOCK
Definition: resource.h:29
#define WARN(fmt,...)
Definition: debug.h:111
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:1429
#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
GLuint64EXT * result
Definition: glext.h:11304

◆ GUILoggedOnSAS()

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

Definition at line 921 of file gui.c.

924 {
925  INT result;
926 
927  TRACE("GUILoggedOnSAS()\n");
928 
929  if (dwSasType != WLX_SAS_TYPE_CTRL_ALT_DEL)
930  {
931  /* Nothing to do for WLX_SAS_TYPE_TIMEOUT ; the dialog will
932  * close itself thanks to the use of WlxDialogBoxParam */
933  return WLX_SAS_ACTION_NONE;
934  }
935 
936  pgContext->pWlxFuncs->WlxSwitchDesktopToWinlogon(
937  pgContext->hWlx);
938 
939  result = pgContext->pWlxFuncs->WlxDialogBoxParam(
940  pgContext->hWlx,
941  pgContext->hDllInstance,
945  (LPARAM)pgContext);
946 
949  {
951  }
952 
954  {
955  pgContext->pWlxFuncs->WlxSwitchDesktopToUser(
956  pgContext->hWlx);
957  }
958 
959  return result;
960 }
int32_t INT
Definition: typedefs.h:57
static INT_PTR CALLBACK SecurityDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:858
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
GLuint64EXT * result
Definition: glext.h:11304

◆ GUILoggedOutSAS()

static INT GUILoggedOutSAS ( IN OUT PGINA_CONTEXT  pgContext)
static

Definition at line 1280 of file gui.c.

1282 {
1283  LEGALNOTICEDATA LegalNotice = {NULL, NULL};
1284  HKEY hKey = NULL;
1285  LONG rc;
1286  int result;
1287 
1288  TRACE("GUILoggedOutSAS()\n");
1289 
1291  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
1292  0,
1294  &hKey);
1295  if (rc == ERROR_SUCCESS)
1296  {
1297  ReadRegSzValue(hKey,
1298  L"LegalNoticeCaption",
1299  &LegalNotice.pszCaption);
1300 
1301  ReadRegSzValue(hKey,
1302  L"LegalNoticeText",
1303  &LegalNotice.pszText);
1304 
1305  RegCloseKey(hKey);
1306  }
1307 
1308  if (LegalNotice.pszCaption != NULL && wcslen(LegalNotice.pszCaption) != 0 &&
1309  LegalNotice.pszText != NULL && wcslen(LegalNotice.pszText) != 0)
1310  {
1311  pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
1312  pgContext->hDllInstance,
1314  GetDesktopWindow(),
1316  (LPARAM)&LegalNotice);
1317  }
1318 
1319  if (LegalNotice.pszCaption != NULL)
1320  HeapFree(GetProcessHeap(), 0, LegalNotice.pszCaption);
1321 
1322  if (LegalNotice.pszText != NULL)
1323  HeapFree(GetProcessHeap(), 0, LegalNotice.pszText);
1324 
1325  result = pgContext->pWlxFuncs->WlxDialogBoxParam(
1326  pgContext->hWlx,
1327  pgContext->hDllInstance,
1329  GetDesktopWindow(),
1331  (LPARAM)pgContext);
1332  if (result >= WLX_SAS_ACTION_LOGON &&
1334  {
1335  WARN("WlxLoggedOutSAS() returns 0x%x\n", result);
1336  return result;
1337  }
1338 
1339  WARN("WlxDialogBoxParam() failed (0x%x)\n", result);
1340  return WLX_SAS_ACTION_NONE;
1341 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDD_LEGALNOTICE
Definition: resource.h:54
static INT_PTR CALLBACK LegalNoticeDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1245
#define WARN(fmt,...)
Definition: debug.h:111
LONG ReadRegSzValue(IN HKEY hKey, IN LPCWSTR pszValue, OUT LPWSTR *pValue)
Definition: msgina.c:60
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
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:143
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
static INT_PTR CALLBACK LogonDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1156
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
#define WLX_SAS_ACTION_SWITCH_CONSOLE
Definition: winwlx.h:69
static const WCHAR L[]
Definition: oid.c:1250
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LPWSTR pszText
Definition: gui.c:28
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
GLuint64EXT * result
Definition: glext.h:11304
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:402
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ GUIRemoveStatusMessage()

static BOOL GUIRemoveStatusMessage ( IN PGINA_CONTEXT  pgContext)
static

Definition at line 371 of file gui.c.

373 {
374  if (pgContext->hStatusWindow)
375  {
376  EndDialog(pgContext->hStatusWindow, 0);
377  pgContext->hStatusWindow = NULL;
378  }
379 
380  return TRUE;
381 }
#define TRUE
Definition: types.h:120
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
smooth NULL
Definition: ftsmooth.c:416

◆ LegalNoticeDialogProc()

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

Definition at line 1245 of file gui.c.

1250 {
1251  PLEGALNOTICEDATA pLegalNotice;
1252 
1253  switch (uMsg)
1254  {
1255  case WM_INITDIALOG:
1256  pLegalNotice = (PLEGALNOTICEDATA)lParam;
1257  SetWindowTextW(hwndDlg, pLegalNotice->pszCaption);
1258  SetDlgItemTextW(hwndDlg, IDC_LEGALNOTICE_TEXT, pLegalNotice->pszText);
1259  return TRUE;
1260 
1261  case WM_COMMAND:
1262  switch (LOWORD(wParam))
1263  {
1264  case IDOK:
1265  EndDialog(hwndDlg, 0);
1266  return TRUE;
1267 
1268  case IDCANCEL:
1269  EndDialog(hwndDlg, 0);
1270  return TRUE;
1271  }
1272  break;
1273  }
1274 
1275  return FALSE;
1276 }
struct _LEGALNOTICEDATA * PLEGALNOTICEDATA
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
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:55
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
LPWSTR pszCaption
Definition: gui.c:27
#define WM_COMMAND
Definition: winuser.h:1722
LPWSTR pszText
Definition: gui.c:28
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
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 1524 of file gui.c.

1529 {
1530  PDLG_DATA pDlgData;
1531 
1532  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1533 
1534  switch (uMsg)
1535  {
1536  case WM_INITDIALOG:
1537  {
1538  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
1539  if (pDlgData == NULL)
1540  return FALSE;
1541 
1542  DlgData_LoadBitmaps(pDlgData);
1543 
1544  SetWelcomeText(hwndDlg);
1545 
1546  SetLockMessage(hwndDlg, IDC_LOCKED_MESSAGE, pDlgData->pgContext);
1547  return TRUE;
1548  }
1549  case WM_PAINT:
1550  {
1551  PAINTSTRUCT ps;
1552  if (pDlgData && pDlgData->hLogoBitmap)
1553  {
1554  BeginPaint(hwndDlg, &ps);
1555  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
1556  EndPaint(hwndDlg, &ps);
1557  }
1558  return TRUE;
1559  }
1560  case WM_DESTROY:
1561  {
1562  DlgData_Destroy(pDlgData);
1563  return TRUE;
1564  }
1565  }
1566 
1567  return FALSE;
1568 }
struct _DLG_DATA * PDLG_DATA
static VOID SetLockMessage(HWND hwnd, INT nDlgItem, PGINA_CONTEXT pgContext)
Definition: gui.c:1345
#define TRUE
Definition: types.h:120
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define IDC_LOCKED_MESSAGE
Definition: resource.h:27
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_DESTROY
Definition: winuser.h:1591
static void DlgData_Destroy(PDLG_DATA pDlgData)
Definition: gui.c:81
#define WM_PAINT
Definition: winuser.h:1602
PGINA_CONTEXT pgContext
Definition: gui.c:33
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)
Definition: gui.c:31
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:45
#define DST_BITMAP
Definition: winuser.h:516
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:101
static BOOL DlgData_LoadBitmaps(PDLG_DATA pDlgData)
Definition: gui.c:57
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
HBITMAP hLogoBitmap
Definition: gui.c:34

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

763 {
764  switch (uMsg)
765  {
766  case WM_INITDIALOG:
767  return TRUE;
768 
769  case WM_COMMAND:
770  switch (LOWORD(wParam))
771  {
772  case IDYES:
773  EndDialog(hwndDlg, IDYES);
774  return TRUE;
775 
776  case IDNO:
777  EndDialog(hwndDlg, IDNO);
778  return TRUE;
779  }
780  break;
781 
782  case WM_CLOSE:
783  EndDialog(hwndDlg, IDNO);
784  return TRUE;
785  }
786 
787  return FALSE;
788 }
#define TRUE
Definition: types.h:120
#define IDYES
Definition: winuser.h:829
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_COMMAND
Definition: winuser.h:1722
#define IDNO
Definition: winuser.h:830
#define WM_INITDIALOG
Definition: winuser.h:1721
#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 1156 of file gui.c.

1161 {
1162  PDLG_DATA pDlgData;
1163 
1164  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1165 
1166  switch (uMsg)
1167  {
1168  case WM_INITDIALOG:
1169  {
1170  /* FIXME: take care of NoDomainUI */
1171  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
1172  if (pDlgData == NULL)
1173  return FALSE;
1174 
1175  DlgData_LoadBitmaps(pDlgData);
1176 
1177  SetWelcomeText(hwndDlg);
1178 
1179  if (pDlgData->pgContext->bAutoAdminLogon ||
1180  !pDlgData->pgContext->bDontDisplayLastUserName)
1181  SetDlgItemTextW(hwndDlg, IDC_LOGON_USERNAME, pDlgData->pgContext->UserName);
1182 
1183  if (pDlgData->pgContext->bAutoAdminLogon)
1184  SetDlgItemTextW(hwndDlg, IDC_LOGON_PASSWORD, pDlgData->pgContext->Password);
1185 
1187 
1188  if (pDlgData->pgContext->bDisableCAD)
1189  EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
1190 
1191  if (!pDlgData->pgContext->bShutdownWithoutLogon)
1193 
1195 
1196  if (pDlgData->pgContext->bAutoAdminLogon)
1197  PostMessage(GetDlgItem(hwndDlg, IDOK), BM_CLICK, 0, 0);
1198 
1199  return TRUE;
1200  }
1201 
1202  case WM_PAINT:
1203  {
1204  PAINTSTRUCT ps;
1205  if (pDlgData && pDlgData->hLogoBitmap)
1206  {
1207  BeginPaint(hwndDlg, &ps);
1208  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
1209  EndPaint(hwndDlg, &ps);
1210  }
1211  return TRUE;
1212  }
1213 
1214  case WM_DESTROY:
1215  DlgData_Destroy(pDlgData);
1216  return TRUE;
1217 
1218  case WM_COMMAND:
1219  switch (LOWORD(wParam))
1220  {
1221  case IDOK:
1222  if (DoLogon(hwndDlg, pDlgData->pgContext))
1223  EndDialog(hwndDlg, WLX_SAS_ACTION_LOGON);
1224  return TRUE;
1225 
1226  case IDCANCEL:
1227  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
1228  return TRUE;
1229 
1230  case IDC_LOGON_SHUTDOWN:
1231  if (OnShutDown(hwndDlg, pDlgData->pgContext) == IDOK)
1232  EndDialog(hwndDlg, pDlgData->pgContext->nShutdownAction);
1233  return TRUE;
1234  }
1235  break;
1236  }
1237 
1238  return FALSE;
1239 }
struct _DLG_DATA * PDLG_DATA
#define IDC_LOGON_SHUTDOWN
Definition: resource.h:15
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDC_LOGON_PASSWORD
Definition: resource.h:13
BOOL bDontDisplayLastUserName
Definition: msgina.h:43
static INT OnShutDown(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:809
HWND WINAPI SetFocus(_In_opt_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
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
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR UserName[256]
Definition: msgina.h:50
#define WM_DESTROY
Definition: winuser.h:1591
#define PostMessage
Definition: winuser.h:5807
#define BM_CLICK
Definition: winuser.h:1899
static void DlgData_Destroy(PDLG_DATA pDlgData)
Definition: gui.c:81
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:1121
#define IDC_LOGON_USERNAME
Definition: resource.h:12
#define WM_PAINT
Definition: winuser.h:1602
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
PGINA_CONTEXT pgContext
Definition: gui.c:33
static BOOL DoLogon(IN HWND hwndDlg, IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:965
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:1722
Definition: gui.c:31
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:45
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define DST_BITMAP
Definition: winuser.h:516
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:101
#define IDCANCEL
Definition: winuser.h:825
WCHAR Password[256]
Definition: msgina.h:52
BOOL bDisableCAD
Definition: msgina.h:41
static BOOL DlgData_LoadBitmaps(PDLG_DATA pDlgData)
Definition: gui.c:57
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
HBITMAP hLogoBitmap
Definition: gui.c:34

Referenced by GUILoggedOutSAS().

◆ OnChangePassword()

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

Definition at line 735 of file gui.c.

738 {
739  INT res;
740 
741  TRACE("OnChangePassword()\n");
742 
743  res = pgContext->pWlxFuncs->WlxDialogBoxParam(
744  pgContext->hWlx,
745  pgContext->hDllInstance,
747  hwnd,
749  (LPARAM)pgContext);
750 
751  TRACE("Result: %x\n", res);
752 
753  return FALSE;
754 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDD_CHANGEPWD
Definition: resource.h:34
int32_t INT
Definition: typedefs.h:57
static INT_PTR CALLBACK ChangePasswordDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:646
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

Referenced by DoLogon(), and SecurityDialogProc().

◆ OnInitSecurityDlg()

static VOID OnInitSecurityDlg ( HWND  hwnd,
PGINA_CONTEXT  pgContext 
)
static

Definition at line 702 of file gui.c.

704 {
705  WCHAR Buffer1[256];
706  WCHAR Buffer2[256];
707  WCHAR Buffer3[256];
708  WCHAR Buffer4[512];
709 
710  LoadStringW(pgContext->hDllInstance, IDS_LOGONMSG, Buffer1, _countof(Buffer1));
711 
712  wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
713  wsprintfW(Buffer4, Buffer1, Buffer2);
714 
716 
717  LoadStringW(pgContext->hDllInstance, IDS_LOGONDATE, Buffer1, _countof(Buffer1));
718 
720  (SYSTEMTIME*)&pgContext->LogonTime, NULL, Buffer2, _countof(Buffer2));
721 
723  (SYSTEMTIME*)&pgContext->LogonTime, NULL, Buffer3, _countof(Buffer3));
724 
725  wsprintfW(Buffer4, Buffer1, Buffer2, Buffer3);
726 
728 
729  if (pgContext->bAutoAdminLogon)
731 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
WCHAR DomainName[256]
Definition: msgina.h:51
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDC_SECURITY_MESSAGE
Definition: resource.h:18
#define LOCALE_USER_DEFAULT
#define DATE_SHORTDATE
Definition: winnls.h:193
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)
smooth NULL
Definition: ftsmooth.c:416
#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
static const WCHAR L[]
Definition: oid.c:1250
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:78
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL bAutoAdminLogon
Definition: msgina.h:42
#define IDC_SECURITY_LOGOFF
Definition: resource.h:21
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:79

Referenced by SecurityDialogProc().

◆ OnLogOff()

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

Definition at line 793 of file gui.c.

796 {
797  return pgContext->pWlxFuncs->WlxDialogBoxParam(
798  pgContext->hWlx,
799  pgContext->hDllInstance,
801  hwndDlg,
803  (LPARAM)pgContext);
804 }
#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:758
#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 809 of file gui.c.

812 {
813  INT ret;
814  DWORD ShutdownOptions;
815 
816  TRACE("OnShutDown(%p %p)\n", hwndDlg, pgContext);
817 
818  pgContext->nShutdownAction = GetDefaultShutdownSelState();
819  ShutdownOptions = GetDefaultShutdownOptions();
820 
821  if (pgContext->UserToken != NULL)
822  {
823  if (ImpersonateLoggedOnUser(pgContext->UserToken))
824  {
825  pgContext->nShutdownAction = LoadShutdownSelState();
826  ShutdownOptions = GetAllowedShutdownOptions();
827  RevertToSelf();
828  }
829  else
830  {
831  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
832  }
833  }
834 
835  ret = ShutdownDialog(hwndDlg, ShutdownOptions, pgContext);
836 
837  if (ret == IDOK)
838  {
839  if (pgContext->UserToken != NULL)
840  {
841  if (ImpersonateLoggedOnUser(pgContext->UserToken))
842  {
843  SaveShutdownSelState(pgContext->nShutdownAction);
844  RevertToSelf();
845  }
846  else
847  {
848  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
849  }
850  }
851  }
852 
853  return ret;
854 }
#define IDOK
Definition: winuser.h:824
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1487
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD GetDefaultShutdownOptions(VOID)
Definition: shutdown.c:221
int32_t INT
Definition: typedefs.h:57
smooth NULL
Definition: ftsmooth.c:416
DWORD GetDefaultShutdownSelState(VOID)
Definition: shutdown.c:95
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:101
#define ERR(fmt,...)
Definition: debug.h:109
INT_PTR ShutdownDialog(IN HWND hwndDlg, IN DWORD ShutdownOptions, IN PGINA_CONTEXT pgContext)
Definition: shutdown.c:493
VOID SaveShutdownSelState(DWORD ShutdownCode)
DWORD GetAllowedShutdownOptions(VOID)
Definition: shutdown.c:227

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

474 {
475  WCHAR szCaption[256];
476  WCHAR szText[256];
477 
478  LoadStringW(pgContext->hDllInstance, uCaption, szCaption, _countof(szCaption));
479  LoadStringW(pgContext->hDllInstance, uText, szText, _countof(szText));
480 
481  return pgContext->pWlxFuncs->WlxMessageBox(pgContext->hWlx,
482  hwnd,
483  szText,
484  szCaption,
485  uType);
486 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
static const WCHAR szText[]
Definition: dialog.c:139
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68

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

863 {
864  PGINA_CONTEXT pgContext;
865 
866  pgContext = (PGINA_CONTEXT)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
867 
868  switch (uMsg)
869  {
870  case WM_INITDIALOG:
871  {
872  pgContext = (PGINA_CONTEXT)lParam;
873  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)pgContext);
874 
875  SetWelcomeText(hwndDlg);
876 
878  SetFocus(GetDlgItem(hwndDlg, IDNO));
879  return TRUE;
880  }
881 
882  case WM_COMMAND:
883  {
884  switch (LOWORD(wParam))
885  {
886  case IDC_SECURITY_LOCK:
888  return TRUE;
889  case IDC_SECURITY_LOGOFF:
890  if (OnLogOff(hwndDlg, pgContext) == IDYES)
892  return TRUE;
894  if (OnShutDown(hwndDlg, pgContext) == IDOK)
895  EndDialog(hwndDlg, pgContext->nShutdownAction);
896  return TRUE;
898  if (OnChangePassword(hwndDlg, pgContext))
900  return TRUE;
903  return TRUE;
904  case IDCANCEL:
905  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
906  return TRUE;
907  }
908  break;
909  }
910  case WM_CLOSE:
911  {
912  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
913  return TRUE;
914  }
915  }
916 
917  return FALSE;
918 }
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define IDYES
Definition: winuser.h:829
static VOID OnInitSecurityDlg(HWND hwnd, PGINA_CONTEXT pgContext)
Definition: gui.c:702
static INT OnShutDown(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:809
HWND WINAPI SetFocus(_In_opt_ HWND)
#define GetWindowLongPtrW
Definition: winuser.h:4804
static BOOL OnChangePassword(IN HWND hwnd, IN PGINA_CONTEXT pgContext)
Definition: gui.c:735
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 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:1603
#define IDC_SECURITY_TASKMGR
Definition: resource.h:24
#define WM_COMMAND
Definition: winuser.h:1722
#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:101
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define IDNO
Definition: winuser.h:830
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
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:793
#define IDC_SECURITY_CHANGEPWD
Definition: resource.h:23

Referenced by GUILoggedOnSAS().

◆ SetDomainComboBox()

static VOID SetDomainComboBox ( HWND  hwndDomainComboBox,
PGINA_CONTEXT  pgContext 
)
static

Definition at line 1121 of file gui.c.

1124 {
1125  WCHAR szComputerName[MAX_COMPUTERNAME_LENGTH + 1];
1126  DWORD dwComputerNameLength;
1127  LONG lIndex = 0;
1128  LONG lFindIndex;
1129 
1130  SendMessageW(hwndDomainComboBox, CB_RESETCONTENT, 0, 0);
1131 
1132  dwComputerNameLength = _countof(szComputerName);
1133  if (GetComputerNameW(szComputerName, &dwComputerNameLength))
1134  {
1135  lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)szComputerName);
1136  }
1137 
1138  if (wcslen(pgContext->DomainName) != 0)
1139  {
1140  lFindIndex = SendMessageW(hwndDomainComboBox, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)pgContext->DomainName);
1141  if (lFindIndex == CB_ERR)
1142  {
1143  lIndex = SendMessageW(hwndDomainComboBox, CB_ADDSTRING, 0, (LPARAM)pgContext->DomainName);
1144  }
1145  else
1146  {
1147  lIndex = lFindIndex;
1148  }
1149  }
1150 
1151  SendMessageW(hwndDomainComboBox, CB_SETCURSEL, lIndex, 0);
1152 }
WCHAR DomainName[256]
Definition: msgina.h:51
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:443
long LONG
Definition: pedump.c:60
#define CB_ADDSTRING
Definition: winuser.h:1918
LONG_PTR LPARAM
Definition: windef.h:208
#define CB_RESETCONTENT
Definition: winuser.h:1941
#define CB_ERR
Definition: winuser.h:2410
__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:1943
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1922

Referenced by LogonDialogProc().

◆ SetLockMessage()

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

Definition at line 1345 of file gui.c.

1348 {
1349  WCHAR Buffer1[256];
1350  WCHAR Buffer2[256];
1351  WCHAR Buffer3[512];
1352 
1353  LoadStringW(pgContext->hDllInstance, IDS_LOCKMSG, Buffer1, _countof(Buffer1));
1354 
1355  wsprintfW(Buffer2, L"%s\\%s", pgContext->DomainName, pgContext->UserName);
1356  wsprintfW(Buffer3, Buffer1, Buffer2);
1357 
1358  SetDlgItemTextW(hwnd, nDlgItem, Buffer3);
1359 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
WCHAR DomainName[256]
Definition: msgina.h:51
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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)
WCHAR UserName[256]
Definition: msgina.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static const WCHAR L[]
Definition: oid.c:1250
#define IDS_LOCKMSG
Definition: resource.h:77

Referenced by LockedDialogProc(), and UnlockDialogProc().

◆ SetWelcomeText()

static VOID SetWelcomeText ( HWND  hWnd)
static

Definition at line 101 of file gui.c.

102 {
103  PWCHAR pBuffer = NULL, p;
104  HKEY hKey;
105  DWORD BufSize, dwType, dwWelcomeSize, dwTitleLength;
106  LONG rc;
107 
108  TRACE("SetWelcomeText(%p)\n", hWnd);
109 
110  /* Open the Winlogon key */
112  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
113  0,
115  &hKey);
116  if (rc != ERROR_SUCCESS)
117  {
118  WARN("RegOpenKeyExW() failed with error %lu\n", rc);
119  return;
120  }
121 
122  /* Get the size of the Welcome value */
123  dwWelcomeSize = 0;
124  rc = RegQueryValueExW(hKey,
125  L"Welcome",
126  NULL,
127  &dwType,
128  NULL,
129  &dwWelcomeSize);
130  if (rc == ERROR_FILE_NOT_FOUND || dwWelcomeSize == 0 || dwType != REG_SZ)
131  goto done;
132 
133  dwTitleLength = GetWindowTextLengthW(hWnd);
134  BufSize = dwWelcomeSize + ((dwTitleLength + 1) * sizeof(WCHAR));
135 
137  if (pBuffer == NULL)
138  goto done;
139 
140  GetWindowTextW(hWnd, pBuffer, BufSize / sizeof(WCHAR));
141  wcscat(pBuffer, L" ");
142  p = &pBuffer[dwTitleLength + 1];
143 
144  RegQueryValueExW(hKey,
145  L"Welcome",
146  NULL,
147  &dwType,
148  (PBYTE)p,
149  &dwWelcomeSize);
150 
152 
153 done:
154  if (pBuffer != NULL)
156 
157  RegCloseKey(hKey);
158 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WARN(fmt,...)
Definition: debug.h:111
HWND hWnd
Definition: settings.c:17
uint16_t * PWCHAR
Definition: typedefs.h:55
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
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:403
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:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetWindowTextLengthW(_In_ HWND)
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
#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:5832
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
GLfloat GLfloat p
Definition: glext.h:8902
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:402
#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 257 of file gui.c.

258 {
259  HDESK hDesk;
261 
262  /* When SetThreadDesktop is called the system closes the desktop handle when needed
263  so we have to create a new handle because this handle may still be in use by winlogon */
265  msg->hDesktop,
267  (HANDLE*)&hDesk,
268  0,
269  FALSE,
271  {
272  ERR("Duplicating handle failed!\n");
273  HeapFree(GetProcessHeap(), 0, lpParam);
274  return FALSE;
275  }
276 
277  if(!SetThreadDesktop(hDesk))
278  {
279  ERR("Setting thread desktop failed!\n");
280  HeapFree(GetProcessHeap(), 0, lpParam);
281  return FALSE;
282  }
283 
285  hDllInstance,
289  (LPARAM)lpParam);
290 
291  HeapFree(GetProcessHeap(), 0, lpParam);
292  return TRUE;
293 }
#define TRUE
Definition: types.h:120
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
#define DUPLICATE_SAME_ACCESS
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:403
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
static INT_PTR CALLBACK StatusDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:162
#define ERR(fmt,...)
Definition: debug.h:109
#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:402
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 162 of file gui.c.

167 {
168  PDLG_DATA pDlgData;
170 
171  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
172 
173  switch (uMsg)
174  {
175  case WM_INITDIALOG:
176  {
178  if (!msg)
179  return FALSE;
180 
181  msg->Context->hStatusWindow = hwndDlg;
182 
183  if (msg->pTitle)
184  SetWindowTextW(hwndDlg, msg->pTitle);
185  SetDlgItemTextW(hwndDlg, IDC_STATUS_MESSAGE, msg->pMessage);
186  SetEvent(msg->StartupEvent);
187 
188  pDlgData = DlgData_Create(hwndDlg, msg->Context);
189  if (pDlgData == NULL)
190  return FALSE;
191 
192  if (DlgData_LoadBitmaps(pDlgData))
193  {
194  pDlgData->TimerID = SetTimer(hwndDlg, -1, 20, NULL);
195  }
196  return TRUE;
197  }
198 
199  case WM_TIMER:
200  {
201  if (pDlgData && pDlgData->hBarBitmap)
202  {
203  /*
204  * Default rotation bar image width is 413 (same as logo)
205  * We can divide 413 by 7 without remainder
206  */
207  pDlgData->BarCounter = (pDlgData->BarCounter + 7) % pDlgData->BarWidth;
208  InvalidateRect(hwndDlg, NULL, FALSE);
209  UpdateWindow(hwndDlg);
210  }
211  return TRUE;
212  }
213 
214  case WM_DRAWITEM:
215  {
217 
218  if (lpDis->CtlID != IDC_BAR)
219  {
220  return FALSE;
221  }
222 
223  if (pDlgData && pDlgData->hBarBitmap)
224  {
225  HDC hdcMem;
226  HGDIOBJ hOld;
227  DWORD off = pDlgData->BarCounter;
228  DWORD iw = pDlgData->BarWidth;
229  DWORD ih = pDlgData->BarHeight;
230 
231  hdcMem = CreateCompatibleDC(lpDis->hDC);
232  hOld = SelectObject(hdcMem, pDlgData->hBarBitmap);
233  BitBlt(lpDis->hDC, off, 0, iw - off, ih, hdcMem, 0, 0, SRCCOPY);
234  BitBlt(lpDis->hDC, 0, 0, off, ih, hdcMem, iw - off, 0, SRCCOPY);
235  SelectObject(hdcMem, hOld);
236  DeleteDC(hdcMem);
237 
238  return TRUE;
239  }
240  return FALSE;
241  }
242 
243  case WM_DESTROY:
244  {
245  if (pDlgData && pDlgData->hBarBitmap)
246  {
247  KillTimer(hwndDlg, pDlgData->TimerID);
248  }
249  DlgData_Destroy(pDlgData);
250  return TRUE;
251  }
252  }
253  return FALSE;
254 }
struct _DLG_DATA * PDLG_DATA
#define TRUE
Definition: types.h:120
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
HBITMAP hBarBitmap
Definition: gui.c:35
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
DWORD BarWidth
Definition: gui.c:40
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static HDC
Definition: imagelist.c:92
BOOL WINAPI UpdateWindow(_In_ HWND)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4804
static VOID NTAPI BitBlt(IN ULONG Left, IN ULONG Top, IN ULONG Width, IN ULONG Height, IN PUCHAR Buffer, IN ULONG BitsPerPixel, IN ULONG Delta)
Definition: vga.c:405
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1591
DWORD BarCounter
Definition: gui.c:37
#define IDC_BAR
Definition: resource.h:58
static void DlgData_Destroy(PDLG_DATA pDlgData)
Definition: gui.c:81
#define WM_TIMER
Definition: winuser.h:1724
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:41
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
Definition: gui.c:31
UINT_PTR TimerID
Definition: gui.c:36
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:45
BOOL WINAPI DeleteDC(_In_ HDC)
#define WM_DRAWITEM
Definition: winuser.h:1627
#define msg(x)
Definition: auth_time.c:54
static BOOL DlgData_LoadBitmaps(PDLG_DATA pDlgData)
Definition: gui.c:57
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104
off
Definition: i386-dis.c:3909

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

1434 {
1435  PDLG_DATA pDlgData;
1437 
1438  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
1439 
1440  switch (uMsg)
1441  {
1442  case WM_INITDIALOG:
1443  {
1444  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
1445  if (pDlgData == NULL)
1446  return FALSE;
1447 
1448  SetWelcomeText(hwndDlg);
1449 
1450  SetLockMessage(hwndDlg, IDC_UNLOCK_MESSAGE, pDlgData->pgContext);
1451 
1452  SetDlgItemTextW(hwndDlg, IDC_UNLOCK_USERNAME, pDlgData->pgContext->UserName);
1454 
1455  if (pDlgData->pgContext->bDisableCAD)
1456  EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
1457 
1458  DlgData_LoadBitmaps(pDlgData);
1459  return TRUE;
1460  }
1461 
1462  case WM_PAINT:
1463  {
1464  PAINTSTRUCT ps;
1465  if (pDlgData && pDlgData->hLogoBitmap)
1466  {
1467  BeginPaint(hwndDlg, &ps);
1468  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
1469  EndPaint(hwndDlg, &ps);
1470  }
1471  return TRUE;
1472  }
1473  case WM_DESTROY:
1474  DlgData_Destroy(pDlgData);
1475  return TRUE;
1476 
1477  case WM_COMMAND:
1478  switch (LOWORD(wParam))
1479  {
1480  case IDOK:
1481  if (DoUnlock(hwndDlg, pDlgData->pgContext, &result))
1482  EndDialog(hwndDlg, result);
1483  return TRUE;
1484 
1485  case IDCANCEL:
1486  EndDialog(hwndDlg, WLX_SAS_ACTION_NONE);
1487  return TRUE;
1488  }
1489  break;
1490  }
1491 
1492  return FALSE;
1493 }
struct _DLG_DATA * PDLG_DATA
static VOID SetLockMessage(HWND hwnd, INT nDlgItem, PGINA_CONTEXT pgContext)
Definition: gui.c:1345
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
static BOOL DoUnlock(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext, OUT LPINT Action)
Definition: gui.c:1364
HWND WINAPI SetFocus(_In_opt_ HWND)
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
int32_t INT
Definition: typedefs.h:57
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
WCHAR UserName[256]
Definition: msgina.h:50
#define WM_DESTROY
Definition: winuser.h:1591
static void DlgData_Destroy(PDLG_DATA pDlgData)
Definition: gui.c:81
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_UNLOCK_PASSWORD
Definition: resource.h:32
#define WM_PAINT
Definition: winuser.h:1602
PGINA_CONTEXT pgContext
Definition: gui.c:33
#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:1722
Definition: gui.c:31
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:45
#define IDC_UNLOCK_MESSAGE
Definition: resource.h:30
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define DST_BITMAP
Definition: winuser.h:516
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:101
#define IDCANCEL
Definition: winuser.h:825
BOOL bDisableCAD
Definition: msgina.h:41
static BOOL DlgData_LoadBitmaps(PDLG_DATA pDlgData)
Definition: gui.c:57
GLuint64EXT * result
Definition: glext.h:11304
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
HBITMAP hLogoBitmap
Definition: gui.c:34

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

389 {
390  PDLG_DATA pDlgData;
391 
392  pDlgData = (PDLG_DATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);
393 
394  switch (uMsg)
395  {
396  case WM_INITDIALOG:
397  {
398  pDlgData = DlgData_Create(hwndDlg, (PGINA_CONTEXT)lParam);
399  if (pDlgData == NULL)
400  return FALSE;
401 
402  DlgData_LoadBitmaps(pDlgData);
403  return TRUE;
404  }
405 
406  case WM_PAINT:
407  {
408  PAINTSTRUCT ps;
409  if (pDlgData && pDlgData->hLogoBitmap)
410  {
411  BeginPaint(hwndDlg, &ps);
412  DrawStateW(ps.hdc, NULL, NULL, (LPARAM)pDlgData->hLogoBitmap, (WPARAM)0, 0, 0, 0, 0, DST_BITMAP);
413  EndPaint(hwndDlg, &ps);
414  }
415  return TRUE;
416  }
417  case WM_DESTROY:
418  {
419  DlgData_Destroy(pDlgData);
420  return TRUE;
421  }
422  }
423  return FALSE;
424 }
struct _DLG_DATA * PDLG_DATA
#define TRUE
Definition: types.h:120
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4804
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define GWLP_USERDATA
Definition: treelist.c:63
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_DESTROY
Definition: winuser.h:1591
static void DlgData_Destroy(PDLG_DATA pDlgData)
Definition: gui.c:81
#define WM_PAINT
Definition: winuser.h:1602
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)
Definition: gui.c:31
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:45
#define DST_BITMAP
Definition: winuser.h:516
static BOOL DlgData_LoadBitmaps(PDLG_DATA pDlgData)
Definition: gui.c:57
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
HBITMAP hLogoBitmap
Definition: gui.c:34

Referenced by GUIDisplaySASNotice().

Variable Documentation

◆ GinaGraphicalUI

GINA_UI GinaGraphicalUI
Initial value:
= {
}
static INT GUILockedSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1497
static INT GUILoggedOutSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1280
static BOOL GUIDisplayStatusMessage(IN PGINA_CONTEXT pgContext, IN HDESK hDesktop, IN DWORD dwOptions, IN PWSTR pTitle, IN PWSTR pMessage)
Definition: gui.c:296
static INT GUILoggedOnSAS(IN OUT PGINA_CONTEXT pgContext, IN DWORD dwSasType)
Definition: gui.c:921
static BOOL GUIInitialize(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:92
static BOOL GUIRemoveStatusMessage(IN PGINA_CONTEXT pgContext)
Definition: gui.c:371
static VOID GUIDisplaySASNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:427
static VOID GUIDisplayLockedNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1572

Definition at line 1586 of file gui.c.

Referenced by ChooseGinaUI().