ReactOS  0.4.10-dev-479-g13a3cf0
winlogon.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winuser.h>
#include <winreg.h>
#include <winwlx.h>
#include <ndk/rtlfuncs.h>
#include <ndk/exfuncs.h>
#include <strsafe.h>
#include <reactos/undocuser.h>
#include <wine/debug.h>
#include "resource.h"
Include dependency graph for winlogon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GINAFUNCTIONS
 
struct  _GINAINSTANCE
 
struct  _WLSESSION
 

Macros

#define USE_GETLASTINPUTINFO
 
#define WIN32_NO_STATUS
 
#define LockWorkstation(Session)
 
#define UnlockWorkstation(Session)
 
#define WLX_SHUTTINGDOWN(Status)
 
#define WLX_SUSPENDING(Status)
 

Typedefs

typedef DWORD *typedef BOOL (WINAPI *PFWLXINITIALIZE)(LPWSTR
 
typedef DWORD *typedef HANDLE
 
typedef DWORD *typedef PVOID
 
typedef DWORD *typedef PVOID
*typedef 
VOID (WINAPI *PFWLXDISPLAYSASNOTICE)(PVOID)
 
typedef PVOID *typedef PWSTR
 
typedef DWORD DWORD
 
typedef struct _GINAFUNCTIONS GINAFUNCTIONS
 
typedef struct _GINAFUNCTIONSPGINAFUNCTIONS
 
typedef struct _GINAINSTANCE GINAINSTANCE
 
typedef struct _GINAINSTANCEPGINAINSTANCE
 
typedef enum _LOGON_STATE LOGON_STATE
 
typedef enum _LOGON_STATEPLOGON_STATE
 
typedef struct _WLSESSION WLSESSION
 
typedef struct _WLSESSIONPWLSESSION
 
typedef enum _NOTIFICATION_TYPE NOTIFICATION_TYPE
 
typedef enum _NOTIFICATION_TYPEPNOTIFICATION_TYPE
 

Enumerations

enum  _LOGON_STATE {
  STATE_INIT, STATE_LOGGED_OFF, STATE_LOGGED_OFF_SAS, STATE_LOGGED_ON,
  STATE_LOGGED_ON_SAS, STATE_LOCKED, STATE_LOCKED_SAS, STATE_LOGGING_OFF,
  STATE_SHUTTING_DOWN, STATE_SHUT_DOWN, STATE_SCREENSAVER
}
 
enum  _NOTIFICATION_TYPE {
  LogonHandler, LogoffHandler, LockHandler, UnlockHandler,
  StartupHandler, ShutdownHandler, StartScreenSaverHandler, StopScreenSaverHandler,
  DisconnectHandler, ReconnectHandler, StartShellHandler, PostShellHandler,
  LastHandler
}
 

Functions

BOOL WINAPI SetWindowStationUser (IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
 
 WINE_DEFAULT_DEBUG_CHANNEL (winlogon)
 
typedef BOOL (WINAPI *PFWLXNEGOTIATE)(DWORD
 
typedef int (WINAPI *PFWLXLOGGEDOUTSAS)(PVOID
 
typedef VOID (WINAPI *PFWLXDISPLAYLOCKEDNOTICE)(PVOID)
 
BOOL CreateUserEnvironment (IN PWLSESSION Session)
 
BOOL InitNotifications (VOID)
 
VOID CleanupNotifications (VOID)
 
VOID CallNotificationDlls (PWLSESSION pSession, NOTIFICATION_TYPE Type)
 
BOOL StartRpcServer (VOID)
 
BOOL SetDefaultLanguage (IN PWLSESSION Session)
 
NTSTATUS HandleShutdown (IN OUT PWLSESSION Session, IN DWORD wlxAction)
 
BOOL InitializeSAS (IN OUT PWLSESSION Session)
 
BOOL InitializeScreenSaver (IN OUT PWLSESSION Session)
 
VOID StartScreenSaver (IN PWLSESSION Session)
 
DWORD GetSetupType (VOID)
 
BOOL RunSetup (VOID)
 
DWORD TerminateSystemShutdown (VOID)
 
DWORD StartSystemShutdown (PUNICODE_STRING lpMessage, ULONG dwTimeout, BOOLEAN bForceAppsClosed, BOOLEAN bRebootAfterShutdown, ULONG dwReason)
 
BOOL PlaySoundRoutine (IN LPCWSTR FileName, IN UINT Logon, IN UINT Flags)
 
BOOL DisplayStatusMessage (IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
 
BOOL RemoveStatusMessage (IN PWLSESSION Session)
 
VOID InitDialogListHead (VOID)
 
VOID CloseAllDialogWindows (VOID)
 
BOOL GinaInit (IN OUT PWLSESSION Session)
 
BOOL AddAceToWindowStation (IN HWINSTA WinSta, IN PSID Sid)
 
BOOL CreateWindowStationAndDesktops (IN OUT PWLSESSION Session)
 
VOID WINAPI WlxUseCtrlAltDel (HANDLE hWlx)
 
VOID WINAPI WlxSetContextPointer (HANDLE hWlx, PVOID pWlxContext)
 
VOID WINAPI WlxSasNotify (HANDLE hWlx, DWORD dwSasType)
 
BOOL WINAPI WlxSetTimeout (HANDLE hWlx, DWORD Timeout)
 
int WINAPI WlxAssignShellProtection (HANDLE hWlx, HANDLE hToken, HANDLE hProcess, HANDLE hThread)
 
int WINAPI WlxMessageBox (HANDLE hWlx, HWND hwndOwner, LPWSTR lpszText, LPWSTR lpszTitle, UINT fuStyle)
 
int WINAPI WlxDialogBox (HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc)
 
int WINAPI WlxDialogBoxParam (HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam)
 
int WINAPI WlxDialogBoxIndirect (HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc)
 
int WINAPI WlxDialogBoxIndirectParam (HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam)
 
int WINAPI WlxSwitchDesktopToUser (HANDLE hWlx)
 
int WINAPI WlxSwitchDesktopToWinlogon (HANDLE hWlx)
 
int WINAPI WlxChangePasswordNotify (HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo)
 
BOOL WINAPI WlxGetSourceDesktop (HANDLE hWlx, PWLX_DESKTOP *ppDesktop)
 
BOOL WINAPI WlxSetReturnDesktop (HANDLE hWlx, PWLX_DESKTOP pDesktop)
 
BOOL WINAPI WlxCreateUserDesktop (HANDLE hWlx, HANDLE hToken, DWORD Flags, PWSTR pszDesktopName, PWLX_DESKTOP *ppDesktop)
 
int WINAPI WlxChangePasswordNotifyEx (HANDLE hWlx, PWLX_MPR_NOTIFY_INFO pMprInfo, DWORD dwChangeInfo, PWSTR ProviderName, PVOID Reserved)
 
BOOL WINAPI WlxCloseUserDesktop (HANDLE hWlx, PWLX_DESKTOP pDesktop, HANDLE hToken)
 
BOOL WINAPI WlxSetOption (HANDLE hWlx, DWORD Option, ULONG_PTR Value, ULONG_PTR *OldValue)
 
BOOL WINAPI WlxGetOption (HANDLE hWlx, DWORD Option, ULONG_PTR *Value)
 
VOID WINAPI WlxWin31Migrate (HANDLE hWlx)
 
BOOL WINAPI WlxQueryClientCredentials (PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred)
 
BOOL WINAPI WlxQueryInetConnectorCredentials (PWLX_CLIENT_CREDENTIALS_INFO_V1_0 pCred)
 
DWORD WINAPI WlxQueryConsoleSwitchCredentials (PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0 pCred)
 
BOOL WINAPI WlxQueryTsLogonCredentials (PWLX_CLIENT_CREDENTIALS_INFO_V2_0 pCred)
 
BOOL WINAPI WlxDisconnect (VOID)
 
DWORD WINAPI WlxQueryTerminalServicesData (HANDLE hWlx, PWLX_TERMINAL_SERVICES_DATA pTSData, WCHAR *UserName, WCHAR *Domain)
 

Variables

typedef PLUID
 
typedef PSID
 
typedef PDWORD
 
typedef PHANDLE
 
typedef PWLX_MPR_NOTIFY_INFO
 
typedef HDESK
 
HINSTANCE hAppInstance
 
PWLSESSION WLSession
 
LUID LuidNone
 

Macro Definition Documentation

#define LockWorkstation (   Session)

Definition at line 210 of file winlogon.h.

Referenced by WinMain().

#define UnlockWorkstation (   Session)

Definition at line 211 of file winlogon.h.

#define USE_GETLASTINPUTINFO

Definition at line 31 of file winlogon.h.

#define WIN32_NO_STATUS

Definition at line 33 of file winlogon.h.

#define WLX_SHUTTINGDOWN (   Status)
Value:
)
#define WLX_SAS_ACTION_SHUTDOWN
Definition: winwlx.h:57
#define WLX_SAS_ACTION_SHUTDOWN_POWER_OFF
Definition: winwlx.h:62
Status
Definition: gdiplustypes.h:24
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63

Definition at line 270 of file winlogon.h.

Referenced by DoGenericAction().

#define WLX_SUSPENDING (   Status)
Value:
)
#define WLX_SAS_ACTION_SHUTDOWN_HIBERNATE
Definition: winwlx.h:66
#define WLX_SAS_ACTION_SHUTDOWN_SLEEP2
Definition: winwlx.h:65
Status
Definition: gdiplustypes.h:24
#define WLX_SAS_ACTION_SHUTDOWN_SLEEP
Definition: winwlx.h:64

Definition at line 276 of file winlogon.h.

Typedef Documentation

typedef CONST PIXELFORMATDESCRIPTOR *typedef CONST PIXELFORMATDESCRIPTOR *typedef BOOL(WINAPI *SWAPBUFFERS)(HDC hdc)

Definition at line 60 of file winlogon.h.

typedef DWORD

Definition at line 83 of file winlogon.h.

typedef HANDLE

Definition at line 60 of file winlogon.h.

typedef PVOID

Definition at line 60 of file winlogon.h.

static PWSTR

Definition at line 65 of file winlogon.h.

typedef VOID

Definition at line 61 of file winlogon.h.

Enumeration Type Documentation

Enumerator
STATE_INIT 
STATE_LOGGED_OFF 
STATE_LOGGED_OFF_SAS 
STATE_LOGGED_ON 
STATE_LOGGED_ON_SAS 
STATE_LOCKED 
STATE_LOCKED_SAS 
STATE_LOGGING_OFF 
STATE_SHUTTING_DOWN 
STATE_SHUT_DOWN 
STATE_SCREENSAVER 

Definition at line 195 of file winlogon.h.

196 {
197  STATE_INIT,
202  STATE_LOCKED,
204  STATE_LOGGING_OFF, // not used yet
205  STATE_SHUTTING_DOWN, // not used yet
206  STATE_SHUT_DOWN, // not used yet
207  STATE_SCREENSAVER // not used yet
enum _LOGON_STATE LOGON_STATE
enum _LOGON_STATE * PLOGON_STATE
Enumerator
LogonHandler 
LogoffHandler 
LockHandler 
UnlockHandler 
StartupHandler 
ShutdownHandler 
StartScreenSaverHandler 
StopScreenSaverHandler 
DisconnectHandler 
ReconnectHandler 
StartShellHandler 
PostShellHandler 
LastHandler 

Definition at line 250 of file winlogon.h.

Function Documentation

BOOL AddAceToWindowStation ( IN HWINSTA  WinSta,
IN PSID  Sid 
)

Definition at line 942 of file wlx.c.

Referenced by AllowWinstaAccess().

945 {
946  DWORD AclSize;
948  PACL pDefaultAcl = NULL;
949  PSECURITY_DESCRIPTOR WinstaSd = NULL;
951  BOOL Ret = FALSE;
952 
953  /* Allocate space for an ACL */
954  AclSize = sizeof(ACL)
955  + 2 * (FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + GetLengthSid(Sid));
956  pDefaultAcl = HeapAlloc(GetProcessHeap(), 0, AclSize);
957  if (!pDefaultAcl)
958  {
959  ERR("WL: HeapAlloc() failed\n");
960  goto cleanup;
961  }
962 
963  /* Initialize it */
964  if (!InitializeAcl(pDefaultAcl, AclSize, ACL_REVISION))
965  {
966  ERR("WL: InitializeAcl() failed (error %lu)\n", GetLastError());
967  goto cleanup;
968  }
969 
970  /* Initialize new security descriptor */
973  {
974  ERR("WL: InitializeSecurityDescriptor() failed (error %lu)\n", GetLastError());
975  goto cleanup;
976  }
977 
978  /* Allocate memory for access allowed ACE */
980  GetLengthSid(Sid) - sizeof(DWORD));
981 
982  /* Create the first ACE for the window station */
985  Ace->Header.AceSize = sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(Sid) - sizeof(DWORD);
986  Ace->Mask = GENERIC_ACCESS;
987 
988  /* Copy the sid */
989  if (!CopySid(GetLengthSid(Sid), &Ace->SidStart, Sid))
990  {
991  ERR("WL: CopySid() failed (error %lu)\n", GetLastError());
992  goto cleanup;
993  }
994 
995  /* Add the first ACE */
996  if (!AddAce(pDefaultAcl, ACL_REVISION, MAXDWORD, (LPVOID)Ace, Ace->Header.AceSize))
997  {
998  ERR("WL: AddAce() failed (error %lu)\n", GetLastError());
999  goto cleanup;
1000  }
1001 
1002  /* Add the second ACE to the end of ACL */
1003  Ace->Header.AceFlags = NO_PROPAGATE_INHERIT_ACE;
1004  Ace->Mask = WINSTA_ALL;
1005  if (!AddAce(pDefaultAcl, ACL_REVISION, MAXDWORD, (LPVOID)Ace, Ace->Header.AceSize))
1006  {
1007  ERR("WL: AddAce() failed (error %lu)\n", GetLastError());
1008  goto cleanup;
1009  }
1010 
1011  /* Add ACL to winsta's security descriptor */
1012  if (!SetSecurityDescriptorDacl(WinstaSd, TRUE, pDefaultAcl, FALSE))
1013  {
1014  ERR("WL: SetSecurityDescriptorDacl() failed (error %lu)\n", GetLastError());
1015  goto cleanup;
1016  }
1017 
1018  /* Apply security to the window station */
1019  SecurityInformation = DACL_SECURITY_INFORMATION;
1020  if (!SetUserObjectSecurity(WinSta, &SecurityInformation, WinstaSd))
1021  {
1022  ERR("WL: SetUserObjectSecurity() failed (error %lu)\n", GetLastError());
1023  goto cleanup;
1024  }
1025 
1026  /* Indicate success */
1027  Ret = TRUE;
1028 
1029 cleanup:
1030  /* Free allocated stuff */
1031  if (pDefaultAcl) HeapFree(GetProcessHeap(), 0, pDefaultAcl);
1032  if (WinstaSd) HeapFree(GetProcessHeap(), 0, WinstaSd);
1033  if (Ace) HeapFree(GetProcessHeap(), 0, Ace);
1034 
1035  return Ret;
1036 }
UCHAR AceFlags
Definition: ms-dtyp.idl:211
#define TRUE
Definition: types.h:120
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
Definition: security.c:881
#define SECURITY_DESCRIPTOR_MIN_LENGTH
Definition: setypes.h:761
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:804
#define GENERIC_ACCESS
Definition: wlx.c:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
struct _ACCESS_ALLOWED_ACE ACCESS_ALLOWED_ACE
#define NO_PROPAGATE_INHERIT_ACE
Definition: setypes.h:716
ACE_HEADER Header
Definition: ms-dtyp.idl:216
#define DWORD
Definition: msvc.h:34
DWORD DWORD
Definition: winlogon.h:83
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
USHORT AceSize
Definition: ms-dtyp.idl:212
#define FALSE
Definition: types.h:117
DWORD SECURITY_INFORMATION
Definition: ms-dtyp.idl:311
Definition: card.h:12
struct _ACL ACL
smooth NULL
Definition: ftsmooth.c:416
#define MAXDWORD
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
Definition: rtlfuncs.h:1104
BOOL WINAPI SetUserObjectSecurity(_In_ HANDLE, _In_ PSECURITY_INFORMATION, _In_ PSECURITY_DESCRIPTOR)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ SECURITY_INFORMATION SecurityInformation
Definition: fltkernel.h:1339
#define CONTAINER_INHERIT_ACE
Definition: setypes.h:715
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:794
#define ACCESS_ALLOWED_ACE_TYPE
Definition: setypes.h:685
UCHAR AceType
Definition: ms-dtyp.idl:210
#define ERR(fmt,...)
Definition: debug.h:109
ACCESS_MASK Mask
Definition: ms-dtyp.idl:217
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
BOOL WINAPI AddAce(PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength)
Definition: security.c:1016
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define ACL_REVISION
Definition: setypes.h:39
char * cleanup(char *str)
Definition: wpickclick.c:99
#define INHERIT_ONLY_ACE
Definition: setypes.h:717
#define WINSTA_ALL
Definition: wlx.c:20
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
Definition: security.c:587
#define HeapFree(x, y, z)
Definition: compat.h:394
#define OBJECT_INHERIT_ACE
Definition: setypes.h:714
#define DACL_SECURITY_INFORMATION
Definition: setypes.h:125
typedef BOOL ( WINAPI PFWLXNEGOTIATE)
VOID CallNotificationDlls ( PWLSESSION  pSession,
NOTIFICATION_TYPE  Type 
)

Definition at line 249 of file notify.c.

Referenced by DoGenericAction(), HandleLogoff(), HandleLogon(), HandleShutdown(), StartScreenSaver(), and WinMain().

252 {
253  PLIST_ENTRY ListEntry;
254  PNOTIFICATION_ITEM NotificationDll;
256 
257  TRACE("CallNotificationDlls()\n");
258 
259  Info.Size = sizeof(WLX_NOTIFICATION_INFO);
260 
261  switch (Type)
262  {
263  case LogoffHandler:
264  case ShutdownHandler:
265  Info.Flags = 3;
266  break;
267 
268  default:
269  Info.Flags = 0;
270  break;
271  }
272 
273  Info.UserName = NULL; //UserName;
274  Info.Domain = NULL; //Domain;
276  Info.hToken = pSession->UserToken;
277 
278  switch (Type)
279  {
280  case LogonHandler:
281  case StartShellHandler:
282  Info.hDesktop = pSession->ApplicationDesktop;
283  break;
284 
286  Info.hDesktop = pSession->ApplicationDesktop;
287  break;
288 
289  default:
290  Info.hDesktop = pSession->WinlogonDesktop;
291  break;
292  }
293 
294  Info.pStatusCallback = NULL;
295 
296  ListEntry = NotificationDllListHead.Flink;
297  while (ListEntry != &NotificationDllListHead)
298  {
299 TRACE("ListEntry %p\n", ListEntry);
300 
301  NotificationDll = CONTAINING_RECORD(ListEntry,
303  ListEntry);
304 TRACE("NotificationDll: %p\n", NotificationDll);
305  if (NotificationDll != NULL && NotificationDll->bEnabled)
306  {
307 TRACE("NotificationDll->Handler: %p\n", NotificationDll->Handler[Type]);
308  if (NotificationDll->Handler[Type] != NULL)
309  NotificationDll->Handler[Type](&Info);
310  }
311 
312  ListEntry = ListEntry->Flink;
313  }
314 }
PWLX_NOTIFY_HANDLER Handler[LastHandler]
Definition: notify.c:46
Type
Definition: Type.h:6
HDESK WinlogonDesktop
Definition: winlogon.h:223
HANDLE UserToken
Definition: winlogon.h:226
static LIST_ENTRY NotificationDllListHead
Definition: notify.c:50
HDESK ApplicationDesktop
Definition: winlogon.h:222
struct TraceInfo Info
PFNMSGECALLBACK pStatusCallback
Definition: winwlx.h:629
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR InteractiveWindowStationName
Definition: winlogon.h:221
Definition: typedefs.h:117
struct _WLX_NOTIFICATION_INFO WLX_NOTIFICATION_INFO
VOID CleanupNotifications ( VOID  )

Definition at line 318 of file notify.c.

Referenced by WinMain().

319 {
320  PLIST_ENTRY ListEntry;
321  PNOTIFICATION_ITEM NotificationDll;
322 
323  ListEntry = NotificationDllListHead.Flink;
324  while (ListEntry != &NotificationDllListHead)
325  {
326  NotificationDll = CONTAINING_RECORD(ListEntry,
328  ListEntry);
329  if (NotificationDll != NULL)
330  {
331  FreeLibrary(NotificationDll->hInstance);
332  }
333 
334  ListEntry = ListEntry->Flink;
335 
336  RemoveEntryList(&NotificationDll->ListEntry);
337 
338  RtlFreeHeap(RtlGetProcessHeap(), 0, NotificationDll);
339  }
340 }
HINSTANCE hInstance
Definition: notify.c:39
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
static LIST_ENTRY NotificationDllListHead
Definition: notify.c:50
LIST_ENTRY ListEntry
Definition: notify.c:37
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define FreeLibrary(x)
Definition: compat.h:405
Definition: typedefs.h:117
VOID CloseAllDialogWindows ( VOID  )

Definition at line 109 of file wlx.c.

Referenced by DispatchSAS().

110 {
111  PDIALOG_LIST_ENTRY Current;
112  PLIST_ENTRY ListEntry;
113 
114  ListEntry = DialogListHead.Flink;
115  while (ListEntry != &DialogListHead)
116  {
117  Current = CONTAINING_RECORD(ListEntry,
119  Entry);
120 
121  PostMessage(Current->hWnd, WLX_WM_SAS, 0, 0);
122 
123  ListEntry = ListEntry->Flink;
124  }
125 }
#define WLX_WM_SAS
Definition: winwlx.h:71
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define PostMessage
Definition: winuser.h:5693
static LIST_ENTRY DialogListHead
Definition: wlx.c:40
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
HWND hWnd
Definition: wlx.c:32
Definition: typedefs.h:117
Definition: wlx.c:29
base of all file and directory entries
Definition: entries.h:82
BOOL CreateUserEnvironment ( IN PWLSESSION  Session)

Definition at line 128 of file environment.c.

Referenced by HandleLogon().

130 {
131  HKEY hKeyCurrentUser;
132  LONG lError;
133 
134  TRACE("WL: CreateUserEnvironment called\n");
135 
136  /* Impersonate the new user */
137  if (!ImpersonateLoggedOnUser(Session->UserToken))
138  {
139  ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
140  return FALSE;
141  }
142 
143  /* Open the new user HKCU key */
145  &hKeyCurrentUser);
146  if (lError == ERROR_SUCCESS)
147  {
148  BuildVolatileEnvironment(Session,
149  hKeyCurrentUser);
150  RegCloseKey(hKeyCurrentUser);
151  }
152 
153  /* Revert the impersonation */
154  RevertToSelf();
155 
156  TRACE("WL: CreateUserEnvironment done\n");
157 
158  return TRUE;
159 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1483
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
static VOID BuildVolatileEnvironment(IN PWLSESSION Session, IN HKEY hKeyCurrentUser)
Definition: environment.c:19
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
#define TRACE(s)
Definition: solgame.cpp:4
HANDLE HKEY
Definition: registry.h:24
#define ERR(fmt,...)
Definition: debug.h:109
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3247
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
BOOL CreateWindowStationAndDesktops ( IN OUT PWLSESSION  Session)

Definition at line 1121 of file wlx.c.

Referenced by WinMain().

1123 {
1124  BYTE LocalSystemBuffer[SECURITY_MAX_SID_SIZE];
1125  BYTE InteractiveBuffer[SECURITY_MAX_SID_SIZE];
1126  PSID pLocalSystemSid = (PSID)&LocalSystemBuffer;
1127  PSID pInteractiveSid = (PSID)InteractiveBuffer;
1128  DWORD SidSize, AclSize;
1129  PACL pDefaultAcl = NULL;
1130  PACL pUserDesktopAcl = NULL;
1131  SECURITY_DESCRIPTOR DefaultSecurityDescriptor;
1132  SECURITY_ATTRIBUTES DefaultSecurity;
1133  SECURITY_DESCRIPTOR UserDesktopSecurityDescriptor;
1134  SECURITY_ATTRIBUTES UserDesktopSecurity;
1135  BOOL ret = FALSE;
1136 
1137  /*
1138  * Prepare information for ACLs we will apply
1139  */
1140  SidSize = SECURITY_MAX_SID_SIZE;
1141  if (!CreateWellKnownSid(WinLocalSystemSid, NULL, pLocalSystemSid, &SidSize))
1142  {
1143  ERR("WL: CreateWellKnownSid() failed (error %lu)\n", GetLastError());
1144  goto cleanup;
1145  }
1146  SidSize = SECURITY_MAX_SID_SIZE;
1147  if (!CreateWellKnownSid(WinInteractiveSid, NULL, pInteractiveSid, &SidSize))
1148  {
1149  ERR("WL: CreateWellKnownSid() failed (error %lu)\n", GetLastError());
1150  goto cleanup;
1151  }
1152 
1153  AclSize = sizeof(ACL)
1154  + FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + GetLengthSid(pLocalSystemSid)
1155  + FIELD_OFFSET(ACCESS_ALLOWED_ACE, SidStart) + GetLengthSid(pInteractiveSid);
1156  pDefaultAcl = HeapAlloc(GetProcessHeap(), 0, AclSize);
1157  pUserDesktopAcl = HeapAlloc(GetProcessHeap(), 0, AclSize);
1158  if (!pDefaultAcl || !pUserDesktopAcl)
1159  {
1160  ERR("WL: HeapAlloc() failed\n");
1161  goto cleanup;
1162  }
1163 
1164  if (!InitializeAcl(pDefaultAcl, AclSize, ACL_REVISION)
1165  || !InitializeAcl(pUserDesktopAcl, AclSize, ACL_REVISION))
1166  {
1167  ERR("WL: InitializeAcl() failed (error %lu)\n", GetLastError());
1168  goto cleanup;
1169  }
1170 
1171  /*
1172  * Create default ACL (window station, winlogon desktop, screen saver desktop)
1173  */
1174  if (!AddAccessAllowedAce(pDefaultAcl, ACL_REVISION, GENERIC_ALL, pLocalSystemSid)
1175  || !AddAccessAllowedAce(pDefaultAcl, ACL_REVISION, GENERIC_READ, pInteractiveSid))
1176  {
1177  ERR("WL: AddAccessAllowedAce() failed (error %lu)\n", GetLastError());
1178  goto cleanup;
1179  }
1180 
1181  /*
1182  * Create the default security descriptor
1183  */
1184  if (!InitializeSecurityDescriptor(&DefaultSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
1185  {
1186  ERR("WL: InitializeSecurityDescriptor() failed (error %lu)\n", GetLastError());
1187  goto cleanup;
1188  }
1189 
1190  if (!SetSecurityDescriptorDacl(&DefaultSecurityDescriptor, TRUE, pDefaultAcl, FALSE))
1191  {
1192  ERR("WL: SetSecurityDescriptorDacl() failed (error %lu)\n", GetLastError());
1193  goto cleanup;
1194  }
1195 
1196  DefaultSecurity.nLength = sizeof(SECURITY_ATTRIBUTES);
1197  DefaultSecurity.lpSecurityDescriptor = &DefaultSecurityDescriptor;
1198  DefaultSecurity.bInheritHandle = TRUE;
1199 
1200  /*
1201  * Create user desktop ACL
1202  */
1203  if (!AddAccessAllowedAce(pUserDesktopAcl, ACL_REVISION, GENERIC_ALL, pLocalSystemSid)
1204  || !AddAccessAllowedAce(pUserDesktopAcl, ACL_REVISION, GENERIC_ALL, pInteractiveSid))
1205  {
1206  ERR("WL: AddAccessAllowedAce() failed (error %lu)\n", GetLastError());
1207  goto cleanup;
1208  }
1209 
1210  /*
1211  * Create the user desktop security descriptor
1212  */
1213  if (!InitializeSecurityDescriptor(&UserDesktopSecurityDescriptor, SECURITY_DESCRIPTOR_REVISION))
1214  {
1215  ERR("WL: InitializeSecurityDescriptor() failed (error %lu)\n", GetLastError());
1216  goto cleanup;
1217  }
1218 
1219  if (!SetSecurityDescriptorDacl(&UserDesktopSecurityDescriptor, TRUE, pUserDesktopAcl, FALSE))
1220  {
1221  ERR("WL: SetSecurityDescriptorDacl() failed (error %lu)\n", GetLastError());
1222  goto cleanup;
1223  }
1224 
1225  UserDesktopSecurity.nLength = sizeof(SECURITY_ATTRIBUTES);
1226  UserDesktopSecurity.lpSecurityDescriptor = &UserDesktopSecurityDescriptor;
1227  UserDesktopSecurity.bInheritHandle = TRUE;
1228 
1229  /*
1230  * Create the interactive window station
1231  */
1232  Session->InteractiveWindowStationName = L"WinSta0";
1233  Session->InteractiveWindowStation = CreateWindowStationW(
1234  Session->InteractiveWindowStationName,
1235  0,
1237  &DefaultSecurity);
1238  if (!Session->InteractiveWindowStation)
1239  {
1240  ERR("WL: Failed to create window station (%lu)\n", GetLastError());
1241  goto cleanup;
1242  }
1243  if (!SetProcessWindowStation(Session->InteractiveWindowStation))
1244  {
1245  ERR("WL: SetProcessWindowStation() failed (error %lu)\n", GetLastError());
1246  goto cleanup;
1247  }
1248 
1249  /*
1250  * Create the application desktop
1251  */
1252  Session->ApplicationDesktop = CreateDesktopW(
1253  L"Default",
1254  NULL,
1255  NULL,
1256  0, /* FIXME: Add DF_ALLOWOTHERACCOUNTHOOK flag? */
1258  &UserDesktopSecurity);
1259  if (!Session->ApplicationDesktop)
1260  {
1261  ERR("WL: Failed to create Default desktop (%lu)\n", GetLastError());
1262  goto cleanup;
1263  }
1264 
1265  /*
1266  * Create the winlogon desktop
1267  */
1268  Session->WinlogonDesktop = CreateDesktopW(
1269  L"Winlogon",
1270  NULL,
1271  NULL,
1272  0,
1274  &DefaultSecurity); // FIXME: Must use restricted Winlogon-only security!!
1275  if (!Session->WinlogonDesktop)
1276  {
1277  ERR("WL: Failed to create Winlogon desktop (%lu)\n", GetLastError());
1278  goto cleanup;
1279  }
1280 
1281  /*
1282  * Create the screen saver desktop
1283  */
1284  Session->ScreenSaverDesktop = CreateDesktopW(
1285  L"Screen-Saver",
1286  NULL,
1287  NULL,
1288  0,
1290  &DefaultSecurity);
1291  if(!Session->ScreenSaverDesktop)
1292  {
1293  ERR("WL: Failed to create Screen-Saver desktop (%lu)\n", GetLastError());
1294  goto cleanup;
1295  }
1296 
1297  /*
1298  * Switch to winlogon desktop
1299  */
1300  if (!SetThreadDesktop(Session->WinlogonDesktop) ||
1301  !SwitchDesktop(Session->WinlogonDesktop))
1302  {
1303  ERR("WL: Cannot switch to Winlogon desktop (%lu)\n", GetLastError());
1304  goto cleanup;
1305  }
1306 
1307  SetWindowStationUser(Session->InteractiveWindowStation,
1308  &LuidNone, NULL, 0);
1309 
1310  ret = TRUE;
1311 
1312 cleanup:
1313  if (!ret)
1314  {
1315  if (Session->ApplicationDesktop)
1316  {
1317  CloseDesktop(Session->ApplicationDesktop);
1318  Session->ApplicationDesktop = NULL;
1319  }
1320  if (Session->WinlogonDesktop)
1321  {
1322  CloseDesktop(Session->WinlogonDesktop);
1323  Session->WinlogonDesktop = NULL;
1324  }
1325  if (Session->ScreenSaverDesktop)
1326  {
1327  CloseDesktop(Session->ScreenSaverDesktop);
1328  Session->ScreenSaverDesktop = NULL;
1329  }
1330  if (Session->InteractiveWindowStation)
1331  {
1332  CloseWindowStation(Session->InteractiveWindowStation);
1333  Session->InteractiveWindowStation = NULL;
1334  }
1335  }
1336  HeapFree(GetProcessHeap(), 0, pDefaultAcl);
1337  HeapFree(GetProcessHeap(), 0, pUserDesktopAcl);
1338  return ret;
1339 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define GENERIC_ALL
Definition: nt_native.h:92
BOOL WINAPI SetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
Definition: winsta.c:400
#define TRUE
Definition: types.h:120
#define SECURITY_MAX_SID_SIZE
Definition: setypes.h:458
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
Definition: security.c:881
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:804
BOOL WINAPI AddAccessAllowedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
Definition: security.c:914
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetProcessWindowStation(_In_ HWINSTA)
LUID LuidNone
Definition: sas.c:46
DWORD DWORD
Definition: winlogon.h:83
BOOL WINAPI SetThreadDesktop(_In_ HDESK)
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define FALSE
Definition: types.h:117
struct _ACL ACL
smooth NULL
Definition: ftsmooth.c:416
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI GetLengthSid(PSID pSid)
Definition: security.c:794
BOOL WINAPI SwitchDesktop(_In_ HDESK)
struct _SID * PSID
Definition: eventlog.c:35
int ret
static const WCHAR L[]
Definition: oid.c:1087
#define GENERIC_READ
Definition: compat.h:124
unsigned char BYTE
Definition: ntddk_ex.h:96
#define ERR(fmt,...)
Definition: debug.h:109
static PSID pLocalSystemSid
Definition: security.c:17
LPVOID lpSecurityDescriptor
Definition: compat.h:181
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
#define ACL_REVISION
Definition: setypes.h:39
HWINSTA WINAPI CreateWindowStationW(_In_opt_ LPCWSTR lpwinsta, _In_ DWORD dwFlags, _In_ ACCESS_MASK dwDesiredAccess, _In_opt_ LPSECURITY_ATTRIBUTES lpsa)
BOOL WINAPI CloseDesktop(_In_ HDESK)
char * cleanup(char *str)
Definition: wpickclick.c:99
HDESK WINAPI CreateDesktopW(LPCWSTR lpszDesktop, LPCWSTR lpszDevice, LPDEVMODEW pDevmode, DWORD dwFlags, ACCESS_MASK dwDesiredAccess, LPSECURITY_ATTRIBUTES lpsa)
Definition: desktop.c:473
BOOL WINAPI CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType, IN PSID DomainSid OPTIONAL, OUT PSID pSid, IN OUT DWORD *cbSid)
Definition: security.c:597
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL WINAPI CloseWindowStation(_In_ HWINSTA)
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
BOOL DisplayStatusMessage ( IN PWLSESSION  Session,
IN HDESK  hDesktop,
IN UINT  ResourceId 
)

Definition at line 216 of file winlogon.c.

Referenced by HandleLogoff(), HandleLogon(), HandleShutdown(), and WinMain().

220 {
221  WCHAR StatusMsg[MAX_PATH];
222 
223  if (Session->Gina.Version < WLX_VERSION_1_3)
224  return TRUE;
225 
226  if (Session->SuppressStatus)
227  return TRUE;
228 
229  if (LoadStringW(hAppInstance, ResourceId, StatusMsg, MAX_PATH) == 0)
230  return FALSE;
231 
232  return Session->Gina.Functions.WlxDisplayStatusMessage(Session->Gina.Context, hDesktop, 0, NULL, StatusMsg);
233 }
#define TRUE
Definition: types.h:120
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define FALSE
Definition: types.h:117
HINSTANCE hAppInstance
Definition: winlogon.c:19
smooth NULL
Definition: ftsmooth.c:416
#define MAX_PATH
Definition: compat.h:26
#define WLX_VERSION_1_3
Definition: winwlx.h:31
DWORD GetSetupType ( VOID  )

Definition at line 16 of file setup.c.

Referenced by SASWindowProc(), and WinMain().

17 {
18  DWORD dwError;
19  HKEY hKey;
20  DWORD dwType;
21  DWORD dwSize;
22  DWORD dwSetupType;
23 
24  TRACE("GetSetupType()\n");
25 
26  /* Open key */
28  L"SYSTEM\\Setup",
29  0,
31  &hKey);
32  if (dwError != ERROR_SUCCESS)
33  return 0;
34 
35  /* Read key */
36  dwSize = sizeof(DWORD);
37  dwError = RegQueryValueExW(hKey,
38  L"SetupType",
39  NULL,
40  &dwType,
41  (LPBYTE)&dwSetupType,
42  &dwSize);
43 
44  /* Close key, and check if returned values are correct */
45  RegCloseKey(hKey);
46  if (dwError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD))
47  return 0;
48 
49  TRACE("GetSetupType() returns %lu\n", dwSetupType);
50  return dwSetupType;
51 }
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned char * LPBYTE
Definition: typedefs.h:52
#define DWORD
Definition: msvc.h:34
DWORD DWORD
Definition: winlogon.h:83
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
#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:4134
HANDLE HKEY
Definition: registry.h:24
static const WCHAR L[]
Definition: oid.c:1087
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
#define REG_DWORD
Definition: sdbapi.c:539
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
DWORD dwSize
Definition: wglext.h:734
BOOL GinaInit ( IN OUT PWLSESSION  Session)

Definition at line 919 of file wlx.c.

Referenced by WinMain().

921 {
922  DWORD GinaDllVersion;
923 
924  if (!LoadGina(&Session->Gina.Functions, &GinaDllVersion, &Session->Gina.hDllInstance))
925  return FALSE;
926 
927  Session->Gina.Context = NULL;
928  Session->Gina.Version = GinaDllVersion;
929  Session->Gina.UseCtrlAltDelete = FALSE;
930  Session->SuppressStatus = FALSE;
931 
932  TRACE("Calling WlxInitialize(\"%S\")\n", Session->InteractiveWindowStationName);
933  return Session->Gina.Functions.WlxInitialize(
934  Session->InteractiveWindowStationName,
935  (HANDLE)Session,
936  NULL,
938  &Session->Gina.Context);
939 }
DWORD *typedef PVOID
Definition: winlogon.h:60
DWORD DWORD
Definition: winlogon.h:83
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL LoadGina(IN OUT PGINAFUNCTIONS Functions, OUT DWORD *DllVersion, OUT HMODULE *GinaInstance)
Definition: wlx.c:819
DWORD *typedef HANDLE
Definition: winlogon.h:60
static WLX_DISPATCH_VERSION_1_4 FunctionTable
Definition: wlx.c:736
NTSTATUS HandleShutdown ( IN OUT PWLSESSION  Session,
IN DWORD  wlxAction 
)

Definition at line 969 of file sas.c.

Referenced by DoGenericAction(), and WinMain().

972 {
973  PLOGOFF_SHUTDOWN_DATA LSData;
974  HANDLE hThread;
975  DWORD exitCode;
976  BOOLEAN Old;
977 
978  // SwitchDesktop(Session->WinlogonDesktop);
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 */
1002  hThread = CreateThread(NULL, 0, LogoffShutdownThread, (LPVOID)LSData, 0, NULL);
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  }
1009  WaitForSingleObject(hThread, INFINITE);
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());
1014  CloseHandle(hThread);
1015  return STATUS_UNSUCCESSFUL;
1016  }
1017  CloseHandle(hThread);
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:216
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
return STATUS_SUCCESS
Definition: btrfs.c:2690
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
PWLSESSION Session
Definition: sas.c:41
static VOID UninitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:955
#define EWX_REBOOT
Definition: winuser.h:633
DWORD DWORD
Definition: winlogon.h:83
static DWORD WINAPI LogoffShutdownThread(LPVOID Parameter)
Definition: sas.c:627
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:526
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define DialogBox
Definition: winuser.h:5622
static INT_PTR CALLBACK ShutdownComputerWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: sas.c:923
#define FALSE
Definition: types.h:117
#define EWX_SHUTDOWN
Definition: winuser.h:634
#define IDS_REACTOSISSHUTTINGDOWN
Definition: resource.h:31
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:135
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:635
#define SE_SHUTDOWN_PRIVILEGE
Definition: security.c:673
#define EWX_POWEROFF
Definition: winuser.h:632
unsigned char BOOLEAN
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#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:109
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:249
DWORD *typedef HANDLE
Definition: winlogon.h:60
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
HANDLE hThread
Definition: wizard.c:27
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
#define INFINITE
Definition: serial.h:102
#define HeapFree(x, y, z)
Definition: compat.h:394
HINSTANCE hAppInstance
Definition: mmc.c:23
VOID InitDialogListHead ( VOID  )

Definition at line 45 of file wlx.c.

Referenced by WinMain().

46 {
48 }
static LIST_ENTRY DialogListHead
Definition: wlx.c:40
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
BOOL InitializeSAS ( IN OUT PWLSESSION  Session)

Definition at line 1508 of file sas.c.

Referenced by WinMain().

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 }
#define TRUE
Definition: types.h:120
int cbWndExtra
Definition: winuser.h:3168
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:3170
struct _WNDCLASSEXW WNDCLASSEXW
static VOID UninitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:955
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
LPCWSTR lpszMenuName
Definition: winuser.h:3173
#define WINLOGON_SAS_CLASS
Definition: sas.c:25
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
int cbClsExtra
Definition: winuser.h:3167
LPCWSTR lpszClassName
Definition: winuser.h:3174
unsigned int BOOL
Definition: ntddk_ex.h:94
HBRUSH hbrBackground
Definition: winuser.h:3172
UINT cbSize
Definition: winuser.h:3164
BOOL WINAPI SwitchDesktop(_In_ HDESK)
HINSTANCE hInstance
Definition: winuser.h:3169
#define CS_SAVEBITS
Definition: winuser.h:652
BOOL SetDefaultLanguage(IN PWLSESSION Session)
Definition: sas.c:110
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:3171
UINT style
Definition: winuser.h:3165
WNDPROC lpfnWndProc
Definition: winuser.h:3166
#define ERR(fmt,...)
Definition: debug.h:109
#define WS_POPUP
Definition: pedump.c:616
#define WINLOGON_SAS_TITLE
Definition: sas.c:26
HICON hIconSm
Definition: winuser.h:3175
char * cleanup(char *str)
Definition: wpickclick.c:99
HINSTANCE hAppInstance
Definition: mmc.c:23
BOOL InitializeScreenSaver ( IN OUT PWLSESSION  Session)

