mirror of
https://github.com/reactos/reactos.git
synced 2025-06-05 17:30:32 +00:00
[ScreenSaver]
- Fixed screen saver load and save plus the registry problems. svn path=/trunk/; revision=51973
This commit is contained in:
parent
787984bc0f
commit
e878e6c8fc
4 changed files with 38 additions and 5 deletions
|
@ -240,7 +240,7 @@ VOID
|
|||
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 @@ StartScreenSaver(
|
|||
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 @@ cleanup:
|
|||
RevertToSelf();
|
||||
if (hKey)
|
||||
RegCloseKey(hKey);
|
||||
if (hCurrentUser)
|
||||
RegCloseKey(hCurrentUser);
|
||||
if (!ret)
|
||||
{
|
||||
PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_ACTIVITY, 0);
|
||||
|
|
|
@ -460,6 +460,7 @@ static VOID
|
|||
SetScreenSaver(HWND hwndDlg, PDATA pData)
|
||||
{
|
||||
HKEY regKey;
|
||||
BOOL DeleteMode = FALSE;
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER,
|
||||
_T("Control Panel\\Desktop"),
|
||||
|
@ -486,6 +487,7 @@ SetScreenSaver(HWND hwndDlg, PDATA pData)
|
|||
{
|
||||
/* Windows deletes the value if no screensaver is set */
|
||||
RegDeleteValue(regKey, _T("SCRNSAVE.EXE"));
|
||||
DeleteMode = TRUE;
|
||||
}
|
||||
|
||||
/* set the screensaver time delay */
|
||||
|
@ -506,6 +508,10 @@ SetScreenSaver(HWND hwndDlg, PDATA pData)
|
|||
(PBYTE)szTime,
|
||||
_tcslen(szTime) * sizeof(TCHAR));
|
||||
|
||||
if (DeleteMode) Time = 0;
|
||||
|
||||
SystemParametersInfoW(SPI_SETSCREENSAVETIMEOUT, Time, 0, SPIF_SENDCHANGE);
|
||||
|
||||
/* set the secure value */
|
||||
Ret = SendDlgItemMessage(hwndDlg,
|
||||
IDC_SCREENS_USEPASSCHK,
|
||||
|
|
|
@ -75,14 +75,15 @@ DWORD IntLastInputTick(BOOL LastInputTickSetGet)
|
|||
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);
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ static const WCHAR* VAL_HOVERHEIGHT = L"MouseHoverHeight";
|
|||
|
||||
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";
|
||||
|
@ -136,6 +137,20 @@ SpiLoadUserPrefMask(DWORD 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
|
||||
INT
|
||||
SpiLoadMouse(PCWSTR pwszValue, INT iValue)
|
||||
|
@ -280,7 +295,7 @@ SpiUpdatePerUserSystemParameters()
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue