ReactOS  0.4.13-dev-656-g74bcf30
winlogon.c File Reference
#include "winlogon.h"
#include <ndk/cmfuncs.h>
Include dependency graph for winlogon.c:

Go to the source code of this file.

Functions

static BOOL StartServicesManager (VOID)
 
static BOOL StartLsass (VOID)
 
static VOID WaitForLsass (VOID)
 
static BOOL InitKeyboardLayouts (VOID)
 
BOOL DisplayStatusMessage (IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
 
BOOL RemoveStatusMessage (IN PWLSESSION Session)
 
static INT_PTR CALLBACK GinaLoadFailedWindowProc (IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
 
int WINAPI WinMain (IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd)
 

Variables

HINSTANCE hAppInstance
 
PWLSESSION WLSession = NULL
 

Function Documentation

◆ DisplayStatusMessage()

BOOL DisplayStatusMessage ( IN PWLSESSION  Session,
IN HDESK  hDesktop,
IN UINT  ResourceId 
)

Definition at line 216 of file winlogon.c.

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
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HINSTANCE hAppInstance
Definition: winlogon.c:19
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define WLX_VERSION_1_3
Definition: winwlx.h:31

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

◆ GinaLoadFailedWindowProc()

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

Definition at line 250 of file winlogon.c.

255 {
256  switch (uMsg)
257  {
258  case WM_COMMAND:
259  {
260  switch (LOWORD(wParam))
261  {
262  case IDOK:
263  EndDialog(hwndDlg, IDOK);
264  return TRUE;
265  }
266  break;
267  }
268 
269  case WM_INITDIALOG:
270  {
271  int len;
272  WCHAR templateText[MAX_PATH], text[MAX_PATH];
273 
274  len = GetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, templateText, MAX_PATH);
275  if (len)
276  {
277  wsprintfW(text, templateText, (LPWSTR)lParam);
279  }
280 
281  SetFocus(GetDlgItem(hwndDlg, IDOK));
282  return TRUE;
283  }
284 
285  case WM_CLOSE:
286  {
287  EndDialog(hwndDlg, IDCANCEL);
288  return TRUE;
289  }
290  }
291 
292  return FALSE;
293 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2208
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
const WCHAR * text
Definition: package.c:1827
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_CLOSE
Definition: winuser.h:1603
#define MAX_PATH
Definition: compat.h:26
GLenum GLsizei len
Definition: glext.h:6722
#define WM_COMMAND
Definition: winuser.h:1722
#define IDC_GINALOADFAILED
Definition: resource.h:13
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by WinMain().

◆ InitKeyboardLayouts()

static BOOL InitKeyboardLayouts ( VOID  )
static

Definition at line 152 of file winlogon.c.

153 {
154  WCHAR wszKeyName[12], wszKLID[10];
155  DWORD dwSize = sizeof(wszKLID), dwType, i = 1;
156  HKEY hKey;
157  UINT Flags;
158  BOOL bRet = FALSE;
159 
160  /* Open registry key with preloaded layouts */
161  if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
162  {
163  while (TRUE)
164  {
165  /* Read values with integer names only */
166  swprintf(wszKeyName, L"%d", i++);
167  if (RegQueryValueExW(hKey, wszKeyName, NULL, &dwType, (LPBYTE)wszKLID, &dwSize) != ERROR_SUCCESS)
168  {
169  /* There is no more entries */
170  break;
171  }
172 
173  /* Only REG_SZ values are valid */
174  if (dwType != REG_SZ)
175  {
176  ERR("Wrong type: %ws!\n", wszKLID);
177  continue;
178  }
179 
180  /* Load keyboard layout with given locale id */
182  if (i > 1)
184  else // First layout
185  Flags |= KLF_ACTIVATE; // |0x40000000
186  if (!LoadKeyboardLayoutW(wszKLID, Flags))
187  {
188  ERR("LoadKeyboardLayoutW(%ws) failed!\n", wszKLID);
189  continue;
190  }
191  else
192  {
193  /* We loaded at least one layout - success */
194  bRet = TRUE;
195  }
196  }
197 
198  /* Close the key now */
199  RegCloseKey(hKey);
200  }
201  else
202  WARN("RegOpenKeyExW(Keyboard Layout\\Preload) failed!\n");
203 
204  if (!bRet)
205  {
206  /* If we failed, load US keyboard layout */
208  bRet = TRUE;
209  }
210 
211  return bRet;
212 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define KLF_ACTIVATE
Definition: winuser.h:111
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WARN(fmt,...)
Definition: debug.h:111
#define KLF_NOTELLSHELL
Definition: winuser.h:116
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define KLF_SUBSTITUTE_OK
Definition: winuser.h:112
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define KLF_REPLACELANG
Definition: winuser.h:115
#define ERR(fmt,...)
Definition: debug.h:109
#define KLF_SETFORPROCESS
Definition: winuser.h:117
HKL WINAPI LoadKeyboardLayoutW(_In_ LPCWSTR, _In_ UINT)
unsigned int UINT
Definition: ndis.h:50
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define REG_SZ
Definition: layer.c:22

Referenced by WinMain().

◆ RemoveStatusMessage()

BOOL RemoveStatusMessage ( IN PWLSESSION  Session)

Definition at line 237 of file winlogon.c.

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

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

◆ StartLsass()

static BOOL StartLsass ( VOID  )
static

Definition at line 74 of file winlogon.c.

75 {
76  STARTUPINFOW StartupInfo;
77  PROCESS_INFORMATION ProcessInformation;
78  LPCWSTR ServiceString = L"lsass.exe";
79  BOOL res;
80 
81  /* Start the local security authority subsystem (lsass.exe) */
82  ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
83  StartupInfo.cb = sizeof(StartupInfo);
84  StartupInfo.lpReserved = NULL;
85  StartupInfo.lpDesktop = NULL;
86  StartupInfo.lpTitle = NULL;
87  StartupInfo.dwFlags = 0;
88  StartupInfo.cbReserved2 = 0;
89  StartupInfo.lpReserved2 = 0;
90 
91  TRACE("WL: Creating new process - %S\n", ServiceString);
92 
93  res = CreateProcessW(ServiceString,
94  NULL,
95  NULL,
96  NULL,
97  FALSE,
99  NULL,
100  NULL,
101  &StartupInfo,
102  &ProcessInformation);
103 
104  TRACE("WL: Created new process - %S\n", ServiceString);
105 
106  CloseHandle(ProcessInformation.hThread);
107  CloseHandle(ProcessInformation.hProcess);
108 
109  return res;
110 }
#define CloseHandle
Definition: compat.h:398
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPWSTR lpReserved
Definition: winbase.h:818
PBYTE lpReserved2
Definition: winbase.h:831
#define ZeroMemory
Definition: winbase.h:1635
WORD cbReserved2
Definition: winbase.h:830
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR lpDesktop
Definition: winbase.h:819
smooth NULL
Definition: ftsmooth.c:416
LPWSTR lpTitle
Definition: winbase.h:820
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:4623
#define TRACE(s)
Definition: solgame.cpp:4
DWORD cb
Definition: winbase.h:817
static const WCHAR L[]
Definition: oid.c:1250
#define DETACHED_PROCESS
Definition: winbase.h:179
GLuint res
Definition: glext.h:9613
DWORD dwFlags
Definition: winbase.h:828

Referenced by WinMain().

◆ StartServicesManager()

static BOOL StartServicesManager ( VOID  )
static

Definition at line 26 of file winlogon.c.

27 {
28  STARTUPINFOW StartupInfo;
29  PROCESS_INFORMATION ProcessInformation;
30  LPCWSTR ServiceString = L"services.exe";
31  BOOL res;
32 
33  /* Start the service control manager (services.exe) */
34  ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
35  StartupInfo.cb = sizeof(StartupInfo);
36  StartupInfo.lpReserved = NULL;
37  StartupInfo.lpDesktop = NULL;
38  StartupInfo.lpTitle = NULL;
39  StartupInfo.dwFlags = 0;
40  StartupInfo.cbReserved2 = 0;
41  StartupInfo.lpReserved2 = 0;
42 
43  TRACE("WL: Creating new process - %S\n", ServiceString);
44 
45  res = CreateProcessW(ServiceString,
46  NULL,
47  NULL,
48  NULL,
49  FALSE,
51  NULL,
52  NULL,
53  &StartupInfo,
54  &ProcessInformation);
55  if (!res)
56  {
57  ERR("WL: Failed to execute services (error %lu)\n", GetLastError());
58  return FALSE;
59  }
60 
61  TRACE("WL: Created new process - %S\n", ServiceString);
62 
63  CloseHandle(ProcessInformation.hThread);
64  CloseHandle(ProcessInformation.hProcess);
65 
66  TRACE("WL: StartServicesManager() done.\n");
67 
68  return TRUE;
69 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LPWSTR lpReserved
Definition: winbase.h:818
PBYTE lpReserved2
Definition: winbase.h:831
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
WORD cbReserved2
Definition: winbase.h:830
unsigned int BOOL
Definition: ntddk_ex.h:94
LPWSTR lpDesktop
Definition: winbase.h:819
smooth NULL
Definition: ftsmooth.c:416
LPWSTR lpTitle
Definition: winbase.h:820
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:4623
#define TRACE(s)
Definition: solgame.cpp:4
DWORD cb
Definition: winbase.h:817
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:109
#define DETACHED_PROCESS
Definition: winbase.h:179
GLuint res
Definition: glext.h:9613
DWORD dwFlags
Definition: winbase.h:828

Referenced by WinMain().

◆ WaitForLsass()

static VOID WaitForLsass ( VOID  )
static

Definition at line 115 of file winlogon.c.

116 {
117  HANDLE hEvent;
118  DWORD dwError;
119 
121  TRUE,
122  FALSE,
123  L"LSA_RPC_SERVER_ACTIVE");
124  if (hEvent == NULL)
125  {
126  dwError = GetLastError();
127  TRACE("WL: Failed to create the notification event (Error %lu)\n", dwError);
128 
129  if (dwError == ERROR_ALREADY_EXISTS)
130  {
132  FALSE,
133  L"LSA_RPC_SERVER_ACTIVE");
134  if (hEvent == NULL)
135  {
136  ERR("WL: Could not open the notification event (Error %lu)\n", GetLastError());
137  return;
138  }
139  }
140  }
141 
142  TRACE("WL: Wait for the LSA server!\n");
144  TRACE("WL: LSA server running!\n");
145 
147 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
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
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:628
static HANDLE hEvent
Definition: comm.c:54
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define SYNCHRONIZE
Definition: nt_native.h:61
#define ERR(fmt,...)
Definition: debug.h:109
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define INFINITE
Definition: serial.h:102

Referenced by WinMain().

◆ WinMain()

int WINAPI WinMain ( IN HINSTANCE  hInstance,
IN HINSTANCE  hPrevInstance,
IN LPSTR  lpCmdLine,
IN int  nShowCmd 
)

Definition at line 298 of file winlogon.c.

303 {
304 #if 0
305  LSA_STRING ProcessName, PackageName;
308  BOOLEAN Old;
311 #endif
312  ULONG HardErrorResponse;
313  MSG Msg;
314 
315  UNREFERENCED_PARAMETER(hPrevInstance);
316  UNREFERENCED_PARAMETER(lpCmdLine);
317  UNREFERENCED_PARAMETER(nShowCmd);
318 
320 
321  /* Make us critical */
324 
326  {
327  ERR("WL: Could not register logon process\n");
328  NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
329  ExitProcess(1);
330  }
331 
333  if (!WLSession)
334  {
335  ERR("WL: Could not allocate memory for winlogon instance\n");
336  NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
337  ExitProcess(1);
338  }
339 
340  ZeroMemory(WLSession, sizeof(WLSESSION));
341  WLSession->DialogTimeout = 120; /* 2 minutes */
342 
343  /* Initialize the dialog tracking list */
345 
347  {
348  ERR("WL: Could not create window station and desktops\n");
349  NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
350  ExitProcess(1);
351  }
352 
354 
355  /* Load default keyboard layouts */
356  if (!InitKeyboardLayouts())
357  {
358  ERR("WL: Could not preload keyboard layouts\n");
359  NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
360  ExitProcess(1);
361  }
362 
363  if (!StartRpcServer())
364  {
365  ERR("WL: Could not start the RPC server\n");
366  NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
367  ExitProcess(1);
368  }
369 
370  if (!StartServicesManager())
371  {
372  ERR("WL: Could not start services.exe\n");
373  NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
374  ExitProcess(1);
375  }
376 
377  if (!StartLsass())
378  {
379  ERR("WL: Failed to start lsass.exe service (error %lu)\n", GetLastError());
380  NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, NULL, OptionOk, &HardErrorResponse);
381  ExitProcess(1);
382  }
383 
384  /* Wait for the LSA server */
385  WaitForLsass();
386 
387  /* Init Notifications */
389 
390  /* Load and initialize gina */
391  if (!GinaInit(WLSession))
392  {
393  ERR("WL: Failed to initialize Gina\n");
394  // FIXME: Retrieve the real name of the GINA DLL we were trying to load.
395  // It is known only inside the GinaInit function...
398  ExitProcess(1);
399  }
400 
402 
403 #if 0
404  /* Connect to NetLogon service (lsass.exe) */
405  /* Real winlogon uses "Winlogon" */
406  RtlInitUnicodeString((PUNICODE_STRING)&ProcessName, L"Winlogon");
407  Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
409  {
410  /* Add the 'SeTcbPrivilege' privilege and try again */
412  if (!NT_SUCCESS(Status))
413  {
414  ERR("RtlAdjustPrivilege() failed with error %lu\n", LsaNtStatusToWinError(Status));
415  return 1;
416  }
417 
418  Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
419  }
420 
421  if (!NT_SUCCESS(Status))
422  {
423  ERR("LsaRegisterLogonProcess() failed with error %lu\n", LsaNtStatusToWinError(Status));
424  return 1;
425  }
426 
429  if (!NT_SUCCESS(Status))
430  {
431  ERR("LsaLookupAuthenticationPackage() failed with error %lu\n", LsaNtStatusToWinError(Status));
433  return 1;
434  }
435 #endif
436 
438 
439  /* Create a hidden window to get SAS notifications */
440  if (!InitializeSAS(WLSession))
441  {
442  ERR("WL: Failed to initialize SAS\n");
443  ExitProcess(2);
444  }
445 
446  // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_PREPARENETWORKCONNECTIONS);
447  // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGCOMPUTERSETTINGS);
448 
449  /* Display logged out screen */
452 
453  /* Check for pending setup */
454  if (GetSetupType() != 0)
455  {
456  /* Run setup and reboot when done */
457  TRACE("WL: Setup mode detected\n");
458  RunSetup();
459  }
460  else
461  {
463  }
464 
465  (void)LoadLibraryW(L"sfc_os.dll");
466 
467  /* Tell kernel that CurrentControlSet is good (needed
468  * to support Last good known configuration boot) */
470 
471  /* Message loop for the SAS window */
472  while (GetMessageW(&Msg, WLSession->SASWindow, 0, 0))
473  {
476  }
477 
479 
480  /* We never go there */
481 
482  return 0;
483 }
PWLSESSION WLSession
Definition: winlogon.c:20
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL DisplayStatusMessage(IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
Definition: winlogon.c:216
BOOL RemoveStatusMessage(IN PWLSESSION Session)
Definition: winlogon.c:237
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define WLX_WM_SAS
Definition: winwlx.h:71
BOOL WINAPI RegisterLogonProcess(DWORD, BOOL)
Definition: logon.c:43
#define TRUE
Definition: types.h:120
struct _WLSESSION * PWLSESSION
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
HDESK WinlogonDesktop
Definition: winlogon.h:224
_In_ ULONG Mode
Definition: hubbusif.h:303
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:553
static INT_PTR CALLBACK GinaLoadFailedWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: winlogon.c:250
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
HWND SASWindow
Definition: winlogon.h:220
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define CM_BOOT_FLAG_ACCEPTED
Definition: cmtypes.h:153
BOOL InitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:1578
LONG NTSTATUS
Definition: precomp.h:26
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1517
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
BOOL RunSetup(VOID)
Definition: setup.c:153
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
NTSTATUS HandleShutdown(IN OUT PWLSESSION Session, IN DWORD wlxAction)
Definition: sas.c:1039
DWORD GetSetupType(VOID)
Definition: setup.c:16
static VOID WaitForLsass(VOID)
Definition: winlogon.c:115
HANDLE LsaHandle
Definition: logon.c:14
BOOL InitNotifications(VOID)
Definition: notify.c:196
#define STATUS_PORT_CONNECTION_REFUSED
Definition: ntstatus.h:287
HINSTANCE hInstance
Definition: charmap.c:20
#define SE_TCB_PRIVILEGE
Definition: security.c:661
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
static BOOL InitKeyboardLayouts(VOID)
Definition: winlogon.c:152
#define IDS_REACTOSISSTARTINGUP
Definition: resource.h:35
NTSTATUS NTAPI NtInitializeRegistry(IN USHORT Flag)
Definition: ntapi.c:1298
struct _WLSESSION WLSESSION
BOOL GinaInit(IN OUT PWLSESSION Session)
Definition: wlx.c:919
HINSTANCE hAppInstance
Definition: winlogon.c:19
unsigned char BOOLEAN
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:622
LONG_PTR LPARAM
Definition: windef.h:208
NTSYSAPI NTSTATUS __cdecl RtlSetThreadIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
ULONG LSA_OPERATIONAL_MODE
Definition: ntsecapi.h:364
#define MICROSOFT_KERBEROS_NAME_W
Definition: ntsecapi.h:25
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1129
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DWORD DialogTimeout
Definition: winlogon.h:230
#define LockWorkstation(Session)
Definition: winlogon.h:211
#define DialogBoxParam
Definition: winuser.h:5662
NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE)
static const WCHAR L[]
Definition: oid.c:1250
BOOL StartRpcServer(VOID)
Definition: rpcserver.c:19
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
static BOOL StartServicesManager(VOID)
Definition: winlogon.c:26
VOID CleanupNotifications(VOID)
Definition: notify.c:318
#define IDD_GINALOADFAILED
Definition: resource.h:12
ULONG AuthenticationPackage
Definition: logon.c:15
static BOOL StartLsass(VOID)
Definition: winlogon.c:74
struct @1574 Msg[]
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:109
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:249
NTSTATUS NTAPI LsaLookupAuthenticationPackage(HANDLE, PLSA_STRING, PULONG)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL CreateWindowStationAndDesktops(IN OUT PWLSESSION Session)
Definition: wlx.c:1121
NTSYSAPI NTSTATUS __cdecl RtlSetProcessIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
unsigned int ULONG
Definition: retypes.h:1
NTSTATUS NTAPI LsaRegisterLogonProcess(PLSA_STRING, PHANDLE, PLSA_OPERATIONAL_MODE)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:656
VOID InitDialogListHead(VOID)
Definition: wlx.c:45
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188
LOGON_STATE LogonState
Definition: winlogon.h:229

Variable Documentation

◆ hAppInstance

HINSTANCE hAppInstance

Definition at line 19 of file winlogon.c.

Referenced by DisplayStatusMessage(), and WinMain().

◆ WLSession

PWLSESSION WLSession = NULL

Definition at line 20 of file winlogon.c.

Referenced by DefaultWlxScreenSaverNotify(), RunSetupThreadProc(), and WinMain().