Definition at line 204 of file screensaver.c.

Referenced by HandleLogon().

206 {
207  HANDLE ScreenSaverThread;
208 
209 #ifndef USE_GETLASTINPUTINFO
210  /* Register hooks to detect keyboard and mouse activity */
211  Session->KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardActivityProc, hAppInstance, 0);
212  if (!Session->KeyboardHook)
213  {
214  ERR("WL: Unable to register keyboard hook\n");
215  return FALSE;
216  }
217 
218  Session->MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseActivityProc, hAppInstance, 0);
219  if (!Session->MouseHook)
220  {
221  ERR("WL: Unable to register mouse hook\n");
222  return FALSE;
223  }
224 #endif
225 
226  Session->hScreenSaverParametersChanged = CreateEventW(NULL, FALSE, FALSE, NULL);
227  if (!Session->hScreenSaverParametersChanged)
228  {
229  WARN("WL: Unable to create screen saver event (error %lu)\n", GetLastError());
230  return TRUE;
231  }
232 
233  Session->hEndOfScreenSaverThread = CreateEventW(NULL, FALSE, FALSE, NULL);
234  if (!Session->hEndOfScreenSaverThread)
235  {
236  WARN("WL: Unable to create screen saver event (error %lu)\n", GetLastError());
237  CloseHandle(Session->hScreenSaverParametersChanged);
238  return TRUE;
239  }
240 
241  ScreenSaverThread = CreateThread(NULL,
242  0,
244  Session,
245  0,
246  NULL);
247  if (ScreenSaverThread)
248  CloseHandle(ScreenSaverThread);
249  else
250  ERR("WL: Unable to start screen saver thread\n");
251 
252  return TRUE;
253 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
#define WH_MOUSE_LL
Definition: winuser.h:44
#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:135
smooth NULL
Definition: ftsmooth.c:416
#define WH_KEYBOARD_LL
Definition: winuser.h:43
#define SetWindowsHookEx
Definition: winuser.h:5717
#define ERR(fmt,...)
Definition: debug.h:109
DWORD *typedef HANDLE
Definition: winlogon.h:60
static DWORD WINAPI ScreenSaverThreadMain(IN LPVOID lpParameter)
Definition: screensaver.c:76
HINSTANCE hAppInstance
Definition: mmc.c:23
BOOL InitNotifications ( VOID  )

