ReactOS  0.4.15-dev-4927-gfe8f806
gui.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS msgina.dll
3  * FILE: dll/win32/msgina/gui.c
4  * PURPOSE: ReactOS Logon GINA DLL
5  * PROGRAMMERS: HervĂ© Poussineau (hpoussin@reactos.org)
6  * Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
7  */
8 
9 #include "msgina.h"
10 
11 #include <wingdi.h>
12 #include <winnls.h>
13 #include <winreg.h>
14 
15 typedef struct _DISPLAYSTATUSMSG
16 {
18  HDESK hDesktop;
24 
25 typedef struct _LEGALNOTICEDATA
26 {
30 
31 // Timer ID for the animated dialog bar.
32 #define IDT_BAR 1
33 
34 typedef struct _DLG_DATA
35 {
46 
47 static PDLG_DATA
48 DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
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 }
58 
59 static VOID
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 }
88 
89 static VOID
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 }
114 
115 static BOOL
117  IN OUT PGINA_CONTEXT pgContext)
118 {
119  TRACE("GUIInitialize(%p)\n", pgContext);
120  return TRUE;
121 }
122 
123 static
124 VOID
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 }
183 
184 static VOID
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 }
247 
248 static INT_PTR CALLBACK
250  IN HWND hwndDlg,
251  IN UINT uMsg,
252  IN WPARAM wParam,
253  IN LPARAM lParam)
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 }
353 
354 static DWORD WINAPI
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 }
392 
393 static BOOL
395  IN PGINA_CONTEXT pgContext,
396  IN HDESK hDesktop,
398  IN PWSTR pTitle,
399  IN PWSTR pMessage)
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 }
467 
468 static BOOL
470  IN PGINA_CONTEXT pgContext)
471 {
472  if (pgContext->hStatusWindow)
473  {
474  EndDialog(pgContext->hStatusWindow, 0);
475  pgContext->hStatusWindow = NULL;
476  }
477 
478  return TRUE;
479 }
480 
481 static INT_PTR CALLBACK
483  IN HWND hwndDlg,
484  IN UINT uMsg,
485  IN WPARAM wParam,
486  IN LPARAM lParam)
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 }
523 
524 static VOID
526  IN OUT PGINA_CONTEXT pgContext)
527 {
528  TRACE("GUIDisplaySASNotice()\n");
529 
530  /* Display the notice window */
531  pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
532  pgContext->hDllInstance,
536  (LPARAM)pgContext);
537 }
538 
539 /* Get the text contained in a textbox. Allocates memory in pText
540  * to contain the text. Returns TRUE in case of success */
541 static BOOL
543  IN HWND hwndDlg,
544  IN INT TextboxId,
545  OUT LPWSTR *pText)
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 }
562 
563 
564 static
565 INT
567  IN PGINA_CONTEXT pgContext,
568  IN HWND hwnd,
569  IN UINT uType,
570  IN UINT uCaption,
571  IN UINT uText)
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 }
585 
586 
587 static
588 BOOL
590  IN PGINA_CONTEXT pgContext,
591  IN HWND hwndDlg)
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 }
741 
742 
743 static INT_PTR CALLBACK
745  IN HWND hwndDlg,
746  IN UINT uMsg,
747  IN WPARAM wParam,
748  IN LPARAM lParam)
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);
762  SendDlgItemMessageW(hwndDlg, IDC_CHANGEPWD_DOMAIN, CB_ADDSTRING, 0, (LPARAM)pgContext->DomainName);
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 }
797 
798 
799 static VOID
801  PGINA_CONTEXT pgContext)
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 }
830 
831 
832 static BOOL
834  IN HWND hwnd,
835  IN PGINA_CONTEXT pgContext)
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 }
853 
854 
855 static INT_PTR CALLBACK
857  IN HWND hwndDlg,
858  IN UINT uMsg,
859  IN WPARAM wParam,
860  IN LPARAM lParam)
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 }
887 
888 
889 static
890 INT
892  IN HWND hwndDlg,
893  IN PGINA_CONTEXT pgContext)
894 {
895  return pgContext->pWlxFuncs->WlxDialogBoxParam(
896  pgContext->hWlx,
897  pgContext->hDllInstance,
899  hwndDlg,
901  (LPARAM)pgContext);
902 }
903 
904 
905 static
906 INT
908  IN HWND hwndDlg,
909  IN PGINA_CONTEXT pgContext)
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 }
953 
954 
955 static INT_PTR CALLBACK
957  IN HWND hwndDlg,
958  IN UINT uMsg,
959  IN WPARAM wParam,
960  IN LPARAM lParam)
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 }
1017 
1018 static INT
1020  IN OUT PGINA_CONTEXT pgContext,
1021  IN DWORD dwSasType)
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 }
1059 
1060 
1061 static
1062 BOOL
1064  IN HWND hwndDlg,
1065  IN OUT PGINA_CONTEXT pgContext)
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 }
1215 
1216 
1217 static
1218 VOID
1220  HWND hwndDomainComboBox,
1221  PGINA_CONTEXT pgContext)
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 }
1251 
1252 
1253 static INT_PTR CALLBACK
1255  IN HWND hwndDlg,
1256  IN UINT uMsg,
1257  IN WPARAM wParam,
1258  IN LPARAM lParam)
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 }
1338 
1339 
1340 static
1341 INT_PTR
1342 CALLBACK
1344  IN HWND hwndDlg,
1345  IN UINT uMsg,
1346  IN WPARAM wParam,
1347  IN LPARAM lParam)
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 }
1375 
1376 
1377 static INT
1379  IN OUT PGINA_CONTEXT pgContext)
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 }
1440 
1441 
1442 static VOID
1444  INT nDlgItem,
1445  PGINA_CONTEXT pgContext)
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 }
1458 
1459 
1460 static
1461 BOOL
1463  IN HWND hwndDlg,
1464  IN PGINA_CONTEXT pgContext,
1465  OUT LPINT Action)
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 }
1522 
1523 
1524 static
1525 INT_PTR
1526 CALLBACK
1528  IN HWND hwndDlg,
1529  IN UINT uMsg,
1530  IN WPARAM wParam,
1531  IN LPARAM lParam)
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 }
1592 
1593 
1594 static INT
1596  IN OUT PGINA_CONTEXT pgContext)
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 }
1619 
1620 
1621 static INT_PTR CALLBACK
1623  IN HWND hwndDlg,
1624  IN UINT uMsg,
1625  IN WPARAM wParam,
1626  IN LPARAM lParam)
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 }
1667 
1668 
1669 static VOID
1671  IN OUT PGINA_CONTEXT pgContext)
1672 {
1673  TRACE("GUIdisplayLockedNotice()\n");
1674 
1675  pgContext->pWlxFuncs->WlxDialogBoxParam(
1676  pgContext->hWlx,
1677  pgContext->hDllInstance,
1679  GetDesktopWindow(),
1681  (LPARAM)pgContext);
1682 }
1683 
1685  GUIInitialize,
1691  GUILockedSAS,
1693 };
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
WCHAR DomainName[256]
Definition: msgina.h:51
struct _DLG_DATA * PDLG_DATA
#define IDD_UNLOCK
Definition: resource.h:29
#define IDS_PASSWORDEXPIRED
Definition: resource.h:107
DWORD dwOptions
Definition: solitaire.cpp:24
#define IDD_WELCOME
Definition: resource.h:8
#define IDC_LOGON_SHUTDOWN
Definition: resource.h:15
#define IDI_ROSLOGO
Definition: resource.h:42
#define IN
Definition: typedefs.h:39
#define IDC_ROSLOGO
Definition: resource.h:69
static INT GUILockedSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1595
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
static VOID SetLockMessage(HWND hwnd, INT nDlgItem, PGINA_CONTEXT pgContext)
Definition: gui.c:1443
struct _LEGALNOTICEDATA * PLEGALNOTICEDATA
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:598
#define IDC_LOGON_PASSWORD
Definition: resource.h:13
LPCSTR pText
Definition: txtscale.cpp:79
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
struct _DISPLAYSTATUSMSG * PDISPLAYSTATUSMSG
HBITMAP hBarBitmap
Definition: gui.c:38
struct _MSV1_0_CHANGEPASSWORD_REQUEST MSV1_0_CHANGEPASSWORD_REQUEST
#define _Inout_
Definition: ms_sal.h:378
#define ERROR_SUCCESS
Definition: deptool.c:10
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define IDYES
Definition: winuser.h:829
GLuint64EXT * result
Definition: glext.h:11304
#define IDC_SECURITY_MESSAGE
Definition: resource.h:18
struct _LEGALNOTICEDATA LEGALNOTICEDATA
#define IDD_LEGALNOTICE
Definition: resource.h:66
USHORT MaximumLength
Definition: env_spec_w32.h:370
static BOOL DoUnlock(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext, OUT LPINT Action)
Definition: gui.c:1462
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
DWORD BarWidth
Definition: gui.c:43
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
static INT_PTR CALLBACK LegalNoticeDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1343
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1610
uint16_t * PWSTR
Definition: typedefs.h:56
static VOID OnInitSecurityDlg(HWND hwnd, PGINA_CONTEXT pgContext)
Definition: gui.c:800
BOOL bDontDisplayLastUserName
Definition: msgina.h:43
#define LOCALE_USER_DEFAULT
NTSTATUS ConnectToLsa(PGINA_CONTEXT pgContext)
Definition: lsa.c:11
#define DATE_SHORTDATE
Definition: winnls.h:196
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define WARN(fmt,...)
Definition: debug.h:112
#define IDC_CHANGEPWD_DOMAIN
Definition: resource.h:36
LONG NTSTATUS
Definition: precomp.h:26
HDESK hDesktop
Definition: gui.c:18
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:307
#define IDD_CHANGEPWD
Definition: resource.h:34
DWORD dwOptions
Definition: gui.c:19
static INT OnShutDown(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:907
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL DoAdminUnlock(IN PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:665
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GWL_EXSTYLE
Definition: winuser.h:845
HWND WINAPI SetFocus(_In_opt_ HWND)
#define IDS_LOGONTITLE
Definition: resource.h:103
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
DWORD GetDefaultShutdownOptions(VOID)
Definition: shutdown.c:764
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
UINT_PTR WPARAM
Definition: windef.h:207
#define STATUS_ACCOUNT_LOCKED_OUT
Definition: ntstatus.h:696
#define MB_ICONSTOP
Definition: winuser.h:797
#define GetWindowLongPtrW
Definition: winuser.h:4809
uint16_t * PWCHAR
Definition: typedefs.h:56
LONG left
Definition: windef.h:306
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
int32_t INT_PTR
Definition: typedefs.h:64
static BOOL OnChangePassword(IN HWND hwnd, IN PGINA_CONTEXT pgContext)
Definition: gui.c:833
static INT GUILoggedOutSAS(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1378
LONG ReadRegSzValue(IN HKEY hKey, IN LPCWSTR pszValue, OUT LPWSTR *pValue)
Definition: msgina.c:60
#define IDC_LOCKED_MESSAGE
Definition: resource.h:27
LONG right
Definition: windef.h:308
HANDLE hDllInstance
Definition: msgina.h:37
#define IDS_ACCOUNTEXPIRED
Definition: resource.h:108
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:58
HWND hWndBarCtrl
Definition: gui.c:39
static INT ResourceMessageBox(IN PGINA_CONTEXT pgContext, IN HWND hwnd, IN UINT uType, IN UINT uCaption, IN UINT uText)
Definition: gui.c:566
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
UNICODE_STRING AccountName
Definition: ntsecapi.h:513
#define STATUS_ACCOUNT_EXPIRED
Definition: ntstatus.h:636
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
#define IDS_ACCOUNTRESTRICTION
Definition: resource.h:112
#define STATUS_INVALID_LOGON_HOURS
Definition: ntstatus.h:347
struct GINA_CONTEXT * PGINA_CONTEXT
#define STATUS_ACCOUNT_RESTRICTION
Definition: ntstatus.h:346
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IDC_LEGALNOTICE_TEXT
Definition: resource.h:67
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
static INT_PTR CALLBACK SecurityDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:956
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define IDC_LOGON_DOMAIN
Definition: resource.h:14
ULONG nShutdownAction
Definition: msgina.h:47
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
PWSTR pTitle
Definition: gui.c:20
#define IDC_CHANGEPWD_USERNAME
Definition: resource.h:35
#define L(x)
Definition: ntvdm.h:50
GINA_UI GinaGraphicalUI
Definition: gui.c:1684
#define DUPLICATE_SAME_ACCESS
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
struct _DLG_DATA DLG_DATA
#define LANG_JAPANESE
Definition: nls.h:76
#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
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
long LONG
Definition: pedump.c:60
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define IDS_ACCOUNTLOCKED
Definition: resource.h:109
DWORD LogoHeight
Definition: gui.c:42
#define GWLP_USERDATA
Definition: treelist.c:63
#define CB_ADDSTRING
Definition: winuser.h:1923
static INT_PTR CALLBACK ChangePasswordDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:744
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56
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 IDT_BAR
Definition: gui.c:32
#define WLX_SAS_ACTION_UNLOCK_WKSTA
Definition: winwlx.h:60
#define IDD_LOGOFF
Definition: resource.h:41
PVOID pBuffer
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
LPWSTR pszCaption
Definition: gui.c:27
#define IDS_PASSWORDCHANGED
Definition: resource.h:102
LONG_PTR LPARAM
Definition: windef.h:208
NTSTATUS DoLoginTasks(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password, OUT PNTSTATUS SubStatus)
Definition: msgina.c:752
DWORD GetDefaultShutdownSelState(VOID)
Definition: shutdown.c:427
#define IDC_SECURITY_LOGONDATE
Definition: resource.h:19
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
WCHAR UserName[256]
Definition: msgina.h:50
static BOOL GUIDisplayStatusMessage(IN PGINA_CONTEXT pgContext, IN HDESK hDesktop, IN DWORD dwOptions, IN PWSTR pTitle, IN PWSTR pMessage)
Definition: gui.c:394
#define BufSize
Definition: FsRtlTunnel.c:28
#define IDD_SECURITY
Definition: inetcpl.h:83
#define CB_RESETCONTENT
Definition: winuser.h:1946
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define CB_ERR
Definition: winuser.h:2415
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1596
static INT GUILoggedOnSAS(IN OUT PGINA_CONTEXT pgContext, IN DWORD dwSasType)
Definition: gui.c:1019
DWORD BarCounter
Definition: gui.c:40
#define PostMessage
Definition: winuser.h:5812
static BOOL DoChangePassword(IN PGINA_CONTEXT pgContext, IN HWND hwndDlg)
Definition: gui.c:589
static HINSTANCE hDllInstance
Definition: clb.c:30
#define IDD_LOGON
Definition: resource.h:141
#define IDS_INVALIDWORKSTATION
Definition: resource.h:111
Status
Definition: gdiplustypes.h:24
static INT_PTR CALLBACK UnlockDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1527
static INT cxOld
Definition: eventvwr.c:4291
#define BM_CLICK
Definition: winuser.h:1904
#define STATUS_ACCOUNT_DISABLED
Definition: ntstatus.h:350
PWSTR pMessage
Definition: gui.c:21
int Count
Definition: noreturn.cpp:7
#define IDC_BAR
Definition: resource.h:70
static VOID AdjustStatusMessageWindow(HWND hwndDlg, PDLG_DATA pDlgData)
Definition: gui.c:185
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL GUIInitialize(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:116
#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
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define STATUS_PASSWORD_EXPIRED
Definition: ntstatus.h:349
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL bShutdownWithoutLogon
Definition: msgina.h:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define _countof(array)
Definition: sndvol32.h:68
#define WM_TIMER
Definition: winuser.h:1729
static INT_PTR CALLBACK StatusDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:249
#define WM_CLOSE
Definition: winuser.h:1608
UNICODE_STRING NewPassword
Definition: ntsecapi.h:515
static INT_PTR CALLBACK LogonDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1254
#define IDS_INVALIDLOGONHOURS
Definition: resource.h:110
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define WINAPI
Definition: msvc.h:6
#define IDS_NONMATCHINGPASSWORDS
Definition: resource.h:101
SYSTEMTIME LogonTime
Definition: msgina.h:53
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2652
static VOID SetDomainComboBox(HWND hwndDomainComboBox, PGINA_CONTEXT pgContext)
Definition: gui.c:1219
#define IDC_UNLOCK_PASSWORD
Definition: resource.h:32
#define IDC_STATUS_MESSAGE
Definition: resource.h:6
DWORD BarHeight
Definition: gui.c:44
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_LOCKEDWRONGPASSWORD
Definition: resource.h:98
#define GetObject
Definition: wingdi.h:4468
#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
#define WLX_SAS_ACTION_SWITCH_CONSOLE
Definition: winwlx.h:69
#define IDC_CHANGEPWD_OLDPWD
Definition: resource.h:37
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
int ret
#define IDS_LOGONWRONGUSERORPWD
Definition: resource.h:104
static VOID DlgData_Destroy(_Inout_ HWND hwndDlg)
Definition: gui.c:90
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define IDC_UNLOCK_USERNAME
Definition: resource.h:31
#define IDC_SECURITY_TASKMGR
Definition: resource.h:24
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
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 MB_ICONERROR
Definition: winuser.h:781
#define GetCurrentProcess()
Definition: compat.h:618
static DWORD WINAPI StartupWindowThread(LPVOID lpParam)
Definition: gui.c:355
#define CB_SETCURSEL
Definition: winuser.h:1948
#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 MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define IDS_LOCKEDWRONGUSER
Definition: resource.h:99
static INT_PTR CALLBACK LogOffDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:856
DWORD LoadShutdownSelState(VOID)
Definition: shutdown.c:433
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)
#define ERR(fmt,...)
Definition: debug.h:110
#define GWL_STYLE
Definition: winuser.h:846
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define IDI_BAR
Definition: resource.h:76
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL bAutoAdminLogon
Definition: msgina.h:42
#define STATUS_INVALID_WORKSTATION
Definition: ntstatus.h:348
static PDLG_DATA DlgData_Create(HWND hwndDlg, PGINA_CONTEXT pgContext)
Definition: gui.c:48
#define IDC_UNLOCK_MESSAGE
Definition: resource.h:30
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
BOOL WINAPI DeleteDC(_In_ HDC)
static BOOL GUIRemoveStatusMessage(IN PGINA_CONTEXT pgContext)
Definition: gui.c:469
unsigned short USHORT
Definition: pedump.c:61
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
FxAutoRegKey hKey
#define STATUS_PASSWORD_MUST_CHANGE
Definition: ntstatus.h:680
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
INT_PTR ShutdownDialog(IN HWND hwndDlg, IN DWORD ShutdownOptions, IN PGINA_CONTEXT pgContext)
Definition: shutdown.c:1189
#define IDS_CHANGEPWDTITLE
Definition: resource.h:100
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define IDS_LOCKMSG
Definition: resource.h:94
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
Definition: bl.h:1330
struct _DISPLAYSTATUSMSG DISPLAYSTATUSMSG
static INT_PTR CALLBACK LockedDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:1622
MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType
Definition: ntsecapi.h:511
HANDLE StartupEvent
Definition: gui.c:22
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WLX_SAS_ACTION_PWD_CHANGED
Definition: winwlx.h:58
_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
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
static INT_PTR CALLBACK WelcomeDialogProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: gui.c:482
#define MB_OK
Definition: winuser.h:784
#define IMAGE_BITMAP
Definition: winuser.h:211
#define IDS_PASSWORDMUSTCHANGE
Definition: resource.h:106
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define IDD_STATUS
Definition: resource.h:22
#define IDC_CHANGEPWD_NEWPWD2
Definition: resource.h:39
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
DWORD LogoWidth
Definition: gui.c:41
#define IDS_LOGONUSERDISABLED
Definition: resource.h:105
static BOOL GetTextboxText(IN HWND hwndDlg, IN INT TextboxId, OUT LPWSTR *pText)
Definition: gui.c:542
#define WLX_SAS_ACTION_TASKLIST
Definition: winwlx.h:59
#define WM_DRAWITEM
Definition: winuser.h:1632
#define IDC_SECURITY_LOGOFF
Definition: resource.h:21
#define msg(x)
Definition: auth_time.c:54
LPWSTR pszText
Definition: gui.c:28
#define IDS_COMPUTERLOCKED
Definition: resource.h:97
NTSTATUS NTAPI LsaFreeReturnBuffer(PVOID)
#define DST_BITMAP
Definition: winuser.h:516
#define OUT
Definition: typedefs.h:40
UNICODE_STRING OldPassword
Definition: ntsecapi.h:514
GLuint res
Definition: glext.h:9613
#define LANG_CHINESE
Definition: nls.h:42
#define IDD_LOCKED
Definition: resource.h:26
#define IDC_SECURITY_SHUTDOWN
Definition: resource.h:22
static VOID GUIDisplaySASNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:525
static VOID GUIDisplayLockedNotice(IN OUT PGINA_CONTEXT pgContext)
Definition: gui.c:1670
unsigned int ULONG
Definition: retypes.h:1
#define GetWindowTextLength
Definition: winuser.h:5779
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
LONG bottom
Definition: windef.h:309
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define LANG_KOREAN
Definition: nls.h:84
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:738
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
static VOID SetWelcomeText(HWND hWnd)
Definition: gui.c:125
#define SetWindowLongPtrW
Definition: winuser.h:5326
static HBITMAP
Definition: button.c:44
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
VOID SaveShutdownSelState(DWORD ShutdownCode)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IDNO
Definition: winuser.h:830
DWORD GetAllowedShutdownOptions(VOID)
Definition: shutdown.c:770
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
WCHAR Password[256]
Definition: msgina.h:52
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define INFINITE
Definition: serial.h:102
BOOL bDisableCAD
Definition: msgina.h:41
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
Arabic default style
Definition: afstyles.h:93
INT WINAPI GetTimeFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, INT cchOut)
Definition: lcformat.c:1079
PGINA_CONTEXT Context
Definition: gui.c:17
NTSTATUS NTAPI LsaCallAuthenticationPackage(HANDLE, ULONG, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS)
BYTE * PBYTE
Definition: pedump.c:66
#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
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
#define SRCCOPY
Definition: wingdi.h:333
HBITMAP hLogoBitmap
Definition: gui.c:37
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
HDC hdcMem
Definition: welcome.c:104
static INT OnLogOff(IN HWND hwndDlg, IN PGINA_CONTEXT pgContext)
Definition: gui.c:891
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
#define IDC_CHANGEPWD_NEWPWD1
Definition: resource.h:38
#define STATUS_LOGON_FAILURE
Definition: ntstatus.h:345
#define IDS_LOGONDATE
Definition: resource.h:96
char * Text
Definition: combotst.c:136
static INT cyOld
Definition: eventvwr.c:4291
BOOL CreateProfile(IN OUT PGINA_CONTEXT pgContext, IN PWSTR UserName, IN PWSTR Domain, IN PWSTR Password)
Definition: msgina.c:785
int * LPINT
Definition: windef.h:178
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define IDC_SECURITY_CHANGEPWD
Definition: resource.h:23
#define REG_SZ
Definition: layer.c:22
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1927