Author: jimtabor Date: Sat May 28 11:39:36 2011 New Revision: 51973
URL: http://svn.reactos.org/svn/reactos?rev=51973&view=rev Log: [ScreenSaver] - Fixed screen saver load and save plus the registry problems.
Modified: trunk/reactos/base/system/winlogon/screensaver.c trunk/reactos/dll/cpl/desk/screensaver.c trunk/reactos/subsystems/win32/win32k/ntuser/input.c trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
Modified: trunk/reactos/base/system/winlogon/screensaver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/winlogon/screen... ============================================================================== --- trunk/reactos/base/system/winlogon/screensaver.c [iso-8859-1] (original) +++ trunk/reactos/base/system/winlogon/screensaver.c [iso-8859-1] Sat May 28 11:39:36 2011 @@ -240,7 +240,7 @@ StartScreenSaver( IN PWLSESSION Session) { - HKEY hKey = NULL; + HKEY hKey = NULL, hCurrentUser = NULL; WCHAR szApplicationName[MAX_PATH]; WCHAR szCommandLine[MAX_PATH + 3]; DWORD bufferSize = sizeof(szApplicationName) - sizeof(WCHAR); @@ -258,8 +258,17 @@ goto cleanup; }
+ rc = RegOpenCurrentUser( + KEY_READ, + &hCurrentUser); + if (rc != ERROR_SUCCESS) + { + ERR("WL: RegOpenCurrentUser Error!\n"); + goto cleanup; + } + rc = RegOpenKeyExW( - HKEY_CURRENT_USER, + hCurrentUser, L"Control Panel\Desktop", 0, KEY_QUERY_VALUE, @@ -343,6 +352,8 @@ RevertToSelf(); if (hKey) RegCloseKey(hKey); + if (hCurrentUser) + RegCloseKey(hCurrentUser); if (!ret) { PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_ACTIVITY, 0);
Modified: trunk/reactos/dll/cpl/desk/screensaver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/desk/screensaver.c?... ============================================================================== --- trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/desk/screensaver.c [iso-8859-1] Sat May 28 11:39:36 2011 @@ -460,6 +460,7 @@ SetScreenSaver(HWND hwndDlg, PDATA pData) { HKEY regKey; + BOOL DeleteMode = FALSE;
if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\Desktop"), @@ -486,6 +487,7 @@ { /* Windows deletes the value if no screensaver is set */ RegDeleteValue(regKey, _T("SCRNSAVE.EXE")); + DeleteMode = TRUE; }
/* set the screensaver time delay */ @@ -505,6 +507,10 @@ REG_SZ, (PBYTE)szTime, _tcslen(szTime) * sizeof(TCHAR)); + + if (DeleteMode) Time = 0; + + SystemParametersInfoW(SPI_SETSCREENSAVETIMEOUT, Time, 0, SPIF_SENDCHANGE);
/* set the secure value */ Ret = SendDlgItemMessage(hwndDlg,
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Sat May 28 11:39:36 2011 @@ -75,14 +75,15 @@ VOID FASTCALL DoTheScreenSaver(VOID) { LARGE_INTEGER TickCount; - DWORD Test; + DWORD Test, TO;
if (gspv.iScrSaverTimeout > 0) // Zero means Off. { KeQueryTickCount(&TickCount); Test = MsqCalculateMessageTime(&TickCount); Test = Test - LastInputTick; - if (Test > gspv.iScrSaverTimeout) + TO = 1000 * gspv.iScrSaverTimeout; + if (Test > TO) { DPRINT("Screensaver Message Start! Tick %d Timeout %d \n", Test, gspv.iScrSaverTimeout);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] Sat May 28 11:39:36 2011 @@ -59,6 +59,7 @@
static const WCHAR* KEY_DESKTOP = L"Control Panel\Desktop"; static const WCHAR* VAL_SCRTO = L"ScreenSaveTimeOut"; +static const WCHAR* VAL_SCRNSV = L"SCRNSAVE.EXE"; static const WCHAR* VAL_SCRACT = L"ScreenSaveActive"; static const WCHAR* VAL_GRID = L"GridGranularity"; static const WCHAR* VAL_DRAG = L"DragFullWindows"; @@ -134,6 +135,20 @@ return dValue; } return Result; +} + +static +DWORD +SpiLoadTimeOut(VOID) +{ // Must have the string! + WCHAR szApplicationName[MAX_PATH]; + RtlZeroMemory(&szApplicationName, sizeof(szApplicationName)); + if (!RegReadUserSetting(KEY_DESKTOP, VAL_SCRNSV, REG_SZ, &szApplicationName, sizeof(szApplicationName))) + { + return 0; + } + if (wcslen(szApplicationName) == 0) return 0; + return SpiLoadInt(KEY_DESKTOP, VAL_SCRTO, 0); }
static @@ -280,7 +295,7 @@ gspv.bDropShadow = 1; gspv.dwMenuShowDelay = 100;
- gspv.iScrSaverTimeout = 600000; // TO in 10 minutes. + gspv.iScrSaverTimeout = SpiLoadTimeOut(); gspv.bScrSaverActive = FALSE; gspv.bScrSaverRunning = FALSE; #if(WINVER >= 0x0600)