[WINLOGON]

Implement calls to the notification DLLs.

svn path=/trunk/; revision=68803
This commit is contained in:
Eric Kohl 2015-08-23 15:48:52 +00:00
parent 80314158bf
commit f28d52abfc
5 changed files with 113 additions and 20 deletions

View file

@ -16,23 +16,6 @@
// void Event_Handler_Function_Name(PWLX_NOTIFICATION_INFO pInfo);
typedef VOID (WINAPI *PWLX_NOTIFY_HANDLER)(PWLX_NOTIFICATION_INFO pInfo);
typedef enum _NOTIFICATION_TYPE
{
LogonHandler,
LogoffHandler,
LockHandler,
UnlockHandler,
StartupHandler,
ShutdownHandler,
StartScreenSaverHandler,
StopScreenSaverHandler,
DisconnectHandler,
ReconnectHandler,
StartShellHandler,
PostShellHandler,
LastHandler
} NOTIFICATION_TYPE, *PNOTIFICATION_TYPE;
static PSTR FuncNames[LastHandler] =
{
"Logon",
@ -203,6 +186,75 @@ InitNotifications(VOID)
}
VOID
CallNotificationDlls(
PWLSESSION pSession,
NOTIFICATION_TYPE Type)
{
PLIST_ENTRY ListEntry;
PNOTIFICATION_ITEM NotificationDll;
WLX_NOTIFICATION_INFO Info;
TRACE("CallNotificationDlls()\n");
Info.Size = sizeof(WLX_NOTIFICATION_INFO);
switch (Type)
{
case LogoffHandler:
case ShutdownHandler:
Info.Flags = 3;
break;
default:
Info.Flags = 0;
break;
}
Info.UserName = NULL; //UserName;
Info.Domain = NULL; //Domain;
Info.WindowStation = pSession->InteractiveWindowStationName;
Info.hToken = pSession->UserToken;
switch (Type)
{
case LogonHandler:
case StartShellHandler:
Info.hDesktop = pSession->ApplicationDesktop;
break;
case StartScreenSaverHandler:
Info.hDesktop = pSession->ApplicationDesktop;
break;
default:
Info.hDesktop = pSession->WinlogonDesktop;
break;
}
Info.pStatusCallback = NULL;
ListEntry = NotificationDllListHead.Flink;
while (ListEntry != &NotificationDllListHead)
{
TRACE("ListEntry %p\n", ListEntry);
NotificationDll = CONTAINING_RECORD(ListEntry,
NOTIFICATION_ITEM,
ListEntry);
TRACE("NotificationDll: %p\n", NotificationDll);
if (NotificationDll != NULL)
{
TRACE("NotificationDll->Handler: %p\n", NotificationDll->Handler[Type]);
if (NotificationDll->Handler[Type] != NULL)
NotificationDll->Handler[Type](&Info);
}
ListEntry = ListEntry->Flink;
}
}
VOID
CleanupNotifications(VOID)
{
@ -217,14 +269,14 @@ CleanupNotifications(VOID)
ListEntry);
if (NotificationDll != NULL)
{
FreeLibrary(NotificationDll->hInstance);
}
ListEntry = ListEntry->Flink;
RemoveEntryList(&NotificationDll->ListEntry);
RtlFreeHeap(RtlGetProcessHeap(), 0, NotificationDll);
}
}

View file

@ -446,6 +446,8 @@ HandleLogon(
goto cleanup;
}
CallNotificationDlls(Session, LogonHandler);
DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS);
UpdatePerUserSystemParameters(0, TRUE);
@ -465,6 +467,8 @@ HandleLogon(
goto cleanup;
}
CallNotificationDlls(Session, StartShellHandler);
if (!InitializeScreenSaver(Session))
WARN("WL: Failed to initialize screen saver\n");
@ -783,10 +787,14 @@ HandleLogoff(
DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_SAVEYOURSETTINGS);
UnloadUserProfile(Session->UserToken, Session->hProfileInfo);
CallNotificationDlls(Session, LogoffHandler);
CloseHandle(Session->UserToken);
UpdatePerUserSystemParameters(0, FALSE);
Session->LogonState = STATE_LOGGED_OFF;
Session->UserToken = NULL;
return STATUS_SUCCESS;
}
@ -894,6 +902,8 @@ HandleShutdown(
return STATUS_UNSUCCESSFUL;
}
CallNotificationDlls(Session, ShutdownHandler);
/* Destroy SAS window */
UninitializeSAS(Session);
@ -932,6 +942,7 @@ DoGenericAction(
if (!HandleLogon(Session))
{
Session->Gina.Functions.WlxDisplaySASNotice(Session->Gina.Context);
CallNotificationDlls(Session, LogonHandler);
}
}
break;
@ -957,6 +968,7 @@ DoGenericAction(
SwitchDesktop(Session->WinlogonDesktop);
Session->LogonState = STATE_LOCKED;
Session->Gina.Functions.WlxDisplayLockedNotice(Session->Gina.Context);
CallNotificationDlls(Session, LockHandler);
}
break;
case WLX_SAS_ACTION_LOGOFF: /* 0x04 */
@ -999,6 +1011,7 @@ DoGenericAction(
case WLX_SAS_ACTION_UNLOCK_WKSTA: /* 0x08 */
SwitchDesktop(Session->ApplicationDesktop);
Session->LogonState = STATE_LOGGED_ON;
CallNotificationDlls(Session, UnlockHandler);
break;
default:
WARN("Unknown SAS action 0x%lx\n", wlxAction);

View file

@ -348,6 +348,8 @@ StartScreenSaver(
SystemParametersInfoW(SPI_SETSCREENSAVERRUNNING, TRUE, NULL, 0);
CallNotificationDlls(Session, StartScreenSaverHandler);
/* Wait the end of the process or some other activity */
ResetEvent(Session->hUserActivity);
HandleArray[0] = ProcessInformation.hProcess;
@ -363,6 +365,8 @@ StartScreenSaver(
CloseHandle(ProcessInformation.hProcess);
CallNotificationDlls(Session, StopScreenSaverHandler);
cleanup:
RevertToSelf();
if (hKey)

View file

@ -434,6 +434,8 @@ WinMain(
}
#endif
CallNotificationDlls(WLSession, StartupHandler);
/* Create a hidden window to get SAS notifications */
if (!InitializeSAS(WLSession))
{

View file

@ -240,6 +240,23 @@ typedef struct _WLSESSION
WLX_PROFILE_V2_0 *Profile;
} WLSESSION, *PWLSESSION;
typedef enum _NOTIFICATION_TYPE
{
LogonHandler,
LogoffHandler,
LockHandler,
UnlockHandler,
StartupHandler,
ShutdownHandler,
StartScreenSaverHandler,
StopScreenSaverHandler,
DisconnectHandler,
ReconnectHandler,
StartShellHandler,
PostShellHandler,
LastHandler
} NOTIFICATION_TYPE, *PNOTIFICATION_TYPE;
extern HINSTANCE hAppInstance;
extern PWLSESSION WLSession;
@ -266,6 +283,11 @@ InitNotifications(VOID);
VOID
CleanupNotifications(VOID);
VOID
CallNotificationDlls(
PWLSESSION pSession,
NOTIFICATION_TYPE Type);
/* rpcserver.c */
BOOL
StartRpcServer(VOID);