X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fdll%2Fcpl%2Fsysdm%2Fvirtmem.c;h=5dc572c01387ca6bc279a728e6a19391a64eb60c;hp=6dcd9ad64574d59550532475009e7edae4ab3dcd;hb=23e08cb25eb507f574c229361bf35ecfd7ea3d2c;hpb=4fad7fd6167df49b3746c321874ae4a8d558f454 diff --git a/reactos/dll/cpl/sysdm/virtmem.c b/reactos/dll/cpl/sysdm/virtmem.c index 6dcd9ad6457..5dc572c0138 100644 --- a/reactos/dll/cpl/sysdm/virtmem.c +++ b/reactos/dll/cpl/sysdm/virtmem.c @@ -220,7 +220,7 @@ WritePageFileSettings(PVIRTMEM pVirtMem) pVirtMem->Pagefile[i].MaxValue); /* Add it to our overall registry string */ - lstrcat(szPagingFiles + nPos, szText); + lstrcpy(szPagingFiles + nPos, szText); /* Record the position where the next string will start */ nPos += (INT)lstrlen(szText) + 1; @@ -299,8 +299,11 @@ static VOID OnSet(PVIRTMEM pVirtMem) { INT Index; - UINT Value; + UINT InitValue; + UINT MaxValue; BOOL bTranslated; + TCHAR szTitle[64]; + TCHAR szMessage[256]; pVirtMem->bSave = TRUE; @@ -315,41 +318,61 @@ OnSet(PVIRTMEM pVirtMem) if (IsDlgButtonChecked(pVirtMem->hSelf, IDC_CUSTOM) == BST_CHECKED) { - Value = GetDlgItemInt(pVirtMem->hSelf, - IDC_INITIALSIZE, - &bTranslated, - FALSE); + InitValue = GetDlgItemInt(pVirtMem->hSelf, + IDC_INITIALSIZE, + &bTranslated, + FALSE); if (!bTranslated) { - /* FIXME: Show error message instead of setting the edit - field to the previous value */ - SetDlgItemInt(pVirtMem->hSelf, - IDC_INITIALSIZE, - pVirtMem->Pagefile[Index].InitialValue, - FALSE); - } - else - { - pVirtMem->Pagefile[Index].InitialValue = Value; + if (LoadString(hApplet, + IDS_MESSAGEBOXTITLE, + szTitle, + sizeof(szTitle) / sizeof(szTitle[0])) == 0) + _tcscpy(szTitle, _T("System control panel applet")); + + if (LoadString(hApplet, + IDS_WARNINITIALSIZE, + szMessage, + sizeof(szMessage) / sizeof(szMessage[0])) == 0) + _tcscpy(szMessage, _T("Enter a numeric value for the initial size of the paging file.")); + + MessageBox(NULL, + szMessage, + szTitle, + MB_ICONWARNING | MB_OK); + return; } - Value = GetDlgItemInt(pVirtMem->hSelf, - IDC_MAXSIZE, - &bTranslated, - FALSE); + MaxValue = GetDlgItemInt(pVirtMem->hSelf, + IDC_MAXSIZE, + &bTranslated, + FALSE); if (!bTranslated) { - /* FIXME: Show error message instead of setting the edit - field to the previous value */ - SetDlgItemInt(pVirtMem->hSelf, - IDC_MAXSIZE, - pVirtMem->Pagefile[Index].MaxValue, - FALSE); - } - else - { - pVirtMem->Pagefile[Index].MaxValue = Value; + if (LoadString(hApplet, + IDS_MESSAGEBOXTITLE, + szTitle, + sizeof(szTitle) / sizeof(szTitle[0])) == 0) + _tcscpy(szTitle, _T("System control panel applet")); + + if (LoadString(hApplet, + IDS_WARNMAXIMUMSIZE, + szMessage, + sizeof(szMessage) / sizeof(szMessage[0])) == 0) + _tcscpy(szMessage, _T("Enter a numeric value for the maximum size of the paging file.")); + + MessageBox(NULL, + szMessage, + szTitle, + MB_ICONWARNING | MB_OK); + return; } + + /* FIXME: Add more file size checks! */ + + pVirtMem->Pagefile[Index].InitialValue = InitValue; + pVirtMem->Pagefile[Index].MaxValue = MaxValue; + pVirtMem->Pagefile[Index].bUsed = TRUE; } else {