ReactOS  0.4.15-dev-5112-g22d8c0f
sas.c File Reference
#include "winlogon.h"
#include <aclapi.h>
#include <mmsystem.h>
#include <userenv.h>
#include <ndk/setypes.h>
#include <ndk/sefuncs.h>
Include dependency graph for sas.c:

Go to the source code of this file.

Classes

struct  tagLOGOFF_SHUTDOWN_DATA
 

Macros

#define WIN32_LEAN_AND_MEAN
 
#define WINLOGON_SAS_CLASS   L"SAS Window class"
 
#define WINLOGON_SAS_TITLE   L"SAS window"
 
#define HK_CTRL_ALT_DEL   0
 
#define HK_CTRL_SHIFT_ESC   1
 
#define EWX_ACTION_MASK   0x5C0F
 

Typedefs

typedef struct tagLOGOFF_SHUTDOWN_DATA LOGOFF_SHUTDOWN_DATA
 
typedef struct tagLOGOFF_SHUTDOWN_DATAPLOGOFF_SHUTDOWN_DATA
 

Functions

static BOOL StartTaskManager (IN OUT PWLSESSION Session)
 
static BOOL StartUserShell (IN OUT PWLSESSION Session)
 
BOOL SetDefaultLanguage (IN PWLSESSION Session)
 
BOOL PlaySoundRoutine (IN LPCWSTR FileName, IN UINT bLogon, IN UINT Flags)
 
DWORD WINAPI PlayLogonSoundThread (IN LPVOID lpParameter)
 
static VOID PlayLogonSound (IN OUT PWLSESSION Session)
 
static VOID RestoreAllConnections (PWLSESSION Session)
 
static BOOL HandleLogon (IN OUT PWLSESSION Session)
 
static DWORD WINAPI LogoffShutdownThread (LPVOID Parameter)
 
static DWORD WINAPI KillComProcesses (LPVOID Parameter)
 
static NTSTATUS CreateLogoffSecurityAttributes (OUT PSECURITY_ATTRIBUTES *ppsa)
 
static VOID DestroyLogoffSecurityAttributes (IN PSECURITY_ATTRIBUTES psa)
 
static NTSTATUS HandleLogoff (IN OUT PWLSESSION Session, IN UINT Flags)
 
static INT_PTR CALLBACK ShutdownComputerWindowProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
static VOID UninitializeSAS (IN OUT PWLSESSION Session)
 
NTSTATUS HandleShutdown (IN OUT PWLSESSION Session, IN DWORD wlxAction)
 
static VOID DoGenericAction (IN OUT PWLSESSION Session, IN DWORD wlxAction)
 
static VOID DispatchSAS (IN OUT PWLSESSION Session, IN DWORD dwSasType)
 
static BOOL RegisterHotKeys (IN PWLSESSION Session, IN HWND hwndSAS)
 
static BOOL UnregisterHotKeys (IN PWLSESSION Session, IN HWND hwndSAS)
 
BOOL WINAPI HandleMessageBeep (UINT uType)
 
static LRESULT CALLBACK SASWindowProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
BOOL InitializeSAS (IN OUT PWLSESSION Session)
 

Variables

static BOOL ExitReactOSInProgress = FALSE
 
LUID LuidNone = {0, 0}
 

Macro Definition Documentation

◆ EWX_ACTION_MASK

#define EWX_ACTION_MASK   0x5C0F

Definition at line 37 of file sas.c.

◆ HK_CTRL_ALT_DEL

#define HK_CTRL_ALT_DEL   0

Definition at line 29 of file sas.c.

◆ HK_CTRL_SHIFT_ESC

#define HK_CTRL_SHIFT_ESC   1

Definition at line 30 of file sas.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 17 of file sas.c.

◆ WINLOGON_SAS_CLASS

#define WINLOGON_SAS_CLASS   L"SAS Window class"

Definition at line 26 of file sas.c.

◆ WINLOGON_SAS_TITLE

#define WINLOGON_SAS_TITLE   L"SAS window"

Definition at line 27 of file sas.c.

Typedef Documentation

◆ LOGOFF_SHUTDOWN_DATA

◆ PLOGOFF_SHUTDOWN_DATA

Function Documentation

◆ CreateLogoffSecurityAttributes()

static NTSTATUS CreateLogoffSecurityAttributes ( OUT PSECURITY_ATTRIBUTES ppsa)
static

Definition at line 694 of file sas.c.

696 {
697  /* The following code is not working yet and messy */
698  /* Still, it gives some ideas about data types and functions involved and */
699  /* required to set up a SECURITY_DESCRIPTOR for a SECURITY_ATTRIBUTES */
700  /* instance for a thread, to allow that thread to ImpersonateLoggedOnUser(). */
701  /* Specifically THREAD_SET_THREAD_TOKEN is required. */
704  BYTE* pMem;
705  PACL pACL;
706  EXPLICIT_ACCESS Access;
707  PSID pEveryoneSID = NULL;
709 
710  *ppsa = NULL;
711 
712  // Let's first try to enumerate what kind of data we need for this to ever work:
713  // 1. The Winlogon SID, to be able to give it THREAD_SET_THREAD_TOKEN.
714  // 2. The users SID (the user trying to logoff, or rather shut down the system).
715  // 3. At least two EXPLICIT_ACCESS instances:
716  // 3.1 One for Winlogon itself, giving it the rights
717  // required to THREAD_SET_THREAD_TOKEN (as it's needed to successfully call
718  // ImpersonateLoggedOnUser).
719  // 3.2 One for the user, to allow *that* thread to perform its work.
720  // 4. An ACL to hold the these EXPLICIT_ACCESS ACE's.
721  // 5. A SECURITY_DESCRIPTOR to hold the ACL, and finally.
722  // 6. A SECURITY_ATTRIBUTES instance to pull all of this required stuff
723  // together, to hand it to CreateThread.
724  //
725  // However, it seems struct LOGOFF_SHUTDOWN_DATA doesn't contain
726  // these required SID's, why they'd have to be added.
727  // The Winlogon's own SID should probably only be created once,
728  // while the user's SID obviously must be created for each new user.
729  // Might as well store it when the user logs on?
730 
732  1,
734  0, 0, 0, 0, 0, 0, 0,
735  &pEveryoneSID))
736  {
737  ERR("Failed to initialize security descriptor for logoff thread!\n");
738  return STATUS_UNSUCCESSFUL;
739  }
740 
741  /* set up the required security attributes to be able to shut down */
742  /* To save space and time, allocate a single block of memory holding */
743  /* both SECURITY_ATTRIBUTES and SECURITY_DESCRIPTOR */
744  pMem = HeapAlloc(GetProcessHeap(),
745  0,
746  sizeof(SECURITY_ATTRIBUTES) +
748  sizeof(ACL));
749  if (!pMem)
750  {
751  ERR("Failed to allocate memory for logoff security descriptor!\n");
752  return STATUS_NO_MEMORY;
753  }
754 
755  /* Note that the security descriptor needs to be in _absolute_ format, */
756  /* meaning its members must be pointers to other structures, rather */
757  /* than the relative format using offsets */
758  psa = (PSECURITY_ATTRIBUTES)pMem;
761 
762  // Initialize an EXPLICIT_ACCESS structure for an ACE.
763  // The ACE will allow this thread to log off (and shut down the system, currently).
764  ZeroMemory(&Access, sizeof(Access));
766  Access.grfAccessMode = SET_ACCESS; // GRANT_ACCESS?
770  Access.Trustee.ptstrName = pEveryoneSID;
771 
772  if (SetEntriesInAcl(1, &Access, NULL, &pACL) != ERROR_SUCCESS)
773  {
774  ERR("Failed to set Access Rights for logoff thread. Logging out will most likely fail.\n");
775 
776  HeapFree(GetProcessHeap(), 0, pMem);
777  return STATUS_UNSUCCESSFUL;
778  }
779 
781  {
782  ERR("Failed to initialize security descriptor for logoff thread!\n");
783  HeapFree(GetProcessHeap(), 0, pMem);
784  return STATUS_UNSUCCESSFUL;
785  }
786 
788  TRUE, // bDaclPresent flag
789  pACL,
790  FALSE)) // not a default DACL
791  {
792  ERR("SetSecurityDescriptorDacl Error %lu\n", GetLastError());
793  HeapFree(GetProcessHeap(), 0, pMem);
794  return STATUS_UNSUCCESSFUL;
795  }
796 
797  psa->nLength = sizeof(SECURITY_ATTRIBUTES);
798  psa->lpSecurityDescriptor = SecurityDescriptor;
799  psa->bInheritHandle = FALSE;
800 
801  *ppsa = psa;
802 
803  return STATUS_SUCCESS;
804 }
struct _SECURITY_DESCRIPTOR * PSECURITY_DESCRIPTOR
Definition: security.c:97
TRUSTEE_TYPE TrusteeType
Definition: accctrl.h:207
#define NO_INHERITANCE
Definition: accctrl.h:103
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
ACCESS_MODE grfAccessMode
Definition: accctrl.h:333
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SECURITY_DESCRIPTOR_MIN_LENGTH
Definition: setypes.h:811
#define TRUE
Definition: types.h:120
_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:182
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:931
static SID_IDENTIFIER_AUTHORITY WorldAuthority
Definition: security.c:14
TRUSTEE_A Trustee
Definition: accctrl.h:335
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
#define THREAD_SET_THREAD_TOKEN
Definition: pstypes.h:150
LPSTR ptstrName
Definition: accctrl.h:208
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define FALSE
Definition: types.h:117
struct _ACL * PACL
Definition: security.c:104
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SECURITY_WORLD_SID_AUTHORITY
Definition: setypes.h:527
#define SECURITY_WORLD_RID
Definition: setypes.h:541
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
DWORD grfInheritance
Definition: accctrl.h:334
unsigned char BYTE
Definition: xxhash.c:193
#define ERR(fmt,...)
Definition: debug.h:110
#define SetEntriesInAcl
Definition: aclapi.h:240
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
DWORD grfAccessPermissions
Definition: accctrl.h:332
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
struct _SECURITY_ATTRIBUTES * PSECURITY_ATTRIBUTES
#define STATUS_SUCCESS
Definition: shellext.h:65
TRUSTEE_FORM TrusteeForm
Definition: accctrl.h:206
BYTE * PBYTE
Definition: pedump.c:66
#define HeapFree(x, y, z)
Definition: compat.h:594
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
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:676

