- Check the custom paging file sizes for being within useful limits and display warnings if these limit were exceeded.
- Translators: Please translate the message strings!

svn path=/trunk/; revision=47534
This commit is contained in:
Eric Kohl 2010-06-03 13:17:33 +00:00
parent 447be42c33
commit 65435e1b84
5 changed files with 83 additions and 32 deletions

View file

@ -202,7 +202,7 @@ BEGIN
LTEXT "", IDC_SPACEAVAIL, 105, 92, 104, 9
LTEXT "&Anfangsgröße (MB):", -1, 22, 118, 70, 9
LTEXT "Ma&ximale Größe (MB):", -1, 22, 131, 75, 9
AUTORADIOBUTTON "&Benutzerdefinierte Größe", IDC_CUSTOM, 20, 105, 90, 9, WS_GROUP
AUTORADIOBUTTON "&Benutzerdefinierte Größe", IDC_CUSTOM, 20, 105, 95, 9, WS_GROUP
AUTORADIOBUTTON "Größe wird vom &System verwaltet", IDC_SYSMANSIZE, 20, 145, 120, 9
AUTORADIOBUTTON "&Keine Auslagerungsdatei", IDC_NOPAGEFILE, 20, 158, 90, 9
EDITTEXT IDC_INITIALSIZE, 100, 114, 44, 13, NOT WS_BORDER, WS_EX_CLIENTEDGE
@ -292,5 +292,7 @@ BEGIN
IDS_MESSAGEBOXTITLE "Systemsteuerungsoption ""System"""
IDS_WARNINITIALSIZE "Geben Sie einen numerischen Wert für die Anfangsgröße der Auslagerungsdatei an."
IDS_WARNMAXIMUMSIZE "Geben Sie einen numerischen Wert für die Maximalgröße der Auslagerungsdatei an."
IDS_WARNINITIALRANGE "Die Anfangsgröße der Auslagerungsdatei darf nicht kleiner als 2 MB sein und darf den verfügbaren Speicherplatz auf dem gewählten Laufwerk nicht überschreiten."
IDS_WARNMAXIMUMRANGE "Die Maximalgröße der Auslagerungsdatei darf nicht kleiner als die Anfangsgröße sein und darf den verfügbaren Speicherplatz auf dem gewählten Laufwerk nicht überschreiten."
IDS_DEVS "\nReactOS Team\n\nProjektkoordinator\n\nAleksey Bragin\n\nEntwicklerteam\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Verantwortliche\n\nColin Finck\nZ98\n\nWebseitenteam\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedienteam\n\nMindflyer\nWierd_W\n\nweiterer Dank geht an\n\nalle Mitwirkenden\nWine Team\n\n"
END

View file

@ -287,5 +287,7 @@ BEGIN
IDS_MESSAGEBOXTITLE "System control panel applet"
IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file."
IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file."
IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB and must not exceed the available space on the selected drive."
IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size and must not exceed the available space on the selected drive."
IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n"
END

View file

@ -50,8 +50,9 @@ INT_PTR CALLBACK LicenceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
typedef struct _PAGEFILE
{
TCHAR szDrive[3];
INT InitialValue;
INT MaxValue;
INT InitialSize;
INT MaximumSize;
INT FreeSize;
BOOL bUsed;
} PAGEFILE, *PPAGEFILE;

View file

@ -35,6 +35,8 @@
#define IDS_MESSAGEBOXTITLE 77
#define IDS_WARNINITIALSIZE 78
#define IDS_WARNMAXIMUMSIZE 79
#define IDS_WARNINITIALRANGE 80
#define IDS_WARNMAXIMUMRANGE 81
/* propsheet - general */
#define IDD_PROPPAGEGENERAL 100

View file

