ReactOS 0.4.16-dev-188-g678aa63
screensaver.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Display Control Panel
4 * FILE: dll/cpl/desk/screensaver.c
5 * PURPOSE: Screen saver property page
6 *
7 * PROGRAMMERS: Trevor McCort (lycan359@gmail.com)
8 * Ged Murphy (gedmurphy@reactos.org)
9 */
10
11#include "desk.h"
12
13#define MAX_SCREENSAVERS 100
14
15static const TCHAR szPreviewWndClass[] = TEXT("SSDemoParent");
16
17typedef struct
18{
19 BOOL bIsScreenSaver; /* Is this a valid screensaver */
20 TCHAR szFilename[MAX_PATH];
21 TCHAR szDisplayName[256];
23
24
25typedef struct _DATA
26{
34
35
36static LPTSTR
38{
39 HKEY hKey;
40 LPTSTR lpBuf = NULL;
42 LONG Ret;
43
45 _T("Control Panel\\Desktop"),
46 0,
48 &hKey);
49 if (Ret != ERROR_SUCCESS)
50 return NULL;
51
53 lpValue,
54 0,
55 &Type,
56 NULL,
57 &BufSize);
58 if (Ret == ERROR_SUCCESS)
59 {
60 lpBuf = HeapAlloc(GetProcessHeap(), 0, BufSize);
61 if (lpBuf)
62 {
64 lpValue,
65 0,
66 &Type,
67 (LPBYTE)lpBuf,
68 &BufSize);
69 if (Ret != ERROR_SUCCESS)
70 {
71 HeapFree(GetProcessHeap(), 0, lpBuf);
72 lpBuf = NULL;
73 }
74 }
75 }
76
78
79 return lpBuf;
80}
81
82
83static VOID
85{
86 HWND hwndCombo;
88 INT i;
89
90 hwndCombo = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
91
92 i = (INT)SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
93 i = (INT)SendMessage(hwndCombo, CB_GETITEMDATA, i, 0);
94
95 pData->Selection = i;
96
97 bEnable = (i != 0);
98
106}
107
108
111 UINT uMsg,
114{
115 HWND hwnd;
116 PDATA pData;
117 LRESULT Ret = FALSE;
118
120 if (!pData)
121 return Ret;
122
123 Ret = CallWindowProc(pData->OldPreviewProc, hwndDlg, uMsg, wParam, lParam);
124
125 if (uMsg == WM_PAINT)
126 {
127 hwnd = pData->ScreenSaverPreviewParent;
128 if (hwnd)
130 }
131
132 return Ret;
133}
134
135
136static VOID
138{
139 HBRUSH hBrush;
140 HDC hDC;
141 HGDIOBJ hOldObj;
142 RECT rcItem = {
147 };
148
149 hDC = CreateCompatibleDC(draw->hDC);
151
152 if (!IsWindowVisible(pData->ScreenSaverPreviewParent))
153 {
154 /* FIXME: Draw static bitmap inside monitor. */
156 FillRect(hDC, &rcItem, hBrush);
157 DeleteObject(hBrush);
158 }
159
160 GdiTransparentBlt(draw->hDC,
161 draw->rcItem.left, draw->rcItem.top,
162 draw->rcItem.right - draw->rcItem.left + 1,
163 draw->rcItem.bottom - draw->rcItem.top + 1,
164 hDC,
165 0, 0,
168
169 SelectObject(hDC, hOldObj);
170 DeleteDC(hDC);
171}
172
173
174/*
175 * /p:<hwnd> Run preview, hwnd is handle of calling window
176 */
177static VOID
179{
180 HWND hPreview = pData->ScreenSaverPreviewParent;
181 HRESULT hr;
182 STARTUPINFO si;
183 TCHAR szCmdline[2048];
184
185 /* Kill off the previous preview process */
186 if (pData->PrevWindowPi.hProcess)
187 {
188 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
189 CloseHandle(pData->PrevWindowPi.hProcess);
190 CloseHandle(pData->PrevWindowPi.hThread);
191 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
192 }
193 ShowWindow(pData->ScreenSaverPreviewParent, SW_HIDE);
194
195 if (pData->Selection < 1)
196 return;
197
198 hr = StringCbPrintf(szCmdline, sizeof(szCmdline),
199 TEXT("%s /p %Iu"),
200 pData->ScreenSaverItems[pData->Selection].szFilename,
201 (ULONG_PTR)hPreview);
202 if (FAILED(hr))
203 return;
204
205 ZeroMemory(&si, sizeof(si));
206 si.cb = sizeof(si);
207 ZeroMemory(&pData->PrevWindowPi, sizeof(pData->PrevWindowPi));
208
209 ShowWindow(pData->ScreenSaverPreviewParent, SW_SHOW);
210
211 if (!CreateProcess(NULL,
212 szCmdline,
213 NULL,
214 NULL,
215 FALSE,
216 0,
217 NULL,
218 NULL,
219 &si,
220 &pData->PrevWindowPi))
221 {
222 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
223 }
224}
225
226static VOID
229{
230 DWORD dwResult;
231 MSG msg;
232
233 while (TRUE)
234 {
235 dwResult = MsgWaitForMultipleObjects(1,
236 &hProcess,
237 FALSE,
238 INFINITE,
240 if (dwResult == WAIT_OBJECT_0 + 1)
241 {
242 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
243 {
244 if (msg.message == WM_QUIT)
245 {
246 return;
247 }
248 if (!IsDialogMessage(hwndDlg, &msg))
249 {
252 }
253 }
254 }
255 else
256 {
257 return;
258 }
259 }
260}
261
262
263/*
264 * /c:<hwnd> Run configuration, hwnd is handle of calling window
265 */
266static VOID
268{
269 HRESULT hr;
270 STARTUPINFO si;
272 TCHAR szCmdline[2048];
273
274 if (pData->Selection < 1)
275 return;
276
277 hr = StringCbPrintf(szCmdline, sizeof(szCmdline),
278 TEXT("%s /c:%Iu"),
279 pData->ScreenSaverItems[pData->Selection].szFilename,
280 (ULONG_PTR)hwndDlg);
281 if (FAILED(hr))
282 return;
283
284 ZeroMemory(&si, sizeof(si));
285 si.cb = sizeof(si);
286 ZeroMemory(&pi, sizeof(pi));
288 szCmdline,
289 NULL,
290 NULL,
291 FALSE,
292 0,
293 NULL,
294 NULL,
295 &si,
296 &pi))
297 {
298 /* Kill off the previous preview process */
299 if (pData->PrevWindowPi.hProcess)
300 {
301 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
302 CloseHandle(pData->PrevWindowPi.hProcess);
303 CloseHandle(pData->PrevWindowPi.hThread);
304 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
305 }
306
307 WaitForSettingsDialog(hwndDlg, pi.hProcess);
309
310 CloseHandle(pi.hProcess);
311 CloseHandle(pi.hThread);
312 }
313}
314
315/*
316 * /s Run normal
317 */
318static VOID
320{
321 HRESULT hr;
322 STARTUPINFO si;
324 TCHAR szCmdline[2048];
325
326 if (pData->Selection < 1)
327 return;
328
329 /* Kill off the previous preview process */
330 if (pData->PrevWindowPi.hProcess)
331 {
332 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
333 CloseHandle(pData->PrevWindowPi.hProcess);
334 CloseHandle(pData->PrevWindowPi.hThread);
335 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
336 }
337
338 hr = StringCbPrintf(szCmdline, sizeof(szCmdline),
339 TEXT("%s /s"),
340 pData->ScreenSaverItems[pData->Selection].szFilename);
341 if (FAILED(hr))
342 return;
343
344 ZeroMemory(&si, sizeof(si));
345 si.cb = sizeof(si);
346 ZeroMemory(&pi, sizeof(pi));
348 szCmdline,
349 NULL,
350 NULL,
351 FALSE,
352 0,
353 NULL,
354 NULL,
355 &si,
356 &pi))
357 {
359 CloseHandle(pi.hProcess);
360 CloseHandle(pi.hThread);
361 }
362}
363
364
365static VOID
367{
368 HKEY hKey;
369 TCHAR szBuffer[2];
370 DWORD bufferSize = sizeof(szBuffer);
371 DWORD varType = REG_SZ;
372 LONG result;
373
375 _T("Control Panel\\Desktop"),
376 0,
378 &hKey) == ERROR_SUCCESS)
379 {
381 _T("ScreenSaverIsSecure"),
382 0,
383 &varType,
384 (LPBYTE)szBuffer,
385 &bufferSize);
387
388 if (result == ERROR_SUCCESS)
389 {
390 if (_ttoi(szBuffer) == 1)
391 {
392 SendDlgItemMessage(hwndDlg,
396 0);
397 return;
398 }
399 }
400
401 SendDlgItemMessage(hwndDlg,
405 0);
406 }
407}
408
409
410static BOOL
412 _In_ HWND hwndScreenSavers,
414 _In_ SCREEN_SAVER_ITEM* ScreenSaverItem)
415{
416 UINT i;
417
418 if (pData->ScreenSaverCount >= MAX_SCREENSAVERS)
419 return FALSE;
420
421 i = SendMessage(hwndScreenSavers,
423 0,
424 (LPARAM)ScreenSaverItem->szDisplayName);
425 if ((i == CB_ERR) || (i == CB_ERRSPACE))
426 return FALSE;
427
428 SendMessage(hwndScreenSavers,
430 i,
431 (LPARAM)pData->ScreenSaverCount);
432
433 pData->ScreenSaverCount++;
434 return TRUE;
435}
436
437static BOOL
439 _In_ HWND hwndScreenSavers,
441 _In_ LPCTSTR pszFilePath,
443{
444 SCREEN_SAVER_ITEM* ScreenSaverItem;
446 HRESULT hr;
447
448 if (pData->ScreenSaverCount >= MAX_SCREENSAVERS)
449 return FALSE;
450
451 ScreenSaverItem = pData->ScreenSaverItems + pData->ScreenSaverCount;
452
453 ScreenSaverItem->bIsScreenSaver = TRUE;
454
455 hModule = LoadLibraryEx(pszFilePath,
456 NULL,
458 if (hModule)
459 {
461 1,
462 ScreenSaverItem->szDisplayName,
463 _countof(ScreenSaverItem->szDisplayName)) == 0)
464 {
465 /* If the string does not exist, copy the file name */
466 hr = StringCbCopy(ScreenSaverItem->szDisplayName,
467 sizeof(ScreenSaverItem->szDisplayName),
469 if (FAILED(hr))
470 {
472 return FALSE;
473 }
474 /* Remove the .scr extension */
475 ScreenSaverItem->szDisplayName[_tcslen(pszFileName)-4] = _T('\0');
476 }
478 }
479 else
480 {
481 hr = StringCbCopy(ScreenSaverItem->szDisplayName,
482 sizeof(ScreenSaverItem->szDisplayName),
483 _T("Unknown"));
484 if (FAILED(hr))
485 return FALSE;
486 }
487
488 hr = StringCbCopy(ScreenSaverItem->szFilename,
489 sizeof(ScreenSaverItem->szFilename),
490 pszFilePath);
491 if (FAILED(hr))
492 return FALSE;
493
494 return AddScreenSaverItem(hwndScreenSavers, pData, ScreenSaverItem);
495}
496
497static VOID
499 _In_ HWND hwndScreenSavers,
501 _In_ LPCTSTR pszSearchPath)
502{
503 HRESULT hr;
505 HANDLE hFind;
507
509 TEXT("%s\\*.scr"), pszSearchPath);
510 if (FAILED(hr))
511 return;
512
513 hFind = FindFirstFile(szFilePath, &fd);
514 if (hFind == INVALID_HANDLE_VALUE)
515 return;
516
517 do
518 {
519 /* Don't add any hidden screensavers */
520 if (fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
521 continue;
522
523 if (pData->ScreenSaverCount >= MAX_SCREENSAVERS)
524 break;
525
527 TEXT("%s\\%s"), pszSearchPath, fd.cFileName);
528 if (FAILED(hr))
529 break;
530
531 if (!AddScreenSaver(hwndScreenSavers, pData, szFilePath, fd.cFileName))
532 break;
533
534 } while (FindNextFile(hFind, &fd));
535
536 FindClose(hFind);
537}
538
539static VOID
541 _In_ HWND hwndScreenSavers,
543{
544 SCREEN_SAVER_ITEM* ScreenSaverItem;
545 PTCHAR pBackSlash;
546 TCHAR szSearchPath[MAX_PATH];
547 TCHAR szLocalPath[MAX_PATH];
548
549 /* Initialize the number of list items */
550 pData->ScreenSaverCount = 0;
551
552 /* Add the "(None)" item */
553 ScreenSaverItem = pData->ScreenSaverItems;
554
555 ScreenSaverItem->bIsScreenSaver = FALSE;
556
558 IDS_NONE,
559 ScreenSaverItem->szDisplayName,
560 _countof(ScreenSaverItem->szDisplayName));
561
562 AddScreenSaverItem(hwndScreenSavers, pData, ScreenSaverItem);
563
564 /* Add all the screensavers where the applet is stored */
565 GetModuleFileName(hApplet, szLocalPath, _countof(szLocalPath));
566 pBackSlash = _tcsrchr(szLocalPath, _T('\\'));
567 if (pBackSlash != NULL)
568 {
569 *pBackSlash = _T('\0');
570 SearchScreenSavers(hwndScreenSavers, pData, szLocalPath);
571 }
572
573 /* Add all the screensavers in the C:\ReactOS\System32 directory */
574 GetSystemDirectory(szSearchPath, _countof(szSearchPath));
575 if (pBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
576 SearchScreenSavers(hwndScreenSavers, pData, szSearchPath);
577
578 /* Add all the screensavers in the C:\ReactOS directory */
579 GetWindowsDirectory(szSearchPath, _countof(szSearchPath));
580 if (pBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
581 SearchScreenSavers(hwndScreenSavers, pData, szSearchPath);
582}
583
584
585static VOID
587{
588 HKEY regKey;
589
591 _T("Control Panel\\Desktop"),
592 0,
594 &regKey) == ERROR_SUCCESS)
595 {
596 INT Time;
597 BOOL bRet;
598 TCHAR Sec;
599 UINT Ret;
600
601 /* Set the screensaver */
602 if (pData->ScreenSaverItems[pData->Selection].bIsScreenSaver)
603 {
604 SIZE_T Length = (_tcslen(pData->ScreenSaverItems[pData->Selection].szFilename) + 1) * sizeof(TCHAR);
605 RegSetValueEx(regKey,
606 _T("SCRNSAVE.EXE"),
607 0,
608 REG_SZ,
609 (PBYTE)pData->ScreenSaverItems[pData->Selection].szFilename,
610 (DWORD)Length);
611
613 }
614 else
615 {
616 /* Windows deletes the value if no screensaver is set */
617 RegDeleteValue(regKey, _T("SCRNSAVE.EXE"));
618
620 }
621
622 /* Set the secure value */
623 Ret = SendDlgItemMessage(hwndDlg,
626 0,
627 0);
628 Sec = (Ret == BST_CHECKED) ? _T('1') : _T('0');
629 RegSetValueEx(regKey,
630 _T("ScreenSaverIsSecure"),
631 0,
632 REG_SZ,
633 (PBYTE)&Sec,
634 sizeof(TCHAR));
635
636 /* Set the screensaver time delay */
637 Time = GetDlgItemInt(hwndDlg,
639 &bRet,
640 FALSE);
641 if (Time == 0)
642 Time = 1;
643 Time *= 60; // Convert to seconds
644
646
647 RegCloseKey(regKey);
648 }
649}
650
651
652static BOOL
654{
655 HWND hwndSSCombo = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
656 LPTSTR pSsValue;
657 INT iCurSs;
658 WNDCLASS wc = {0};
659
661 if (!pData)
662 {
663 EndDialog(hwndDlg, -1);
664 return FALSE;
665 }
666
668 wc.hInstance = hApplet;
669 wc.hCursor = NULL;
672
673 if (RegisterClass(&wc))
674 {
675 HWND hParent = GetDlgItem(hwndDlg, IDC_SCREENS_PREVIEW);
676 HWND hChild;
677
678 if (hParent != NULL)
679 {
680 pData->OldPreviewProc = (WNDPROC)GetWindowLongPtr(hParent, GWLP_WNDPROC);
683 }
684
687 0, 0, 0, 0, hParent,
688 NULL, hApplet, NULL);
689 if (hChild != NULL)
690 {
691 RECT rc;
692 GetClientRect(hParent, &rc);
693 rc.left += MONITOR_LEFT;
694 rc.top += MONITOR_TOP;
696 }
697
698 pData->ScreenSaverPreviewParent = hChild;
699 }
700
702
703 pData->Selection = -1;
704
705 SendDlgItemMessage(hwndDlg,
708 0,
709 MAKELONG(240, 1));
710
711 EnumScreenSavers(hwndSSCombo, pData);
712
714
715 /* Set the current screensaver in the combo box */
716 iCurSs = 0; // Default to "(None)"
717 pSsValue = GetCurrentScreenSaverValue(_T("SCRNSAVE.EXE"));
718 if (pSsValue)
719 {
720 BOOL bFound = FALSE;
721 INT i;
722
723 /* Find whether the current screensaver is in the list */
724 for (i = 0; i < pData->ScreenSaverCount; i++)
725 {
726 if (!_tcsicmp(pSsValue, pData->ScreenSaverItems[i].szFilename))
727 {
728 bFound = TRUE;
729 break;
730 }
731 }
732
733 if (!bFound)
734 {
735 /* The current screensaver is not in the list: add it */
736 // i = pData->ScreenSaverCount;
737 bFound = AddScreenSaver(hwndSSCombo, pData, pSsValue, _T("SCRNSAVE.EXE"));
738 if (bFound)
739 i = pData->ScreenSaverCount - 1;
740 }
741
742 HeapFree(GetProcessHeap(), 0, pSsValue);
743
744 if (bFound)
745 {
746 /* The current screensaver should be in the list: select it */
747 iCurSs = SendMessage(hwndSSCombo,
749 -1,
750 (LPARAM)pData->ScreenSaverItems[i].szDisplayName);
751 if (iCurSs == CB_ERR)
752 iCurSs = 0; // Default to "(None)"
753 }
754 }
755 SendMessage(hwndSSCombo, CB_SETCURSEL, iCurSs, 0);
756
757 /* Set the current timeout */
758 pSsValue = GetCurrentScreenSaverValue(_T("ScreenSaveTimeOut"));
759 if (pSsValue)
760 {
761 UINT Time = _ttoi(pSsValue) / 60;
762
763 HeapFree(GetProcessHeap(), 0, pSsValue);
764
765 SendDlgItemMessage(hwndDlg,
768 0,
769 Time);
770 }
771
772 SelectionChanged(hwndDlg, pData);
773
774 return TRUE;
775}
776
777
780 UINT uMsg,
783{
784 PDATA pData;
785
787
788 switch (uMsg)
789 {
790 case WM_INITDIALOG:
791 {
792 OnInitDialog(hwndDlg, pData);
793 break;
794 }
795
796 case WM_DESTROY:
797 {
798 if (pData->ScreenSaverPreviewParent)
799 {
802 (LONG_PTR)pData->OldPreviewProc);
803 DestroyWindow(pData->ScreenSaverPreviewParent);
804 pData->ScreenSaverPreviewParent = NULL;
805 }
807 if (pData->PrevWindowPi.hProcess)
808 {
809 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
810 CloseHandle(pData->PrevWindowPi.hProcess);
811 CloseHandle(pData->PrevWindowPi.hThread);
812 }
814 break;
815 }
816
817 case WM_ENDSESSION:
818 {
820 break;
821 }
822
823 case WM_DRAWITEM:
824 {
825 LPDRAWITEMSTRUCT lpDrawItem;
826 lpDrawItem = (LPDRAWITEMSTRUCT)lParam;
827
828 if (lpDrawItem->CtlID == IDC_SCREENS_PREVIEW)
829 ShowScreenSaverPreview(lpDrawItem, pData);
830 break;
831 }
832
833 case WM_COMMAND:
834 {
835 DWORD controlId = LOWORD(wParam);
837
838 switch (controlId)
839 {
840 case IDC_SCREENS_LIST:
841 {
843 {
844 SelectionChanged(hwndDlg, pData);
846 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
847 }
848 break;
849 }
850
852 {
853 if (command == EN_CHANGE)
854 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
855 break;
856 }
857
858 case IDC_SCREENS_POWER_BUTTON: // Start Powercfg.Cpl
859 {
860 if (command == BN_CLICKED)
861 WinExec("rundll32 shell32.dll,Control_RunDLL powercfg.cpl",SW_SHOWNORMAL);
862 break;
863 }
864
865 case IDC_SCREENS_TESTSC: // Screensaver Preview
866 {
867 if (command == BN_CLICKED)
868 {
869 ScreenSaverPreview(hwndDlg, pData);
871 }
872 break;
873 }
874
875 case IDC_SCREENS_SETTINGS: // Screensaver Settings
876 {
877 if (command == BN_CLICKED)
878 ScreenSaverConfig(hwndDlg, pData);
879 break;
880 }
881
882 case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure
883 {
884 if (command == BN_CLICKED)
885 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
886 break;
887 }
888 }
889 break;
890 }
891
892 case WM_NOTIFY:
893 {
894 LPNMHDR lpnm = (LPNMHDR)lParam;
895
896 switch(lpnm->code)
897 {
898 case PSN_APPLY:
899 {
900 SetScreenSaver(hwndDlg, pData);
901 return TRUE;
902 }
903
904 case PSN_SETACTIVE:
905 {
906 /* Enable screensaver preview support */
908 break;
909 }
910
911 case PSN_KILLACTIVE:
912 {
913 /* Kill running preview screensaver */
914 if (pData->PrevWindowPi.hProcess)
915 {
916 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
917 CloseHandle(pData->PrevWindowPi.hProcess);
918 CloseHandle(pData->PrevWindowPi.hThread);
919 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
920 }
921 break;
922 }
923 }
924 }
925 break;
926 }
927
928 return FALSE;
929}
static HDC hDC
Definition: 3dtext.c:33
#define BufSize
Definition: FsRtlTunnel.c:28
Type
Definition: Type.h:7
#define msg(x)
Definition: auth_time.c:54
GLOBAL_DATA g_GlobalData
Definition: background.c:70
#define IDS_NONE
Definition: resource.h:133
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define MONITOR_HEIGHT
Definition: desk.h:77
#define MONITOR_BOTTOM
Definition: desk.h:74
#define MONITOR_LEFT
Definition: desk.h:71
#define MONITOR_ALPHA
Definition: desk.h:79
#define MONITOR_TOP
Definition: desk.h:72
#define MONITOR_WIDTH
Definition: desk.h:76
#define MONITOR_RIGHT
Definition: desk.h:73
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDC_SCREENS_PREVIEW
Definition: resource.h:39
#define IDC_SCREENS_USEPASSCHK
Definition: resource.h:44
#define IDC_SCREENS_TIME
Definition: resource.h:46
#define IDC_SCREENS_TIMEDELAY
Definition: resource.h:45
#define IDC_SCREENS_POWER_BUTTON
Definition: resource.h:41
#define IDC_MINTEXT
Definition: resource.h:48
#define IDC_SCREENS_LIST
Definition: resource.h:40
#define IDC_SCREENS_TESTSC
Definition: resource.h:43
#define IDC_SCREENS_SETTINGS
Definition: resource.h:42
#define IDC_WAITTEXT
Definition: resource.h:47
static LPTSTR GetCurrentScreenSaverValue(LPTSTR lpValue)
Definition: screensaver.c:37
static VOID ShowScreenSaverPreview(IN LPDRAWITEMSTRUCT draw, IN PDATA pData)
Definition: screensaver.c:137
static VOID SelectionChanged(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:84
static VOID EnumScreenSavers(_In_ HWND hwndScreenSavers, _In_ PDATA pData)
Definition: screensaver.c:540
static VOID WaitForSettingsDialog(HWND hwndDlg, HANDLE hProcess)
Definition: screensaver.c:227
static VOID ScreenSaverPreview(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:319
static VOID SetScreenSaver(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:586
struct _DATA DATA
static BOOL AddScreenSaverItem(_In_ HWND hwndScreenSavers, _In_ PDATA pData, _In_ SCREEN_SAVER_ITEM *ScreenSaverItem)
Definition: screensaver.c:411
static VOID SearchScreenSavers(_In_ HWND hwndScreenSavers, _In_ PDATA pData, _In_ LPCTSTR pszSearchPath)
Definition: screensaver.c:498
static VOID SetScreenSaverPreviewBox(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:178
struct _DATA * PDATA
#define MAX_SCREENSAVERS
Definition: screensaver.c:13
static BOOL OnInitDialog(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:653
static VOID ScreenSaverConfig(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:267
static const TCHAR szPreviewWndClass[]
Definition: screensaver.c:15
INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: screensaver.c:779
static VOID CheckRegScreenSaverIsSecure(HWND hwndDlg)
Definition: screensaver.c:366
LRESULT CALLBACK RedrawSubclassProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: screensaver.c:110
static BOOL AddScreenSaver(_In_ HWND hwndScreenSavers, _In_ PDATA pData, _In_ LPCTSTR pszFilePath, _In_ LPCTSTR pszFileName)
Definition: screensaver.c:438
HMODULE hModule
Definition: animate.c:44
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
UINT WINAPI DECLSPEC_HOTPATCH WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
Definition: proc.c:4779
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
pKey DeleteObject()
size_t bufferSize
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FAILED(hr)
Definition: intsafe.h:51
#define TEXT(s)
Definition: k32.h:26
#define REG_SZ
Definition: layer.c:22
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define _tcsrchr
Definition: utility.h:116
static HDC
Definition: imagelist.c:88
static HTREEITEM hChild
Definition: treeview.c:383
static PLARGE_INTEGER Time
Definition: time.c:105
static refpint_t pi[]
Definition: server.c:96
#define _In_
Definition: ms_sal.h:308
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_READ
Definition: nt_native.h:1023
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
char * PTCHAR
Definition: ntbasedef.h:476
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define INT
Definition: polytest.cpp:20
UINT Sec[]
Definition: powershemes.c:41
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_APPLY
Definition: prsht.h:117
#define PSN_SETACTIVE
Definition: prsht.h:115
#define UDM_SETRANGE
Definition: commctrl.h:2146
#define UDM_SETPOS32
Definition: commctrl.h:2160
static WCHAR szFilePath[]
Definition: qotd.c:14
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
static int fd
Definition: io.c:51
HRESULT hr
Definition: shlfolder.c:183
#define _countof(array)
Definition: sndvol32.h:70
#define StringCbCopy
Definition: strsafe.h:155
#define StringCbPrintf
Definition: strsafe.h:544
TCHAR szDisplayName[256]
Definition: screensaver.c:21
TCHAR szFilename[MAX_PATH]
Definition: screensaver.c:20
WNDPROC OldPreviewProc
Definition: screensaver.c:30
SCREEN_SAVER_ITEM ScreenSaverItems[MAX_SCREENSAVERS]
Definition: screensaver.c:27
int Selection
Definition: screensaver.c:29
PROCESS_INFORMATION PrevWindowPi
Definition: screensaver.c:28
UINT ScreenSaverCount
Definition: screensaver.c:31
HWND ScreenSaverPreviewParent
Definition: screensaver.c:32
LONG bmMonHeight
Definition: desk.h:164
LONG bmMonWidth
Definition: desk.h:163
COLORREF desktop_color
Definition: desk.h:159
HBITMAP hMonitorBitmap
Definition: desk.h:162
DWORD cb
Definition: winbase.h:831
HBRUSH hbrBackground
Definition: winuser.h:3173
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
UINT code
Definition: winuser.h:3162
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI GdiTransparentBlt(HDC hdcDst, int xDst, int yDst, int wDst, int hDst, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, UINT crTransparent)
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
#define _T(x)
Definition: vfdio.h:22
#define GetWindowsDirectory
Definition: winbase.h:3857
#define CreateProcess
Definition: winbase.h:3758
#define ZeroMemory
Definition: winbase.h:1712
#define GetSystemDirectory
Definition: winbase.h:3842
#define LoadLibraryEx
Definition: winbase.h:3863
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:342
#define FindNextFile
Definition: winbase.h:3788
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define FindFirstFile
Definition: winbase.h:3782
#define DONT_RESOLVE_DLL_REFERENCES
Definition: winbase.h:341
#define GetModuleFileName
Definition: winbase.h:3831
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ BOOL bEnable
Definition: winddi.h:3426
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define BLACK_BRUSH
Definition: wingdi.h:896
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegSetValueEx
Definition: winreg.h:533
#define RegQueryValueEx
Definition: winreg.h:524
#define RegDeleteValue
Definition: winreg.h:508
#define SW_SHOWNORMAL
Definition: winuser.h:773
#define WM_PAINT
Definition: winuser.h:1623
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define CreateWindowEx
Definition: winuser.h:5767
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define SW_HIDE
Definition: winuser.h:771
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define DWLP_USER
Definition: winuser.h:875
#define WM_QUIT
Definition: winuser.h:1626
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CallWindowProc
Definition: winuser.h:5747
#define IsDialogMessage
Definition: winuser.h:5821
#define BST_UNCHECKED
Definition: winuser.h:199
#define CB_ERRSPACE
Definition: winuser.h:2439
#define WM_COMMAND
Definition: winuser.h:1743
#define SPI_SETSCREENSAVEACTIVE
Definition: winuser.h:1369
#define CB_ERR
Definition: winuser.h:2438
#define CB_SETCURSEL
Definition: winuser.h:1964
#define UnregisterClass
Definition: winuser.h:5873
#define QS_ALLINPUT
Definition: winuser.h:906
#define RDW_ERASE
Definition: winuser.h:1214
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1943
#define WM_INITDIALOG
Definition: winuser.h:1742
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_DRAWITEM
Definition: winuser.h:1648
#define CBN_SELCHANGE
Definition: winuser.h:1982
#define BM_SETCHECK
Definition: winuser.h:1924
#define SPIF_SENDCHANGE
Definition: winuser.h:1575
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1574
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define RDW_ALLCHILDREN
Definition: winuser.h:1224
#define PM_REMOVE
Definition: winuser.h:1199
#define CB_ADDSTRING
Definition: winuser.h:1939
struct tagNMHDR * LPNMHDR
#define CB_GETITEMDATA
Definition: winuser.h:1953
#define SendMessage
Definition: winuser.h:5855
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define PeekMessage
Definition: winuser.h:5842
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
HWND WINAPI GetParent(_In_ HWND)
#define LoadString
Definition: winuser.h:5831
#define BN_CLICKED
Definition: winuser.h:1928
#define SW_SHOW
Definition: winuser.h:778
#define RegisterClass
Definition: winuser.h:5848
#define WM_DESTROY
Definition: winuser.h:1612
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
#define DispatchMessage
Definition: winuser.h:5777
#define WM_ENDSESSION
Definition: winuser.h:1630
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
#define SystemParametersInfo
Definition: winuser.h:5870
#define CB_GETCURSEL
Definition: winuser.h:1946
#define SendDlgItemMessage
Definition: winuser.h:5854
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SPI_SETSCREENSAVETIMEOUT
Definition: winuser.h:1367
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define RDW_INVALIDATE
Definition: winuser.h:1217
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1921
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define EN_CHANGE
Definition: winuser.h:2025
char TCHAR
Definition: xmlstorage.h:189
#define _ttoi
Definition: xmlstorage.h:195
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcslen
Definition: xmlstorage.h:198
#define _tcsicmp
Definition: xmlstorage.h:205