3 * PROJECT: ReactOS System Control Panel Applet
4 * LICENSE: GPL - See COPYING in the top level directory
5 * FILE: dll/cpl/sysdm/startrec.c
6 * PURPOSE: Computer settings for startup and recovery
7 * COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
8 * Copyright 2006 Christoph von Wittich <Christoph@ApiViewer.de>
14 static TCHAR m_szFreeldrIni
[MAX_PATH
+ 15];
16 void SetTimeout(HWND hwndDlg
, int Timeout
)
20 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECLISTUPDWN
), FALSE
);
24 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECLISTUPDWN
), TRUE
);
26 SendDlgItemMessage(hwndDlg
, IDC_STRRECLISTUPDWN
, UDM_SETPOS
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) Timeout
, 0));
29 /* Property page dialog callback */
31 StartRecDlgProc(HWND hwndDlg
,
37 TCHAR szDefaultOS
[MAX_PATH
];
38 TCHAR szDefaultOSName
[MAX_PATH
];
42 UNREFERENCED_PARAMETER(lParam
);
48 /* get Path to freeldr.ini or boot.ini */
49 szSystemDrive
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, MAX_PATH
);
50 if (szSystemDrive
!= NULL
)
52 szSystemDrive
= _tgetenv(_T("SystemDrive"));
53 if (m_szFreeldrIni
!= NULL
&& szSystemDrive
!= NULL
)
55 _tcscpy(m_szFreeldrIni
, szSystemDrive
);
56 _tcscat(m_szFreeldrIni
, _T("\\freeldr.ini"));
57 if (!PathFileExists(m_szFreeldrIni
))
59 _tcscpy(m_szFreeldrIni
, szSystemDrive
);
60 _tcscat(m_szFreeldrIni
, _T("\\boot.ini"));
63 HeapFree(GetProcessHeap(), 0, szSystemDrive
);
66 SetDlgItemText(hwndDlg
, IDC_STRRECDUMPFILE
, _T("%SystemRoot%\\MiniDump"));
68 /* load settings from freeldr.ini */
69 GetPrivateProfileString(_T("boot loader"), _T("default"), NULL
, szDefaultOS
, MAX_PATH
, m_szFreeldrIni
);
70 GetPrivateProfileString(_T("operating systems"), szDefaultOS
, NULL
, szDefaultOSName
, MAX_PATH
, m_szFreeldrIni
);
71 SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
)szDefaultOSName
);
72 SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETCURSEL
, (WPARAM
)0, (LPARAM
)0);
75 iTimeout
= GetPrivateProfileInt(_T("boot loader"), _T("timeout"), 0, m_szFreeldrIni
);
76 SetTimeout(hwndDlg
, iTimeout
);
78 SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
85 switch(LOWORD(wParam
))
89 ShellExecute(0, _T("open"), _T("notepad"), m_szFreeldrIni
, NULL
, SW_SHOWNORMAL
);
95 if (SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
96 iTimeout
= SendDlgItemMessage(hwndDlg
, IDC_STRRECLISTUPDWN
, UDM_GETPOS
, (WPARAM
)0, (LPARAM
)0);
99 _stprintf(szTimeout
, _T("%i"), iTimeout
);
100 WritePrivateProfileString(_T("boot loader"), _T("timeout"), szTimeout
, m_szFreeldrIni
);
111 if (SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
112 SetTimeout(hwndDlg
, 30);
114 SetTimeout(hwndDlg
, 0);