ReactOS  0.4.14-dev-556-g4c5b21f
wlx.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS Winlogon
4  * FILE: base/system/winlogon/wlx.c
5  * PURPOSE: Logon
6  * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
7  * Ge van Geldorp (gvg@reactos.com)
8  * Hervé Poussineau (hpoussin@reactos.org)
9  */
10 
11 /* INCLUDES *****************************************************************/
12 
13 #include "winlogon.h"
14 
15 #define DESKTOP_ALL (DESKTOP_READOBJECTS | DESKTOP_CREATEWINDOW | \
16  DESKTOP_CREATEMENU | DESKTOP_HOOKCONTROL | DESKTOP_JOURNALRECORD | \
17  DESKTOP_JOURNALPLAYBACK | DESKTOP_ENUMERATE | DESKTOP_WRITEOBJECTS | \
18  DESKTOP_SWITCHDESKTOP | STANDARD_RIGHTS_REQUIRED)
19 
20 #define WINSTA_ALL (WINSTA_ENUMDESKTOPS | WINSTA_READATTRIBUTES | \
21  WINSTA_ACCESSCLIPBOARD | WINSTA_CREATEDESKTOP | \
22  WINSTA_WRITEATTRIBUTES | WINSTA_ACCESSGLOBALATOMS | \
23  WINSTA_EXITWINDOWS | WINSTA_ENUMERATE | WINSTA_READSCREEN | \
24  STANDARD_RIGHTS_REQUIRED)
25 
26 #define GENERIC_ACCESS (GENERIC_READ | GENERIC_WRITE | \
27  GENERIC_EXECUTE | GENERIC_ALL)
28 
29 typedef struct _DIALOG_LIST_ENTRY
30 {
36 
37 /* GLOBALS ******************************************************************/
38 
39 //static UINT_PTR IdTimer;
41 
42 /* FUNCTIONS ****************************************************************/
43 
44 VOID
46 {
48 }
49 
50 
51 static
54 {
55  PDIALOG_LIST_ENTRY ListEntry;
56 
57  ListEntry = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DIALOG_LIST_ENTRY));
58  if (ListEntry == NULL)
59  return NULL;
60 
61  TRACE("Add entry %p\n", ListEntry);
62 
64  &ListEntry->Entry);
65 
66  return ListEntry;
67 }
68 
69 
70 static
71 VOID
73 {
74  TRACE("Remove entry %p\n", ListEntry);
75 
76  RemoveEntryList(&ListEntry->Entry);
77  RtlFreeHeap(RtlGetProcessHeap(), 0, ListEntry);
78 }
79 
80 
81 static
84 {
85  PDIALOG_LIST_ENTRY Current;
86  PLIST_ENTRY ListEntry;
87 
88  ListEntry = DialogListHead.Flink;
89  while (ListEntry != &DialogListHead)
90  {
91  Current = CONTAINING_RECORD(ListEntry,
93  Entry);
94  if (Current->hWnd == hwndDlg)
95  {
96  TRACE("Found entry: %p\n", Current);
97  return Current;
98  }
99 
100  ListEntry = ListEntry->Flink;
101  }
102 
103  TRACE("Found no entry!\n");
104  return NULL;
105 }
106 
107 
108 VOID
110 {
111  PDIALOG_LIST_ENTRY Current;
112  PLIST_ENTRY ListEntry;
113 
114  ListEntry = DialogListHead.Flink;
115  while (ListEntry != &DialogListHead)
116  {
117  Current = CONTAINING_RECORD(ListEntry,
119  Entry);
120 
121  PostMessage(Current->hWnd, WLX_WM_SAS, 0, 0);
122 
123  ListEntry = ListEntry->Flink;
124  }
125 }
126 
127 
128 static
129 INT_PTR
130 CALLBACK
132  IN HWND hwndDlg,
133  IN UINT uMsg,
134  IN WPARAM wParam,
135  IN LPARAM lParam)
136 {
137  PDIALOG_LIST_ENTRY ListEntry;
138  INT_PTR ret;
139 
140  if (uMsg == WM_INITDIALOG)
141  {
142  ListEntry = (PDIALOG_LIST_ENTRY)lParam;
143 
144  TRACE("Set dialog handle: %p\n", hwndDlg);
145  ListEntry->hWnd = hwndDlg;
146  lParam = ListEntry->lParam;
147 // SetTopTimeout(hWnd);
148  }
149  else
150  {
151  ListEntry = GetDialogListEntry(hwndDlg);
152  if (ListEntry == NULL)
153  return FALSE;
154  }
155 
156  if (uMsg == WLX_WM_SAS)
157  {
158  EndDialog(hwndDlg, WLX_DLG_SAS);
159  return 0;
160  }
161 
162  ret = ListEntry->DlgProc(hwndDlg, uMsg, wParam, lParam);
163 
164  return ret;
165 
166 /*
167  if (uMsg == WM_TIMER && (UINT_PTR)wParam == IdTimer)
168  {
169  EndDialog(hwndDlg, -1);
170  KillTimer(hwndDlg, IdTimer);
171  return TRUE;
172  }
173  else if (uMsg == WM_INITDIALOG)
174  {
175  IdTimer = SetTimer(hwndDlg, 0, WLSession->DialogTimeout * 1000, NULL);
176  return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
177  }
178  else if (uMsg == WM_NCDESTROY)
179  {
180  BOOL ret;
181  ret = PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
182  PreviousWindowProc = NULL;
183  return ret;
184  }
185  else
186  {
187  return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
188  }
189 */
190 }
191 
192 /*
193  * @implemented
194  */
195 VOID
196 WINAPI
198  HANDLE hWlx)
199 {
200  ULONG_PTR OldValue;
201 
202  TRACE("WlxUseCtrlAltDel()\n");
203 
204  WlxSetOption(hWlx, WLX_OPTION_USE_CTRL_ALT_DEL, TRUE, &OldValue);
205 }
206 
207 /*
208  * @implemented
209  */
210 VOID
211 WINAPI
213  HANDLE hWlx,
214  PVOID pWlxContext)
215 {
216  ULONG_PTR OldValue;
217 
218  TRACE("WlxSetContextPointer(%p)\n", pWlxContext);
219 
220  WlxSetOption(hWlx, WLX_OPTION_CONTEXT_POINTER, (ULONG_PTR)pWlxContext, &OldValue);
221 }
222 
223 /*
224  * @implemented
225  */
226 VOID
227 WINAPI
229  HANDLE hWlx,
230  DWORD dwSasType)
231 {
232  PWLSESSION Session = (PWLSESSION)hWlx;
233 
234  TRACE("WlxSasNotify(0x%lx)\n", dwSasType);
235 
236  if (dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL || dwSasType > WLX_SAS_TYPE_MAX_MSFT_VALUE)
237  PostMessageW(Session->SASWindow, WLX_WM_SAS, dwSasType, 0);
238 }
239 
240 /*
241  * @implemented
242  */
243 BOOL
244 WINAPI
246  HANDLE hWlx,
247  DWORD Timeout)
248 {
249  PWLSESSION Session = (PWLSESSION)hWlx;
250 
251  TRACE("WlxSetTimeout(%lu)\n", Timeout);
252 
253  Session->DialogTimeout = Timeout;
254  return TRUE;
255 }
256 
257 /*
258  * @unimplemented
259  */
260 int
261 WINAPI
263  HANDLE hWlx,
264  HANDLE hToken,
266  HANDLE hThread)
267 {
269  UNREFERENCED_PARAMETER(hToken);
272 
274  return 0;
275 }
276 
277 /*
278  * @implemented
279  */
280 int
281 WINAPI
283  HANDLE hWlx,
284  HWND hwndOwner,
285  LPWSTR lpszText,
286  LPWSTR lpszTitle,
287  UINT fuStyle)
288 {
290 
291  TRACE("WlxMessageBox()\n");
292  /* FIXME: Provide a custom window proc to be able to handle timeout */
293  return MessageBoxW(hwndOwner, lpszText, lpszTitle, fuStyle);
294 }
295 
296 /*
297  * @implemented
298  */
299 int
300 WINAPI
302  HANDLE hWlx,
303  HANDLE hInst,
304  LPWSTR lpszTemplate,
305  HWND hwndOwner,
306  DLGPROC dlgprc)
307 {
309 
310  TRACE("WlxDialogBox()\n");
311 
312  return (int)WlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, dlgprc, 0);
313 }
314 
315 /*
316  * @implemented
317  */
318 int
319 WINAPI
321  HANDLE hWlx,
322  HANDLE hInst,
323  LPWSTR lpszTemplate,
324  HWND hwndOwner,
325  DLGPROC dlgprc,
326  LPARAM dwInitParam)
327 {
328  PDIALOG_LIST_ENTRY ListEntry;
329  int ret;
330 
332 
333  TRACE("WlxDialogBoxParam()\n");
334 
335  ListEntry = AddDialogListEntry();
336  if (ListEntry == NULL)
337  return -1;
338 
339  ListEntry->DlgProc = dlgprc;
340  ListEntry->lParam = dwInitParam;
341 
342  ret = (int)DialogBoxParamW(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc, (LPARAM)ListEntry);
343 
344  RemoveDialogListEntry(ListEntry);
345 
346  return ret;
347 }
348 
349 /*
350  * @implemented
351  */
352 int
353 WINAPI
355  HANDLE hWlx,
356  HANDLE hInst,
357  LPCDLGTEMPLATE hDialogTemplate,
358  HWND hwndOwner,
359  DLGPROC dlgprc)
360 {
362 
363  TRACE("WlxDialogBoxIndirect()\n");
364 
365  return (int)WlxDialogBoxIndirectParam(hWlx, hInst, hDialogTemplate, hwndOwner, dlgprc, 0);
366 }
367 
368 /*
369  * @implemented
370  */
371 int
372 WINAPI
374  HANDLE hWlx,
375  HANDLE hInst,
376  LPCDLGTEMPLATE hDialogTemplate,
377  HWND hwndOwner,
378  DLGPROC dlgprc,
379  LPARAM dwInitParam)
380 {
381  PDIALOG_LIST_ENTRY ListEntry;
382  int ret;
383 
385 
386  TRACE("WlxDialogBoxIndirectParam()\n");
387 
388  ListEntry = AddDialogListEntry();
389  if (ListEntry == NULL)
390  return -1;
391 
392  ListEntry->DlgProc = dlgprc;
393  ListEntry->lParam = dwInitParam;
394 
395  ret = (int)DialogBoxIndirectParamW(hInst, hDialogTemplate, hwndOwner, DefaultWlxWindowProc, (LPARAM)ListEntry);
396 
397  RemoveDialogListEntry(ListEntry);
398 
399  return ret;
400 }
401 
402 /*
403  * @implemented
404  */
405 int
406 WINAPI
408  HANDLE hWlx)
409 {
410  PWLSESSION Session = (PWLSESSION)hWlx;
411 
412  TRACE("WlxSwitchDesktopToUser()\n");
413 
414  return (int)SwitchDesktop(Session->ApplicationDesktop);
415 }
416 
417 /*
418  * @implemented
419  */
420 int
421 WINAPI
423  HANDLE hWlx)
424 {
425  PWLSESSION Session = (PWLSESSION)hWlx;
426 
427  TRACE("WlxSwitchDesktopToWinlogon()\n");
428 
429  return (int)SwitchDesktop(Session->WinlogonDesktop);
430 }
431 
432 /*
433  * @unimplemented
434  */
435 int
436 WINAPI
438  HANDLE hWlx,
439  PWLX_MPR_NOTIFY_INFO pMprInfo,
440  DWORD dwChangeInfo)
441 {
443  UNREFERENCED_PARAMETER(pMprInfo);
444  UNREFERENCED_PARAMETER(dwChangeInfo);
445 
447  return 0;
448 }
449 
450 /*
451  * @unimplemented
452  */
453 BOOL
454 WINAPI
456  HANDLE hWlx,
457  PWLX_DESKTOP* ppDesktop)
458 {
460  UNREFERENCED_PARAMETER(ppDesktop);
461 
463  return FALSE;
464 }
465 
466 /*
467  * @unimplemented
468  */
469 BOOL
470 WINAPI
472  HANDLE hWlx,
473  PWLX_DESKTOP pDesktop)
474 {
476  UNREFERENCED_PARAMETER(pDesktop);
477 
479  return FALSE;
480 }
481 
482 /*
483  * @unimplemented
484  */
485 BOOL
486 WINAPI
488  HANDLE hWlx,
489  HANDLE hToken,
490  DWORD Flags,
491  PWSTR pszDesktopName,
492  PWLX_DESKTOP* ppDesktop)
493 {
495  UNREFERENCED_PARAMETER(hToken);
497  UNREFERENCED_PARAMETER(pszDesktopName);
498  UNREFERENCED_PARAMETER(ppDesktop);
499 
501  return FALSE;
502 }
503 
504 /*
505  * @unimplemented
506  */
507 int
508 WINAPI
510  HANDLE hWlx,
511  PWLX_MPR_NOTIFY_INFO pMprInfo,
512  DWORD dwChangeInfo,
513  PWSTR ProviderName,
514  PVOID Reserved)
515 {
517  UNREFERENCED_PARAMETER(pMprInfo);
518  UNREFERENCED_PARAMETER(dwChangeInfo);
519  UNREFERENCED_PARAMETER(ProviderName);
521 
523  return 0;
524 }
525 
526 /*
527  * @unimplemented
528  */
529 BOOL
530 WINAPI
532  HANDLE hWlx,
533  PWLX_DESKTOP pDesktop,
534  HANDLE hToken)
535 {
537  UNREFERENCED_PARAMETER(pDesktop);
538  UNREFERENCED_PARAMETER(hToken);
539 
541  return FALSE;
542 }
543 
544 /*
545  * @implemented
546  */
547 BOOL
548 WINAPI
550  HANDLE hWlx,
551  DWORD Option,
553  ULONG_PTR* OldValue)
554 {
555  PWLSESSION Session = (PWLSESSION)hWlx;
556 
557  TRACE("WlxSetOption(%lu)\n", Option);
558 
559  switch (Option)
560  {
562  *OldValue = (ULONG_PTR)Session->Gina.UseCtrlAltDelete;
563  Session->Gina.UseCtrlAltDelete = (BOOL)Value;
564  return TRUE;
566  *OldValue = (ULONG_PTR)Session->Gina.Context;
567  Session->Gina.Context = (PVOID)Value;
568  return TRUE;
571  return FALSE;
572  }
573 
574  return FALSE;
575 }
576 
577 /*
578  * @implemented
579  */
580 BOOL
581 WINAPI
583  HANDLE hWlx,
584  DWORD Option,
585  ULONG_PTR* Value)
586 {
587  PWLSESSION Session = (PWLSESSION)hWlx;
588 
589  TRACE("WlxGetOption(%lu)\n", Option);
590 
591  switch (Option)
592  {
594  *Value = (ULONG_PTR)Session->Gina.UseCtrlAltDelete;
595  return TRUE;
597  {
598  *Value = (ULONG_PTR)Session->Gina.Context;
599  return TRUE;
600  }
605  return FALSE;
607  {
608  switch (Session->Gina.Version)
609  {
610  case WLX_VERSION_1_0:
611  *Value = sizeof(WLX_DISPATCH_VERSION_1_0);
612  break;
613  case WLX_VERSION_1_1:
614  *Value = sizeof(WLX_DISPATCH_VERSION_1_1);
615  break;
616  case WLX_VERSION_1_2:
617  *Value = sizeof(WLX_DISPATCH_VERSION_1_2);
618  break;
619  case WLX_VERSION_1_3:
620  *Value = sizeof(WLX_DISPATCH_VERSION_1_3);
621  break;
622  case WLX_VERSION_1_4:
623  *Value = sizeof(WLX_DISPATCH_VERSION_1_4);
624  break;
625  default:
626  return FALSE;
627  }
628  return TRUE;
629  }
630  }
631 
632  return FALSE;
633 }
634 
635 /*
636  * @unimplemented
637  */
638 VOID
639 WINAPI
641  HANDLE hWlx)
642 {
644 
646 }
647 
648 /*
649  * @unimplemented
650  */
651 BOOL
652 WINAPI
655 {
656  UNREFERENCED_PARAMETER(pCred);
657 
659  return FALSE;
660 }
661 
662 /*
663  * @unimplemented
664  */
665 BOOL
666 WINAPI
669 {
670  UNREFERENCED_PARAMETER(pCred);
671 
673  return FALSE;
674 }
675 
676 /*
677  * @unimplemented
678  */
679 BOOL
680 WINAPI
682 {
684  return FALSE;
685 }
686 
687 /*
688  * @unimplemented
689  */
690 DWORD
691 WINAPI
693  HANDLE hWlx,
695  WCHAR* UserName,
696  WCHAR* Domain)
697 {
699  UNREFERENCED_PARAMETER(pTSData);
700  UNREFERENCED_PARAMETER(UserName);
701  UNREFERENCED_PARAMETER(Domain);
702 
704  return 0;
705 }
706 
707 /*
708  * @unimplemented
709  */
710 DWORD
711 WINAPI
714 {
715  UNREFERENCED_PARAMETER(pCred);
716 
718  return 0;
719 }
720 
721 /*
722  * @unimplemented
723  */
724 BOOL
725 WINAPI
728 {
729  UNREFERENCED_PARAMETER(pCred);
730 
732  return FALSE;
733 }
734 
735 static
739  WlxSasNotify,
743  WlxDialogBox,
755  WlxSetOption,
756  WlxGetOption,
764 };
765 
766 /******************************************************************************/
767 
768 static
769 BOOL
771  OUT LPWSTR Path,
772  IN DWORD Len)
773 {
774  LONG Status;
775  DWORD Type, Size;
776  HKEY hKey;
777 
780  L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
781  0,
783  &hKey);
784  if (Status != ERROR_SUCCESS)
785  {
786  /* Default value */
787  wcsncpy(Path, L"msgina.dll", Len);
788  return TRUE;
789  }
790 
791  Size = Len * sizeof(WCHAR);
793  hKey,
794  L"GinaDLL",
795  NULL,
796  &Type,
797  (LPBYTE)Path,
798  &Size);
799  if (Status != ERROR_SUCCESS || Type != REG_SZ || Size == 0)
800  wcsncpy(Path, L"msgina.dll", Len);
801  RegCloseKey(hKey);
802  return TRUE;
803 }
804 
805 static
806 BOOL
807 WINAPI
809  IN PVOID pWlxContext,
810  IN OUT BOOL *pSecure)
811 {
812  if (*pSecure)
813  *pSecure = WLSession->Gina.Functions.WlxIsLogoffOk(pWlxContext);
814  return TRUE;
815 }
816 
817 static
818 BOOL
820  IN OUT PGINAFUNCTIONS Functions,
821  OUT DWORD *DllVersion,
822  OUT HMODULE *GinaInstance)
823 {
824  HMODULE hGina = NULL;
825  WCHAR GinaDll[MAX_PATH + 1];
826  BOOL ret = FALSE;
827 
828  GinaDll[0] = '\0';
829  if (!GetGinaPath(GinaDll, MAX_PATH))
830  goto cleanup;
831  /* Terminate string */
832  GinaDll[MAX_PATH] = '\0';
833 
834  hGina = LoadLibraryW(GinaDll);
835  if (!hGina)
836  goto cleanup;
837 
838  Functions->WlxNegotiate = (PFWLXNEGOTIATE)GetProcAddress(hGina, "WlxNegotiate");
839  Functions->WlxInitialize = (PFWLXINITIALIZE)GetProcAddress(hGina, "WlxInitialize");
840 
841  if (!Functions->WlxInitialize)
842  goto cleanup;
843 
844  if (!Functions->WlxNegotiate)
845  {
846  /* Assume current version */
847  *DllVersion = WLX_CURRENT_VERSION;
848  }
849  else
850  {
851  TRACE("About to negotiate with Gina %S. Winlogon uses version %x\n",
852  GinaDll, WLX_CURRENT_VERSION);
853  if (!Functions->WlxNegotiate(WLX_CURRENT_VERSION, DllVersion))
854  goto cleanup;
855  }
856 
857  TRACE("Gina uses WLX_VERSION %lx\n", *DllVersion);
858 
859  if (*DllVersion >= WLX_VERSION_1_0)
860  {
861  Functions->WlxActivateUserShell = (PFWLXACTIVATEUSERSHELL)GetProcAddress(hGina, "WlxActivateUserShell");
862  if (!Functions->WlxActivateUserShell) goto cleanup;
863  Functions->WlxDisplayLockedNotice = (PFWLXDISPLAYLOCKEDNOTICE)GetProcAddress(hGina, "WlxDisplayLockedNotice");
864  if (!Functions->WlxDisplayLockedNotice) goto cleanup;
865  Functions->WlxDisplaySASNotice = (PFWLXDISPLAYSASNOTICE)GetProcAddress(hGina, "WlxDisplaySASNotice");
866  if (!Functions->WlxDisplaySASNotice) goto cleanup;
867  Functions->WlxIsLockOk = (PFWLXISLOCKOK)GetProcAddress(hGina, "WlxIsLockOk");
868  if (!Functions->WlxIsLockOk) goto cleanup;
869  Functions->WlxIsLogoffOk = (PFWLXISLOGOFFOK)GetProcAddress(hGina, "WlxIsLogoffOk");
870  if (!Functions->WlxIsLogoffOk) goto cleanup;
871  Functions->WlxLoggedOnSAS = (PFWLXLOGGEDONSAS)GetProcAddress(hGina, "WlxLoggedOnSAS");
872  if (!Functions->WlxLoggedOnSAS) goto cleanup;
873  Functions->WlxLoggedOutSAS = (PFWLXLOGGEDOUTSAS)GetProcAddress(hGina, "WlxLoggedOutSAS");
874  if (!Functions->WlxLoggedOutSAS) goto cleanup;
875  Functions->WlxLogoff = (PFWLXLOGOFF)GetProcAddress(hGina, "WlxLogoff");
876  if (!Functions->WlxLogoff) goto cleanup;
877  Functions->WlxShutdown = (PFWLXSHUTDOWN)GetProcAddress(hGina, "WlxShutdown");
878  if (!Functions->WlxShutdown) goto cleanup;
879  Functions->WlxWkstaLockedSAS = (PFWLXWKSTALOCKEDSAS)GetProcAddress(hGina, "WlxWkstaLockedSAS");
880  if (!Functions->WlxWkstaLockedSAS) goto cleanup;
881  }
882 
883  if (*DllVersion >= WLX_VERSION_1_1)
884  {
885  Functions->WlxScreenSaverNotify = (PFWLXSCREENSAVERNOTIFY)GetProcAddress(hGina, "WlxScreenSaverNotify");
886  Functions->WlxStartApplication = (PFWLXSTARTAPPLICATION)GetProcAddress(hGina, "WlxStartApplication");
887  }
888 
889  if (*DllVersion >= WLX_VERSION_1_3)
890  {
891  Functions->WlxDisplayStatusMessage = (PFWLXDISPLAYSTATUSMESSAGE)GetProcAddress(hGina, "WlxDisplayStatusMessage");
892  if (!Functions->WlxDisplayStatusMessage) goto cleanup;
893  Functions->WlxGetStatusMessage = (PFWLXGETSTATUSMESSAGE)GetProcAddress(hGina, "WlxGetStatusMessage");
894  if (!Functions->WlxGetStatusMessage) goto cleanup;
895  Functions->WlxNetworkProviderLoad = (PFWLXNETWORKPROVIDERLOAD)GetProcAddress(hGina, "WlxNetworkProviderLoad");
896  if (!Functions->WlxNetworkProviderLoad) goto cleanup;
897  Functions->WlxRemoveStatusMessage = (PFWLXREMOVESTATUSMESSAGE)GetProcAddress(hGina, "WlxRemoveStatusMessage");
898  if (!Functions->WlxRemoveStatusMessage) goto cleanup;
899  }
900 
901  /* Provide some default functions */
902  if (!Functions->WlxScreenSaverNotify)
903  Functions->WlxScreenSaverNotify = DefaultWlxScreenSaverNotify;
904 
905  ret = TRUE;
906 
907 cleanup:
908  if (!ret)
909  {
910  if (hGina)
911  FreeLibrary(hGina);
912  }
913  else
914  *GinaInstance = hGina;
915  return ret;
916 }
917 
918 BOOL
920  IN OUT PWLSESSION Session)
921 {
922  DWORD GinaDllVersion;
923 
924  if (!LoadGina(&Session->Gina.Functions, &GinaDllVersion, &Session->Gina.hDllInstance))
925  return FALSE;
926 
927  Session->Gina.Context = NULL;
928  Session->Gina.Version = GinaDllVersion;
929  Session->Gina.UseCtrlAltDelete = FALSE;
930  Session->SuppressStatus = FALSE;
931 
932  TRACE("Calling WlxInitialize(\"%S\")\n", Session->InteractiveWindowStationName);
933  return Session->Gina.Functions.WlxInitialize(
934  Session->InteractiveWindowStationName,
935  (HANDLE)Session,
936  NULL,
938  &Session->Gina.Context);
939 }
940 
941 BOOL
943  IN HWINSTA WinSta,
944  IN PSID Sid)
945 {
946  DWORD AclSize;
948  PACL pDefaultAcl = NULL;
949  PSECURITY_DESCRIPTOR WinstaSd = NULL;
951  BOOL Ret = FALSE;
952 
953  /* Allocate space for an ACL */
954  AclSize = sizeof(ACL)
955  + 2 * (FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + GetLengthSid(Sid));
956  pDefaultAcl = HeapAlloc(GetProcessHeap(), 0, AclSize);
957  if (!pDefaultAcl)
958  {
959  ERR("WL: HeapAlloc() failed\n");
960  goto cleanup;
961  }
962 
963  /* Initialize it */
964  if (!InitializeAcl(pDefaultAcl, AclSize, ACL_REVISION))
965  {
966  ERR("WL: InitializeAcl() failed (error %lu)\n", GetLastError());
967  goto cleanup;
968  }
969 
970  /* Initialize new security descriptor */
973  {
974  ERR("WL: InitializeSecurityDescriptor() failed (error %lu)\n", GetLastError());
975  goto cleanup;
976  }
977 
978  /* Allocate memory for access allowed ACE */
980  GetLengthSid(Sid) - sizeof(DWORD));
981 
982  /* Create the first ACE for the window station */
983  Ace->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
985  Ace->Header.AceSize = sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(Sid) - sizeof(DWORD);
986  Ace->Mask = GENERIC_ACCESS;
987 
988  /* Copy the sid */
989  if (!CopySid(GetLengthSid(Sid), &Ace->SidStart, Sid))
990  {
991  ERR("WL: CopySid() failed (error %lu)\n", GetLastError());
992  goto cleanup;
993  }
994 
995  /* Add the first ACE */
996  if (!AddAce(pDefaultAcl, ACL_REVISION, MAXDWORD, (LPVOID)Ace, Ace->Header.AceSize))
997  {
998  ERR("WL: AddAce() failed (error %lu)\n", GetLastError());
999  goto cleanup;
1000  }
1001 
1002  /* Add the second ACE to the end of ACL */
1003  Ace->Header.AceFlags = NO_PROPAGATE_INHERIT_ACE;
1004  Ace->Mask = WINSTA_ALL;
1005  if (!AddAce(pDefaultAcl, ACL_REVISION, MAXDWORD, (LPVOID)Ace, Ace->Header.AceSize))
1006  {
1007  ERR("WL: AddAce() failed (error %lu)\n", GetLastError());
1008  goto cleanup;
1009  }
1010 
1011  /* Add ACL to winsta's security descriptor */
1012  if (!SetSecurityDescriptorDacl(WinstaSd, TRUE, pDefaultAcl, FALSE))
1013  {
1014  ERR("WL: SetSecurityDescriptorDacl() failed (error %lu)\n", GetLastError());
1015  goto cleanup;
1016  }
1017 
1018  /* Apply security to the window station */
1020  if (!SetUserObjectSecurity(WinSta, &SecurityInformation, WinstaSd))
1021  {
1022  ERR("WL: SetUserObjectSecurity() failed (error %lu)\n", GetLastError());
1023  goto cleanup;
1024  }
1025 
1026  /* Indicate success */
1027  Ret = TRUE;
1028 
1029 cleanup:
1030  /* Free allocated stuff */
1031  if (pDefaultAcl) HeapFree(GetProcessHeap(), 0, pDefaultAcl);
1032  if (WinstaSd) HeapFree(GetProcessHeap(), 0, WinstaSd);
1033  if (Ace) HeapFree(GetProcessHeap(), 0, Ace);
1034 
1035  return Ret;
1036 }
1037 
1038 BOOL
1040  IN HDESK Desktop,
1041  IN PSID WinlogonSid,
1042  IN PSID UserSid)
1043 {
1044  DWORD AclSize;
1046  PACL Acl = NULL;
1047  PSECURITY_DESCRIPTOR DesktopSd = NULL;
1048  BOOL Ret = FALSE;
1049 
1050  /* Allocate ACL */
1051  AclSize = sizeof(ACL)
1052  + FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + GetLengthSid(WinlogonSid);
1053 
1054  /* Take user's sid into account */
1055  if (UserSid)
1056  AclSize += FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + GetLengthSid(UserSid);
1057 
1058  Acl = HeapAlloc(GetProcessHeap(), 0, AclSize);
1059  if (!Acl)
1060  {
1061  ERR("WL: HeapAlloc() failed\n");
1062  goto cleanup;
1063  }
1064 
1065  /* Initialize ACL */
1066  if (!InitializeAcl(Acl, AclSize, ACL_REVISION))
1067  {
1068  ERR("WL: InitializeAcl() failed (error %lu)\n", GetLastError());
1069  goto cleanup;
1070  }
1071 
1072  /* Add full desktop access ACE for winlogon */
1073  if (!AddAccessAllowedAce(Acl, ACL_REVISION, DESKTOP_ALL, WinlogonSid))
1074  {
1075  ERR("WL: AddAccessAllowedAce() failed (error %lu)\n", GetLastError());
1076  goto cleanup;
1077  }
1078 
1079  /* Add full desktop access ACE for a user (if provided) */
1080  if (UserSid && !AddAccessAllowedAce(Acl, ACL_REVISION, DESKTOP_ALL, UserSid))
1081  {
1082  ERR("WL: AddAccessAllowedAce() failed (error %lu)\n", GetLastError());
1083  goto cleanup;
1084  }
1085 
1086  /* Initialize new security descriptor */
1089  {
1090  ERR("WL: InitializeSecurityDescriptor() failed (error %lu)\n", GetLastError());
1091  goto cleanup;
1092  }
1093 
1094  /* Add ACL to the security descriptor */
1095  if (!SetSecurityDescriptorDacl(DesktopSd, TRUE, Acl, FALSE))
1096  {
1097  ERR("WL: SetSecurityDescriptorDacl() failed (error %lu)\n", GetLastError());
1098  goto cleanup;
1099  }
1100 
1101  /* Apply security to the window station */
1104  {
1105  ERR("WL: SetUserObjectSecurity() failed (error %lu)\n", GetLastError());
1106  goto cleanup;
1107  }
1108 
1109  /* Indicate success */
1110  Ret = TRUE;
1111 
1112 cleanup:
1113  /* Free allocated stuff */
1114  if (Acl) HeapFree(GetProcessHeap(), 0, Acl);
1115  if (DesktopSd) HeapFree(GetProcessHeap(), 0, DesktopSd);
1116 
1117  return Ret;
1118 }
1119 
1120 BOOL
1122  IN OUT PWLSESSION Session)
1123 {
1124  BYTE LocalSystemBuffer[SECURITY_MAX_SID_SIZE];
1125  BYTE InteractiveBuffer[SECURITY_MAX_SID_SIZE];
1126  PSID pLocalSystemSid = (PSID)&LocalSystemBuffer;
1127  PSID pInteractiveSid = (PSID)InteractiveBuffer;
1128  DWORD SidSize, AclSize;
1129  PACL pDefaultAcl = NULL;
1130  PACL pUserDesktopAcl = NULL;
1131  SECURITY_DESCRIPTOR DefaultSecurityDescriptor;
1132  SECURITY_ATTRIBUTES DefaultSecurity;
1133  SECURITY_DESCRIPTOR UserDesktopSecurityDescriptor;
1134  SECURITY_ATTRIBUTES UserDesktopSecurity;
1135  BOOL ret = FALSE;
1136 
1137  /*
1138  * Prepare information for ACLs we will apply
1139  */
1140  SidSize = SECURITY_MAX_SID_SIZE;
1141  if (!CreateWellKnownSid(WinLocalSystemSid, NULL, pLocalSystemSid, &SidSize))
1142  {
1143  ERR("WL: CreateWellKnownSid() failed (error %lu)\n", GetLastError());
1144  goto cleanup;
1145  }
1146  SidSize = SECURITY_MAX_SID_SIZE;
1147  if (!CreateWellKnownSid(WinInteractiveSid, NULL, pInteractiveSid, &SidSize))
1148  {
1149  ERR("WL: CreateWellKnownSid() failed (error %lu)\n", GetLastError());
1150  goto cleanup;
1151  }
1152 
1153  AclSize = sizeof(ACL)
1155  + FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + GetLengthSid(pInteractiveSid);
1156  pDefaultAcl = HeapAlloc(GetProcessHeap(), 0, AclSize);
1157  pUserDesktopAcl = HeapAlloc(GetProcessHeap(), 0, AclSize);
1158  if (!pDefaultAcl || !pUserDesktopAcl)
1159  {
1160  ERR("WL: HeapAlloc() failed\n");
1161  goto cleanup;
1162  }
1163 
1164  if (!InitializeAcl(pDefaultAcl, AclSize, ACL_REVISION)
1165  || !InitializeAcl(pUserDesktopAcl, AclSize, ACL_REVISION))
1166  {
1167  ERR("WL: InitializeAcl() failed (error %lu)\n", GetLastError());
1168  goto cleanup;
1169  }
1170 
1171  /*
1172  * Create default ACL (window station, winlogon desktop, screen saver desktop)
1173  */
1175  || !AddAccessAllowedAce(pDefaultAcl, ACL_REVISION, GENERIC_READ, pInteractiveSid))
1176  {
1177  ERR("WL: AddAccessAllowedAce() failed (error %lu)\n", GetLastError());
1178  goto cleanup;
1179  }
1180 
1181  /*
1182  * Create the default security descriptor
1183  */
1184  if (!InitializeSecurityDescriptor(&DefaultSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
1185  {
1186  ERR("WL: InitializeSecurityDescriptor() failed (error %lu)\n", GetLastError());
1187  goto cleanup;
1188  }
1189 
1190  if (!SetSecurityDescriptorDacl(&DefaultSecurityDescriptor, TRUE, pDefaultAcl, FALSE))
1191  {
1192  ERR("WL: SetSecurityDescriptorDacl() failed (error %lu)\n", GetLastError());
1193  goto cleanup;
1194  }
1195 
1196  DefaultSecurity.nLength = sizeof(SECURITY_ATTRIBUTES);
1197  DefaultSecurity.lpSecurityDescriptor = &DefaultSecurityDescriptor;
1198  DefaultSecurity.bInheritHandle = TRUE;
1199 
1200  /*
1201  * Create user desktop ACL
1202  */
1204  || !AddAccessAllowedAce(pUserDesktopAcl, ACL_REVISION, GENERIC_ALL, pInteractiveSid))
1205  {
1206  ERR("WL: AddAccessAllowedAce() failed (error %lu)\n", GetLastError());
1207  goto cleanup;
1208  }
1209 
1210  /*
1211  * Create the user desktop security descriptor
1212  */
1213  if (!InitializeSecurityDescriptor(&UserDesktopSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
1214  {
1215  ERR("WL: InitializeSecurityDescriptor() failed (error %lu)\n", GetLastError());
1216  goto cleanup;
1217  }
1218 
1219  if (!SetSecurityDescriptorDacl(&UserDesktopSecurityDescriptor, TRUE, pUserDesktopAcl, FALSE))
1220  {
1221  ERR("WL: SetSecurityDescriptorDacl() failed (error %lu)\n", GetLastError());
1222  goto cleanup;
1223  }
1224 
1225  UserDesktopSecurity.nLength = sizeof(SECURITY_ATTRIBUTES);
1226  UserDesktopSecurity.lpSecurityDescriptor = &UserDesktopSecurityDescriptor;
1227  UserDesktopSecurity.bInheritHandle = TRUE;
1228 
1229  /*
1230  * Create the interactive window station
1231  */
1232  Session->InteractiveWindowStationName = L"WinSta0";
1233  Session->InteractiveWindowStation = CreateWindowStationW(
1234  Session->InteractiveWindowStationName,
1235  0,
1237  &DefaultSecurity);
1238  if (!Session->InteractiveWindowStation)
1239  {
1240  ERR("WL: Failed to create window station (%lu)\n", GetLastError());
1241  goto cleanup;
1242  }
1243  if (!SetProcessWindowStation(Session->InteractiveWindowStation))
1244  {
1245  ERR("WL: SetProcessWindowStation() failed (error %lu)\n", GetLastError());
1246  goto cleanup;
1247  }
1248 
1249  /*
1250  * Create the application desktop
1251  */
1252  Session->ApplicationDesktop = CreateDesktopW(
1253  L"Default",
1254  NULL,
1255  NULL,
1256  0, /* FIXME: Add DF_ALLOWOTHERACCOUNTHOOK flag? */
1258  &UserDesktopSecurity);
1259  if (!Session->ApplicationDesktop)
1260  {
1261  ERR("WL: Failed to create Default desktop (%lu)\n", GetLastError());
1262  goto cleanup;
1263  }
1264 
1265  /*
1266  * Create the winlogon desktop
1267  */
1268  Session->WinlogonDesktop = CreateDesktopW(
1269  L"Winlogon",
1270  NULL,
1271  NULL,
1272  0,
1274  &DefaultSecurity); // FIXME: Must use restricted Winlogon-only security!!
1275  if (!Session->WinlogonDesktop)
1276  {
1277  ERR("WL: Failed to create Winlogon desktop (%lu)\n", GetLastError());
1278  goto cleanup;
1279  }
1280 
1281  /*
1282  * Create the screen saver desktop
1283  */
1284  Session->ScreenSaverDesktop = CreateDesktopW(
1285  L"Screen-Saver",
1286  NULL,
1287  NULL,
1288  0,
1290  &DefaultSecurity);
1291  if(!Session->ScreenSaverDesktop)
1292  {
1293  ERR("WL: Failed to create Screen-Saver desktop (%lu)\n", GetLastError());
1294  goto cleanup;
1295  }
1296 
1297  /*
1298  * Switch to winlogon desktop
1299  */
1300  if (!SetThreadDesktop(Session->WinlogonDesktop) ||
1301  !SwitchDesktop(Session->WinlogonDesktop))
1302  {
1303  ERR("WL: Cannot switch to Winlogon desktop (%lu)\n", GetLastError());
1304  goto cleanup;
1305  }
1306 
1307  SetWindowStationUser(Session->InteractiveWindowStation,
1308  &LuidNone, NULL, 0);
1309 
1310  ret = TRUE;
1311 
1312 cleanup:
1313  if (!ret)
1314  {
1315  if (Session->ApplicationDesktop)
1316  {
1317  CloseDesktop(Session->ApplicationDesktop);
1318  Session->ApplicationDesktop = NULL;
1319  }
1320  if (Session->WinlogonDesktop)
1321  {
1322  CloseDesktop(Session->WinlogonDesktop);
1323  Session->WinlogonDesktop = NULL;
1324  }
1325  if (Session->ScreenSaverDesktop)
1326  {
1327  CloseDesktop(Session->ScreenSaverDesktop);
1328  Session->ScreenSaverDesktop = NULL;
1329  }
1330  if (Session->InteractiveWindowStation)
1331  {
1332  CloseWindowStation(Session->InteractiveWindowStation);
1333  Session->InteractiveWindowStation = NULL;
1334  }
1335  }
1336  HeapFree(GetProcessHeap(), 0, pDefaultAcl);
1337  HeapFree(GetProcessHeap(), 0, pUserDesktopAcl);
1338  return ret;
1339 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
DLGPROC DlgProc
Definition: wlx.c:33
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
BOOL UseCtrlAltDelete
Definition: winlogon.h:126
PWLSESSION WLSession
Definition: winlogon.c:20
PVOID Context
Definition: winlogon.h:124
LPARAM lParam
Definition: wlx.c:34
#define IN
Definition: typedefs.h:38
#define WLX_WM_SAS
Definition: winwlx.h:71
#define GENERIC_ALL
Definition: nt_native.h:92
int WINAPI WlxDialogBoxIndirectParam(HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam)
Definition: wlx.c:373
BOOL WINAPI SetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
Definition: winsta.c:419
int WINAPI WlxDialogBoxIndirect(HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc)
Definition: wlx.c:354
#define TRUE
Definition: types.h:120
struct _WLSESSION * PWLSESSION
PFWLXISLOGOFFOK WlxIsLogoffOk
Definition: winlogon.h:101
struct _WLX_DISPATCH_VERSION_1_0 WLX_DISPATCH_VERSION_1_0
static VOID RemoveDialogListEntry(PDIALOG_LIST_ENTRY ListEntry)
Definition: wlx.c:72
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
VOID WINAPI WlxWin31Migrate(HANDLE hWlx)
Definition: wlx.c:640
BOOL WINAPI WlxSetTimeout(HANDLE hWlx, DWORD Timeout)
Definition: wlx.c:245
#define SECURITY_MAX_SID_SIZE
Definition: setypes.h:458
Type
Definition: Type.h:6
#define ERROR_SUCCESS
Definition: deptool.c:10
static BOOL WINAPI DefaultWlxScreenSaverNotify(IN PVOID pWlxContext, IN OUT BOOL *pSecure)
Definition: wlx.c:808
HDESK WinlogonDesktop
Definition: winlogon.h:224
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
Definition: security.c:885
#define SECURITY_DESCRIPTOR_MIN_LENGTH
Definition: setypes.h:761
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
uint16_t * PWSTR
Definition: typedefs.h:54
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:808
HWND SASWindow
Definition: winlogon.h:220
BOOL(WINAPI * PFWLXSCREENSAVERNOTIFY)(PVOID, BOOL *)
Definition: winlogon.h:77
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
BOOL WINAPI AddAccessAllowedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
Definition: security.c:918
#define CALLBACK
Definition: compat.h:27
BOOL(WINAPI * PFWLXDISPLAYSTATUSMESSAGE)(PVOID, HDESK, DWORD, PWSTR, PWSTR)
Definition: winlogon.h:83
#define GENERIC_ACCESS
Definition: wlx.c:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
struct _ACCESS_ALLOWED_ACE ACCESS_ALLOWED_ACE
int WINAPI WlxAssignShellProtection(HANDLE hWlx, HANDLE hToken, HANDLE hProcess, HANDLE hThread)
Definition: wlx.c:262
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
LIST_ENTRY Entry
Definition: wlx.c:31
#define WLX_OPTION_DISPATCH_TABLE_SIZE
Definition: winwlx.h:331
BOOL WINAPI SetProcessWindowStation(_In_ HWINSTA)
UINT_PTR WPARAM
Definition: windef.h:207
#define NO_PROPAGATE_INHERIT_ACE
Definition: setypes.h:716
int32_t INT_PTR
Definition: typedefs.h:62
LUID LuidNone
Definition: sas.c:46
static INT_PTR CALLBACK DefaultWlxWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wlx.c:131
int(WINAPI * PFWLXLOGGEDONSAS)(PVOID, DWORD, PVOID)
Definition: winlogon.h:67
int(WINAPI * PFWLXWKSTALOCKEDSAS)(PVOID, DWORD)
Definition: winlogon.h:69
#define DWORD
Definition: nt_native.h:44
HDESK ApplicationDesktop
Definition: winlogon.h:223
BOOL AddAceToWindowStation(IN HWINSTA WinSta, IN PSID Sid)
Definition: wlx.c:942
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
VOID WINAPI WlxSetContextPointer(HANDLE hWlx, PVOID pWlxContext)
Definition: wlx.c:212
BOOL(WINAPI * PFWLXINITIALIZE)(LPWSTR, HANDLE, PVOID, PVOID, PVOID *)
Definition: winlogon.h:61
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
uint32_t ULONG_PTR
Definition: typedefs.h:63
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
int WINAPI WlxDialogBox(HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc)
Definition: wlx.c:301
BOOL(WINAPI * PFWLXREMOVESTATUSMESSAGE)(PVOID)
Definition: winlogon.h:85
VOID(WINAPI * PFWLXSHUTDOWN)(PVOID, DWORD)
Definition: winlogon.h:73
VOID WINAPI WlxSasNotify(HANDLE hWlx, DWORD dwSasType)
Definition: wlx.c:228
BOOL WINAPI WlxCloseUserDesktop(HANDLE hWlx, PWLX_DESKTOP pDesktop, HANDLE hToken)
Definition: wlx.c:531
BOOL WINAPI WlxGetSourceDesktop(HANDLE hWlx, PWLX_DESKTOP *ppDesktop)
Definition: wlx.c:455
Definition: card.h:12
#define WLX_OPTION_SMART_CARD_INFO
Definition: winwlx.h:330
BOOL WINAPI WlxCreateUserDesktop(HANDLE hWlx, HANDLE hToken, DWORD Flags, PWSTR pszDesktopName, PWLX_DESKTOP *ppDesktop)
Definition: wlx.c:487
struct _ACL ACL
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
#define MAXDWORD
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI SetUserObjectSecurity(_In_ HANDLE, _In_ PSECURITY_INFORMATION, _In_ PSECURITY_DESCRIPTOR)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1339
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
int WINAPI WlxChangePasswordNotifyEx(HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo, PWSTR ProviderName, PVOID Reserved)
Definition: wlx.c:509
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
DWORD WINAPI WlxQueryTerminalServicesData(HANDLE hWlx, PWLX_TERMINAL_SERVICES_DATA pTSData, WCHAR *UserName, WCHAR *Domain)
Definition: wlx.c:692
#define WLX_VERSION_1_1
Definition: winwlx.h:29
GINAINSTANCE Gina
Definition: winlogon.h:216
BOOL AddAceToDesktop(IN HDESK Desktop, IN PSID WinlogonSid, IN PSID UserSid)
Definition: wlx.c:1039
#define PostMessage
Definition: winuser.h:5807
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
static LIST_ENTRY DialogListHead
Definition: wlx.c:40
int WINAPI WlxMessageBox(HANDLE hWlx, HWND hwndOwner, LPWSTR lpszText, LPWSTR lpszTitle, UINT fuStyle)
Definition: wlx.c:282
#define CONTAINER_INHERIT_ACE
Definition: setypes.h:715
BOOL(WINAPI * PFWLXNETWORKPROVIDERLOAD)(PVOID, PWLX_MPR_NOTIFY_INFO)
Definition: winlogon.h:82
#define WLX_OPTION_SMART_CARD_PRESENT
Definition: winwlx.h:329
#define WLX_OPTION_CONTEXT_POINTER
Definition: winwlx.h:323
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
VOID(WINAPI * PFWLXDISPLAYLOCKEDNOTICE)(PVOID)
Definition: winlogon.h:68
#define WLX_VERSION_1_4
Definition: winwlx.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:413
#define WLX_OPTION_USE_CTRL_ALT_DEL
Definition: winwlx.h:322
#define DESKTOP_ALL
Definition: wlx.c:15
#define GetProcessHeap()
Definition: compat.h:403
#define WLX_OPTION_USE_SMART_CARD
Definition: winwlx.h:324
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
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:798
BOOL WINAPI WlxQueryClientCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred)
Definition: wlx.c:653
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:8
#define WLX_VERSION_1_2
Definition: winwlx.h:30
DWORD WINAPI WlxQueryConsoleSwitchCredentials(PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred)
Definition: wlx.c:712
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:685
#define Len
Definition: deflate.h:82
DWORD DialogTimeout
Definition: winlogon.h:230
static BOOL GetGinaPath(OUT LPWSTR Path, IN DWORD Len)
Definition: wlx.c:770
BOOL WINAPI SwitchDesktop(_In_ HDESK)
GINAFUNCTIONS Functions
Definition: winlogon.h:123
BOOL WINAPI WlxQueryTsLogonCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred)
Definition: wlx.c:726
struct _SID * PSID
Definition: eventlog.c:35
VOID(WINAPI * PFWLXLOGOFF)(PVOID)
Definition: winlogon.h:72
HWND hWnd
Definition: wlx.c:32
int ret
struct _WLX_DISPATCH_VERSION_1_4 WLX_DISPATCH_VERSION_1_4
BOOL(WINAPI * PFWLXACTIVATEUSERSHELL)(PVOID, PWSTR, PWSTR, PVOID)
Definition: winlogon.h:66
static const WCHAR L[]
Definition: oid.c:1250
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
VOID(WINAPI * PFWLXDISPLAYSASNOTICE)(PVOID)
Definition: winlogon.h:62
int(WINAPI * PFWLXLOGGEDOUTSAS)(PVOID, DWORD, PLUID, PSID, PDWORD, PHANDLE, PWLX_MPR_NOTIFY_INFO, PVOID *)
Definition: winlogon.h:63
unsigned char BYTE
Definition: mem.h:68
BOOL(WINAPI * PFWLXSTARTAPPLICATION)(PVOID, PWSTR, PVOID, PWSTR)
Definition: winlogon.h:78
#define WLX_DLG_SAS
Definition: winwlx.h:73
BOOL(WINAPI * PFWLXISLOCKOK)(PVOID)
Definition: winlogon.h:70
#define GENERIC_READ
Definition: compat.h:124
Definition: typedefs.h:117
struct _WLX_DISPATCH_VERSION_1_1 WLX_DISPATCH_VERSION_1_1
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2871
#define WLX_VERSION_1_0
Definition: winwlx.h:28
#define ERR(fmt,...)
Definition: debug.h:109
BOOL CreateWindowStationAndDesktops(IN OUT PWLSESSION Session)
Definition: wlx.c:1121
int WINAPI WlxSwitchDesktopToWinlogon(HANDLE hWlx)
Definition: wlx.c:422
static BOOL LoadGina(IN OUT PGINAFUNCTIONS Functions, OUT DWORD *DllVersion, OUT HMODULE *GinaInstance)
Definition: wlx.c:819
#define WLX_CURRENT_VERSION
Definition: winwlx.h:33
static PSID pLocalSystemSid
Definition: security.c:18
HINSTANCE hInst
Definition: dxdiag.c:13
PRTL_UNICODE_STRING_BUFFER Path
#define WLX_SAS_TYPE_MAX_MSFT_VALUE
Definition: winwlx.h:46
static ULONG Timeout
Definition: ping.c:61
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
LPVOID lpSecurityDescriptor
Definition: compat.h:181
struct _WLX_DISPATCH_VERSION_1_3 WLX_DISPATCH_VERSION_1_3
static PDIALOG_LIST_ENTRY GetDialogListEntry(HWND hwndDlg)
Definition: wlx.c:83
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
Definition: wlx.c:29
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
unsigned int UINT
Definition: ndis.h:50
VOID InitDialogListHead(VOID)
Definition: wlx.c:45
struct _DIALOG_LIST_ENTRY * PDIALOG_LIST_ENTRY
BOOL WINAPI AddAce(PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength)
Definition: security.c:1020
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HANDLE hThread
Definition: wizard.c:27
struct _WLX_DISPATCH_VERSION_1_2 WLX_DISPATCH_VERSION_1_2
#define ACL_REVISION
Definition: setypes.h:39
BOOL(WINAPI * PFWLXISLOGOFFOK)(PVOID)
Definition: winlogon.h:71
BOOL WINAPI WlxDisconnect(VOID)
Definition: wlx.c:681
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI WlxSetOption(HANDLE hWlx, DWORD Option, ULONG_PTR Value, ULONG_PTR *OldValue)
Definition: wlx.c:549
#define OUT
Definition: typedefs.h:39
HWINSTA WINAPI CreateWindowStationW(_In_opt_ LPCWSTR lpwinsta, _In_ DWORD dwFlags, _In_ ACCESS_MASK dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpsa)
BOOL WINAPI CloseDesktop(_In_ HDESK)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
static PDIALOG_LIST_ENTRY AddDialogListEntry(VOID)
Definition: wlx.c:53
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL GinaInit(IN OUT PWLSESSION Session)
Definition: wlx.c:919
#define ULONG_PTR
Definition: config.h:101
char * cleanup(char *str)
Definition: wpickclick.c:99
static WLX_DISPATCH_VERSION_1_4 FunctionTable
Definition: wlx.c:736
#define GetProcAddress(x, y)
Definition: compat.h:418
#define INHERIT_ONLY_ACE
Definition: setypes.h:717
BOOL(WINAPI * PFWLXNEGOTIATE)(DWORD, DWORD *)
Definition: winlogon.h:60
VOID WINAPI WlxUseCtrlAltDel(HANDLE hWlx)
Definition: wlx.c:197
int WINAPI WlxChangePasswordNotify(HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo)
Definition: wlx.c:437
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define WINSTA_ALL
Definition: wlx.c:20
HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop, LPCWSTR lpszDevice, LPDEVMODEW pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
Definition: desktop.c:473
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
Definition: security.c:591
BOOL WINAPI CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType, IN PSID DomainSid OPTIONAL, OUT PSID pSid, IN OUT DWORD *cbSid)
Definition: security.c:601
#define WM_INITDIALOG
Definition: winuser.h:1721
BOOL WINAPI WlxQueryInetConnectorCredentials(PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred)
Definition: wlx.c:667
VOID CloseAllDialogWindows(VOID)
Definition: wlx.c:109
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:402
#define OBJECT_INHERIT_ACE
Definition: setypes.h:714
DWORD Version
Definition: winlogon.h:125
base of all file and directory entries
Definition: entries.h:82
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
BOOL WINAPI WlxSetReturnDesktop(HANDLE hWlx, PWLX_DESKTOP pDesktop)
Definition: wlx.c:471
#define WLX_VERSION_1_3
Definition: winwlx.h:31
BOOL WINAPI CloseWindowStation(_In_ HWINSTA)
BOOL WINAPI WlxGetOption(HANDLE hWlx, DWORD Option, ULONG_PTR *Value)
Definition: wlx.c:582
int WINAPI WlxDialogBoxParam(HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam)
Definition: wlx.c:320
struct _DIALOG_LIST_ENTRY DIALOG_LIST_ENTRY
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
BOOL(WINAPI * PFWLXGETSTATUSMESSAGE)(PVOID, DWORD *, PWSTR, DWORD)
Definition: winlogon.h:84
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
int WINAPI WlxSwitchDesktopToUser(HANDLE hWlx)
Definition: wlx.c:407