- implement reading startup / recovery options

svn path=/trunk/; revision=28437
This commit is contained in:
Johannes Anderwald 2007-08-20 21:41:05 +00:00
parent 0b103054a4
commit 4871c23639
17 changed files with 231 additions and 5 deletions

View file

@ -121,4 +121,8 @@ BEGIN
IDS_CPLSYSTEMDESCRIPTION "Zobrazuje informace o Vašem počítači, mění různé systémové proměnné a hardwarové vlastnosti."
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -119,4 +119,8 @@ BEGIN
IDS_CPLSYSTEMDESCRIPTION "Se mere information omkring din computer, og skift diverse system og hardware indstillinger."
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -273,4 +273,8 @@ BEGIN
IDS_PETABYTE "PB RAM"
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(Keine)"
IDS_MINI_DUMP "Kleines Speicherabild(64KB)"
IDS_KERNEL_DUMP "Kernelspeicherabild"
IDS_FULL_DUMP "Vollständiges Speicherabild"
END

View file

@ -265,4 +265,8 @@ BEGIN
IDS_PETABYTE "PB of RAM"
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -125,4 +125,8 @@ BEGIN
IDS_CPLSYSTEMDESCRIPTION "Ver información de su Computadora y cambiar varias opciones del systema."
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -268,4 +268,8 @@ BEGIN
IDS_PETABYTE "PB de RAM"
IDS_VARIABLE "Variable"
IDS_VALUE "Valeur"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -122,4 +122,8 @@ BEGIN
IDS_CPLSYSTEMDESCRIPTION "A számítógéppel kapcsolatos információk megjelenítése, különböző rendszer és hardver beállítások módosítása."
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -264,4 +264,9 @@ BEGIN
IDS_PETABYTE "PB RAM"
IDS_VARIABLE "Variabel"
IDS_VALUE "Nilai"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -265,4 +265,9 @@ BEGIN
IDS_PETABYTE "PB di RAM"
IDS_VARIABLE "Variabile"
IDS_VALUE "Valore"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -121,4 +121,9 @@ BEGIN
IDS_CPLSYSTEMDESCRIPTION "システムの基本情報を表\示し、システムやハードウェアの様々な設定を変更します。"
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -121,4 +121,9 @@ BEGIN
IDS_CPLSYSTEMDESCRIPTION "Systeeminformatie weergeven en omgevingsinstellingen wijzigen."
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -270,4 +270,9 @@ BEGIN
IDS_PETABYTE "PB RAM"
IDS_VARIABLE "Zmienna"
IDS_VALUE "WartoϾ"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -265,4 +265,9 @@ BEGIN
IDS_PETABYTE "Ïá ÎÇÓ"
IDS_VARIABLE "Ïåðåìåííàÿ"
IDS_VALUE "Çíà÷åíèå"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -123,4 +123,9 @@ BEGIN
IDS_CPLSYSTEMDESCRIPTION "Se information om din dator och ändra olika system- och hårdvaruinställningar."
IDS_VARIABLE "Variable"
IDS_VALUE "Value"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -273,4 +273,9 @@ BEGIN
IDS_PETABYTE "PB of RAM"
IDS_VARIABLE "Çì³ííà"
IDS_VALUE "Çíà÷åííÿ"
IDS_NO_DUMP "(None)"
IDS_MINI_DUMP "Minidump(64KB)"
IDS_KERNEL_DUMP "Kernel dump"
IDS_FULL_DUMP "Complete dump"
END

View file

@ -20,6 +20,11 @@
#define IDS_VARIABLE 66
#define IDS_VALUE 67
#define IDS_NO_DUMP 68
#define IDS_MINI_DUMP 69
#define IDS_KERNEL_DUMP 70
#define IDS_FULL_DUMP 71
/* propsheet - general */
#define IDD_PROPPAGEGENERAL 100

View file

