2 * PROJECT: ReactOS System Control Panel Applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/sysdm/startrec.c
5 * PURPOSE: Computer settings for startup and recovery
6 * COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
7 * Copyright 2006 Christoph von Wittich <Christoph@ApiViewer.de>
8 * Copyright 2007 Johannes Anderwald <johannes dot anderwald at student dot tugraz dot at>
13 typedef struct _STARTINFO
15 TCHAR szFreeldrIni
[MAX_PATH
+ 15];
16 TCHAR szDumpFile
[MAX_PATH
];
17 TCHAR szMinidumpDir
[MAX_PATH
];
18 DWORD dwCrashDumpEnabled
;
20 } STARTINFO
, *PSTARTINFO
;
24 SetTimeout(HWND hwndDlg
, INT Timeout
)
28 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECLISTUPDWN
), FALSE
);
29 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECLISTEDIT
), FALSE
);
33 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECLISTUPDWN
), TRUE
);
34 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECLISTEDIT
), TRUE
);
36 SendDlgItemMessage(hwndDlg
, IDC_STRRECLISTUPDWN
, UDM_SETRANGE
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) 999, 0));
37 SendDlgItemMessage(hwndDlg
, IDC_STRRECLISTUPDWN
, UDM_SETPOS
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) Timeout
, 0));
41 SetRecoveryTimeout(HWND hwndDlg
, INT Timeout
)
45 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECRECUPDWN
), FALSE
);
46 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECRECEDIT
), FALSE
);
50 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECRECUPDWN
), TRUE
);
51 EnableWindow(GetDlgItem(hwndDlg
, IDC_STRRECRECEDIT
), TRUE
);
53 SendDlgItemMessage(hwndDlg
, IDC_STRRECRECUPDWN
, UDM_SETRANGE
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) 999, 0));
54 SendDlgItemMessage(hwndDlg
, IDC_STRRECRECUPDWN
, UDM_SETPOS
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) Timeout
, 0));
59 GetSystemDrive(TCHAR
**szSystemDrive
)
63 /* get Path to freeldr.ini or boot.ini */
64 *szSystemDrive
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
* sizeof(TCHAR
));
65 if (szSystemDrive
!= NULL
)
67 dwBufSize
= GetEnvironmentVariable(_T("SystemDrive"), *szSystemDrive
, MAX_PATH
);
68 if (dwBufSize
> MAX_PATH
)
73 szTmp
= HeapReAlloc(GetProcessHeap(), 0, *szSystemDrive
, dwBufSize
* sizeof(TCHAR
));
77 *szSystemDrive
= szTmp
;
79 dwBufSize2
= GetEnvironmentVariable(_T("SystemDrive"), *szSystemDrive
, dwBufSize
);
80 if (dwBufSize2
> dwBufSize
|| dwBufSize2
== 0)
83 else if (dwBufSize
== 0)
86 HeapFree(GetProcessHeap(), 0, szSystemDrive
);
87 *szSystemDrive
= NULL
;
98 ReadFreeldrSection(HINF hInf
, TCHAR
*szSectionName
)
101 INFCONTEXT InfContext
;
102 TCHAR szName
[MAX_PATH
];
103 TCHAR szValue
[MAX_PATH
];
106 if (!SetupFindFirstLine(hInf
,
111 /* failed to find section */
115 pRecord
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(BOOTRECORD
));
121 _tcscpy(pRecord
->szSectionName
, szSectionName
);
125 if (!SetupGetStringField(&InfContext
,
128 sizeof(szName
) / sizeof(TCHAR
),
134 if (!SetupGetStringField(&InfContext
,
137 sizeof(szValue
) / sizeof(TCHAR
),
143 if (!_tcsnicmp(szName
, _T("BootType"), 8))
145 if (!_tcsnicmp(szValue
, _T("ReactOS"), 7))
147 //FIXME store as enum
148 pRecord
->BootType
= 1;
152 pRecord
->BootType
= 0;
155 else if (!_tcsnicmp(szName
, _T("SystemPath"), 10))
157 _tcscpy(pRecord
->szBootPath
, szValue
);
159 else if (!_tcsnicmp(szName
, _T("Options"), 7))
161 //FIXME store flags as values
162 _tcscpy(pRecord
->szOptions
, szValue
);
166 while (SetupFindNextLine(&InfContext
, &InfContext
));
173 LoadFreeldrSettings(HINF hInf
, HWND hwndDlg
)
175 INFCONTEXT InfContext
;
177 TCHAR szDefaultOs
[MAX_PATH
];
178 TCHAR szName
[MAX_PATH
];
179 TCHAR szValue
[MAX_PATH
];
184 if (!SetupFindFirstLine(hInf
,
189 /* failed to find default os */
193 if (!SetupGetStringField(&InfContext
,
196 sizeof(szDefaultOs
) / sizeof(TCHAR
),
203 if (!SetupFindFirstLine(hInf
,
208 /* expected to find timeout value */
213 if (!SetupGetIntField(&InfContext
,
217 /* failed to retrieve timeout */
221 if (!SetupFindFirstLine(hInf
,
222 _T("Operating Systems"),
226 /* expected list of operating systems */
232 if (!SetupGetStringField(&InfContext
,
235 sizeof(szName
) / sizeof(TCHAR
),
238 /* the ini file is messed up */
242 if (!SetupGetStringField(&InfContext
,
245 sizeof(szValue
) / sizeof(TCHAR
),
248 /* the ini file is messed up */
252 pRecord
= ReadFreeldrSection(hInf
, szName
);
255 lResult
= SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
)szValue
);
256 if (lResult
!= CB_ERR
)
258 SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETITEMDATA
, (WPARAM
)lResult
, (LPARAM
)pRecord
);
259 if (!_tcscmp(szDefaultOs
, szName
))
261 /* we store the friendly name as key */
262 _tcscpy(szDefaultOs
, szValue
);
267 HeapFree(GetProcessHeap(), 0, pRecord
);
271 while (SetupFindNextLine(&InfContext
, &InfContext
));
273 /* find default os in list */
274 lResult
= SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_FINDSTRING
, (WPARAM
)-1, (LPARAM
)szDefaultOs
);
275 if (lResult
!= CB_ERR
)
278 SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETCURSEL
, (WPARAM
)lResult
, (LPARAM
)0);
283 SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
286 SetTimeout(hwndDlg
, TimeOut
);
292 LoadBootSettings(HINF hInf
, HWND hwndDlg
)
294 INFCONTEXT InfContext
;
295 TCHAR szName
[MAX_PATH
];
296 TCHAR szValue
[MAX_PATH
];
299 TCHAR szDefaultOS
[MAX_PATH
];
300 TCHAR szOptions
[MAX_PATH
];
304 if(!SetupFindFirstLine(hInf
,
314 if (!SetupGetStringField(&InfContext
,
317 sizeof(szName
) / sizeof(TCHAR
),
323 if (!SetupGetStringField(&InfContext
,
326 sizeof(szValue
) / sizeof(TCHAR
),
332 if (!_tcsnicmp(szName
, _T("timeout"), 7))
334 TimeOut
= _ttoi(szValue
);
337 if (!_tcsnicmp(szName
, _T("default"), 7))
339 _tcscpy(szDefaultOS
, szValue
);
343 while (SetupFindNextLine(&InfContext
, &InfContext
));
345 if (!SetupFindFirstLine(hInf
,
346 _T("operating systems"),
350 /* failed to find operating systems section */
356 if (!SetupGetStringField(&InfContext
,
359 sizeof(szName
) / sizeof(TCHAR
),
365 if (!SetupGetStringField(&InfContext
,
368 sizeof(szValue
) / sizeof(TCHAR
),
374 SetupGetStringField(&InfContext
,
377 sizeof(szOptions
) / sizeof(TCHAR
),
380 pRecord
= (PBOOTRECORD
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(BOOTRECORD
));
383 pRecord
->BootType
= 0;
384 _tcscpy(pRecord
->szBootPath
, szName
);
385 _tcscpy(pRecord
->szSectionName
, szValue
);
386 _tcscpy(pRecord
->szOptions
, szOptions
);
388 if (!_tcscmp(szName
, szDefaultOS
))
390 /* ms boot ini stores the path not the friendly name */
391 _tcscpy(szDefaultOS
, szValue
);
394 lResult
= SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
)szValue
);
395 if (lResult
!= CB_ERR
)
397 SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETITEMDATA
, (WPARAM
)lResult
, (LPARAM
)pRecord
);
401 HeapFree(GetProcessHeap(), 0, pRecord
);
406 while (SetupFindNextLine(&InfContext
, &InfContext
));
408 /* find default os in list */
409 lResult
= SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_FINDSTRING
, (WPARAM
)0, (LPARAM
)szDefaultOS
);
410 if (lResult
!= CB_ERR
)
413 SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETCURSEL
, (WPARAM
)lResult
, (LPARAM
)0);
418 SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
421 SetTimeout(hwndDlg
, TimeOut
);
427 DeleteBootRecords(HWND hwndDlg
)
433 lIndex
= SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETCOUNT
, (WPARAM
)0, (LPARAM
)0);
434 if (lIndex
== CB_ERR
)
437 for (index
= 0; index
<lIndex
; index
++)
439 pRecord
= (PBOOTRECORD
) SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETITEMDATA
, (WPARAM
)index
, (LPARAM
)0);
440 if ((INT_PTR
)pRecord
!= CB_ERR
)
442 HeapFree(GetProcessHeap(), 0, pRecord
);
446 SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_RESETCONTENT
, (WPARAM
)0, (LPARAM
)0);
450 LoadOSList(HWND hwndDlg
, PSTARTINFO pStartInfo
)
453 TCHAR
*szSystemDrive
;
456 dwBufSize
= GetSystemDrive(&szSystemDrive
);
460 _tcscpy(pStartInfo
->szFreeldrIni
, szSystemDrive
);
461 _tcscat(pStartInfo
->szFreeldrIni
, _T("\\freeldr.ini"));
463 if (PathFileExists(pStartInfo
->szFreeldrIni
))
465 /* freeldr.ini exists */
466 hInf
= SetupOpenInfFile(pStartInfo
->szFreeldrIni
,
471 if (hInf
!= INVALID_HANDLE_VALUE
)
473 LoadFreeldrSettings(hInf
, hwndDlg
);
474 SetupCloseInfFile(hInf
);
475 pStartInfo
->iFreeLdrIni
= 1;
481 /* try load boot.ini settings */
482 _tcscpy(pStartInfo
->szFreeldrIni
, szSystemDrive
);
483 _tcscat(pStartInfo
->szFreeldrIni
, _T("\\boot.ini"));
485 if (PathFileExists(pStartInfo
->szFreeldrIni
))
487 /* load boot.ini settings */
488 hInf
= SetupOpenInfFile(pStartInfo
->szFreeldrIni
,
493 if (hInf
!= INVALID_HANDLE_VALUE
)
495 LoadBootSettings(hInf
, hwndDlg
);
496 SetupCloseInfFile(hInf
);
497 pStartInfo
->iFreeLdrIni
= 2;
508 SetCrashDlgItems(HWND hwnd
, PSTARTINFO pStartInfo
)
510 if (pStartInfo
->dwCrashDumpEnabled
== 0)
512 /* no crash information required */
513 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), FALSE
);
514 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECOVERWRITE
), FALSE
);
516 else if (pStartInfo
->dwCrashDumpEnabled
== 3)
519 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), TRUE
);
520 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECOVERWRITE
), FALSE
);
521 SendMessage(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), WM_SETTEXT
, (WPARAM
)0, (LPARAM
)pStartInfo
->szMinidumpDir
);
523 else if (pStartInfo
->dwCrashDumpEnabled
== 1 || pStartInfo
->dwCrashDumpEnabled
== 2)
525 /* kernel or complete dump */
526 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), TRUE
);
527 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECOVERWRITE
), TRUE
);
528 SendMessage(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), WM_SETTEXT
, (WPARAM
)0, (LPARAM
)pStartInfo
->szDumpFile
);
530 SendDlgItemMessage(hwnd
, IDC_STRRECDEBUGCOMBO
, CB_SETCURSEL
, (WPARAM
)pStartInfo
->dwCrashDumpEnabled
, (LPARAM
)0);
534 WriteStartupRecoveryOptions(HWND hwndDlg
, PSTARTINFO pStartInfo
)
539 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
540 _T("System\\CurrentControlSet\\Control\\CrashControl"),
543 &hKey
) != ERROR_SUCCESS
)
545 /* failed to open key */
549 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECWRITEEVENT
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
550 RegSetValueEx(hKey
, _T("LogEvent"), 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
552 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECSENDALERT
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
553 RegSetValueEx(hKey
, _T("SendAlert"), 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
555 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECRESTART
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
556 RegSetValueEx(hKey
, _T("AutoReboot"), 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
558 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECOVERWRITE
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
559 RegSetValueEx(hKey
, _T("Overwrite"), 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
562 if (pStartInfo
->dwCrashDumpEnabled
== 1 || pStartInfo
->dwCrashDumpEnabled
== 2)
564 SendDlgItemMessage(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szDumpFile
) / sizeof(TCHAR
), (LPARAM
)pStartInfo
->szDumpFile
);
565 RegSetValueEx(hKey
, _T("DumpFile"), 0, REG_EXPAND_SZ
, (LPBYTE
)pStartInfo
->szDumpFile
, (_tcslen(pStartInfo
->szDumpFile
) + 1) * sizeof(TCHAR
));
567 else if (pStartInfo
->dwCrashDumpEnabled
== 3)
569 SendDlgItemMessage(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szDumpFile
) / sizeof(TCHAR
), (LPARAM
)pStartInfo
->szDumpFile
);
570 RegSetValueEx(hKey
, _T("MinidumpDir"), 0, REG_EXPAND_SZ
, (LPBYTE
)pStartInfo
->szDumpFile
, (_tcslen(pStartInfo
->szDumpFile
) + 1) * sizeof(TCHAR
));
573 RegSetValueEx(hKey
, _T("CrashDumpEnabled"), 0, REG_DWORD
, (LPBYTE
)(DWORD_PTR
)pStartInfo
->dwCrashDumpEnabled
, sizeof(pStartInfo
->dwCrashDumpEnabled
));
578 LoadRecoveryOptions(HWND hwndDlg
, PSTARTINFO pStartInfo
)
582 TCHAR szName
[MAX_PATH
];
583 TCHAR szValue
[MAX_PATH
];
584 DWORD i
, dwName
, dwValue
, dwValueLength
, dwType
;
586 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
587 _T("System\\CurrentControlSet\\Control\\CrashControl"),
590 &hKey
) != ERROR_SUCCESS
)
592 /* failed to open key */
596 if (RegQueryInfoKey(hKey
,
607 NULL
) != ERROR_SUCCESS
)
613 for (i
= 0; i
< dwValues
; i
++)
615 dwName
= sizeof(szName
) / sizeof(TCHAR
);
617 RegEnumValue(hKey
, i
, szName
, &dwName
, NULL
, &dwType
, NULL
, NULL
);
618 if (dwType
== REG_DWORD
)
620 dwValueLength
= sizeof(dwValue
);
621 dwName
= sizeof(szName
) / sizeof(TCHAR
);
622 if (RegEnumValue(hKey
, i
, szName
, &dwName
, NULL
, &dwType
, (LPBYTE
)&dwValue
, &dwValueLength
) != ERROR_SUCCESS
)
627 dwValueLength
= sizeof(szValue
);
628 dwName
= sizeof(szName
) / sizeof(TCHAR
);
629 if (RegEnumValue(hKey
, i
, szName
, &dwName
, NULL
, &dwType
, (LPBYTE
)&szValue
, &dwValueLength
) != ERROR_SUCCESS
)
633 if (!_tcscmp(szName
, _T("LogEvent")))
636 SendDlgItemMessage(hwndDlg
, IDC_STRRECWRITEEVENT
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
638 else if (!_tcscmp(szName
, _T("SendAlert")))
641 SendDlgItemMessage(hwndDlg
, IDC_STRRECSENDALERT
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
643 else if (!_tcscmp(szName
, _T("AutoReboot")))
646 SendDlgItemMessage(hwndDlg
, IDC_STRRECRESTART
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
648 else if (!_tcscmp(szName
, _T("Overwrite")))
651 SendDlgItemMessage(hwndDlg
, IDC_STRRECOVERWRITE
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
653 else if (!_tcscmp(szName
, _T("DumpFile")))
655 _tcscpy(pStartInfo
->szDumpFile
, szValue
);
657 else if (!_tcscmp(szName
, _T("MinidumpDir")))
659 _tcscpy(pStartInfo
->szMinidumpDir
, szValue
);
661 else if (!_tcscmp(szName
, _T("CrashDumpEnabled")))
663 pStartInfo
->dwCrashDumpEnabled
= dwValue
;
667 if (LoadString(hApplet
, IDS_NO_DUMP
, szValue
, sizeof(szValue
) / sizeof(TCHAR
)) < sizeof(szValue
) / sizeof(TCHAR
))
668 SendDlgItemMessage(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szValue
);
670 if (LoadString(hApplet
, IDS_FULL_DUMP
, szValue
, sizeof(szValue
) / sizeof(TCHAR
)) < sizeof(szValue
) / sizeof(TCHAR
))
671 SendDlgItemMessage(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szValue
);
673 if (LoadString(hApplet
, IDS_KERNEL_DUMP
, szValue
, sizeof(szValue
) / sizeof(TCHAR
)) < sizeof(szValue
) / sizeof(TCHAR
))
674 SendDlgItemMessage(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szValue
);
676 if (LoadString(hApplet
, IDS_MINI_DUMP
, szValue
, sizeof(szValue
) / sizeof(TCHAR
)) < sizeof(szValue
) / sizeof(TCHAR
))
677 SendDlgItemMessage(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szValue
);
679 SetCrashDlgItems(hwndDlg
, pStartInfo
);
684 /* Property page dialog callback */
686 StartRecDlgProc(HWND hwndDlg
,
691 PSTARTINFO pStartInfo
;
697 UNREFERENCED_PARAMETER(lParam
);
699 pStartInfo
= (PSTARTINFO
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
704 pStartInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(STARTINFO
));
705 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (LONG_PTR
)pStartInfo
);
707 LoadRecoveryOptions(hwndDlg
, pStartInfo
);
708 SetRecoveryTimeout(hwndDlg
, 0);
709 return LoadOSList(hwndDlg
, pStartInfo
);
712 DeleteBootRecords(hwndDlg
);
713 HeapFree(GetProcessHeap(), 0, pStartInfo
);
717 switch(LOWORD(wParam
))
720 ShellExecute(0, _T("open"), _T("notepad"), pStartInfo
->szFreeldrIni
, NULL
, SW_SHOWNORMAL
);
721 // FIXME use CreateProcess and wait untill finished
722 // DeleteBootRecords(hwndDlg);
723 // LoadOSList(hwndDlg);
728 if (SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
729 iTimeout
= SendDlgItemMessage(hwndDlg
, IDC_STRRECLISTUPDWN
, UDM_GETPOS
, (WPARAM
)0, (LPARAM
)0);
732 _stprintf(szTimeout
, _T("%i"), iTimeout
);
734 lResult
= SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETCURSEL
, (WPARAM
)0, (LPARAM
)0);
735 if (lResult
== CB_ERR
)
738 DeleteBootRecords(hwndDlg
);
742 pRecord
= (PBOOTRECORD
) SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETITEMDATA
, (WPARAM
)lResult
, (LPARAM
)0);
744 if ((INT_PTR
)pRecord
!= CB_ERR
)
746 if (pStartInfo
->iFreeLdrIni
== 1) // FreeLdrIni style
748 /* set default timeout */
749 WritePrivateProfileString(_T("FREELOADER"),
752 pStartInfo
->szFreeldrIni
);
754 WritePrivateProfileString(_T("FREELOADER"),
756 pRecord
->szSectionName
,
757 pStartInfo
->szFreeldrIni
);
760 else if (pStartInfo
->iFreeLdrIni
== 2) // BootIni style
762 /* set default timeout */
763 WritePrivateProfileString(_T("boot loader"),
766 pStartInfo
->szFreeldrIni
);
768 WritePrivateProfileString(_T("boot loader"),
771 pStartInfo
->szFreeldrIni
);
776 WriteStartupRecoveryOptions(hwndDlg
, pStartInfo
);
787 if (SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
788 SetTimeout(hwndDlg
, 30);
790 SetTimeout(hwndDlg
, 0);
794 if (SendDlgItemMessage(hwndDlg
, IDC_STRRECREC
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
795 SetRecoveryTimeout(hwndDlg
, 30);
797 SetRecoveryTimeout(hwndDlg
, 0);
800 case IDC_STRRECDEBUGCOMBO
:
801 if (HIWORD(wParam
) == CBN_SELCHANGE
)
805 lResult
= SendDlgItemMessage(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_GETCURSEL
, (WPARAM
)0, (LPARAM
)0);
806 if (lResult
!= CB_ERR
&& lResult
!= pStartInfo
->dwCrashDumpEnabled
)
808 if (pStartInfo
->dwCrashDumpEnabled
== 1 || pStartInfo
->dwCrashDumpEnabled
== 2)
810 SendDlgItemMessage(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szDumpFile
) / sizeof(TCHAR
), (LPARAM
)pStartInfo
->szDumpFile
);
812 else if (pStartInfo
->dwCrashDumpEnabled
== 3)
814 SendDlgItemMessage(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szMinidumpDir
) / sizeof(TCHAR
), (LPARAM
)pStartInfo
->szMinidumpDir
);
817 pStartInfo
->dwCrashDumpEnabled
= lResult
;
818 SetCrashDlgItems(hwndDlg
, pStartInfo
);