d7b2f8d2dd73d6d9cf2e5fb70044c5f4b87fee28
[reactos.git] / reactos / dll / cpl / sysdm / virtmem.c
1 /*
2 * PROJECT: ReactOS system properties, control panel applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/sysdm/virtual.c
5 * PURPOSE: Virtual memory control dialog
6 * COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
7 *
8 */
9
10 #include "precomp.h"
11
12 static BOOL OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem);
13 static LPCTSTR lpKey = _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
14
15 static BOOL
16 ReadPageFileSettings(PVIRTMEM pVirtMem)
17 {
18 HKEY hkey = NULL;
19 DWORD dwType;
20 DWORD dwDataSize;
21 BOOL bRet = FALSE;
22
23 if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
24 lpKey,
25 0,
26 NULL,
27 REG_OPTION_NON_VOLATILE,
28 KEY_QUERY_VALUE,
29 NULL,
30 &hkey,
31 NULL) == ERROR_SUCCESS)
32 {
33 if (RegQueryValueEx(hkey,
34 _T("PagingFiles"),
35 NULL,
36 &dwType,
37 NULL,
38 &dwDataSize) == ERROR_SUCCESS)
39 {
40 pVirtMem->szPagingFiles = (LPTSTR)HeapAlloc(GetProcessHeap(),
41 0,
42 dwDataSize);
43 if (pVirtMem->szPagingFiles != NULL)
44 {
45 ZeroMemory(pVirtMem->szPagingFiles,
46 dwDataSize);
47 if (RegQueryValueEx(hkey,
48 _T("PagingFiles"),
49 NULL,
50 &dwType,
51 (PBYTE)pVirtMem->szPagingFiles,
52 &dwDataSize) == ERROR_SUCCESS)
53 {
54 bRet = TRUE;
55 }
56 }
57 }
58 }
59
60 if (!bRet)
61 ShowLastWin32Error(pVirtMem->hSelf);
62
63 if (hkey != NULL)
64 RegCloseKey(hkey);
65
66 return bRet;
67 }
68
69
70 static VOID
71 GetPageFileSizes(LPTSTR lpPageFiles,
72 LPINT lpInitialSize,
73 LPINT lpMaximumSize)
74 {
75 INT i = 0;
76
77 *lpInitialSize = -1;
78 *lpMaximumSize = -1;
79
80 while (*lpPageFiles != _T('\0'))
81 {
82 if (*lpPageFiles == _T(' '))
83 {
84 lpPageFiles++;
85
86 switch (i)
87 {
88 case 0:
89 *lpInitialSize = (INT)_ttoi(lpPageFiles);
90 i = 1;
91 break;
92
93 case 1:
94 *lpMaximumSize = (INT)_ttoi(lpPageFiles);
95 return;
96 }
97 }
98
99 lpPageFiles++;
100 }
101 }
102
103
104 static VOID
105 ParseMemSettings(PVIRTMEM pVirtMem)
106 {
107 TCHAR szDrives[1024]; // All drives
108 LPTSTR DrivePtr = szDrives;
109 TCHAR szDrive[3]; // Single drive
110 TCHAR szVolume[MAX_PATH + 1];
111 INT InitialSize;
112 INT MaximumSize;
113 INT DriveLen;
114 INT PgCnt = 0;
115 INT Len;
116
117 DriveLen = GetLogicalDriveStrings(1023,
118 szDrives);
119
120 while (DriveLen != 0)
121 {
122 Len = lstrlen(DrivePtr) + 1;
123 DriveLen -= Len;
124
125 DrivePtr = _tcsupr(DrivePtr);
126
127 /* Copy the 'X:' portion */
128 lstrcpyn(szDrive, DrivePtr, sizeof(szDrive) / sizeof(TCHAR));
129
130 if (GetDriveType(DrivePtr) == DRIVE_FIXED)
131 {
132 InitialSize = -1;
133 MaximumSize = -1;
134
135 /* Does drive match the one in the registry ? */
136 if (!_tcsncmp(pVirtMem->szPagingFiles, szDrive, 2))
137 {
138 GetPageFileSizes(pVirtMem->szPagingFiles,
139 &InitialSize,
140 &MaximumSize);
141 }
142
143 pVirtMem->Pagefile[PgCnt].InitialSize = InitialSize;
144 pVirtMem->Pagefile[PgCnt].MaximumSize = MaximumSize;
145 pVirtMem->Pagefile[PgCnt].bUsed = TRUE;
146 lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive);
147
148
149 /* Get the volume label if there is one */
150 if (GetVolumeInformation(DrivePtr,
151 szVolume,
152 MAX_PATH + 1,
153 NULL,
154 NULL,
155 NULL,
156 NULL,
157 0))
158 {
159 pVirtMem->Pagefile[PgCnt].pszVolume = HeapAlloc(GetProcessHeap(),
160 0,
161 (_tcslen(szVolume) + 1) * sizeof(TCHAR));
162 if (pVirtMem->Pagefile[PgCnt].pszVolume != NULL)
163 _tcscpy(pVirtMem->Pagefile[PgCnt].pszVolume, szVolume);
164 }
165
166 PgCnt++;
167 }
168
169 DrivePtr += Len;
170 }
171
172 pVirtMem->Count = PgCnt;
173 }
174
175
176 static VOID
177 WritePageFileSettings(PVIRTMEM pVirtMem)
178 {
179 HKEY hk = NULL;
180 TCHAR szPagingFiles[2048];
181 TCHAR szText[256];
182 INT i, nPos = 0;
183 BOOL bErr = TRUE;
184
185 for (i = 0; i < pVirtMem->Count; ++i)
186 {
187 if (pVirtMem->Pagefile[i].bUsed &&
188 pVirtMem->Pagefile[i].InitialSize != -1 &&
189 pVirtMem->Pagefile[i].MaximumSize != -1)
190 {
191 _stprintf(szText,
192 _T("%s\\pagefile.sys %i %i"),
193 pVirtMem->Pagefile[i].szDrive,
194 pVirtMem->Pagefile[i].InitialSize,
195 pVirtMem->Pagefile[i].MaximumSize);
196
197 /* Add it to our overall registry string */
198 lstrcpy(szPagingFiles + nPos, szText);
199
200 /* Record the position where the next string will start */
201 nPos += (INT)lstrlen(szText) + 1;
202
203 /* Add another NULL for REG_MULTI_SZ */
204 szPagingFiles[nPos] = _T('\0');
205 nPos++;
206 }
207 }
208
209 if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
210 lpKey,
211 0,
212 NULL,
213 REG_OPTION_NON_VOLATILE,
214 KEY_WRITE,
215 NULL,
216 &hk,
217 NULL) == ERROR_SUCCESS)
218 {
219 if (RegSetValueEx(hk,
220 _T("PagingFiles"),
221 0,
222 REG_MULTI_SZ,
223 (LPBYTE) szPagingFiles,
224 (DWORD) nPos * sizeof(TCHAR)) == ERROR_SUCCESS)
225 {
226 bErr = FALSE;
227 }
228
229 RegCloseKey(hk);
230 }
231
232 if (bErr)
233 ShowLastWin32Error(pVirtMem->hSelf);
234 }
235
236
237 static VOID
238 SetListBoxColumns(HWND hwndListBox)
239 {
240 RECT rect = {0, 0, 103, 0};
241 MapDialogRect(hwndListBox, &rect);
242
243 SendMessage(hwndListBox, LB_SETTABSTOPS, (WPARAM)1, (LPARAM)&rect.right);
244 }
245
246
247 static VOID
248 OnNoPagingFile(PVIRTMEM pVirtMem)
249 {
250 /* Disable the page file custom size boxes */
251 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
252 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
253 }
254
255
256 static VOID
257 OnSysManSize(PVIRTMEM pVirtMem)
258 {
259 /* Disable the page file custom size boxes */
260 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
261 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
262 }
263
264
265 static VOID
266 OnCustom(PVIRTMEM pVirtMem)
267 {
268 /* Enable the page file custom size boxes */
269 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), TRUE);
270 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
271 }
272
273
274 static VOID
275 InitPagefileList(PVIRTMEM pVirtMem)
276 {
277 TCHAR szDisplayString[256];
278 TCHAR szSize[64];
279 INT Index;
280 INT i;
281
282 for (i = 0; i < 26; i++)
283 {
284 if (pVirtMem->Pagefile[i].bUsed)
285 {
286 if ((pVirtMem->Pagefile[i].InitialSize == -1) &&
287 (pVirtMem->Pagefile[i].MaximumSize == -1))
288 {
289 LoadString(hApplet,
290 IDS_PAGEFILE_NONE,
291 szSize,
292 sizeof(szSize) / sizeof(szSize[0]));
293 }
294 else if ((pVirtMem->Pagefile[i].InitialSize == 0) &&
295 (pVirtMem->Pagefile[i].MaximumSize == 0))
296 {
297 LoadString(hApplet,
298 IDS_PAGEFILE_SYSTEM,
299 szSize,
300 sizeof(szSize) / sizeof(szSize[0]));
301 }
302 else
303 {
304 _stprintf(szSize, _T("%d - %d"),
305 pVirtMem->Pagefile[i].InitialSize,
306 pVirtMem->Pagefile[i].MaximumSize);
307 }
308
309 _stprintf(szDisplayString,
310 _T("%s [%s]\t%s"),
311 pVirtMem->Pagefile[i].szDrive,
312 pVirtMem->Pagefile[i].pszVolume ? pVirtMem->Pagefile[i].pszVolume : _T(""),
313 szSize);
314
315 Index = SendMessage(pVirtMem->hListBox, LB_ADDSTRING, (WPARAM)0, (LPARAM)szDisplayString);
316 SendMessage(pVirtMem->hListBox, LB_SETITEMDATA, Index, i);
317 }
318 }
319
320 SendMessage(pVirtMem->hListBox, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
321
322 OnSelChange(pVirtMem->hSelf, pVirtMem);
323 }
324
325
326 static VOID
327 UpdatePagefileEntry(PVIRTMEM pVirtMem,
328 INT ListIndex,
329 INT DriveIndex)
330 {
331 TCHAR szDisplayString[256];
332 TCHAR szSize[64];
333
334 if ((pVirtMem->Pagefile[DriveIndex].InitialSize == -1) &&
335 (pVirtMem->Pagefile[DriveIndex].MaximumSize == -1))
336 {
337 LoadString(hApplet,
338 IDS_PAGEFILE_NONE,
339 szSize,
340 sizeof(szSize) / sizeof(szSize[0]));
341 }
342 else if ((pVirtMem->Pagefile[DriveIndex].InitialSize == 0) &&
343 (pVirtMem->Pagefile[DriveIndex].MaximumSize == 0))
344 {
345 LoadString(hApplet,
346 IDS_PAGEFILE_SYSTEM,
347 szSize,
348 sizeof(szSize) / sizeof(szSize[0]));
349 }
350 else
351 {
352 _stprintf(szSize,
353 _T("%d - %d"),
354 pVirtMem->Pagefile[DriveIndex].InitialSize,
355 pVirtMem->Pagefile[DriveIndex].MaximumSize);
356 }
357
358 _stprintf(szDisplayString,
359 _T("%s [%s]\t%s"),
360 pVirtMem->Pagefile[DriveIndex].szDrive,
361 pVirtMem->Pagefile[DriveIndex].pszVolume ? pVirtMem->Pagefile[DriveIndex].pszVolume : L"",
362 szSize);
363
364 SendMessage(pVirtMem->hListBox, LB_DELETESTRING, (WPARAM)ListIndex, 0);
365 SendMessage(pVirtMem->hListBox, LB_INSERTSTRING, (WPARAM)ListIndex, (LPARAM)szDisplayString);
366 SendMessage(pVirtMem->hListBox, LB_SETCURSEL, (WPARAM)ListIndex, 0);
367 }
368
369
370 static VOID
371 OnSet(PVIRTMEM pVirtMem)
372 {
373 INT Index;
374 UINT InitialSize = -1;
375 UINT MaximumSize = -1;
376 BOOL bTranslated;
377 INT DriveIndex = 0;
378
379 Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
380 IDC_PAGEFILELIST,
381 LB_GETCURSEL,
382 0,
383 0);
384 if (Index >= 0 && Index < pVirtMem->Count)
385 {
386 DriveIndex = SendDlgItemMessage(pVirtMem->hSelf,
387 IDC_PAGEFILELIST,
388 LB_GETITEMDATA,
389 0,
390 0);
391
392 /* Check if custom settings are checked */
393 if (IsDlgButtonChecked(pVirtMem->hSelf,
394 IDC_CUSTOM) == BST_CHECKED)
395 {
396 InitialSize = GetDlgItemInt(pVirtMem->hSelf,
397 IDC_INITIALSIZE,
398 &bTranslated,
399 FALSE);
400 if (!bTranslated)
401 {
402 ResourceMessageBox(hApplet,
403 NULL,
404 MB_ICONWARNING | MB_OK,
405 IDS_MESSAGEBOXTITLE,
406 IDS_WARNINITIALSIZE);
407 return;
408 }
409
410 MaximumSize = GetDlgItemInt(pVirtMem->hSelf,
411 IDC_MAXSIZE,
412 &bTranslated,
413 FALSE);
414 if (!bTranslated)
415 {
416 ResourceMessageBox(hApplet,
417 NULL,
418 MB_ICONWARNING | MB_OK,
419 IDS_MESSAGEBOXTITLE,
420 IDS_WARNMAXIMUMSIZE);
421 return;
422 }
423
424 /* Check the valid range of the inial size */
425 if (InitialSize < 2 ||
426 InitialSize > pVirtMem->Pagefile[DriveIndex].FreeSize)
427 {
428 ResourceMessageBox(hApplet,
429 NULL,
430 MB_ICONWARNING | MB_OK,
431 IDS_MESSAGEBOXTITLE,
432 IDS_WARNINITIALRANGE);
433 return;
434 }
435
436 /* Check the valid range of the maximum size */
437 if (MaximumSize < InitialSize ||
438 MaximumSize > pVirtMem->Pagefile[DriveIndex].FreeSize)
439 {
440 ResourceMessageBox(hApplet,
441 NULL,
442 MB_ICONWARNING | MB_OK,
443 IDS_MESSAGEBOXTITLE,
444 IDS_WARNMAXIMUMRANGE);
445 return;
446 }
447
448 if ((pVirtMem->Pagefile[DriveIndex].InitialSize != InitialSize) &&
449 (pVirtMem->Pagefile[DriveIndex].MaximumSize != MaximumSize))
450 pVirtMem->bModified = TRUE;
451
452 pVirtMem->Pagefile[DriveIndex].InitialSize = InitialSize;
453 pVirtMem->Pagefile[DriveIndex].MaximumSize = MaximumSize;
454 pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
455 }
456 else if (IsDlgButtonChecked(pVirtMem->hSelf,
457 IDC_NOPAGEFILE) == BST_CHECKED)
458 {
459 if ((pVirtMem->Pagefile[DriveIndex].InitialSize != InitialSize) &&
460 (pVirtMem->Pagefile[DriveIndex].MaximumSize != MaximumSize))
461 pVirtMem->bModified = TRUE;
462
463 /* Set sizes to -1 */
464 pVirtMem->Pagefile[DriveIndex].InitialSize = -1;
465 pVirtMem->Pagefile[DriveIndex].MaximumSize = -1;
466 pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
467 }
468 else
469 {
470 if ((pVirtMem->Pagefile[DriveIndex].InitialSize != InitialSize) &&
471 (pVirtMem->Pagefile[DriveIndex].MaximumSize != MaximumSize))
472 pVirtMem->bModified = TRUE;
473
474 pVirtMem->Pagefile[DriveIndex].InitialSize = 0;
475 pVirtMem->Pagefile[DriveIndex].MaximumSize = 0;
476 pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
477 }
478
479 UpdatePagefileEntry(pVirtMem, Index, DriveIndex);
480 }
481 }
482
483
484 static BOOL
485 OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
486 {
487 TCHAR szBuffer[64];
488 MEMORYSTATUSEX MemoryStatus;
489 ULARGE_INTEGER FreeDiskSpace;
490 UINT /*i,*/ FreeMemMb /*, PageFileSizeMb*/;
491 INT Index;
492
493 Index = (INT)SendDlgItemMessage(hwndDlg,
494 IDC_PAGEFILELIST,
495 LB_GETCURSEL,
496 0,
497 0);
498 if (Index >= 0 && Index < pVirtMem->Count)
499 {
500 /* Set drive letter */
501 SetDlgItemText(hwndDlg, IDC_DRIVE,
502 pVirtMem->Pagefile[Index].szDrive);
503
504 /* Set available disk space */
505 if (GetDiskFreeSpaceEx(pVirtMem->Pagefile[Index].szDrive,
506 NULL, NULL, &FreeDiskSpace))
507 {
508 pVirtMem->Pagefile[Index].FreeSize = (UINT)(FreeDiskSpace.QuadPart / (1024 * 1024));
509 _stprintf(szBuffer, _T("%u MB"), pVirtMem->Pagefile[Index].FreeSize);
510 SetDlgItemText(hwndDlg, IDC_SPACEAVAIL, szBuffer);
511 }
512
513 if (pVirtMem->Pagefile[Index].InitialSize == -1 &&
514 pVirtMem->Pagefile[Index].MaximumSize == -1)
515 {
516 /* No pagefile */
517
518 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
519 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
520
521 CheckDlgButton(pVirtMem->hSelf, IDC_NOPAGEFILE, BST_CHECKED);
522 }
523 else if (pVirtMem->Pagefile[Index].InitialSize == 0 &&
524 pVirtMem->Pagefile[Index].MaximumSize == 0)
525 {
526 /* System managed size*/
527
528 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
529 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
530
531 CheckDlgButton(pVirtMem->hSelf, IDC_SYSMANSIZE, BST_CHECKED);
532 }
533 else
534 {
535 /* Custom size */
536
537 /* Enable and fill the custom values */
538 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
539 EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), TRUE);
540
541 SetDlgItemInt(pVirtMem->hSelf,
542 IDC_INITIALSIZE,
543 pVirtMem->Pagefile[Index].InitialSize,
544 FALSE);
545
546 SetDlgItemInt(pVirtMem->hSelf,
547 IDC_MAXSIZE,
548 pVirtMem->Pagefile[Index].MaximumSize,
549 FALSE);
550
551 CheckDlgButton(pVirtMem->hSelf,
552 IDC_CUSTOM,
553 BST_CHECKED);
554 }
555
556 /* Set minimum pagefile size */
557 SetDlgItemText(hwndDlg, IDC_MINIMUM, _T("2 MB"));
558
559 /* Set recommended pagefile size */
560 MemoryStatus.dwLength = sizeof(MEMORYSTATUSEX);
561 if (GlobalMemoryStatusEx(&MemoryStatus))
562 {
563 FreeMemMb = (UINT)(MemoryStatus.ullTotalPhys / (1024 * 1024));
564 _stprintf(szBuffer, _T("%u MB"), FreeMemMb + (FreeMemMb / 2));
565 SetDlgItemText(hwndDlg, IDC_RECOMMENDED, szBuffer);
566 }
567
568 /* Set current pagefile size */
569 #if 0
570 PageFileSizeMb = 0;
571 for (i = 0; i < 26; i++)
572 {
573 PageFileSizeMb += pVirtMem->Pagefile[i].InitialSize;
574 }
575 _stprintf(szBuffer, _T("%u MB"), PageFileSizeMb);
576 SetDlgItemText(hwndDlg, IDC_CURRENT, szBuffer);
577 #endif
578 }
579
580 return TRUE;
581 }
582
583
584 static VOID
585 OnOk(PVIRTMEM pVirtMem)
586 {
587 if (pVirtMem->bModified == TRUE)
588 {
589 ResourceMessageBox(hApplet,
590 NULL,
591 MB_ICONINFORMATION | MB_OK,
592 IDS_MESSAGEBOXTITLE,
593 IDS_INFOREBOOT);
594
595 WritePageFileSettings(pVirtMem);
596 }
597 }
598
599
600 static VOID
601 OnInitDialog(HWND hwnd, PVIRTMEM pVirtMem)
602 {
603 INT i;
604
605 pVirtMem->hSelf = hwnd;
606 pVirtMem->hListBox = GetDlgItem(hwnd, IDC_PAGEFILELIST);
607 pVirtMem->bModified = FALSE;
608
609 SetListBoxColumns(pVirtMem->hListBox);
610
611 for (i = 0; i < 26; i++)
612 {
613 pVirtMem->Pagefile[i].bUsed = FALSE;
614 pVirtMem->Pagefile[i].InitialSize = -1;
615 pVirtMem->Pagefile[i].MaximumSize = -1;
616 }
617
618 /* Load the pagefile systems from the reg */
619 ReadPageFileSettings(pVirtMem);
620
621 /* Parse our settings and set up dialog */
622 ParseMemSettings(pVirtMem);
623
624 InitPagefileList(pVirtMem);
625 }
626
627
628 static VOID
629 OnDestroy(PVIRTMEM pVirtMem)
630 {
631 INT i;
632
633 for (i = 0; i < 26; i++)
634 {
635 if (pVirtMem->Pagefile[i].pszVolume != NULL)
636 HeapFree(GetProcessHeap(), 0, pVirtMem->Pagefile[i].pszVolume);
637 }
638
639 if (pVirtMem->szPagingFiles)
640 HeapFree(GetProcessHeap(), 0, pVirtMem->szPagingFiles);
641
642 HeapFree(GetProcessHeap(), 0, pVirtMem);
643 }
644
645
646 INT_PTR CALLBACK
647 VirtMemDlgProc(HWND hwndDlg,
648 UINT uMsg,
649 WPARAM wParam,
650 LPARAM lParam)
651 {
652 PVIRTMEM pVirtMem;
653
654 UNREFERENCED_PARAMETER(lParam);
655
656 pVirtMem = (PVIRTMEM)GetWindowLongPtr(hwndDlg, DWLP_USER);
657
658 switch (uMsg)
659 {
660 case WM_INITDIALOG:
661 pVirtMem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(VIRTMEM));
662 if (pVirtMem == NULL)
663 {
664 EndDialog(hwndDlg, 0);
665 return FALSE;
666 }
667
668 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pVirtMem);
669
670 OnInitDialog(hwndDlg, pVirtMem);
671 break;
672
673 case WM_DESTROY:
674 OnDestroy(pVirtMem);
675 break;
676
677 case WM_COMMAND:
678 switch (LOWORD(wParam))
679 {
680 case IDCANCEL:
681 EndDialog(hwndDlg, 0);
682 return TRUE;
683
684 case IDOK:
685 OnOk(pVirtMem);
686 EndDialog(hwndDlg, pVirtMem->bModified);
687 return TRUE;
688
689 case IDC_NOPAGEFILE:
690 OnNoPagingFile(pVirtMem);
691 return TRUE;
692
693 case IDC_SYSMANSIZE:
694 OnSysManSize(pVirtMem);
695 return TRUE;
696
697 case IDC_CUSTOM:
698 OnCustom(pVirtMem);
699 return TRUE;
700
701 case IDC_SET:
702 OnSet(pVirtMem);
703 return TRUE;
704
705 case IDC_PAGEFILELIST:
706 switch (HIWORD(wParam))
707 {
708 case LBN_SELCHANGE:
709 OnSelChange(hwndDlg, pVirtMem);
710 return TRUE;
711 }
712 break;
713 }
714 break;
715 }
716
717 return FALSE;
718 }