1 /* $Id: winlogon.c,v 1.6 2000/08/12 19:33:23 dwelch Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: services/winlogon/winlogon.c
7 * PROGRAMMER: David Welch (welch@cwcom.net)
12 /* INCLUDES *****************************************************************/
17 #include <lsass/ntsecapi.h>
22 /* GLOBALS ******************************************************************/
24 /* FUNCTIONS *****************************************************************/
26 BOOLEAN
StartServices(VOID
)
28 HANDLE ServicesInitEvent
;
30 STARTUPINFO StartupInfo
;
31 PROCESS_INFORMATION ProcessInformation
;
33 ServicesInitEvent
= CreateEvent(NULL
,
36 "\\ServicesInitDone");
38 if (ServicesInitEvent
== NULL
)
40 DbgPrint("Failed to create services notification event\n");
44 /* Start the Win32 subsystem (csrss.exe) */
45 DbgPrint("WL: Executing services.exe\n");
47 StartupInfo
.cb
= sizeof(StartupInfo
);
48 StartupInfo
.lpReserved
= NULL
;
49 StartupInfo
.lpDesktop
= NULL
;
50 StartupInfo
.lpTitle
= NULL
;
51 StartupInfo
.dwFlags
= 0;
52 StartupInfo
.cbReserved2
= 0;
53 StartupInfo
.lpReserved2
= 0;
55 Result
= CreateProcess("C:\\reactos\\system32\\services.exe",
67 DbgPrint("WL: Failed to execute services\n");
71 DbgPrint("WL: Waiting for services\n");
72 WaitForSingleObject(ServicesInitEvent
, INFINITE
);
74 DbgPrint("WL: Finished waiting for services\n");
78 BOOLEAN
StartLsass(VOID
)
80 HANDLE LsassInitEvent
;
82 STARTUPINFO StartupInfo
;
83 PROCESS_INFORMATION ProcessInformation
;
85 LsassInitEvent
= CreateEvent(NULL
,
90 if (LsassInitEvent
== NULL
)
92 DbgPrint("Failed to create lsass notification event\n");
96 /* Start the Win32 subsystem (csrss.exe) */
97 DbgPrint("WL: Executing lsass.exe\n");
99 StartupInfo
.cb
= sizeof(StartupInfo
);
100 StartupInfo
.lpReserved
= NULL
;
101 StartupInfo
.lpDesktop
= NULL
;
102 StartupInfo
.lpTitle
= NULL
;
103 StartupInfo
.dwFlags
= 0;
104 StartupInfo
.cbReserved2
= 0;
105 StartupInfo
.lpReserved2
= 0;
107 Result
= CreateProcess("C:\\reactos\\system32\\lsass.exe",
116 &ProcessInformation
);
119 DbgPrint("WL: Failed to execute lsass\n");
123 DbgPrint("WL: Waiting for lsass\n");
124 WaitForSingleObject(LsassInitEvent
, INFINITE
);
126 DbgPrint("WL: Finished waiting for lsass\n");
130 VOID
DoLoginUser(PCHAR Name
, PCHAR Password
)
132 PROCESS_INFORMATION ProcessInformation
;
133 STARTUPINFO StartupInfo
;
136 StartupInfo
.cb
= sizeof(StartupInfo
);
137 StartupInfo
.lpReserved
= NULL
;
138 StartupInfo
.lpDesktop
= NULL
;
139 StartupInfo
.lpTitle
= NULL
;
140 StartupInfo
.dwFlags
= 0;
141 StartupInfo
.cbReserved2
= 0;
142 StartupInfo
.lpReserved2
= 0;
144 Result
= CreateProcess("C:\\reactos\\system32\\shell.exe",
153 &ProcessInformation
);
156 DbgPrint("WL: Failed to execute user shell\n");
159 WaitForSingleObject(ProcessInformation
.hProcess
, INFINITE
);
163 WinMain(HINSTANCE hInstance
,
164 HINSTANCE hPrevInstance
,
169 LSA_STRING ProcessName
;
172 LSA_OPERATIONAL_MODE Mode
;
174 CHAR LoginPrompt
[] = "login:";
175 CHAR PasswordPrompt
[] = "password:";
182 * FIXME: Create WindowStations here. At the moment lsass and services
189 /* FIXME: What name does the real WinLogon use? */
191 RtlInitUnicodeString((PUNICODE_STRING
)&ProcessName
, L
"WinLogon");
192 Status
= LsaRegisterLogonProcess(&ProcessName
, &LsaHandle
, &Mode
);
193 if (!NT_SUCCESS(Status
))
195 DbgPrint("WL: Failed to connect to lsass\n");
200 /* smss wouldn't have created a console for us */
206 /* Display login prompt */
207 WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE
),
215 ReadConsole(GetStdHandle(STD_INPUT_HANDLE
),
221 } while (LoginName
[i
- 1] != '\n');
222 LoginName
[i
- 1] = 0;
224 /* Display password prompt */
225 WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE
),
227 wcslen(PasswordPrompt
),
233 ReadConsole(GetStdHandle(STD_INPUT_HANDLE
),
239 } while (Password
[i
- 1] != '\n');
242 DoLoginUser(LoginName
, Password
);