Author: hpoussin
Date: Fri Aug 4 15:37:18 2006
New Revision: 23442
URL:
http://svn.reactos.org/svn/reactos?rev=23442&view=rev
Log:
- Specify *W at the end of function calls, and remove the need to define UNICODE
- Rename MsGina to Gina
- Start services.exe before running 2nd stage setup
Modified:
trunk/reactos/base/system/winlogon/sas.c
trunk/reactos/base/system/winlogon/setup.c
trunk/reactos/base/system/winlogon/winlogon.c
trunk/reactos/base/system/winlogon/winlogon.h
trunk/reactos/base/system/winlogon/winlogon.rbuild
trunk/reactos/base/system/winlogon/wlx.c
Modified: trunk/reactos/base/system/winlogon/sas.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/sas.c…
==============================================================================
--- trunk/reactos/base/system/winlogon/sas.c (original)
+++ trunk/reactos/base/system/winlogon/sas.c Fri Aug 4 15:37:18 2006
@@ -28,8 +28,8 @@
StartTaskManager(
IN OUT PWLSESSION Session)
{
- return Session->MsGina.Functions.WlxStartApplication(
- Session->MsGina.Context,
+ return Session->Gina.Functions.WlxStartApplication(
+ Session->Gina.Context,
L"Default",
NULL,
L"taskmgr.exe");
@@ -81,8 +81,8 @@
/* FIXME: reverting to lower privileges after creating user shell? */
RtlAdjustPrivilege(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE, TRUE, FALSE, &Old);
- return Session->MsGina.Functions.WlxActivateUserShell(
- Session->MsGina.Context,
+ return Session->Gina.Functions.WlxActivateUserShell(
+ Session->Gina.Context,
L"Default",//NULL, /* FIXME */
NULL, /* FIXME */
lpEnvironment);
@@ -127,11 +127,11 @@
case WLX_SAS_ACTION_NONE: /* 0x02 */
break;
case WLX_SAS_ACTION_LOCK_WKSTA: /* 0x03 */
- if (Session->MsGina.Functions.WlxIsLockOk(Session->MsGina.Context))
+ if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context))
{
SwitchDesktop(WLSession->WinlogonDesktop);
Session->LogonStatus = WKSTA_IS_LOCKED;
- Session->MsGina.Functions.WlxDisplayLockedNotice(Session->MsGina.Context);
+ Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
}
break;
case WLX_SAS_ACTION_LOGOFF: /* 0x04 */
@@ -140,13 +140,13 @@
case WLX_SAS_ACTION_SHUTDOWN_REBOOT: /* 0x0b */
if (Session->LogonStatus != WKSTA_IS_LOGGED_OFF)
{
- if (!Session->MsGina.Functions.WlxIsLogoffOk(Session->MsGina.Context))
+ if (!Session->Gina.Functions.WlxIsLogoffOk(Session->Gina.Context))
break;
SwitchDesktop(WLSession->WinlogonDesktop);
- Session->MsGina.Functions.WlxLogoff(Session->MsGina.Context);
+ Session->Gina.Functions.WlxLogoff(Session->Gina.Context);
HandleLogoff(Session);
Session->LogonStatus = WKSTA_IS_LOGGED_OFF;
- Session->MsGina.Functions.WlxDisplaySASNotice(Session->MsGina.Context);
+ Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
}
if (WLX_SHUTTINGDOWN(wlxAction))
HandleShutdown(Session, wlxAction);
@@ -172,9 +172,9 @@
DWORD wlxAction = WLX_SAS_ACTION_NONE;
if (Session->LogonStatus == WKSTA_IS_LOGGED_ON)
- wlxAction = Session->MsGina.Functions.WlxLoggedOnSAS(Session->MsGina.Context,
dwSasType, NULL);
+ wlxAction = Session->Gina.Functions.WlxLoggedOnSAS(Session->Gina.Context,
dwSasType, NULL);
else if (Session->LogonStatus == WKSTA_IS_LOCKED)
- wlxAction = Session->MsGina.Functions.WlxWkstaLockedSAS(Session->MsGina.Context,
dwSasType);
+ wlxAction = Session->Gina.Functions.WlxWkstaLockedSAS(Session->Gina.Context,
dwSasType);
else
{
/* Display a new dialog (if necessary) */
@@ -182,7 +182,7 @@
{
case WLX_SAS_TYPE_TIMEOUT: /* 0x00 */
{
- Session->MsGina.Functions.WlxDisplaySASNotice(Session->MsGina.Context);
+ Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
break;
}
case WLX_SAS_TYPE_CTRL_ALT_DEL: /* 0x01 */
@@ -192,8 +192,8 @@
ZeroMemory(&Session->Profile, sizeof(Session->Profile));
Session->Options = 0;
- wlxAction = Session->MsGina.Functions.WlxLoggedOutSAS(
- Session->MsGina.Context,
+ wlxAction = Session->Gina.Functions.WlxLoggedOutSAS(
+ Session->Gina.Context,
Session->SASAction,
&Session->LogonId,
LogonSid,
@@ -384,6 +384,8 @@
case MAKELONG(MOD_CONTROL | MOD_ALT, VK_DELETE):
{
TRACE("SAS: CONTROL+ALT+DELETE\n");
+ if (!Session->Gina.UseCtrlAltDelete)
+ break;
DispatchSAS(Session, WLX_SAS_TYPE_CTRL_ALT_DEL);
return TRUE;
}
@@ -435,7 +437,7 @@
InitializeSAS(
IN OUT PWLSESSION Session)
{
- WNDCLASSEX swc;
+ WNDCLASSEXW swc;
/* register SAS window class.
* WARNING! MAKE SURE WE ARE IN THE WINLOGON DESKTOP! */
@@ -451,11 +453,11 @@
swc.lpszMenuName = NULL;
swc.lpszClassName = WINLOGON_SAS_CLASS;
swc.hIconSm = NULL;
- RegisterClassEx(&swc); /* FIXME: check return code */
+ RegisterClassExW(&swc); /* FIXME: check return code */
/* create invisible SAS window */
DPRINT1("Session %p\n", Session);
- Session->SASWindow = CreateWindowEx(
+ Session->SASWindow = CreateWindowExW(
0,
WINLOGON_SAS_CLASS,
WINLOGON_SAS_TITLE,
Modified: trunk/reactos/base/system/winlogon/setup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/setup…
==============================================================================
--- trunk/reactos/base/system/winlogon/setup.c (original)
+++ trunk/reactos/base/system/winlogon/setup.c Fri Aug 4 15:37:18 2006
@@ -43,7 +43,7 @@
DWORD dwSize;
DWORD dwSetupType;
- dwError = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SYSTEM\\Setup", //TEXT("SYSTEM\\Setup"),
0,
KEY_QUERY_VALUE,
@@ -54,7 +54,7 @@
}
dwSize = sizeof(DWORD);
- dwError = RegQueryValueEx (hKey,
+ dwError = RegQueryValueExW (hKey,
L"SetupType", //TEXT("SetupType"),
NULL,
&dwType,
@@ -76,7 +76,7 @@
DWORD dwError;
HKEY hKey;
- dwError = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SYSTEM\\Setup", //TEXT("SYSTEM\\Setup"),
0,
KEY_SET_VALUE,
@@ -86,7 +86,7 @@
return FALSE;
}
- dwError = RegSetValueEx (hKey,
+ dwError = RegSetValueExW (hKey,
L"SetupType", //TEXT("SetupType"),
0,
REG_DWORD,
@@ -106,7 +106,7 @@
RunSetup (VOID)
{
PROCESS_INFORMATION ProcessInformation;
- STARTUPINFO StartupInfo;
+ STARTUPINFOW StartupInfo;
WCHAR Shell[MAX_PATH];
WCHAR CommandLine[MAX_PATH];
BOOLEAN Result;
Modified: trunk/reactos/base/system/winlogon/winlogon.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.c (original)
+++ trunk/reactos/base/system/winlogon/winlogon.c Fri Aug 4 15:37:18 2006
@@ -36,7 +36,7 @@
{
case IDC_BTNSHTDOWNCOMPUTER:
EndDialog(hwndDlg, IDC_BTNSHTDOWNCOMPUTER);
- break;
+ return TRUE;
}
break;
}
@@ -44,10 +44,10 @@
{
RemoveMenu(GetSystemMenu(hwndDlg, FALSE), SC_CLOSE, MF_BYCOMMAND);
SetFocus(GetDlgItem(hwndDlg, IDC_BTNSHTDOWNCOMPUTER));
- break;
+ return TRUE;
}
}
- return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
+ return FALSE;
}
static BOOL
@@ -55,7 +55,7 @@
{
HANDLE ServicesInitEvent;
BOOLEAN Result;
- STARTUPINFO StartupInfo;
+ STARTUPINFOW StartupInfo;
PROCESS_INFORMATION ProcessInformation;
DWORD Count;
WCHAR ServiceString[] = L"services.exe";
@@ -74,7 +74,7 @@
DPRINT1(L"WL: Creating new process - \"services.exe\".\n");
#endif
- Result = CreateProcess(NULL,
+ Result = CreateProcessW(NULL,
ServiceString,
NULL,
NULL,
@@ -96,7 +96,7 @@
Sleep(1000);
DPRINT("WL: Attempting to open event
\"SvcctrlStartEvent_A3725DX\"\n");
- ServicesInitEvent = OpenEvent(EVENT_ALL_ACCESS, //SYNCHRONIZE,
+ ServicesInitEvent = OpenEventW(EVENT_ALL_ACCESS, //SYNCHRONIZE,
FALSE,
L"SvcctrlStartEvent_A3725DX");
if (ServicesInitEvent != NULL)
@@ -133,7 +133,7 @@
if (!hSCManager)
goto cleanup;
- hService = OpenService(hSCManager, ServiceName, SERVICE_START);
+ hService = OpenServiceW(hSCManager, ServiceName, SERVICE_START);
if (!hService)
goto cleanup;
#if 0
@@ -156,7 +156,7 @@
{
HANDLE LsassInitEvent;
- LsassInitEvent = CreateEvent(
+ LsassInitEvent = CreateEventW(
NULL,
TRUE,
FALSE,
@@ -393,7 +393,7 @@
DestroyEnvironmentBlock (lpEnvironment);
return FALSE;
}
- /*WLSession->MsGina.Functions.WlxActivateUserShell(WLSession->MsGina.Context,
+ /*WLSession->Gina.Functions.WlxActivateUserShell(WLSession->Gina.Context,
L"WinSta0\\Default",
NULL,
NULL);*/
@@ -439,10 +439,10 @@
if (Session->SuppressStatus)
return TRUE;
- if (LoadString(hAppInstance, ResourceId, StatusMsg, MAX_PATH) == 0)
+ if (LoadStringW(hAppInstance, ResourceId, StatusMsg, MAX_PATH) == 0)
return FALSE;
- return Session->MsGina.Functions.WlxDisplayStatusMessage(Session->MsGina.Context,
hDesktop, 0, NULL, StatusMsg);
+ return Session->Gina.Functions.WlxDisplayStatusMessage(Session->Gina.Context,
hDesktop, 0, NULL, StatusMsg);
}
static VOID
@@ -481,7 +481,7 @@
RemoveStatusMessage(Session);
- if(!MsGinaInst->Functions->WlxActivateUserShell(MsGinaInst->Context,
+ if(!GinaInst->Functions->WlxActivateUserShell(GinaInst->Context,
L"WinSta0\\Default",
NULL,
NULL))
@@ -498,13 +498,56 @@
Sleep(150);
- MsGinaInst->Functions->WlxShutdown(MsGinaInst->Context,
WLX_SAS_ACTION_SHUTDOWN);
+ GinaInst->Functions->WlxShutdown(GinaInst->Context,
WLX_SAS_ACTION_SHUTDOWN);
DisplayStatusMessage(Session, Session->WinlogonDesktop,
IDS_REACTOSISSHUTTINGDOWN);
Sleep(250);
RemoveStatusMessage(Session);
*/
+}
+
+static INT_PTR CALLBACK
+GinaLoadFailedWindowProc(
+ IN HWND hwndDlg,
+ IN UINT uMsg,
+ IN WPARAM wParam,
+ IN LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ EndDialog(hwndDlg, IDOK);
+ return TRUE;
+ }
+ break;
+ }
+ case WM_INITDIALOG:
+ {
+ int len;
+ WCHAR templateText[MAX_PATH], text[MAX_PATH];
+
+ len = GetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, templateText, MAX_PATH);
+ if (len)
+ {
+ wsprintfW(text, templateText, (LPWSTR)lParam);
+ SetDlgItemTextW(hwndDlg, IDC_GINALOADFAILED, text);
+ }
+ SetFocus(GetDlgItem(hwndDlg, IDOK));
+ return TRUE;
+ }
+ case WM_CLOSE:
+ {
+ EndDialog(hwndDlg, IDCANCEL);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
}
int WINAPI
@@ -550,31 +593,6 @@
}
LockWorkstation(WLSession);
- /* Check for pending setup */
- if (GetSetupType() != 0)
- {
- DPRINT("Winlogon: CheckForSetup() in setup mode\n");
-
- /* Run setup and reboot when done */
- SwitchDesktop(WLSession->ApplicationDesktop);
- RunSetup();
-
- NtShutdownSystem(ShutdownReboot);
- ExitProcess(0);
- return 0;
- }
-
- /* Load and initialize gina */
- if (!GinaInit(WLSession))
- {
- ERR("WL: Failed to initialize Gina\n");
- NtShutdownSystem(ShutdownNoReboot);
- ExitProcess(0);
- return 0;
- }
-
- DisplayStatusMessage(WLSession, WLSession->WinlogonDesktop,
IDS_REACTOSISSTARTINGUP);
-
if (!StartServicesManager())
{
ERR("WL: Could not start services.exe\n");
@@ -582,6 +600,32 @@
ExitProcess(0);
return 0;
}
+
+ /* Check for pending setup */
+ if (GetSetupType() != 0)
+ {
+ TRACE("WL: Setup mode detected\n");
+
+ /* Run setup and reboot when done */
+ SwitchDesktop(WLSession->ApplicationDesktop);
+ RunSetup();
+
+ NtShutdownSystem(ShutdownReboot);
+ ExitProcess(0);
+ return 0;
+ }
+
+ /* Load and initialize gina */
+ if (!GinaInit(WLSession))
+ {
+ ERR("WL: Failed to initialize Gina\n");
+ DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_GINALOADFAILED), 0,
GinaLoadFailedWindowProc, (LPARAM)L"");
+ NtShutdownSystem(ShutdownReboot);
+ ExitProcess(0);
+ return 0;
+ }
+
+ DisplayStatusMessage(WLSession, WLSession->WinlogonDesktop,
IDS_REACTOSISSTARTINGUP);
if (!StartLsass())
{
@@ -597,7 +641,12 @@
if (Status == STATUS_PORT_CONNECTION_REFUSED)
{
/* Add the 'SeTcbPrivilege' privilege and try again */
- RtlAdjustPrivilege(SE_TCB_PRIVILEGE, TRUE, TRUE, &Old);
+ Status = RtlAdjustPrivilege(SE_TCB_PRIVILEGE, TRUE, TRUE, &Old);
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("RtlAdjustPrivilege() failed with error %lu\n",
LsaNtStatusToWinError(Status));
+ return 1;
+ }
Status = LsaRegisterLogonProcess(&ProcessName, &LsaHandle, &Mode);
}
if (!NT_SUCCESS(Status))
Modified: trunk/reactos/base/system/winlogon/winlogon.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.h (original)
+++ trunk/reactos/base/system/winlogon/winlogon.h Fri Aug 4 15:37:18 2006
@@ -68,7 +68,7 @@
typedef BOOL (WINAPI * PFWLXGETSTATUSMESSAGE) (PVOID, DWORD *, PWSTR, DWORD);
typedef BOOL (WINAPI * PFWLXREMOVESTATUSMESSAGE) (PVOID);
-typedef struct _MSGINAFUNCTIONS
+typedef struct _GINAFUNCTIONS
{
/* Functions always available for a valid GINA */
PFWLXNEGOTIATE WlxNegotiate;
@@ -99,15 +99,16 @@
PFWLXREMOVESTATUSMESSAGE WlxRemoveStatusMessage;
/* Functions available if WlxVersion >= WLX_VERSION_1_4 (MS Windows XP) */
-} MSGINAFUNCTIONS, *PMSGINAFUNCTIONS;
-
-typedef struct _MSGINAINSTANCE
+} GINAFUNCTIONS, *PGINAFUNCTIONS;
+
+typedef struct _GINAINSTANCE
{
HMODULE hDllInstance;
- MSGINAFUNCTIONS Functions;
+ GINAFUNCTIONS Functions;
PVOID Context;
DWORD Version;
-} MSGINAINSTANCE, *PMSGINAINSTANCE;
+ BOOL UseCtrlAltDelete;
+} GINAINSTANCE, *PGINAINSTANCE;
/* FIXME: put in an enum */
#define WKSTA_IS_LOGGED_OFF 0
@@ -119,7 +120,7 @@
typedef struct _WLSESSION
{
- MSGINAINSTANCE MsGina;
+ GINAINSTANCE Gina;
DWORD SASAction;
DWORD LogonStatus;
BOOL SuppressStatus;
@@ -157,9 +158,9 @@
)
#define RemoveStatusMessage(Session) \
- Session->MsGina.Functions.WlxRemoveStatusMessage(Session->MsGina.Context);
+ Session->Gina.Functions.WlxRemoveStatusMessage(Session->Gina.Context);
#define DisplaySASNotice(Session) \
- Session->MsGina.Functions.WlxDisplaySASNotice(Session->MsGina.Context);
+ Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
/* user32 */
BOOL WINAPI
Modified: trunk/reactos/base/system/winlogon/winlogon.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/winlo…
==============================================================================
--- trunk/reactos/base/system/winlogon/winlogon.rbuild (original)
+++ trunk/reactos/base/system/winlogon/winlogon.rbuild Fri Aug 4 15:37:18 2006
@@ -2,8 +2,6 @@
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<module name="winlogon" type="win32gui"
installbase="system32" installname="winlogon.exe">
<include base="winlogon">.</include>
- <define name="UNICODE" />
- <define name="_UNICODE" />
<define name="__USE_W32API" />
<library>ntdll</library>
<library>kernel32</library>
Modified: trunk/reactos/base/system/winlogon/wlx.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/wlx.c…
==============================================================================
--- trunk/reactos/base/system/winlogon/wlx.c (original)
+++ trunk/reactos/base/system/winlogon/wlx.c Fri Aug 4 15:37:18 2006
@@ -27,35 +27,25 @@
{
if (uMsg == WM_TIMER && (UINT_PTR)wParam == IdTimer)
{
- CHECKPOINT1;
EndDialog(hwndDlg, -1);
KillTimer(hwndDlg, IdTimer);
- CHECKPOINT1;
return TRUE;
}
else if (uMsg == WM_INITDIALOG)
{
- CHECKPOINT1;
- PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
IdTimer = SetTimer(hwndDlg, 0, WLSession->DialogTimeout * 1000, NULL);
- CHECKPOINT1;
- if (IdTimer == 0)
- return FALSE;
- return TRUE;
+ return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);;
}
else if (uMsg == WM_NCDESTROY)
{
- CHECKPOINT1;
- PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
- CHECKPOINT1;
+ BOOL ret;
+ ret = PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
PreviousWindowProc = NULL;
- return TRUE;
+ return ret;
}
else
{
- INT_PTR ret = PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
- ret = PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
- return ret;
+ return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
}
}
@@ -66,7 +56,8 @@
WlxUseCtrlAltDel(
HANDLE hWlx)
{
- WlxSetOption(hWlx, WLX_OPTION_USE_CTRL_ALT_DEL, TRUE, NULL);
+ ULONG_PTR OldValue;
+ WlxSetOption(hWlx, WLX_OPTION_USE_CTRL_ALT_DEL, TRUE, &OldValue);
}
/*
@@ -77,7 +68,8 @@
HANDLE hWlx,
PVOID pWlxContext)
{
- WlxSetOption(hWlx, WLX_OPTION_CONTEXT_POINTER, (ULONG_PTR)pWlxContext, NULL);
+ ULONG_PTR OldValue;
+ WlxSetOption(hWlx, WLX_OPTION_CONTEXT_POINTER, (ULONG_PTR)pWlxContext, &OldValue);
}
/*
@@ -147,7 +139,7 @@
if (PreviousWindowProc != NULL)
return -1;
PreviousWindowProc = dlgprc;
- return (int)DialogBox(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc);
+ return (int)DialogBoxW(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc);
}
/*
@@ -165,7 +157,7 @@
if (PreviousWindowProc != NULL)
return -1;
PreviousWindowProc = dlgprc;
- return (int)DialogBoxParam(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc,
dwInitParam);
+ return (int)DialogBoxParamW(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc,
dwInitParam);
}
/*
@@ -182,7 +174,7 @@
if (PreviousWindowProc != NULL)
return -1;
PreviousWindowProc = dlgprc;
- return (int)DialogBoxIndirect(hInst, hDialogTemplate, hwndOwner, DefaultWlxWindowProc);
+ return (int)DialogBoxIndirectW(hInst, hDialogTemplate, hwndOwner,
DefaultWlxWindowProc);
}
/*
@@ -200,7 +192,7 @@
if (PreviousWindowProc != NULL)
return -1;
PreviousWindowProc = dlgprc;
- return (int)DialogBoxIndirectParam(hInst, hDialogTemplate, hwndOwner,
DefaultWlxWindowProc, dwInitParam);
+ return (int)DialogBoxIndirectParamW(hInst, hDialogTemplate, hwndOwner,
DefaultWlxWindowProc, dwInitParam);
}
/*
@@ -316,30 +308,27 @@
ULONG_PTR* OldValue)
{
PWLSESSION Session = (PWLSESSION)hWlx;
- UNIMPLEMENTED;
-
- if (Session || !Value)
- {
- switch (Option)
- {
- case WLX_OPTION_USE_CTRL_ALT_DEL:
- return TRUE;
- case WLX_OPTION_CONTEXT_POINTER:
- {
- *OldValue = (ULONG_PTR)Session->MsGina.Context;
- Session->MsGina.Context = (PVOID)Value;
- return TRUE;
- }
- case WLX_OPTION_USE_SMART_CARD:
- return FALSE;
- }
- }
-
- return FALSE;
-}
-
-/*
- * @unimplemented
+
+ switch (Option)
+ {
+ case WLX_OPTION_USE_CTRL_ALT_DEL:
+ *OldValue = (ULONG_PTR)Session->Gina.UseCtrlAltDelete;
+ Session->Gina.UseCtrlAltDelete = (BOOL)Value;
+ return TRUE;
+ case WLX_OPTION_CONTEXT_POINTER:
+ *OldValue = (ULONG_PTR)Session->Gina.Context;
+ Session->Gina.Context = (PVOID)Value;
+ return TRUE;
+ case WLX_OPTION_USE_SMART_CARD:
+ UNIMPLEMENTED;
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+/*
+ * @implemented
*/
BOOL WINAPI
WlxGetOption(
@@ -347,28 +336,26 @@
DWORD Option,
ULONG_PTR* Value)
{
- PMSGINAINSTANCE Instance = (PMSGINAINSTANCE)hWlx;
- UNIMPLEMENTED;
-
- if (Instance || !Value)
- {
- switch (Option)
+ PWLSESSION Session = (PWLSESSION)hWlx;
+
+ switch (Option)
+ {
+ case WLX_OPTION_USE_CTRL_ALT_DEL:
+ *Value = (ULONG_PTR)Session->Gina.UseCtrlAltDelete;
+ return TRUE;
+ case WLX_OPTION_CONTEXT_POINTER:
{
- 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)
+ *Value = (ULONG_PTR)Session->Gina.Context;
+ return TRUE;
+ }
+ case WLX_OPTION_USE_SMART_CARD:
+ case WLX_OPTION_SMART_CARD_PRESENT:
+ case WLX_OPTION_SMART_CARD_INFO:
+ UNIMPLEMENTED;
+ return FALSE;
+ case WLX_OPTION_DISPATCH_TABLE_SIZE:
+ {
+ switch (Session->Gina.Version)
{
case WLX_VERSION_1_0:
*Value = sizeof(WLX_DISPATCH_VERSION_1_0);
@@ -387,9 +374,8 @@
break;
default:
return FALSE;
- }
- return TRUE;
}
+ return TRUE;
}
}
@@ -516,7 +502,7 @@
DWORD Type, Size;
HKEY hKey;
- Status = RegOpenKeyEx(
+ Status = RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon",
0,
@@ -530,7 +516,7 @@
}
Size = Len * sizeof(WCHAR);
- Status = RegQueryValueEx(
+ Status = RegQueryValueExW(
hKey,
L"GinaDLL",
NULL,
@@ -543,74 +529,30 @@
return TRUE;
}
-static INT_PTR CALLBACK
-GinaLoadFailedWindowProc(
- IN HWND hwndDlg,
- IN UINT uMsg,
- IN WPARAM wParam,
- IN LPARAM lParam)
-{
- switch (uMsg)
- {
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- EndDialog(hwndDlg, IDOK);
- break;
- }
- break;
- }
- case WM_INITDIALOG:
- {
- int len;
- WCHAR templateText[MAX_PATH], text[MAX_PATH];
-
- len = GetDlgItemText(hwndDlg, IDC_GINALOADFAILED, templateText, MAX_PATH);
- if (len)
- {
- wsprintf(text, templateText, (LPWSTR)lParam);
- SetDlgItemText(hwndDlg, IDC_GINALOADFAILED, text);
- }
- SetFocus(GetDlgItem(hwndDlg, IDOK));
- break;
- }
- case WM_CLOSE:
- {
- EndDialog(hwndDlg, IDCANCEL);
- return TRUE;
- }
- }
-
- return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
-}
-
-#define FAIL_AND_RETURN() return DialogBoxParam(hAppInstance,
MAKEINTRESOURCE(IDD_GINALOADFAILED), 0, GinaLoadFailedWindowProc, (LPARAM)GinaDll)
&& FALSE
static BOOL
LoadGina(
- IN OUT PMSGINAFUNCTIONS Functions,
+ IN OUT PGINAFUNCTIONS Functions,
OUT DWORD *DllVersion,
OUT HMODULE *GinaInstance)
{
- HMODULE hGina;
+ HMODULE hGina = NULL;
WCHAR GinaDll[MAX_PATH + 1];
+ BOOL ret = FALSE;
GinaDll[0] = '\0';
if (!GetGinaPath(GinaDll, MAX_PATH))
- FAIL_AND_RETURN();
+ goto cleanup;
/* Terminate string */
GinaDll[MAX_PATH] = '\0';
- if (!(hGina = LoadLibrary(GinaDll)))
- FAIL_AND_RETURN();
- *GinaInstance = hGina;
+ if (!(hGina = LoadLibraryW(GinaDll)))
+ goto cleanup;
Functions->WlxNegotiate = (PFWLXNEGOTIATE)GetProcAddress(hGina,
"WlxNegotiate");
Functions->WlxInitialize = (PFWLXINITIALIZE)GetProcAddress(hGina,
"WlxInitialize");
if (!Functions->WlxInitialize)
- FAIL_AND_RETURN();
+ goto cleanup;
if (!Functions->WlxNegotiate)
{
@@ -618,55 +560,64 @@
*DllVersion = WLX_CURRENT_VERSION;
}
else if (!Functions->WlxNegotiate(WLX_CURRENT_VERSION, DllVersion))
- FAIL_AND_RETURN();
+ goto cleanup;
if (*DllVersion >= WLX_VERSION_1_0)
{
Functions->WlxActivateUserShell = (PFWLXACTIVATEUSERSHELL)GetProcAddress(hGina,
"WlxActivateUserShell");
- if (!Functions->WlxActivateUserShell) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxDisplayLockedNotice = (PFWLXDISPLAYLOCKEDNOTICE)GetProcAddress(hGina,
"WlxDisplayLockedNotice");
- if (!Functions->WlxDisplayLockedNotice) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxDisplaySASNotice = (PFWLXDISPLAYSASNOTICE)GetProcAddress(hGina,
"WlxDisplaySASNotice");
- if (!Functions->WlxDisplaySASNotice) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxIsLockOk = (PFWLXISLOCKOK)GetProcAddress(hGina,
"WlxIsLockOk");
- if (!Functions->WlxIsLockOk) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxIsLogoffOk = (PFWLXISLOGOFFOK)GetProcAddress(hGina,
"WlxIsLogoffOk");
- if (!Functions->WlxIsLogoffOk) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxLoggedOnSAS = (PFWLXLOGGEDONSAS)GetProcAddress(hGina,
"WlxLoggedOnSAS");
- if (!Functions->WlxLoggedOnSAS) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxLoggedOutSAS = (PFWLXLOGGEDOUTSAS)GetProcAddress(hGina,
"WlxLoggedOutSAS");
- if (!Functions->WlxLoggedOutSAS) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxLogoff = (PFWLXLOGOFF)GetProcAddress(hGina, "WlxLogoff");
- if (!Functions->WlxLogoff) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxShutdown = (PFWLXSHUTDOWN)GetProcAddress(hGina,
"WlxShutdown");
- if (!Functions->WlxShutdown) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxWkstaLockedSAS = (PFWLXWKSTALOCKEDSAS)GetProcAddress(hGina,
"WlxWkstaLockedSAS");
- if (!Functions->WlxWkstaLockedSAS) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
}
if (*DllVersion >= WLX_VERSION_1_1)
{
Functions->WlxScreenSaverNotify = (PFWLXSCREENSAVERNOTIFY)GetProcAddress(hGina,
"WlxScreenSaverNotify");
- if (!Functions->WlxScreenSaverNotify) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxStartApplication = (PFWLXSTARTAPPLICATION)GetProcAddress(hGina,
"WlxStartApplication");
- if (!Functions->WlxStartApplication) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
}
if (*DllVersion >= WLX_VERSION_1_3)
{
Functions->WlxDisplayStatusMessage =
(PFWLXDISPLAYSTATUSMESSAGE)GetProcAddress(hGina, "WlxDisplayStatusMessage");
- if (!Functions->WlxDisplayStatusMessage) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxGetStatusMessage = (PFWLXGETSTATUSMESSAGE)GetProcAddress(hGina,
"WlxGetStatusMessage");
- if (!Functions->WlxGetStatusMessage) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxNetworkProviderLoad = (PFWLXNETWORKPROVIDERLOAD)GetProcAddress(hGina,
"WlxNetworkProviderLoad");
- if (!Functions->WlxNetworkProviderLoad) FAIL_AND_RETURN();
+ if (!Functions->WlxActivateUserShell) goto cleanup;
Functions->WlxRemoveStatusMessage = (PFWLXREMOVESTATUSMESSAGE)GetProcAddress(hGina,
"WlxRemoveStatusMessage");
- if (!Functions->WlxRemoveStatusMessage) FAIL_AND_RETURN();
- }
-
- return TRUE;
-}
-#undef FAIL_AND_RETURN
+ if (!Functions->WlxActivateUserShell) goto cleanup;
+ }
+
+ ret = TRUE;
+
+cleanup:
+ if (!ret)
+ {
+ if (hGina)
+ FreeLibrary(hGina);
+ }
+ else
+ *GinaInstance = hGina;
+ return ret;
+}
BOOL
GinaInit(
@@ -674,20 +625,21 @@
{
DWORD GinaDllVersion;
- if (!LoadGina(&Session->MsGina.Functions, &GinaDllVersion,
&Session->MsGina.hDllInstance))
+ if (!LoadGina(&Session->Gina.Functions, &GinaDllVersion,
&Session->Gina.hDllInstance))
return FALSE;
- Session->MsGina.Context = NULL;
- Session->MsGina.Version = GinaDllVersion;
+ Session->Gina.Context = NULL;
+ Session->Gina.Version = GinaDllVersion;
+ Session->Gina.UseCtrlAltDelete = FALSE;
Session->SuppressStatus = FALSE;
PreviousWindowProc = NULL;
- return Session->MsGina.Functions.WlxInitialize(
+ return Session->Gina.Functions.WlxInitialize(
Session->InteractiveWindowStationName,
(HANDLE)Session,
NULL,
(PVOID)&FunctionTable,
- &Session->MsGina.Context);
+ &Session->Gina.Context);
}
BOOL
@@ -698,7 +650,7 @@
* Create the interactive window station
*/
Session->InteractiveWindowStationName = L"WinSta0";
- Session->InteractiveWindowStation = CreateWindowStation(
+ Session->InteractiveWindowStation = CreateWindowStationW(
Session->InteractiveWindowStationName,
0,
WINSTA_CREATEDESKTOP,
@@ -713,7 +665,7 @@
/*
* Create the application desktop
*/
- Session->ApplicationDesktop = CreateDesktop(
+ Session->ApplicationDesktop = CreateDesktopW(
L"Default",
NULL,
NULL,
@@ -729,7 +681,7 @@
/*
* Create the winlogon desktop
*/
- Session->WinlogonDesktop = CreateDesktop(
+ Session->WinlogonDesktop = CreateDesktopW(
L"Winlogon",
NULL,
NULL,
@@ -745,7 +697,7 @@
/*
* Create the screen saver desktop
*/
- Session->ScreenSaverDesktop = CreateDesktop(
+ Session->ScreenSaverDesktop = CreateDesktopW(
L"Screen-Saver",
NULL,
NULL,