1
0
Fork 0
mirror of https://github.com/reactos/reactos.git synced 2025-05-29 14:08:22 +00:00

[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); // void Event_Handler_Function_Name(PWLX_NOTIFICATION_INFO pInfo);
typedef VOID (WINAPI *PWLX_NOTIFY_HANDLER)(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] = static PSTR FuncNames[LastHandler] =
{ {
"Logon", "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 VOID
CleanupNotifications(VOID) CleanupNotifications(VOID)
{ {
@ -217,14 +269,14 @@ CleanupNotifications(VOID)
ListEntry); ListEntry);
if (NotificationDll != NULL) if (NotificationDll != NULL)
{ {
FreeLibrary(NotificationDll->hInstance);
} }
ListEntry = ListEntry->Flink; ListEntry = ListEntry->Flink;
RemoveEntryList(&NotificationDll->ListEntry); RemoveEntryList(&NotificationDll->ListEntry);
RtlFreeHeap(RtlGetProcessHeap(), 0, NotificationDll);
} }
} }

View file

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

View file

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

View file

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

View file

@ -240,6 +240,23 @@ typedef struct _WLSESSION
WLX_PROFILE_V2_0 *Profile; WLX_PROFILE_V2_0 *Profile;
} WLSESSION, *PWLSESSION; } 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 HINSTANCE hAppInstance;
extern PWLSESSION WLSession; extern PWLSESSION WLSession;
@ -266,6 +283,11 @@ InitNotifications(VOID);
VOID VOID
CleanupNotifications(VOID); CleanupNotifications(VOID);
VOID
CallNotificationDlls(
PWLSESSION pSession,
NOTIFICATION_TYPE Type);
/* rpcserver.c */ /* rpcserver.c */
BOOL BOOL
StartRpcServer(VOID); StartRpcServer(VOID);