ReactOS 0.4.16-dev-1946-g52006dd
powershemes.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Power Configuration Applet
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Power Schemes tab
5 * COPYRIGHT: Copyright 2006 Alexander Wurzinger <lohnegrim@gmx.net>
6 * Copyright 2006 Johannes Anderwald <johannes.anderwald@reactos.org>
7 * Copyright 2006 Martin Rottensteiner <2005only@pianonote.at>
8 * Copyright 2007 Dmitry Chapyshev <lentind@yandex.ru>
9 * Copyright 2019 Eric Kohl <eric.kohl@reactos.org>
10 */
11
12#include "powercfg.h"
13
14typedef struct _POWER_SCHEME
15{
22
23
25{
30
31
33{
38
39
41{
42 60,
43 120,
44 180,
45 300,
46 600,
47 900,
48 1200,
49 1500,
50 1800,
51 2700,
52 3600,
53 7200,
54 10800,
55 14400,
56 18000,
57 0
58};
59
60
61static
65 UINT uId,
66 DWORD dwName,
67 LPTSTR pszName,
68 DWORD dwDescription,
69 LPWSTR pszDescription,
71{
72 PPOWER_SCHEME pScheme;
73 BOOL bResult = FALSE;
74
75 pScheme = HeapAlloc(GetProcessHeap(),
77 sizeof(POWER_SCHEME));
78 if (pScheme == NULL)
79 return NULL;
80
81 pScheme->uId = uId;
82 CopyMemory(&pScheme->PowerPolicy, pp, sizeof(POWER_POLICY));
83
84 if (dwName != 0)
85 {
86 pScheme->pszName = HeapAlloc(GetProcessHeap(),
88 dwName);
89 if (pScheme->pszName == NULL)
90 goto done;
91
92 _tcscpy(pScheme->pszName, pszName);
93 }
94
95 if (dwDescription != 0)
96 {
99 dwDescription);
100 if (pScheme->pszDescription == NULL)
101 goto done;
102
103 _tcscpy(pScheme->pszDescription, pszDescription);
104 }
105
106 InsertTailList(&pPageData->PowerSchemesList, &pScheme->ListEntry);
107 bResult = TRUE;
108
109done:
110 if (bResult == FALSE)
111 {
112 if (pScheme->pszName)
113 HeapFree(GetProcessHeap(), 0, pScheme->pszName);
114
115 if (pScheme->pszDescription)
116 HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
117
118 HeapFree(GetProcessHeap(), 0, pScheme);
119 pScheme = NULL;
120 }
121
122 return pScheme;
123}
124
125
126static
127VOID
129 PPOWER_SCHEME pScheme)
130{
131 RemoveEntryList(&pScheme->ListEntry);
132
133 if (pScheme->pszName)
134 HeapFree(GetProcessHeap(), 0, pScheme->pszName);
135
136 if (pScheme->pszDescription)
137 HeapFree(GetProcessHeap(), 0, pScheme->pszDescription);
138
139 HeapFree(GetProcessHeap(), 0, pScheme);
140}
141
142
143static
147 UINT uiIndex,
148 DWORD dwName,
149 LPTSTR pszName,
150 DWORD dwDesc,
151 LPWSTR pszDesc,
152 PPOWER_POLICY pp,
154{
155 if (ValidatePowerPolicies(0, pp))
156 {
158 uiIndex,
159 dwName,
160 pszName,
161 dwDesc,
162 pszDesc,
163 pp);
164 }
165
166 return TRUE;
167}
168
169static
170VOID
172 PPOWER_SCHEMES_PAGE_DATA pPageData)
173{
175
177}
178
179
180static
181VOID
183 PPOWER_SCHEMES_PAGE_DATA pPageData)
184{
185 PLIST_ENTRY ListEntry;
186 PPOWER_SCHEME pScheme;
187
188 for (;;)
189 {
190 ListEntry = pPageData->PowerSchemesList.Flink;
191 if (ListEntry == &pPageData->PowerSchemesList)
192 break;
193
194 pScheme = CONTAINING_RECORD(ListEntry, POWER_SCHEME, ListEntry);
195 DeletePowerScheme(pScheme);
196 }
197
198 pPageData->pActivePowerScheme = NULL;
199 pPageData->pSelectedPowerScheme = NULL;
200}
201
202
205 HWND hwndDlg)
206{
208
209 if (!GetPwrCapabilities(&spc))
210 return FALSE;
211
217 {
220 }
221
227 {
230 }
231
232 return TRUE;
233}
234
235
236static
237VOID
239 HWND hwndDlg,
240 PPOWER_SCHEMES_PAGE_DATA pPageData,
241 PPOWER_SCHEME pScheme)
242{
243 INT i = 0, iCurSel = 0;
244 TCHAR szTemp[MAX_PATH];
245 TCHAR szConfig[MAX_PATH];
246 PPOWER_POLICY pp;
247 HWND hwndCtrl;
248
249 iCurSel = (INT)SendDlgItemMessage(hwndDlg,
252 0,
253 0);
254 if (iCurSel == CB_ERR)
255 return;
256
258 (iCurSel > 0));
259
260 if (pScheme == NULL)
261 {
262 pScheme = (PPOWER_SCHEME)SendDlgItemMessage(hwndDlg,
265 (WPARAM)iCurSel,
266 0);
267 if (pScheme == (PPOWER_SCHEME)CB_ERR)
268 return;
269 }
270
271 pPageData->pSelectedPowerScheme = pScheme;
272
273 if (LoadString(hApplet, IDS_CONFIG1, szTemp, _countof(szTemp)))
274 {
275 _stprintf(szConfig, szTemp, pScheme->pszName);
276 SetWindowText(GetDlgItem(hwndDlg, IDC_GRPDETAIL), szConfig);
277 }
278
279 pp = &pScheme->PowerPolicy;
280
281 for (i = 0; i < 16; i++)
282 {
283 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORACLIST);
284 if (hwndCtrl != NULL && Sec[i] == pp->user.VideoTimeoutAc)
285 {
286 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
287 }
288
289 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORDCLIST);
290 if (hwndCtrl != NULL && Sec[i] == pp->user.VideoTimeoutDc)
291 {
292 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
293 }
294
295 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKACLIST);
296 if (hwndCtrl != NULL && Sec[i] == pp->user.SpindownTimeoutAc)
297 {
298 SendMessage(hwndCtrl, CB_SETCURSEL, i - 2, 0);
299 }
300
301 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKDCLIST);
302 if (hwndCtrl != NULL && Sec[i] == pp->user.SpindownTimeoutDc)
303 {
304 SendMessage(hwndCtrl, CB_SETCURSEL, i - 2, 0);
305 }
306
307 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYACLIST);
308 if (hwndCtrl != NULL && Sec[i] == pp->user.IdleTimeoutAc)
309 {
310 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
311 }
312
313 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYDCLIST);
314 if (hwndCtrl != NULL && Sec[i] == pp->user.IdleTimeoutDc)
315 {
316 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
317 }
318
319 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST);
320 if (hwndCtrl != NULL && Sec[i] == pp->mach.DozeS4TimeoutAc)
321 {
322 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
323 }
324
325 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST);
326 if (hwndCtrl != NULL && Sec[i] == pp->mach.DozeS4TimeoutDc)
327 {
328 SendMessage(hwndCtrl, CB_SETCURSEL, i, 0);
329 }
330 }
331}
332
333
334static VOID
336{
337 int ifrom = 0, i = 0, imin = 0;
338 HWND hwnd = NULL;
341
342 for (i = 1; i < 9; i++)
343 {
344 switch (i)
345 {
346 case 1:
349 break;
350
351 case 2:
354 break;
355
356 case 3:
357 hwnd = GetDlgItem(hwndDlg, IDC_DISKACLIST);
359 break;
360
361 case 4:
364 break;
365
366 case 5:
369 break;
370
371 case 6:
374 break;
375
376 case 7:
377 hwnd = GetDlgItem(hwndDlg, IDC_DISKDCLIST);
379 break;
380
381 case 8:
384 break;
385
386 default:
387 hwnd = NULL;
388 return;
389 }
390
391 if (hwnd == NULL)
392 continue;
393
394 for (ifrom = imin; ifrom < (IDS_TIMEOUT15 + 1); ifrom++)
395 {
396 if (LoadString(hApplet, ifrom, szName, _countof(szName)))
397 {
400 0,
401 (LPARAM)szName);
402 if (index == CB_ERR)
403 return;
404
407 index,
408 (LPARAM)Sec[ifrom - IDS_TIMEOUT16]);
409 }
410 }
411
413 {
416 0,
417 (LPARAM)szName);
418 if (index == CB_ERR)
419 return;
420
423 index,
424 (LPARAM)Sec[0]);
425 }
426 }
427}
428
429
430static VOID
432 HWND hwndDlg,
433 PPOWER_SCHEMES_PAGE_DATA pPageData)
434{
435 PPOWER_SCHEME pScheme;
436 HWND hwndCtrl;
437 INT tmp;
438
439 pScheme = pPageData->pSelectedPowerScheme;
440
441 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORACLIST);
442 if (hwndCtrl != NULL)
443 {
444 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
445 if (tmp > 0 && tmp < 16)
446 {
447 pScheme->PowerPolicy.user.VideoTimeoutAc = Sec[tmp];
448 }
449 }
450
451 hwndCtrl = GetDlgItem(hwndDlg, IDC_MONITORDCLIST);
452 if (hwndCtrl != NULL)
453 {
454 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
455 if (tmp > 0 && tmp < 16)
456 {
457 pScheme->PowerPolicy.user.VideoTimeoutDc = Sec[tmp];
458 }
459 }
460
461 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKACLIST);
462 if (hwndCtrl != NULL)
463 {
464 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
465 if (tmp > 0 && tmp < 16)
466 {
467 pScheme->PowerPolicy.user.SpindownTimeoutAc = Sec[tmp + 2];
468 }
469 }
470
471 hwndCtrl = GetDlgItem(hwndDlg, IDC_DISKDCLIST);
472 if (hwndCtrl != NULL)
473 {
474 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
475 if (tmp > 0 && tmp < 16)
476 {
477 pScheme->PowerPolicy.user.SpindownTimeoutDc = Sec[tmp + 2];
478 }
479 }
480
481 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYACLIST);
482 if (hwndCtrl != NULL)
483 {
484 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
485 if (tmp > 0 && tmp < 16)
486 {
487 pScheme->PowerPolicy.user.IdleTimeoutAc = Sec[tmp];
488 }
489 }
490
491 hwndCtrl = GetDlgItem(hwndDlg, IDC_STANDBYDCLIST);
492 if (hwndCtrl != NULL)
493 {
494 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
495 if (tmp > 0 && tmp < 16)
496 {
497 pScheme->PowerPolicy.user.IdleTimeoutDc = Sec[tmp];
498 }
499 }
500
501 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST);
502 if (hwndCtrl != NULL)
503 {
504 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
505 if (tmp > 0 && tmp < 16)
506 {
507 pScheme->PowerPolicy.mach.DozeS4TimeoutAc = Sec[tmp];
508 }
509 }
510
511 hwndCtrl = GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST);
512 if (hwndCtrl != NULL)
513 {
514 tmp = (INT)SendMessage(hwndCtrl, CB_GETCURSEL, 0, 0);
515 if (tmp > 0 && tmp < 16)
516 {
517 pScheme->PowerPolicy.mach.DozeS4TimeoutDc = Sec[tmp];
518 }
519 }
520
521 if (SetActivePwrScheme(pScheme->uId, NULL, &pScheme->PowerPolicy))
522 {
523 pPageData->pActivePowerScheme = pScheme;
524 }
525}
526
527
528static
529BOOL
531 HWND hwnd,
532 PPOWER_SCHEMES_PAGE_DATA pPageData)
533{
534 WCHAR szTitleBuffer[256];
535 WCHAR szRawBuffer[256], szCookedBuffer[512];
536 INT iCurSel;
537 HWND hList;
538 PPOWER_SCHEME pScheme;
539 WCHAR szErrorText[512];
540
542
543 iCurSel = SendMessage(hList, CB_GETCURSEL, 0, 0);
544 if (iCurSel == CB_ERR)
545 return FALSE;
546
547 SendMessage(hList, CB_SETCURSEL, iCurSel, 0);
548
549 pScheme = (PPOWER_SCHEME)SendMessage(hList, CB_GETITEMDATA, (WPARAM)iCurSel, 0);
550 if (pScheme == (PPOWER_SCHEME)CB_ERR)
551 return FALSE;
552
553 LoadStringW(hApplet, IDS_DEL_SCHEME_TITLE, szTitleBuffer, _countof(szTitleBuffer));
554 LoadStringW(hApplet, IDS_DEL_SCHEME, szRawBuffer, _countof(szRawBuffer));
555 StringCchPrintfW(szCookedBuffer, _countof(szCookedBuffer), szRawBuffer, pScheme->pszName);
556
557 if (MessageBoxW(hwnd, szCookedBuffer, szTitleBuffer, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES)
558 {
559 if (!DeletePwrScheme(pScheme->uId))
560 {
561 LoadStringW(hApplet, IDS_DEL_SCHEME_ERROR, szErrorText, sizeof(szErrorText) / sizeof(WCHAR));
562 MessageBoxW(NULL, szErrorText, NULL, MB_OK | MB_ICONERROR);
563 return FALSE;
564 }
565
566 iCurSel = SendMessage(hList, CB_FINDSTRING, -1, (LPARAM)pScheme->pszName);
567 if (iCurSel != CB_ERR)
568 SendMessage(hList, CB_DELETESTRING, iCurSel, 0);
569
570 DeletePowerScheme(pScheme);
571
572 iCurSel = SendMessage(hList, CB_FINDSTRING, -1, (LPARAM)pPageData->pActivePowerScheme->pszName);
573 if (iCurSel != CB_ERR)
574 {
575 SendMessage(hList, CB_SETCURSEL, iCurSel, 0);
576 }
577 else
578 {
580 }
581
582 LoadConfig(hwnd, pPageData, NULL);
583 return TRUE;
584 }
585
586 return FALSE;
587}
588
589
590static
591BOOL
593 HWND hwndDlg,
594 PSAVE_POWER_SCHEME_DATA pSaveSchemeData)
595{
596 PPOWER_SCHEMES_PAGE_DATA pPageData;
597 PPOWER_SCHEME pScheme;
598 TCHAR szSchemeName[512];
599 BOOL bRet = FALSE;
600
601 pPageData = pSaveSchemeData->pPageData;
602
603 GetDlgItemText(hwndDlg, IDC_SCHEMENAME, szSchemeName, _countof(szSchemeName));
604
605 pScheme = AddPowerScheme(pPageData,
606 -1,
607 (_tcslen(szSchemeName) + 1) * sizeof(TCHAR),
608 szSchemeName,
609 sizeof(TCHAR),
610 TEXT(""),
611 &pPageData->pSelectedPowerScheme->PowerPolicy);
612 if (pScheme != NULL)
613 {
614 if (WritePwrScheme(&pScheme->uId,
615 pScheme->pszName,
616 pScheme->pszDescription,
617 &pScheme->PowerPolicy))
618 {
619 pSaveSchemeData->pNewScheme = pScheme;
620 bRet = TRUE;
621 }
622 else
623 {
624 DeletePowerScheme(pScheme);
625 }
626 }
627
628 return bRet;
629}
630
631
635 HWND hwndDlg,
636 UINT uMsg,
639{
640 PSAVE_POWER_SCHEME_DATA pSaveSchemeData;
641
642 pSaveSchemeData = (PSAVE_POWER_SCHEME_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
643
644 switch (uMsg)
645 {
646 case WM_INITDIALOG:
647 pSaveSchemeData = (PSAVE_POWER_SCHEME_DATA)lParam;
648 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSaveSchemeData);
649
650 SetDlgItemText(hwndDlg,
652 pSaveSchemeData->pPageData->pSelectedPowerScheme->pszName);
653 return TRUE;
654
655 case WM_COMMAND:
656 switch(LOWORD(wParam))
657 {
658 case IDOK:
659 EndDialog(hwndDlg, SavePowerScheme(hwndDlg, pSaveSchemeData));
660 break;
661
662 case IDCANCEL:
663 EndDialog(hwndDlg, FALSE);
664 break;
665 }
666 break;
667 }
668
669 return FALSE;
670}
671
672
673static
674VOID
676 HWND hwndDlg,
677 PPOWER_SCHEMES_PAGE_DATA pPageData)
678{
679 SAVE_POWER_SCHEME_DATA SaveSchemeData;
680 POWER_POLICY BackupPowerPolicy;
681 HWND hwndList;
682 INT index;
683
684 SaveSchemeData.pPageData = pPageData;
685 SaveSchemeData.pNewScheme = NULL;
686 SaveSchemeData.hwndPage = hwndDlg;
687
688 CopyMemory(&BackupPowerPolicy,
690 sizeof(POWER_POLICY));
691
692 Pos_SaveData(hwndDlg, pPageData);
693
696 hwndDlg,
698 (LPARAM)&SaveSchemeData))
699 {
700 if (SaveSchemeData.pNewScheme)
701 {
702 hwndList = GetDlgItem(hwndDlg, IDC_ENERGYLIST);
703
704 index = (INT)SendDlgItemMessage(hwndDlg,
707 -1,
708 (LPARAM)SaveSchemeData.pNewScheme->pszName);
709
710 if (index == CB_ERR)
711 {
712 index = (INT)SendMessage(hwndList,
714 0,
715 (LPARAM)SaveSchemeData.pNewScheme->pszName);
716 if (index != CB_ERR)
717 {
718 SendMessage(hwndList,
720 index,
721 (LPARAM)SaveSchemeData.pNewScheme);
722
723 SendMessage(hwndList, CB_SETCURSEL, (WPARAM)index, 0);
725 }
726
727 }
728 LoadConfig(hwndDlg, pPageData, SaveSchemeData.pNewScheme);
729 }
730 }
731
733 &BackupPowerPolicy,
734 sizeof(POWER_POLICY));
735}
736
737
738static BOOL
740 HWND hwndDlg,
741 PPOWER_SCHEMES_PAGE_DATA pPageData)
742{
743 PLIST_ENTRY ListEntry;
744 PPOWER_SCHEME pScheme;
745 INT index;
746 POWER_POLICY pp;
748 HWND hwndList;
749 UINT aps = 0;
750
751 hwndList = GetDlgItem(hwndDlg, IDC_ENERGYLIST);
752
753 if (!GetActivePwrScheme(&aps))
754 return FALSE;
755
757 return FALSE;
758
759 if (!ReadPwrScheme(aps, &pp))
760 return FALSE;
761
762 if (!ValidatePowerPolicies(&gGPP, 0))
763 return FALSE;
764
765/*
766 if (!SetActivePwrScheme(aps, &gGPP, &pp))
767 return FALSE;
768*/
769
770 if (!GetPwrCapabilities(&spc))
771 return FALSE;
772
774 {
775 // TODO:
776 // Enable write / delete powerscheme button
777 }
778
779 Pos_InitPage(hwndDlg);
780
781 if (!GetActivePwrScheme(&aps))
782 return FALSE;
783
784 ListEntry = pPageData->PowerSchemesList.Flink;
785 while (ListEntry != &pPageData->PowerSchemesList)
786 {
787 pScheme = CONTAINING_RECORD(ListEntry, POWER_SCHEME, ListEntry);
788
789 index = (int)SendMessage(hwndList,
791 0,
792 (LPARAM)pScheme->pszName);
793 if (index == CB_ERR)
794 break;
795
796 SendMessage(hwndList,
798 index,
799 (LPARAM)pScheme);
800
801 if (aps == pScheme->uId)
802 {
803 SendMessage(hwndList,
805 TRUE,
806 (LPARAM)pScheme->pszName);
807
808 pPageData->pActivePowerScheme = pScheme;
809 LoadConfig(hwndDlg, pPageData, pScheme);
810 }
811
812 ListEntry = ListEntry->Flink;
813 }
814
815 if (SendMessage(hwndList, CB_GETCOUNT, 0, 0) > 0)
816 {
818 }
819
820 return TRUE;
821}
822
823
824/* Property page dialog callback */
827 HWND hwndDlg,
828 UINT uMsg,
831{
832 PPOWER_SCHEMES_PAGE_DATA pPageData;
833
835
836 switch (uMsg)
837 {
838 case WM_INITDIALOG:
842 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPageData);
843
844 BuildSchemesList(pPageData);
845
846 if (!Pos_InitData(hwndDlg))
847 {
848 // TODO:
849 // Initialization failed
850 // Handle error
851 MessageBox(hwndDlg,_T("Pos_InitData failed\n"), NULL, MB_OK);
852 }
853
854 if (!CreateEnergyList(hwndDlg, pPageData))
855 {
856 // TODO:
857 // Initialization failed
858 // Handle error
859 MessageBox(hwndDlg,_T("CreateEnergyList failed\n"), NULL, MB_OK);
860 }
861 return TRUE;
862
863 case WM_DESTROY:
864 if (pPageData)
865 {
866 DestroySchemesList(pPageData);
867 HeapFree(GetProcessHeap(), 0, pPageData);
869 }
870 break;
871
872 case WM_COMMAND:
873 switch(LOWORD(wParam))
874 {
875 case IDC_ENERGYLIST:
877 {
878 LoadConfig(hwndDlg, pPageData, NULL);
879 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
880 }
881 break;
882
883 case IDC_DELETE_BTN:
884 DelScheme(hwndDlg, pPageData);
885 break;
886
887 case IDC_SAVEAS_BTN:
888 SaveScheme(hwndDlg, pPageData);
889 break;
890
893 case IDC_DISKACLIST:
894 case IDC_DISKDCLIST:
900 {
901 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
902 }
903 break;
904 }
905 break;
906
907 case WM_NOTIFY:
908 switch (((LPNMHDR)lParam)->code)
909 {
910 case PSN_APPLY:
911 Pos_SaveData(hwndDlg, pPageData);
912 return TRUE;
913
914 case PSN_SETACTIVE:
915 Pos_InitData(hwndDlg);
916 return TRUE;
917 }
918 break;
919 }
920
921 return FALSE;
922}
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:120
#define IDS_DEL_SCHEME
Definition: resource.h:88
#define IDS_DEL_SCHEME_TITLE
Definition: resource.h:89
#define IDS_CONFIG1
Definition: resource.h:50
#define IDC_HIBERNATE
Definition: resource.h:118
#define IDS_DEL_SCHEME_ERROR
Definition: resource.h:90
#define IDC_MONITORDCLIST
Definition: resource.h:112
#define IDC_STANDBYACLIST
Definition: resource.h:109
#define IDC_MONITORACLIST
Definition: resource.h:111
#define IDS_TIMEOUT16
Definition: resource.h:72
#define IDS_TIMEOUT1
Definition: resource.h:73
#define IDC_ENERGYLIST
Definition: resource.h:102
#define IDC_DISKDCLIST
Definition: resource.h:114
#define IDC_GRPDETAIL
Definition: resource.h:103
#define IDC_HIBERNATEACLIST
Definition: resource.h:116
#define IDC_DISKACLIST
Definition: resource.h:113
#define IDC_SCHEMENAME
Definition: resource.h:156
#define IDD_SAVEPOWERSCHEME
Definition: resource.h:59
#define IDS_TIMEOUT15
Definition: resource.h:87
#define IDC_STANDBYDCLIST
Definition: resource.h:110
#define IDC_HIBERNATEDCLIST
Definition: resource.h:117
#define IDS_TIMEOUT3
Definition: resource.h:75
#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
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
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:28
HWND hList
Definition: livecd.c:10
#define CopyMemory
Definition: minwinbase.h:29
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define _stprintf
Definition: utility.h:124
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define IS_PWR_SUSPEND_ALLOWED(PowerCaps)
Definition: potypes.h:63
#define IS_PWR_HIBERNATE_ALLOWED(PowerCaps)
Definition: potypes.h:70
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define LOWORD(l)
Definition: pedump.c:82
#define INT
Definition: polytest.cpp:20
GLOBAL_POWER_POLICY gGPP
Definition: powercfg.c:16
UINT Sec[]
Definition: powershemes.c:40
static VOID Pos_SaveData(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:431
struct _POWER_SCHEME POWER_SCHEME
static VOID DeletePowerScheme(PPOWER_SCHEME pScheme)
Definition: powershemes.c:128
struct _SAVE_POWER_SCHEME_DATA SAVE_POWER_SCHEME_DATA
static BOOL CreateEnergyList(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:739
struct _SAVE_POWER_SCHEME_DATA * PSAVE_POWER_SCHEME_DATA
BOOLEAN Pos_InitData(HWND hwndDlg)
Definition: powershemes.c:204
static VOID LoadConfig(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData, PPOWER_SCHEME pScheme)
Definition: powershemes.c:238
static BOOL DelScheme(HWND hwnd, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:530
INT_PTR CALLBACK PowerSchemesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: powershemes.c:826
static BOOL SavePowerScheme(HWND hwndDlg, PSAVE_POWER_SCHEME_DATA pSaveSchemeData)
Definition: powershemes.c:592
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:634
static BOOLEAN CALLBACK EnumPowerSchemeCallback(UINT uiIndex, DWORD dwName, LPTSTR pszName, DWORD dwDesc, LPWSTR pszDesc, PPOWER_POLICY pp, LPARAM lParam)
Definition: powershemes.c:146
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:63
static VOID BuildSchemesList(PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:171
static VOID DestroySchemesList(PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:182
static VOID Pos_InitPage(HWND hwndDlg)
Definition: powershemes.c:335
static VOID SaveScheme(HWND hwndDlg, PPOWER_SCHEMES_PAGE_DATA pPageData)
Definition: powershemes.c:675
BOOLEAN WINAPI GetPwrCapabilities(PSYSTEM_POWER_CAPABILITIES lpSystemPowerCapabilities)
Definition: powrprof.c:582
BOOLEAN WINAPI ReadPwrScheme(UINT uiID, PPOWER_POLICY pPowerPolicy)
Definition: powrprof.c:946
BOOLEAN WINAPI GetActivePwrScheme(PUINT puiID)
Definition: powrprof.c:509
BOOLEAN WINAPI ValidatePowerPolicies(PGLOBAL_POWER_POLICY pGPP, PPOWER_POLICY pPP)
Definition: powrprof.c:1187
BOOLEAN WINAPI WritePwrScheme(PUINT puiID, LPWSTR lpszName, LPWSTR lpszDescription, PPOWER_POLICY pPowerPolicy)
Definition: powrprof.c:1102
BOOLEAN WINAPI SetActivePwrScheme(UINT uiID, PGLOBAL_POWER_POLICY lpGlobalPowerPolicy, PPOWER_POLICY lpPowerPolicy)
Definition: powrprof.c:978
BOOLEAN WINAPI EnumPwrSchemes(PWRSCHEMESENUMPROC lpfnPwrSchemesEnumProc, LPARAM lParam)
Definition: powrprof.c:443
BOOLEAN WINAPI DeletePwrScheme(UINT uiIndex)
Definition: powrprof.c:323
BOOLEAN WINAPI CanUserWritePwrScheme(VOID)
Definition: powrprof.c:303
BOOLEAN WINAPI ReadGlobalPwrPolicy(PGLOBAL_POWER_POLICY pGlobalPowerPolicy)
Definition: powrprof.c:857
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
#define _countof(array)
Definition: sndvol32.h:70
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:118
USER_POWER_POLICY user
Definition: powrprof.h:117
PPOWER_SCHEME pActivePowerScheme
Definition: powershemes.c:27
LIST_ENTRY PowerSchemesList
Definition: powershemes.c:26
PPOWER_SCHEME pSelectedPowerScheme
Definition: powershemes.c:28
LIST_ENTRY ListEntry
Definition: powershemes.c:16
LPTSTR pszDescription
Definition: powershemes.c:19
LPTSTR pszName
Definition: powershemes.c:18
POWER_POLICY PowerPolicy
Definition: powershemes.c:20
PPOWER_SCHEME pNewScheme
Definition: powershemes.c:35
PPOWER_SCHEMES_PAGE_DATA pPageData
Definition: powershemes.c:34
ULONG VideoTimeoutDc
Definition: powrprof.h:104
ULONG SpindownTimeoutAc
Definition: powrprof.h:105
ULONG SpindownTimeoutDc
Definition: powrprof.h:106
ULONG IdleTimeoutAc
Definition: powrprof.h:94
ULONG IdleTimeoutDc
Definition: powrprof.h:95
ULONG VideoTimeoutAc
Definition: powrprof.h:103
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
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define CB_SELECTSTRING
Definition: winuser.h:1989
#define CB_SETITEMDATA
Definition: winuser.h:1995
#define SW_HIDE
Definition: winuser.h:779
#define DWLP_USER
Definition: winuser.h:883
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDCANCEL
Definition: winuser.h:842
#define GetDlgItemText
Definition: winuser.h:5896
#define WM_COMMAND
Definition: winuser.h:1768
#define CB_ERR
Definition: winuser.h:2471
#define CB_SETCURSEL
Definition: winuser.h:1990
#define DialogBoxParam
Definition: winuser.h:5875
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_YESNO
Definition: winuser.h:828
#define CB_GETCOUNT
Definition: winuser.h:1971
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:841
#define CBN_SELCHANGE
Definition: winuser.h:2008
#define MB_ICONERROR
Definition: winuser.h:798
#define CB_ADDSTRING
Definition: winuser.h:1965
#define CB_GETITEMDATA
Definition: winuser.h:1979
#define SendMessage
Definition: winuser.h:5954
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MB_OK
Definition: winuser.h:801
HWND WINAPI GetParent(_In_ HWND)
#define LoadString
Definition: winuser.h:5930
#define MB_ICONQUESTION
Definition: winuser.h:800
#define MessageBox
Definition: winuser.h:5933
#define MB_DEFBUTTON2
Definition: winuser.h:810
#define SW_SHOW
Definition: winuser.h:786
#define WM_DESTROY
Definition: winuser.h:1637
#define CB_FINDSTRING
Definition: winuser.h:1968
#define SetWindowText
Definition: winuser.h:5968
#define IDYES
Definition: winuser.h:846
#define CB_GETCURSEL
Definition: winuser.h:1972
#define CB_DELETESTRING
Definition: winuser.h:1966
#define SendDlgItemMessage
Definition: winuser.h:5953
#define SetDlgItemText
Definition: winuser.h:5960
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