[WINLOGON]

- Implement a global dialog tracking list.
- Close the SAS notice dialog before the logon dialog is created and create a new SAS notice dialog when the user cancels the logon dialog. This prevents the creation of multiple SAS notice dialogs below the logon dialog.

svn path=/trunk/; revision=61585
This commit is contained in:
Eric Kohl 2014-01-11 16:20:31 +00:00
parent 837597758f
commit f0ecb9c0cb
4 changed files with 182 additions and 25 deletions

View file

@ -845,6 +845,7 @@ DoGenericAction(
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context); Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
break; break;
case WLX_SAS_ACTION_NONE: /* 0x02 */ case WLX_SAS_ACTION_NONE: /* 0x02 */
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
break; break;
case WLX_SAS_ACTION_LOCK_WKSTA: /* 0x03 */ case WLX_SAS_ACTION_LOCK_WKSTA: /* 0x03 */
if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context)) if (Session->Gina.Functions.WlxIsLockOk(Session->Gina.Context))
@ -923,6 +924,13 @@ DispatchSAS(
default: default:
{ {
PSID LogonSid = NULL; /* FIXME */ PSID LogonSid = NULL; /* FIXME */
HWND hwnd;
hwnd = GetTopDialogWindow();
if (hwnd != NULL)
{
SendMessage(hwnd, WM_USER, 0, 0);
}
Session->Options = 0; Session->Options = 0;

View file

@ -334,6 +334,9 @@ WinMain(
ZeroMemory(WLSession, sizeof(WLSESSION)); ZeroMemory(WLSession, sizeof(WLSESSION));
WLSession->DialogTimeout = 120; /* 2 minutes */ WLSession->DialogTimeout = 120; /* 2 minutes */
/* Initialize the dialog tracking list */
InitDialogListHead();
if (!CreateWindowStationAndDesktops(WLSession)) if (!CreateWindowStationAndDesktops(WLSession))
{ {
ERR("WL: Could not create window station and desktops\n"); ERR("WL: Could not create window station and desktops\n");

View file

@ -189,17 +189,17 @@ typedef struct _GINAINSTANCE
*/ */
typedef enum _LOGON_STATE typedef enum _LOGON_STATE
{ {
STATE_INIT, // not user yet STATE_INIT, // not used yet
STATE_LOGGED_OFF, STATE_LOGGED_OFF,
STATE_LOGGED_OFF_SAS, // not user yet STATE_LOGGED_OFF_SAS, // not used yet
STATE_LOGGED_ON, STATE_LOGGED_ON,
STATE_LOGGED_ON_SAS, // not user yet STATE_LOGGED_ON_SAS, // not used yet
STATE_SCREENSAVER, // not user yet STATE_SCREENSAVER, // not used yet
STATE_LOCKED, STATE_LOCKED,
STATE_LOCKED_SAS, // not user yet STATE_LOCKED_SAS, // not used yet
STATE_LOGGING_OFF, // not user yet STATE_LOGGING_OFF, // not used yet
STATE_SHUTTING_DOWN, // not user yet STATE_SHUTTING_DOWN, // not used yet
STATE_SHUT_DOWN // not user yet STATE_SHUT_DOWN // not used yet
} LOGON_STATE, *PLOGON_STATE; } LOGON_STATE, *PLOGON_STATE;
#define LockWorkstation(Session) #define LockWorkstation(Session)
@ -291,6 +291,12 @@ BOOL
RemoveStatusMessage(IN PWLSESSION Session); RemoveStatusMessage(IN PWLSESSION Session);
/* wlx.c */ /* wlx.c */
VOID
InitDialogListHead(VOID);
HWND
GetTopDialogWindow(VOID);
BOOL BOOL
GinaInit(IN OUT PWLSESSION Session); GinaInit(IN OUT PWLSESSION Session);

View file

@ -26,13 +26,107 @@
#define GENERIC_ACCESS (GENERIC_READ | GENERIC_WRITE | \ #define GENERIC_ACCESS (GENERIC_READ | GENERIC_WRITE | \
GENERIC_EXECUTE | GENERIC_ALL) GENERIC_EXECUTE | GENERIC_ALL)
typedef struct _DIALOG_LIST_ENTRY
{
LIST_ENTRY Entry;
HWND hWnd;
DLGPROC DlgProc;
LPARAM lParam;
} DIALOG_LIST_ENTRY, *PDIALOG_LIST_ENTRY;
/* GLOBALS ******************************************************************/ /* GLOBALS ******************************************************************/
static DLGPROC PreviousWindowProc; //static UINT_PTR IdTimer;
static UINT_PTR IdTimer; static LIST_ENTRY DialogListHead;
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
VOID
InitDialogListHead(VOID)
{
InitializeListHead(&DialogListHead);
}
static
PDIALOG_LIST_ENTRY
AddDialogListEntry(VOID)
{
PDIALOG_LIST_ENTRY ListEntry;
ListEntry = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DIALOG_LIST_ENTRY));
if (ListEntry == NULL)
return NULL;
TRACE("Add entry %p\n", ListEntry);
InsertHeadList(&DialogListHead,
&ListEntry->Entry);
return ListEntry;
}
static
VOID
RemoveDialogListEntry(PDIALOG_LIST_ENTRY ListEntry)
{
TRACE("Remove entry %p\n", ListEntry);
RemoveEntryList(&ListEntry->Entry);
RtlFreeHeap(RtlGetProcessHeap(), 0, ListEntry);
}
static
PDIALOG_LIST_ENTRY
GetDialogListEntry(HWND hwndDlg)
{
PDIALOG_LIST_ENTRY Current;
PLIST_ENTRY ListEntry;
ListEntry = DialogListHead.Flink;
while (ListEntry != &DialogListHead)
{
Current = CONTAINING_RECORD(ListEntry,
DIALOG_LIST_ENTRY,
Entry);
if (Current->hWnd == hwndDlg)
{
TRACE("Found entry: %p\n", Current);
return Current;
}
ListEntry = ListEntry->Flink;
}
TRACE("Found no entry!\n");
return NULL;
}
HWND
GetTopDialogWindow(VOID)
{
PDIALOG_LIST_ENTRY Current;
PLIST_ENTRY ListEntry;
ListEntry = DialogListHead.Flink;
if (ListEntry != &DialogListHead)
{
Current = CONTAINING_RECORD(ListEntry,
DIALOG_LIST_ENTRY,
Entry);
TRACE("Found entry: %p window %p\n", Current, Current->hWnd);
return Current->hWnd;
}
TRACE("Found no window\n");
return NULL;
}
static static
INT_PTR INT_PTR
CALLBACK CALLBACK
@ -42,6 +136,36 @@ DefaultWlxWindowProc(
IN WPARAM wParam, IN WPARAM wParam,
IN LPARAM lParam) IN LPARAM lParam)
{ {
PDIALOG_LIST_ENTRY ListEntry;
INT_PTR ret;
if (uMsg == WM_INITDIALOG)
{
ListEntry = (PDIALOG_LIST_ENTRY)lParam;
TRACE("Set dialog handle: %p\n", hwndDlg);
ListEntry->hWnd = hwndDlg;
lParam = ListEntry->lParam;
// SetTopTimeout(hWnd);
}
else
{
ListEntry = GetDialogListEntry(hwndDlg);
if (ListEntry == NULL)
return FALSE;
}
if (uMsg == WM_USER)
{
EndDialog(hwndDlg, 0);
return 0;
}
ret = ListEntry->DlgProc(hwndDlg, uMsg, wParam, lParam);
return ret;
/*
if (uMsg == WM_TIMER && (UINT_PTR)wParam == IdTimer) if (uMsg == WM_TIMER && (UINT_PTR)wParam == IdTimer)
{ {
EndDialog(hwndDlg, -1); EndDialog(hwndDlg, -1);
@ -64,6 +188,7 @@ DefaultWlxWindowProc(
{ {
return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam); return PreviousWindowProc(hwndDlg, uMsg, wParam, lParam);
} }
*/
} }
/* /*
@ -186,10 +311,7 @@ WlxDialogBox(
TRACE("WlxDialogBox()\n"); TRACE("WlxDialogBox()\n");
if (PreviousWindowProc != NULL) return (int)WlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, dlgprc, 0);
return -1;
PreviousWindowProc = dlgprc;
return (int)DialogBoxW((HINSTANCE) hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc);
} }
/* /*
@ -205,14 +327,25 @@ WlxDialogBoxParam(
DLGPROC dlgprc, DLGPROC dlgprc,
LPARAM dwInitParam) LPARAM dwInitParam)
{ {
PDIALOG_LIST_ENTRY ListEntry;
int ret;
UNREFERENCED_PARAMETER(hWlx); UNREFERENCED_PARAMETER(hWlx);
TRACE("WlxDialogBoxParam()\n"); TRACE("WlxDialogBoxParam()\n");
if (PreviousWindowProc != NULL) ListEntry = AddDialogListEntry();
if (ListEntry == NULL)
return -1; return -1;
PreviousWindowProc = dlgprc;
return (int)DialogBoxParamW(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc, dwInitParam); ListEntry->DlgProc = dlgprc;
ListEntry->lParam = dwInitParam;
ret = (int)DialogBoxParamW(hInst, lpszTemplate, hwndOwner, DefaultWlxWindowProc, (LPARAM)ListEntry);
RemoveDialogListEntry(ListEntry);
return ret;
} }
/* /*
@ -231,10 +364,7 @@ WlxDialogBoxIndirect(
TRACE("WlxDialogBoxIndirect()\n"); TRACE("WlxDialogBoxIndirect()\n");
if (PreviousWindowProc != NULL) return (int)WlxDialogBoxIndirectParam(hWlx, hInst, hDialogTemplate, hwndOwner, dlgprc, 0);
return -1;
PreviousWindowProc = dlgprc;
return (int)DialogBoxIndirectW(hInst, hDialogTemplate, hwndOwner, DefaultWlxWindowProc);
} }
/* /*
@ -250,14 +380,25 @@ WlxDialogBoxIndirectParam(
DLGPROC dlgprc, DLGPROC dlgprc,
LPARAM dwInitParam) LPARAM dwInitParam)
{ {
PDIALOG_LIST_ENTRY ListEntry;
int ret;
UNREFERENCED_PARAMETER(hWlx); UNREFERENCED_PARAMETER(hWlx);
TRACE("WlxDialogBoxIndirectParam()\n"); TRACE("WlxDialogBoxIndirectParam()\n");
if (PreviousWindowProc != NULL) ListEntry = AddDialogListEntry();
if (ListEntry == NULL)
return -1; return -1;
PreviousWindowProc = dlgprc;
return (int)DialogBoxIndirectParamW(hInst, hDialogTemplate, hwndOwner, DefaultWlxWindowProc, dwInitParam); ListEntry->DlgProc = dlgprc;
ListEntry->lParam = dwInitParam;
ret = (int)DialogBoxIndirectParamW(hInst, hDialogTemplate, hwndOwner, DefaultWlxWindowProc, (LPARAM)ListEntry);
RemoveDialogListEntry(ListEntry);
return ret;
} }
/* /*
@ -789,7 +930,6 @@ GinaInit(
Session->Gina.Version = GinaDllVersion; Session->Gina.Version = GinaDllVersion;
Session->Gina.UseCtrlAltDelete = FALSE; Session->Gina.UseCtrlAltDelete = FALSE;
Session->SuppressStatus = FALSE; Session->SuppressStatus = FALSE;
PreviousWindowProc = NULL;
TRACE("Calling WlxInitialize(\"%S\")\n", Session->InteractiveWindowStationName); TRACE("Calling WlxInitialize(\"%S\")\n", Session->InteractiveWindowStationName);
return Session->Gina.Functions.WlxInitialize( return Session->Gina.Functions.WlxInitialize(