Referenced by HandleLogoff().

◆ DestroyLogoffSecurityAttributes()

static VOID DestroyLogoffSecurityAttributes ( IN PSECURITY_ATTRIBUTES  psa)
static

Definition at line 808 of file sas.c.

810 {
811  if (psa)
812  {
813  HeapFree(GetProcessHeap(), 0, psa);
814  }
815 }
#define GetProcessHeap()
Definition: compat.h:595
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by HandleLogoff().

◆ DispatchSAS()

static VOID DispatchSAS ( IN OUT PWLSESSION  Session,
IN DWORD  dwSasType 
)
static

Definition at line 1142 of file sas.c.

1145 {
1146  DWORD wlxAction = WLX_SAS_ACTION_NONE;
1147  PSID LogonSid = NULL; /* FIXME */
1148  BOOL bSecure = TRUE;
1149 
1150  switch (dwSasType)
1151  {
1153  switch (Session->LogonState)
1154  {
1155  case STATE_INIT:
1156  Session->LogonState = STATE_LOGGED_OFF;
1157  Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1158  return;
1159 
1160  case STATE_LOGGED_OFF:
1161  Session->LogonState = STATE_LOGGED_OFF_SAS;
1162 
1164 
1165  Session->Options = 0;
1166 
1167  wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOutSAS(
1168  Session->Gina.Context,
1169  Session->SASAction,
1170  &Session->LogonId,
1171  LogonSid,
1172  &Session->Options,
1173  &Session->UserToken,
1174  &Session->MprNotifyInfo,
1175  (PVOID*)&Session->Profile);
1176  break;
1177 
1178  case STATE_LOGGED_OFF_SAS:
1179  /* Ignore SAS if we are already in an SAS state */
1180  return;
1181 
1182  case STATE_LOGGED_ON:
1183  Session->LogonState = STATE_LOGGED_ON_SAS;
1184  wlxAction = (DWORD)Session->Gina.Functions.WlxLoggedOnSAS(Session->Gina.Context, dwSasType, NULL);
1185  break;
1186 
1187  case STATE_LOGGED_ON_SAS:
1188  /* Ignore SAS if we are already in an SAS state */
1189  return;
1190 
1191  case STATE_LOCKED:
1192  Session->LogonState = STATE_LOCKED_SAS;
1193 
1195 
1196  wlxAction = (DWORD)Session->Gina.Functions.WlxWkstaLockedSAS(Session->Gina.Context, dwSasType);
1197  break;
1198 
1199  case STATE_LOCKED_SAS:
1200  /* Ignore SAS if we are already in an SAS state */
1201  return;
1202 
1203  default:
1204  return;
1205  }
1206  break;
1207 
1208  case WLX_SAS_TYPE_TIMEOUT:
1209  return;
1210 
1212  if (!Session->Gina.Functions.WlxScreenSaverNotify(Session->Gina.Context, &bSecure))
1213  {
1214  /* Skip start of screen saver */
1215  SetEvent(Session->hEndOfScreenSaver);
1216  }
1217  else
1218  {
1219  StartScreenSaver(Session);
1220  if (bSecure)
1221  {
1222  wlxAction = WLX_SAS_ACTION_LOCK_WKSTA;
1223 // DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA);
1224  }
1225  }
1226  break;
1227 
1229  SetEvent(Session->hUserActivity);
1230  break;
1231  }
1232 
1233  DoGenericAction(Session, wlxAction);
1234 }
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
#define WLX_SAS_TYPE_SCRNSVR_ACTIVITY
Definition: winwlx.h:38
#define TRUE
Definition: types.h:120
VOID StartScreenSaver(IN PWLSESSION Session)
Definition: screensaver.c:257
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define WLX_SAS_TYPE_TIMEOUT
Definition: winwlx.h:35
static VOID DoGenericAction(IN OUT PWLSESSION Session, IN DWORD wlxAction)
Definition: sas.c:1052
#define DWORD
Definition: nt_native.h:44
#define WLX_SAS_TYPE_SCRNSVR_TIMEOUT
Definition: winwlx.h:37
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
VOID CloseAllDialogWindows(VOID)
Definition: wlx.c:95
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define NULL
Definition: types.h:112

Referenced by SASWindowProc().

◆ DoGenericAction()

static VOID DoGenericAction ( IN OUT PWLSESSION  Session,
IN DWORD  wlxAction 
)
static

Definition at line 1052 of file sas.c.

1055 {
1056  switch (wlxAction)
1057  {
1058  case WLX_SAS_ACTION_LOGON: /* 0x01 */
1059  if (Session->LogonState == STATE_LOGGED_OFF_SAS)
1060  {
1061  if (!HandleLogon(Session))
1062  {
1063  Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1065  }
1066  }
1067  break;
1068  case WLX_SAS_ACTION_NONE: /* 0x02 */
1069  if (Session->LogonState == STATE_LOGGED_OFF_SAS)
1070  {
1071  Session->LogonState = STATE_LOGGED_OFF;
1072  Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1073  }
1074  else if (Session->LogonState == STATE_LOGGED_ON_SAS)
1075  {
1076  Session->LogonState = STATE_LOGGED_ON;
1077  }
1078  else if (Session->LogonState == STATE_LOCKED_SAS)
1079  {
1080  Session->LogonState = STATE_LOCKED;
1081  Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
1082  }
1083  break;
1084  case WLX_SAS_ACTION_LOCK_WKSTA: /* 0x03 */
1085  if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context))
1086  {
1087  SwitchDesktop(Session->WinlogonDesktop);
1088  Session->LogonState = STATE_LOCKED;
1089  Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
1091  }
1092  break;
1093  case WLX_SAS_ACTION_LOGOFF: /* 0x04 */
1094  case WLX_SAS_ACTION_SHUTDOWN: /* 0x05 */
1095  case WLX_SAS_ACTION_SHUTDOWN_POWER_OFF: /* 0x0a */
1096  case WLX_SAS_ACTION_SHUTDOWN_REBOOT: /* 0x0b */
1097  if (Session->LogonState != STATE_LOGGED_OFF)
1098  {
1099  if (!Session->Gina.Functions.WlxIsLogoffOk(Session->Gina.Context))
1100  break;
1101  if (!NT_SUCCESS(HandleLogoff(Session, EWX_LOGOFF)))
1102  {
1103  RemoveStatusMessage(Session);
1104  break;
1105  }
1106  Session->Gina.Functions.WlxLogoff(Session->Gina.Context);
1107  }
1108  if (WLX_SHUTTINGDOWN(wlxAction))
1109  {
1110  // FIXME: WlxShutdown should be done from inside HandleShutdown,
1111  // after having displayed "ReactOS is shutting down" message.
1112  Session->Gina.Functions.WlxShutdown(Session->Gina.Context, wlxAction);
1113  if (!NT_SUCCESS(HandleShutdown(Session, wlxAction)))
1114  {
1115  RemoveStatusMessage(Session);
1116  Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1117  }
1118  }
1119  else
1120  {
1121  RemoveStatusMessage(Session);
1122  Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
1123  }
1124  break;
1125  case WLX_SAS_ACTION_TASKLIST: /* 0x07 */
1126  SwitchDesktop(Session->ApplicationDesktop);
1127  Session->LogonState = STATE_LOGGED_ON;
1128  StartTaskManager(Session);
1129  break;
1130  case WLX_SAS_ACTION_UNLOCK_WKSTA: /* 0x08 */
1131  SwitchDesktop(Session->ApplicationDesktop);
1132  Session->LogonState = STATE_LOGGED_ON;
1134  break;
1135  default:
1136  WARN("Unknown SAS action 0x%lx\n", wlxAction);
1137  }
1138 }
#define WLX_SAS_ACTION_SHUTDOWN
Definition: winwlx.h:57
BOOL RemoveStatusMessage(IN PWLSESSION Session)
Definition: winlogon.c:370
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
#define WARN(fmt,...)
Definition: debug.h:112
static BOOL StartTaskManager(IN OUT PWLSESSION Session)
Definition: sas.c:52
NTSTATUS HandleShutdown(IN OUT PWLSESSION Session, IN DWORD wlxAction)
Definition: sas.c:964
#define EWX_LOGOFF
Definition: winuser.h:631
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56
#define WLX_SAS_ACTION_UNLOCK_WKSTA
Definition: winwlx.h:60
static BOOL HandleLogon(IN OUT PWLSESSION Session)
Definition: sas.c:497
#define WLX_SHUTTINGDOWN(Status)
Definition: winlogon.h:271
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
BOOL WINAPI SwitchDesktop(_In_ HDESK)
#define WLX_SAS_ACTION_LOGON
Definition: winwlx.h:53
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:380
#define WLX_SAS_ACTION_NONE
Definition: winwlx.h:54
#define WLX_SAS_ACTION_TASKLIST
Definition: winwlx.h:59
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
static NTSTATUS HandleLogoff(IN OUT PWLSESSION Session, IN UINT Flags)
Definition: sas.c:820

