https://git.reactos.org/?p=reactos.git;a=commitdiff;h=beeb989eaa5ad095c106f4...
commit beeb989eaa5ad095c106f46036c639bf34d8cda1 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sun Mar 15 14:19:42 2020 +0100 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sun Mar 15 14:21:11 2020 +0100
[POWERCFG] Disable the "Enable hibernation" checkbox if the system does not support hibernation --- dll/cpl/powercfg/hibernate.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dll/cpl/powercfg/hibernate.c b/dll/cpl/powercfg/hibernate.c index 02e774e784e..3f19aea2ab3 100644 --- a/dll/cpl/powercfg/hibernate.c +++ b/dll/cpl/powercfg/hibernate.c @@ -19,6 +19,7 @@ Hib_InitDialog(HWND hwndDlg) TCHAR szTemp[MAX_PATH]; LPTSTR lpRoot; ULARGE_INTEGER FreeBytesAvailable, TotalNumberOfBytes, TotalNumberOfFreeBytes; + BOOLEAN bHibernate;
if (GetPwrCapabilities(&PowerCaps)) { @@ -59,6 +60,12 @@ Hib_InitDialog(HWND hwndDlg) ShowWindow(GetDlgItem(hwndDlg, IDC_TOLESSFREESPACE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), TRUE); } + + bHibernate = PowerCaps.HiberFilePresent ? TRUE : FALSE; + if (CallNtPowerInformation(SystemReserveHiberFile, &bHibernate, sizeof(bHibernate), NULL, 0) != STATUS_SUCCESS) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_HIBERNATEFILE), FALSE); + } } }