@ -6,13 +6,15 @@
* PURPOSE: Computer settings for startup and recovery
* COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
* Copyright 2006 Christoph von Wittich <Christoph@ApiViewer.de>
*
* Copyright 2007 Johannes Anderwald <johannes dot anderwald at student dot tugraz dot at>
*/
#include "precomp.h"
static TCHAR m_szFreeldrIni[MAX_PATH + 15];
static int m_FreeLdrIni = 0;
static TCHAR m_szDumpFile[MAX_PATH];
static TCHAR m_szMinidumpDir[MAX_PATH];
static DWORD m_dwCrashDumpEnabled = 0;
void SetTimeout(HWND hwndDlg, int Timeout)
{
if (Timeout == 0)
@ -399,9 +401,7 @@ LRESULT LoadOSList(HWND hwndDlg)
DWORD dwBufSize;
TCHAR *szSystemDrive;
HINF hInf;
SetDlgItemText(hwndDlg, IDC_STRRECDUMPFILE, _T("%SystemRoot%\\MiniDump"));
dwBufSize = GetSystemDrive(&szSystemDrive);
if (!dwBufSize)
return FALSE;
@ -450,6 +450,134 @@ LRESULT LoadOSList(HWND hwndDlg)
return FALSE;
}
void SetCrashDlgItems(HWND hwnd)
{
if (m_dwCrashDumpEnabled == 0)
{
/* no crash information required */
EnableWindow(GetDlgItem(hwnd, IDC_STRRECDUMPFILE), FALSE);
EnableWindow(GetDlgItem(hwnd, IDC_STRRECOVERWRITE), FALSE);
}
else if (m_dwCrashDumpEnabled == 3)
{
/* minidump type */
EnableWindow(GetDlgItem(hwnd, IDC_STRRECDUMPFILE), TRUE);
EnableWindow(GetDlgItem(hwnd, IDC_STRRECOVERWRITE), FALSE);
SendMessage(GetDlgItem(hwnd, IDC_STRRECDUMPFILE), WM_SETTEXT, (WPARAM)0, (LPARAM)m_szMinidumpDir);
}
else if (m_dwCrashDumpEnabled == 1 || m_dwCrashDumpEnabled == 2)
{
/* kernel or complete dump */
EnableWindow(GetDlgItem(hwnd, IDC_STRRECDUMPFILE), TRUE);
EnableWindow(GetDlgItem(hwnd, IDC_STRRECOVERWRITE), TRUE);
SendMessage(GetDlgItem(hwnd, IDC_STRRECDUMPFILE), WM_SETTEXT, (WPARAM)0, (LPARAM)m_szDumpFile);
}
SendDlgItemMessage(hwnd, IDC_STRRECDEBUGCOMBO, CB_SETCURSEL, (WPARAM)m_dwCrashDumpEnabled, (LPARAM)0);
}
void LoadRecoveryOptions(HWND hwndDlg)
{
HKEY hKey;
DWORD dwValues;
TCHAR szName[MAX_PATH];
TCHAR szValue[MAX_PATH];
DWORD i, dwName, dwValue, dwValueLength, dwType;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
_T("System\\CurrentControlSet\\Control\\CrashControl"),
0,
KEY_READ,
&hKey) != ERROR_SUCCESS)
{
/* failed to open key */
return;
}
if (RegQueryInfoKey(hKey,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
&dwValues,
NULL,
NULL,
NULL,
NULL) != ERROR_SUCCESS)
{
RegCloseKey(hKey);
return;
}
for (i = 0; i < dwValues; i++)
{
dwName = sizeof(szName) / sizeof(TCHAR);
RegEnumValue(hKey, i, szName, &dwName, NULL, &dwType, NULL, NULL);
if (dwType == REG_DWORD)
{
dwValueLength = sizeof(dwValue);
dwName = sizeof(szName) / sizeof(TCHAR);
if (RegEnumValue(hKey, i, szName, &dwName, NULL, &dwType, (LPBYTE)&dwValue, &dwValueLength) != ERROR_SUCCESS)
continue;
}
else
{
dwValueLength = sizeof(szValue);
dwName = sizeof(szName) / sizeof(TCHAR);
if (RegEnumValue(hKey, i, szName, &dwName, NULL, &dwType, (LPBYTE)&szValue, &dwValueLength) != ERROR_SUCCESS)
continue;
}
if (!_tcscmp(szName, _T("LogEvent")))
{
if (dwValue)
SendDlgItemMessage(hwndDlg, IDC_STRRECWRITEEVENT, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
}
else if (!_tcscmp(szName, _T("SendAlert")))
{
if (dwValue)
SendDlgItemMessage(hwndDlg, IDC_STRRECSENDALERT, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
}
else if (!_tcscmp(szName, _T("AutoReboot")))
{
if (dwValue)
SendDlgItemMessage(hwndDlg, IDC_STRRECRESTART, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
}
else if (!_tcscmp(szName, _T("Overwrite")))
{
if (dwValue)
SendDlgItemMessage(hwndDlg, IDC_STRRECOVERWRITE, BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0);
}
else if (!_tcscmp(szName, _T("DumpFile")))
{
_tcscpy(m_szDumpFile, szValue);
}
else if (!_tcscmp(szName, _T("MinidumpDir")))
{
_tcscpy(m_szMinidumpDir, szValue);
}
else if (!_tcscmp(szName, _T("CrashDumpEnabled")))
{
m_dwCrashDumpEnabled = dwValue;
}
}
if (LoadString(hApplet, IDS_NO_DUMP, szValue, sizeof(szValue) / sizeof(TCHAR)) < sizeof(szValue) / sizeof(TCHAR))
SendDlgItemMessage(hwndDlg, IDC_STRRECDEBUGCOMBO, CB_ADDSTRING, (WPARAM)0, (LPARAM) szValue);
if (LoadString(hApplet, IDS_FULL_DUMP, szValue, sizeof(szValue) / sizeof(TCHAR)) < sizeof(szValue) / sizeof(TCHAR))
SendDlgItemMessage(hwndDlg, IDC_STRRECDEBUGCOMBO, CB_ADDSTRING, (WPARAM)0, (LPARAM) szValue);
if (LoadString(hApplet, IDS_KERNEL_DUMP, szValue, sizeof(szValue) / sizeof(TCHAR)) < sizeof(szValue) / sizeof(TCHAR))
SendDlgItemMessage(hwndDlg, IDC_STRRECDEBUGCOMBO, CB_ADDSTRING, (WPARAM)0, (LPARAM) szValue);
if (LoadString(hApplet, IDS_MINI_DUMP, szValue, sizeof(szValue) / sizeof(TCHAR)) < sizeof(szValue) / sizeof(TCHAR))
SendDlgItemMessage(hwndDlg, IDC_STRRECDEBUGCOMBO, CB_ADDSTRING, (WPARAM)0, (LPARAM) szValue);
SetCrashDlgItems(hwndDlg);
RegCloseKey(hKey);
}
/* Property page dialog callback */
INT_PTR CALLBACK
@ -469,6 +597,7 @@ StartRecDlgProc(HWND hwndDlg,
{
case WM_INITDIALOG:
{
LoadRecoveryOptions(hwndDlg);
return LoadOSList(hwndDlg);
}
break;
@ -558,6 +687,30 @@ StartRecDlgProc(HWND hwndDlg,
else
SetTimeout(hwndDlg, 0);
}
case IDC_STRRECDEBUGCOMBO:
{
if (HIWORD(wParam) == CBN_SELCHANGE)
{
LRESULT lResult;
lResult = SendDlgItemMessage(hwndDlg, IDC_STRRECDEBUGCOMBO, CB_GETCURSEL, (WPARAM)0, (LPARAM)0);
if (lResult != CB_ERR && lResult != m_dwCrashDumpEnabled)
{
if (m_dwCrashDumpEnabled == 1 || m_dwCrashDumpEnabled == 2)
{
SendDlgItemMessage(hwndDlg, IDC_STRRECDUMPFILE, WM_GETTEXT, (WPARAM)sizeof(m_szDumpFile) / sizeof(TCHAR), (LPARAM)m_szDumpFile);
}
else if (m_dwCrashDumpEnabled == 3)
{
SendDlgItemMessage(hwndDlg, IDC_STRRECDUMPFILE, WM_GETTEXT, (WPARAM)sizeof(m_szMinidumpDir) / sizeof(TCHAR), (LPARAM)m_szMinidumpDir);
}
m_dwCrashDumpEnabled = lResult;
SetCrashDlgItems(hwndDlg);
}
}
break;
}
}
}
break;