Referenced by DispatchSAS(), and SASWindowProc().

◆ HandleLogoff()

static NTSTATUS HandleLogoff ( IN OUT PWLSESSION  Session,
IN UINT  Flags 
)
static

Definition at line 820 of file sas.c.

823 {
824  PLOGOFF_SHUTDOWN_DATA LSData;
826  HANDLE hThread;
827  DWORD exitCode;
829 
830  /* Prepare data for logoff thread */
831  LSData = HeapAlloc(GetProcessHeap(), 0, sizeof(LOGOFF_SHUTDOWN_DATA));
832  if (!LSData)
833  {
834  ERR("Failed to allocate mem for thread data\n");
835  return STATUS_NO_MEMORY;
836  }
837  LSData->Flags = Flags;
838  LSData->Session = Session;
839 
841  if (!NT_SUCCESS(Status))
842  {
843  ERR("Failed to create a required security descriptor. Status 0x%08lx\n", Status);
844  HeapFree(GetProcessHeap(), 0, LSData);
845  return Status;
846  }
847 
848  /* Run logoff thread */
850  if (!hThread)
851  {
852  ERR("Unable to create logoff thread, error %lu\n", GetLastError());
854  HeapFree(GetProcessHeap(), 0, LSData);
855  return STATUS_UNSUCCESSFUL;
856  }
858  if (!GetExitCodeThread(hThread, &exitCode))
859  {
860  ERR("Unable to get exit code of logoff thread (error %lu)\n", GetLastError());
863  HeapFree(GetProcessHeap(), 0, LSData);
864  return STATUS_UNSUCCESSFUL;
865  }
867  if (exitCode == 0)
868  {
869  ERR("Logoff thread returned failure\n");
871  HeapFree(GetProcessHeap(), 0, LSData);
872  return STATUS_UNSUCCESSFUL;
873  }
874 
875  SwitchDesktop(Session->WinlogonDesktop);
876 
877  // TODO: Play logoff sound!
878 
879  SetWindowStationUser(Session->InteractiveWindowStation,
880  &LuidNone, NULL, 0);
881 
882  // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOGGINGOFF);
883 
884  // FIXME: Closing network connections!
885  // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_CLOSINGNETWORKCONNECTIONS);
886 
887  /* Kill remaining COM apps. Only at logoff! */
888  hThread = CreateThread(psa, 0, KillComProcesses, (LPVOID)LSData, 0, NULL);
889  if (hThread)
890  {
893  }
894 
895  /* We're done with the SECURITY_DESCRIPTOR */
897  psa = NULL;
898 
899  HeapFree(GetProcessHeap(), 0, LSData);
900 
901  DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_SAVEYOURSETTINGS);
902 
903  UnloadUserProfile(Session->UserToken, Session->hProfileInfo);
904 
906 
907  CloseHandle(Session->UserToken);
909  Session->LogonState = STATE_LOGGED_OFF;
910  Session->UserToken = NULL;
911 
912  return STATUS_SUCCESS;
913 }
BOOL DisplayStatusMessage(IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
Definition: winlogon.c:349
BOOL WINAPI SetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
Definition: winsta.c:419
#define CloseHandle
Definition: compat.h:598
static DWORD WINAPI KillComProcesses(LPVOID Parameter)
Definition: sas.c:664
LONG NTSTATUS
Definition: precomp.h:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
PWLSESSION Session
Definition: sas.c:42
static VOID DestroyLogoffSecurityAttributes(IN PSECURITY_ATTRIBUTES psa)
Definition: sas.c:808
LUID LuidNone
Definition: sas.c:47
BOOL WINAPI UnloadUserProfile(_In_ HANDLE hToken, _In_ HANDLE hProfile)
Definition: profile.c:2184
static DWORD WINAPI LogoffShutdownThread(LPVOID Parameter)
Definition: sas.c:619
static NTSTATUS CreateLogoffSecurityAttributes(OUT PSECURITY_ATTRIBUTES *ppsa)
Definition: sas.c:694
#define IDS_SAVEYOURSETTINGS
Definition: resource.h:34
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define FALSE
Definition: types.h:117
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI SwitchDesktop(_In_ HDESK)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ERR(fmt,...)
Definition: debug.h:110
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:380
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
DWORD WINAPI UpdatePerUserSystemParameters(DWORD dw1, DWORD dw2)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define INFINITE
Definition: serial.h:102
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by DoGenericAction().

◆ HandleLogon()

static BOOL HandleLogon ( IN OUT PWLSESSION  Session)
static

Definition at line 497 of file sas.c.

499 {
500  PROFILEINFOW ProfileInfo;
501  BOOL ret = FALSE;
502 
503  /* Loading personal settings */
504  DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_LOADINGYOURPERSONALSETTINGS);
505  ProfileInfo.hProfile = INVALID_HANDLE_VALUE;
506  if (0 == (Session->Options & WLX_LOGON_OPT_NO_PROFILE))
507  {
508  if (Session->Profile == NULL
509  || (Session->Profile->dwType != WLX_PROFILE_TYPE_V1_0
510  && Session->Profile->dwType != WLX_PROFILE_TYPE_V2_0))
511  {
512  ERR("WL: Wrong profile\n");
513  goto cleanup;
514  }
515 
516  /* Load the user profile */
517  ZeroMemory(&ProfileInfo, sizeof(PROFILEINFOW));
518  ProfileInfo.dwSize = sizeof(PROFILEINFOW);
519  ProfileInfo.dwFlags = 0;
520  ProfileInfo.lpUserName = Session->MprNotifyInfo.pszUserName;
521  ProfileInfo.lpProfilePath = Session->Profile->pszProfile;
522  if (Session->Profile->dwType >= WLX_PROFILE_TYPE_V2_0)
523  {
524  ProfileInfo.lpDefaultPath = Session->Profile->pszNetworkDefaultUserProfile;
525  ProfileInfo.lpServerName = Session->Profile->pszServerName;
526  ProfileInfo.lpPolicyPath = Session->Profile->pszPolicy;
527  }
528 
529  if (!LoadUserProfileW(Session->UserToken, &ProfileInfo))
530  {
531  ERR("WL: LoadUserProfileW() failed\n");
532  goto cleanup;
533  }
534  }
535 
536  /* Create environment block for the user */
537  if (!CreateUserEnvironment(Session))
538  {
539  WARN("WL: SetUserEnvironment() failed\n");
540  goto cleanup;
541  }
542 
544 
545  DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS);
547 
548  /* Set default user language */
549  if (!SetDefaultLanguage(Session))
550  {
551  WARN("WL: SetDefaultLanguage() failed\n");
552  goto cleanup;
553  }
554 
555  /* Allow winsta and desktop access for this session */
556  if (!AllowAccessOnSession(Session))
557  {
558  WARN("WL: AllowAccessOnSession() failed to give winsta & desktop access for this session\n");
559  goto cleanup;
560  }
561 
562  /* Connect remote resources */
563  RestoreAllConnections(Session);
564 
565  if (!StartUserShell(Session))
566  {
567  //WCHAR StatusMsg[256];
568  WARN("WL: WlxActivateUserShell() failed\n");
569  //LoadStringW(hAppInstance, IDS_FAILEDACTIVATEUSERSHELL, StatusMsg, sizeof(StatusMsg) / sizeof(StatusMsg[0]));
570  //MessageBoxW(0, StatusMsg, NULL, MB_ICONERROR);
571  goto cleanup;
572  }
573 
575 
576  if (!InitializeScreenSaver(Session))
577  WARN("WL: Failed to initialize screen saver\n");
578 
579  Session->hProfileInfo = ProfileInfo.hProfile;
580 
581  /* Logon has succeeded. Play sound. */
582  PlayLogonSound(Session);
583 
584  ret = TRUE;
585 
586 cleanup:
587  if (Session->Profile)
588  {
589  HeapFree(GetProcessHeap(), 0, Session->Profile->pszProfile);
590  HeapFree(GetProcessHeap(), 0, Session->Profile);
591  }
592  Session->Profile = NULL;
593  if (!ret && ProfileInfo.hProfile != INVALID_HANDLE_VALUE)
594  {
595  UnloadUserProfile(Session->UserToken, ProfileInfo.hProfile);
596  }
597  RemoveStatusMessage(Session);
598  if (!ret)
599  {
600  SetWindowStationUser(Session->InteractiveWindowStation,
601  &LuidNone, NULL, 0);
602  CloseHandle(Session->UserToken);
603  Session->UserToken = NULL;
604  }
605 
606  if (ret)
607  {
608  SwitchDesktop(Session->ApplicationDesktop);
609  Session->LogonState = STATE_LOGGED_ON;
610  }
611 
612  return ret;
613 }
BOOL DisplayStatusMessage(IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
Definition: winlogon.c:349
BOOL RemoveStatusMessage(IN PWLSESSION Session)
Definition: winlogon.c:370
#define IDS_APPLYINGYOURPERSONALSETTINGS
Definition: resource.h:26
BOOL WINAPI SetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
Definition: winsta.c:419
#define CloseHandle
Definition: compat.h:598
HANDLE hProfile
Definition: userenv.h:43
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define ZeroMemory
Definition: winbase.h:1667
BOOL CreateUserEnvironment(IN PWLSESSION Session)
Definition: environment.c:128
LUID LuidNone
Definition: sas.c:47
BOOL WINAPI UnloadUserProfile(_In_ HANDLE hToken, _In_ HANDLE hProfile)
Definition: profile.c:2184
LPWSTR lpDefaultPath
Definition: userenv.h:40
LPWSTR lpUserName
Definition: userenv.h:38
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR lpServerName
Definition: userenv.h:41
static VOID RestoreAllConnections(PWLSESSION Session)
Definition: sas.c:433
LPWSTR lpPolicyPath
Definition: userenv.h:42
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
#define GetProcessHeap()
Definition: compat.h:595
BOOL InitializeScreenSaver(IN OUT PWLSESSION Session)
Definition: screensaver.c:204
BOOL WINAPI SwitchDesktop(_In_ HDESK)
DWORD dwSize
Definition: userenv.h:36
BOOL SetDefaultLanguage(IN PWLSESSION Session)
Definition: sas.c:111
int ret
DWORD dwFlags
Definition: userenv.h:37
#define WLX_LOGON_OPT_NO_PROFILE
Definition: winwlx.h:48
struct _PROFILEINFOW PROFILEINFOW
#define ERR(fmt,...)
Definition: debug.h:110
static BOOL StartUserShell(IN OUT PWLSESSION Session)
Definition: sas.c:80
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:380
static VOID PlayLogonSound(IN OUT PWLSESSION Session)
Definition: sas.c:421
LPWSTR lpProfilePath
Definition: userenv.h:39
#define NULL
Definition: types.h:112
BOOL WINAPI LoadUserProfileW(_In_ HANDLE hToken, _Inout_ LPPROFILEINFOW lpProfileInfo)
Definition: profile.c:2005
char * cleanup(char *str)
Definition: wpickclick.c:99
DWORD WINAPI UpdatePerUserSystemParameters(DWORD dw1, DWORD dw2)
#define WLX_PROFILE_TYPE_V2_0
Definition: winwlx.h:51
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WLX_PROFILE_TYPE_V1_0
Definition: winwlx.h:50
#define IDS_LOADINGYOURPERSONALSETTINGS
Definition: resource.h:29

Referenced by DoGenericAction().

◆ HandleMessageBeep()

BOOL WINAPI HandleMessageBeep ( UINT  uType)

Definition at line 1273 of file sas.c.

1274 {
1275  LPWSTR EventName;
1276 
1277  switch(uType)
1278  {
1279  case 0xFFFFFFFF:
1280  EventName = NULL;
1281  break;
1282  case MB_OK:
1283  EventName = L"SystemDefault";
1284  break;
1285  case MB_ICONASTERISK:
1286  EventName = L"SystemAsterisk";
1287  break;
1288  case MB_ICONEXCLAMATION:
1289  EventName = L"SystemExclamation";
1290  break;
1291  case MB_ICONHAND:
1292  EventName = L"SystemHand";
1293  break;
1294  case MB_ICONQUESTION:
1295  EventName = L"SystemQuestion";
1296  break;
1297  default:
1298  WARN("Unhandled type %d\n", uType);
1299  EventName = L"SystemDefault";
1300  }
1301 
1302  return PlaySoundRoutine(EventName, FALSE, SND_ALIAS | SND_NOWAIT | SND_NOSTOP | SND_ASYNC);
1303 }
#define MB_ICONHAND
Definition: winuser.h:782
#define WARN(fmt,...)
Definition: debug.h:112
BOOL PlaySoundRoutine(IN LPCWSTR FileName, IN UINT bLogon, IN UINT Flags)
Definition: sas.c:240
#define MB_ICONEXCLAMATION
Definition: winuser.h:779
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define SND_NOSTOP
Definition: mmsystem.h:158
#define SND_ALIAS
Definition: mmsystem.h:160
#define MB_ICONQUESTION
Definition: winuser.h:783
#define SND_ASYNC
Definition: mmsystem.h:154
#define MB_ICONASTERISK
Definition: winuser.h:778
#define SND_NOWAIT
Definition: mmsystem.h:159
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SASWindowProc().

◆ HandleShutdown()

NTSTATUS HandleShutdown ( IN OUT PWLSESSION  Session,
IN DWORD  wlxAction 
)

Definition at line 964 of file sas.c.

967 {
968  PLOGOFF_SHUTDOWN_DATA LSData;
969  HANDLE hThread;
970  DWORD exitCode;
971  BOOLEAN Old;
972 
973  // SwitchDesktop(Session->WinlogonDesktop);
974 
975  /* If the system is rebooting, show the appropriate string */
976  if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_REBOOT)
977  DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_REACTOSISRESTARTING);
978  else
979  DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_REACTOSISSHUTTINGDOWN);
980 
981  /* Prepare data for shutdown thread */
982  LSData = HeapAlloc(GetProcessHeap(), 0, sizeof(LOGOFF_SHUTDOWN_DATA));
983  if (!LSData)
984  {
985  ERR("Failed to allocate mem for thread data\n");
986  return STATUS_NO_MEMORY;
987  }
988  if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_POWER_OFF)
989  LSData->Flags = EWX_POWEROFF;
990  else if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_REBOOT)
991  LSData->Flags = EWX_REBOOT;
992  else
993  LSData->Flags = EWX_SHUTDOWN;
994  LSData->Session = Session;
995 
996  // FIXME: We may need to specify this flag to really force application kill
997  // (we are shutting down ReactOS, not just logging off so no hangs, etc...
998  // should be allowed).
999  // LSData->Flags |= EWX_FORCE;
1000 
1001  /* Run shutdown thread */
1003  if (!hThread)
1004  {
1005  ERR("Unable to create shutdown thread, error %lu\n", GetLastError());
1006  HeapFree(GetProcessHeap(), 0, LSData);
1007  return STATUS_UNSUCCESSFUL;
1008  }
1010  HeapFree(GetProcessHeap(), 0, LSData);
1011  if (!GetExitCodeThread(hThread, &exitCode))
1012  {
1013  ERR("Unable to get exit code of shutdown thread (error %lu)\n", GetLastError());
1015  return STATUS_UNSUCCESSFUL;
1016  }
1018  if (exitCode == 0)
1019  {
1020  ERR("Shutdown thread returned failure\n");
1021  return STATUS_UNSUCCESSFUL;
1022  }
1023 
1025 
1026  /* Destroy SAS window */
1027  UninitializeSAS(Session);
1028 
1029  /* Now we can shut down NT */
1030  ERR("Shutting down NT...\n");
1032  if (wlxAction == WLX_SAS_ACTION_SHUTDOWN_REBOOT)
1033  {
1035  }
1036  else
1037  {
1038  if (FALSE)
1039  {
1040  /* FIXME - only show this dialog if it's a shutdown and the computer doesn't support APM */
1043  }
1045  }
1047  return STATUS_SUCCESS;
1048 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL DisplayStatusMessage(IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
Definition: winlogon.c:349
#define CloseHandle
Definition: compat.h:598
#define TRUE
Definition: types.h:120
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
PWLSESSION Session
Definition: sas.c:42
static VOID UninitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:950
#define EWX_REBOOT
Definition: winuser.h:633
static DWORD WINAPI LogoffShutdownThread(LPVOID Parameter)
Definition: sas.c:619
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define DialogBox
Definition: winuser.h:5751
static INT_PTR CALLBACK ShutdownComputerWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: sas.c:918
#define FALSE
Definition: types.h:117
#define EWX_SHUTDOWN
Definition: winuser.h:634
#define IDS_REACTOSISSHUTTINGDOWN
Definition: resource.h:31
unsigned char BOOLEAN
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
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
#define EWX_POWEROFF
Definition: winuser.h:632
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
Definition: shutdown.c:43
#define IDD_SHUTDOWNCOMPUTER
Definition: resource.h:7
#define ERR(fmt,...)
Definition: debug.h:110
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:380
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
#define IDS_REACTOSISRESTARTING
Definition: resource.h:38
#define STATUS_SUCCESS
Definition: shellext.h:65
#define INFINITE
Definition: serial.h:102
#define HeapFree(x, y, z)
Definition: compat.h:594
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by DoGenericAction(), and WinMain().

◆ InitializeSAS()

BOOL InitializeSAS ( IN OUT PWLSESSION  Session)

Definition at line 1508 of file sas.c.

1510 {
1511  WNDCLASSEXW swc;
1512  BOOL ret = FALSE;
1513 
1514  if (!SwitchDesktop(Session->WinlogonDesktop))
1515  {
1516  ERR("WL: Failed to switch to winlogon desktop\n");
1517  goto cleanup;
1518  }
1519 
1520  /* Register SAS window class */
1521  swc.cbSize = sizeof(WNDCLASSEXW);
1522  swc.style = CS_SAVEBITS;
1523  swc.lpfnWndProc = SASWindowProc;
1524  swc.cbClsExtra = 0;
1525  swc.cbWndExtra = 0;
1526  swc.hInstance = hAppInstance;
1527  swc.hIcon = NULL;
1528  swc.hCursor = NULL;
1529  swc.hbrBackground = NULL;
1530  swc.lpszMenuName = NULL;
1532  swc.hIconSm = NULL;
1533  if (RegisterClassExW(&swc) == 0)
1534  {
1535  ERR("WL: Failed to register SAS window class\n");
1536  goto cleanup;
1537  }
1538 
1539  /* Create invisible SAS window */
1540  Session->SASWindow = CreateWindowExW(
1541  0,
1544  WS_POPUP,
1545  0, 0, 0, 0, 0, 0,
1546  hAppInstance, Session);
1547  if (!Session->SASWindow)
1548  {
1549  ERR("WL: Failed to create SAS window\n");
1550  goto cleanup;
1551  }
1552 
1553  /* Register SAS window to receive SAS notifications */
1554  if (!SetLogonNotifyWindow(Session->SASWindow))
1555  {
1556  ERR("WL: Failed to register SAS window\n");
1557  goto cleanup;
1558  }
1559 
1560  if (!SetDefaultLanguage(NULL))
1561  return FALSE;
1562 
1563  ret = TRUE;
1564 
1565 cleanup:
1566  if (!ret)
1567  UninitializeSAS(Session);
1568  return ret;
1569 }
int cbWndExtra
Definition: winuser.h:3210
#define TRUE
Definition: types.h:120
BOOL WINAPI SetLogonNotifyWindow(HWND Wnd)
Definition: logon.c:91
static LRESULT CALLBACK SASWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: sas.c:1308
HICON hIcon
Definition: winuser.h:3212
struct _WNDCLASSEXW WNDCLASSEXW
static VOID UninitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:950
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
LPCWSTR lpszMenuName
Definition: winuser.h:3215
#define WINLOGON_SAS_CLASS
Definition: sas.c:26
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
int cbClsExtra
Definition: winuser.h:3209
LPCWSTR lpszClassName
Definition: winuser.h:3216
HBRUSH hbrBackground
Definition: winuser.h:3214
UINT cbSize
Definition: winuser.h:3206
BOOL WINAPI SwitchDesktop(_In_ HDESK)
HINSTANCE hInstance
Definition: winuser.h:3211
#define CS_SAVEBITS
Definition: winuser.h:652
BOOL SetDefaultLanguage(IN PWLSESSION Session)
Definition: sas.c:111
int ret
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)
HCURSOR hCursor
Definition: winuser.h:3213
UINT style
Definition: winuser.h:3207
WNDPROC lpfnWndProc
Definition: winuser.h:3208
#define ERR(fmt,...)
Definition: debug.h:110
#define WS_POPUP
Definition: pedump.c:616
#define WINLOGON_SAS_TITLE
Definition: sas.c:27
#define NULL
Definition: types.h:112
HICON hIconSm
Definition: winuser.h:3217
char * cleanup(char *str)
Definition: wpickclick.c:99
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by WinMain().