Definition at line 196 of file notify.c.

Referenced by WinMain().

197 {
198  HKEY hNotifyKey = NULL;
199  LONG lError;
200  DWORD dwIndex;
201  WCHAR szKeyName[80];
202  DWORD dwKeyName;
203 
204  TRACE("InitNotifications()\n");
205 
207 
209  L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\Notify",
210  0,
212  &hNotifyKey);
213  if (lError != ERROR_SUCCESS)
214  {
215  TRACE("RegOpenKeyExW()\n");
216  return TRUE;
217  }
218 
219  dwIndex = 0;
220  for(;;)
221  {
222  dwKeyName = 80 * sizeof(WCHAR);
223  lError = RegEnumKeyExW(hNotifyKey,
224  dwIndex,
225  szKeyName,
226  &dwKeyName,
227  NULL,
228  NULL,
229  NULL,
230  NULL);
231  if (lError != ERROR_SUCCESS)
232  break;
233 
234  TRACE("Notification DLL: %S\n", szKeyName);
235  LoadNotificationDll(hNotifyKey, szKeyName);
236 
237  dwIndex++;
238  }
239 
240  RegCloseKey(hNotifyKey);
241 
242  TRACE("InitNotifications() done\n");
243 
244  return TRUE;
245 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
static LIST_ENTRY NotificationDllListHead
Definition: notify.c:50
#define WCHAR
Definition: msvc.h:43
DWORD DWORD
Definition: winlogon.h:83
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static VOID LoadNotificationDll(HKEY hNotifyKey, PWSTR pKeyName)
Definition: notify.c:84
HANDLE HKEY
Definition: registry.h:24
static const WCHAR L[]
Definition: oid.c:1087
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2541
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
typedef int ( WINAPI PFWLXLOGGEDOUTSAS)
BOOL PlaySoundRoutine ( IN LPCWSTR  FileName,
IN UINT  Logon,
IN UINT  Flags 
)

