some more work on winlogon

svn path=/trunk/; revision=6874
This commit is contained in:
Thomas Bluemel 2003-12-07 00:04:20 +00:00
parent ab4deea68c
commit 0b4f93260c
7 changed files with 234 additions and 40 deletions

View file

@ -7,6 +7,7 @@ HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\WinLogon","Shell",0x00020000,"%
;HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\WinLogon","Shell",0x00020000,"%SystemRoot%\bin\explorer.exe"
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\WinLogon","StartServices",0x00010001,0x00000001
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\WinLogon","StartGUI",0x00010001,0x00000000
HKLM,"SOFTWARE\ReactOS\Windows NT\CurrentVersion\WinLogon","Userinit",0x00020000,"%SystemRoot%\system32\userinit.exe,"
HKCU, "Control Panel\Desktop", "CursorBlinkRate",0x00000000,"530"

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: msgina.c,v 1.5 2003/12/01 18:21:04 weiden Exp $
/* $Id: msgina.c,v 1.6 2003/12/07 00:04:20 weiden Exp $
*
* PROJECT: ReactOS msgina.dll
* FILE: lib/msgina/msgina.c
@ -199,10 +199,11 @@ WlxActivateUserShell(
BOOL Ret;
/* get the path of userinit */
if(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
if(RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
{
/* FIXME - why does this always fail??? */
VirtualFree(pEnvironment, 0, MEM_RELEASE);
return FALSE;
}
@ -216,9 +217,8 @@ WlxActivateUserShell(
}
RegCloseKey(hKey);
/* FIXME - execute logon script */
/* start userinit */
/* FIXME - allow to start more applications that are comma-separated */
si.cb = sizeof(STARTUPINFO);
si.lpReserved = NULL;
si.lpTitle = L"userinit";

View file

@ -29,3 +29,4 @@
#define IDS_SAVEYOURSETTINGS 1687
#define IDS_REACTOSISSTARTINGUP 1690
#define IDS_FAILEDACTIVATEUSERSHELL 1001

View file

@ -1,4 +1,4 @@
/* $Id: winlogon.c,v 1.21 2003/12/01 18:21:04 weiden Exp $
/* $Id: winlogon.c,v 1.22 2003/12/07 00:04:20 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -31,9 +31,9 @@
/* GLOBALS ******************************************************************/
BOOL
LoadGina(PMSGINAFUNCTIONS Functions);
LoadGina(PMSGINAFUNCTIONS Functions, DWORD *DllVersion);
BOOL
MsGinaInit();
MsGinaInit(DWORD Version);
HINSTANCE hAppInstance;
HWINSTA InteractiveWindowStation; /* WinSta0 */
@ -61,6 +61,37 @@ static void PrintString (WCHAR* fmt,...)
OutputDebugString(buffer);
}
BOOL
CALLBACK
ShutdownComputerProc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDC_BTNSHTDOWNCOMPUTER:
EndDialog(hwndDlg, IDC_BTNSHTDOWNCOMPUTER);
break;
}
break;
}
case WM_INITDIALOG:
{
RemoveMenu(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND);
SetFocus(GetDlgItem(hwndDlg, IDC_BTNSHTDOWNCOMPUTER));
break;
}
}
return FALSE;
}
static BOOLEAN StartServices(VOID)
{
HANDLE ServicesInitEvent;
@ -220,6 +251,35 @@ static BOOLEAN StartProcess(PWCHAR ValueName)
return StartIt;
}
/*
static BOOL RestartShell(void)
{
HANDLE WinLogonKey;
DWORD Type, Size, Value;
if(OpenRegistryKey(&WinLogonKey))
{
Size = sizeof(DWORD);
if(ERROR_SUCCESS == RegQueryValueEx(WinLogonKey,
L"AutoRestartShell",
NULL,
&Type,
(LPBYTE)&Value,
&Size))
{
if(Type == REG_DWORD)
{
RegCloseKey(WinLogonKey);
return (Value != 0);
}
}
RegCloseKey(WinLogonKey);
}
return FALSE;
}
*/
#if SUPPORT_CONSOLESTART
static BOOL StartIntoGUI(void)
{
@ -346,6 +406,7 @@ WinMain(HINSTANCE hInstance,
LSA_OPERATIONAL_MODE Mode;
ULONG AuthenticationPackage;
#endif
DWORD GinaDllVersion;
HANDLE hShutdownEvent;
WCHAR StatusMsg[256];
BOOL Success;
@ -444,7 +505,7 @@ WinMain(HINSTANCE hInstance,
if(!StartConsole)
{
#endif
if(!LoadGina(&MsGinaFunctions))
if(!LoadGina(&MsGinaFunctions, &GinaDllVersion))
{
NtShutdownSystem(ShutdownReboot);
ExitProcess(0);
@ -465,7 +526,7 @@ WinMain(HINSTANCE hInstance,
return(0);
}
if(!MsGinaInit() || !MsGinaInst)
if(!MsGinaInit(GinaDllVersion) || !MsGinaInst)
{
DbgPrint("WL: Failed to initialize winlogon!\n");
NtShutdownSystem(ShutdownNoReboot);
@ -585,6 +646,9 @@ WinMain(HINSTANCE hInstance,
if (! DoLoginUser(LoginName, Password))
{
}
NtShutdownSystem(ShutdownNoReboot);
ExitProcess(0);
}
else
{
@ -598,7 +662,7 @@ WinMain(HINSTANCE hInstance,
StatusMsg);
/* FIXME */
Sleep(250);
Sleep(150);
LoadString(hAppInstance, IDS_APPLYINGCOMPUTERSETTINGS, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
@ -608,14 +672,14 @@ WinMain(HINSTANCE hInstance,
StatusMsg);
/* FIXME */
Sleep(250);
Sleep(150);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
/* FIXME - call WlxLoggedOutSAS() to display the login dialog */
Sleep(500);
Sleep(250);
LoadString(hAppInstance, IDS_LOADINGYOURPERSONALSETTINGS, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
@ -625,7 +689,7 @@ WinMain(HINSTANCE hInstance,
StatusMsg);
/* FIXME */
Sleep(250);
Sleep(150);
LoadString(hAppInstance, IDS_APPLYINGYOURPERSONALSETTINGS, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
@ -634,26 +698,67 @@ WinMain(HINSTANCE hInstance,
NULL,
StatusMsg);
/* FIXME */
Sleep(150);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
if(!MsGinaInst->Functions->WlxActivateUserShell(MsGinaInst->Context,
L"WinSta0\\Default",
NULL,
NULL))
{
LoadString(hAppInstance, IDS_FAILEDACTIVATEUSERSHELL, StatusMsg, 256 * sizeof(WCHAR));
MessageBox(0, StatusMsg, NULL, MB_ICONERROR);
SetEvent(hShutdownEvent);
}
WaitForSingleObject(hShutdownEvent, INFINITE);
CloseHandle(hShutdownEvent);
LoadString(hAppInstance, IDS_SAVEYOURSETTINGS, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
ApplicationDesktop,
0,
NULL,
StatusMsg);
/* FIXME */
Sleep(150);
MsGinaInst->Functions->WlxShutdown(MsGinaInst->Context, WLX_SAS_ACTION_SHUTDOWN);
LoadString(hAppInstance, IDS_REACTOSISSHUTTINGDOWN, StatusMsg, 256 * sizeof(WCHAR));
MsGinaInst->Functions->WlxDisplayStatusMessage(MsGinaInst->Context,
ApplicationDesktop,
0,
NULL,
StatusMsg);
/* FIXME */
Sleep(250);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
MsGinaInst->Functions->WlxRemoveStatusMessage(MsGinaInst->Context);
/* FIXME - call WlxActivateUserShell() which will start userinit.exe */
DoLoginUser(LoginName, Password); /* FIXME - remove */
DbgPrint("shell exited! finished\n");
MessageBox(0, L"Shell exited", L"", 0);
WaitForSingleObject(hShutdownEvent, INFINITE);
CloseHandle(hShutdownEvent);
/* FIXME - Flush disks and registry, ... */
/* FIXME - only show this dialog if it's a shutdown and the computer doesn't support APM */
switch(DialogBox(hInstance, MAKEINTRESOURCE(IDD_SHUTDOWNCOMPUTER), 0, ShutdownComputerProc))
{
case IDC_BTNSHTDOWNCOMPUTER:
NtShutdownSystem(ShutdownReboot);
break;
default:
NtShutdownSystem(ShutdownNoReboot);
break;
}
ExitProcess(0);
#if SUPPORT_CONSOLESTART
}
#endif
NtShutdownSystem(ShutdownNoReboot);
ExitProcess(0);
return 0;
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: winlogon.h,v 1.1 2003/12/01 18:21:04 weiden Exp $
/* $Id: winlogon.h,v 1.2 2003/12/07 00:04:20 weiden Exp $
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS winlogon
* FILE: subsys/system/winlogon/winlogon.h
@ -66,9 +66,9 @@ typedef struct _MSGINAFUNCTIONS
PFWLXLOGGEDONSAS WlxLoggedOnSAS;
PFWLXDISPLAYLOCKEDNOTICE WlxDisplayLockedNotice;
PFWLXWKSTALOCKEDSAS WlxWkstaLockedSAS;
PFWLXISLOCKOK WlxIsLockOK;
PFWLXISLOGOFFOK WlxIsLogOffOK;
PFWLXLOGOFF WlxLogOff;
PFWLXISLOCKOK WlxIsLockOk;
PFWLXISLOGOFFOK WlxIsLogoffOk;
PFWLXLOGOFF WlxLogoff;
PFWLXSHUTDOWN WlxShutdown;
PFWLXSCREENSAVERNOTIFY WlxScreenSaverNotify;
@ -85,6 +85,7 @@ typedef struct _MSGINAINSTANCE
HANDLE hDllInstance;
PMSGINAFUNCTIONS Functions;
PVOID Context;
DWORD Version;
} MSGINAINSTANCE, *PMSGINAINSTANCE;
extern HINSTANCE hAppInstance;

View file

@ -40,8 +40,7 @@ END
IDI_WINLOGON ICON "resources/winlogon.ico"
IDD_SHUTDOWNCOMPUTER DIALOG 45, 22, 164, 52
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Shutdown Computer"
FONT 8, "MS Shell Dlg"
BEGIN
@ -78,3 +77,9 @@ BEGIN
IDS_REACTOSISSTARTINGUP "ReactOS is starting up..."
END
STRINGTABLE
BEGIN
IDS_FAILEDACTIVATEUSERSHELL "Winlogon failed to activate user shell!"
END

View file

@ -1,4 +1,4 @@
/* $Id: wlx.c,v 1.1 2003/12/01 18:21:04 weiden Exp $
/* $Id: wlx.c,v 1.2 2003/12/07 00:04:20 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -295,7 +295,25 @@ WlxSetOption(
ULONG_PTR* OldValue
)
{
PMSGINAINSTANCE Instance = (PMSGINAINSTANCE)hWlx;
Unimplemented;
if(Instance || !Value)
{
switch(Option)
{
case WLX_OPTION_USE_CTRL_ALT_DEL:
return TRUE;
case WLX_OPTION_CONTEXT_POINTER:
{
*OldValue = (ULONG_PTR)Instance->Context;
Instance->Context = (PVOID)Value;
return TRUE;
}
case WLX_OPTION_USE_SMART_CARD:
return FALSE;
}
}
return FALSE;
}
@ -309,7 +327,51 @@ WlxGetOption(
ULONG_PTR* Value
)
{
PMSGINAINSTANCE Instance = (PMSGINAINSTANCE)hWlx;
Unimplemented;
if(Instance || !Value)
{
switch(Option)
{
case WLX_OPTION_USE_CTRL_ALT_DEL:
return TRUE;
case WLX_OPTION_CONTEXT_POINTER:
{
*Value = (ULONG_PTR)Instance->Context;
return TRUE;
}
case WLX_OPTION_USE_SMART_CARD:
case WLX_OPTION_SMART_CARD_PRESENT:
case WLX_OPTION_SMART_CARD_INFO:
*Value = 0;
return FALSE;
case WLX_OPTION_DISPATCH_TABLE_SIZE:
{
switch(Instance->Version)
{
case WLX_VERSION_1_0:
*Value = sizeof(WLX_DISPATCH_VERSION_1_0);
break;
case WLX_VERSION_1_1:
*Value = sizeof(WLX_DISPATCH_VERSION_1_1);
break;
case WLX_VERSION_1_2:
*Value = sizeof(WLX_DISPATCH_VERSION_1_2);
break;
case WLX_VERSION_1_3:
*Value = sizeof(WLX_DISPATCH_VERSION_1_3);
break;
case WLX_VERSION_1_4:
*Value = sizeof(WLX_DISPATCH_VERSION_1_4);
break;
default:
return 0;
}
return TRUE;
}
}
}
return FALSE;
}
@ -510,11 +572,10 @@ GinaLoadFailedProc(
}
BOOL
LoadGina(PMSGINAFUNCTIONS Functions)
LoadGina(PMSGINAFUNCTIONS Functions, DWORD *DllVersion)
{
HMODULE hGina;
WCHAR GinaDll[MAX_PATH + 1];
DWORD DllVersion = 0;
MsGinaInst = NULL;
@ -532,31 +593,50 @@ LoadGina(PMSGINAFUNCTIONS Functions)
if(Functions->WlxNegotiate)
{
if(!Functions->WlxNegotiate(WLX_VERSION_1_3, &DllVersion))
if(!Functions->WlxNegotiate(WLX_VERSION_1_3, DllVersion))
{
return FALSE;
}
/* FIXME - allow other versions */
if(DllVersion != WLX_VERSION_1_3)
if(*DllVersion >= WLX_VERSION_1_0)
{
return FALSE;
Functions->WlxActivateUserShell = (PFWLXACTIVATEUSERSHELL)GetProcAddress(hGina, "WlxActivateUserShell");
Functions->WlxDisplayLockedNotice = (PFWLXDISPLAYLOCKEDNOTICE)GetProcAddress(hGina, "WlxDisplayLockedNotice");
Functions->WlxDisplaySASNotice = (PFWLXDISPLAYSASNOTICE)GetProcAddress(hGina, "WlxDisplaySASNotice");
Functions->WlxIsLockOk = (PFWLXISLOCKOK)GetProcAddress(hGina, "WlxIsLockOk");
Functions->WlxIsLogoffOk = (PFWLXISLOGOFFOK)GetProcAddress(hGina, "WlxIsLogoffOk");
Functions->WlxLoggedOnSAS = (PFWLXLOGGEDONSAS)GetProcAddress(hGina, "WlxLoggedOnSAS");
Functions->WlxLoggedOutSAS = (PFWLXLOGGEDOUTSAS)GetProcAddress(hGina, "WlxLoggedOutSAS");
Functions->WlxLogoff = (PFWLXLOGOFF)GetProcAddress(hGina, "WlxLogoff");
Functions->WlxShutdown = (PFWLXSHUTDOWN)GetProcAddress(hGina, "WlxShutdown");
Functions->WlxWkstaLockedSAS = (PFWLXWKSTALOCKEDSAS)GetProcAddress(hGina, "WlxWkstaLockedSAS");
}
if(DllVersion >= WLX_VERSION_1_3)
if(*DllVersion >= WLX_VERSION_1_1)
{
Functions->WlxScreenSaverNotify = (PFWLXSCREENSAVERNOTIFY)GetProcAddress(hGina, "WlxScreenSaverNotify");
Functions->WlxStartApplication = (PFWLXSTARTAPPLICATION)GetProcAddress(hGina, "WlxStartApplication");
}
if(*DllVersion >= WLX_VERSION_1_3)
{
Functions->WlxNetworkProviderLoad = (PFWLXNETWORKPROVIDERLOAD)GetProcAddress(hGina, "WlxNetworkProviderLoad");
Functions->WlxDisplayStatusMessage = (PFWLXDISPLAYSTATUSMESSAGE)GetProcAddress(hGina, "WlxDisplayStatusMessage");
Functions->WlxGetStatusMessage = (PFWLXGETSTATUSMESSAGE)GetProcAddress(hGina, "WlxGetStatusMessage");
Functions->WlxNetworkProviderLoad = (PFWLXNETWORKPROVIDERLOAD)GetProcAddress(hGina, "WlxNetworkProviderLoad");
Functions->WlxRemoveStatusMessage = (PFWLXREMOVESTATUSMESSAGE)GetProcAddress(hGina, "WlxRemoveStatusMessage");
}
if(*DllVersion >= WLX_VERSION_1_4)
{
}
}
return (Functions->WlxNegotiate != NULL) && (Functions->WlxInitialize != NULL);
}
BOOL
MsGinaInit()
MsGinaInit(DWORD Version)
{
PMSGINAINSTANCE Instance;
@ -569,6 +649,7 @@ MsGinaInit()
Instance->Functions = &MsGinaFunctions;
Instance->hDllInstance = NULL; /* FIXME */
Instance->Context = NULL;
Instance->Version = Version;
MsGinaInst = Instance;