2003-03-25 19:26:33 +00:00
|
|
|
/* $Id: winlogon.c,v 1.18 2003/03/25 19:26:33 ekohl Exp $
|
1999-07-17 23:10:31 +00:00
|
|
|
*
|
1999-06-06 16:40:10 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: services/winlogon/winlogon.c
|
|
|
|
* PURPOSE: Logon
|
|
|
|
* PROGRAMMER: David Welch (welch@cwcom.net)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* Created 22/05/98
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
2002-09-08 10:23:54 +00:00
|
|
|
|
2002-09-07 15:13:13 +00:00
|
|
|
#include <ntos.h>
|
2002-09-08 10:23:54 +00:00
|
|
|
#include <windows.h>
|
2000-08-12 19:33:23 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <lsass/ntsecapi.h>
|
1999-11-20 21:53:53 +00:00
|
|
|
#include <wchar.h>
|
|
|
|
|
2003-03-25 19:26:33 +00:00
|
|
|
#include "setup.h"
|
|
|
|
|
2003-03-20 20:56:52 +00:00
|
|
|
#define NDEBUG
|
2002-02-08 02:57:10 +00:00
|
|
|
#include <debug.h>
|
1999-11-20 21:53:53 +00:00
|
|
|
|
1999-06-08 22:45:53 +00:00
|
|
|
/* GLOBALS ******************************************************************/
|
|
|
|
|
2001-06-12 17:51:51 +00:00
|
|
|
HWINSTA InteractiveWindowStation; /* WinSta0 */
|
|
|
|
HDESK ApplicationDesktop; /* WinSta0\Default */
|
|
|
|
HDESK WinlogonDesktop; /* WinSta0\Winlogon */
|
|
|
|
HDESK ScreenSaverDesktop; /* WinSta0\Screen-Saver */
|
|
|
|
|
1999-06-06 16:40:10 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2003-02-02 22:38:54 +00:00
|
|
|
static void PrintString (char* fmt,...)
|
2001-01-20 18:40:27 +00:00
|
|
|
{
|
|
|
|
char buffer[512];
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vsprintf(buffer, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
OutputDebugString(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-02-02 22:38:54 +00:00
|
|
|
static BOOLEAN StartServices(VOID)
|
1999-06-06 16:40:10 +00:00
|
|
|
{
|
2000-08-12 19:33:23 +00:00
|
|
|
HANDLE ServicesInitEvent;
|
|
|
|
BOOLEAN Result;
|
|
|
|
STARTUPINFO StartupInfo;
|
|
|
|
PROCESS_INFORMATION ProcessInformation;
|
2000-12-08 00:45:04 +00:00
|
|
|
CHAR CommandLine[MAX_PATH];
|
|
|
|
DWORD Count;
|
2001-01-20 18:40:27 +00:00
|
|
|
|
2002-02-08 02:57:10 +00:00
|
|
|
/* Start the service control manager (services.exe) */
|
2000-12-08 00:45:04 +00:00
|
|
|
GetSystemDirectory(CommandLine, MAX_PATH);
|
|
|
|
strcat(CommandLine, "\\services.exe");
|
2002-02-08 02:57:10 +00:00
|
|
|
|
2000-08-12 19:33:23 +00:00
|
|
|
StartupInfo.cb = sizeof(StartupInfo);
|
|
|
|
StartupInfo.lpReserved = NULL;
|
|
|
|
StartupInfo.lpDesktop = NULL;
|
|
|
|
StartupInfo.lpTitle = NULL;
|
|
|
|
StartupInfo.dwFlags = 0;
|
|
|
|
StartupInfo.cbReserved2 = 0;
|
|
|
|
StartupInfo.lpReserved2 = 0;
|
|
|
|
|
2002-12-27 13:54:28 +00:00
|
|
|
PrintString("WL: Creating new process - \"services.exe\".\n");
|
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
Result = CreateProcess(CommandLine,
|
2002-12-27 13:54:28 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
DETACHED_PROCESS,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&StartupInfo,
|
|
|
|
&ProcessInformation);
|
2000-08-12 19:33:23 +00:00
|
|
|
if (!Result)
|
|
|
|
{
|
2002-12-27 13:54:28 +00:00
|
|
|
PrintString("WL: Failed to execute services\n");
|
|
|
|
return FALSE;
|
2000-08-12 19:33:23 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
/* wait for event creation (by SCM) for max. 20 seconds */
|
|
|
|
for (Count = 0; Count < 20; Count++)
|
|
|
|
{
|
2002-12-27 13:54:28 +00:00
|
|
|
Sleep(1000);
|
2000-12-08 00:45:04 +00:00
|
|
|
|
2002-12-27 13:54:28 +00:00
|
|
|
//DbgPrint("WL: Attempting to open event \"SvcctrlStartEvent_A3725DX\"\n");
|
|
|
|
ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE,
|
|
|
|
FALSE,
|
|
|
|
"SvcctrlStartEvent_A3725DX");
|
|
|
|
if (ServicesInitEvent != NULL)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2000-12-08 00:45:04 +00:00
|
|
|
}
|
|
|
|
|
2002-12-27 13:54:28 +00:00
|
|
|
if (ServicesInitEvent == NULL)
|
|
|
|
{
|
|
|
|
DbgPrint("WL: Failed to open event \"SvcctrlStartEvent_A3725DX\"\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
/* wait for event signalization */
|
2002-12-27 13:54:28 +00:00
|
|
|
//DbgPrint("WL: Waiting forever on event handle: %x\n", ServicesInitEvent);
|
2000-08-12 19:33:23 +00:00
|
|
|
WaitForSingleObject(ServicesInitEvent, INFINITE);
|
2002-12-27 13:54:28 +00:00
|
|
|
//DbgPrint("WL: Closing event object \"SvcctrlStartEvent_A3725DX\"\n");
|
2000-12-08 00:45:04 +00:00
|
|
|
CloseHandle(ServicesInitEvent);
|
2002-12-27 13:54:28 +00:00
|
|
|
DbgPrint("WL: StartServices() Done.\n");
|
2002-02-08 02:57:10 +00:00
|
|
|
|
2001-01-20 18:40:27 +00:00
|
|
|
return TRUE;
|
1999-06-06 16:40:10 +00:00
|
|
|
}
|
1999-06-08 22:45:53 +00:00
|
|
|
|
2003-02-02 22:38:54 +00:00
|
|
|
static BOOLEAN StartLsass(VOID)
|
1999-06-08 22:45:53 +00:00
|
|
|
{
|
2000-08-12 19:33:23 +00:00
|
|
|
HANDLE LsassInitEvent;
|
|
|
|
BOOLEAN Result;
|
|
|
|
STARTUPINFO StartupInfo;
|
|
|
|
PROCESS_INFORMATION ProcessInformation;
|
2000-12-08 00:45:04 +00:00
|
|
|
CHAR CommandLine[MAX_PATH];
|
2000-08-12 19:33:23 +00:00
|
|
|
|
|
|
|
LsassInitEvent = CreateEvent(NULL,
|
2002-12-27 13:54:28 +00:00
|
|
|
TRUE,
|
|
|
|
FALSE,
|
|
|
|
"\\LsassInitDone");
|
2000-08-12 19:33:23 +00:00
|
|
|
|
|
|
|
if (LsassInitEvent == NULL)
|
|
|
|
{
|
2002-12-27 13:54:28 +00:00
|
|
|
DbgPrint("WL: Failed to create lsass notification event\n");
|
|
|
|
return(FALSE);
|
2000-08-12 19:33:23 +00:00
|
|
|
}
|
|
|
|
|
2000-12-05 18:11:51 +00:00
|
|
|
/* Start the local security authority subsystem (lsass.exe) */
|
2000-08-12 19:33:23 +00:00
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
GetSystemDirectory(CommandLine, MAX_PATH);
|
|
|
|
strcat(CommandLine, "\\lsass.exe");
|
|
|
|
|
2000-08-12 19:33:23 +00:00
|
|
|
StartupInfo.cb = sizeof(StartupInfo);
|
|
|
|
StartupInfo.lpReserved = NULL;
|
|
|
|
StartupInfo.lpDesktop = NULL;
|
|
|
|
StartupInfo.lpTitle = NULL;
|
|
|
|
StartupInfo.dwFlags = 0;
|
|
|
|
StartupInfo.cbReserved2 = 0;
|
|
|
|
StartupInfo.lpReserved2 = 0;
|
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
Result = CreateProcess(CommandLine,
|
2002-12-27 13:54:28 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
DETACHED_PROCESS,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&StartupInfo,
|
|
|
|
&ProcessInformation);
|
2000-08-12 19:33:23 +00:00
|
|
|
if (!Result)
|
|
|
|
{
|
2002-12-27 13:54:28 +00:00
|
|
|
DbgPrint("WL: Failed to execute lsass\n");
|
|
|
|
return(FALSE);
|
2000-08-12 19:33:23 +00:00
|
|
|
}
|
|
|
|
|
2002-02-08 02:57:10 +00:00
|
|
|
DPRINT("WL: Waiting for lsass\n");
|
2000-08-12 19:33:23 +00:00
|
|
|
WaitForSingleObject(LsassInitEvent, INFINITE);
|
2000-12-08 00:45:04 +00:00
|
|
|
CloseHandle(LsassInitEvent);
|
2000-08-12 19:33:23 +00:00
|
|
|
|
|
|
|
return(TRUE);
|
1999-06-08 22:45:53 +00:00
|
|
|
}
|
|
|
|
|
2003-02-02 22:38:54 +00:00
|
|
|
static BOOLEAN OpenRegistryKey(HANDLE *WinLogonKey)
|
|
|
|
{
|
|
|
|
return ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
|
|
|
_T("SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\WinLogon"),
|
|
|
|
0,
|
|
|
|
KEY_QUERY_VALUE,
|
|
|
|
WinLogonKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOLEAN StartProcess(PCHAR ValueName)
|
|
|
|
{
|
|
|
|
BOOL StartIt;
|
|
|
|
HANDLE WinLogonKey;
|
|
|
|
DWORD Type;
|
|
|
|
DWORD Size;
|
|
|
|
DWORD StartValue;
|
|
|
|
|
|
|
|
StartIt = TRUE;
|
|
|
|
if (OpenRegistryKey(&WinLogonKey))
|
|
|
|
{
|
|
|
|
Size = sizeof(DWORD);
|
|
|
|
if (ERROR_SUCCESS == RegQueryValueEx(WinLogonKey,
|
|
|
|
ValueName,
|
|
|
|
NULL,
|
|
|
|
&Type,
|
|
|
|
(LPBYTE) &StartValue,
|
|
|
|
&Size))
|
|
|
|
{
|
|
|
|
if (REG_DWORD == Type)
|
|
|
|
{
|
|
|
|
StartIt = (0 != StartValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RegCloseKey(WinLogonKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
return StartIt;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PCHAR GetShell(PCHAR CommandLine)
|
2003-01-23 00:16:47 +00:00
|
|
|
{
|
|
|
|
HANDLE WinLogonKey;
|
|
|
|
BOOL GotCommandLine;
|
|
|
|
DWORD Type;
|
|
|
|
DWORD Size;
|
|
|
|
CHAR Shell[_MAX_PATH];
|
|
|
|
|
|
|
|
GotCommandLine = FALSE;
|
2003-02-02 22:38:54 +00:00
|
|
|
if (OpenRegistryKey(&WinLogonKey))
|
2003-01-23 00:16:47 +00:00
|
|
|
{
|
|
|
|
Size = MAX_PATH;
|
|
|
|
if (ERROR_SUCCESS == RegQueryValueEx(WinLogonKey,
|
|
|
|
_T("Shell"),
|
|
|
|
NULL,
|
|
|
|
&Type,
|
2003-02-02 22:38:54 +00:00
|
|
|
(LPBYTE) Shell,
|
2003-01-23 00:16:47 +00:00
|
|
|
&Size))
|
|
|
|
{
|
|
|
|
if (REG_EXPAND_SZ == Type)
|
|
|
|
{
|
|
|
|
ExpandEnvironmentStrings(Shell, CommandLine, _MAX_PATH);
|
|
|
|
GotCommandLine = TRUE;
|
|
|
|
}
|
|
|
|
else if (REG_SZ == Type)
|
|
|
|
{
|
|
|
|
strcpy(CommandLine, Shell);
|
|
|
|
GotCommandLine = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RegCloseKey(WinLogonKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! GotCommandLine)
|
|
|
|
{
|
|
|
|
GetSystemDirectory(CommandLine, MAX_PATH - 10);
|
2003-03-20 19:21:01 +00:00
|
|
|
strcat(CommandLine, "\\cmd.exe");
|
2003-01-23 00:16:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return CommandLine;
|
|
|
|
}
|
|
|
|
|
2003-02-02 22:38:54 +00:00
|
|
|
static BOOL DoLoginUser(PCHAR Name, PCHAR Password)
|
1999-06-08 22:45:53 +00:00
|
|
|
{
|
2000-08-12 19:33:23 +00:00
|
|
|
PROCESS_INFORMATION ProcessInformation;
|
|
|
|
STARTUPINFO StartupInfo;
|
|
|
|
BOOLEAN Result;
|
2000-12-08 00:45:04 +00:00
|
|
|
CHAR CommandLine[MAX_PATH];
|
|
|
|
CHAR CurrentDirectory[MAX_PATH];
|
|
|
|
|
|
|
|
GetWindowsDirectory(CurrentDirectory, MAX_PATH);
|
|
|
|
|
2000-08-12 19:33:23 +00:00
|
|
|
StartupInfo.cb = sizeof(StartupInfo);
|
|
|
|
StartupInfo.lpReserved = NULL;
|
|
|
|
StartupInfo.lpDesktop = NULL;
|
|
|
|
StartupInfo.lpTitle = NULL;
|
|
|
|
StartupInfo.dwFlags = 0;
|
|
|
|
StartupInfo.cbReserved2 = 0;
|
|
|
|
StartupInfo.lpReserved2 = 0;
|
|
|
|
|
2003-01-23 00:16:47 +00:00
|
|
|
Result = CreateProcess(NULL,
|
|
|
|
GetShell(CommandLine),
|
2002-12-27 13:54:28 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
FALSE,
|
|
|
|
DETACHED_PROCESS,
|
|
|
|
NULL,
|
|
|
|
CurrentDirectory,
|
|
|
|
&StartupInfo,
|
|
|
|
&ProcessInformation);
|
2000-08-12 19:33:23 +00:00
|
|
|
if (!Result)
|
|
|
|
{
|
2003-01-23 00:16:47 +00:00
|
|
|
DbgPrint("WL: Failed to execute user shell %s\n", CommandLine);
|
|
|
|
return FALSE;
|
2000-08-12 19:33:23 +00:00
|
|
|
}
|
|
|
|
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
|
2001-04-26 01:36:32 +00:00
|
|
|
CloseHandle( ProcessInformation.hProcess );
|
|
|
|
CloseHandle( ProcessInformation.hThread );
|
2003-01-23 00:16:47 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-06-08 22:45:53 +00:00
|
|
|
}
|
|
|
|
|
2000-08-12 19:33:23 +00:00
|
|
|
int STDCALL
|
2000-12-05 02:40:51 +00:00
|
|
|
WinMain(HINSTANCE hInstance,
|
2002-12-27 13:54:28 +00:00
|
|
|
HINSTANCE hPrevInstance,
|
|
|
|
LPSTR lpCmdLine,
|
|
|
|
int nShowCmd)
|
1999-06-08 22:45:53 +00:00
|
|
|
{
|
2000-08-12 19:33:23 +00:00
|
|
|
#if 0
|
2002-07-17 21:04:57 +00:00
|
|
|
LSA_STRING ProcessName;
|
|
|
|
NTSTATUS Status;
|
|
|
|
HANDLE LsaHandle;
|
|
|
|
LSA_OPERATIONAL_MODE Mode;
|
2000-08-12 19:33:23 +00:00
|
|
|
#endif
|
2002-07-17 21:04:57 +00:00
|
|
|
CHAR LoginPrompt[] = "login:";
|
|
|
|
CHAR PasswordPrompt[] = "password:";
|
|
|
|
DWORD Result;
|
|
|
|
CHAR LoginName[255];
|
|
|
|
CHAR Password[255];
|
|
|
|
BOOL Success;
|
|
|
|
ULONG i;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FIXME: Create a security descriptor with
|
|
|
|
* one ACE containing the Winlogon SID
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the interactive window station
|
|
|
|
*/
|
|
|
|
InteractiveWindowStation =
|
|
|
|
CreateWindowStationW(L"WinSta0", 0, GENERIC_ALL, NULL);
|
2002-06-11 22:09:03 +00:00
|
|
|
if (InteractiveWindowStation == NULL)
|
|
|
|
{
|
2002-12-27 13:54:28 +00:00
|
|
|
DbgPrint("WL: Failed to create window station (0x%X)\n", GetLastError());
|
2002-06-11 22:09:03 +00:00
|
|
|
NtRaiseHardError(STATUS_SYSTEM_PROCESS_TERMINATED, 0, 0, 0, 0, 0);
|
|
|
|
ExitProcess(1);
|
|
|
|
}
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2001-06-12 17:51:51 +00:00
|
|
|
/*
|
|
|
|
* Set the process window station
|
|
|
|
*/
|
|
|
|
SetProcessWindowStation(InteractiveWindowStation);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the application desktop
|
|
|
|
*/
|
2002-07-17 21:04:57 +00:00
|
|
|
ApplicationDesktop =
|
|
|
|
CreateDesktopW(L"Default",
|
2002-12-27 13:54:28 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
0, /* FIXME: Set some flags */
|
|
|
|
GENERIC_ALL,
|
|
|
|
NULL);
|
2001-06-12 17:51:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the winlogon desktop
|
|
|
|
*/
|
2002-07-17 21:04:57 +00:00
|
|
|
WinlogonDesktop = CreateDesktopW(L"Winlogon",
|
2002-12-27 13:54:28 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
0, /* FIXME: Set some flags */
|
|
|
|
GENERIC_ALL,
|
|
|
|
NULL);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2001-06-12 17:51:51 +00:00
|
|
|
/*
|
|
|
|
* Create the screen saver desktop
|
|
|
|
*/
|
2002-07-17 21:04:57 +00:00
|
|
|
ScreenSaverDesktop = CreateDesktopW(L"Screen-Saver",
|
2002-12-27 13:54:28 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
0, /* FIXME: Set some flags */
|
|
|
|
GENERIC_ALL,
|
|
|
|
NULL);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2001-06-12 17:51:51 +00:00
|
|
|
/*
|
|
|
|
* Switch to winlogon desktop
|
|
|
|
*/
|
2002-07-17 21:04:57 +00:00
|
|
|
/* FIXME: Do start up in the application desktop for now. */
|
|
|
|
Status = NtSetInformationProcess(NtCurrentProcess(),
|
2002-12-27 13:54:28 +00:00
|
|
|
ProcessDesktop,
|
|
|
|
&ApplicationDesktop,
|
|
|
|
sizeof(ApplicationDesktop));
|
2002-07-17 21:04:57 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DbgPrint("WL: Cannot set default desktop for winlogon.\n");
|
|
|
|
}
|
|
|
|
SetThreadDesktop(ApplicationDesktop);
|
|
|
|
Success = SwitchDesktop(ApplicationDesktop);
|
2001-06-12 17:51:51 +00:00
|
|
|
if (!Success)
|
2002-07-17 21:04:57 +00:00
|
|
|
{
|
2002-12-27 13:54:28 +00:00
|
|
|
DbgPrint("WL: Cannot switch to Winlogon desktop (0x%X)\n", GetLastError());
|
2002-07-17 21:04:57 +00:00
|
|
|
}
|
2003-03-20 20:56:52 +00:00
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
AllocConsole();
|
2001-06-22 02:10:11 +00:00
|
|
|
SetConsoleTitle( "Winlogon" );
|
2003-03-25 19:26:33 +00:00
|
|
|
|
|
|
|
/* Check for pending setup */
|
|
|
|
if (GetSetupType () != 0)
|
|
|
|
{
|
|
|
|
DPRINT ("Winlogon: CheckForSetup() in setup mode\n");
|
|
|
|
|
|
|
|
/* Run setup and reboot when done */
|
|
|
|
RunSetup ();
|
|
|
|
|
|
|
|
// NtShutdownSystem (ShutdownReboot);
|
|
|
|
NtShutdownSystem (ShutdownNoReboot);
|
|
|
|
ExitProcess (0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
/* start system processes (services.exe & lsass.exe) */
|
2003-02-02 22:38:54 +00:00
|
|
|
if (StartProcess("StartServices"))
|
2002-12-27 13:54:28 +00:00
|
|
|
{
|
2003-02-02 22:38:54 +00:00
|
|
|
if (!StartServices())
|
|
|
|
{
|
2003-03-25 19:26:33 +00:00
|
|
|
DbgPrint("WL: Failed to start Services (0x%X)\n", GetLastError());
|
2003-02-02 22:38:54 +00:00
|
|
|
}
|
2002-12-27 13:54:28 +00:00
|
|
|
}
|
2001-01-20 18:40:27 +00:00
|
|
|
#if 0
|
2003-02-02 22:38:54 +00:00
|
|
|
if (StartProcess("StartLsass"))
|
2002-12-27 13:54:28 +00:00
|
|
|
{
|
2003-02-02 22:38:54 +00:00
|
|
|
if (!StartLsass())
|
|
|
|
{
|
2003-03-25 19:26:33 +00:00
|
|
|
DbgPrint("WL: Failed to start LSASS (0x%X)\n", GetLastError());
|
2003-02-02 22:38:54 +00:00
|
|
|
}
|
2002-12-27 13:54:28 +00:00
|
|
|
}
|
2000-12-05 02:40:51 +00:00
|
|
|
#endif
|
2000-08-12 19:33:23 +00:00
|
|
|
|
|
|
|
/* FIXME: What name does the real WinLogon use? */
|
|
|
|
#if 0
|
|
|
|
RtlInitUnicodeString((PUNICODE_STRING)&ProcessName, L"WinLogon");
|
|
|
|
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
2003-03-25 19:26:33 +00:00
|
|
|
DbgPrint("WL: Failed to connect to LSASS\n");
|
2002-12-27 13:54:28 +00:00
|
|
|
return(1);
|
2000-08-12 19:33:23 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2001-06-12 17:51:51 +00:00
|
|
|
/* FIXME: Create a window class and associate a Winlogon
|
|
|
|
* window procedure with it.
|
|
|
|
* Register SAS with the window.
|
|
|
|
* Register for logoff notification
|
|
|
|
*/
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2000-08-12 19:33:23 +00:00
|
|
|
/* Main loop */
|
2002-02-08 02:57:10 +00:00
|
|
|
#if 0
|
2003-03-20 20:56:52 +00:00
|
|
|
/* Display login prompt */
|
|
|
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
|
|
|
|
LoginPrompt,
|
|
|
|
strlen(LoginPrompt), // wcslen(LoginPrompt),
|
|
|
|
&Result,
|
|
|
|
NULL);
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
|
|
|
|
&LoginName[i],
|
|
|
|
1,
|
|
|
|
&Result,
|
|
|
|
NULL);
|
|
|
|
i++;
|
|
|
|
} while (LoginName[i - 1] != '\n');
|
|
|
|
LoginName[i - 1] = 0;
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2003-03-20 20:56:52 +00:00
|
|
|
/* Display password prompt */
|
|
|
|
WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE),
|
|
|
|
PasswordPrompt,
|
|
|
|
strlen(PasswordPrompt), // wcslen(PasswordPrompt),
|
|
|
|
&Result,
|
|
|
|
NULL);
|
|
|
|
i = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),
|
|
|
|
&Password[i],
|
|
|
|
1,
|
|
|
|
&Result,
|
|
|
|
NULL);
|
|
|
|
i++;
|
|
|
|
} while (Password[i - 1] != '\n');
|
|
|
|
Password[i - 1] =0;
|
2002-02-08 02:57:10 +00:00
|
|
|
#endif
|
2003-03-20 20:56:52 +00:00
|
|
|
|
|
|
|
if (! DoLoginUser(LoginName, Password))
|
|
|
|
{
|
2000-08-12 19:33:23 +00:00
|
|
|
}
|
2003-03-20 20:56:52 +00:00
|
|
|
|
|
|
|
NtShutdownSystem(ShutdownNoReboot);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
ExitProcess(0);
|
2002-07-17 21:04:57 +00:00
|
|
|
|
2000-12-08 00:45:04 +00:00
|
|
|
return 0;
|
1999-06-18 22:11:21 +00:00
|
|
|
}
|