Definition at line 239 of file sas.c.

Referenced by HandleMessageBeep(), and PlayLogonSoundThread().

243 {
244  typedef BOOL (WINAPI *PLAYSOUNDW)(LPCWSTR,HMODULE,DWORD);
245  typedef UINT (WINAPI *WAVEOUTGETNUMDEVS)(VOID);
246  PLAYSOUNDW Play;
247  WAVEOUTGETNUMDEVS waveOutGetNumDevs;
248  UINT NumDevs;
249  HMODULE hLibrary;
250  BOOL Ret = FALSE;
251 
252  hLibrary = LoadLibraryW(L"winmm.dll");
253  if (hLibrary)
254  {
255  waveOutGetNumDevs = (WAVEOUTGETNUMDEVS)GetProcAddress(hLibrary, "waveOutGetNumDevs");
256  if (waveOutGetNumDevs)
257  {
258  NumDevs = waveOutGetNumDevs();
259  if (!NumDevs)
260  {
261  if (!bLogon)
262  {
263  Beep(500, 500);
264  }
265  FreeLibrary(hLibrary);
266  return FALSE;
267  }
268  }
269 
270  Play = (PLAYSOUNDW)GetProcAddress(hLibrary, "PlaySoundW");
271  if (Play)
272  {
273  Ret = Play(FileName, NULL, Flags);
274  }
275  FreeLibrary(hLibrary);
276  }
277 
278  return Ret;
279 }
#define DWORD
Definition: msvc.h:34
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define FALSE
Definition: types.h:117
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2140
#define FreeLibrary(x)
Definition: compat.h:405
unsigned int BOOL
Definition: ntddk_ex.h:94
static const WCHAR L[]
Definition: oid.c:1087
#define VOID
Definition: acefi.h:82
HMODULE hLibrary
Definition: odbccp32.c:12
#define WINAPI
Definition: msvc.h:20
unsigned int UINT
Definition: ndis.h:50
HANDLE HMODULE
Definition: typedefs.h:75
BOOL WINAPI Beep(IN DWORD dwFreq, IN DWORD dwDuration)
Definition: deviceio.c:48
#define GetProcAddress(x, y)
Definition: compat.h:410
#define UINT
Definition: msvc.h:27
#define BOOL
Definition: msvc.h:23
#define LPCWSTR
Definition: msvc.h:45
BOOL RemoveStatusMessage ( IN PWLSESSION  Session)

