[MSIEXEC] Sync with Wine Staging 2.16. CORE-13762
[reactos.git] / base / system / winlogon / screensaver.c
index a46e577..a613928 100644 (file)
@@ -177,13 +177,14 @@ ScreenSaverThreadMain(
     }
 
 cleanup:
-    RevertToSelf();
     if (Session->hUserActivity)
         CloseHandle(Session->hUserActivity);
 
     if (Session->hEndOfScreenSaver)
         CloseHandle(Session->hEndOfScreenSaver);
 
+    RevertToSelf();
+
 #ifndef USE_GETLASTINPUTINFO
     if (Session->KeyboardHook)
         UnhookWindowsHookEx(Session->KeyboardHook);
@@ -194,6 +195,7 @@ cleanup:
 
     CloseHandle(Session->hEndOfScreenSaverThread);
     CloseHandle(Session->hScreenSaverParametersChanged);
+
     return 0;
 }
 
@@ -348,6 +350,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,14 +367,17 @@ StartScreenSaver(
 
     CloseHandle(ProcessInformation.hProcess);
 
+    CallNotificationDlls(Session, StopScreenSaverHandler);
+
 cleanup:
-    RevertToSelf();
     if (hKey)
         RegCloseKey(hKey);
 
     if (hCurrentUser)
         RegCloseKey(hCurrentUser);
 
+    RevertToSelf();
+
     if (!ret)
     {
         PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_ACTIVITY, 0);