◆ KillComProcesses()

static DWORD WINAPI KillComProcesses ( LPVOID  Parameter)
static

Definition at line 664 of file sas.c.

666 {
667  DWORD ret = 1;
669 
670  TRACE("In KillComProcesses\n");
671 
672  if (LSData->Session->UserToken != NULL &&
674  {
675  ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
676  return 0;
677  }
678 
679  /* Attempt to kill remaining processes. No notifications needed. */
681  {
682  ERR("Unable to kill COM apps, error %lu\n", GetLastError());
683  ret = 0;
684  }
685 
686  if (LSData->Session->UserToken)
687  RevertToSelf();
688 
689  return ret;
690 }
#define EWX_FORCE
Definition: winuser.h:630
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1610
HANDLE UserToken
Definition: winlogon.h:227
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
PWLSESSION Session
Definition: sas.c:42
_In_ PVOID Parameter
Definition: ldrtypes.h:241
#define EWX_LOGOFF
Definition: winuser.h:631
#define EWX_CALLER_WINLOGON
Definition: undocuser.h:128
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define EWX_NONOTIFY
Definition: undocuser.h:134
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define ERR(fmt,...)
Definition: debug.h:110
struct tagLOGOFF_SHUTDOWN_DATA * PLOGOFF_SHUTDOWN_DATA
#define NULL
Definition: types.h:112

Referenced by HandleLogoff().

◆ LogoffShutdownThread()

static DWORD WINAPI LogoffShutdownThread ( LPVOID  Parameter)
static

Definition at line 619 of file sas.c.

621 {
622  DWORD ret = 1;
624  UINT uFlags;
625 
626  if (LSData->Session->UserToken != NULL &&
628  {
629  ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
630  return 0;
631  }
632 
633  // FIXME: To be really fixed: need to check what needs to be kept and what needs to be removed there.
634  //
635  // uFlags = EWX_INTERNAL_KILL_USER_APPS | (LSData->Flags & EWX_FLAGS_MASK) |
636  // ((LSData->Flags & EWX_ACTION_MASK) == EWX_LOGOFF ? EWX_CALLER_WINLOGON_LOGOFF : 0);
637 
638  uFlags = EWX_CALLER_WINLOGON | (LSData->Flags & 0x0F);
639 
640  TRACE("In LogoffShutdownThread with uFlags == 0x%x; exit_in_progress == %s\n",
641  uFlags, ExitReactOSInProgress ? "true" : "false");
642 
644 
645  /* Close processes of the interactive user */
646  if (!ExitWindowsEx(uFlags, 0))
647  {
648  ERR("Unable to kill user apps, error %lu\n", GetLastError());
649  ret = 0;
650  }
651 
652  /* Cancel all the user connections */
654 
655  if (LSData->Session->UserToken)
656  RevertToSelf();
657 
658  return ret;
659 }
#define TRUE
Definition: types.h:120
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1610
HANDLE UserToken
Definition: winlogon.h:227
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
PWLSESSION Session
Definition: sas.c:42
UINT uFlags
Definition: api.c:59
_In_ PVOID Parameter
Definition: ldrtypes.h:241
#define EWX_CALLER_WINLOGON
Definition: undocuser.h:128
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL ExitReactOSInProgress
Definition: sas.c:45
int ret
BOOL WINAPI ExitWindowsEx(_In_ UINT, _In_ DWORD)
#define ERR(fmt,...)
Definition: debug.h:110
struct tagLOGOFF_SHUTDOWN_DATA * PLOGOFF_SHUTDOWN_DATA
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
DWORD WINAPI WNetClearConnections(HWND owner)
Definition: wnet.c:2825

Referenced by HandleLogoff(), and HandleShutdown().

◆ PlayLogonSound()

static VOID PlayLogonSound ( IN OUT PWLSESSION  Session)
static

Definition at line 421 of file sas.c.

423 {
424  HANDLE hThread;
425 
426  hThread = CreateThread(NULL, 0, PlayLogonSoundThread, (PVOID)Session->UserToken, 0, NULL);
427  if (hThread)
429 }
#define CloseHandle
Definition: compat.h:598
DWORD WINAPI PlayLogonSoundThread(IN LPVOID lpParameter)
Definition: sas.c:284
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28

Referenced by HandleLogon().

◆ PlayLogonSoundThread()

DWORD WINAPI PlayLogonSoundThread ( IN LPVOID  lpParameter)

Definition at line 284 of file sas.c.

286 {
287  BYTE TokenUserBuffer[256];
288  PTOKEN_USER pTokenUser = (TOKEN_USER*)TokenUserBuffer;
289  ULONG Length;
290  HKEY hKey;
291  WCHAR wszBuffer[MAX_PATH] = {0};
292  WCHAR wszDest[MAX_PATH];
293  DWORD dwSize = sizeof(wszBuffer), dwType;
295  UNICODE_STRING SidString;
297  ULONG Index = 0;
298  SC_HANDLE hSCManager, hService;
299 
300  //
301  // FIXME: Isn't it possible to *JUST* impersonate the current user
302  // *AND* open its HKCU??
303  //
304 
305  /* Get SID of current user */
306  Status = NtQueryInformationToken((HANDLE)lpParameter,
307  TokenUser,
308  TokenUserBuffer,
309  sizeof(TokenUserBuffer),
310  &Length);
311  if (!NT_SUCCESS(Status))
312  {
313  ERR("NtQueryInformationToken failed: %x!\n", Status);
314  return 0;
315  }
316 
317  /* Convert SID to string */
318  RtlInitEmptyUnicodeString(&SidString, wszBuffer, sizeof(wszBuffer));
319  Status = RtlConvertSidToUnicodeString(&SidString, pTokenUser->User.Sid, FALSE);
320  if (!NT_SUCCESS(Status))
321  {
322  ERR("RtlConvertSidToUnicodeString failed: %x!\n", Status);
323  return 0;
324  }
325 
326  /* Build path to logon sound registry key.
327  Note: We can't use HKCU here, because Winlogon is owned by SYSTEM user */
328  if (FAILED(StringCbCopyW(wszBuffer + SidString.Length/sizeof(WCHAR),
329  sizeof(wszBuffer) - SidString.Length,
330  L"\\AppEvents\\Schemes\\Apps\\.Default\\WindowsLogon\\.Current")))
331  {
332  /* SID is too long. Should not happen. */
333  ERR("StringCbCopyW failed!\n");
334  return 0;
335  }
336 
337  /* Open registry key and query sound path */
338  if (RegOpenKeyExW(HKEY_USERS, wszBuffer, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
339  {
340  ERR("RegOpenKeyExW(%ls) failed!\n", wszBuffer);
341  return 0;
342  }
343 
344  if (RegQueryValueExW(hKey, NULL, NULL, &dwType,
345  (LPBYTE)wszBuffer, &dwSize) != ERROR_SUCCESS ||
346  (dwType != REG_SZ && dwType != REG_EXPAND_SZ))
347  {
348  ERR("RegQueryValueExW failed!\n");
349  RegCloseKey(hKey);
350  return 0;
351  }
352 
353  RegCloseKey(hKey);
354 
355  if (!wszBuffer[0])
356  {
357  /* No sound has been set */
358  ERR("No sound has been set\n");
359  return 0;
360  }
361 
362  /* Expand environment variables */
363  if (!ExpandEnvironmentStringsW(wszBuffer, wszDest, MAX_PATH))
364  {
365  ERR("ExpandEnvironmentStringsW failed!\n");
366  return 0;
367  }
368 
369  /* Open the service manager */
371  if (!hSCManager)
372  {
373  ERR("OpenSCManager failed (%x)\n", GetLastError());
374  return 0;
375  }
376 
377  /* Open the wdmaud service */
378  hService = OpenServiceW(hSCManager, L"wdmaud", GENERIC_READ);
379  if (!hService)
380  {
381  /* The service is not installed */
382  TRACE("Failed to open wdmaud service (%x)\n", GetLastError());
384  return 0;
385  }
386 
387  /* Wait for wdmaud to start */
388  do
389  {
391  {
392  TRACE("QueryServiceStatusEx failed (%x)\n", GetLastError());
393  break;
394  }
395 
396  if (Info.dwCurrentState == SERVICE_RUNNING)
397  break;
398 
399  Sleep(1000);
400 
401  } while (Index++ < 20);
402 
403  CloseServiceHandle(hService);
405 
406  /* If wdmaud is not running exit */
407  if (Info.dwCurrentState != SERVICE_RUNNING)
408  {
409  WARN("wdmaud has not started!\n");
410  return 0;
411  }
412 
413  /* Sound subsystem is running. Play logon sound. */
414  TRACE("Playing logon sound: %ls\n", wszDest);
416  return 0;
417 }
#define HKEY_USERS
Definition: winreg.h:13
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
LONG NTSTATUS
Definition: precomp.h:26
BOOL PlaySoundRoutine(IN LPCWSTR FileName, IN UINT bLogon, IN UINT Flags)
Definition: sas.c:240
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2835
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define SERVICE_RUNNING
Definition: winsvc.h:24
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2108
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
Status
Definition: gdiplustypes.h:24
_Must_inspect_result_ __kernel_entry NTSTATUS NTAPI NtQueryInformationToken(_In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_writes_bytes_to_opt_(TokenInformationLength, *ReturnLength) PVOID TokenInformation, _In_ ULONG TokenInformationLength, _Out_ PULONG ReturnLength)
Queries a specific type of information in regard of an access token based upon the information class....
Definition: tokencls.c:473
#define OpenSCManager
Definition: winsvc.h:575
#define TRACE(s)
Definition: solgame.cpp:4
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ WDFCOLLECTION _In_ ULONG Index
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI NTSTATUS NTAPI RtlConvertSidToUnicodeString(OUT PUNICODE_STRING DestinationString, IN PVOID Sid, IN BOOLEAN AllocateDestinationString)
#define GENERIC_READ
Definition: compat.h:135
SC_HANDLE hSCManager
Definition: sc.c:12
unsigned char BYTE
Definition: xxhash.c:193
#define ERR(fmt,...)
Definition: debug.h:110
#define SND_FILENAME
Definition: mmsystem.h:162
FxAutoRegKey hKey
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
unsigned int ULONG
Definition: retypes.h:1
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
SID_AND_ATTRIBUTES User
Definition: setypes.h:1006
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define REG_SZ
Definition: layer.c:22

Referenced by PlayLogonSound().

◆ PlaySoundRoutine()

BOOL PlaySoundRoutine ( IN LPCWSTR  FileName,
IN UINT  bLogon,
IN UINT  Flags 
)

Definition at line 240 of file sas.c.

244 {
245  typedef BOOL (WINAPI *PLAYSOUNDW)(LPCWSTR,HMODULE,DWORD);
246  typedef UINT (WINAPI *WAVEOUTGETNUMDEVS)(VOID);
247  PLAYSOUNDW Play;
248  WAVEOUTGETNUMDEVS waveOutGetNumDevs;
249  UINT NumDevs;
251  BOOL Ret = FALSE;
252 
253  hLibrary = LoadLibraryW(L"winmm.dll");
254  if (hLibrary)
255  {
256  waveOutGetNumDevs = (WAVEOUTGETNUMDEVS)GetProcAddress(hLibrary, "waveOutGetNumDevs");
257  if (waveOutGetNumDevs)
258  {
259  NumDevs = waveOutGetNumDevs();
260  if (!NumDevs)
261  {
262  if (!bLogon)
263  {
264  Beep(440, 125);
265  }
267  return FALSE;
268  }
269  }
270 
271  Play = (PLAYSOUNDW)GetProcAddress(hLibrary, "PlaySoundW");
272  if (Play)
273  {
274  Ret = Play(FileName, NULL, Flags);
275  }
277  }
278 
279  return Ret;
280 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define LoadLibraryW(x)
Definition: compat.h:606
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2140
#define FreeLibrary(x)
Definition: compat.h:607
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define WINAPI
Definition: msvc.h:6
#define VOID
Definition: acefi.h:82
HMODULE hLibrary
Definition: odbccp32.c:12
HANDLE HMODULE
Definition: typedefs.h:77
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL WINAPI Beep(IN DWORD dwFreq, IN DWORD dwDuration)
Definition: deviceio.c:48
#define GetProcAddress(x, y)
Definition: compat.h:612

Referenced by HandleMessageBeep(), and PlayLogonSoundThread().

◆ RegisterHotKeys()

static BOOL RegisterHotKeys ( IN PWLSESSION  Session,
IN HWND  hwndSAS 
)
static

Definition at line 1238 of file sas.c.

1241 {
1242  /* Register Ctrl+Alt+Del Hotkey */
1244  {
1245  ERR("WL: Unable to register Ctrl+Alt+Del hotkey!\n");
1246  return FALSE;
1247  }
1248 
1249  /* Register Ctrl+Shift+Esc (optional) */
1250  Session->TaskManHotkey = RegisterHotKey(hwndSAS, HK_CTRL_SHIFT_ESC, MOD_CONTROL | MOD_SHIFT, VK_ESCAPE);
1251  if (!Session->TaskManHotkey)
1252  WARN("WL: Warning: Unable to register Ctrl+Alt+Esc hotkey!\n");
1253  return TRUE;
1254 }
#define HK_CTRL_ALT_DEL
Definition: sas.c:29
#define MOD_ALT
Definition: imm.h:319
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
#define VK_ESCAPE
Definition: winuser.h:2204
#define FALSE
Definition: types.h:117
#define VK_DELETE
Definition: winuser.h:2223
HWND hwndSAS
Definition: winsta.c:24
#define MOD_SHIFT
Definition: imm.h:321
#define ERR(fmt,...)
Definition: debug.h:110
#define HK_CTRL_SHIFT_ESC
Definition: sas.c:30
BOOL WINAPI RegisterHotKey(_In_opt_ HWND, _In_ int, _In_ UINT, _In_ UINT)
#define MOD_CONTROL
Definition: imm.h:320

Referenced by SASWindowProc().

◆ RestoreAllConnections()

static VOID RestoreAllConnections ( PWLSESSION  Session)
static

Definition at line 433 of file sas.c.

434 {
435  DWORD dRet;
436  HANDLE hEnum;
437  LPNETRESOURCE lpRes;
438  DWORD dSize = 0x1000;
439  DWORD dCount = -1;
440  LPNETRESOURCE lpCur;
441  BOOL UserProfile;
442 
443  UserProfile = (Session && Session->UserToken);
444  if (!UserProfile)
445  {
446  return;
447  }
448 
449  if (!ImpersonateLoggedOnUser(Session->UserToken))
450  {
451  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
452  return;
453  }
454 
456  if (dRet != WN_SUCCESS)
457  {
458  ERR("Failed to open enumeration: %lu\n", dRet);
459  goto quit;
460  }
461 
462  lpRes = HeapAlloc(GetProcessHeap(), 0, dSize);
463  if (!lpRes)
464  {
465  ERR("Failed to allocate memory\n");
466  WNetCloseEnum(hEnum);
467  goto quit;
468  }
469 
470  do
471  {
472  dSize = 0x1000;
473  dCount = -1;
474 
475  memset(lpRes, 0, dSize);
476  dRet = WNetEnumResource(hEnum, &dCount, lpRes, &dSize);
477  if (dRet == WN_SUCCESS || dRet == WN_MORE_DATA)
478  {
479  lpCur = lpRes;
480  for (; dCount; dCount--)
481  {
483  lpCur++;
484  }
485  }
486  } while (dRet != WN_NO_MORE_ENTRIES);
487 
488  HeapFree(GetProcessHeap(), 0, lpRes);
489  WNetCloseEnum(hEnum);
490 
491 quit:
492  RevertToSelf();
493 }
#define WNetAddConnection
Definition: winnetwk.h:611
#define WN_SUCCESS
Definition: winnetwk.h:111
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1610
void quit(int argc, const char *argv[])
Definition: cmds.c:1606
HANDLE UserToken
Definition: winlogon.h:227
LPSTR lpLocalName
Definition: winnetwk.h:171
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
#define WNetOpenEnum
Definition: winnetwk.h:598
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI WNetCloseEnum(HANDLE hEnum)
Definition: wnet.c:1760
#define WNetEnumResource
Definition: winnetwk.h:599
#define RESOURCETYPE_DISK
Definition: winnetwk.h:64
#define RESOURCE_REMEMBERED
Definition: winnetwk.h:60
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
LPSTR lpRemoteName
Definition: winnetwk.h:172
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by HandleLogon().

◆ SASWindowProc()

static LRESULT CALLBACK SASWindowProc ( IN HWND  hwndDlg,
IN UINT  uMsg,
IN WPARAM  wParam,
IN LPARAM  lParam 
)
static

Definition at line 1308 of file sas.c.

1313 {
1314  PWLSESSION Session = (PWLSESSION)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
1315 
1316  switch (uMsg)
1317  {
1318  case WM_HOTKEY:
1319  {
1320  switch (lParam)
1321  {
1323  {
1324  TRACE("SAS: CONTROL+ALT+DELETE\n");
1325  if (!Session->Gina.UseCtrlAltDelete)
1326  break;
1328  return TRUE;
1329  }
1331  {
1332  TRACE("SAS: CONTROL+SHIFT+ESCAPE\n");
1333  if (Session->LogonState == STATE_LOGGED_ON)
1335  return TRUE;
1336  }
1337  }
1338  break;
1339  }
1340  case WM_CREATE:
1341  {
1342  /* Get the session pointer from the create data */
1343  Session = (PWLSESSION)((LPCREATESTRUCT)lParam)->lpCreateParams;
1344 
1345  /* Save the Session pointer */
1346  SetWindowLongPtrW(hwndDlg, GWLP_USERDATA, (LONG_PTR)Session);
1347  if (GetSetupType())
1348  return TRUE;
1349  return RegisterHotKeys(Session, hwndDlg);
1350  }
1351  case WM_DESTROY:
1352  {
1353  if (!GetSetupType())
1354  UnregisterHotKeys(Session, hwndDlg);
1355  return TRUE;
1356  }
1357  case WM_SETTINGCHANGE:
1358  {
1359  UINT uiAction = (UINT)wParam;
1360  if (uiAction == SPI_SETSCREENSAVETIMEOUT
1361  || uiAction == SPI_SETSCREENSAVEACTIVE)
1362  {
1364  }
1365  return TRUE;
1366  }
1367  case WM_LOGONNOTIFY:
1368  {
1369  switch(wParam)
1370  {
1371  case LN_MESSAGE_BEEP:
1372  {
1373  return HandleMessageBeep(lParam);
1374  }
1375  case LN_SHELL_EXITED:
1376  {
1377  /* lParam is the exit code */
1378  if (lParam != 1 &&
1379  Session->LogonState != STATE_LOGGED_OFF &&
1380  Session->LogonState != STATE_LOGGED_OFF_SAS)
1381  {
1382  SetTimer(hwndDlg, 1, 1000, NULL);
1383  }
1384  break;
1385  }
1386  case LN_START_SCREENSAVE:
1387  {
1389  break;
1390  }
1391  case LN_LOCK_WORKSTATION:
1392  {
1394  break;
1395  }
1396  case LN_LOGOFF:
1397  {
1398  UINT Flags = (UINT)lParam;
1400  DWORD wlxAction;
1401 
1402  TRACE("\tFlags : 0x%lx\n", lParam);
1403 
1404  /*
1405  * Our caller (USERSRV) should have added the shutdown flag
1406  * when setting also poweroff or reboot.
1407  */
1408  if (Action & (EWX_POWEROFF | EWX_REBOOT))
1409  {
1410  if ((Action & EWX_SHUTDOWN) == 0)
1411  {
1412  ERR("Missing EWX_SHUTDOWN flag for poweroff or reboot; action 0x%x\n", Action);
1413  return STATUS_INVALID_PARAMETER;
1414  }
1415 
1416  /* Now we can locally remove it for performing checks */
1417  Action &= ~EWX_SHUTDOWN;
1418  }
1419 
1420  /* Check parameters */
1421  if (Action & EWX_FORCE)
1422  {
1423  // FIXME!
1424  ERR("FIXME: EWX_FORCE present for Winlogon, what to do?\n");
1425  Action &= ~EWX_FORCE;
1426  }
1427  switch (Action)
1428  {
1429  case EWX_LOGOFF:
1430  wlxAction = WLX_SAS_ACTION_LOGOFF;
1431  break;
1432  case EWX_SHUTDOWN:
1433  wlxAction = WLX_SAS_ACTION_SHUTDOWN;
1434  break;
1435  case EWX_REBOOT:
1436  wlxAction = WLX_SAS_ACTION_SHUTDOWN_REBOOT;
1437  break;
1438  case EWX_POWEROFF:
1440  break;
1441 
1442  default:
1443  {
1444  ERR("Invalid ExitWindows action 0x%x\n", Action);
1445  return STATUS_INVALID_PARAMETER;
1446  }
1447  }
1448 
1449  TRACE("In LN_LOGOFF, exit_in_progress == %s\n",
1450  ExitReactOSInProgress ? "true" : "false");
1451 
1452  /*
1453  * In case a parallel shutdown request is done (while we are
1454  * being to shut down) and it was not done by Winlogon itself,
1455  * then just stop here.
1456  */
1457 #if 0
1458 // This code is commented at the moment (even if it's correct) because
1459 // our log-offs do not really work: the shell is restarted, no app is killed
1460 // etc... and as a result you just get explorer opening "My Documents". And
1461 // if you try now a shut down, it won't work because winlogon thinks it is
1462 // still in the middle of a shutdown.
1463 // Maybe we also need to reset ExitReactOSInProgress somewhere else??
1465  {
1466  break;
1467  }
1468 #endif
1469  /* Now do the shutdown action proper */
1470  DoGenericAction(Session, wlxAction);
1471  return 1;
1472  }
1473  case LN_LOGOFF_CANCELED:
1474  {
1475  ERR("Logoff canceled!!, before: exit_in_progress == %s, after will be false\n",
1476  ExitReactOSInProgress ? "true" : "false");
1477 
1479  return 1;
1480  }
1481  default:
1482  {
1483  ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam);
1484  }
1485  }
1486  return 0;
1487  }
1488  case WM_TIMER:
1489  {
1490  if (wParam == 1)
1491  {
1492  KillTimer(hwndDlg, 1);
1493  StartUserShell(Session);
1494  }
1495  break;
1496  }
1497  case WLX_WM_SAS:
1498  {
1499  DispatchSAS(Session, (DWORD)wParam);
1500  return TRUE;
1501  }
1502  }
1503 
1504  return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
1505 }
BOOL UseCtrlAltDelete
Definition: winlogon.h:126
#define MOD_ALT
Definition: imm.h:319
#define EWX_FORCE
Definition: winuser.h:630
#define WLX_SAS_ACTION_SHUTDOWN
Definition: winwlx.h:57
#define WLX_WM_SAS
Definition: winwlx.h:71
#define WLX_SAS_ACTION_LOCK_WKSTA
Definition: winwlx.h:55
struct _WLSESSION * PWLSESSION
#define LN_LOGOFF_CANCELED
Definition: undocuser.h:121
HANDLE hScreenSaverParametersChanged
Definition: winlogon.h:238
BOOL WINAPI HandleMessageBeep(UINT uType)
Definition: sas.c:1273
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define WM_HOTKEY
Definition: winuser.h:1869
HWND SASWindow
Definition: winlogon.h:220
static BOOL RegisterHotKeys(IN PWLSESSION Session, IN HWND hwndSAS)
Definition: sas.c:1238
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
static BOOL UnregisterHotKeys(IN PWLSESSION Session, IN HWND hwndSAS)
Definition: sas.c:1258
static VOID DoGenericAction(IN OUT PWLSESSION Session, IN DWORD wlxAction)
Definition: sas.c:1052
#define EWX_REBOOT
Definition: winuser.h:633
DWORD GetSetupType(VOID)
Definition: setup.c:16
#define VK_ESCAPE
Definition: winuser.h:2204
WPARAM wParam
Definition: combotst.c:138
#define EWX_LOGOFF
Definition: winuser.h:631
#define WM_SETTINGCHANGE
Definition: winuser.h:1619
#define EWX_CALLER_WINLOGON
Definition: undocuser.h:128
#define WLX_SAS_TYPE_SCRNSVR_TIMEOUT
Definition: winwlx.h:37
#define FALSE
Definition: types.h:117
#define EWX_SHUTDOWN
Definition: winuser.h:634
#define LN_LOGOFF
Definition: undocuser.h:114
#define GWLP_USERDATA
Definition: treelist.c:63
#define LN_START_SCREENSAVE
Definition: undocuser.h:120
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define WLX_SAS_ACTION_LOGOFF
Definition: winwlx.h:56
static VOID DispatchSAS(IN OUT PWLSESSION Session, IN DWORD dwSasType)
Definition: sas.c:1142
#define VK_DELETE
Definition: winuser.h:2223
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1599
#define EWX_POWEROFF
Definition: winuser.h:632
GINAINSTANCE Gina
Definition: winlogon.h:216
#define LN_LOCK_WORKSTATION
Definition: undocuser.h:117
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define MOD_SHIFT
Definition: imm.h:321
#define WM_TIMER
Definition: winuser.h:1732
unsigned long DWORD
Definition: ntddk_ex.h:95
static BOOL ExitReactOSInProgress
Definition: sas.c:45
#define SPI_SETSCREENSAVEACTIVE
Definition: winuser.h:1356
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define ERR(fmt,...)
Definition: debug.h:110
static BOOL StartUserShell(IN OUT PWLSESSION Session)
Definition: sas.c:80
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define WLX_SAS_ACTION_TASKLIST
Definition: winwlx.h:59
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1598
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
#define SetWindowLongPtrW
Definition: winuser.h:5336
#define GetWindowLongPtr
Definition: treelist.c:73
#define LN_MESSAGE_BEEP
Definition: undocuser.h:119
#define MOD_CONTROL
Definition: imm.h:320
#define EWX_ACTION_MASK
Definition: sas.c:37
LPARAM lParam
Definition: combotst.c:139
#define SPI_SETSCREENSAVETIMEOUT
Definition: winuser.h:1354
#define LN_SHELL_EXITED
Definition: undocuser.h:115
LOGON_STATE LogonState
Definition: winlogon.h:229

Referenced by InitializeSAS().

◆ SetDefaultLanguage()

BOOL SetDefaultLanguage ( IN PWLSESSION  Session)

Definition at line 111 of file sas.c.

113 {
114  BOOL ret = FALSE;
115  BOOL UserProfile;
116  LONG rc;
117  HKEY UserKey, hKey = NULL;
118  LPCWSTR SubKey, ValueName;
119  DWORD dwType, dwSize;
120  LPWSTR Value = NULL;
121  UNICODE_STRING ValueString;
123  LCID Lcid;
124 
125  UserProfile = (Session && Session->UserToken);
126 
127  if (UserProfile && !ImpersonateLoggedOnUser(Session->UserToken))
128  {
129  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
130  return FALSE;
131  // FIXME: ... or use the default language of the system??
132  // UserProfile = FALSE;
133  }
134 
135  if (UserProfile)
136  {
137  rc = RegOpenCurrentUser(MAXIMUM_ALLOWED, &UserKey);
138  if (rc != ERROR_SUCCESS)
139  {
140  TRACE("RegOpenCurrentUser() failed with error %lu\n", rc);
141  goto cleanup;
142  }
143 
144  SubKey = L"Control Panel\\International";
145  ValueName = L"Locale";
146  }
147  else
148  {
149  UserKey = NULL;
150  SubKey = L"System\\CurrentControlSet\\Control\\Nls\\Language";
151  ValueName = L"Default";
152  }
153 
154  rc = RegOpenKeyExW(UserKey ? UserKey : HKEY_LOCAL_MACHINE,
155  SubKey,
156  0,
157  KEY_READ,
158  &hKey);
159 
160  if (UserKey)
161  RegCloseKey(UserKey);
162 
163  if (rc != ERROR_SUCCESS)
164  {
165  TRACE("RegOpenKeyEx() failed with error %lu\n", rc);
166  goto cleanup;
167  }
168 
169  rc = RegQueryValueExW(hKey,
170  ValueName,
171  NULL,
172  &dwType,
173  NULL,
174  &dwSize);
175  if (rc != ERROR_SUCCESS)
176  {
177  TRACE("RegQueryValueEx() failed with error %lu\n", rc);
178  goto cleanup;
179  }
180  else if (dwType != REG_SZ)
181  {
182  TRACE("Wrong type for %S\\%S registry entry (got 0x%lx, expected 0x%x)\n",
183  SubKey, ValueName, dwType, REG_SZ);
184  goto cleanup;
185  }
186 
188  if (!Value)
189  {
190  TRACE("HeapAlloc() failed\n");
191  goto cleanup;
192  }
193  rc = RegQueryValueExW(hKey,
194  ValueName,
195  NULL,
196  NULL,
197  (LPBYTE)Value,
198  &dwSize);
199  if (rc != ERROR_SUCCESS)
200  {
201  TRACE("RegQueryValueEx() failed with error %lu\n", rc);
202  goto cleanup;
203  }
204 
205  /* Convert Value to a Lcid */
206  ValueString.Length = ValueString.MaximumLength = (USHORT)dwSize;
207  ValueString.Buffer = Value;
208  Status = RtlUnicodeStringToInteger(&ValueString, 16, (PULONG)&Lcid);
209  if (!NT_SUCCESS(Status))
210  {
211  TRACE("RtlUnicodeStringToInteger() failed with status 0x%08lx\n", Status);
212  goto cleanup;
213  }
214 
215  TRACE("%s language is 0x%08lx\n",
216  UserProfile ? "User" : "System", Lcid);
217  Status = NtSetDefaultLocale(UserProfile, Lcid);
218  if (!NT_SUCCESS(Status))
219  {
220  TRACE("NtSetDefaultLocale() failed with status 0x%08lx\n", Status);
221  goto cleanup;
222  }
223 
224  ret = TRUE;
225 
226 cleanup:
227  if (Value)
229 
230  if (hKey)
231  RegCloseKey(hKey);
232 
233  if (UserProfile)
234  RevertToSelf();
235 
236  return ret;
237 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define ERROR_SUCCESS
Definition: deptool.c:10
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2414
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1610
LONG NTSTATUS
Definition: precomp.h:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
DWORD LCID
Definition: nls.h:13
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:203
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
int ret
#define ERR(fmt,...)
Definition: debug.h:110
unsigned short USHORT
Definition: pedump.c:61
FxAutoRegKey hKey
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3232
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToInteger(PUNICODE_STRING String, ULONG Base, PULONG Value)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by HandleLogon(), and InitializeSAS().

◆ ShutdownComputerWindowProc()

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

Definition at line 918 of file sas.c.

923 {
925 
926  switch (uMsg)
927  {
928  case WM_COMMAND:
929  {
930  switch (LOWORD(wParam))
931  {
934  return TRUE;
935  }
936  break;
937  }
938  case WM_INITDIALOG:
939  {
942  return TRUE;
943  }
944  }
945  return FALSE;
946 }
#define MF_BYCOMMAND
Definition: winuser.h:202
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_BTNSHTDOWNCOMPUTER
Definition: resource.h:10
#define WM_COMMAND
Definition: winuser.h:1730
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SC_CLOSE
Definition: winuser.h:2582
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by HandleShutdown().

◆ StartTaskManager()

static BOOL StartTaskManager ( IN OUT PWLSESSION  Session)
static

Definition at line 52 of file sas.c.

54 {
55  LPVOID lpEnvironment;
56  BOOL ret;
57 
58  if (!Session->Gina.Functions.WlxStartApplication)
59  return FALSE;
60 
62  &lpEnvironment,
63  Session->UserToken,
64  TRUE))
65  {
66  return FALSE;
67  }
68 
69  ret = Session->Gina.Functions.WlxStartApplication(
70  Session->Gina.Context,
71  L"Default",
72  lpEnvironment,
73  L"taskmgr.exe");
74 
75  DestroyEnvironmentBlock(lpEnvironment);
76  return ret;
77 }
#define TRUE
Definition: types.h:120
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:505
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
int ret
BOOL WINAPI DestroyEnvironmentBlock(IN LPVOID lpEnvironment)
Definition: environment.c:727

Referenced by DoGenericAction().

◆ StartUserShell()

static BOOL StartUserShell ( IN OUT PWLSESSION  Session)
static

Definition at line 80 of file sas.c.

82 {
83  LPVOID lpEnvironment = NULL;
84  BOOLEAN Old;
85  BOOL ret;
86 
87  /* Create environment block for the user */
88  if (!CreateEnvironmentBlock(&lpEnvironment, Session->UserToken, TRUE))
89  {
90  WARN("WL: CreateEnvironmentBlock() failed\n");
91  return FALSE;
92  }
93 
94  /* Get privilege */
95  /* FIXME: who should do it? winlogon or gina? */
96  /* FIXME: reverting to lower privileges after creating user shell? */
98 
99  ret = Session->Gina.Functions.WlxActivateUserShell(
100  Session->Gina.Context,
101  L"Default",
102  NULL, /* FIXME */
103  lpEnvironment);
104 
105  DestroyEnvironmentBlock(lpEnvironment);
106  return ret;
107 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
BOOL WINAPI CreateEnvironmentBlock(OUT LPVOID *lpEnvironment, IN HANDLE hToken, IN BOOL bInherit)
Definition: environment.c:505
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned char BOOLEAN
int ret
BOOL WINAPI DestroyEnvironmentBlock(IN LPVOID lpEnvironment)
Definition: environment.c:727
#define NULL
Definition: types.h:112
#define SE_ASSIGNPRIMARYTOKEN_PRIVILEGE
Definition: security.c:657

Referenced by HandleLogon(), and SASWindowProc().

◆ UninitializeSAS()

static VOID UninitializeSAS ( IN OUT PWLSESSION  Session)
static

Definition at line 950 of file sas.c.

952 {
953  if (Session->SASWindow)
954  {
955  DestroyWindow(Session->SASWindow);
956  Session->SASWindow = NULL;
957  }
958  if (Session->hEndOfScreenSaverThread)
959  SetEvent(Session->hEndOfScreenSaverThread);
961 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WINLOGON_SAS_CLASS
Definition: sas.c:26
#define NULL
Definition: types.h:112
HINSTANCE hAppInstance
Definition: mmc.c:23

Referenced by HandleShutdown(), and InitializeSAS().

◆ UnregisterHotKeys()

static BOOL UnregisterHotKeys ( IN PWLSESSION  Session,
IN HWND  hwndSAS 
)
static

Definition at line 1258 of file sas.c.

1261 {
1262  /* Unregister hotkeys */
1264 
1265  if (Session->TaskManHotkey)
1267 
1268  return TRUE;
1269 }
#define HK_CTRL_ALT_DEL
Definition: sas.c:29
#define TRUE
Definition: types.h:120
BOOL WINAPI UnregisterHotKey(_In_opt_ HWND, _In_ int)
HWND hwndSAS
Definition: winsta.c:24
#define HK_CTRL_SHIFT_ESC
Definition: sas.c:30

Referenced by SASWindowProc().

Variable Documentation

◆ ExitReactOSInProgress

BOOL ExitReactOSInProgress = FALSE
static

Definition at line 45 of file sas.c.

Referenced by LogoffShutdownThread(), and SASWindowProc().

◆ LuidNone

LUID LuidNone = {0, 0}