Skip to content

Commit 0f10593

Browse files
committed
[POWERCFG] Use the IS_PWR_* macros (reactos#8386)
1 parent 103c818 commit 0f10593

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

dll/cpl/powercfg/advanced.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ GetPowerActionFromPolicy(
135135
else
136136
{
137137
poAction = Policy->Action;
138-
if ((poAction == PowerActionHibernate) && !(spc->SystemS4 && spc->HiberFilePresent))
138+
if ((poAction == PowerActionHibernate) && !IS_PWR_HIBERNATE_ALLOWED(spc))
139139
poAction = PowerActionSleep;
140-
if ((poAction == PowerActionSleep) && !(spc->SystemS1 || spc->SystemS2 || spc->SystemS3))
140+
if ((poAction == PowerActionSleep) && !IS_PWR_SUSPEND_ALLOWED(spc))
141141
{
142142
if (bIsLid)
143143
poAction = PowerActionNone;
@@ -282,7 +282,7 @@ Adv_InitDialog(
282282
HWND hList2;
283283
HWND hList3;
284284

285-
BOOLEAN bSuspend = FALSE;
285+
BOOLEAN bSuspend;
286286
BOOLEAN bHibernate;
287287
BOOLEAN bShutdown;
288288
BOOL bEnabled;
@@ -308,11 +308,9 @@ Adv_InitDialog(
308308

309309
GetPwrCapabilities(&spc);
310310

311-
if (spc.SystemS1 || spc.SystemS2 || spc.SystemS3)
312-
bSuspend=TRUE;
313-
314-
bHibernate = spc.HiberFilePresent;
315-
bShutdown = spc.SystemS5;
311+
bSuspend = IS_PWR_SUSPEND_ALLOWED(&spc);
312+
bHibernate = IS_PWR_HIBERNATE_ALLOWED(&spc);
313+
bShutdown = IS_PWR_POWEROFF_ALLOWED(&spc);
316314

317315
hList1 = GetDlgItem(hwndDlg, IDC_LIDCLOSE);
318316
SendMessage(hList1, CB_RESETCONTENT, 0, 0);

dll/cpl/powercfg/powercfg.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ Applet1(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
131131
InitPropSheetPage(&psh, IDD_PROPPAGEADVANCED, AdvancedDlgProc);
132132
if (spc.SystemS4)
133133
{
134+
/* ACPI S4 state is supported, display the "Hibernate" page
135+
* where we can enable or disable the hibernation file */
134136
InitPropSheetPage(&psh, IDD_PROPPAGEHIBERNATE, HibernateDlgProc);
135137
}
136138

dll/cpl/powercfg/powershemes.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,25 +208,27 @@ Pos_InitData(
208208
SYSTEM_POWER_CAPABILITIES spc;
209209

210210
if (!GetPwrCapabilities(&spc))
211-
{
212211
return FALSE;
213-
}
214212

215213
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBY),
216-
(spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
214+
IS_PWR_SUSPEND_ALLOWED(&spc) ? SW_SHOW : SW_HIDE);
217215
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYACLIST),
218-
(spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
216+
IS_PWR_SUSPEND_ALLOWED(&spc) ? SW_SHOW : SW_HIDE);
219217
if (spc.SystemBatteriesPresent)
218+
{
220219
ShowWindow(GetDlgItem(hwndDlg, IDC_STANDBYDCLIST),
221-
(spc.SystemS1 || spc.SystemS2 || spc.SystemS3) ? SW_SHOW : SW_HIDE);
220+
IS_PWR_SUSPEND_ALLOWED(&spc) ? SW_SHOW : SW_HIDE);
221+
}
222222

223223
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATE),
224-
(spc.HiberFilePresent) ? SW_SHOW : SW_HIDE);
224+
IS_PWR_HIBERNATE_ALLOWED(&spc) ? SW_SHOW : SW_HIDE);
225225
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEACLIST),
226-
(spc.HiberFilePresent) ? SW_SHOW : SW_HIDE);
226+
IS_PWR_HIBERNATE_ALLOWED(&spc) ? SW_SHOW : SW_HIDE);
227227
if (spc.SystemBatteriesPresent)
228+
{
228229
ShowWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEDCLIST),
229-
(spc.HiberFilePresent) ? SW_SHOW : SW_HIDE);
230+
IS_PWR_HIBERNATE_ALLOWED(&spc) ? SW_SHOW : SW_HIDE);
231+
}
230232

231233
return TRUE;
232234
}

0 commit comments

Comments
 (0)