ReactOS 0.4.16-dev-329-g9223134
powershemes.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Power Configuration Applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/powercfg/powershemes.c
5 * PURPOSE: powerschemes tab of applet
6 * PROGRAMMERS: Alexander Wurzinger (Lohnegrim at gmx dot net)
7 * Johannes Anderwald (johannes.anderwald@reactos.org)
8 * Martin Rottensteiner
9 * Dmitry Chapyshev (lentind@yandex.ru)
10 */
11
12#include "powercfg.h"
13#include <debug.h>
14
15typedef struct _POWER_SCHEME
16{
23
24
26{
31
32
34{
39
40
42{
43 60,
44 120,
45 180,
46 300,
47 600,
48 900,
49 1200,
50 1500,
51 1800,
52 2700,
53 3600,
54 7200,
55 10800,
56 14400,
57 18000,
58 0
59};
60
61
62static
66 UINT uId,
67 DWORD dwName,
68 LPTSTR pszName,
69 DWORD dwDescription,
70 LPWSTR pszDescription,
72{
73 PPOWER_SCHEME pScheme;
74 BOOL bResult = FALSE;
75
76 pScheme = HeapAlloc(GetProcessHeap(),
78 sizeof(POWER_SCHEME));
79 if (pScheme == NULL)
80 return NULL;
81
82 pScheme->uId = uId;
83 CopyMemory(&pScheme->PowerPolicy, pp, sizeof(POWER_POLICY));
84
85 if (dwName != 0)
86 {
87 pScheme->pszName = HeapAlloc(GetProcessHeap(),
89 dwName);
90 if (pScheme->pszName == NULL)
91 goto done;
92
93 _tcscpy(pScheme->pszName, pszName);
94 }
95
96 if (dwDescription != 0)
97 {
100 dwDescription);
101 if (pScheme->pszDescription == NULL)
102 goto done;
103
104 _tcscpy(pScheme->pszDescription, pszDescription);
105 }
106
107 InsertTailList(&pPageData->PowerSchemesList, &pScheme->ListEntry);
108 bResult = TRUE;
109
110done:
111 if (bResult == FALSE)
112 {
113 if (pScheme->pszName)
114 HeapFree(GetProcessHeap(), 0, pScheme->pszName);
115
116 if (pScheme->pszDescription)
117 HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
118
119 HeapFree(GetProcessHeap(), 0, pScheme);
120 pScheme = NULL;
121 }
122
123 return pScheme;
124}
125
126
127static
128VOID
130 PPOWER_SCHEME pScheme)
131{
132 RemoveEntryList(&pScheme->ListEntry);
133
134 if (pScheme->pszName)
135 HeapFree(GetProcessHeap(), 0, pScheme->pszName);
136
137 if (pScheme->pszDescription)
138 HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
139
140 HeapFree(GetProcessHeap(), 0, pScheme);
141}
142
143
144static
148 UINT uiIndex,
149 DWORD dwName,
150 LPTSTR pszName,
151 DWORD dwDesc,
152 LPWSTR pszDesc,
153 PPOWER_POLICY pp,
155{
156 if (ValidatePowerPolicies(0, pp))
157 {
159 uiIndex,
160 dwName,
161 pszName,
162 dwDesc,
163 pszDesc,
164 pp);
165 }
166
167 return TRUE;
168}
169
170static
171VOID
173 PPOWER_SCHEMES_PAGE_DATA pPageData)
174{
176
178}
179
180
181static
182VOID
184 PPOWER_SCHEMES_PAGE_DATA pPageData)
185{
186 PLIST_ENTRY ListEntry;
187 PPOWER_SCHEME pScheme;
188
189 for (;;)
190 {
191 ListEntry = pPageData->PowerSchemesList.Flink;
192 if (ListEntry == &pPageData->PowerSchemesList)
193 break;
194
195 pScheme = CONTAINING_RECORD(ListEntry, POWER_SCHEME, ListEntry);
196 DeletePowerScheme(pScheme);
197 }
198
199 pPageData->pActivePowerScheme = NULL;
200 pPageData->pSelectedPowerScheme = NULL;
201}
202
203
206 HWND hwndDlg)
207{
209
210 if (!GetPwrCapabilities(&spc))
211 {
212 return FALSE;
213 }
214
216 (spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
218 (spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
221 (spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
222
230
231 return TRUE;
232}
233
234
235static
236VOID
238 HWND hwndDlg,
239 PPOWER_SCHEMES_PAGE_DATA pPageData,
240 PPOWER_SCHEME pScheme)
241{
242 INT i = 0, iCurSel = 0;
243 TCHAR szTemp[MAX_PATH];
244 TCHAR szConfig[MAX_PATH];
245 PPOWER_POLICY pp;
246 HWND hwndCtrl;
247
248 iCurSel = (INT)SendDlgItemMessage(hwndDlg,
251 0,
252 0);
253 if (iCurSel == CB_ERR)
254 return;
255
257 (iCurSel > 0));
258
259 if (pScheme == NULL)
260 {
261 pScheme = (PPOWER_SCHEME)SendDlgItemMessage(hwndDlg,
264 (WPARAM)iCurSel,
265 0);
266 if (pScheme == (PPOWER_SCHEME)CB_ERR)
267 return;
268 }
269
270 pPageData->pSelectedPowerScheme = pScheme;
271
272 if (LoadString(hApplet, IDS_CONFIG1, szTemp, MAX_PATH))
273 {
274 _stprintf(szConfig, szTemp, pScheme->pszName);
275 SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL), szConfig);
276 }
277
278 pp = &pScheme->PowerPolicy;
279
280 for (i = 0; i < 16; i++)
281 {
282 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORACLIST);
283 if (hwndCtrl != NULL && Sec[i] == pp->user.VideoTimeoutAc)
284 {
285 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
286 }
287
288 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORDCLIST);
289 if (hwndCtrl != NULL && Sec[i] == pp->user.VideoTimeoutDc)
290 {
291 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
292 }
293
294 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKACLIST);
295 if (hwndCtrl != NULL && Sec[i] == pp->user.SpindownTimeoutAc)
296 {
297 SendMessage(hwndCtrl, CB_SETCURSEL, i - 2, 0);
298 }
299
300 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKDCLIST);
301 if (hwndCtrl != NULL && Sec[i] == pp->user.SpindownTimeoutDc)
302 {
303 SendMessage(hwndCtrl, CB_SETCURSEL, i - 2, 0);
304 }
305
306 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYACLIST);
307 if (hwndCtrl != NULL && Sec[i] == pp->user.IdleTimeoutAc)
308 {
309 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
310 }
311
312 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYDCLIST);
313 if (hwndCtrl != NULL && Sec[i] == pp->user.IdleTimeoutDc)
314 {
315 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
316 }
317
318 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST);
319 if (hwndCtrl != NULL && Sec[i] == pp->mach.DozeS4TimeoutAc)
320 {
321 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
322 }
323
324 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST);
325 if (hwndCtrl != NULL && Sec[i] == pp->mach.DozeS4TimeoutDc)
326 {
327 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
328 }
329 }
330}
331
332
333static VOID
335{
336 int ifrom = 0, i = 0, imin = 0;
337 HWND hwnd = NULL;
340
341 for (i = 1; i < 9; i++)
342 {
343 switch (i)
344 {
345 case 1:
348 break;
349
350 case 2:
353 break;
354
355 case 3:
356 hwnd = GetDlgItem(hwndDlg, IDC_DISKACLIST);
358 break;
359
360 case 4:
363 break;
364
365 case 5:
368 break;
369
370 case 6:
373 break;
374
375 case 7:
376 hwnd = GetDlgItem(hwndDlg, IDC_DISKDCLIST);
378 break;
379
380 case 8:
383 break;
384
385 default:
386 hwnd = NULL;
387 return;
388 }
389
390 if (hwnd == NULL)
391 continue;
392
393 for (ifrom = imin; ifrom < (IDS_TIMEOUT15 + 1); ifrom++)
394 {
395 if (LoadString(hApplet, ifrom, szName, MAX_PATH))
396 {
399 0,
400 (LPARAM)szName);
401 if (index == CB_ERR)
402 return;
403
406 index,
407 (LPARAM)Sec[ifrom - IDS_TIMEOUT16]);
408 }
409 }
410
412 {
415 0,
416 (LPARAM)szName);
417 if (index == CB_ERR)
418 return;
419
422 index,
423 (LPARAM)Sec[0]);
424 }
425 }
426}
427
428
429static VOID
431 HWND hwndDlg,
432 PPOWER_SCHEMES_PAGE_DATA pPageData)
433{
434 PPOWER_SCHEME pScheme;
435 HWND hwndCtrl;
436 INT tmp;
437
438 pScheme = pPageData->pSelectedPowerScheme;
439
440 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORACLIST);
441 if (hwndCtrl != NULL)
442 {
443 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
444 if (tmp > 0 && tmp < 16)
445 {
446 pScheme->PowerPolicy.user.VideoTimeoutAc = Sec[tmp];
447 }
448 }
449
450 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORDCLIST);
451 if (hwndCtrl != NULL)
452 {
453 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
454 if (tmp > 0 && tmp < 16)
455 {
456 pScheme->PowerPolicy.user.VideoTimeoutDc = Sec[tmp];
457 }
458 }
459
460 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKACLIST);
461 if (hwndCtrl != NULL)
462 {
463 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
464 if (tmp > 0 && tmp < 16)
465 {
466 pScheme->PowerPolicy.user.SpindownTimeoutAc = Sec[tmp + 2];
467 }
468 }
469
470 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKDCLIST);
471 if (hwndCtrl != NULL)
472 {
473 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
474 if (tmp > 0 && tmp < 16)
475 {
476 pScheme->PowerPolicy.user.SpindownTimeoutDc = Sec[tmp + 2];
477 }
478 }
479
480 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYACLIST);
481 if (hwndCtrl != NULL)
482 {
483 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
484 if (tmp > 0 && tmp < 16)
485 {
486 pScheme->PowerPolicy.user.IdleTimeoutAc = Sec[tmp];
487 }
488 }
489
490 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYDCLIST);
491 if (hwndCtrl != NULL)
492 {
493 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
494 if (tmp > 0 && tmp < 16)
495 {
496 pScheme->PowerPolicy.user.IdleTimeoutDc = Sec[tmp];
497 }
498 }
499
500 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST);
501 if (hwndCtrl != NULL)
502 {
503 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
504 if (tmp > 0 && tmp < 16)
505 {
506 pScheme->PowerPolicy.mach.DozeS4TimeoutAc = Sec[tmp];
507 }
508 }
509
510 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST);
511 if (hwndCtrl != NULL)
512 {
513 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
514 if (tmp > 0 && tmp < 16)
515 {
516 pScheme->PowerPolicy.mach.DozeS4TimeoutDc = Sec[tmp];
517 }
518 }
519
520 if (SetActivePwrScheme(pScheme->uId, NULL, &pScheme->PowerPolicy))
521 {
522 pPageData->pActivePowerScheme = pScheme;
523 }
524}
525
526
527static
528BOOL
530 HWND hwnd,
531 PPOWER_SCHEMES_PAGE_DATA pPageData)
532{
533 WCHAR szTitleBuffer[256];
534 WCHAR szRawBuffer[256], szCookedBuffer[512];
535 INT iCurSel;
536 HWND hList;
537 PPOWER_SCHEME pScheme;
538 WCHAR szErrorText[512];
539
541
542 iCurSel = SendMessage(hList, CB_GETCURSEL, 0, 0);
543 if (iCurSel == CB_ERR)
544 return FALSE;
545
546 SendMessage(hList, CB_SETCURSEL, iCurSel, 0);
547
548 pScheme = (PPOWER_SCHEME)SendMessage(hList, CB_GETITEMDATA, (WPARAM)iCurSel, 0);
549 if (pScheme == (PPOWER_SCHEME)CB_ERR)
550 return FALSE;
551
552 LoadStringW(hApplet, IDS_DEL_SCHEME_TITLE, szTitleBuffer, ARRAYSIZE(szTitleBuffer));
553 LoadStringW(hApplet, IDS_DEL_SCHEME, szRawBuffer, ARRAYSIZE(szRawBuffer));
554 StringCchPrintfW(szCookedBuffer, ARRAYSIZE(szCookedBuffer), szRawBuffer, pScheme->pszName);
555
556 if (MessageBoxW(hwnd, szCookedBuffer, szTitleBuffer, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES)
557 {
558 if (!DeletePwrScheme(pScheme->uId))
559 {
560 LoadStringW(hApplet, IDS_DEL_SCHEME_ERROR, szErrorText, sizeof(szErrorText) / sizeof(WCHAR));
561 MessageBoxW(NULL, szErrorText, NULL, MB_OK | MB_ICONERROR);
562 return FALSE;
563 }
564
565 iCurSel = SendMessage(hList, CB_FINDSTRING, -1, (LPARAM)pScheme->pszName);
566 if (iCurSel != CB_ERR)
567 SendMessage(hList, CB_DELETESTRING, iCurSel, 0);
568
569 DeletePowerScheme(pScheme);
570
571 iCurSel = SendMessage(hList, CB_FINDSTRING, -1, (LPARAM)pPageData->pActivePowerScheme->pszName);
572 if (iCurSel != CB_ERR)
573 {
574 SendMessage(hList, CB_SETCURSEL, iCurSel, 0);
575 }
576 else
577 {
579 }
580
581 LoadConfig(hwnd, pPageData, NULL);
582 return TRUE;
583 }
584
585 return FALSE;
586}
587
588
589static
590BOOL
592 HWND hwndDlg,
593 PSAVE_POWER_SCHEME_DATA pSaveSchemeData)
594{
595 PPOWER_SCHEMES_PAGE_DATA pPageData;
596 PPOWER_SCHEME pScheme;
597 TCHAR szSchemeName[512];
598 BOOL bRet = FALSE;
599
600 pPageData = pSaveSchemeData->pPageData;
601
602 GetDlgItemText(hwndDlg, IDC_SCHEMENAME, szSchemeName, ARRAYSIZE(szSchemeName));
603
604 pScheme = AddPowerScheme(pPageData,
605 -1,
606 (_tcslen(szSchemeName) + 1) * sizeof(TCHAR),
607 szSchemeName,
608 sizeof(TCHAR),
609 TEXT(""),
610 &pPageData->pSelectedPowerScheme->PowerPolicy);
611 if (pScheme != NULL)
612 {
613 if (WritePwrScheme(&pScheme->uId,
614 pScheme->pszName,
615 pScheme->pszDescription,
616 &pScheme->PowerPolicy))
617 {
618 pSaveSchemeData->pNewScheme = pScheme;
619 bRet = TRUE;
620 }
621 else
622 {
623 DeletePowerScheme(pScheme);
624 }
625 }
626
627 return bRet;
628}
629
630
634 HWND hwndDlg,
635 UINT uMsg,
638{
639 PSAVE_POWER_SCHEME_DATA pSaveSchemeData;
640
641 pSaveSchemeData = (PSAVE_POWER_SCHEME_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
642
643 switch (uMsg)
644 {
645 case WM_INITDIALOG:
646 pSaveSchemeData = (PSAVE_POWER_SCHEME_DATA)lParam;
647 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSaveSchemeData);
648
649 SetDlgItemText(hwndDlg,
651 pSaveSchemeData->pPageData->pSelectedPowerScheme->pszName);
652 return TRUE;
653
654 case WM_COMMAND:
655 switch(LOWORD(wParam))
656 {
657 case IDOK:
658 EndDialog(hwndDlg, SavePowerScheme(hwndDlg, pSaveSchemeData));
659 break;
660
661 case IDCANCEL:
662 EndDialog(hwndDlg, FALSE);
663 break;
664 }
665 break;
666 }
667
668 return FALSE;
669}
670
671
672static
673VOID
675 HWND hwndDlg,
676 PPOWER_SCHEMES_PAGE_DATA pPageData)
677{
678 SAVE_POWER_SCHEME_DATA SaveSchemeData;
679 POWER_POLICY BackupPowerPolicy;
680 HWND hwndList;
681 INT index;
682
683 SaveSchemeData.pPageData = pPageData;
684 SaveSchemeData.pNewScheme = NULL;
685 SaveSchemeData.hwndPage = hwndDlg;
686
687 CopyMemory(&BackupPowerPolicy,
689 sizeof(POWER_POLICY));
690
691 Pos_SaveData(hwndDlg, pPageData);
692
695 hwndDlg,
697 (LPARAM)&SaveSchemeData))
698 {
699 if (SaveSchemeData.pNewScheme)
700 {
701 hwndList = GetDlgItem(hwndDlg, IDC_ENERGYLIST);
702
703 index = (INT)SendDlgItemMessage(hwndDlg,
706 -1,
707 (LPARAM)SaveSchemeData.pNewScheme->pszName);
708
709 if (index == CB_ERR)
710 {
711 index = (INT)SendMessage(hwndList,
713 0,
714 (LPARAM)SaveSchemeData.pNewScheme->pszName);
715 if (index != CB_ERR)
716 {
717 SendMessage(hwndList,
719 index,
720 (LPARAM)SaveSchemeData.pNewScheme);
721
722 SendMessage(hwndList, CB_SETCURSEL, (WPARAM)index, 0);
724 }
725
726 }
727 LoadConfig(hwndDlg, pPageData, SaveSchemeData.pNewScheme);
728 }
729 }
730
732 &BackupPowerPolicy,
733 sizeof(POWER_POLICY));
734}
735
736
737static BOOL
739 HWND hwndDlg,
740 PPOWER_SCHEMES_PAGE_DATA pPageData)
741{
742 PLIST_ENTRY ListEntry;
743 PPOWER_SCHEME pScheme;
744 INT index;
745 POWER_POLICY pp;
747 HWND hwndList;
748 UINT aps = 0;
749
750 hwndList = GetDlgItem(hwndDlg, IDC_ENERGYLIST);
751
752 if (!GetActivePwrScheme(&aps))
753 return FALSE;
754
756 return FALSE;
757
758 if (!ReadPwrScheme(aps, &pp))
759 return FALSE;
760
761 if (!ValidatePowerPolicies(&gGPP, 0))
762 return FALSE;
763
764/*
765 if (!SetActivePwrScheme(aps, &gGPP, &pp))
766 return FALSE;
767*/
768
769 if (!GetPwrCapabilities(&spc))
770 return FALSE;
771
773 {
774 // TODO:
775 // Enable write / delete powerscheme button
776 }
777
778 Pos_InitPage(hwndDlg);
779
780 if (!GetActivePwrScheme(&aps))
781 return FALSE;
782
783 ListEntry = pPageData->PowerSchemesList.Flink;
784 while (ListEntry != &pPageData->PowerSchemesList)
785 {
786 pScheme = CONTAINING_RECORD(ListEntry, POWER_SCHEME, ListEntry);
787
788 index = (int)SendMessage(hwndList,
790 0,
791 (LPARAM)pScheme->pszName);
792 if (index == CB_ERR)
793 break;
794
795 SendMessage(hwndList,
797 index,
798 (LPARAM)pScheme);
799
800 if (aps == pScheme->uId)
801 {
802 SendMessage(hwndList,
804 TRUE,
805 (LPARAM)pScheme->pszName);
806
807 pPageData->pActivePowerScheme = pScheme;
808 LoadConfig(hwndDlg, pPageData, pScheme);
809 }
810
811 ListEntry = ListEntry->Flink;
812 }
813
814 if (SendMessage(hwndList, CB_GETCOUNT, 0, 0) > 0)
815 {
817 }
818
819 return TRUE;
820}
821
822
823/* Property page dialog callback */
826 HWND hwndDlg,
827 UINT uMsg,
830{
831 PPOWER_SCHEMES_PAGE_DATA pPageData;
832
834
835 switch (uMsg)
836 {
837 case WM_INITDIALOG:
841 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPageData);
842
843 BuildSchemesList(pPageData);
844
845 if (!Pos_InitData(hwndDlg))
846 {
847 // TODO:
848 // Initialization failed
849 // Handle error
850 MessageBox(hwndDlg,_T("Pos_InitData failed\n"), NULL, MB_OK);
851 }
852
853 if (!CreateEnergyList(hwndDlg, pPageData))
854 {
855 // TODO:
856 // Initialization failed
857 // Handle error
858 MessageBox(hwndDlg,_T("CreateEnergyList failed\n"), NULL, MB_OK);
859 }
860 return TRUE;
861
862 case WM_DESTROY:
863 if (pPageData)
864 {
865 DestroySchemesList(pPageData);
866 HeapFree(GetProcessHeap(), 0, pPageData);
868 }
869 break;
870
871 case WM_COMMAND:
872 switch(LOWORD(wParam))
873 {
874 case IDC_ENERGYLIST:
876 {
877 LoadConfig(hwndDlg, pPageData, NULL);
878 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
879 }
880 break;
881
882 case IDC_DELETE_BTN:
883 DelScheme(hwndDlg, pPageData);
884 break;
885
886 case IDC_SAVEAS_BTN:
887 SaveScheme(hwndDlg, pPageData);
888 break;
889
892 case IDC_DISKACLIST:
893 case IDC_DISKDCLIST:
899 {
900 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
901 }
902 break;
903 }
904 break;
905
906 case WM_NOTIFY:
907 switch (((LPNMHDR)lParam)->code)
908 {
909 case PSN_APPLY:
910 Pos_SaveData(hwndDlg, pPageData);
911 return TRUE;
912
913 case PSN_SETACTIVE:
914 Pos_InitData(hwndDlg);
915 return TRUE;
916 }
917 break;
918 }
919
920 return FALSE;
921}
unsigned char BOOLEAN
#define index(s, c)
Definition: various.h:29
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#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_SAVEAS_BTN
Definition: resource.h:66
#define IDC_DELETE_BTN
Definition: resource.h:67
#define IDC_STANDBY
Definition: resource.h:77
#define IDS_DEL_SCHEME
Definition: resource.h:48
#define IDS_DEL_SCHEME_TITLE
Definition: resource.h:49
#define IDS_CONFIG1
Definition: resource.h:11
#define IDC_HIBERNATE
Definition: resource.h:75
#define IDS_DEL_SCHEME_ERROR
Definition: resource.h:50
#define IDC_MONITORDCLIST
Definition: resource.h:69
#define IDC_STANDBYACLIST
Definition: resource.h:66
#define IDC_MONITORACLIST
Definition: resource.h:68
#define IDS_TIMEOUT16
Definition: resource.h:32
#define IDS_TIMEOUT1
Definition: resource.h:33
#define IDC_ENERGYLIST
Definition: resource.h:59
#define IDC_DISKDCLIST
Definition: resource.h:71
#define IDC_GRPDETAIL
Definition: resource.h:60
#define IDC_HIBERNATEACLIST
Definition: resource.h:73
#define IDC_DISKACLIST
Definition: resource.h:70
#define IDC_SCHEMENAME
Definition: resource.h:113
#define IDD_SAVEPOWERSCHEME
Definition: resource.h:20
#define IDS_TIMEOUT15
Definition: resource.h:47
#define IDC_STANDBYDCLIST
Definition: resource.h:67
#define IDC_HIBERNATEDCLIST
Definition: resource.h:74
#define IDS_TIMEOUT3
Definition: resource.h:35
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#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
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint index
Definition: glext.h:6031
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 _tcscpy
Definition: tchar.h:623
#define TEXT(s)
Definition: k32.h:26
HWND hList
Definition: livecd.c:10
#define _stprintf
Definition: utility.h:124
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define INT
Definition: polytest.cpp:20
GLOBAL_POWER_POLICY gGPP
Definition: powercfg.c:23
UINT Sec[]
Definition: powershemes.c:41
static VOID Pos_SaveData(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:430
struct _POWER_SCHEME POWER_SCHEME
static VOID DeletePowerScheme(PPOWER_SCHEME pScheme)
Definition: powershemes.c:129
struct _SAVE_POWER_SCHEME_DATA SAVE_POWER_SCHEME_DATA
static BOOL CreateEnergyList(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:738
struct _SAVE_POWER_SCHEME_DATA * PSAVE_POWER_SCHEME_DATA
BOOLEAN Pos_InitData(HWND hwndDlg)
Definition: powershemes.c:205
static VOID LoadConfig(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData, PPOWER_SCHEME pScheme)
Definition: powershemes.c:237
static BOOL DelScheme(HWND hwnd, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:529
INT_PTR CALLBACK PowerSchemesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: powershemes.c:825
static BOOL SavePowerScheme(HWND hwndDlg, PSAVE_POWER_SCHEME_DATA pSaveSchemeData)
Definition: powershemes.c:591
struct _POWER_SCHEMES_PAGE_DATA POWER_SCHEMES_PAGE_DATA
struct _POWER_SCHEME * PPOWER_SCHEME
struct _POWER_SCHEMES_PAGE_DATA * PPOWER_SCHEMES_PAGE_DATA
INT_PTR CALLBACK SaveSchemeDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: powershemes.c:633
static BOOLEAN CALLBACK EnumPowerSchemeCallback(UINT uiIndex, DWORD dwName, LPTSTR pszName, DWORD dwDesc, LPWSTR pszDesc, PPOWER_POLICY pp, LPARAM lParam)
Definition: powershemes.c:147
static PPOWER_SCHEME AddPowerScheme(PPOWER_SCHEMES_PAGE_DATA pPageData, UINT uId, DWORD dwName, LPTSTR pszName, DWORD dwDescription, LPWSTR pszDescription, PPOWER_POLICY pp)
Definition: powershemes.c:64
static VOID BuildSchemesList(PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:172
static VOID DestroySchemesList(PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:183
static VOID Pos_InitPage(HWND hwndDlg)
Definition: powershemes.c:334
static VOID SaveScheme(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:674
BOOLEAN WINAPI GetPwrCapabilities(PSYSTEM_POWER_CAPABILITIES lpSystemPowerCapabilities)
Definition: powrprof.c:358
BOOLEAN WINAPI ReadPwrScheme(UINT uiID, PPOWER_POLICY pPowerPolicy)
Definition: powrprof.c:610
BOOLEAN WINAPI GetActivePwrScheme(PUINT puiID)
Definition: powrprof.c:285
BOOLEAN WINAPI ValidatePowerPolicies(PGLOBAL_POWER_POLICY pGPP, PPOWER_POLICY pPP)
Definition: powrprof.c:1017
BOOLEAN WINAPI WritePwrScheme(PUINT puiID, LPWSTR lpszName, LPWSTR lpszDescription, PPOWER_POLICY pPowerPolicy)
Definition: powrprof.c:766
BOOLEAN WINAPI SetActivePwrScheme(UINT uiID, PGLOBAL_POWER_POLICY lpGlobalPowerPolicy, PPOWER_POLICY lpPowerPolicy)
Definition: powrprof.c:642
BOOLEAN WINAPI EnumPwrSchemes(PWRSCHEMESENUMPROC lpfnPwrSchemesEnumProc, LPARAM lParam)
Definition: powrprof.c:219
BOOLEAN WINAPI DeletePwrScheme(UINT uiIndex)
Definition: powrprof.c:99
BOOLEAN WINAPI CanUserWritePwrScheme(VOID)
Definition: powrprof.c:79
BOOLEAN WINAPI ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
Definition: powrprof.c:521
static const WCHAR szName[]
Definition: powrprof.c:45
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
#define PSN_SETACTIVE
Definition: prsht.h:115
#define WM_NOTIFY
Definition: richedit.h:61
static int imin(int a, int b)
Definition: format.c:174
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
BOOLEAN SystemBatteriesPresent
Definition: ntpoapi.h:374
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
MACHINE_POWER_POLICY mach
Definition: powrprof.h:92
USER_POWER_POLICY user
Definition: powrprof.h:91
PPOWER_SCHEME pActivePowerScheme
Definition: powershemes.c:28
LIST_ENTRY PowerSchemesList
Definition: powershemes.c:27
PPOWER_SCHEME pSelectedPowerScheme
Definition: powershemes.c:29
LIST_ENTRY ListEntry
Definition: powershemes.c:17
LPTSTR pszDescription
Definition: powershemes.c:20
LPTSTR pszName
Definition: powershemes.c:19
POWER_POLICY PowerPolicy
Definition: powershemes.c:21
PPOWER_SCHEME pNewScheme
Definition: powershemes.c:36
PPOWER_SCHEMES_PAGE_DATA pPageData
Definition: powershemes.c:35
ULONG VideoTimeoutDc
Definition: powrprof.h:80
ULONG SpindownTimeoutAc
Definition: powrprof.h:81
ULONG SpindownTimeoutDc
Definition: powrprof.h:82
ULONG IdleTimeoutAc
Definition: powrprof.h:70
ULONG IdleTimeoutDc
Definition: powrprof.h:71
ULONG VideoTimeoutAc
Definition: powrprof.h:79
Definition: inflate.c:139
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
int32_t INT
Definition: typedefs.h:58
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define HIWORD(l)
Definition: typedefs.h:247
#define _T(x)
Definition: vfdio.h:22
#define CopyMemory
Definition: winbase.h:1735
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define CB_SELECTSTRING
Definition: winuser.h:1963
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define SW_HIDE
Definition: winuser.h:771
#define DWLP_USER
Definition: winuser.h:875
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:834
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define GetDlgItemText
Definition: winuser.h:5797
#define WM_COMMAND
Definition: winuser.h:1743
#define CB_ERR
Definition: winuser.h:2438
#define CB_SETCURSEL
Definition: winuser.h:1964
#define DialogBoxParam
Definition: winuser.h:5776
#define WM_INITDIALOG
Definition: winuser.h:1742
#define MB_YESNO
Definition: winuser.h:820
#define CB_GETCOUNT
Definition: winuser.h:1945
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
#define CBN_SELCHANGE
Definition: winuser.h:1982
#define MB_ICONERROR
Definition: winuser.h:790
#define CB_ADDSTRING
Definition: winuser.h:1939
#define CB_GETITEMDATA
Definition: winuser.h:1953
#define SendMessage
Definition: winuser.h:5855
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MB_OK
Definition: winuser.h:793
HWND WINAPI GetParent(_In_ HWND)
#define LoadString
Definition: winuser.h:5831
#define MB_ICONQUESTION
Definition: winuser.h:792
#define MessageBox
Definition: winuser.h:5834
#define MB_DEFBUTTON2
Definition: winuser.h:802
#define SW_SHOW
Definition: winuser.h:778
#define WM_DESTROY
Definition: winuser.h:1612
#define CB_FINDSTRING
Definition: winuser.h:1942
#define SetWindowText
Definition: winuser.h:5869
#define IDYES
Definition: winuser.h:838
#define CB_GETCURSEL
Definition: winuser.h:1946
#define CB_DELETESTRING
Definition: winuser.h:1940
#define SendDlgItemMessage
Definition: winuser.h:5854
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define SetDlgItemText
Definition: winuser.h:5861
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
char TCHAR
Definition: xmlstorage.h:189
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
CHAR * LPTSTR
Definition: xmlstorage.h:192
#define _tcslen
Definition: xmlstorage.h:198