ReactOS 0.4.16-dev-1946-g52006dd
winlogon.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Winlogon
4 * FILE: base/system/winlogon/winlogon.c
5 * PURPOSE: Logon
6 * PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
7 * Filip Navara
8 * Hervé Poussineau (hpoussin@reactos.org)
9 */
10
11/* INCLUDES *****************************************************************/
12
13#include "winlogon.h"
14
15#include <ndk/cmfuncs.h>
16
17/* GLOBALS ******************************************************************/
18
21
22/* FUNCTIONS *****************************************************************/
23
31{
32 PWSTR ptr;
33
34 if (!String)
35 return NULL;
36
37 ptr = RtlAllocateHeap(RtlGetProcessHeap(), 0,
38 (wcslen(String) + 1) * sizeof(WCHAR));
39 if (ptr)
41 return ptr;
42}
43
44
45static
46BOOL
48{
49 STARTUPINFOW StartupInfo;
50 PROCESS_INFORMATION ProcessInformation;
51 LPCWSTR ServiceString = L"services.exe";
52 BOOL res;
53
54 /* Start the service control manager (services.exe) */
55 ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
56 StartupInfo.cb = sizeof(StartupInfo);
57 StartupInfo.lpReserved = NULL;
58 StartupInfo.lpDesktop = NULL;
59 StartupInfo.lpTitle = NULL;
60 StartupInfo.dwFlags = 0;
61 StartupInfo.cbReserved2 = 0;
62 StartupInfo.lpReserved2 = 0;
63
64 TRACE("WL: Creating new process - %S\n", ServiceString);
65
66 res = CreateProcessW(ServiceString,
67 NULL,
68 NULL,
69 NULL,
70 FALSE,
72 NULL,
73 NULL,
74 &StartupInfo,
75 &ProcessInformation);
76 if (!res)
77 {
78 ERR("WL: Failed to execute services (error %lu)\n", GetLastError());
79 return FALSE;
80 }
81
82 TRACE("WL: Created new process - %S\n", ServiceString);
83
84 CloseHandle(ProcessInformation.hThread);
85 CloseHandle(ProcessInformation.hProcess);
86
87 TRACE("WL: StartServicesManager() done.\n");
88
89 return TRUE;
90}
91
92
93static
94BOOL
96{
97 STARTUPINFOW StartupInfo;
98 PROCESS_INFORMATION ProcessInformation;
99 LPCWSTR ServiceString = L"lsass.exe";
100 BOOL res;
101
102 /* Start the local security authority subsystem (lsass.exe) */
103 ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
104 StartupInfo.cb = sizeof(StartupInfo);
105 StartupInfo.lpReserved = NULL;
106 StartupInfo.lpDesktop = NULL;
107 StartupInfo.lpTitle = NULL;
108 StartupInfo.dwFlags = 0;
109 StartupInfo.cbReserved2 = 0;
110 StartupInfo.lpReserved2 = 0;
111
112 TRACE("WL: Creating new process - %S\n", ServiceString);
113
114 res = CreateProcessW(ServiceString,
115 NULL,
116 NULL,
117 NULL,
118 FALSE,
120 NULL,
121 NULL,
122 &StartupInfo,
123 &ProcessInformation);
124
125 TRACE("WL: Created new process - %S\n", ServiceString);
126
127 CloseHandle(ProcessInformation.hThread);
128 CloseHandle(ProcessInformation.hProcess);
129
130 return res;
131}
132
133
134static
135VOID
137{
139 DWORD dwError;
140
142 TRUE,
143 FALSE,
144 L"LSA_RPC_SERVER_ACTIVE");
145 if (hEvent == NULL)
146 {
147 dwError = GetLastError();
148 TRACE("WL: Failed to create the notification event (Error %lu)\n", dwError);
149
150 if (dwError == ERROR_ALREADY_EXISTS)
151 {
153 FALSE,
154 L"LSA_RPC_SERVER_ACTIVE");
155 if (hEvent == NULL)
156 {
157 ERR("WL: Could not open the notification event (Error %lu)\n", GetLastError());
158 return;
159 }
160 }
161 }
162
163 TRACE("WL: Wait for the LSA server!\n");
165 TRACE("WL: LSA server running!\n");
166
168}
169
170
171static
172VOID
174{
175 LONG lError;
176 HKEY hKey = NULL;
177 DWORD dwType, dwSize;
178 PWSTR pszBuffer;
179 WCHAR szBuffer[128] = L"";
180
182 L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
183 0,
185 &hKey);
186 if (lError != ERROR_SUCCESS)
187 {
188 ERR("WL: RegOpenKeyExW(\"HKLM\\System\\CurrentControlSet\\Services\\Tcpip\\Parameters\") failed (error %lu)\n", lError);
189 return;
190 }
191
192 /*
193 * Read the "NV Hostname" value and copy it into the "Hostname" value.
194 */
195
196 pszBuffer = szBuffer;
197 dwSize = ARRAYSIZE(szBuffer);
198
199 lError = RegQueryValueExW(hKey,
200 L"NV Hostname",
201 NULL,
202 &dwType,
203 (LPBYTE)pszBuffer,
204 &dwSize);
205 if (((lError == ERROR_INSUFFICIENT_BUFFER) || (lError == ERROR_MORE_DATA)) && (dwType == REG_SZ))
206 {
207 pszBuffer = HeapAlloc(GetProcessHeap(), 0, dwSize);
208 if (pszBuffer)
209 {
210 lError = RegQueryValueExW(hKey,
211 L"NV Hostname",
212 NULL,
213 &dwType,
214 (LPBYTE)pszBuffer,
215 &dwSize);
216 }
217 else
218 {
219 ERR("WL: Could not reallocate memory for pszBuffer\n");
220 }
221 }
222 if ((lError == ERROR_SUCCESS) && (dwType == REG_SZ))
223 {
224 TRACE("NV Hostname is '%S'.\n", pszBuffer);
225
226 lError = RegSetValueExW(hKey,
227 L"Hostname",
228 0,
229 REG_SZ,
230 (LPBYTE)pszBuffer,
231 dwSize);
232 if (lError != ERROR_SUCCESS)
233 ERR("WL: RegSetValueExW(\"Hostname\") failed (error %lu)\n", lError);
234 }
235
236 /*
237 * Read the "NV Domain" value and copy it into the "Domain" value.
238 */
239
240 // pszBuffer = szBuffer;
241 // dwSize = ARRAYSIZE(szBuffer);
242
243 lError = RegQueryValueExW(hKey,
244 L"NV Domain",
245 NULL,
246 &dwType,
247 (LPBYTE)pszBuffer,
248 &dwSize);
249 if (((lError == ERROR_INSUFFICIENT_BUFFER) || (lError == ERROR_MORE_DATA)) && (dwType == REG_SZ))
250 {
251 if (pszBuffer != szBuffer)
252 {
253 PWSTR pszNewBuffer;
254 pszNewBuffer = HeapReAlloc(GetProcessHeap(), 0, pszBuffer, dwSize);
255 if (pszNewBuffer)
256 {
257 pszBuffer = pszNewBuffer;
258 }
259 else
260 {
261 HeapFree(GetProcessHeap(), 0, pszBuffer);
262 pszBuffer = NULL;
263 }
264 }
265 else
266 {
267 pszBuffer = HeapAlloc(GetProcessHeap(), 0, dwSize);
268 }
269 if (pszBuffer)
270 {
271 lError = RegQueryValueExW(hKey,
272 L"NV Domain",
273 NULL,
274 &dwType,
275 (LPBYTE)pszBuffer,
276 &dwSize);
277 }
278 else
279 {
280 ERR("WL: Could not reallocate memory for pszBuffer\n");
281 }
282 }
283 if ((lError == ERROR_SUCCESS) && (dwType == REG_SZ))
284 {
285 TRACE("NV Domain is '%S'.\n", pszBuffer);
286
287 lError = RegSetValueExW(hKey,
288 L"Domain",
289 0,
290 REG_SZ,
291 (LPBYTE)pszBuffer,
292 dwSize);
293 if (lError != ERROR_SUCCESS)
294 ERR("WL: RegSetValueExW(\"Domain\") failed (error %lu)\n", lError);
295 }
296
297 if (pszBuffer != szBuffer)
298 HeapFree(GetProcessHeap(), 0, pszBuffer);
299
301}
302
303
304static
305BOOL
307{
308 WCHAR wszKeyName[12], wszKLID[10];
309 DWORD dwSize = sizeof(wszKLID), dwType, i = 1;
310 HKEY hKey;
311 UINT Flags;
312 BOOL bRet = FALSE;
313
314 /* Open registry key with preloaded layouts */
315 if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Keyboard Layout\\Preload", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
316 {
317 while (TRUE)
318 {
319 /* Read values with integer names only */
320 swprintf(wszKeyName, L"%d", i++);
321 if (RegQueryValueExW(hKey, wszKeyName, NULL, &dwType, (LPBYTE)wszKLID, &dwSize) != ERROR_SUCCESS)
322 {
323 /* There is no more entries */
324 break;
325 }
326
327 /* Only REG_SZ values are valid */
328 if (dwType != REG_SZ)
329 {
330 ERR("Wrong type: %ws!\n", wszKLID);
331 continue;
332 }
333
334 /* Load keyboard layout with given locale id */
336 if (i > 1)
338 else // First layout
339 Flags |= KLF_ACTIVATE; // |0x40000000
340 if (!LoadKeyboardLayoutW(wszKLID, Flags))
341 {
342 ERR("LoadKeyboardLayoutW(%ws) failed!\n", wszKLID);
343 continue;
344 }
345 else
346 {
347 /* We loaded at least one layout - success */
348 bRet = TRUE;
349 }
350 }
351
352 /* Close the key now */
354 }
355 else
356 WARN("RegOpenKeyExW(Keyboard Layout\\Preload) failed!\n");
357
358 if (!bRet)
359 {
360 /* If we failed, load US keyboard layout */
362 bRet = TRUE;
363 }
364
365 return bRet;
366}
367
368
369BOOL
371 IN PWLSESSION Session,
372 IN HDESK hDesktop,
374{
375 WCHAR StatusMsg[MAX_PATH];
376
377 if (Session->Gina.Version < WLX_VERSION_1_3)
378 return TRUE;
379
380 if (Session->SuppressStatus)
381 return TRUE;
382
383 if (LoadStringW(hAppInstance, ResourceId, StatusMsg, MAX_PATH) == 0)
384 return FALSE;
385
386 return Session->Gina.Functions.WlxDisplayStatusMessage(Session->Gina.Context, hDesktop, 0, NULL, StatusMsg);
387}
388
389
390BOOL
392 IN PWLSESSION Session)
393{
394 if (Session->Gina.Version < WLX_VERSION_1_3)
395 return TRUE;
396
397 return Session->Gina.Functions.WlxRemoveStatusMessage(Session->Gina.Context);
398}
399
400
401static
405 IN HWND hwndDlg,
406 IN UINT uMsg,
409{
410 switch (uMsg)
411 {
412 case WM_COMMAND:
413 {
414 switch (LOWORD(wParam))
415 {
416 case IDOK:
417 EndDialog(hwndDlg, IDOK);
418 return TRUE;
419 }
420 break;
421 }
422
423 case WM_INITDIALOG:
424 {
425 int len;
426 WCHAR templateText[MAX_PATH], text[MAX_PATH];
427
428 len = GetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, templateText, MAX_PATH);
429 if (len)
430 {
431 wsprintfW(text, templateText, (LPWSTR)lParam);
433 }
434 return TRUE;
435 }
436
437 case WM_CLOSE:
438 {
439 EndDialog(hwndDlg, IDCANCEL);
440 return TRUE;
441 }
442 }
443
444 return FALSE;
445}
446
447
448int
449WINAPI
452 IN HINSTANCE hPrevInstance,
453 IN LPSTR lpCmdLine,
454 IN int nShowCmd)
455{
456#if 0
457 LSA_STRING ProcessName, PackageName;
460 BOOLEAN Old;
463#endif
464 ULONG HardErrorResponse;
465 MSG Msg;
466
467 UNREFERENCED_PARAMETER(hPrevInstance);
468 UNREFERENCED_PARAMETER(lpCmdLine);
469 UNREFERENCED_PARAMETER(nShowCmd);
470
472
473 /* Make us critical */
476
477 /* Update the cached TCP/IP Information in the registry */
479
481 {
482 ERR("WL: Could not register logon process\n");
484 ExitProcess(1);
485 }
486
488 if (!WLSession)
489 {
490 ERR("WL: Could not allocate memory for winlogon instance\n");
492 ExitProcess(1);
493 }
494
496 WLSession->DialogTimeout = 120; /* 2 minutes */
497
498 /* Initialize the dialog tracking list */
500
502 {
503 ERR("WL: Could not create window station and desktops\n");
505 ExitProcess(1);
506 }
507
509
510 /* Load default keyboard layouts */
511 if (!InitKeyboardLayouts())
512 {
513 ERR("WL: Could not preload keyboard layouts\n");
515 ExitProcess(1);
516 }
517
518 if (!StartRpcServer())
519 {
520 ERR("WL: Could not start the RPC server\n");
522 ExitProcess(1);
523 }
524
526 {
527 ERR("WL: Could not start services.exe\n");
529 ExitProcess(1);
530 }
531
532 if (!StartLsass())
533 {
534 ERR("WL: Failed to start lsass.exe service (error %lu)\n", GetLastError());
536 ExitProcess(1);
537 }
538
539 /* Wait for the LSA server */
540 WaitForLsass();
541
542 /* Init Notifications */
544
545 /* Load and initialize gina */
546 if (!GinaInit(WLSession))
547 {
548 ERR("WL: Failed to initialize Gina\n");
549 // FIXME: Retrieve the real name of the GINA DLL we were trying to load.
550 // It is known only inside the GinaInit function...
553 ExitProcess(1);
554 }
555
557
558#if 0
559 /* Connect to NetLogon service (lsass.exe) */
560 /* Real winlogon uses "Winlogon" */
561 RtlInitUnicodeString((PUNICODE_STRING)&ProcessName, L"Winlogon");
562 Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
564 {
565 /* Add the 'SeTcbPrivilege' privilege and try again */
567 if (!NT_SUCCESS(Status))
568 {
569 ERR("RtlAdjustPrivilege() failed with error %lu\n", LsaNtStatusToWinError(Status));
570 return 1;
571 }
572
573 Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
574 }
575
576 if (!NT_SUCCESS(Status))
577 {
578 ERR("LsaRegisterLogonProcess() failed with error %lu\n", LsaNtStatusToWinError(Status));
579 return 1;
580 }
581
584 if (!NT_SUCCESS(Status))
585 {
586 ERR("LsaLookupAuthenticationPackage() failed with error %lu\n", LsaNtStatusToWinError(Status));
588 return 1;
589 }
590#endif
591
593
594 /* Create a hidden window to get SAS notifications */
596 {
597 ERR("WL: Failed to initialize SAS\n");
598 ExitProcess(2);
599 }
600
601 // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_PREPARENETWORKCONNECTIONS);
602 // DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGCOMPUTERSETTINGS);
603
604 /* Display logged out screen */
607
608 /* Check for pending setup */
609 if (GetSetupType() != 0)
610 {
611 /* Run setup and reboot when done */
612 TRACE("WL: Setup mode detected\n");
613 RunSetup();
614 }
615 else
616 {
618 }
619
620 /* Tell kernel that CurrentControlSet is good (needed
621 * to support Last good known configuration boot) */
623
624 /* Message loop for the SAS window */
625 while (GetMessageW(&Msg, WLSession->SASWindow, 0, 0))
626 {
629 }
630
632
633 /* We never go there */
634 // TODO: Shutdown if we are in session 0, otherwise let the process terminate.
636 return 0;
637}
INT ResourceId
Definition: LoadImageGCC.c:72
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
DWORD StartRpcServer(VOID)
Definition: rpcserver.c:32
HANDLE LsaHandle
Definition: wkssvc.c:41
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL InitNotifications(VOID)
Definition: notify.c:420
VOID CallNotificationDlls(PWLSESSION pSession, NOTIFICATION_TYPE Type)
Definition: notify.c:530
VOID CleanupNotifications(VOID)
Definition: notify.c:593
#define IDD_GINALOADFAILED
Definition: resource.h:14
#define IDC_GINALOADFAILED
Definition: resource.h:15
#define IDS_REACTOSISSTARTINGUP
Definition: resource.h:37
DWORD GetSetupType(VOID)
Definition: setup.c:16
BOOL RunSetup(VOID)
Definition: setup.c:153
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
#define RegCloseKey(hKey)
Definition: registry.h:49
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
struct @1765 Msg[]
wcscpy
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
ULONG AuthenticationPackage
Definition: logon.c:18
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1131
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
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:4600
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1489
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
const WCHAR * text
Definition: package.c:1794
#define swprintf
Definition: precomp.h:40
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
Status
Definition: gdiplustypes.h:25
GLuint res
Definition: glext.h:9613
GLenum GLsizei len
Definition: glext.h:6722
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
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:551
_In_ ULONG Mode
Definition: hubbusif.h:303
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static PVOID ptr
Definition: dispmode.c:27
#define SE_TCB_PRIVILEGE
Definition: security.c:661
static HANDLE hEvent
Definition: comm.c:54
unsigned int UINT
Definition: ndis.h:50
#define CM_BOOT_FLAG_ACCEPTED
Definition: cmtypes.h:160
@ OptionOk
Definition: extypes.h:187
NTSYSAPI NTSTATUS __cdecl RtlSetThreadIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
NTSYSAPI NTSTATUS NTAPI RtlAdjustPrivilege(_In_ ULONG Privilege, _In_ BOOLEAN NewValue, _In_ BOOLEAN ForThread, _Out_ PBOOLEAN OldValue)
NTSYSAPI NTSTATUS __cdecl RtlSetProcessIsCritical(_In_ BOOLEAN NewValue, _Out_opt_ PBOOLEAN OldValue, _In_ BOOLEAN NeedBreaks)
#define _In_opt_
Definition: no_sal2.h:212
#define SYNCHRONIZE
Definition: nt_native.h:61
#define KEY_READ
Definition: nt_native.h:1026
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_QUERY_VALUE
Definition: nt_native.h:1019
#define KEY_SET_VALUE
Definition: nt_native.h:1020
NTSTATUS NTAPI NtInitializeRegistry(IN USHORT Flag)
Definition: ntapi.c:1318
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define MICROSOFT_KERBEROS_NAME_W
Definition: ntsecapi.h:25
NTSTATUS NTAPI LsaLookupAuthenticationPackage(HANDLE, PLSA_STRING, PULONG)
ULONG LSA_OPERATIONAL_MODE
Definition: ntsecapi.h:367
NTSTATUS NTAPI LsaDeregisterLogonProcess(HANDLE)
NTSTATUS NTAPI LsaRegisterLogonProcess(PLSA_STRING, PHANDLE, PLSA_OPERATIONAL_MODE)
#define STATUS_PORT_CONNECTION_REFUSED
Definition: ntstatus.h:395
#define STATUS_SYSTEM_PROCESS_TERMINATED
Definition: ntstatus.h:792
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
NTSTATUS HandleShutdown(IN OUT PWLSESSION Session, IN DWORD wlxAction)
Definition: sas.c:1149
BOOL InitializeSAS(IN OUT PWLSESSION Session)
Definition: sas.c:1740
#define TRACE(s)
Definition: solgame.cpp:4
DWORD DialogTimeout
Definition: winlogon.h:240
HDESK WinlogonDesktop
Definition: winlogon.h:234
LOGON_STATE LogonState
Definition: winlogon.h:239
HWND SASWindow
Definition: winlogon.h:228
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:802
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:682
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
uint16_t * PWSTR
Definition: typedefs.h:56
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
unsigned char * LPBYTE
Definition: typedefs.h:53
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2439
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define DETACHED_PROCESS
Definition: winbase.h:183
#define WINAPI
Definition: msvc.h:6
BOOL DisplayStatusMessage(IN PWLSESSION Session, IN HDESK hDesktop, IN UINT ResourceId)
Definition: winlogon.c:370
static BOOL InitKeyboardLayouts(VOID)
Definition: winlogon.c:306
PWSTR WlStrDup(_In_opt_ PCWSTR String)
Duplicates the given string, allocating a buffer on the heap.
Definition: winlogon.c:29
static BOOL StartLsass(VOID)
Definition: winlogon.c:95
static INT_PTR CALLBACK GinaLoadFailedWindowProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: winlogon.c:404
static BOOL StartServicesManager(VOID)
Definition: winlogon.c:47
int WINAPI WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd)
Definition: winlogon.c:450
PWLSESSION WLSession
Definition: winlogon.c:20
static VOID UpdateTcpIpInformation(VOID)
Definition: winlogon.c:173
HINSTANCE hAppInstance
Definition: winlogon.c:19
BOOL RemoveStatusMessage(IN PWLSESSION Session)
Definition: winlogon.c:391
static VOID WaitForLsass(VOID)
Definition: winlogon.c:136
#define LockWorkstation(Session)
Definition: winlogon.h:217
BOOL GinaInit(IN OUT PWLSESSION Session)
Definition: wlx.c:930
struct _WLSESSION * PWLSESSION
VOID InitDialogListHead(VOID)
Definition: wlx.c:31
struct _WLSESSION WLSESSION
@ STATE_INIT
Definition: winlogon.h:204
BOOL CreateWindowStationAndDesktops(_Inout_ PWLSESSION Session)
Definition: wlx.c:953
@ StartupHandler
Definition: winlogon.h:268
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WM_CLOSE
Definition: winuser.h:1649
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define KLF_SETFORPROCESS
Definition: winuser.h:117
#define IDCANCEL
Definition: winuser.h:842
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define KLF_REPLACELANG
Definition: winuser.h:115
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
#define KLF_ACTIVATE
Definition: winuser.h:111
#define WM_COMMAND
Definition: winuser.h:1768
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define DialogBoxParam
Definition: winuser.h:5875
#define WM_INITDIALOG
Definition: winuser.h:1767
#define IDOK
Definition: winuser.h:841
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
HKL WINAPI LoadKeyboardLayoutW(_In_ LPCWSTR, _In_ UINT)
BOOL WINAPI RegisterLogonProcess(DWORD, BOOL)
Definition: logon.c:43
#define KLF_SUBSTITUTE_OK
Definition: winuser.h:112
#define KLF_NOTELLSHELL
Definition: winuser.h:116
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define WLX_SAS_TYPE_CTRL_ALT_DEL
Definition: winwlx.h:36
#define WLX_WM_SAS
Definition: winwlx.h:71
#define WLX_VERSION_1_3
Definition: winwlx.h:31
#define WLX_SAS_ACTION_SHUTDOWN_REBOOT
Definition: winwlx.h:63
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char * LPSTR
Definition: xmlstorage.h:182