Definition at line 237 of file winlogon.c.

Referenced by DoGenericAction(), HandleLogon(), and WinMain().

239 {
240  if (Session->Gina.Version < WLX_VERSION_1_3)
241  return TRUE;
242 
243  return Session->Gina.Functions.WlxRemoveStatusMessage(Session->Gina.Context);
244 }
#define TRUE
Definition: types.h:120
#define WLX_VERSION_1_3
Definition: winwlx.h:31
BOOL RunSetup ( VOID  )

Definition at line 153 of file setup.c.

Referenced by WinMain().

154 {
155  HANDLE hThread;
156 
157  hThread = CreateThread(NULL,
158  0,
160  NULL,
161  0,
162  NULL);
163  if (hThread != NULL)
164  CloseHandle(hThread);
165 
166  return hThread != NULL;
167 }
#define CloseHandle
Definition: compat.h:398
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:135
smooth NULL
Definition: ftsmooth.c:416
static DWORD WINAPI RunSetupThreadProc(IN LPVOID lpParameter)
Definition: setup.c:57
DWORD *typedef HANDLE
Definition: winlogon.h:60
HANDLE hThread
Definition: wizard.c:27
BOOL SetDefaultLanguage ( IN PWLSESSION  Session)

Definition at line 110 of file sas.c.

Referenced by HandleLogon(), and InitializeSAS().

112 {
113  BOOL ret = FALSE;
114  BOOL UserProfile;
115  LONG rc;
116  HKEY UserKey, hKey = NULL;
117  LPCWSTR SubKey, ValueName;
118  DWORD dwType, dwSize;
119  LPWSTR Value = NULL;
120  UNICODE_STRING ValueString;
122  LCID Lcid;
123 
124  UserProfile = (Session && Session->UserToken);
125 
126  if (UserProfile && !ImpersonateLoggedOnUser(Session->UserToken))
127  {
128  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
129  return FALSE;
130  // FIXME: ... or use the default language of the system??
131  // UserProfile = FALSE;
132  }
133 
134  if (UserProfile)
135  {
136  rc = RegOpenCurrentUser(MAXIMUM_ALLOWED, &UserKey);
137  if (rc != ERROR_SUCCESS)
138  {
139  TRACE("RegOpenCurrentUser() failed with error %lu\n", rc);
140  goto cleanup;
141  }
142 
143  SubKey = L"Control Panel\\International";
144  ValueName = L"Locale";
145  }
146  else
147  {
148  UserKey = NULL;
149  SubKey = L"System\\CurrentControlSet\\Control\\Nls\\Language";
150  ValueName = L"Default";
151  }
152 
153  rc = RegOpenKeyExW(UserKey ? UserKey : HKEY_LOCAL_MACHINE,
154  SubKey,
155  0,
156  KEY_READ,
157  &hKey);
158 
159  if (UserKey)
160  RegCloseKey(UserKey);
161 
162  if (rc != ERROR_SUCCESS)
163  {
164  TRACE("RegOpenKeyEx() failed with error %lu\n", rc);
165  goto cleanup;
166  }
167 
168  rc = RegQueryValueExW(hKey,
169  ValueName,
170  NULL,
171  &dwType,
172  NULL,
173  &dwSize);
174  if (rc != ERROR_SUCCESS)
175  {
176  TRACE("RegQueryValueEx() failed with error %lu\n", rc);
177  goto cleanup;
178  }
179  else if (dwType != REG_SZ)
180  {
181  TRACE("Wrong type for %S\\%S registry entry (got 0x%lx, expected 0x%x)\n",
182  SubKey, ValueName, dwType, REG_SZ);
183  goto cleanup;
184  }
185 
186  Value = HeapAlloc(GetProcessHeap(), 0, dwSize);
187  if (!Value)
188  {
189  TRACE("HeapAlloc() failed\n");
190  goto cleanup;
191  }
192  rc = RegQueryValueExW(hKey,
193  ValueName,
194  NULL,
195  NULL,
196  (LPBYTE)Value,
197  &dwSize);
198  if (rc != ERROR_SUCCESS)
199  {
200  TRACE("RegQueryValueEx() failed with error %lu\n", rc);
201  goto cleanup;
202  }
203 
204  /* Convert Value to a Lcid */
205  ValueString.Length = ValueString.MaximumLength = (USHORT)dwSize;
206  ValueString.Buffer = Value;
207  Status = RtlUnicodeStringToInteger(&ValueString, 16, (PULONG)&Lcid);
208  if (!NT_SUCCESS(Status))
209  {
210  TRACE("RtlUnicodeStringToInteger() failed with status 0x%08lx\n", Status);
211  goto cleanup;
212  }
213 
214  TRACE("%s language is 0x%08lx\n",
215  UserProfile ? "User" : "System", Lcid);
216  Status = NtSetDefaultLocale(UserProfile, Lcid);
217  if (!NT_SUCCESS(Status))
218  {
219  TRACE("NtSetDefaultLocale() failed with status 0x%08lx\n", Status);
220  goto cleanup;
221  }
222 
223  ret = TRUE;
224 
225 cleanup:
226  if (Value)
227  HeapFree(GetProcessHeap(), 0, Value);
228 
229  if (hKey)
230  RegCloseKey(hKey);
231 
232  if (UserProfile)
233  RevertToSelf();
234 
235  return ret;
236 }
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
_In_ CONST DEVPROPKEY _In_ LCID Lcid
Definition: iofuncs.h:2408
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define KEY_READ
Definition: nt_native.h:1023
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1483
unsigned char * LPBYTE
Definition: typedefs.h:52
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD LCID
Definition: nls.h:13
DWORD DWORD
Definition: winlogon.h:83
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG NTSTATUS
Definition: precomp.h:26
#define GetProcessHeap()
Definition: compat.h:395
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:4134
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:24
HANDLE HKEY
Definition: registry.h:24
NTSTATUS NTAPI NtSetDefaultLocale(IN BOOLEAN UserProfile, IN LCID DefaultLocaleId)
Definition: locale.c:203
int ret
static const WCHAR L[]
Definition: oid.c:1087
UINTN UINT8 Value
Definition: acefiex.h:751
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3247
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:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
DWORD dwSize
Definition: wglext.h:734
BOOL WINAPI SetWindowStationUser ( IN HWINSTA  hWindowStation,
IN PLUID  pluid,
IN PSID psid  OPTIONAL,
IN DWORD  size 
)

