Author: cwittich
Date: Mon Nov 6 01:53:48 2006
New Revision: 24691
URL:
http://svn.reactos.org/svn/reactos?rev=24691&view=rev
Log:
implemented timeout settings on startup and recovery page
Modified:
trunk/reactos/dll/cpl/sysdm/en.rc
trunk/reactos/dll/cpl/sysdm/precomp.h
trunk/reactos/dll/cpl/sysdm/startrec.c
trunk/reactos/dll/cpl/sysdm/sysdm.rbuild
Modified: trunk/reactos/dll/cpl/sysdm/en.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/en.rc?rev=24…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/en.rc (original)
+++ trunk/reactos/dll/cpl/sysdm/en.rc Mon Nov 6 01:53:48 2006
@@ -165,11 +165,11 @@
LTEXT "Default operating &system:", IDC_STATIC, 14, 26, 100, 8
COMBOBOX IDC_STRECOSCOMBO, 14, 37, 224, 46, CBS_DROPDOWNLIST
//CHECKBOX "&Time to display list of operating systems:",
IDC_STRECLIST, 14, 56, 150, 8
- CONTROL "&Time to display list of operating systems:",
IDC_STRECLIST, "button", BS_CHECKBOX, 14, 56, 150, 8
+ CONTROL "&Time to display list of operating systems:",
IDC_STRECLIST, "button", BS_AUTOCHECKBOX, 14, 56, 150, 8
EDITTEXT IDC_STRRECLISTEDIT, 179, 54, 30, 12
CONTROL "", IDC_STRRECLISTUPDWN, "msctls_updown32", UDS_WRAP
| UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS |
WS_CHILD | WS_VISIBLE, 0, 0, 8, 13
LTEXT "seconds", IDC_STATIC, 215, 56, 25, 8
- CONTROL "Time to &display recovery options when needed:",
IDC_STRRECREC, "button", BS_CHECKBOX, 14, 70, 163, 8
+ CONTROL "Time to &display recovery options when needed:",
IDC_STRRECREC, "button", BS_AUTOCHECKBOX, 14, 70, 163, 8
EDITTEXT IDC_STRRECRECEDIT, 179, 68, 30, 12
CONTROL "", IDC_STRRECRECUPDWN, "msctls_updown32", UDS_WRAP |
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS |
WS_CHILD | WS_VISIBLE, 0, 0, 8, 13
LTEXT "seconds", IDC_STATIC, 215, 70, 25, 8
Modified: trunk/reactos/dll/cpl/sysdm/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/precomp.h?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/precomp.h (original)
+++ trunk/reactos/dll/cpl/sysdm/precomp.h Mon Nov 6 01:53:48 2006
@@ -8,6 +8,7 @@
#include <lm.h>
#include <cpl.h>
#include <shellapi.h>
+#include <shlwapi.h>
#include "resource.h"
#define NUM_APPLETS (1)
Modified: trunk/reactos/dll/cpl/sysdm/startrec.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/startrec.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/startrec.c (original)
+++ trunk/reactos/dll/cpl/sysdm/startrec.c Mon Nov 6 01:53:48 2006
@@ -1,13 +1,30 @@
+
/*
* PROJECT: ReactOS System Control Panel Applet
* LICENSE: GPL - See COPYING in the top level directory
* FILE: dll/cpl/sysdm/startrec.c
* PURPOSE: Computer settings for startup and recovery
* COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy(a)gmail.com>
+ * Copyright 2006 Christoph von Wittich <Christoph(a)ApiViewer.de>
*
*/
#include "precomp.h"
+
+static TCHAR m_szFreeldrIni[MAX_PATH + 15];
+
+void SetTimeout(HWND hwndDlg, int Timeout)
+{
+ if (Timeout == 0)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRRECLISTUPDWN), FALSE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STRRECLISTUPDWN), TRUE);
+ }
+ SendDlgItemMessage(hwndDlg, IDC_STRRECLISTUPDWN, UDM_SETPOS, (WPARAM) 0, (LPARAM)
MAKELONG((short) Timeout, 0));
+}
/* Property page dialog callback */
INT_PTR CALLBACK
@@ -17,24 +34,85 @@
LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(hwndDlg);
+ TCHAR *szSystemDrive;
+ TCHAR szDefaultOS[MAX_PATH];
+ TCHAR szDefaultOSName[MAX_PATH];
+ TCHAR szTimeout[10];
+ int iTimeout;
+
switch(uMsg)
{
case WM_INITDIALOG:
{
- MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
+ /* get Path to freeldr.ini or boot.ini */
+ szSystemDrive = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH);
+ if (szSystemDrive != NULL)
+ {
+ szSystemDrive = _tgetenv(_T("SystemDrive"));
+ if (m_szFreeldrIni != NULL)
+ {
+ _tcscpy(m_szFreeldrIni, szSystemDrive);
+ _tcscat(m_szFreeldrIni, _T("\\freeldr.ini"));
+ if (!PathFileExists(m_szFreeldrIni))
+ {
+ _tcscpy(m_szFreeldrIni, szSystemDrive);
+ _tcscat(m_szFreeldrIni, _T("\\boot.ini"));
+ }
+ }
+ HeapFree(GetProcessHeap(), 0, szSystemDrive);
+ }
+
+ SetDlgItemText(hwndDlg, IDC_STRRECDUMPFILE, _T("%SystemRoot%\\MiniDump"));
+
+ /* load settings from freeldr.ini */
+ GetPrivateProfileString(_T("boot loader"), _T("default"), NULL,
szDefaultOS, MAX_PATH, m_szFreeldrIni);
+ GetPrivateProfileString(_T("operating systems"), szDefaultOS, NULL,
szDefaultOSName, MAX_PATH, m_szFreeldrIni);
+ SendDlgItemMessage(hwndDlg, IDC_STRECOSCOMBO, CB_ADDSTRING, (WPARAM)0,
(LPARAM)szDefaultOSName);
+ SendDlgItemMessage(hwndDlg, IDC_STRECOSCOMBO, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);
+
+ /* timeout */
+ iTimeout = GetPrivateProfileInt(_T("boot loader"), _T("timeout"),
0, m_szFreeldrIni);
+ SetTimeout(hwndDlg, iTimeout);
+ if (iTimeout != 0)
+ SendDlgItemMessage(hwndDlg, IDC_STRECLIST, BM_SETCHECK, (WPARAM)BST_CHECKED,
(LPARAM)0);
+
}
break;
case WM_COMMAND:
{
- if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
- {
- EndDialog(hwndDlg,
- LOWORD(wParam));
- return TRUE;
- }
+ switch(LOWORD(wParam))
+ {
+ case IDC_STRRECEDIT:
+ {
+ ShellExecute(0, _T("open"), _T("notepad"), m_szFreeldrIni, NULL,
SW_SHOWNORMAL);
+ break;
+ }
+ case IDOK:
+ {
+ /* save timeout */
+ if (SendDlgItemMessage(hwndDlg, IDC_STRECLIST, BM_GETCHECK, (WPARAM)0, (LPARAM)0) ==
BST_CHECKED)
+ iTimeout = SendDlgItemMessage(hwndDlg, IDC_STRRECLISTUPDWN, UDM_GETPOS, (WPARAM)0,
(LPARAM)0);
+ else
+ iTimeout = 0;
+ _stprintf(szTimeout, _T("%i"), iTimeout);
+ WritePrivateProfileString(_T("boot loader"), _T("timeout"),
szTimeout, m_szFreeldrIni);
+ }
+ case IDCANCEL:
+ {
+ EndDialog(hwndDlg,
+ LOWORD(wParam));
+ return TRUE;
+ break;
+ }
+ case IDC_STRECLIST:
+ {
+ if (SendDlgItemMessage(hwndDlg, IDC_STRECLIST, BM_GETCHECK, (WPARAM)0, (LPARAM)0) ==
BST_CHECKED)
+ SetTimeout(hwndDlg, 30);
+ else
+ SetTimeout(hwndDlg, 0);
+ }
+ }
}
break;
}
Modified: trunk/reactos/dll/cpl/sysdm/sysdm.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/sysdm.rbuild…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/sysdm.rbuild (original)
+++ trunk/reactos/dll/cpl/sysdm/sysdm.rbuild Mon Nov 6 01:53:48 2006
@@ -16,6 +16,7 @@
<library>ntdll</library>
<library>msimg32</library>
<library>shell32</library>
+ <library>shlwapi</library>
<file>advanced.c</file>
<file>computer.c</file>
<file>custclicklink.c</file>