@ -110,7 +110,7 @@ ParseMemSettings(PVIRTMEM pVirtMem)
TCHAR szVolume[MAX_PATH];
TCHAR *szDisplayString;
INT InitialSize = 0;
INT MaxSize = 0;
INT MaximumSize = 0;
INT DriveLen;
INT PgCnt = 0;
@ -141,17 +141,17 @@ ParseMemSettings(PVIRTMEM pVirtMem)
/* FIXME: we only check the first available pagefile in the reg */
GetPageFileSizes(pVirtMem->szPagingFiles,
&InitialSize,
&MaxSize);
&MaximumSize);
pVirtMem->Pagefile[PgCnt].InitialValue = InitialSize;
pVirtMem->Pagefile[PgCnt].MaxValue = MaxSize;
pVirtMem->Pagefile[PgCnt].InitialSize = InitialSize;
pVirtMem->Pagefile[PgCnt].MaximumSize = MaximumSize;
pVirtMem->Pagefile[PgCnt].bUsed = TRUE;
lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive);
}
else
{
pVirtMem->Pagefile[PgCnt].InitialValue = 0;
pVirtMem->Pagefile[PgCnt].MaxValue = 0;
pVirtMem->Pagefile[PgCnt].InitialSize = 0;
pVirtMem->Pagefile[PgCnt].MaximumSize = 0;
pVirtMem->Pagefile[PgCnt].bUsed = FALSE;
lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive);
}
@ -177,11 +177,11 @@ ParseMemSettings(PVIRTMEM pVirtMem)
}
}
if ((InitialSize != 0) || (MaxSize != 0))
if ((InitialSize != 0) || (MaximumSize != 0))
{
TCHAR szSize[64];
_stprintf(szSize, _T("%i - %i"), InitialSize, MaxSize);
_stprintf(szSize, _T("%i - %i"), InitialSize, MaximumSize);
_tcscat(szDisplayString, _T("\t"));
_tcscat(szDisplayString, szSize);
}
@ -216,8 +216,8 @@ WritePageFileSettings(PVIRTMEM pVirtMem)
{
_stprintf(szText, _T("%s\\pagefile.sys %i %i"),
pVirtMem->Pagefile[i].szDrive,
pVirtMem->Pagefile[i].InitialValue,
pVirtMem->Pagefile[i].MaxValue);
pVirtMem->Pagefile[i].InitialSize,
pVirtMem->Pagefile[i].MaximumSize);
/* Add it to our overall registry string */
lstrcpy(szPagingFiles + nPos, szText);
@ -299,8 +299,8 @@ static VOID
OnSet(PVIRTMEM pVirtMem)
{
INT Index;
UINT InitValue;
UINT MaxValue;
UINT InitialSize;
UINT MaximumSize;
BOOL bTranslated;
TCHAR szTitle[64];
TCHAR szMessage[256];
@ -318,10 +318,10 @@ OnSet(PVIRTMEM pVirtMem)
if (IsDlgButtonChecked(pVirtMem->hSelf,
IDC_CUSTOM) == BST_CHECKED)
{
InitValue = GetDlgItemInt(pVirtMem->hSelf,
IDC_INITIALSIZE,
&bTranslated,
FALSE);
InitialSize = GetDlgItemInt(pVirtMem->hSelf,
IDC_INITIALSIZE,
&bTranslated,
FALSE);
if (!bTranslated)
{
if (LoadString(hApplet,
@ -343,10 +343,10 @@ OnSet(PVIRTMEM pVirtMem)
return;
}
MaxValue = GetDlgItemInt(pVirtMem->hSelf,
IDC_MAXSIZE,
&bTranslated,
FALSE);
MaximumSize = GetDlgItemInt(pVirtMem->hSelf,
IDC_MAXSIZE,
&bTranslated,
FALSE);
if (!bTranslated)
{
if (LoadString(hApplet,
@ -368,16 +368,59 @@ OnSet(PVIRTMEM pVirtMem)
return;
}
/* FIXME: Add more file size checks! */
/* Check the valid range of the inial size */
if (InitialSize < 2 ||
InitialSize > pVirtMem->Pagefile[Index].FreeSize)
{
if (LoadString(hApplet,
IDS_MESSAGEBOXTITLE,
szTitle,
sizeof(szTitle) / sizeof(szTitle[0])) == 0)
_tcscpy(szTitle, _T("System control panel applet"));
pVirtMem->Pagefile[Index].InitialValue = InitValue;
pVirtMem->Pagefile[Index].MaxValue = MaxValue;
LoadString(hApplet,
IDS_WARNINITIALRANGE,
szMessage,
sizeof(szMessage) / sizeof(szMessage[0]));
MessageBox(NULL,
szMessage,
szTitle,
MB_ICONWARNING | MB_OK);
return;
}
/* Check the valid range of the maximum size */
if (MaximumSize < InitialSize ||
MaximumSize > pVirtMem->Pagefile[Index].FreeSize)
{
if (LoadString(hApplet,
IDS_MESSAGEBOXTITLE,
szTitle,
sizeof(szTitle) / sizeof(szTitle[0])) == 0)
_tcscpy(szTitle, _T("System control panel applet"));
LoadString(hApplet,
IDS_WARNMAXIMUMRANGE,
szMessage,
sizeof(szMessage) / sizeof(szMessage[0]));
MessageBox(NULL,
szMessage,
szTitle,
MB_ICONWARNING | MB_OK);
return;
}
pVirtMem->Pagefile[Index].InitialSize = InitialSize;
pVirtMem->Pagefile[Index].MaximumSize = MaximumSize;
pVirtMem->Pagefile[Index].bUsed = TRUE;
}
else
{
/* set sizes to 0 */
pVirtMem->Pagefile[Index].InitialValue = pVirtMem->Pagefile[Index].MaxValue = 0;
pVirtMem->Pagefile[Index].InitialSize = 0;
pVirtMem->Pagefile[Index].MaximumSize = 0;
// check to see if this drive is used for a paging file
if (IsDlgButtonChecked(pVirtMem->hSelf,
@ -420,12 +463,13 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
if (GetDiskFreeSpaceEx(pVirtMem->Pagefile[Index].szDrive,
NULL, NULL, &FreeBytes))
{
pVirtMem->Pagefile[Index].FreeSize = FreeBytes.QuadPart >> 20;
_stprintf(szBuffer, _T("%I64u MB"), FreeBytes.QuadPart / (1024 * 1024));
SetDlgItemText(hwndDlg, IDC_SPACEAVAIL, szBuffer);
}
if (pVirtMem->Pagefile[Index].InitialValue != 0 &&
pVirtMem->Pagefile[Index].MaxValue != 0)
if (pVirtMem->Pagefile[Index].InitialSize != 0 &&
pVirtMem->Pagefile[Index].MaximumSize != 0)
{
/* enable and fill the custom values */
EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
@ -433,12 +477,12 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
SetDlgItemInt(pVirtMem->hSelf,
IDC_INITIALSIZE,
pVirtMem->Pagefile[Index].InitialValue,
pVirtMem->Pagefile[Index].InitialSize,
FALSE);
SetDlgItemInt(pVirtMem->hSelf,
IDC_MAXSIZE,
pVirtMem->Pagefile[Index].MaxValue,
pVirtMem->Pagefile[Index].MaximumSize,
FALSE);
CheckDlgButton(pVirtMem->hSelf,
@ -482,7 +526,7 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
FileSize = 0;
for (i = 0; i < 26; i++)
{
FileSize += pVirtMem->Pagefile[i].InitialValue;
FileSize += pVirtMem->Pagefile[i].InitialSize;
}
_stprintf(szBuffer, _T("%u MB"), FileSize);
SetDlgItemText(hwndDlg, IDC_CURRENT, szBuffer);