ReactOS 0.4.15-dev-6644-g539123c
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 background a wallpaper */
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(),
61 0,
62 BufSize);
63 if (lpBuf)
64 {
66 lpValue,
67 0,
68 &Type,
69 (LPBYTE)lpBuf,
70 &BufSize);
71 if (Ret != ERROR_SUCCESS)
72 {
73 HeapFree(GetProcessHeap(), 0, lpBuf);
74 lpBuf = NULL;
75 }
76 }
77 }
78
80
81 return lpBuf;
82}
83
84
85static VOID
87{
88 HWND hwndCombo;
90 INT i;
91
92 hwndCombo = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
93
94 i = (INT)SendMessage(hwndCombo, CB_GETCURSEL, 0, 0);
95 i = (INT)SendMessage(hwndCombo, CB_GETITEMDATA, i, 0);
96
97 pData->Selection = i;
98
99 bEnable = (i != 0);
100
108}
109
110
113 UINT uMsg,
116{
117 HWND hwnd;
118 PDATA pData;
119 LRESULT Ret = FALSE;
120
122 if (!pData)
123 return Ret;
124
125 Ret = CallWindowProc(pData->OldPreviewProc, hwndDlg, uMsg, wParam, lParam);
126
127 if (uMsg == WM_PAINT)
128 {
129 hwnd = pData->ScreenSaverPreviewParent;
130 if (hwnd)
132 }
133
134 return Ret;
135}
136
137
138static VOID
140{
141 HBRUSH hBrush;
142 HDC hDC;
143 HGDIOBJ hOldObj;
144 RECT rcItem = {
149 };
150
151 hDC = CreateCompatibleDC(draw->hDC);
153
154 if (!IsWindowVisible(pData->ScreenSaverPreviewParent))
155 {
156 /* FIXME: Draw static bitmap inside monitor. */
158 FillRect(hDC, &rcItem, hBrush);
159 DeleteObject(hBrush);
160 }
161
162 GdiTransparentBlt(draw->hDC,
163 draw->rcItem.left, draw->rcItem.top,
164 draw->rcItem.right - draw->rcItem.left + 1,
165 draw->rcItem.bottom - draw->rcItem.top + 1,
166 hDC,
167 0, 0,
170
171 SelectObject(hDC, hOldObj);
172 DeleteDC(hDC);
173}
174
175
176static VOID
178{
179 HWND hPreview = pData->ScreenSaverPreviewParent;
180 STARTUPINFO si;
181 TCHAR szCmdline[2048];
182
183 /* Kill off the previous preview process */
184 if (pData->PrevWindowPi.hProcess)
185 {
186 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
187 CloseHandle(pData->PrevWindowPi.hProcess);
188 CloseHandle(pData->PrevWindowPi.hThread);
189 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
190 }
191 ShowWindow(pData->ScreenSaverPreviewParent, SW_HIDE);
192
193 if (pData->Selection > 0)
194 {
195 _stprintf(szCmdline,
196 _T("%s /p %Iu"),
197 pData->ScreenSaverItems[pData->Selection].szFilename,
198 (ULONG_PTR)hPreview);
199
200 ZeroMemory(&si, sizeof(si));
201 si.cb = sizeof(si);
202 ZeroMemory(&pData->PrevWindowPi, sizeof(pData->PrevWindowPi));
203
204 ShowWindow(pData->ScreenSaverPreviewParent, SW_SHOW);
205
206 if (!CreateProcess(NULL,
207 szCmdline,
208 NULL,
209 NULL,
210 FALSE,
211 0,
212 NULL,
213 NULL,
214 &si,
215 &pData->PrevWindowPi))
216 {
217 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
218 }
219 }
220}
221
222static BOOL
225{
226 DWORD dwResult;
227 MSG msg;
228
229 while (TRUE)
230 {
231 dwResult = MsgWaitForMultipleObjects(1,
232 &hProcess,
233 FALSE,
234 INFINITE,
236 if (dwResult == WAIT_OBJECT_0 + 1)
237 {
238 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
239 {
240 if (msg.message == WM_QUIT)
241 {
242 return FALSE;
243 }
244 if (IsDialogMessage(hwndDlg, &msg))
245 {
248 }
249 }
250 }
251 else if (dwResult == WAIT_OBJECT_0)
252 {
253 return TRUE;
254 }
255 else
256 {
257 return FALSE;
258 }
259 }
260}
261
262
263static VOID
265{
266 /*
267 * /c:<hwnd> Run configuration, hwnd is handle of calling window
268 */
269
270 TCHAR szCmdline[2048];
271 STARTUPINFO si;
273
274 if (pData->Selection < 1)
275 return;
276
277 _stprintf(szCmdline,
278 _T("%s /c:%Iu"),
279 pData->ScreenSaverItems[pData->Selection].szFilename,
280 (ULONG_PTR)hwndDlg);
281
282 ZeroMemory(&si, sizeof(si));
283 si.cb = sizeof(si);
284 ZeroMemory(&pi, sizeof(pi));
286 szCmdline,
287 NULL,
288 NULL,
289 FALSE,
290 0,
291 NULL,
292 NULL,
293 &si,
294 &pi))
295 {
296 /* Kill off the previous preview process */
297 if (pData->PrevWindowPi.hProcess)
298 {
299 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
300 CloseHandle(pData->PrevWindowPi.hProcess);
301 CloseHandle(pData->PrevWindowPi.hThread);
302 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
303 }
304
305 if (WaitForSettingsDialog(hwndDlg, pi.hProcess))
307
308 CloseHandle(pi.hProcess);
309 CloseHandle(pi.hThread);
310 }
311}
312
313
314static VOID
316{
317 /*
318 /s Run normal
319 */
320
321 TCHAR szCmdline[2048];
322 STARTUPINFO si;
324
325 if (pData->Selection < 1)
326 return;
327
328 /* Kill off the previous preview process */
329 if (pData->PrevWindowPi.hProcess)
330 {
331 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
332 CloseHandle(pData->PrevWindowPi.hProcess);
333 CloseHandle(pData->PrevWindowPi.hThread);
334 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
335 }
336
337 _stprintf(szCmdline,
338 _T("%s /s"),
339 pData->ScreenSaverItems[pData->Selection].szFilename);
340
341 ZeroMemory(&si, sizeof(si));
342 si.cb = sizeof(si);
343 ZeroMemory(&pi, sizeof(pi));
345 szCmdline,
346 NULL,
347 NULL,
348 FALSE,
349 0,
350 NULL,
351 NULL,
352 &si,
353 &pi))
354 {
356 CloseHandle(pi.hProcess);
357 CloseHandle(pi.hThread);
358 }
359}
360
361
362static VOID
364{
365 HKEY hKey;
366 TCHAR szBuffer[2];
367 DWORD bufferSize = sizeof(szBuffer);
368 DWORD varType = REG_SZ;
369 LONG result;
370
372 _T("Control Panel\\Desktop"),
373 0,
375 &hKey) == ERROR_SUCCESS)
376 {
378 _T("ScreenSaverIsSecure"),
379 0,
380 &varType,
381 (LPBYTE)szBuffer,
382 &bufferSize);
384
385 if (result == ERROR_SUCCESS)
386 {
387 if (_ttoi(szBuffer) == 1)
388 {
389 SendDlgItemMessage(hwndDlg,
393 0);
394 return;
395 }
396 }
397
398 SendDlgItemMessage(hwndDlg,
402 0);
403 }
404}
405
406
407static VOID
408SearchScreenSavers(HWND hwndScreenSavers,
409 LPCTSTR pszSearchPath,
410 PDATA pData)
411{
413 TCHAR szSearchPath[MAX_PATH];
414 HANDLE hFind;
417 UINT i, ScreenSaverCount;
418 HRESULT hr;
419
420 ScreenSaverCount = pData->ScreenSaverCount;
421
422 hr = StringCbCopy(szSearchPath, sizeof(szSearchPath), pszSearchPath);
423 if (FAILED(hr))
424 return;
425 hr = StringCbCat(szSearchPath, sizeof(szSearchPath), TEXT("\\*.scr"));
426 if (FAILED(hr))
427 return;
428
429 hFind = FindFirstFile(szSearchPath, &fd);
430
431 if (hFind == INVALID_HANDLE_VALUE)
432 return;
433
434 while (ScreenSaverCount < MAX_SCREENSAVERS)
435 {
436 /* Don't add any hidden screensavers */
437 if ((fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0)
438 {
440
441 hr = StringCbCopy(filename, sizeof(filename), pszSearchPath);
442 if (FAILED(hr))
443 {
444 FindClose(hFind);
445 return;
446 }
447 hr = StringCbCat(filename, sizeof(filename), _T("\\"));
448 if (FAILED(hr))
449 {
450 FindClose(hFind);
451 return;
452 }
453 hr = StringCbCat(filename, sizeof(filename), fd.cFileName);
454 if (FAILED(hr))
455 {
456 FindClose(hFind);
457 return;
458 }
459
460 ScreenSaverItem = pData->ScreenSaverItems + ScreenSaverCount;
461
463
465 NULL,
467 if (hModule)
468 {
469 if (0 == LoadString(hModule,
470 1,
472 sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR)))
473 {
474 // If the string does not exists, copy the name of the file
476 if (FAILED(hr))
477 {
479 FindClose(hFind);
480 return;
481 }
482 ScreenSaverItem->szDisplayName[_tcslen(fd.cFileName)-4] = '\0';
483 }
485 }
486 else
487 {
489 if (FAILED(hr))
490 {
491 FindClose(hFind);
492 return;
493 }
494 }
495
497 if (FAILED(hr))
498 {
499 FindClose(hFind);
500 return;
501 }
502
503 i = SendMessage(hwndScreenSavers,
505 0,
507
508 SendMessage(hwndScreenSavers,
510 i,
511 (LPARAM)ScreenSaverCount);
512
513 ScreenSaverCount++;
514 }
515
516 if (!FindNextFile(hFind, &fd))
517 break;
518 }
519
520 FindClose(hFind);
521
522 pData->ScreenSaverCount = ScreenSaverCount;
523}
524
525
526static VOID
528{
529 HWND hwndScreenSavers = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
530 TCHAR szSearchPath[MAX_PATH];
531 TCHAR szLocalPath[MAX_PATH];
532 INT i;
534 LPTSTR lpBackSlash;
535
536 /* Add the "None" item */
537 ScreenSaverItem = pData->ScreenSaverItems;
538
540
542 IDS_NONE,
544 sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR));
545
546 i = SendMessage(hwndScreenSavers,
548 0,
550
551 SendMessage(hwndScreenSavers,
553 i,
554 (LPARAM)0);
555
556 // Initialize number of items into the list
557 pData->ScreenSaverCount = 1;
558
559 // Add all the screensavers where the applet is stored.
560 GetModuleFileName(hApplet, szLocalPath, MAX_PATH);
561 lpBackSlash = _tcsrchr(szLocalPath, _T('\\'));
562 if (lpBackSlash != NULL)
563 {
564 *lpBackSlash = '\0';
565 SearchScreenSavers(hwndScreenSavers, szLocalPath, pData);
566 }
567
568 // Add all the screensavers in the C:\ReactOS\System32 directory.
569 GetSystemDirectory(szSearchPath, MAX_PATH);
570 if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
571 SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
572
573 // Add all the screensavers in the C:\ReactOS directory.
574 GetWindowsDirectory(szSearchPath, MAX_PATH);
575 if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
576 SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
577}
578
579
580static VOID
582{
583 HKEY regKey;
584 BOOL DeleteMode = FALSE;
585
587
589 _T("Control Panel\\Desktop"),
590 0,
592 &regKey) == ERROR_SUCCESS)
593 {
594 INT Time;
595 BOOL bRet;
596 TCHAR Sec;
597 UINT Ret;
598
599 /* Set the screensaver */
600 if (pData->ScreenSaverItems[pData->Selection].bIsScreenSaver)
601 {
602 SIZE_T Length = _tcslen(pData->ScreenSaverItems[pData->Selection].szFilename) * sizeof(TCHAR);
603 RegSetValueEx(regKey,
604 _T("SCRNSAVE.EXE"),
605 0,
606 REG_SZ,
607 (PBYTE)pData->ScreenSaverItems[pData->Selection].szFilename,
608 (DWORD)Length);
609
611 }
612 else
613 {
614 /* Windows deletes the value if no screensaver is set */
615 RegDeleteValue(regKey, _T("SCRNSAVE.EXE"));
616 DeleteMode = TRUE;
617
619 }
620
621 /* Set the secure value */
622 Ret = SendDlgItemMessage(hwndDlg,
625 0,
626 0);
627 Sec = (Ret == BST_CHECKED) ? _T('1') : _T('0');
628 RegSetValueEx(regKey,
629 _T("ScreenSaverIsSecure"),
630 0,
631 REG_SZ,
632 (PBYTE)&Sec,
633 sizeof(TCHAR));
634
635 /* Set the screensaver time delay */
636 Time = GetDlgItemInt(hwndDlg,
638 &bRet,
639 FALSE);
640 if (Time == 0)
641 Time = 60;
642 else
643 Time *= 60;
644
646
647 RegCloseKey(regKey);
648 }
649}
650
651
652static BOOL
654{
655 LPTSTR lpCurSs;
656 HWND hwndSSCombo = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
657 INT Num;
658 WNDCLASS wc = {0};
659
662 sizeof(DATA));
663 if (!pData)
664 {
665 EndDialog(hwndDlg, -1);
666 return FALSE;
667 }
668
670 wc.hInstance = hApplet;
671 wc.hCursor = NULL;
674
675 if (RegisterClass(&wc))
676 {
677 HWND hParent = GetDlgItem(hwndDlg, IDC_SCREENS_PREVIEW);
678 HWND hChild;
679
680 if (hParent != NULL)
681 {
682 pData->OldPreviewProc = (WNDPROC)GetWindowLongPtr(hParent, GWLP_WNDPROC);
685 }
686
689 0, 0, 0, 0, hParent,
690 NULL, hApplet, NULL);
691 if (hChild != NULL)
692 {
693 RECT rc;
694 GetClientRect(hParent, &rc);
695 rc.left += MONITOR_LEFT;
696 rc.top += MONITOR_TOP;
698 }
699
700 pData->ScreenSaverPreviewParent = hChild;
701 }
702
703 SetWindowLongPtr(hwndDlg,
704 DWLP_USER,
705 (LONG_PTR)pData);
706
707 pData->Selection = -1;
708
709 SendDlgItemMessage(hwndDlg,
712 0,
714 ((short) 240, (short) 1));
715
716 AddScreenSavers(hwndDlg,
717 pData);
718
720
721 /* Set the current screensaver in the combo box */
722 lpCurSs = GetCurrentScreenSaverValue(_T("SCRNSAVE.EXE"));
723 if (lpCurSs)
724 {
725 BOOL bFound = FALSE;
726 INT i;
727
728 for (i = 0; i < MAX_SCREENSAVERS; i++)
729 {
730 if (!_tcscmp(lpCurSs, pData->ScreenSaverItems[i].szFilename))
731 {
732 bFound = TRUE;
733 break;
734 }
735 }
736
737 if (bFound)
738 {
739 Num = SendMessage(hwndSSCombo,
741 -1,
742 (LPARAM)pData->ScreenSaverItems[i].szDisplayName);
743 if (Num != CB_ERR)
744 SendMessage(hwndSSCombo,
746 Num,
747 0);
748 }
749 else
750 {
751 SendMessage(hwndSSCombo,
753 0,
754 0);
755 }
756
758 0,
759 lpCurSs);
760 }
761 else
762 {
763 /* Set screensaver to (none) */
764 SendMessage(hwndSSCombo,
766 0,
767 0);
768 }
769
770 /* Set the current timeout */
771 lpCurSs = GetCurrentScreenSaverValue(_T("ScreenSaveTimeOut"));
772 if (lpCurSs)
773 {
774 UINT Time = _ttoi(lpCurSs);
775
776 Time /= 60;
777
778 SendDlgItemMessage(hwndDlg,
781 0,
782 Time);
783
785 0,
786 lpCurSs);
787
788 }
789
790 SelectionChanged(hwndDlg,
791 pData);
792
793 return TRUE;
794}
795
796
799 UINT uMsg,
802{
803 PDATA pData;
804
806
807 switch (uMsg)
808 {
809 case WM_INITDIALOG:
810 {
811 OnInitDialog(hwndDlg, pData);
812 break;
813 }
814
815 case WM_DESTROY:
816 {
817 if (pData->ScreenSaverPreviewParent)
818 {
821 (LONG_PTR)pData->OldPreviewProc);
822 DestroyWindow(pData->ScreenSaverPreviewParent);
823 pData->ScreenSaverPreviewParent = NULL;
824 }
826 if (pData->PrevWindowPi.hProcess)
827 {
828 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
829 CloseHandle(pData->PrevWindowPi.hProcess);
830 CloseHandle(pData->PrevWindowPi.hThread);
831 }
833 0,
834 pData);
835 break;
836 }
837
838 case WM_ENDSESSION:
839 {
841 pData);
842 break;
843 }
844
845 case WM_DRAWITEM:
846 {
847 LPDRAWITEMSTRUCT lpDrawItem;
848 lpDrawItem = (LPDRAWITEMSTRUCT)lParam;
849
850 if (lpDrawItem->CtlID == IDC_SCREENS_PREVIEW)
851 ShowScreenSaverPreview(lpDrawItem, pData);
852 break;
853 }
854
855 case WM_COMMAND:
856 {
857 DWORD controlId = LOWORD(wParam);
859
860 switch (controlId)
861 {
862 case IDC_SCREENS_LIST:
863 {
865 {
866 SelectionChanged(hwndDlg, pData);
868 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
869 }
870 break;
871 }
872
874 {
875 if (command == EN_CHANGE)
876 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
877 break;
878 }
879
880 case IDC_SCREENS_POWER_BUTTON: // Start Powercfg.Cpl
881 {
882 if (command == BN_CLICKED)
883 WinExec("rundll32 shell32.dll,Control_RunDLL powercfg.cpl",SW_SHOWNORMAL);
884 break;
885 }
886
887 case IDC_SCREENS_TESTSC: // Screensaver Preview
888 {
889 if (command == BN_CLICKED)
890 {
891 ScreensaverPreview(hwndDlg, pData);
893 }
894 break;
895 }
896
897 case IDC_SCREENS_SETTINGS: // Screensaver Settings
898 {
899 if (command == BN_CLICKED)
900 ScreensaverConfig(hwndDlg, pData);
901 break;
902 }
903
904 case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure
905 {
906 if (command == BN_CLICKED)
907 {
908 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
909 }
910 break;
911 }
912 }
913 break;
914 }
915
916 case WM_NOTIFY:
917 {
918 LPNMHDR lpnm = (LPNMHDR)lParam;
919
920 switch(lpnm->code)
921 {
922 case PSN_APPLY:
923 {
924 SetScreenSaver(hwndDlg, pData);
925 return TRUE;
926 }
927
928 case PSN_SETACTIVE:
929 {
930 /* Enable screensaver preview support */
932 break;
933 }
934
935 case PSN_KILLACTIVE:
936 {
937 /* Kill running preview screensaver */
938 if (pData->PrevWindowPi.hProcess)
939 {
940 TerminateProcess(pData->PrevWindowPi.hProcess, 0);
941 CloseHandle(pData->PrevWindowPi.hProcess);
942 CloseHandle(pData->PrevWindowPi.hThread);
943 pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
944 }
945 break;
946 }
947 }
948 }
949 break;
950 }
951
952 return FALSE;
953}
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:47
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 VOID ScreensaverPreview(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:315
static LPTSTR GetCurrentScreenSaverValue(LPTSTR lpValue)
Definition: screensaver.c:37
static VOID ShowScreenSaverPreview(IN LPDRAWITEMSTRUCT draw, IN PDATA pData)
Definition: screensaver.c:139
static VOID SelectionChanged(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:86
static VOID SetScreenSaver(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:581
struct _DATA DATA
static VOID SetScreenSaverPreviewBox(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:177
struct _DATA * PDATA
static BOOL WaitForSettingsDialog(HWND hwndDlg, HANDLE hProcess)
Definition: screensaver.c:223
#define MAX_SCREENSAVERS
Definition: screensaver.c:13
static VOID SearchScreenSavers(HWND hwndScreenSavers, LPCTSTR pszSearchPath, PDATA pData)
Definition: screensaver.c:408
static BOOL OnInitDialog(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:653
static const TCHAR szPreviewWndClass[]
Definition: screensaver.c:15
static VOID AddScreenSavers(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:527
INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: screensaver.c:798
static VOID ScreensaverConfig(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:264
static VOID CheckRegScreenSaverIsSecure(HWND hwndDlg)
Definition: screensaver.c:363
LRESULT CALLBACK RedrawSubclassProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: screensaver.c:112
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:4773
#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 _tcscmp
Definition: tchar.h:1424
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
#define TEXT(s)
Definition: k32.h:26
#define REG_SZ
Definition: layer.c:22
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:71
#define _stprintf
Definition: utility.h:124
#define _tcsrchr
Definition: utility.h:116
static HDC
Definition: imagelist.c:92
static HTREEITEM hChild
Definition: treeview.c:381
static PLARGE_INTEGER Time
Definition: time.c:105
static refpint_t pi[]
Definition: server.c:96
__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
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:319
_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:2141
#define UDM_SETPOS32
Definition: commctrl.h:2155
#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 StringCbCat
Definition: strsafe.h:334
#define StringCbCopy
Definition: strsafe.h:155
TCHAR szFilename[MAX_PATH]
Definition: screensaver.c:20
TCHAR szDisplayName[256]
Definition: screensaver.c:21
WNDPROC OldPreviewProc
Definition: screensaver.c:30
int Selection
Definition: screensaver.c:29
ScreenSaverItem ScreenSaverItems[MAX_SCREENSAVERS]
Definition: screensaver.c:27
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:3160
HINSTANCE hInstance
Definition: winuser.h:3157
HCURSOR hCursor
Definition: winuser.h:3159
LPCSTR lpszClassName
Definition: winuser.h:3162
WNDPROC lpfnWndProc
Definition: winuser.h:3154
UINT code
Definition: winuser.h:3149
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)
#define _T(x)
Definition: vfdio.h:22
#define GetWindowsDirectory
Definition: winbase.h:3782
#define CreateProcess
Definition: winbase.h:3683
#define ZeroMemory
Definition: winbase.h:1700
#define GetSystemDirectory
Definition: winbase.h:3767
#define LoadLibraryEx
Definition: winbase.h:3788
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:342
#define FindNextFile
Definition: winbase.h:3713
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define FindFirstFile
Definition: winbase.h:3707
#define DONT_RESOLVE_DLL_REFERENCES
Definition: winbase.h:341
#define GetModuleFileName
Definition: winbase.h:3756
_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:1539
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:764
#define WM_PAINT
Definition: winuser.h:1610
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define CreateWindowEx
Definition: winuser.h:5745
#define CB_SETITEMDATA
Definition: winuser.h:1956
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define DWLP_USER
Definition: winuser.h:866
#define WM_QUIT
Definition: winuser.h:1613
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CallWindowProc
Definition: winuser.h:5725
#define IsDialogMessage
Definition: winuser.h:5799
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_COMMAND
Definition: winuser.h:1730
#define SPI_SETSCREENSAVEACTIVE
Definition: winuser.h:1356
#define CB_ERR
Definition: winuser.h:2425
#define CB_SETCURSEL
Definition: winuser.h:1951
#define UnregisterClass
Definition: winuser.h:5851
#define QS_ALLINPUT
Definition: winuser.h:897
#define RDW_ERASE
Definition: winuser.h:1201
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1930
#define WM_INITDIALOG
Definition: winuser.h:1729
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:1635
#define CBN_SELCHANGE
Definition: winuser.h:1969
#define BM_SETCHECK
Definition: winuser.h:1911
#define SPIF_SENDCHANGE
Definition: winuser.h:1562
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1561
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define PM_REMOVE
Definition: winuser.h:1186
#define CB_ADDSTRING
Definition: winuser.h:1926
struct tagNMHDR * LPNMHDR
#define CB_GETITEMDATA
Definition: winuser.h:1940
#define SendMessage
Definition: winuser.h:5833
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define PeekMessage
Definition: winuser.h:5820
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:5809
#define BN_CLICKED
Definition: winuser.h:1915
#define SW_SHOW
Definition: winuser.h:769
#define RegisterClass
Definition: winuser.h:5826
#define WM_DESTROY
Definition: winuser.h:1599
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
#define DispatchMessage
Definition: winuser.h:5755
#define WM_ENDSESSION
Definition: winuser.h:1617
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
#define SystemParametersInfo
Definition: winuser.h:5848
#define CB_GETCURSEL
Definition: winuser.h:1933
#define SendDlgItemMessage
Definition: winuser.h:5832
BOOL WINAPI IsWindowVisible(_In_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SPI_SETSCREENSAVETIMEOUT
Definition: winuser.h:1354
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define RDW_INVALIDATE
Definition: winuser.h:1204
#define BST_CHECKED
Definition: winuser.h:197
#define BM_GETCHECK
Definition: winuser.h:1908
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define EN_CHANGE
Definition: winuser.h:2012
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