ReactOS 0.4.16-dev-1288-g7ec3a7e
sas.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/sas.c
5 * PURPOSE: Secure Attention Sequence
6 * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
7 * Hervé Poussineau (hpoussin@reactos.org)
8 * Arnav Bhatt (arnavbhatt288@gmail.com)
9 * UPDATE HISTORY:
10 * Created 28/03/2004
11 */
12
13/* INCLUDES *****************************************************************/
14
15#include "winlogon.h"
16
17#define WIN32_LEAN_AND_MEAN
18#include <aclapi.h>
19#include <mmsystem.h>
20#include <userenv.h>
21#include <ndk/setypes.h>
22#include <ndk/sefuncs.h>
23
24/* GLOBALS ******************************************************************/
25
26#define WINLOGON_SAS_CLASS L"SAS Window class"
27#define WINLOGON_SAS_TITLE L"SAS window"
28
29#define IDHK_CTRL_ALT_DEL 0
30#define IDHK_CTRL_SHIFT_ESC 1
31#define IDHK_WIN_L 2
32#define IDHK_WIN_U 3
33
34// #define EWX_FLAGS_MASK 0x00000014
35// #define EWX_ACTION_MASK ~EWX_FLAGS_MASK
36
37// FIXME: At the moment we use this value (select the lowbyte flags and some highbytes ones).
38// It should be set such that it makes winlogon accepting only valid flags.
39#define EWX_ACTION_MASK 0x5C0F
40
42{
46
48
49LUID LuidNone = {0, 0};
50
51typedef struct tagLOGON_SOUND_DATA
52{
56
57/* FUNCTIONS ****************************************************************/
58
59static BOOL
61 IN OUT PWLSESSION Session)
62{
63 LPVOID lpEnvironment;
64 BOOL ret;
65
66 if (!Session->Gina.Functions.WlxStartApplication)
67 return FALSE;
68
70 &lpEnvironment,
71 Session->UserToken,
72 TRUE))
73 {
74 return FALSE;
75 }
76
77 ret = Session->Gina.Functions.WlxStartApplication(
78 Session->Gina.Context,
79 L"Default",
80 lpEnvironment,
81 L"taskmgr.exe");
82
83 DestroyEnvironmentBlock(lpEnvironment);
84 return ret;
85}
86
87static BOOL
89 IN OUT PWLSESSION Session)
90{
91 LPVOID lpEnvironment = NULL;
92 BOOLEAN Old;
93 BOOL ret;
94
95 /* Create environment block for the user */
96 if (!CreateEnvironmentBlock(&lpEnvironment, Session->UserToken, TRUE))
97 {
98 WARN("WL: CreateEnvironmentBlock() failed\n");
99 return FALSE;
100 }
101
102 /* Get privilege */
103 /* FIXME: who should do it? winlogon or gina? */
104 /* FIXME: reverting to lower privileges after creating user shell? */
106
107 ret = Session->Gina.Functions.WlxActivateUserShell(
108 Session->Gina.Context,
109 L"Default",
110 NULL, /* FIXME */
111 lpEnvironment);
112
113 DestroyEnvironmentBlock(lpEnvironment);
114 return ret;
115}
116
117
118BOOL
120 IN PWLSESSION Session)
121{
122 BOOL ret = FALSE;
123 BOOL UserProfile;
124 LONG rc;
125 HKEY UserKey, hKey = NULL;
126 LPCWSTR SubKey, ValueName;
127 DWORD dwType, dwSize;
128 LPWSTR Value = NULL;
129 UNICODE_STRING ValueString;
131 LCID Lcid;
132
133 UserProfile = (Session && Session->UserToken);
134
135 if (UserProfile && !ImpersonateLoggedOnUser(Session->UserToken))
136 {
137 ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
138 return FALSE;
139 // FIXME: ... or use the default language of the system??
140 // UserProfile = FALSE;
141 }
142
143 if (UserProfile)
144 {
145 rc = RegOpenCurrentUser(MAXIMUM_ALLOWED, &UserKey);
146 if (rc != ERROR_SUCCESS)
147 {
148 TRACE("RegOpenCurrentUser() failed with error %lu\n", rc);
149 goto cleanup;
150 }
151
152 SubKey = L"Control Panel\\International";
153 ValueName = L"Locale";
154 }
155 else
156 {
157 UserKey = NULL;
158 SubKey = L"System\\CurrentControlSet\\Control\\Nls\\Language";
159 ValueName = L"Default";
160 }
161
162 rc = RegOpenKeyExW(UserKey ? UserKey : HKEY_LOCAL_MACHINE,
163 SubKey,
164 0,
165 KEY_READ,
166 &hKey);
167
168 if (UserKey)
169 RegCloseKey(UserKey);
170
171 if (rc != ERROR_SUCCESS)
172 {
173 TRACE("RegOpenKeyEx() failed with error %lu\n", rc);
174 goto cleanup;
175 }
176
178 ValueName,
179 NULL,
180 &dwType,
181 NULL,
182 &dwSize);
183 if (rc != ERROR_SUCCESS)
184 {
185 TRACE("RegQueryValueEx() failed with error %lu\n", rc);
186 goto cleanup;
187 }
188 else if (dwType != REG_SZ)
189 {
190 TRACE("Wrong type for %S\\%S registry entry (got 0x%lx, expected 0x%x)\n",
191 SubKey, ValueName, dwType, REG_SZ);
192 goto cleanup;
193 }
194
196 if (!Value)
197 {
198 TRACE("HeapAlloc() failed\n");
199 goto cleanup;
200 }
202 ValueName,
203 NULL,
204 NULL,
205 (LPBYTE)Value,
206 &dwSize);
207 if (rc != ERROR_SUCCESS)
208 {
209 TRACE("RegQueryValueEx() failed with error %lu\n", rc);
210 goto cleanup;
211 }
212
213 /* Convert Value to a Lcid */
214 ValueString.Length = ValueString.MaximumLength = (USHORT)dwSize;
215 ValueString.Buffer = Value;
216 Status = RtlUnicodeStringToInteger(&ValueString, 16, (PULONG)&Lcid);
217 if (!NT_SUCCESS(Status))
218 {
219 TRACE("RtlUnicodeStringToInteger() failed with status 0x%08lx\n", Status);
220 goto cleanup;
221 }
222
223 TRACE("%s language is 0x%08lx\n",
224 UserProfile ? "User" : "System", Lcid);
225 Status = NtSetDefaultLocale(UserProfile, Lcid);
226 if (!NT_SUCCESS(Status))
227 {
228 TRACE("NtSetDefaultLocale() failed with status 0x%08lx\n", Status);
229 goto cleanup;
230 }
231
232 ret = TRUE;
233
234cleanup:
235 if (Value)
237
238 if (hKey)
240
241 if (UserProfile)
242 RevertToSelf();
243
244 return ret;
245}
246
247BOOL
250 IN UINT bLogon,
251 IN UINT Flags)
252{
253 typedef BOOL (WINAPI *PLAYSOUNDW)(LPCWSTR,HMODULE,DWORD);
254 typedef UINT (WINAPI *WAVEOUTGETNUMDEVS)(VOID);
255 PLAYSOUNDW Play;
256 WAVEOUTGETNUMDEVS waveOutGetNumDevs;
257 UINT NumDevs;
259 BOOL Ret = FALSE;
260
261 hLibrary = LoadLibraryW(L"winmm.dll");
262 if (!hLibrary)
263 return FALSE;
264
265 waveOutGetNumDevs = (WAVEOUTGETNUMDEVS)GetProcAddress(hLibrary, "waveOutGetNumDevs");
266 Play = (PLAYSOUNDW)GetProcAddress(hLibrary, "PlaySoundW");
267
269 {
271 {
272 NumDevs = waveOutGetNumDevs();
273 if (!NumDevs)
274 {
275 if (!bLogon)
276 Beep(440, 125);
278 }
279 }
280
281 if (Play)
282 Ret = Play(FileName, NULL, Flags);
283 }
285 {
286 ERR("WL: Exception while playing sound '%S', Status 0x%08lx\n",
288 }
289 _SEH2_END;
290
292
293 return Ret;
294}
295
296static
297DWORD
298WINAPI
300 _In_ LPVOID lpParameter)
301{
302 PLOGON_SOUND_DATA SoundData = (PLOGON_SOUND_DATA)lpParameter;
305 ULONG Index = 0;
306 SC_HANDLE hSCManager, hService;
307
308 /* Open the service manager */
310 if (!hSCManager)
311 {
312 ERR("OpenSCManager failed (%x)\n", GetLastError());
313 goto Cleanup;
314 }
315
316 /* Open the wdmaud service */
317 hService = OpenServiceW(hSCManager, L"wdmaud", GENERIC_READ);
318 if (!hService)
319 {
320 /* The service is not installed */
321 TRACE("Failed to open wdmaud service (%x)\n", GetLastError());
323 goto Cleanup;
324 }
325
326 /* Wait for wdmaud to start */
327 do
328 {
330 {
331 TRACE("QueryServiceStatusEx failed (%x)\n", GetLastError());
332 break;
333 }
334
335 if (Info.dwCurrentState == SERVICE_RUNNING)
336 break;
337
338 Sleep(1000);
339
340 } while (Index++ < 20);
341
342 CloseServiceHandle(hService);
344
345 /* If wdmaud is not running exit */
346 if (Info.dwCurrentState != SERVICE_RUNNING)
347 {
348 WARN("wdmaud has not started!\n");
349 goto Cleanup;
350 }
351
352 /* Sound subsystem is running. Play logon sound. */
353 TRACE("Playing %s sound\n", SoundData->IsStartup ? "startup" : "logon");
354 if (!ImpersonateLoggedOnUser(SoundData->UserToken))
355 {
356 ERR("ImpersonateLoggedOnUser failed (%x)\n", GetLastError());
357 }
358 else
359 {
360 PlaySoundRoutine(SoundData->IsStartup ? L"SystemStart" : L"WindowsLogon",
361 TRUE,
363 RevertToSelf();
364 }
365
366Cleanup:
367 HeapFree(GetProcessHeap(), 0, SoundData);
368 return 0;
369}
370
371static
372VOID
374 _In_ PWLSESSION Session)
375{
376 PLOGON_SOUND_DATA SoundData;
378
379 SoundData = HeapAlloc(GetProcessHeap(), 0, sizeof(LOGON_SOUND_DATA));
380 if (!SoundData)
381 return;
382
383 SoundData->UserToken = Session->UserToken;
384 SoundData->IsStartup = IsFirstLogon(Session);
385
386 hThread = CreateThread(NULL, 0, PlayLogonSoundThread, SoundData, 0, NULL);
387 if (!hThread)
388 {
389 HeapFree(GetProcessHeap(), 0, SoundData);
390 return;
391 }
393}
394
395static
396VOID
398 _In_ PWLSESSION Session,
400{
401 if (!ImpersonateLoggedOnUser(Session->UserToken))
402 return;
403
404 /* NOTE: Logoff and shutdown sounds play synchronously */
405 PlaySoundRoutine(bShutdown ? L"SystemExit" : L"WindowsLogoff",
406 FALSE,
408
409 RevertToSelf();
410}
411
412static
413BOOL
415 _In_ PWLSESSION Session,
416 _In_ LPCWSTR EventName)
417{
418 BOOL bRet;
419
420 if (!ImpersonateLoggedOnUser(Session->UserToken))
421 return FALSE;
422
424
425 RevertToSelf();
426
427 return bRet;
428}
429
430static
431VOID
433{
434 DWORD dRet;
435 HANDLE hEnum;
436 LPNETRESOURCE lpRes;
437 DWORD dSize = 0x1000;
438 DWORD dCount = -1;
439 LPNETRESOURCE lpCur;
440 BOOL UserProfile;
441
442 UserProfile = (Session && Session->UserToken);
443 if (!UserProfile)
444 {
445 return;
446 }
447
448 if (!ImpersonateLoggedOnUser(Session->UserToken))
449 {
450 ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
451 return;
452 }
453
455 if (dRet != WN_SUCCESS)
456 {
457 ERR("Failed to open enumeration: %lu\n", dRet);
458 goto quit;
459 }
460
461 lpRes = HeapAlloc(GetProcessHeap(), 0, dSize);
462 if (!lpRes)
463 {
464 ERR("Failed to allocate memory\n");
465 WNetCloseEnum(hEnum);
466 goto quit;
467 }
468
469 do
470 {
471 dSize = 0x1000;
472 dCount = -1;
473
474 memset(lpRes, 0, dSize);
475 dRet = WNetEnumResource(hEnum, &dCount, lpRes, &dSize);
476 if (dRet == WN_SUCCESS || dRet == WN_MORE_DATA)
477 {
478 lpCur = lpRes;
479 for (; dCount; dCount--)
480 {
482 lpCur++;
483 }
484 }
485 } while (dRet != WN_NO_MORE_ENTRIES);
486
487 HeapFree(GetProcessHeap(), 0, lpRes);
488 WNetCloseEnum(hEnum);
489
490quit:
491 RevertToSelf();
492}
493
494static
495BOOL
497 IN OUT PWLSESSION Session)
498{
499 PROFILEINFOW ProfileInfo;
500 BOOL ret = FALSE;
501
502 /* Loading personal settings */
503 DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOADINGYOURPERSONALSETTINGS);
504 ProfileInfo.hProfile = INVALID_HANDLE_VALUE;
505 if (0 == (Session->Options & WLX_LOGON_OPT_NO_PROFILE))
506 {
507 if (Session->Profile == NULL
508 || (Session->Profile->dwType != WLX_PROFILE_TYPE_V1_0
509 && Session->Profile->dwType != WLX_PROFILE_TYPE_V2_0))
510 {
511 ERR("WL: Wrong profile\n");
512 goto cleanup;
513 }
514
515 /* Load the user profile */
516 ZeroMemory(&ProfileInfo, sizeof(PROFILEINFOW));
517 ProfileInfo.dwSize = sizeof(PROFILEINFOW);
518 ProfileInfo.dwFlags = 0;
519 ProfileInfo.lpUserName = Session->MprNotifyInfo.pszUserName;
520 ProfileInfo.lpProfilePath = Session->Profile->pszProfile;
521 if (Session->Profile->dwType >= WLX_PROFILE_TYPE_V2_0)
522 {
523 ProfileInfo.lpDefaultPath = Session->Profile->pszNetworkDefaultUserProfile;
524 ProfileInfo.lpServerName = Session->Profile->pszServerName;
525 ProfileInfo.lpPolicyPath = Session->Profile->pszPolicy;
526 }
527
528 if (!LoadUserProfileW(Session->UserToken, &ProfileInfo))
529 {
530 ERR("WL: LoadUserProfileW() failed\n");
531 goto cleanup;
532 }
533 }
534
535 /* Create environment block for the user */
536 if (!CreateUserEnvironment(Session))
537 {
538 WARN("WL: SetUserEnvironment() failed\n");
539 goto cleanup;
540 }
541
543
544 DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS);
546
547 /* Set default user language */
548 if (!SetDefaultLanguage(Session))
549 {
550 WARN("WL: SetDefaultLanguage() failed\n");
551 goto cleanup;
552 }
553
554 /* Allow winsta and desktop access for this session */
555 if (!AllowAccessOnSession(Session))
556 {
557 WARN("WL: AllowAccessOnSession() failed to give winsta & desktop access for this session\n");
558 goto cleanup;
559 }
560
561 /* Connect remote resources */
562 RestoreAllConnections(Session);
563
564 if (!StartUserShell(Session))
565 {
566 //WCHAR StatusMsg[256];
567 WARN("WL: WlxActivateUserShell() failed\n");
568 //LoadStringW(hAppInstance, IDS_FAILEDACTIVATEUSERSHELL, StatusMsg, sizeof(StatusMsg) / sizeof(StatusMsg[0]));
569 //MessageBoxW(0, StatusMsg, NULL, MB_ICONERROR);
570 goto cleanup;
571 }
572
574
575 if (!InitializeScreenSaver(Session))
576 WARN("WL: Failed to initialize screen saver\n");
577
578 Session->hProfileInfo = ProfileInfo.hProfile;
579
580 /* Logon has succeeded. Play sound. */
581 PlayLogonSound(Session);
582
583 /* NOTE: The logon timestamp has to be set after calling PlayLogonSound
584 * to correctly detect the startup event (first logon) */
585 SetLogonTimestamp(Session);
586 ret = TRUE;
587
588cleanup:
589 if (Session->Profile)
590 {
591 HeapFree(GetProcessHeap(), 0, Session->Profile->pszProfile);
592 HeapFree(GetProcessHeap(), 0, Session->Profile);
593 }
594 Session->Profile = NULL;
595 if (!ret && ProfileInfo.hProfile != INVALID_HANDLE_VALUE)
596 {
597 UnloadUserProfile(Session->UserToken, ProfileInfo.hProfile);
598 }
599 RemoveStatusMessage(Session);
600 if (!ret)
601 {
602 SetWindowStationUser(Session->InteractiveWindowStation,
603 &LuidNone, NULL, 0);
604 CloseHandle(Session->UserToken);
605 Session->UserToken = NULL;
606 }
607
608 if (ret)
609 {
610 SwitchDesktop(Session->ApplicationDesktop);
611 Session->LogonState = STATE_LOGGED_ON;
612 }
613
614 return ret;
615}
616
617
618static
619DWORD
620WINAPI
623{
624 DWORD ret = 1;
626 UINT uFlags;
627
628 if (LSData->Session->UserToken != NULL &&
630 {
631 ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
632 return 0;
633 }
634
635 // FIXME: To be really fixed: need to check what needs to be kept and what needs to be removed there.
636 //
637 // uFlags = EWX_INTERNAL_KILL_USER_APPS | (LSData->Flags & EWX_FLAGS_MASK) |
638 // ((LSData->Flags & EWX_ACTION_MASK) == EWX_LOGOFF ? EWX_CALLER_WINLOGON_LOGOFF : 0);
639
640 uFlags = EWX_CALLER_WINLOGON | (LSData->Flags & 0x0F);
641
642 TRACE("In LogoffShutdownThread with uFlags == 0x%x; exit_in_progress == %s\n",
643 uFlags, ExitReactOSInProgress ? "true" : "false");
644
646
647 /* Close processes of the interactive user */
648 if (!ExitWindowsEx(uFlags, 0))
649 {
650 ERR("Unable to kill user apps, error %lu\n", GetLastError());
651 ret = 0;
652 }
653
654 /* Cancel all the user connections */
656
657 if (LSData->Session->UserToken)
658 RevertToSelf();
659
660 return ret;
661}
662
663static
664DWORD
665WINAPI
668{
669 DWORD ret = 1;
671
672 TRACE("In KillComProcesses\n");
673
674 if (LSData->Session->UserToken != NULL &&
676 {
677 ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
678 return 0;
679 }
680
681 /* Attempt to kill remaining processes. No notifications needed. */
683 {
684 ERR("Unable to kill COM apps, error %lu\n", GetLastError());
685 ret = 0;
686 }
687
688 if (LSData->Session->UserToken)
689 RevertToSelf();
690
691 return ret;
692}
693
694static
698{
699 /* The following code is not working yet and messy */
700 /* Still, it gives some ideas about data types and functions involved and */
701 /* required to set up a SECURITY_DESCRIPTOR for a SECURITY_ATTRIBUTES */
702 /* instance for a thread, to allow that thread to ImpersonateLoggedOnUser(). */
703 /* Specifically THREAD_SET_THREAD_TOKEN is required. */
706 BYTE* pMem;
707 PACL pACL;
708 EXPLICIT_ACCESS Access;
709 PSID pEveryoneSID = NULL;
711
712 *ppsa = NULL;
713
714 // Let's first try to enumerate what kind of data we need for this to ever work:
715 // 1. The Winlogon SID, to be able to give it THREAD_SET_THREAD_TOKEN.
716 // 2. The users SID (the user trying to logoff, or rather shut down the system).
717 // 3. At least two EXPLICIT_ACCESS instances:
718 // 3.1 One for Winlogon itself, giving it the rights
719 // required to THREAD_SET_THREAD_TOKEN (as it's needed to successfully call
720 // ImpersonateLoggedOnUser).
721 // 3.2 One for the user, to allow *that* thread to perform its work.
722 // 4. An ACL to hold the these EXPLICIT_ACCESS ACE's.
723 // 5. A SECURITY_DESCRIPTOR to hold the ACL, and finally.
724 // 6. A SECURITY_ATTRIBUTES instance to pull all of this required stuff
725 // together, to hand it to CreateThread.
726 //
727 // However, it seems struct LOGOFF_SHUTDOWN_DATA doesn't contain
728 // these required SID's, why they'd have to be added.
729 // The Winlogon's own SID should probably only be created once,
730 // while the user's SID obviously must be created for each new user.
731 // Might as well store it when the user logs on?
732
734 1,
736 0, 0, 0, 0, 0, 0, 0,
737 &pEveryoneSID))
738 {
739 ERR("Failed to initialize security descriptor for logoff thread!\n");
740 return STATUS_UNSUCCESSFUL;
741 }
742
743 /* set up the required security attributes to be able to shut down */
744 /* To save space and time, allocate a single block of memory holding */
745 /* both SECURITY_ATTRIBUTES and SECURITY_DESCRIPTOR */
746 pMem = HeapAlloc(GetProcessHeap(),
747 0,
748 sizeof(SECURITY_ATTRIBUTES) +
750 sizeof(ACL));
751 if (!pMem)
752 {
753 ERR("Failed to allocate memory for logoff security descriptor!\n");
754 return STATUS_NO_MEMORY;
755 }
756
757 /* Note that the security descriptor needs to be in _absolute_ format, */
758 /* meaning its members must be pointers to other structures, rather */
759 /* than the relative format using offsets */
763
764 // Initialize an EXPLICIT_ACCESS structure for an ACE.
765 // The ACE will allow this thread to log off (and shut down the system, currently).
766 ZeroMemory(&Access, sizeof(Access));
768 Access.grfAccessMode = SET_ACCESS; // GRANT_ACCESS?
772 Access.Trustee.ptstrName = pEveryoneSID;
773
774 if (SetEntriesInAcl(1, &Access, NULL, &pACL) != ERROR_SUCCESS)
775 {
776 ERR("Failed to set Access Rights for logoff thread. Logging out will most likely fail.\n");
777
778 HeapFree(GetProcessHeap(), 0, pMem);
779 return STATUS_UNSUCCESSFUL;
780 }
781
783 {
784 ERR("Failed to initialize security descriptor for logoff thread!\n");
785 HeapFree(GetProcessHeap(), 0, pMem);
786 return STATUS_UNSUCCESSFUL;
787 }
788
790 TRUE, // bDaclPresent flag
791 pACL,
792 FALSE)) // not a default DACL
793 {
794 ERR("SetSecurityDescriptorDacl Error %lu\n", GetLastError());
795 HeapFree(GetProcessHeap(), 0, pMem);
796 return STATUS_UNSUCCESSFUL;
797 }
798
799 psa->nLength = sizeof(SECURITY_ATTRIBUTES);
800 psa->lpSecurityDescriptor = SecurityDescriptor;
801 psa->bInheritHandle = FALSE;
802
803 *ppsa = psa;
804
805 return STATUS_SUCCESS;
806}
807
808static
809VOID
812{
813 if (psa)
814 {
816 }
817}
818
819
820static
823 _Inout_ PWLSESSION Session,
824 _In_ DWORD wlxAction)
825{
829 DWORD exitCode;
831
832 /* Prepare data for logoff thread */
833 LSData = HeapAlloc(GetProcessHeap(), 0, sizeof(LOGOFF_SHUTDOWN_DATA));
834 if (!LSData)
835 {
836 ERR("Failed to allocate mem for thread data\n");
837 return STATUS_NO_MEMORY;
838 }
839
840 LSData->Flags = EWX_LOGOFF;
841 if (wlxAction == WLX_SAS_ACTION_FORCE_LOGOFF)
842 {
843 LSData->Flags |= EWX_FORCE;
844 }
845
846 LSData->Session = Session;
847
849 if (!NT_SUCCESS(Status))
850 {
851 ERR("Failed to create a required security descriptor. Status 0x%08lx\n", Status);
852 HeapFree(GetProcessHeap(), 0, LSData);
853 return Status;
854 }
855
856 /* Run logoff thread */
858 if (!hThread)
859 {
860 ERR("Unable to create logoff thread, error %lu\n", GetLastError());
862 HeapFree(GetProcessHeap(), 0, LSData);
863 return STATUS_UNSUCCESSFUL;
864 }
866 if (!GetExitCodeThread(hThread, &exitCode))
867 {
868 ERR("Unable to get exit code of logoff thread (error %lu)\n", GetLastError());
871 HeapFree(GetProcessHeap(), 0, LSData);
872 return STATUS_UNSUCCESSFUL;
873 }
875 if (exitCode == 0)
876 {
877 ERR("Logoff thread returned failure\n");
879 HeapFree(GetProcessHeap(), 0, LSData);
880 return STATUS_UNSUCCESSFUL;
881 }
882
883 SwitchDesktop(Session->WinlogonDesktop);
884
885 PlayLogoffShutdownSound(Session, WLX_SHUTTINGDOWN(wlxAction));
886
887 SetWindowStationUser(Session->InteractiveWindowStation,
888 &LuidNone, NULL, 0);
889
890 // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOGGINGOFF);
891
892 // FIXME: Closing network connections!
893 // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_CLOSINGNETWORKCONNECTIONS);
894
895 /* Kill remaining COM apps. Only at logoff! */
897 if (hThread)
898 {
901 }
902
903 /* We're done with the SECURITY_DESCRIPTOR */
905 psa = NULL;
906
907 HeapFree(GetProcessHeap(), 0, LSData);
908
909 DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_SAVEYOURSETTINGS);
910
911 UnloadUserProfile(Session->UserToken, Session->hProfileInfo);
912
914
915 CloseHandle(Session->UserToken);
917 Session->LogonState = STATE_LOGGED_OFF;
918 Session->UserToken = NULL;
919
920 return STATUS_SUCCESS;
921}
922
923static
927 IN HWND hwndDlg,
928 IN UINT uMsg,
931{
933
934 switch (uMsg)
935 {
936 case WM_COMMAND:
937 {
938 switch (LOWORD(wParam))
939 {
942 return TRUE;
943 }
944 break;
945 }
946 case WM_INITDIALOG:
947 {
950 return TRUE;
951 }
952 }
953 return FALSE;
954}
955
956static
957VOID
959 IN OUT PWLSESSION Session)
960{
961 if (Session->SASWindow)
962 {
963 DestroyWindow(Session->SASWindow);
964 Session->SASWindow = NULL;
965 }
966 if (Session->hEndOfScreenSaverThread)
967 SetEvent(Session->hEndOfScreenSaverThread);
969}
970
973 IN OUT PWLSESSION Session,
974 IN DWORD wlxAction)
975{
978 DWORD exitCode;
979 BOOLEAN Old;
980
981 // SwitchDesktop(Session->WinlogonDesktop);
982
983 /* If the system is rebooting, show the appropriate string */
984 if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_REBOOT)
985 DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_REACTOSISRESTARTING);
986 else
987 DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_REACTOSISSHUTTINGDOWN);
988
989 /* Prepare data for shutdown thread */
990 LSData = HeapAlloc(GetProcessHeap(), 0, sizeof(LOGOFF_SHUTDOWN_DATA));
991 if (!LSData)
992 {
993 ERR("Failed to allocate mem for thread data\n");
994 return STATUS_NO_MEMORY;
995 }
996 if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF)
997 LSData->Flags = EWX_POWEROFF;
998 else if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_REBOOT)
999 LSData->Flags = EWX_REBOOT;
1000 else
1001 LSData->Flags = EWX_SHUTDOWN;
1002 LSData->Session = Session;
1003
1004 // FIXME: We may need to specify this flag to really force application kill
1005 // (we are shutting down ReactOS, not just logging off so no hangs, etc...
1006 // should be allowed).
1007 // LSData->Flags |= EWX_FORCE;
1008
1009 /* Run shutdown thread */
1011 if (!hThread)
1012 {
1013 ERR("Unable to create shutdown thread, error %lu\n", GetLastError());
1014 HeapFree(GetProcessHeap(), 0, LSData);
1015 return STATUS_UNSUCCESSFUL;
1016 }
1018 HeapFree(GetProcessHeap(), 0, LSData);
1019 if (!GetExitCodeThread(hThread, &exitCode))
1020 {
1021 ERR("Unable to get exit code of shutdown thread (error %lu)\n", GetLastError());
1023 return STATUS_UNSUCCESSFUL;
1024 }
1026 if (exitCode == 0)
1027 {
1028 ERR("Shutdown thread returned failure\n");
1029 return STATUS_UNSUCCESSFUL;
1030 }
1031
1033
1034 /* Destroy SAS window */
1035 UninitializeSAS(Session);
1036
1037 /* Now we can shut down NT */
1038 ERR("Shutting down NT...\n");
1040 if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_REBOOT)
1041 {
1043 }
1044 else
1045 {
1046 if (FALSE)
1047 {
1048 /* FIXME - only show this dialog if it's a shutdown and the computer doesn't support APM */
1051 }
1053 }
1055 return STATUS_SUCCESS;
1056}
1057
1058static
1059VOID
1061 IN OUT PWLSESSION Session,
1062 IN DWORD wlxAction)
1063{
1064 switch (wlxAction)
1065 {
1066 case WLX_SAS_ACTION_LOGON: /* 0x01 */
1067 if (Session->LogonState == STATE_LOGGED_OFF_SAS)
1068 {
1069 if (!HandleLogon(Session))
1070 {
1071 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1073 }
1074 }
1075 break;
1076 case WLX_SAS_ACTION_NONE: /* 0x02 */
1077 if (Session->LogonState == STATE_LOGGED_OFF_SAS)
1078 {
1079 Session->LogonState = STATE_LOGGED_OFF;
1080 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1081 }
1082 else if (Session->LogonState == STATE_LOGGED_ON_SAS)
1083 {
1084 Session->LogonState = STATE_LOGGED_ON;
1085 }
1086 else if (Session->LogonState == STATE_LOCKED_SAS)
1087 {
1088 Session->LogonState = STATE_LOCKED;
1089 Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
1090 }
1091 break;
1092 case WLX_SAS_ACTION_LOCK_WKSTA: /* 0x03 */
1093 if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context))
1094 {
1095 SwitchDesktop(Session->WinlogonDesktop);
1096 Session->LogonState = STATE_LOCKED;
1097 Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
1099 }
1100 break;
1101 case WLX_SAS_ACTION_LOGOFF: /* 0x04 */
1102 case WLX_SAS_ACTION_SHUTDOWN: /* 0x05 */
1103 case WLX_SAS_ACTION_FORCE_LOGOFF: /* 0x09 */
1104 case WLX_SAS_ACTION_SHUTDOWN_POWER_OFF: /* 0x0a */
1105 case WLX_SAS_ACTION_SHUTDOWN_REBOOT: /* 0x0b */
1106 if (Session->LogonState != STATE_LOGGED_OFF)
1107 {
1108 if (!Session->Gina.Functions.WlxIsLogoffOk(Session->Gina.Context))
1109 break;
1110 if (!NT_SUCCESS(HandleLogoff(Session, wlxAction)))
1111 {
1112 RemoveStatusMessage(Session);
1113 break;
1114 }
1115 Session->Gina.Functions.WlxLogoff(Session->Gina.Context);
1116 }
1117 if (WLX_SHUTTINGDOWN(wlxAction))
1118 {
1119 // FIXME: WlxShutdown should be done from inside HandleShutdown,
1120 // after having displayed "ReactOS is shutting down" message.
1121 Session->Gina.Functions.WlxShutdown(Session->Gina.Context, wlxAction);
1122 if (!NT_SUCCESS(HandleShutdown(Session, wlxAction)))
1123 {
1124 RemoveStatusMessage(Session);
1125 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1126 }
1127 }
1128 else
1129 {
1130 RemoveStatusMessage(Session);
1131 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1132 }
1133 break;
1134 case WLX_SAS_ACTION_TASKLIST: /* 0x07 */
1135 SwitchDesktop(Session->ApplicationDesktop);
1136 Session->LogonState = STATE_LOGGED_ON;
1137 StartTaskManager(Session);
1138 break;
1139 case WLX_SAS_ACTION_UNLOCK_WKSTA: /* 0x08 */
1140 SwitchDesktop(Session->ApplicationDesktop);
1141 Session->LogonState = STATE_LOGGED_ON;
1143 break;
1144 default:
1145 WARN("Unknown SAS action 0x%lx\n", wlxAction);
1146 }
1147}
1148
1149static
1150VOID
1152 IN OUT PWLSESSION Session,
1153 IN DWORD dwSasType)
1154{
1155 DWORD wlxAction = WLX_SAS_ACTION_NONE;
1156 PSID LogonSid = NULL; /* FIXME */
1157 BOOL bSecure = TRUE;
1158
1159 switch (dwSasType)
1160 {
1162 switch (Session->LogonState)
1163 {
1164 case STATE_INIT:
1165 Session->LogonState = STATE_LOGGED_OFF;
1166 Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1167 return;
1168
1169 case STATE_LOGGED_OFF:
1170 Session->LogonState = STATE_LOGGED_OFF_SAS;
1171
1173
1174 Session->Options = 0;
1175
1176 wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOutSAS(
1177 Session->Gina.Context,
1178 Session->SASAction,
1179 &Session->LogonId,
1180 LogonSid,
1181 &Session->Options,
1182 &Session->UserToken,
1183 &Session->MprNotifyInfo,
1184 (PVOID*)&Session->Profile);
1185 break;
1186
1188 /* Ignore SAS if we are already in an SAS state */
1189 return;
1190
1191 case STATE_LOGGED_ON:
1192 Session->LogonState = STATE_LOGGED_ON_SAS;
1193 wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOnSAS(Session->Gina.Context, dwSasType, NULL);
1194 break;
1195
1197 /* Ignore SAS if we are already in an SAS state */
1198 return;
1199
1200 case STATE_LOCKED:
1201 Session->LogonState = STATE_LOCKED_SAS;
1202
1204
1205 wlxAction = (DWORD)Session->Gina.Functions.WlxWkstaLockedSAS(Session->Gina.Context, dwSasType);
1206 break;
1207
1208 case STATE_LOCKED_SAS:
1209 /* Ignore SAS if we are already in an SAS state */
1210 return;
1211
1212 default:
1213 return;
1214 }
1215 break;
1216
1218 return;
1219
1221 if (!Session->Gina.Functions.WlxScreenSaverNotify(Session->Gina.Context, &bSecure))
1222 {
1223 /* Skip start of screen saver */
1224 SetEvent(Session->hEndOfScreenSaver);
1225 }
1226 else
1227 {
1228 StartScreenSaver(Session);
1229 if (bSecure)
1230 {
1231 wlxAction = WLX_SAS_ACTION_LOCK_WKSTA;
1232// DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
1233 }
1234 }
1235 break;
1236
1238 SetEvent(Session->hUserActivity);
1239 break;
1240 }
1241
1242 DoGenericAction(Session, wlxAction);
1243}
1244
1245static
1246BOOL
1248 IN PWLSESSION Session,
1249 IN HWND hwndSAS)
1250{
1251 /* Register Ctrl+Alt+Del hotkey */
1253 {
1254 ERR("WL: Unable to register Ctrl+Alt+Del hotkey\n");
1255 return FALSE;
1256 }
1257
1258 /* Register Ctrl+Shift+Esc "Task Manager" hotkey (optional) */
1260 if (!Session->TaskManHotkey)
1261 WARN("WL: Unable to register Ctrl+Shift+Esc hotkey\n");
1262
1263 /* Register Win+L "Lock Workstation" hotkey (optional) */
1264 Session->LockWkStaHotkey = RegisterHotKey(hwndSAS, IDHK_WIN_L, MOD_WIN, 'L');
1265 if (!Session->LockWkStaHotkey)
1266 WARN("WL: Unable to register Win+L hotkey\n");
1267
1268 /* Register Win+U "Accessibility Utility" hotkey (optional) */
1269 Session->UtilManHotkey = RegisterHotKey(hwndSAS, IDHK_WIN_U, MOD_WIN, 'U');
1270 if (!Session->UtilManHotkey)
1271 WARN("WL: Unable to register Win+U hotkey\n");
1272
1273 return TRUE;
1274}
1275
1276static
1277BOOL
1279 IN PWLSESSION Session,
1280 IN HWND hwndSAS)
1281{
1282 /* Unregister the hotkeys */
1284
1285 if (Session->TaskManHotkey)
1287
1288 if (Session->LockWkStaHotkey)
1290
1291 if (Session->UtilManHotkey)
1293
1294 return TRUE;
1295}
1296
1297static
1298BOOL
1300 _In_ PWLSESSION Session,
1301 _In_ UINT uType)
1302{
1303 LPWSTR EventName;
1304
1305 switch (uType)
1306 {
1307 case 0xFFFFFFFF:
1308 EventName = NULL;
1309 break;
1310 case MB_OK:
1311 EventName = L"SystemDefault";
1312 break;
1313 case MB_ICONASTERISK:
1314 EventName = L"SystemAsterisk";
1315 break;
1316 case MB_ICONEXCLAMATION:
1317 EventName = L"SystemExclamation";
1318 break;
1319 case MB_ICONHAND:
1320 EventName = L"SystemHand";
1321 break;
1322 case MB_ICONQUESTION:
1323 EventName = L"SystemQuestion";
1324 break;
1325 default:
1326 WARN("Unhandled type %d\n", uType);
1327 EventName = L"SystemDefault";
1328 }
1329
1330 return PlayEventSound(Session, EventName);
1331}
1332
1333static
1334LRESULT
1337 IN HWND hwndDlg,
1338 IN UINT uMsg,
1341{
1343
1344 switch (uMsg)
1345 {
1346 case WM_HOTKEY:
1347 {
1348 switch (wParam)
1349 {
1350 case IDHK_CTRL_ALT_DEL:
1351 {
1352 TRACE("SAS: CONTROL+ALT+DELETE\n");
1353 if (!Session->Gina.UseCtrlAltDelete)
1354 break;
1356 return TRUE;
1357 }
1359 {
1360 TRACE("SAS: CONTROL+SHIFT+ESCAPE\n");
1361 if (Session->LogonState == STATE_LOGGED_ON)
1363 return TRUE;
1364 }
1365 case IDHK_WIN_L:
1366 {
1367 TRACE("SAS: WIN+L\n");
1369 return TRUE;
1370 }
1371 case IDHK_WIN_U:
1372 {
1373 TRACE("SAS: WIN+U\n");
1374 // PostMessageW(Session->SASWindow, WM_LOGONNOTIFY, LN_ACCESSIBILITY, 0);
1375 return TRUE;
1376 }
1377 }
1378 break;
1379 }
1380 case WM_CREATE:
1381 {
1382 /* Get the session pointer from the create data */
1383 Session = (PWLSESSION)((LPCREATESTRUCT)lParam)->lpCreateParams;
1384
1385 /* Save the Session pointer */
1386 SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)Session);
1387 if (GetSetupType())
1388 return TRUE;
1389 return RegisterHotKeys(Session, hwndDlg);
1390 }
1391 case WM_DESTROY:
1392 {
1393 if (!GetSetupType())
1394 UnregisterHotKeys(Session, hwndDlg);
1395 return TRUE;
1396 }
1397 case WM_SETTINGCHANGE:
1398 {
1399 UINT uiAction = (UINT)wParam;
1400 if (uiAction == SPI_SETSCREENSAVETIMEOUT
1401 || uiAction == SPI_SETSCREENSAVEACTIVE)
1402 {
1404 }
1405 return TRUE;
1406 }
1407 case WM_LOGONNOTIFY:
1408 {
1409 switch(wParam)
1410 {
1411 case LN_MESSAGE_BEEP:
1412 {
1413 return HandleMessageBeep(Session, lParam);
1414 }
1415 case LN_SHELL_EXITED:
1416 {
1417 /* lParam is the exit code */
1418 if (lParam != 1 &&
1419 Session->LogonState != STATE_LOGGED_OFF &&
1420 Session->LogonState != STATE_LOGGED_OFF_SAS)
1421 {
1422 SetTimer(hwndDlg, 1, 1000, NULL);
1423 }
1424 break;
1425 }
1427 {
1429 break;
1430 }
1431#if 0
1432 case LN_ACCESSIBILITY:
1433 {
1434 ERR("LN_ACCESSIBILITY(lParam = %lu)\n", lParam);
1435 break;
1436 }
1437#endif
1439 {
1441 break;
1442 }
1443 case LN_LOGOFF:
1444 {
1445 UINT Flags = (UINT)lParam;
1447 DWORD wlxAction;
1448
1449 TRACE("\tFlags : 0x%lx\n", lParam);
1450
1451 /*
1452 * Our caller (USERSRV) should have added the shutdown flag
1453 * when setting also poweroff or reboot.
1454 */
1455 if (Action & (EWX_POWEROFF | EWX_REBOOT))
1456 {
1457 if ((Action & EWX_SHUTDOWN) == 0)
1458 {
1459 ERR("Missing EWX_SHUTDOWN flag for poweroff or reboot; action 0x%x\n", Action);
1461 }
1462
1463 /* Now we can locally remove it for performing checks */
1464 Action &= ~EWX_SHUTDOWN;
1465 }
1466
1467 /* Check parameters */
1468 if (Action & EWX_FORCE)
1469 {
1470 // FIXME!
1471 ERR("FIXME: EWX_FORCE present for Winlogon, what to do?\n");
1472 Action &= ~EWX_FORCE;
1473 }
1474 switch (Action)
1475 {
1476 case EWX_LOGOFF:
1477 wlxAction = WLX_SAS_ACTION_LOGOFF;
1478 break;
1479 case EWX_SHUTDOWN:
1480 wlxAction = WLX_SAS_ACTION_SHUTDOWN;
1481 break;
1482 case EWX_REBOOT:
1484 break;
1485 case EWX_POWEROFF:
1487 break;
1488
1489 default:
1490 {
1491 ERR("Invalid ExitWindows action 0x%x\n", Action);
1493 }
1494 }
1495
1496 TRACE("In LN_LOGOFF, exit_in_progress == %s\n",
1497 ExitReactOSInProgress ? "true" : "false");
1498
1499 /*
1500 * In case a parallel shutdown request is done (while we are
1501 * being to shut down) and it was not done by Winlogon itself,
1502 * then just stop here.
1503 */
1504#if 0
1505// This code is commented at the moment (even if it's correct) because
1506// our log-offs do not really work: the shell is restarted, no app is killed
1507// etc... and as a result you just get explorer opening "My Documents". And
1508// if you try now a shut down, it won't work because winlogon thinks it is
1509// still in the middle of a shutdown.
1510// Maybe we also need to reset ExitReactOSInProgress somewhere else??
1512 {
1513 break;
1514 }
1515#endif
1516 /* Now do the shutdown action proper */
1517 DoGenericAction(Session, wlxAction);
1518 return 1;
1519 }
1520 case LN_LOGOFF_CANCELED:
1521 {
1522 ERR("Logoff canceled!!, before: exit_in_progress == %s, after will be false\n",
1523 ExitReactOSInProgress ? "true" : "false");
1524
1526 return 1;
1527 }
1528 default:
1529 {
1530 ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
1531 }
1532 }
1533 return 0;
1534 }
1535 case WM_TIMER:
1536 {
1537 if (wParam == 1)
1538 {
1539 KillTimer(hwndDlg, 1);
1540 StartUserShell(Session);
1541 }
1542 break;
1543 }
1544 case WLX_WM_SAS:
1545 {
1546 DispatchSAS(Session, (DWORD)wParam);
1547 return TRUE;
1548 }
1549 }
1550
1551 return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
1552}
1553
1554BOOL
1556 IN OUT PWLSESSION Session)
1557{
1558 WNDCLASSEXW swc;
1559 BOOL ret = FALSE;
1560
1561 if (!SwitchDesktop(Session->WinlogonDesktop))
1562 {
1563 ERR("WL: Failed to switch to winlogon desktop\n");
1564 goto cleanup;
1565 }
1566
1567 /* Register SAS window class */
1568 swc.cbSize = sizeof(WNDCLASSEXW);
1569 swc.style = CS_SAVEBITS;
1571 swc.cbClsExtra = 0;
1572 swc.cbWndExtra = 0;
1573 swc.hInstance = hAppInstance;
1574 swc.hIcon = NULL;
1575 swc.hCursor = NULL;
1576 swc.hbrBackground = NULL;
1577 swc.lpszMenuName = NULL;
1579 swc.hIconSm = NULL;
1580 if (RegisterClassExW(&swc) == 0)
1581 {
1582 ERR("WL: Failed to register SAS window class\n");
1583 goto cleanup;
1584 }
1585
1586 /* Create invisible SAS window */
1587 Session->SASWindow = CreateWindowExW(
1588 0,
1591 WS_POPUP,
1592 0, 0, 0, 0, 0, 0,
1593 hAppInstance, Session);
1594 if (!Session->SASWindow)
1595 {
1596 ERR("WL: Failed to create SAS window\n");
1597 goto cleanup;
1598 }
1599
1600 /* Register SAS window to receive SAS notifications */
1601 if (!SetLogonNotifyWindow(Session->SASWindow))
1602 {
1603 ERR("WL: Failed to register SAS window\n");
1604 goto cleanup;
1605 }
1606
1608 return FALSE;
1609
1610 ret = TRUE;
1611
1612cleanup:
1613 if (!ret)
1614 UninitializeSAS(Session);
1615 return ret;
1616}
DWORD WINAPI UpdatePerUserSystemParameters(DWORD dw1, DWORD dw2)
unsigned char BOOLEAN
@ TRUSTEE_IS_SID
Definition: accctrl.h:189
@ TRUSTEE_IS_WELL_KNOWN_GROUP
Definition: accctrl.h:181
#define NO_INHERITANCE
Definition: accctrl.h:103
@ SET_ACCESS
Definition: accctrl.h:150
#define VOID
Definition: acefi.h:82
#define SetEntriesInAcl
Definition: aclapi.h:240
LONG NTSTATUS
Definition: precomp.h:26
HINSTANCE hAppInstance
Definition: mmc.c:23
void quit(int argc, const char *argv[])
Definition: cmds.c:1606
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL CreateUserEnvironment(IN PWLSESSION Session)
Definition: environment.c:128
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:390
#define IDS_APPLYINGYOURPERSONALSETTINGS
Definition: resource.h:26
#define IDC_BTNSHTDOWNCOMPUTER
Definition: resource.h:10
#define IDS_REACTOSISSHUTTINGDOWN
Definition: resource.h:31
#define IDD_SHUTDOWNCOMPUTER
Definition: resource.h:7
#define IDS_REACTOSISRESTARTING
Definition: resource.h:38
#define IDS_SAVEYOURSETTINGS
Definition: resource.h:34
#define IDS_LOADINGYOURPERSONALSETTINGS
Definition: resource.h:29
BOOL InitializeScreenSaver(IN OUT PWLSESSION Session)
Definition: screensaver.c:205
VOID StartScreenSaver(IN PWLSESSION Session)
Definition: screensaver.c:258
BOOL AllowAccessOnSession(_In_ PWLSESSION Session)
Assigns both window station and desktop access to the specific session currently active on the system...
Definition: security.c:1391
DWORD GetSetupType(VOID)
Definition: setup.c:16
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HMODULE hLibrary
Definition: odbccp32.c:12
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI Beep(IN DWORD dwFreq, IN DWORD dwDuration)
Definition: deviceio.c:48
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3209
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
Definition: security.c:674
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:929
UINT uFlags
Definition: api.c:59
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define GENERIC_READ
Definition: compat.h:135
struct _SECURITY_ATTRIBUTES * PSECURITY_ATTRIBUTES
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define LoadLibraryW(x)
Definition: compat.h:747
static void cleanup(void)
Definition: main.c:1335
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
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
BOOL WINAPI RevertToSelf(void)
Definition: security.c:855
static SID_IDENTIFIER_AUTHORITY WorldAuthority
Definition: security.c:14
BOOL WINAPI DestroyEnvironmentBlock(IN LPVOID lpEnvironment)
Definition: environment.c:725
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:503
BOOL WINAPI LoadUserProfileW(_In_ HANDLE hToken, _Inout_ LPPROFILEINFOW lpProfileInfo)
Definition: profile.c:2005
BOOL WINAPI UnloadUserProfile(_In_ HANDLE hToken, _In_ HANDLE hProfile)
Definition: profile.c:2184
static const WCHAR Cleanup[]
Definition: register.c:80
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:25
#define MOD_ALT
Definition: imm.h:184
#define MOD_SHIFT
Definition: imm.h:186
#define MOD_CONTROL
Definition: imm.h:185
#define THREAD_SET_THREAD_TOKEN
Definition: pstypes.h:151
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define REG_SZ
Definition: layer.c:22
#define SND_ALIAS
Definition: mmsystem.h:160
#define SND_ASYNC
Definition: mmsystem.h:154
#define SND_NODEFAULT
Definition: mmsystem.h:155
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE
Definition: security.c:657
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
struct _SECURITY_DESCRIPTOR * PSECURITY_DESCRIPTOR
Definition: security.c:98
struct _ACL * PACL
Definition: security.c:105
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
@ ShutdownReboot
Definition: extypes.h:177
@ ShutdownNoReboot
Definition: extypes.h:176
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
HANDLE hThread
Definition: wizard.c:28
#define _Inout_
Definition: no_sal2.h:162
#define _In_
Definition: no_sal2.h:158
#define BOOL
Definition: nt_native.h:43
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
#define DWORD
Definition: nt_native.h:44
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:437
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
Definition: shutdown.c:43
HWND hwndSAS
Definition: winsta.c:24
#define L(x)
Definition: ntvdm.h:50
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
BYTE * PBYTE
Definition: pedump.c:66
#define WS_POPUP
Definition: pedump.c:616
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_LEAVE
Definition: pseh2_64.h:183
#define DefWindowProc
Definition: ros2win.h:31
static NTSTATUS CreateLogoffSecurityAttributes(OUT PSECURITY_ATTRIBUTES *ppsa)
Definition: sas.c:696
#define WINLOGON_SAS_TITLE
Definition: sas.c:27
static BOOL StartUserShell(IN OUT PWLSESSION Session)
Definition: sas.c:88
static BOOL RegisterHotKeys(IN PWLSESSION Session, IN HWND hwndSAS)
Definition: sas.c:1247
struct tagLOGOFF_SHUTDOWN_DATA LOGOFF_SHUTDOWN_DATA
static DWORD WINAPI PlayLogonSoundThread(_In_ LPVOID lpParameter)
Definition: sas.c:299
static DWORD WINAPI KillComProcesses(LPVOID Parameter)
Definition: sas.c:666
#define WINLOGON_SAS_CLASS
Definition: sas.c:26
#define IDHK_CTRL_ALT_DEL
Definition: sas.c:29
struct tagLOGON_SOUND_DATA LOGON_SOUND_DATA
static LRESULT CALLBACK SASWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: sas.c:1336
#define IDHK_WIN_L
Definition: sas.c:31
static INT_PTR CALLBACK ShutdownComputerWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: sas.c:926
BOOL SetDefaultLanguage(IN PWLSESSION Session)
Definition: sas.c:119
static VOID DispatchSAS(IN OUT PWLSESSION Session, IN DWORD dwSasType)
Definition: sas.c:1151
LUID LuidNone
Definition: sas.c:49
NTSTATUS HandleShutdown(IN OUT PWLSESSION Session, IN DWORD wlxAction)
Definition: sas.c:972
static VOID UninitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:958
static VOID PlayLogoffShutdownSound(_In_ PWLSESSION Session, _In_ BOOL bShutdown)
Definition: sas.c:397
static VOID DoGenericAction(IN OUT PWLSESSION Session, IN DWORD wlxAction)
Definition: sas.c:1060
static VOID PlayLogonSound(_In_ PWLSESSION Session)
Definition: sas.c:373
static BOOL StartTaskManager(IN OUT PWLSESSION Session)
Definition: sas.c:60
static BOOL HandleMessageBeep(_In_ PWLSESSION Session, _In_ UINT uType)
Definition: sas.c:1299
#define EWX_ACTION_MASK
Definition: sas.c:39
static BOOL PlayEventSound(_In_ PWLSESSION Session, _In_ LPCWSTR EventName)
Definition: sas.c:414
static BOOL HandleLogon(IN OUT PWLSESSION Session)
Definition: sas.c:496
struct tagLOGOFF_SHUTDOWN_DATA * PLOGOFF_SHUTDOWN_DATA
struct tagLOGON_SOUND_DATA * PLOGON_SOUND_DATA
static VOID DestroyLogoffSecurityAttributes(IN PSECURITY_ATTRIBUTES psa)
Definition: sas.c:810
BOOL InitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:1555
static VOID RestoreAllConnections(PWLSESSION Session)
Definition: sas.c:432
static DWORD WINAPI LogoffShutdownThread(LPVOID Parameter)
Definition: sas.c:621
BOOL PlaySoundRoutine(IN LPCWSTR FileName, IN UINT bLogon, IN UINT Flags)
Definition: sas.c:248
#define IDHK_CTRL_SHIFT_ESC
Definition: sas.c:30
static BOOL UnregisterHotKeys(IN PWLSESSION Session, IN HWND hwndSAS)
Definition: sas.c:1278
#define IDHK_WIN_U
Definition: sas.c:32
static BOOL ExitReactOSInProgress
Definition: sas.c:47
static NTSTATUS HandleLogoff(_Inout_ PWLSESSION Session, _In_ DWORD wlxAction)
Definition: sas.c:822
SC_HANDLE hSCManager
Definition: sc.c:12
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2926
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2199
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
DWORD LCID
Definition: nls.h:13
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE(s)
Definition: solgame.cpp:4
DWORD grfAccessPermissions
Definition: accctrl.h:332
TRUSTEE_A Trustee
Definition: accctrl.h:335
DWORD grfInheritance
Definition: accctrl.h:334
ACCESS_MODE grfAccessMode
Definition: accctrl.h:333
BOOL UseCtrlAltDelete
Definition: winlogon.h:132
LPSTR lpLocalName
Definition: winnetwk.h:171
LPSTR lpRemoteName
Definition: winnetwk.h:172
LPWSTR lpPolicyPath
Definition: userenv.h:42
LPWSTR lpServerName
Definition: userenv.h:41
LPWSTR lpProfilePath
Definition: userenv.h:39
DWORD dwFlags
Definition: userenv.h:37
DWORD dwSize
Definition: userenv.h:36
HANDLE hProfile
Definition: userenv.h:43
LPWSTR lpUserName
Definition: userenv.h:38
LPWSTR lpDefaultPath
Definition: userenv.h:40
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:207
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:206
LPSTR ptstrName
Definition: accctrl.h:208
USHORT MaximumLength
Definition: env_spec_w32.h:370
HANDLE hScreenSaverParametersChanged
Definition: winlogon.h:247
HANDLE UserToken
Definition: winlogon.h:235
LOGON_STATE LogonState
Definition: winlogon.h:237
HWND SASWindow
Definition: winlogon.h:228
GINAINSTANCE Gina
Definition: winlogon.h:222
LPCWSTR lpszClassName
Definition: winuser.h:3302
LPCWSTR lpszMenuName
Definition: winuser.h:3301
HBRUSH hbrBackground
Definition: winuser.h:3300
WNDPROC lpfnWndProc
Definition: winuser.h:3294
UINT cbSize
Definition: winuser.h:3292
int cbWndExtra
Definition: winuser.h:3296
HCURSOR hCursor
Definition: winuser.h:3299
HICON hIconSm
Definition: winuser.h:3303
HINSTANCE hInstance
Definition: winuser.h:3297
UINT style
Definition: winuser.h:3293
int cbClsExtra
Definition: winuser.h:3295
HICON hIcon
Definition: winuser.h:3298
PWLSESSION Session
Definition: sas.c:44
BOOL IsStartup
Definition: sas.c:54
HANDLE UserToken
Definition: sas.c:53
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
volatile BOOL bShutdown
Definition: tcpsvcs.c:16
#define GetWindowLongPtr
Definition: treelist.c:73
#define GWLP_USERDATA
Definition: treelist.c:63
int32_t INT_PTR
Definition: typedefs.h:64
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * LPBYTE
Definition: typedefs.h:53
#define IN
Definition: typedefs.h:39
HANDLE HMODULE
Definition: typedefs.h:77
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define LN_SHELL_EXITED
Definition: undocuser.h:117
#define EWX_NONOTIFY
Definition: undocuser.h:136
#define LN_LOCK_WORKSTATION
Definition: undocuser.h:119
BOOL WINAPI SetLogonNotifyWindow(HWND Wnd)
Definition: logon.c:91
#define WM_LOGONNOTIFY
Definition: undocuser.h:39
#define EWX_CALLER_WINLOGON
Definition: undocuser.h:130
#define LN_START_SCREENSAVE
Definition: undocuser.h:122
#define LN_MESSAGE_BEEP
Definition: undocuser.h:121
#define LN_LOGOFF
Definition: undocuser.h:116
#define LN_LOGOFF_CANCELED
Definition: undocuser.h:123
struct _PROFILEINFOW PROFILEINFOW
int ret
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define ZeroMemory
Definition: winbase.h:1753
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
BOOL DisplayStatusMessage(IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
Definition: winlogon.c:349
BOOL RemoveStatusMessage(IN PWLSESSION Session)
Definition: winlogon.c:370
FORCEINLINE BOOL IsFirstLogon(_In_ PWLSESSION Session)
Definition: winlogon.h:302
BOOL WINAPI SetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
Definition: winsta.c:419
#define WLX_SHUTTINGDOWN(Status)
Definition: winlogon.h:280
struct _WLSESSION * PWLSESSION
FORCEINLINE VOID SetLogonTimestamp(_Inout_ PWLSESSION Session)
Definition: winlogon.h:294
@ STATE_LOGGED_ON
Definition: winlogon.h:207
@ STATE_LOGGED_OFF_SAS
Definition: winlogon.h:206
@ STATE_LOCKED_SAS
Definition: winlogon.h:210
@ STATE_INIT
Definition: winlogon.h:204
@ STATE_LOGGED_OFF
Definition: winlogon.h:205
@ STATE_LOGGED_ON_SAS
Definition: winlogon.h:208
@ STATE_LOCKED
Definition: winlogon.h:209
VOID CloseAllDialogWindows(VOID)
Definition: wlx.c:95
@ LogonHandler
Definition: winlogon.h:262
@ LogoffHandler
Definition: winlogon.h:263
@ StartShellHandler
Definition: winlogon.h:272
@ UnlockHandler
Definition: winlogon.h:265
@ LockHandler
Definition: winlogon.h:264
@ ShutdownHandler
Definition: winlogon.h:267
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2137
#define RESOURCETYPE_DISK
Definition: winnetwk.h:64
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define WN_SUCCESS
Definition: winnetwk.h:111
#define RESOURCE_REMEMBERED
Definition: winnetwk.h:60
#define WNetEnumResource
Definition: winnetwk.h:599
#define WNetOpenEnum
Definition: winnetwk.h:598
#define WNetAddConnection
Definition: winnetwk.h:611
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define OpenSCManager
Definition: winsvc.h:575
@ SC_STATUS_PROCESS_INFO
Definition: winsvc.h:119
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define EWX_POWEROFF
Definition: winuser.h:645
#define EWX_SHUTDOWN
Definition: winuser.h:647
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI SwitchDesktop(_In_ HDESK)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MOD_WIN
Definition: winuser.h:2663
#define MB_ICONHAND
Definition: winuser.h:799
#define WM_CREATE
Definition: winuser.h:1627
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1759
#define SPI_SETSCREENSAVEACTIVE
Definition: winuser.h:1377
#define EWX_LOGOFF
Definition: winuser.h:644
#define WM_INITDIALOG
Definition: winuser.h:1758
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define WM_SETTINGCHANGE
Definition: winuser.h:1648
#define EWX_REBOOT
Definition: winuser.h:646
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_TIMER
Definition: winuser.h:1761
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
#define EWX_FORCE
Definition: winuser.h:643
#define SC_CLOSE
Definition: winuser.h:2611
#define MB_ICONEXCLAMATION
Definition: winuser.h:796
#define MB_OK
Definition: winuser.h:801
#define MB_ICONQUESTION
Definition: winuser.h:800
#define CS_SAVEBITS
Definition: winuser.h:665
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define WM_HOTKEY
Definition: winuser.h:1898
struct _WNDCLASSEXW WNDCLASSEXW
#define VK_DELETE
Definition: winuser.h:2252
#define WM_DESTROY
Definition: winuser.h:1628
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define MB_ICONASTERISK
Definition: winuser.h:795
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrW
Definition: winuser.h:5431
#define VK_ESCAPE
Definition: winuser.h:2233
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SPI_SETSCREENSAVETIMEOUT
Definition: winuser.h:1375
#define DialogBox
Definition: winuser.h:5846
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define WLX_SAS_TYPE_TIMEOUT
Definition: winwlx.h:35
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define WLX_PROFILE_TYPE_V1_0
Definition: winwlx.h:50
#define WLX_SAS_ACTION_FORCE_LOGOFF
Definition: winwlx.h:61
#define WLX_SAS_ACTION_UNLOCK_WKSTA
Definition: winwlx.h:60
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
#define WLX_PROFILE_TYPE_V2_0
Definition: winwlx.h:51
#define WLX_WM_SAS
Definition: winwlx.h:71
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
#define WLX_SAS_ACTION_TASKLIST
Definition: winwlx.h:59
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
#define WLX_SAS_TYPE_SCRNSVR_TIMEOUT
Definition: winwlx.h:37
#define WLX_SAS_ACTION_SHUTDOWN
Definition: winwlx.h:57
#define WLX_SAS_TYPE_SCRNSVR_ACTIVITY
Definition: winwlx.h:38
#define WLX_LOGON_OPT_NO_PROFILE
Definition: winwlx.h:48
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56
DWORD WINAPI WNetClearConnections(HWND owner)
Definition: wnet.c:2827
DWORD WINAPI WNetCloseEnum(HANDLE hEnum)
Definition: wnet.c:1762
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:191
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2415
_Inout_opt_ PVOID Parameter
Definition: rtltypes.h:336
#define SECURITY_WORLD_SID_AUTHORITY
Definition: setypes.h:527
#define SECURITY_WORLD_RID
Definition: setypes.h:541
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define SECURITY_DESCRIPTOR_MIN_LENGTH
Definition: setypes.h:827
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193