Definition at line 400 of file winsta.c.

Referenced by AllowWinstaAccess(), CreateWindowStationAndDesktops(), HandleLogoff(), and HandleLogon().

405 {
406  BOOL Success;
407 
408  Success = NtUserSetWindowStationUser(hWindowStation, pluid, psid, size);
409  if (Success)
410  {
411  /* Signal log-on/off to WINSRV */
412 
413  /* User is logging on if *pluid != LuidNone, otherwise it is a log-off */
414  LUID LuidNone = {0, 0};
415  BOOL IsLogon = (pluid && !RtlEqualLuid(pluid, &LuidNone));
416 
417  Logon(IsLogon);
418  }
419 
420  return Success;
421 }
LUID LuidNone
Definition: sas.c:46
#define RtlEqualLuid(Luid1, Luid2)
Definition: rtlfuncs.h:301
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
VOID FASTCALL Logon(BOOL IsLogon)
Definition: logon.c:74
BOOL NTAPI NtUserSetWindowStationUser(IN HWINSTA hWindowStation, IN PLUID pluid, IN PSID psid OPTIONAL, IN DWORD size)
Definition: winsta.c:1487
BOOL StartRpcServer ( VOID  )

Definition at line 19 of file rpcserver.c.

Referenced by WinMain().

20 {
22 
23  TRACE("StartRpcServer() called\n");
24 
25  Status = RpcServerUseProtseqEpW(L"ncacn_np",
27  L"\\pipe\\winreg",
28  NULL);
29  if (Status != RPC_S_OK)
30  {
31  ERR("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
32  return FALSE;
33  }
34 
35  Status = RpcServerRegisterIf(winreg_v1_0_s_ifspec,
36  NULL,
37  NULL);
38  if (Status != RPC_S_OK)
39  {
40  ERR("RpcServerRegisterIf() failed (Status %lx)\n", Status);
41  return FALSE;
42  }
43 
44  Status = RpcServerListen(1, 20, TRUE);
45  if (Status != RPC_S_OK)
46  {
47  ERR("RpcServerListen() failed (Status %lx)\n", Status);
48  return FALSE;
49  }
50 
51  TRACE("StartRpcServer() done\n");
52  return TRUE;
53 }
#define TRUE
Definition: types.h:120
long RPC_STATUS
Definition: rpc.h:52
#define FALSE
Definition: types.h:117
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1527
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1123
static const WCHAR L[]
Definition: oid.c:1087
Status
Definition: gdiplustypes.h:24
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:934
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_C_PROTSEQ_MAX_REQS_DEFAULT
Definition: rpcdce.h:123
#define RPC_S_OK
Definition: rpcnterr.h:22
VOID StartScreenSaver ( IN PWLSESSION  Session)

Definition at line 257 of file screensaver.c.

Referenced by DispatchSAS().

259 {
260  HKEY hKey = NULL, hCurrentUser = NULL;
261  WCHAR szApplicationName[MAX_PATH];
262  WCHAR szCommandLine[MAX_PATH + 3];
263  DWORD bufferSize = sizeof(szApplicationName) - sizeof(WCHAR);
264  DWORD dwType;
265  STARTUPINFOW StartupInfo;
266  PROCESS_INFORMATION ProcessInformation;
267  HANDLE HandleArray[2];
268  LONG rc;
269  DWORD Status;
270  BOOL ret = FALSE;
271 
272  if (!ImpersonateLoggedOnUser(Session->UserToken))
273  {
274  ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
275  goto cleanup;
276  }
277 
279  &hCurrentUser);
280  if (rc != ERROR_SUCCESS)
281  {
282  ERR("WL: RegOpenCurrentUser error %lu\n", rc);
283  goto cleanup;
284  }
285 
286  rc = RegOpenKeyExW(hCurrentUser,
287  L"Control Panel\\Desktop",
288  0,
290  &hKey);
291  if (rc != ERROR_SUCCESS)
292  {
293  ERR("WL: RegOpenKeyEx error %lu\n", rc);
294  goto cleanup;
295  }
296 
297  rc = RegQueryValueExW(hKey,
298  L"SCRNSAVE.EXE",
299  0,
300  &dwType,
301  (LPBYTE)szApplicationName,
302  &bufferSize);
303  if (rc != ERROR_SUCCESS || dwType != REG_SZ)
304  {
305  if (rc != ERROR_FILE_NOT_FOUND)
306  ERR("WL: RegQueryValueEx error %lu\n", rc);
307  goto cleanup;
308  }
309 
310  if (bufferSize == 0)
311  {
312  ERR("WL: Buffer size is NULL!\n");
313  goto cleanup;
314  }
315 
316  szApplicationName[bufferSize / sizeof(WCHAR)] = 0; /* Terminate the string */
317 
318  if (wcslen(szApplicationName) == 0)
319  {
320  ERR("WL: Application Name length is zero!\n");
321  goto cleanup;
322  }
323 
324  wsprintfW(szCommandLine, L"%s /s", szApplicationName);
325  TRACE("WL: Executing %S\n", szCommandLine);
326 
327  ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
328  ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION));
329  StartupInfo.cb = sizeof(STARTUPINFOW);
330  StartupInfo.dwFlags = STARTF_SCRNSAVER;
331 
332  /* FIXME: run the screen saver on the screen saver desktop */
333  ret = CreateProcessW(szApplicationName,
334  szCommandLine,
335  NULL,
336  NULL,
337  FALSE,
338  0,
339  NULL,
340  NULL,
341  &StartupInfo,
342  &ProcessInformation);
343  if (!ret)
344  {
345  ERR("WL: Unable to start %S, error %lu\n", szApplicationName, GetLastError());
346  goto cleanup;
347  }
348 
349  CloseHandle(ProcessInformation.hThread);
350 
351  SystemParametersInfoW(SPI_SETSCREENSAVERRUNNING, TRUE, NULL, 0);
352 
354 
355  /* Wait the end of the process or some other activity */
356  ResetEvent(Session->hUserActivity);
357  HandleArray[0] = ProcessInformation.hProcess;
358  HandleArray[1] = Session->hUserActivity;
359  Status = WaitForMultipleObjects(2, HandleArray, FALSE, INFINITE);
360  if (Status == WAIT_OBJECT_0 + 1)
361  {
362  /* Kill the screen saver */
363  TerminateProcess(ProcessInformation.hProcess, 0);
364  }
365 
366  SetEvent(Session->hEndOfScreenSaver);
367 
368  CloseHandle(ProcessInformation.hProcess);
369 
371 
372 cleanup:
373  if (hKey)
374  RegCloseKey(hKey);
375 
376  if (hCurrentUser)
377  RegCloseKey(hCurrentUser);
378 
379  RevertToSelf();
380 
381  if (!ret)
382  {
383  PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_ACTIVITY, 0);
384 #ifndef USE_GETLASTINPUTINFO
385  InterlockedExchange((LONG*)&Session->LastActivity, GetTickCount());
386 #endif
387  }
388 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define WLX_WM_SAS
Definition: winwlx.h:71
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WLX_SAS_TYPE_SCRNSVR_ACTIVITY
Definition: winwlx.h:38
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1483
unsigned char * LPBYTE
Definition: typedefs.h:52
struct _STARTUPINFOW STARTUPINFOW
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
#define STARTF_SCRNSAVER
Definition: undocuser.h:160
#define WCHAR
Definition: msvc.h:43
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
DWORD DWORD
Definition: winlogon.h:83
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI ImpersonateLoggedOnUser(HANDLE hToken)
Definition: misc.c:152
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4650
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WAIT_OBJECT_0
Definition: winbase.h:387
DWORD cb
Definition: winbase.h:817
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
HANDLE HKEY
Definition: registry.h:24
#define MAX_PATH
Definition: compat.h:26
int ret
static const WCHAR L[]
Definition: oid.c:1087
#define InterlockedExchange
Definition: armddk.h:54
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:249
DWORD *typedef HANDLE
Definition: winlogon.h:60
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1589
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:660
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3247
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381
char * cleanup(char *str)
Definition: wpickclick.c:99
DWORD dwFlags
Definition: winbase.h:828
#define INFINITE
Definition: serial.h:102
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22
DWORD StartSystemShutdown ( PUNICODE_STRING  lpMessage,
ULONG  dwTimeout,
BOOLEAN  bForceAppsClosed,
BOOLEAN  bRebootAfterShutdown,
ULONG  dwReason 
)

Definition at line 218 of file shutdown.c.

Referenced by BaseInitiateSystemShutdownEx().

224 {
225  HANDLE hThread;
226 
227  /* Fail if the timeout is 10 years or more */
230 
233 
234  if (lpMessage && lpMessage->Length && lpMessage->Buffer)
235  {
238  lpMessage->Length + sizeof(UNICODE_NULL));
240  {
242  return GetLastError();
243  }
244 
246  lpMessage->Buffer,
247  lpMessage->Length / sizeof(WCHAR));
248  }
249  else
250  {
252  }
253 
255  g_ShutdownParams.bForceAppsClosed = bForceAppsClosed;
256  g_ShutdownParams.bRebootAfterShutdown = bRebootAfterShutdown;
258 
259  /* If dwTimeout is zero perform an immediate system shutdown, otherwise display the countdown shutdown dialog */
260  if (g_ShutdownParams.dwTimeout == 0)
261  {
263  return ERROR_SUCCESS;
264  }
265  else
266  {
268  if (hThread)
269  {
270  CloseHandle(hThread);
271  return ERROR_SUCCESS;
272  }
273  }
274 
276  {
279  }
280 
282  return GetLastError();
283 }
DWORD *typedef PVOID
Definition: winlogon.h:60
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define ERROR_SUCCESS
Definition: deptool.c:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ERROR_SHUTDOWN_IN_PROGRESS
Definition: winerror.h:651
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
SYS_SHUTDOWN_PARAMS g_ShutdownParams
Definition: shutdown.c:39
char _InterlockedCompareExchange8(_Interlocked_operand_ char volatile *_Destination, char _Exchange, char _Comparand)
DWORD dwReason
Definition: misc.cpp:154
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
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:135
smooth NULL
Definition: ftsmooth.c:416
static BOOL DoSystemShutdown(IN PSYS_SHUTDOWN_PARAMS pShutdownParams)
Definition: shutdown.c:46
BOOLEAN bForceAppsClosed
Definition: shutdown.c:30
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD dwTimeout
Definition: wincrypt.h:6079
DWORD *typedef HANDLE
Definition: winlogon.h:60
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
BOOLEAN bRebootAfterShutdown
Definition: shutdown.c:29
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HANDLE hThread
Definition: wizard.c:27
static DWORD WINAPI InitiateSystemShutdownThread(LPVOID lpParameter)
Definition: shutdown.c:179
#define SECONDS_PER_DECADE
Definition: shutdown.c:20
BOOLEAN bShuttingDown
Definition: shutdown.c:33
#define HeapFree(x, y, z)
Definition: compat.h:394
DWORD TerminateSystemShutdown ( VOID  )

