ReactOS  0.4.15-dev-5142-g967f5b9
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 
15 static const TCHAR szPreviewWndClass[] = TEXT("SSDemoParent");
16 
17 typedef struct
18 {
19  BOOL bIsScreenSaver; /* Is this background a wallpaper */
20  TCHAR szFilename[MAX_PATH];
21  TCHAR szDisplayName[256];
23 
24 
25 typedef struct _DATA
26 {
29  int Selection;
33 } DATA, *PDATA;
34 
35 
36 static LPTSTR
38 {
39  HKEY hKey;
40  LPTSTR lpBuf = NULL;
42  LONG Ret;
43 
45  _T("Control Panel\\Desktop"),
46  0,
47  KEY_READ,
48  &hKey);
49  if (Ret != ERROR_SUCCESS)
50  return NULL;
51 
52  Ret = RegQueryValueEx(hKey,
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  {
65  Ret = RegQueryValueEx(hKey,
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 
85 static VOID
87 {
88  HWND hwndCombo;
89  BOOL bEnable;
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,
114  WPARAM wParam,
115  LPARAM lParam)
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 
138 static VOID
140 {
141  HBRUSH hBrush;
142  HDC hDC;
143  HGDIOBJ hOldObj;
144  RECT rcItem = {
145  MONITOR_LEFT,
146  MONITOR_TOP,
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,
169  MONITOR_ALPHA);
170 
171  SelectObject(hDC, hOldObj);
172  DeleteDC(hDC);
173 }
174 
175 
176 static 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 
222 static BOOL
225 {
226  DWORD dwResult;
227  MSG msg;
228 
229  while (TRUE)
230  {
231  dwResult = MsgWaitForMultipleObjects(1,
232  &hProcess,
233  FALSE,
234  INFINITE,
235  QS_ALLINPUT);
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  else
251  {
252  return FALSE;
253  }
254  }
255  else if (dwResult == WAIT_OBJECT_0)
256  {
257  return TRUE;
258  }
259  else
260  {
261  return FALSE;
262  }
263  }
264 }
265 
266 
267 static VOID
269 {
270  /*
271  * /c:<hwnd> Run configuration, hwnd is handle of calling window
272  */
273 
274  TCHAR szCmdline[2048];
275  STARTUPINFO si;
277 
278  if (pData->Selection < 1)
279  return;
280 
281  _stprintf(szCmdline,
282  _T("%s /c:%Iu"),
283  pData->ScreenSaverItems[pData->Selection].szFilename,
284  (ULONG_PTR)hwndDlg);
285 
286  ZeroMemory(&si, sizeof(si));
287  si.cb = sizeof(si);
288  ZeroMemory(&pi, sizeof(pi));
289  if (CreateProcess(NULL,
290  szCmdline,
291  NULL,
292  NULL,
293  FALSE,
294  0,
295  NULL,
296  NULL,
297  &si,
298  &pi))
299  {
300  /* Kill off the previous preview process */
301  if (pData->PrevWindowPi.hProcess)
302  {
303  TerminateProcess(pData->PrevWindowPi.hProcess, 0);
304  CloseHandle(pData->PrevWindowPi.hProcess);
305  CloseHandle(pData->PrevWindowPi.hThread);
306  pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
307  }
308 
309  if (WaitForSettingsDialog(hwndDlg, pi.hProcess))
311  }
312 }
313 
314 
315 static VOID
317 {
318  /*
319  /s Run normal
320  */
321 
322  TCHAR szCmdline[2048];
323  STARTUPINFO si;
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  _stprintf(szCmdline,
339  _T("%s /s"),
340  pData->ScreenSaverItems[pData->Selection].szFilename);
341 
342  ZeroMemory(&si, sizeof(si));
343  si.cb = sizeof(si);
344  ZeroMemory(&pi, sizeof(pi));
345  if (CreateProcess(NULL,
346  szCmdline,
347  NULL,
348  NULL,
349  FALSE,
350  0,
351  NULL,
352  NULL,
353  &si,
354  &pi))
355  {
356  WaitForSingleObject(pi.hProcess, INFINITE);
357  CloseHandle(pi.hProcess);
358  CloseHandle(pi.hThread);
359  }
360 }
361 
362 
363 static VOID
365 {
366  HKEY hKey;
367  TCHAR szBuffer[2];
368  DWORD bufferSize = sizeof(szBuffer);
369  DWORD varType = REG_SZ;
370  LONG result;
371 
373  _T("Control Panel\\Desktop"),
374  0,
376  &hKey) == ERROR_SUCCESS)
377  {
379  _T("ScreenSaverIsSecure"),
380  0,
381  &varType,
382  (LPBYTE)szBuffer,
383  &bufferSize);
384  RegCloseKey(hKey);
385 
386  if (result == ERROR_SUCCESS)
387  {
388  if (_ttoi(szBuffer) == 1)
389  {
390  SendDlgItemMessage(hwndDlg,
392  BM_SETCHECK,
394  0);
395  return;
396  }
397  }
398 
399  SendDlgItemMessage(hwndDlg,
401  BM_SETCHECK,
403  0);
404  }
405 }
406 
407 
408 static VOID
409 SearchScreenSavers(HWND hwndScreenSavers,
410  LPCTSTR pszSearchPath,
411  PDATA pData)
412 {
414  TCHAR szSearchPath[MAX_PATH];
415  HANDLE hFind;
417  HANDLE hModule;
418  UINT i, ScreenSaverCount;
419  HRESULT hr;
420 
421  ScreenSaverCount = pData->ScreenSaverCount;
422 
423  hr = StringCbCopy(szSearchPath, sizeof(szSearchPath), pszSearchPath);
424  if (FAILED(hr))
425  return;
426  hr = StringCbCat(szSearchPath, sizeof(szSearchPath), TEXT("\\*.scr"));
427  if (FAILED(hr))
428  return;
429 
430  hFind = FindFirstFile(szSearchPath, &fd);
431 
432  if (hFind == INVALID_HANDLE_VALUE)
433  return;
434 
435  while (ScreenSaverCount < MAX_SCREENSAVERS)
436  {
437  /* Don't add any hidden screensavers */
438  if ((fd.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) == 0)
439  {
441 
442  hr = StringCbCopy(filename, sizeof(filename), pszSearchPath);
443  if (FAILED(hr))
444  {
445  FindClose(hFind);
446  return;
447  }
448  hr = StringCbCat(filename, sizeof(filename), _T("\\"));
449  if (FAILED(hr))
450  {
451  FindClose(hFind);
452  return;
453  }
454  hr = StringCbCat(filename, sizeof(filename), fd.cFileName);
455  if (FAILED(hr))
456  {
457  FindClose(hFind);
458  return;
459  }
460 
461  ScreenSaverItem = pData->ScreenSaverItems + ScreenSaverCount;
462 
464 
466  NULL,
468  if (hModule)
469  {
470  if (0 == LoadString(hModule,
471  1,
473  sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR)))
474  {
475  // If the string does not exists, copy the name of the file
477  if (FAILED(hr))
478  {
480  FindClose(hFind);
481  return;
482  }
483  ScreenSaverItem->szDisplayName[_tcslen(fd.cFileName)-4] = '\0';
484  }
486  }
487  else
488  {
490  if (FAILED(hr))
491  {
492  FindClose(hFind);
493  return;
494  }
495  }
496 
498  if (FAILED(hr))
499  {
500  FindClose(hFind);
501  return;
502  }
503 
504  i = SendMessage(hwndScreenSavers,
505  CB_ADDSTRING,
506  0,
508 
509  SendMessage(hwndScreenSavers,
511  i,
512  (LPARAM)ScreenSaverCount);
513 
514  ScreenSaverCount++;
515  }
516 
517  if (!FindNextFile(hFind, &fd))
518  break;
519  }
520 
521  FindClose(hFind);
522 
523  pData->ScreenSaverCount = ScreenSaverCount;
524 }
525 
526 
527 static VOID
529 {
530  HWND hwndScreenSavers = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
531  TCHAR szSearchPath[MAX_PATH];
532  TCHAR szLocalPath[MAX_PATH];
533  INT i;
535  LPTSTR lpBackSlash;
536 
537  /* Add the "None" item */
538  ScreenSaverItem = pData->ScreenSaverItems;
539 
541 
543  IDS_NONE,
545  sizeof(ScreenSaverItem->szDisplayName) / sizeof(TCHAR));
546 
547  i = SendMessage(hwndScreenSavers,
548  CB_ADDSTRING,
549  0,
551 
552  SendMessage(hwndScreenSavers,
554  i,
555  (LPARAM)0);
556 
557  // Initialize number of items into the list
558  pData->ScreenSaverCount = 1;
559 
560  // Add all the screensavers where the applet is stored.
561  GetModuleFileName(hApplet, szLocalPath, MAX_PATH);
562  lpBackSlash = _tcsrchr(szLocalPath, _T('\\'));
563  if (lpBackSlash != NULL)
564  {
565  *lpBackSlash = '\0';
566  SearchScreenSavers(hwndScreenSavers, szLocalPath, pData);
567  }
568 
569  // Add all the screensavers in the C:\ReactOS\System32 directory.
570  GetSystemDirectory(szSearchPath, MAX_PATH);
571  if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
572  SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
573 
574  // Add all the screensavers in the C:\ReactOS directory.
575  GetWindowsDirectory(szSearchPath, MAX_PATH);
576  if (lpBackSlash != NULL && _tcsicmp(szSearchPath, szLocalPath) != 0)
577  SearchScreenSavers(hwndScreenSavers, szSearchPath, pData);
578 }
579 
580 
581 static VOID
583 {
584  HKEY regKey;
585  BOOL DeleteMode = FALSE;
586 
588 
590  _T("Control Panel\\Desktop"),
591  0,
593  &regKey) == ERROR_SUCCESS)
594  {
595  INT Time;
596  BOOL bRet;
597  TCHAR Sec;
598  UINT Ret;
599 
600  /* Set the screensaver */
601  if (pData->ScreenSaverItems[pData->Selection].bIsScreenSaver)
602  {
603  SIZE_T Length = _tcslen(pData->ScreenSaverItems[pData->Selection].szFilename) * sizeof(TCHAR);
604  RegSetValueEx(regKey,
605  _T("SCRNSAVE.EXE"),
606  0,
607  REG_SZ,
608  (PBYTE)pData->ScreenSaverItems[pData->Selection].szFilename,
609  (DWORD)Length);
610 
612  }
613  else
614  {
615  /* Windows deletes the value if no screensaver is set */
616  RegDeleteValue(regKey, _T("SCRNSAVE.EXE"));
617  DeleteMode = TRUE;
618 
620  }
621 
622  /* Set the secure value */
623  Ret = SendDlgItemMessage(hwndDlg,
625  BM_GETCHECK,
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 = 60;
643  else
644  Time *= 60;
645 
647 
648  RegCloseKey(regKey);
649  }
650 }
651 
652 
653 static BOOL
655 {
656  LPTSTR lpCurSs;
657  HWND hwndSSCombo = GetDlgItem(hwndDlg, IDC_SCREENS_LIST);
658  INT Num;
659  WNDCLASS wc = {0};
660 
663  sizeof(DATA));
664  if (!pData)
665  {
666  EndDialog(hwndDlg, -1);
667  return FALSE;
668  }
669 
671  wc.hInstance = hApplet;
672  wc.hCursor = NULL;
675 
676  if (RegisterClass(&wc))
677  {
678  HWND hParent = GetDlgItem(hwndDlg, IDC_SCREENS_PREVIEW);
679  HWND hChild;
680 
681  if (hParent != NULL)
682  {
683  pData->OldPreviewProc = (WNDPROC)GetWindowLongPtr(hParent, GWLP_WNDPROC);
686  }
687 
690  0, 0, 0, 0, hParent,
691  NULL, hApplet, NULL);
692  if (hChild != NULL)
693  {
694  RECT rc;
695  GetClientRect(hParent, &rc);
696  rc.left += MONITOR_LEFT;
697  rc.top += MONITOR_TOP;
699  }
700 
701  pData->ScreenSaverPreviewParent = hChild;
702  }
703 
704  SetWindowLongPtr(hwndDlg,
705  DWLP_USER,
706  (LONG_PTR)pData);
707 
708  pData->Selection = -1;
709 
710  SendDlgItemMessage(hwndDlg,
712  UDM_SETRANGE,
713  0,
714  MAKELONG
715  ((short) 240, (short) 1));
716 
717  AddScreenSavers(hwndDlg,
718  pData);
719 
721 
722  /* Set the current screensaver in the combo box */
723  lpCurSs = GetCurrentScreenSaverValue(_T("SCRNSAVE.EXE"));
724  if (lpCurSs)
725  {
726  BOOL bFound = FALSE;
727  INT i;
728 
729  for (i = 0; i < MAX_SCREENSAVERS; i++)
730  {
731  if (!_tcscmp(lpCurSs, pData->ScreenSaverItems[i].szFilename))
732  {
733  bFound = TRUE;
734  break;
735  }
736  }
737 
738  if (bFound)
739  {
740  Num = SendMessage(hwndSSCombo,
742  -1,
743  (LPARAM)pData->ScreenSaverItems[i].szDisplayName);
744  if (Num != CB_ERR)
745  SendMessage(hwndSSCombo,
746  CB_SETCURSEL,
747  Num,
748  0);
749  }
750  else
751  {
752  SendMessage(hwndSSCombo,
753  CB_SETCURSEL,
754  0,
755  0);
756  }
757 
759  0,
760  lpCurSs);
761  }
762  else
763  {
764  /* Set screensaver to (none) */
765  SendMessage(hwndSSCombo,
766  CB_SETCURSEL,
767  0,
768  0);
769  }
770 
771  /* Set the current timeout */
772  lpCurSs = GetCurrentScreenSaverValue(_T("ScreenSaveTimeOut"));
773  if (lpCurSs)
774  {
775  UINT Time = _ttoi(lpCurSs);
776 
777  Time /= 60;
778 
779  SendDlgItemMessage(hwndDlg,
781  UDM_SETPOS32,
782  0,
783  Time);
784 
786  0,
787  lpCurSs);
788 
789  }
790 
791  SelectionChanged(hwndDlg,
792  pData);
793 
794  return TRUE;
795 }
796 
797 
800  UINT uMsg,
801  WPARAM wParam,
802  LPARAM lParam)
803 {
804  PDATA pData;
805 
806  pData = (PDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
807 
808  switch (uMsg)
809  {
810  case WM_INITDIALOG:
811  {
812  OnInitDialog(hwndDlg, pData);
813  break;
814  }
815 
816  case WM_DESTROY:
817  {
818  if (pData->ScreenSaverPreviewParent)
819  {
821  GWLP_WNDPROC,
822  (LONG_PTR)pData->OldPreviewProc);
823  DestroyWindow(pData->ScreenSaverPreviewParent);
824  pData->ScreenSaverPreviewParent = NULL;
825  }
827  if (pData->PrevWindowPi.hProcess)
828  {
829  TerminateProcess(pData->PrevWindowPi.hProcess, 0);
830  CloseHandle(pData->PrevWindowPi.hProcess);
831  CloseHandle(pData->PrevWindowPi.hThread);
832  }
834  0,
835  pData);
836  break;
837  }
838 
839  case WM_ENDSESSION:
840  {
841  SetScreenSaverPreviewBox(hwndDlg,
842  pData);
843  break;
844  }
845 
846  case WM_DRAWITEM:
847  {
848  LPDRAWITEMSTRUCT lpDrawItem;
849  lpDrawItem = (LPDRAWITEMSTRUCT)lParam;
850 
851  if (lpDrawItem->CtlID == IDC_SCREENS_PREVIEW)
852  ShowScreenSaverPreview(lpDrawItem, pData);
853  break;
854  }
855 
856  case WM_COMMAND:
857  {
858  DWORD controlId = LOWORD(wParam);
860 
861  switch (controlId)
862  {
863  case IDC_SCREENS_LIST:
864  {
865  if (HIWORD(wParam) == CBN_SELCHANGE)
866  {
867  SelectionChanged(hwndDlg, pData);
869  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
870  }
871  break;
872  }
873 
875  {
876  if (command == EN_CHANGE)
877  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
878  break;
879  }
880 
881  case IDC_SCREENS_POWER_BUTTON: // Start Powercfg.Cpl
882  {
883  if (command == BN_CLICKED)
884  WinExec("rundll32 shell32.dll,Control_RunDLL powercfg.cpl",SW_SHOWNORMAL);
885  break;
886  }
887 
888  case IDC_SCREENS_TESTSC: // Screensaver Preview
889  {
890  if (command == BN_CLICKED)
891  {
892  ScreensaverPreview(hwndDlg, pData);
894  }
895  break;
896  }
897 
898  case IDC_SCREENS_SETTINGS: // Screensaver Settings
899  {
900  if (command == BN_CLICKED)
901  ScreensaverConfig(hwndDlg, pData);
902  break;
903  }
904 
905  case IDC_SCREENS_USEPASSCHK: // Screensaver Is Secure
906  {
907  if (command == BN_CLICKED)
908  {
909  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
910  }
911  break;
912  }
913  }
914  break;
915  }
916 
917  case WM_NOTIFY:
918  {
919  LPNMHDR lpnm = (LPNMHDR)lParam;
920 
921  switch(lpnm->code)
922  {
923  case PSN_APPLY:
924  {
925  SetScreenSaver(hwndDlg, pData);
926  return TRUE;
927  }
928 
929  case PSN_SETACTIVE:
930  {
931  /* Enable screensaver preview support */
933  break;
934  }
935 
936  case PSN_KILLACTIVE:
937  {
938  /* Kill running preview screensaver */
939  if (pData->PrevWindowPi.hProcess)
940  {
941  TerminateProcess(pData->PrevWindowPi.hProcess, 0);
942  CloseHandle(pData->PrevWindowPi.hProcess);
943  CloseHandle(pData->PrevWindowPi.hThread);
944  pData->PrevWindowPi.hThread = pData->PrevWindowPi.hProcess = NULL;
945  }
946  break;
947  }
948  }
949  }
950  break;
951  }
952 
953  return FALSE;
954 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define RegQueryValueEx
Definition: winreg.h:524
#define CallWindowProc
Definition: winuser.h:5725
#define MONITOR_BOTTOM
Definition: desk.h:74
#define CB_SETITEMDATA
Definition: winuser.h:1956
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define IN
Definition: typedefs.h:39
#define DispatchMessage
Definition: winuser.h:5755
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define PeekMessage
Definition: winuser.h:5820
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define CloseHandle
Definition: compat.h:598
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define IDC_SCREENS_SETTINGS
Definition: resource.h:40
#define IDC_SCREENS_POWER_BUTTON
Definition: resource.h:39
static VOID SearchScreenSavers(HWND hwndScreenSavers, LPCTSTR pszSearchPath, PDATA pData)
Definition: screensaver.c:409
HWND ScreenSaverPreviewParent
Definition: screensaver.c:32
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_SCREENS_LIST
Definition: resource.h:38
#define IDC_SCREENS_TIMEDELAY
Definition: resource.h:43
HRESULT hr
Definition: shlfolder.c:183
GLuint64EXT * result
Definition: glext.h:11304
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define _tcsicmp
Definition: xmlstorage.h:205
#define KEY_READ
Definition: nt_native.h:1023
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
static HTREEITEM hChild
Definition: treeview.c:381
#define TRUE
Definition: types.h:120
#define SW_HIDE
Definition: winuser.h:762
#define CB_GETITEMDATA
Definition: winuser.h:1940
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define IDC_SCREENS_USEPASSCHK
Definition: resource.h:42
COLORREF desktop_color
Definition: desk.h:121
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define IDS_NONE
Definition: resource.h:133
#define INT
Definition: polytest.cpp:20
static HDC
Definition: imagelist.c:92
#define CALLBACK
Definition: compat.h:35
#define WM_QUIT
Definition: winuser.h:1613
#define SystemParametersInfo
Definition: winuser.h:5848
LONG top
Definition: windef.h:307
static BOOL OnInitDialog(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:654
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
int Selection
Definition: screensaver.c:29
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static int fd
Definition: io.c:51
HINSTANCE hApplet
Definition: access.c:17
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
LRESULT CALLBACK RedrawSubclassProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: screensaver.c:112
LONG bmMonHeight
Definition: desk.h:126
UINT_PTR WPARAM
Definition: windef.h:207
struct _DATA DATA
HBRUSH hbrBackground
Definition: winuser.h:3160
#define WS_CHILD
Definition: pedump.c:617
#define SendDlgItemMessage
Definition: winuser.h:5832
UINT WINAPI DECLSPEC_HOTPATCH WinExec(LPCSTR lpCmdLine, UINT uCmdShow)
Definition: proc.c:4775
static VOID SetScreenSaver(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:582
#define PSN_APPLY
Definition: prsht.h:117
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
#define IsDialogMessage
Definition: winuser.h:5799
#define WS_CLIPCHILDREN
Definition: pedump.c:619
const char * filename
Definition: ioapi.h:135
BOOL WINAPI DestroyWindow(_In_ HWND)
#define PSN_SETACTIVE
Definition: prsht.h:115
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
#define CB_GETCURSEL
Definition: winuser.h:1933
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
CHAR * LPTSTR
Definition: xmlstorage.h:192
struct tagNMHDR * LPNMHDR
static VOID SetScreenSaverPreviewBox(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:177
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IDC_SCREENS_TIME
Definition: resource.h:44
UINT code
Definition: winuser.h:3149
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
unsigned char * LPBYTE
Definition: typedefs.h:53
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define FALSE
Definition: types.h:117
TCHAR szFilename[MAX_PATH]
Definition: screensaver.c:20
PROCESS_INFORMATION PrevWindowPi
Definition: screensaver.c:28
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static VOID CheckRegScreenSaverIsSecure(HWND hwndDlg)
Definition: screensaver.c:364
HCURSOR hCursor
Definition: winuser.h:3159
#define CreateWindowEx
Definition: winuser.h:5745
#define GWLP_USERDATA
Definition: treelist.c:63
#define CB_ADDSTRING
Definition: winuser.h:1926
#define MAKELONG(a, b)
Definition: typedefs.h:249
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
HBITMAP hMonitorBitmap
Definition: desk.h:124
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_GETCHECK
Definition: winuser.h:1908
#define UDM_SETRANGE
Definition: commctrl.h:2141
#define BufSize
Definition: FsRtlTunnel.c:28
#define FindFirstFile
Definition: winbase.h:3643
#define SW_SHOW
Definition: winuser.h:769
ScreenSaverItem ScreenSaverItems[MAX_SCREENSAVERS]
Definition: screensaver.c:27
static const TCHAR szPreviewWndClass[]
Definition: screensaver.c:15
#define IDC_SCREENS_PREVIEW
Definition: resource.h:37
struct _DATA * PDATA
#define IDC_WAITTEXT
Definition: resource.h:45
#define CB_ERR
Definition: winuser.h:2425
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1599
#define BLACK_BRUSH
Definition: wingdi.h:896
#define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
Definition: ntbasedef.h:319
char TCHAR
Definition: xmlstorage.h:189
#define RegDeleteValue
Definition: winreg.h:508
#define BM_SETCHECK
Definition: winuser.h:1911
#define _T(x)
Definition: vfdio.h:22
#define FreeLibrary(x)
Definition: compat.h:607
#define StringCbCat
Definition: strsafe.h:334
#define WAIT_OBJECT_0
Definition: winbase.h:403
DWORD cb
Definition: winbase.h:828
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
LONG HRESULT
Definition: typedefs.h:79
static refpint_t pi[]
Definition: server.c:96
#define FindNextFile
Definition: winbase.h:3649
#define RDW_ERASE
Definition: winuser.h:1201
#define MAX_PATH
Definition: compat.h:34
#define UDM_SETPOS32
Definition: commctrl.h:2155
#define MONITOR_ALPHA
Definition: desk.h:79
Type
Definition: Type.h:6
#define BN_CLICKED
Definition: winuser.h:1915
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG bmMonWidth
Definition: desk.h:125
#define GetModuleFileName
Definition: winbase.h:3692
static VOID ScreensaverPreview(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:316
#define WM_ENDSESSION
Definition: winuser.h:1617
#define WM_PAINT
Definition: winuser.h:1610
static VOID ScreensaverConfig(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:268
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
static VOID AddScreenSavers(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:528
#define DONT_RESOLVE_DLL_REFERENCES
Definition: winbase.h:338
#define SPI_SETSCREENSAVEACTIVE
Definition: winuser.h:1356
UINT ScreenSaverCount
Definition: screensaver.c:31
#define StringCbCopy
Definition: strsafe.h:155
size_t bufferSize
#define DWLP_USER
Definition: winuser.h:866
#define IDC_SCREENS_TESTSC
Definition: resource.h:41
#define MONITOR_TOP
Definition: desk.h:72
#define CB_SETCURSEL
Definition: winuser.h:1951
static VOID ShowScreenSaverPreview(IN LPDRAWITEMSTRUCT draw, IN PDATA pData)
Definition: screensaver.c:139
static VOID SelectionChanged(HWND hwndDlg, PDATA pData)
Definition: screensaver.c:86
#define WM_COMMAND
Definition: winuser.h:1730
LPCSTR lpszClassName
Definition: winuser.h:3162
#define CreateProcess
Definition: winbase.h:3619
#define BST_UNCHECKED
Definition: winuser.h:199
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define GetSystemDirectory
Definition: winbase.h:3703
#define GWLP_WNDPROC
Definition: treelist.c:66
UINT Sec[]
Definition: powershemes.c:41
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:339
#define MONITOR_WIDTH
Definition: desk.h:76
#define _stprintf
Definition: utility.h:124
static HDC hDC
Definition: 3dtext.c:33
ULONG_PTR SIZE_T
Definition: typedefs.h:80
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI GetParent(_In_ HWND)
#define SPIF_UPDATEINIFILE
Definition: winuser.h:1561
#define RegOpenKeyEx
Definition: winreg.h:520
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define TEXT(s)
Definition: k32.h:26
_In_ BOOL bEnable
Definition: winddi.h:3426
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
BOOL WINAPI DeleteDC(_In_ HDC)
HINSTANCE hInstance
Definition: winuser.h:3157
FxAutoRegKey hKey
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
#define MONITOR_HEIGHT
Definition: desk.h:77
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
#define QS_ALLINPUT
Definition: winuser.h:897
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define SPIF_SENDCHANGE
Definition: winuser.h:1562
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define CBN_SELCHANGE
Definition: winuser.h:1969
#define BST_CHECKED
Definition: winuser.h:197
WNDPROC lpfnWndProc
Definition: winuser.h:3154
#define WM_DRAWITEM
Definition: winuser.h:1635
#define msg(x)
Definition: auth_time.c:54
#define LoadLibraryEx
Definition: winbase.h:3724
#define IDC_MINTEXT
Definition: resource.h:46
#define SendMessage
Definition: winuser.h:5833
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
GLOBAL_DATA g_GlobalData
Definition: background.c:68
#define MAX_SCREENSAVERS
Definition: screensaver.c:13
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define RegisterClass
Definition: winuser.h:5826
#define PM_REMOVE
Definition: winuser.h:1186
#define MONITOR_LEFT
Definition: desk.h:71
#define GetWindowLongPtr
Definition: treelist.c:73
#define MONITOR_RIGHT
Definition: desk.h:73
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
WNDPROC OldPreviewProc
Definition: screensaver.c:30
LONG_PTR LRESULT
Definition: windef.h:209
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
TCHAR szDisplayName[256]
Definition: screensaver.c:21
#define INFINITE
Definition: serial.h:102
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define UnregisterClass
Definition: winuser.h:5851
#define GetWindowsDirectory
Definition: winbase.h:3718
static LPTSTR GetCurrentScreenSaverValue(LPTSTR lpValue)
Definition: screensaver.c:37
BYTE * PBYTE
Definition: pedump.c:66
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
#define RegSetValueEx
Definition: winreg.h:533
#define LoadString
Definition: winuser.h:5809
static BOOL WaitForSettingsDialog(HWND hwndDlg, HANDLE hProcess)
Definition: screensaver.c:223
static PLARGE_INTEGER Time
Definition: time.c:105
INT_PTR CALLBACK ScreenSaverPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: screensaver.c:799
#define SPI_SETSCREENSAVETIMEOUT
Definition: winuser.h:1354
#define WM_NOTIFY
Definition: richedit.h:61
#define RDW_INVALIDATE
Definition: winuser.h:1204
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)
HMODULE hModule
Definition: animate.c:44
#define REG_SZ
Definition: layer.c:22
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
#define EN_CHANGE
Definition: winuser.h:2012
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1930