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 WCHAR szFreeldrIni
[MAX_PATH
+ 15];
16 WCHAR szDumpFile
[MAX_PATH
];
17 WCHAR 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 SendDlgItemMessageW(hwndDlg
, IDC_STRRECLISTUPDWN
, UDM_SETRANGE
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) 999, 0));
37 SendDlgItemMessageW(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 SendDlgItemMessageW(hwndDlg
, IDC_STRRECRECUPDWN
, UDM_SETRANGE
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) 999, 0));
54 SendDlgItemMessageW(hwndDlg
, IDC_STRRECRECUPDWN
, UDM_SETPOS
, (WPARAM
) 0, (LPARAM
) MAKELONG((short) Timeout
, 0));
59 GetSystemDrive(WCHAR
**szSystemDrive
)
63 /* get Path to freeldr.ini or boot.ini */
64 *szSystemDrive
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
* sizeof(WCHAR
));
65 if (*szSystemDrive
!= NULL
)
67 dwBufSize
= GetEnvironmentVariableW(L
"SystemDrive", *szSystemDrive
, MAX_PATH
);
68 if (dwBufSize
> MAX_PATH
)
73 szTmp
= HeapReAlloc(GetProcessHeap(), 0, *szSystemDrive
, dwBufSize
* sizeof(WCHAR
));
77 *szSystemDrive
= szTmp
;
79 dwBufSize2
= GetEnvironmentVariableW(L
"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
, WCHAR
*szSectionName
)
101 INFCONTEXT InfContext
;
102 WCHAR szName
[MAX_PATH
];
103 WCHAR szValue
[MAX_PATH
];
106 if (!SetupFindFirstLineW(hInf
,
111 /* failed to find section */
115 pRecord
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(BOOTRECORD
));
121 wcscpy(pRecord
->szSectionName
, szSectionName
);
125 if (!SetupGetStringFieldW(&InfContext
,
128 sizeof(szName
) / sizeof(WCHAR
),
134 if (!SetupGetStringFieldW(&InfContext
,
137 sizeof(szValue
) / sizeof(WCHAR
),
143 if (!_wcsnicmp(szName
, L
"BootType", 8))
145 if (!_wcsnicmp(szValue
, L
"ReactOS", 7))
147 //FIXME store as enum
148 pRecord
->BootType
= 1;
152 pRecord
->BootType
= 0;
155 else if (!_wcsnicmp(szName
, L
"SystemPath", 10))
157 wcscpy(pRecord
->szBootPath
, szValue
);
159 else if (!_wcsnicmp(szName
, L
"Options", 7))
161 //FIXME store flags as values
162 wcscpy(pRecord
->szOptions
, szValue
);
166 while (SetupFindNextLine(&InfContext
, &InfContext
));
173 LoadFreeldrSettings(HINF hInf
, HWND hwndDlg
)
175 INFCONTEXT InfContext
;
177 WCHAR szDefaultOs
[MAX_PATH
];
178 WCHAR szName
[MAX_PATH
];
179 WCHAR szValue
[MAX_PATH
];
184 if (!SetupFindFirstLineW(hInf
,
189 /* failed to find default os */
193 if (!SetupGetStringFieldW(&InfContext
,
196 sizeof(szDefaultOs
) / sizeof(WCHAR
),
203 if (!SetupFindFirstLineW(hInf
,
208 /* expected to find timeout value */
213 if (!SetupGetIntField(&InfContext
,
217 /* failed to retrieve timeout */
221 if (!SetupFindFirstLineW(hInf
,
222 L
"Operating Systems",
226 /* expected list of operating systems */
232 if (!SetupGetStringFieldW(&InfContext
,
235 sizeof(szName
) / sizeof(WCHAR
),
238 /* the ini file is messed up */
242 if (!SetupGetStringFieldW(&InfContext
,
245 sizeof(szValue
) / sizeof(WCHAR
),
248 /* the ini file is messed up */
252 pRecord
= ReadFreeldrSection(hInf
, szName
);
255 lResult
= SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
)szValue
);
256 if (lResult
!= CB_ERR
)
258 SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETITEMDATA
, (WPARAM
)lResult
, (LPARAM
)pRecord
);
259 if (!wcscmp(szDefaultOs
, szName
))
261 /* we store the friendly name as key */
262 wcscpy(szDefaultOs
, szValue
);
267 HeapFree(GetProcessHeap(), 0, pRecord
);
271 while (SetupFindNextLine(&InfContext
, &InfContext
));
273 /* find default os in list */
274 lResult
= SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_FINDSTRING
, (WPARAM
)-1, (LPARAM
)szDefaultOs
);
275 if (lResult
!= CB_ERR
)
278 SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETCURSEL
, (WPARAM
)lResult
, (LPARAM
)0);
283 SendDlgItemMessageW(hwndDlg
, IDC_STRECLIST
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
286 SetTimeout(hwndDlg
, TimeOut
);
292 LoadBootSettings(HINF hInf
, HWND hwndDlg
)
294 INFCONTEXT InfContext
;
295 WCHAR szName
[MAX_PATH
];
296 WCHAR szValue
[MAX_PATH
];
299 WCHAR szDefaultOS
[MAX_PATH
];
300 WCHAR szOptions
[MAX_PATH
];
304 if(!SetupFindFirstLineW(hInf
,
314 if (!SetupGetStringFieldW(&InfContext
,
317 sizeof(szName
) / sizeof(WCHAR
),
323 if (!SetupGetStringFieldW(&InfContext
,
326 sizeof(szValue
) / sizeof(WCHAR
),
332 if (!_wcsnicmp(szName
, L
"timeout", 7))
334 TimeOut
= _wtoi(szValue
);
337 if (!_wcsnicmp(szName
, L
"default", 7))
339 wcscpy(szDefaultOS
, szValue
);
343 while (SetupFindNextLine(&InfContext
, &InfContext
));
345 if (!SetupFindFirstLineW(hInf
,
346 L
"operating systems",
350 /* failed to find operating systems section */
356 if (!SetupGetStringFieldW(&InfContext
,
359 sizeof(szName
) / sizeof(WCHAR
),
365 if (!SetupGetStringFieldW(&InfContext
,
368 sizeof(szValue
) / sizeof(WCHAR
),
374 SetupGetStringFieldW(&InfContext
,
377 sizeof(szOptions
) / sizeof(WCHAR
),
380 pRecord
= (PBOOTRECORD
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(BOOTRECORD
));
383 pRecord
->BootType
= 0;
384 wcscpy(pRecord
->szBootPath
, szName
);
385 wcscpy(pRecord
->szSectionName
, szValue
);
386 wcscpy(pRecord
->szOptions
, szOptions
);
388 if (!wcscmp(szName
, szDefaultOS
))
390 /* ms boot ini stores the path not the friendly name */
391 wcscpy(szDefaultOS
, szValue
);
394 lResult
= SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
)szValue
);
395 if (lResult
!= CB_ERR
)
397 SendDlgItemMessageW(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
= SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_FINDSTRING
, (WPARAM
)0, (LPARAM
)szDefaultOS
);
410 if (lResult
!= CB_ERR
)
413 SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_SETCURSEL
, (WPARAM
)lResult
, (LPARAM
)0);
418 SendDlgItemMessageW(hwndDlg
, IDC_STRECLIST
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
421 SetTimeout(hwndDlg
, TimeOut
);
427 DeleteBootRecords(HWND hwndDlg
)
433 lIndex
= SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETCOUNT
, (WPARAM
)0, (LPARAM
)0);
434 if (lIndex
== CB_ERR
)
437 for (index
= 0; index
<lIndex
; index
++)
439 pRecord
= (PBOOTRECORD
) SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETITEMDATA
, (WPARAM
)index
, (LPARAM
)0);
440 if ((INT_PTR
)pRecord
!= CB_ERR
)
442 HeapFree(GetProcessHeap(), 0, pRecord
);
446 SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_RESETCONTENT
, (WPARAM
)0, (LPARAM
)0);
450 LoadOSList(HWND hwndDlg
, PSTARTINFO pStartInfo
)
453 WCHAR
*szSystemDrive
;
456 dwBufSize
= GetSystemDrive(&szSystemDrive
);
460 wcscpy(pStartInfo
->szFreeldrIni
, szSystemDrive
);
461 wcscat(pStartInfo
->szFreeldrIni
, L
"\\freeldr.ini");
463 if (PathFileExistsW(pStartInfo
->szFreeldrIni
))
465 /* free resource previously allocated by GetSystemDrive() */
466 HeapFree(GetProcessHeap(), 0, szSystemDrive
);
467 /* freeldr.ini exists */
468 hInf
= SetupOpenInfFileW(pStartInfo
->szFreeldrIni
,
473 if (hInf
!= INVALID_HANDLE_VALUE
)
475 LoadFreeldrSettings(hInf
, hwndDlg
);
476 SetupCloseInfFile(hInf
);
477 pStartInfo
->iFreeLdrIni
= 1;
483 /* try load boot.ini settings */
484 wcscpy(pStartInfo
->szFreeldrIni
, szSystemDrive
);
485 wcscat(pStartInfo
->szFreeldrIni
, L
"\\boot.ini");
487 /* free resource previously allocated by GetSystemDrive() */
488 HeapFree(GetProcessHeap(), 0, szSystemDrive
);
490 if (PathFileExistsW(pStartInfo
->szFreeldrIni
))
492 /* load boot.ini settings */
493 hInf
= SetupOpenInfFileW(pStartInfo
->szFreeldrIni
,
498 if (hInf
!= INVALID_HANDLE_VALUE
)
500 LoadBootSettings(hInf
, hwndDlg
);
501 SetupCloseInfFile(hInf
);
502 pStartInfo
->iFreeLdrIni
= 2;
513 SetCrashDlgItems(HWND hwnd
, PSTARTINFO pStartInfo
)
515 if (pStartInfo
->dwCrashDumpEnabled
== 0)
517 /* no crash information required */
518 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), FALSE
);
519 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECOVERWRITE
), FALSE
);
521 else if (pStartInfo
->dwCrashDumpEnabled
== 3)
524 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), TRUE
);
525 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECOVERWRITE
), FALSE
);
526 SendMessageW(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), WM_SETTEXT
, (WPARAM
)0, (LPARAM
)pStartInfo
->szMinidumpDir
);
528 else if (pStartInfo
->dwCrashDumpEnabled
== 1 || pStartInfo
->dwCrashDumpEnabled
== 2)
530 /* kernel or complete dump */
531 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), TRUE
);
532 EnableWindow(GetDlgItem(hwnd
, IDC_STRRECOVERWRITE
), TRUE
);
533 SendMessageW(GetDlgItem(hwnd
, IDC_STRRECDUMPFILE
), WM_SETTEXT
, (WPARAM
)0, (LPARAM
)pStartInfo
->szDumpFile
);
535 SendDlgItemMessageW(hwnd
, IDC_STRRECDEBUGCOMBO
, CB_SETCURSEL
, (WPARAM
)pStartInfo
->dwCrashDumpEnabled
, (LPARAM
)0);
539 WriteStartupRecoveryOptions(HWND hwndDlg
, PSTARTINFO pStartInfo
)
544 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
545 L
"System\\CurrentControlSet\\Control\\CrashControl",
548 &hKey
) != ERROR_SUCCESS
)
550 /* failed to open key */
554 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECWRITEEVENT
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
555 RegSetValueExW(hKey
, L
"LogEvent", 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
557 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECSENDALERT
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
558 RegSetValueExW(hKey
, L
"SendAlert", 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
560 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECRESTART
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
561 RegSetValueExW(hKey
, L
"AutoReboot", 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
563 lResult
= (DWORD
) SendDlgItemMessage(hwndDlg
, IDC_STRRECOVERWRITE
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0);
564 RegSetValueExW(hKey
, L
"Overwrite", 0, REG_DWORD
, (LPBYTE
)&lResult
, sizeof(lResult
));
567 if (pStartInfo
->dwCrashDumpEnabled
== 1 || pStartInfo
->dwCrashDumpEnabled
== 2)
569 SendDlgItemMessage(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szDumpFile
) / sizeof(WCHAR
), (LPARAM
)pStartInfo
->szDumpFile
);
570 RegSetValueExW(hKey
, L
"DumpFile", 0, REG_EXPAND_SZ
, (LPBYTE
)pStartInfo
->szDumpFile
, (wcslen(pStartInfo
->szDumpFile
) + 1) * sizeof(WCHAR
));
572 else if (pStartInfo
->dwCrashDumpEnabled
== 3)
574 SendDlgItemMessage(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szDumpFile
) / sizeof(WCHAR
), (LPARAM
)pStartInfo
->szDumpFile
);
575 RegSetValueExW(hKey
, L
"MinidumpDir", 0, REG_EXPAND_SZ
, (LPBYTE
)pStartInfo
->szDumpFile
, (wcslen(pStartInfo
->szDumpFile
) + 1) * sizeof(WCHAR
));
578 RegSetValueExW(hKey
, L
"CrashDumpEnabled", 0, REG_DWORD
, (LPBYTE
)&pStartInfo
->dwCrashDumpEnabled
, sizeof(pStartInfo
->dwCrashDumpEnabled
));
583 LoadRecoveryOptions(HWND hwndDlg
, PSTARTINFO pStartInfo
)
586 WCHAR szName
[MAX_PATH
];
587 DWORD dwValue
, dwValueLength
, dwType
;
589 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
590 L
"System\\CurrentControlSet\\Control\\CrashControl",
593 &hKey
) != ERROR_SUCCESS
)
595 /* failed to open key */
599 dwValueLength
= sizeof(DWORD
);
600 if (RegQueryValueExW(hKey
, L
"LogEvent", NULL
, &dwType
, (LPBYTE
)&dwValue
, &dwValueLength
) == ERROR_SUCCESS
&& dwType
== REG_DWORD
&& dwValue
)
601 SendDlgItemMessageW(hwndDlg
, IDC_STRRECWRITEEVENT
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
603 dwValueLength
= sizeof(DWORD
);
604 if (RegQueryValueExW(hKey
, L
"SendAlert", NULL
, &dwType
, (LPBYTE
)&dwValue
, &dwValueLength
) == ERROR_SUCCESS
&& dwType
== REG_DWORD
&& dwValue
)
605 SendDlgItemMessageW(hwndDlg
, IDC_STRRECSENDALERT
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
607 dwValueLength
= sizeof(DWORD
);
608 if (RegQueryValueExW(hKey
, L
"AutoReboot", NULL
, &dwType
, (LPBYTE
)&dwValue
, &dwValueLength
) == ERROR_SUCCESS
&& dwType
== REG_DWORD
&& dwValue
)
609 SendDlgItemMessageW(hwndDlg
, IDC_STRRECRESTART
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
611 dwValueLength
= sizeof(DWORD
);
612 if (RegQueryValueExW(hKey
, L
"Overwrite", NULL
, &dwType
, (LPBYTE
)&dwValue
, &dwValueLength
) == ERROR_SUCCESS
&& dwType
== REG_DWORD
&& dwValue
)
613 SendDlgItemMessageW(hwndDlg
, IDC_STRRECOVERWRITE
, BM_SETCHECK
, (WPARAM
)BST_CHECKED
, (LPARAM
)0);
615 dwValueLength
= sizeof(DWORD
);
616 if (RegQueryValueExW(hKey
, L
"CrashDumpEnabled", NULL
, &dwType
, (LPBYTE
)&dwValue
, &dwValueLength
) == ERROR_SUCCESS
&& dwType
== REG_DWORD
&& dwValue
)
617 pStartInfo
->dwCrashDumpEnabled
= dwValue
;
619 dwValueLength
= sizeof(pStartInfo
->szDumpFile
);
620 if (RegQueryValueExW(hKey
, L
"DumpFile", NULL
, &dwType
, (LPBYTE
)pStartInfo
->szDumpFile
, &dwValueLength
) != ERROR_SUCCESS
)
621 pStartInfo
->szDumpFile
[0] = L
'\0';
623 dwValueLength
= sizeof(pStartInfo
->szMinidumpDir
);
624 if (RegQueryValueExW(hKey
, L
"MinidumpDir", NULL
, &dwType
, (LPBYTE
)pStartInfo
->szMinidumpDir
, &dwValueLength
) != ERROR_SUCCESS
)
625 pStartInfo
->szMinidumpDir
[0] = L
'\0';
627 if (LoadStringW(hApplet
, IDS_NO_DUMP
, szName
, sizeof(szName
) / sizeof(WCHAR
)))
629 szName
[(sizeof(szName
)/sizeof(WCHAR
))-1] = L
'\0';
630 SendDlgItemMessageW(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szName
);
633 if (LoadString(hApplet
, IDS_FULL_DUMP
, szName
, sizeof(szName
) / sizeof(WCHAR
)))
635 szName
[(sizeof(szName
)/sizeof(WCHAR
))-1] = L
'\0';
636 SendDlgItemMessageW(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szName
);
639 if (LoadStringW(hApplet
, IDS_KERNEL_DUMP
, szName
, sizeof(szName
) / sizeof(WCHAR
)))
641 szName
[(sizeof(szName
)/sizeof(WCHAR
))-1] = L
'\0';
642 SendDlgItemMessageW(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szName
);
645 if (LoadStringW(hApplet
, IDS_MINI_DUMP
, szName
, sizeof(szName
) / sizeof(WCHAR
)))
647 szName
[(sizeof(szName
)/sizeof(WCHAR
))-1] = L
'\0';
648 SendDlgItemMessageW(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_ADDSTRING
, (WPARAM
)0, (LPARAM
) szName
);
651 SetCrashDlgItems(hwndDlg
, pStartInfo
);
656 /* Property page dialog callback */
658 StartRecDlgProc(HWND hwndDlg
,
663 PSTARTINFO pStartInfo
;
669 UNREFERENCED_PARAMETER(lParam
);
671 pStartInfo
= (PSTARTINFO
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
676 pStartInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(STARTINFO
));
677 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (LONG_PTR
)pStartInfo
);
679 LoadRecoveryOptions(hwndDlg
, pStartInfo
);
680 SetRecoveryTimeout(hwndDlg
, 0);
681 return LoadOSList(hwndDlg
, pStartInfo
);
684 DeleteBootRecords(hwndDlg
);
685 HeapFree(GetProcessHeap(), 0, pStartInfo
);
689 switch(LOWORD(wParam
))
692 ShellExecuteW(0, L
"open", L
"notepad", pStartInfo
->szFreeldrIni
, NULL
, SW_SHOWNORMAL
);
693 // FIXME use CreateProcess and wait untill finished
694 // DeleteBootRecords(hwndDlg);
695 // LoadOSList(hwndDlg);
700 if (SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
701 iTimeout
= SendDlgItemMessage(hwndDlg
, IDC_STRRECLISTUPDWN
, UDM_GETPOS
, (WPARAM
)0, (LPARAM
)0);
704 swprintf(szTimeout
, L
"%i", iTimeout
);
706 lResult
= SendDlgItemMessageW(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETCURSEL
, (WPARAM
)0, (LPARAM
)0);
707 if (lResult
== CB_ERR
)
710 DeleteBootRecords(hwndDlg
);
714 pRecord
= (PBOOTRECORD
) SendDlgItemMessage(hwndDlg
, IDC_STRECOSCOMBO
, CB_GETITEMDATA
, (WPARAM
)lResult
, (LPARAM
)0);
716 if ((INT_PTR
)pRecord
!= CB_ERR
)
718 if (pStartInfo
->iFreeLdrIni
== 1) // FreeLdrIni style
720 /* set default timeout */
721 WritePrivateProfileStringW(L
"FREELOADER",
724 pStartInfo
->szFreeldrIni
);
726 WritePrivateProfileStringW(L
"FREELOADER",
728 pRecord
->szSectionName
,
729 pStartInfo
->szFreeldrIni
);
732 else if (pStartInfo
->iFreeLdrIni
== 2) // BootIni style
734 /* set default timeout */
735 WritePrivateProfileStringW(L
"boot loader",
738 pStartInfo
->szFreeldrIni
);
740 WritePrivateProfileStringW(L
"boot loader",
743 pStartInfo
->szFreeldrIni
);
748 WriteStartupRecoveryOptions(hwndDlg
, pStartInfo
);
759 if (SendDlgItemMessage(hwndDlg
, IDC_STRECLIST
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
760 SetTimeout(hwndDlg
, 30);
762 SetTimeout(hwndDlg
, 0);
766 if (SendDlgItemMessage(hwndDlg
, IDC_STRRECREC
, BM_GETCHECK
, (WPARAM
)0, (LPARAM
)0) == BST_CHECKED
)
767 SetRecoveryTimeout(hwndDlg
, 30);
769 SetRecoveryTimeout(hwndDlg
, 0);
772 case IDC_STRRECDEBUGCOMBO
:
773 if (HIWORD(wParam
) == CBN_SELCHANGE
)
777 lResult
= SendDlgItemMessage(hwndDlg
, IDC_STRRECDEBUGCOMBO
, CB_GETCURSEL
, (WPARAM
)0, (LPARAM
)0);
778 if (lResult
!= CB_ERR
&& lResult
!= (LRESULT
)pStartInfo
->dwCrashDumpEnabled
)
780 if (pStartInfo
->dwCrashDumpEnabled
== 1 || pStartInfo
->dwCrashDumpEnabled
== 2)
782 SendDlgItemMessageW(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szDumpFile
) / sizeof(WCHAR
), (LPARAM
)pStartInfo
->szDumpFile
);
784 else if (pStartInfo
->dwCrashDumpEnabled
== 3)
786 SendDlgItemMessageW(hwndDlg
, IDC_STRRECDUMPFILE
, WM_GETTEXT
, (WPARAM
)sizeof(pStartInfo
->szMinidumpDir
) / sizeof(WCHAR
), (LPARAM
)pStartInfo
->szMinidumpDir
);
789 pStartInfo
->dwCrashDumpEnabled
= (DWORD
)lResult
;
790 SetCrashDlgItems(hwndDlg
, pStartInfo
);