Definition at line 208 of file shutdown.c.

Referenced by BaseAbortSystemShutdown().

209 {
212 
213  return ERROR_SUCCESS;
214 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
SYS_SHUTDOWN_PARAMS g_ShutdownParams
Definition: shutdown.c:39
char _InterlockedCompareExchange8(_Interlocked_operand_ char volatile *_Destination, char _Exchange, char _Comparand)
#define FALSE
Definition: types.h:117
#define ERROR_NO_SHUTDOWN_IN_PROGRESS
Definition: winerror.h:652
BOOLEAN bShuttingDown
Definition: shutdown.c:33
typedef VOID ( WINAPI PFWLXDISPLAYLOCKEDNOTICE)
WINE_DEFAULT_DEBUG_CHANNEL ( winlogon  )
int WINAPI WlxAssignShellProtection ( HANDLE  hWlx,
HANDLE  hToken,
HANDLE  hProcess,
HANDLE  hThread 
)

Definition at line 262 of file wlx.c.

267 {
269  UNREFERENCED_PARAMETER(hToken);
272 
274  return 0;
275 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
HANDLE hThread
Definition: wizard.c:27
#define UNIMPLEMENTED
Definition: debug.h:114
int WINAPI WlxChangePasswordNotify ( HANDLE  hWlx,
PWLX_MPR_NOTIFY_INFO  pMprInfo,
DWORD  dwChangeInfo 
)

Definition at line 437 of file wlx.c.

441 {
443  UNREFERENCED_PARAMETER(pMprInfo);
444  UNREFERENCED_PARAMETER(dwChangeInfo);
445 
447  return 0;
448 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define UNIMPLEMENTED
Definition: debug.h:114
int WINAPI WlxChangePasswordNotifyEx ( HANDLE  hWlx,
PWLX_MPR_NOTIFY_INFO  pMprInfo,
DWORD  dwChangeInfo,
PWSTR  ProviderName,
PVOID  Reserved 
)

Definition at line 509 of file wlx.c.

515 {
517  UNREFERENCED_PARAMETER(pMprInfo);
518  UNREFERENCED_PARAMETER(dwChangeInfo);
519  UNREFERENCED_PARAMETER(ProviderName);
521 
523  return 0;
524 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
ULONG PVOID Reserved
Definition: ntimage.h:533
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL WINAPI WlxCloseUserDesktop ( HANDLE  hWlx,
PWLX_DESKTOP  pDesktop,
HANDLE  hToken 
)

Definition at line 531 of file wlx.c.

535 {
537  UNREFERENCED_PARAMETER(pDesktop);
538  UNREFERENCED_PARAMETER(hToken);
539 
541  return FALSE;
542 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL WINAPI WlxCreateUserDesktop ( HANDLE  hWlx,
HANDLE  hToken,
DWORD  Flags,
PWSTR  pszDesktopName,
PWLX_DESKTOP ppDesktop 
)

Definition at line 487 of file wlx.c.

493 {
495  UNREFERENCED_PARAMETER(hToken);
497  UNREFERENCED_PARAMETER(pszDesktopName);
498  UNREFERENCED_PARAMETER(ppDesktop);
499 
501  return FALSE;
502 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
int WINAPI WlxDialogBox ( HANDLE  hWlx,
HANDLE  hInst,
LPWSTR  lpszTemplate,
HWND  hwndOwner,
DLGPROC  dlgprc 
)

Definition at line 301 of file wlx.c.

307 {
309 
310  TRACE("WlxDialogBox()\n");
311 
312  return (int)WlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, dlgprc, 0);
313 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define TRACE(s)
Definition: solgame.cpp:4
HINSTANCE hInst
Definition: dxdiag.c:13
int WINAPI WlxDialogBoxParam(HANDLE hWlx, HANDLE hInst, LPWSTR lpszTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam)
Definition: wlx.c:320
int WINAPI WlxDialogBoxIndirect ( HANDLE  hWlx,
HANDLE  hInst,
LPCDLGTEMPLATE  hDialogTemplate,
HWND  hwndOwner,
DLGPROC  dlgprc 
)

Definition at line 354 of file wlx.c.

360 {
362 
363  TRACE("WlxDialogBoxIndirect()\n");
364 
365  return (int)WlxDialogBoxIndirectParam(hWlx, hInst, hDialogTemplate, hwndOwner, dlgprc, 0);
366 }
int WINAPI WlxDialogBoxIndirectParam(HANDLE hWlx, HANDLE hInst, LPCDLGTEMPLATE hDialogTemplate, HWND hwndOwner, DLGPROC dlgprc, LPARAM dwInitParam)
Definition: wlx.c:373
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define TRACE(s)
Definition: solgame.cpp:4
HINSTANCE hInst
Definition: dxdiag.c:13
int WINAPI WlxDialogBoxIndirectParam ( HANDLE  hWlx,
HANDLE  hInst,
LPCDLGTEMPLATE  hDialogTemplate,
HWND  hwndOwner,
DLGPROC  dlgprc,
LPARAM  dwInitParam 
)

Definition at line 373 of file wlx.c.

Referenced by WlxDialogBoxIndirect().

380 {
381  PDIALOG_LIST_ENTRY ListEntry;
382  int ret;
383 
385 
386  TRACE("WlxDialogBoxIndirectParam()\n");
387 
388  ListEntry = AddDialogListEntry();
389  if (ListEntry == NULL)
390  return -1;
391 
392  ListEntry->DlgProc = dlgprc;
393  ListEntry->lParam = dwInitParam;
394 
395  ret = (int)DialogBoxIndirectParamW(hInst, hDialogTemplate, hwndOwner, DefaultWlxWindowProc, (LPARAM)ListEntry);
396 
397  RemoveDialogListEntry(ListEntry);
398 
399  return ret;
400 }
DLGPROC DlgProc
Definition: wlx.c:33
LPARAM lParam
Definition: wlx.c:34
static VOID RemoveDialogListEntry(PDIALOG_LIST_ENTRY ListEntry)
Definition: wlx.c:72
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static INT_PTR CALLBACK DefaultWlxWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wlx.c:131
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
HINSTANCE hInst
Definition: dxdiag.c:13
INT_PTR WINAPI DialogBoxIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
Definition: wlx.c:29
static PDIALOG_LIST_ENTRY AddDialogListEntry(VOID)
Definition: wlx.c:53
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29
int WINAPI WlxDialogBoxParam ( HANDLE  hWlx,
HANDLE  hInst,
LPWSTR  lpszTemplate,
HWND  hwndOwner,
DLGPROC  dlgprc,
LPARAM  dwInitParam 
)

Definition at line 320 of file wlx.c.

Referenced by WlxDialogBox().

327 {
328  PDIALOG_LIST_ENTRY ListEntry;
329  int ret;
330 
332 
333  TRACE("WlxDialogBoxParam()\n");
334 
335  ListEntry = AddDialogListEntry();
336  if (ListEntry == NULL)
337  return -1;
338 
339  ListEntry->DlgProc = dlgprc;
340  ListEntry->lParam = dwInitParam;
341 
342  ret = (int)DialogBoxParamW(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc, (LPARAM)ListEntry);
343 
344  RemoveDialogListEntry(ListEntry);
345 
346  return ret;
347 }
DLGPROC DlgProc
Definition: wlx.c:33
LPARAM lParam
Definition: wlx.c:34
static VOID RemoveDialogListEntry(PDIALOG_LIST_ENTRY ListEntry)
Definition: wlx.c:72
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static INT_PTR CALLBACK DefaultWlxWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: wlx.c:131
LONG_PTR LPARAM
Definition: windef.h:208
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int ret
HINSTANCE hInst
Definition: dxdiag.c:13
Definition: wlx.c:29
static PDIALOG_LIST_ENTRY AddDialogListEntry(VOID)
Definition: wlx.c:53
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:29
BOOL WINAPI WlxDisconnect ( VOID  )

Definition at line 681 of file wlx.c.

682 {
684  return FALSE;
685 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL WINAPI WlxGetOption ( HANDLE  hWlx,
DWORD  Option,
ULONG_PTR Value 
)

Definition at line 582 of file wlx.c.

586 {
587  PWLSESSION Session = (PWLSESSION)hWlx;
588 
589  TRACE("WlxGetOption(%lu)\n", Option);
590 
591  switch (Option)
592  {
594  *Value = (ULONG_PTR)Session->Gina.UseCtrlAltDelete;
595  return TRUE;
597  {
598  *Value = (ULONG_PTR)Session->Gina.Context;
599  return TRUE;
600  }
605  return FALSE;
607  {
608  switch (Session->Gina.Version)
609  {
610  case WLX_VERSION_1_0:
611  *Value = sizeof(WLX_DISPATCH_VERSION_1_0);
612  break;
613  case WLX_VERSION_1_1:
614  *Value = sizeof(WLX_DISPATCH_VERSION_1_1);
615  break;
616  case WLX_VERSION_1_2:
617  *Value = sizeof(WLX_DISPATCH_VERSION_1_2);
618  break;
619  case WLX_VERSION_1_3:
620  *Value = sizeof(WLX_DISPATCH_VERSION_1_3);
621  break;
622  case WLX_VERSION_1_4:
623  *Value = sizeof(WLX_DISPATCH_VERSION_1_4);
624  break;
625  default:
626  return FALSE;
627  }
628  return TRUE;
629  }
630  }
631 
632  return FALSE;
633 }
BOOL UseCtrlAltDelete
Definition: winlogon.h:125
PVOID Context
Definition: winlogon.h:123
#define TRUE
Definition: types.h:120
struct _WLSESSION * PWLSESSION
struct _WLX_DISPATCH_VERSION_1_0 WLX_DISPATCH_VERSION_1_0
#define WLX_OPTION_DISPATCH_TABLE_SIZE
Definition: winwlx.h:331
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define FALSE
Definition: types.h:117
#define WLX_OPTION_SMART_CARD_INFO
Definition: winwlx.h:330
#define WLX_VERSION_1_1
Definition: winwlx.h:29
GINAINSTANCE Gina
Definition: winlogon.h:215
#define WLX_OPTION_SMART_CARD_PRESENT
Definition: winwlx.h:329
#define WLX_OPTION_CONTEXT_POINTER
Definition: winwlx.h:323
#define WLX_VERSION_1_4
Definition: winwlx.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define WLX_OPTION_USE_CTRL_ALT_DEL
Definition: winwlx.h:322
#define WLX_OPTION_USE_SMART_CARD
Definition: winwlx.h:324
#define WLX_VERSION_1_2
Definition: winwlx.h:30
struct _WLX_DISPATCH_VERSION_1_4 WLX_DISPATCH_VERSION_1_4
struct _WLX_DISPATCH_VERSION_1_1 WLX_DISPATCH_VERSION_1_1
UINTN UINT8 Value
Definition: acefiex.h:751
#define WLX_VERSION_1_0
Definition: winwlx.h:28
struct _WLX_DISPATCH_VERSION_1_3 WLX_DISPATCH_VERSION_1_3
struct _WLX_DISPATCH_VERSION_1_2 WLX_DISPATCH_VERSION_1_2
#define UNIMPLEMENTED
Definition: debug.h:114
#define ULONG_PTR
Definition: config.h:101
DWORD Version
Definition: winlogon.h:124
#define WLX_VERSION_1_3
Definition: winwlx.h:31
BOOL WINAPI WlxGetSourceDesktop ( HANDLE  hWlx,
PWLX_DESKTOP ppDesktop 
)

Definition at line 455 of file wlx.c.

458 {
460  UNREFERENCED_PARAMETER(ppDesktop);
461 
463  return FALSE;
464 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
int WINAPI WlxMessageBox ( HANDLE  hWlx,
HWND  hwndOwner,
LPWSTR  lpszText,
LPWSTR  lpszTitle,
UINT  fuStyle 
)

Definition at line 282 of file wlx.c.

288 {
290 
291  TRACE("WlxMessageBox()\n");
292  /* FIXME: Provide a custom window proc to be able to handle timeout */
293  return MessageBoxW(hwndOwner, lpszText, lpszTitle, fuStyle);
294 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define TRACE(s)
Definition: solgame.cpp:4
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
BOOL WINAPI WlxQueryClientCredentials ( PWLX_CLIENT_CREDENTIALS_INFO_V1_0  pCred)

Definition at line 653 of file wlx.c.

655 {
656  UNREFERENCED_PARAMETER(pCred);
657 
659  return FALSE;
660 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI WlxQueryConsoleSwitchCredentials ( PWLX_CONSOLESWITCH_CREDENTIALS_INFO_V1_0  pCred)

Definition at line 712 of file wlx.c.

714 {
715  UNREFERENCED_PARAMETER(pCred);
716 
718  return 0;
719 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL WINAPI WlxQueryInetConnectorCredentials ( PWLX_CLIENT_CREDENTIALS_INFO_V1_0  pCred)

Definition at line 667 of file wlx.c.

669 {
670  UNREFERENCED_PARAMETER(pCred);
671 
673  return FALSE;
674 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
DWORD WINAPI WlxQueryTerminalServicesData ( HANDLE  hWlx,
PWLX_TERMINAL_SERVICES_DATA  pTSData,
WCHAR UserName,
WCHAR Domain 
)

Definition at line 692 of file wlx.c.

697 {
699  UNREFERENCED_PARAMETER(pTSData);
700  UNREFERENCED_PARAMETER(UserName);
701  UNREFERENCED_PARAMETER(Domain);
702 
704  return 0;
705 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL WINAPI WlxQueryTsLogonCredentials ( PWLX_CLIENT_CREDENTIALS_INFO_V2_0  pCred)

Definition at line 726 of file wlx.c.

728 {
729  UNREFERENCED_PARAMETER(pCred);
730 
732  return FALSE;
733 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
VOID WINAPI WlxSasNotify ( HANDLE  hWlx,
DWORD  dwSasType 
)

Definition at line 228 of file wlx.c.

231 {
232  PWLSESSION Session = (PWLSESSION)hWlx;
233 
234  TRACE("WlxSasNotify(0x%lx)\n", dwSasType);
235 
236  if (dwSasType == WLX_SAS_TYPE_CTRL_ALT_DEL || dwSasType > WLX_SAS_TYPE_MAX_MSFT_VALUE)
237  PostMessageW(Session->SASWindow, WLX_WM_SAS, dwSasType, 0);
238 }
#define WLX_WM_SAS
Definition: winwlx.h:71
struct _WLSESSION * PWLSESSION
HWND SASWindow
Definition: winlogon.h:219
#define TRACE(s)
Definition: solgame.cpp:4
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
#define WLX_SAS_TYPE_MAX_MSFT_VALUE
Definition: winwlx.h:46
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
VOID WINAPI WlxSetContextPointer ( HANDLE  hWlx,
PVOID  pWlxContext 
)

Definition at line 212 of file wlx.c.

215 {
216  ULONG_PTR OldValue;
217 
218  TRACE("WlxSetContextPointer(%p)\n", pWlxContext);
219 
220  WlxSetOption(hWlx, WLX_OPTION_CONTEXT_POINTER, (ULONG_PTR)pWlxContext, &OldValue);
221 }
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define WLX_OPTION_CONTEXT_POINTER
Definition: winwlx.h:323
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI WlxSetOption(HANDLE hWlx, DWORD Option, ULONG_PTR Value, ULONG_PTR *OldValue)
Definition: wlx.c:549
BOOL WINAPI WlxSetOption ( HANDLE  hWlx,
DWORD  Option,
ULONG_PTR  Value,
ULONG_PTR OldValue 
)

Definition at line 549 of file wlx.c.

Referenced by WlxSetContextPointer(), and WlxUseCtrlAltDel().

554 {
555  PWLSESSION Session = (PWLSESSION)hWlx;
556 
557  TRACE("WlxSetOption(%lu)\n", Option);
558 
559  switch (Option)
560  {
562  *OldValue = (ULONG_PTR)Session->Gina.UseCtrlAltDelete;
563  Session->Gina.UseCtrlAltDelete = (BOOL)Value;
564  return TRUE;
566  *OldValue = (ULONG_PTR)Session->Gina.Context;
567  Session->Gina.Context = (PVOID)Value;
568  return TRUE;
571  return FALSE;
572  }
573 
574  return FALSE;
575 }
DWORD *typedef PVOID
Definition: winlogon.h:60
BOOL UseCtrlAltDelete
Definition: winlogon.h:125
PVOID Context
Definition: winlogon.h:123
#define TRUE
Definition: types.h:120
struct _WLSESSION * PWLSESSION
#define FALSE
Definition: types.h:117
GINAINSTANCE Gina
Definition: winlogon.h:215
#define WLX_OPTION_CONTEXT_POINTER
Definition: winwlx.h:323
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WLX_OPTION_USE_CTRL_ALT_DEL
Definition: winwlx.h:322
#define WLX_OPTION_USE_SMART_CARD
Definition: winwlx.h:324
UINTN UINT8 Value
Definition: acefiex.h:751
#define UNIMPLEMENTED
Definition: debug.h:114
#define ULONG_PTR
Definition: config.h:101
BOOL WINAPI WlxSetReturnDesktop ( HANDLE  hWlx,
PWLX_DESKTOP  pDesktop 
)

Definition at line 471 of file wlx.c.

474 {
476  UNREFERENCED_PARAMETER(pDesktop);
477 
479  return FALSE;
480 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:114
BOOL WINAPI WlxSetTimeout ( HANDLE  hWlx,
DWORD  Timeout 
)

Definition at line 245 of file wlx.c.

248 {
249  PWLSESSION Session = (PWLSESSION)hWlx;
250 
251  TRACE("WlxSetTimeout(%lu)\n", Timeout);
252 
253  Session->DialogTimeout = Timeout;
254  return TRUE;
255 }
#define TRUE
Definition: types.h:120
struct _WLSESSION * PWLSESSION
#define TRACE(s)
Definition: solgame.cpp:4
DWORD DialogTimeout
Definition: winlogon.h:229
static ULONG Timeout
Definition: ping.c:61
int WINAPI WlxSwitchDesktopToUser ( HANDLE  hWlx)

Definition at line 407 of file wlx.c.

409 {
410  PWLSESSION Session = (PWLSESSION)hWlx;
411 
412  TRACE("WlxSwitchDesktopToUser()\n");
413 
414  return (int)SwitchDesktop(Session->ApplicationDesktop);
415 }
struct _WLSESSION * PWLSESSION
HDESK ApplicationDesktop
Definition: winlogon.h:222
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI SwitchDesktop(_In_ HDESK)
int WINAPI WlxSwitchDesktopToWinlogon ( HANDLE  hWlx)

Definition at line 422 of file wlx.c.

424 {
425  PWLSESSION Session = (PWLSESSION)hWlx;
426 
427  TRACE("WlxSwitchDesktopToWinlogon()\n");
428 
429  return (int)SwitchDesktop(Session->WinlogonDesktop);
430 }
struct _WLSESSION * PWLSESSION
HDESK WinlogonDesktop
Definition: winlogon.h:223
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI SwitchDesktop(_In_ HDESK)
VOID WINAPI WlxUseCtrlAltDel ( HANDLE  hWlx)

Definition at line 197 of file wlx.c.

199 {
200  ULONG_PTR OldValue;
201 
202  TRACE("WlxUseCtrlAltDel()\n");
203 
204  WlxSetOption(hWlx, WLX_OPTION_USE_CTRL_ALT_DEL, TRUE, &OldValue);
205 }
#define TRUE
Definition: types.h:120
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define TRACE(s)
Definition: solgame.cpp:4
#define WLX_OPTION_USE_CTRL_ALT_DEL
Definition: winwlx.h:322
BOOL WINAPI WlxSetOption(HANDLE hWlx, DWORD Option, ULONG_PTR Value, ULONG_PTR *OldValue)
Definition: wlx.c:549
VOID WINAPI WlxWin31Migrate ( HANDLE  hWlx)

Definition at line 640 of file wlx.c.

642 {
644 
646 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define UNIMPLEMENTED
Definition: debug.h:114

Variable Documentation

LUID LuidNone

Definition at line 46 of file sas.c.

Referenced by CreateWindowStationAndDesktops(), and SetWindowStationUser().

typedef PDWORD

Definition at line 62 of file winlogon.h.

typedef PHANDLE

Definition at line 62 of file winlogon.h.

typedef PLUID

Definition at line 62 of file winlogon.h.

typedef PSID

Definition at line 62 of file winlogon.h.

Definition at line 62 of file winlogon.h.

PWLSESSION WLSession

Definition at line 20 of file winlogon.c.

Referenced by DefaultWlxScreenSaverNotify(), and RunSetupThreadProc().