ReactOS  0.4.15-dev-1070-ge1a01de
virtmem.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS system properties, control panel applet
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: dll/cpl/sysdm/virtmem.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 #define NDEBUG
13 #include <debug.h>
14 
15 static BOOL OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem);
16 static LPCTSTR lpKey = _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
17 
18 static BOOL
20 {
21  HKEY hkey = NULL;
22  DWORD dwType;
23  DWORD dwDataSize;
24  BOOL bRet = FALSE;
25 
27  lpKey,
28  0,
29  NULL,
32  NULL,
33  &hkey,
34  NULL) == ERROR_SUCCESS)
35  {
36  if (RegQueryValueEx(hkey,
37  _T("PagingFiles"),
38  NULL,
39  &dwType,
40  NULL,
41  &dwDataSize) == ERROR_SUCCESS)
42  {
44  0,
45  dwDataSize);
46  if (pVirtMem->szPagingFiles != NULL)
47  {
48  ZeroMemory(pVirtMem->szPagingFiles,
49  dwDataSize);
50  if (RegQueryValueEx(hkey,
51  _T("PagingFiles"),
52  NULL,
53  &dwType,
54  (PBYTE)pVirtMem->szPagingFiles,
55  &dwDataSize) == ERROR_SUCCESS)
56  {
57  bRet = TRUE;
58  }
59  }
60  }
61  }
62 
63  if (!bRet)
64  ShowLastWin32Error(pVirtMem->hSelf);
65 
66  if (hkey != NULL)
67  RegCloseKey(hkey);
68 
69  return bRet;
70 }
71 
72 
73 static VOID
75  LPINT lpInitialSize,
76  LPINT lpMaximumSize)
77 {
78  INT i = 0;
79 
80  *lpInitialSize = -1;
81  *lpMaximumSize = -1;
82 
83  while (*lpPageFiles != _T('\0'))
84  {
85  if (*lpPageFiles == _T(' '))
86  {
87  lpPageFiles++;
88 
89  switch (i)
90  {
91  case 0:
92  *lpInitialSize = (INT)_ttoi(lpPageFiles);
93  i = 1;
94  break;
95 
96  case 1:
97  *lpMaximumSize = (INT)_ttoi(lpPageFiles);
98  return;
99  }
100  }
101 
102  lpPageFiles++;
103  }
104 }
105 
106 
107 static VOID
109 {
110  TCHAR szDrives[1024]; // All drives
111  LPTSTR DrivePtr = szDrives;
112  TCHAR szDrive[3]; // Single drive
113  TCHAR szVolume[MAX_PATH + 1];
114  INT MinSize;
115  INT MaxSize;
116  INT DriveLen;
117  INT PgCnt = 0;
118  INT Len;
119 
120  DriveLen = GetLogicalDriveStrings(1023,
121  szDrives);
122 
123  while (DriveLen != 0)
124  {
125  Len = lstrlen(DrivePtr) + 1;
126  DriveLen -= Len;
127 
128  DrivePtr = _tcsupr(DrivePtr);
129 
130  /* Copy the 'X:' portion */
131  lstrcpyn(szDrive, DrivePtr, sizeof(szDrive) / sizeof(TCHAR));
132 
133  if (GetDriveType(DrivePtr) == DRIVE_FIXED)
134  {
135  MinSize = -1;
136  MaxSize = -1;
137 
138  /* Does drive match the one in the registry ? */
139  if (!_tcsncmp(pVirtMem->szPagingFiles, szDrive, 2))
140  {
142  &MinSize,
143  &MaxSize);
144  }
145 
146  pVirtMem->Pagefile[PgCnt].OldMinSize = MinSize;
147  pVirtMem->Pagefile[PgCnt].OldMaxSize = MaxSize;
148  pVirtMem->Pagefile[PgCnt].NewMinSize = MinSize;
149  pVirtMem->Pagefile[PgCnt].NewMaxSize = MaxSize;
150  pVirtMem->Pagefile[PgCnt].bUsed = TRUE;
151  lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive);
152 
153 
154  /* Get the volume label if there is one */
155  if (GetVolumeInformation(DrivePtr,
156  szVolume,
157  MAX_PATH + 1,
158  NULL,
159  NULL,
160  NULL,
161  NULL,
162  0))
163  {
164  pVirtMem->Pagefile[PgCnt].pszVolume = HeapAlloc(GetProcessHeap(),
165  0,
166  (_tcslen(szVolume) + 1) * sizeof(TCHAR));
167  if (pVirtMem->Pagefile[PgCnt].pszVolume != NULL)
168  _tcscpy(pVirtMem->Pagefile[PgCnt].pszVolume, szVolume);
169  }
170 
171  PgCnt++;
172  }
173 
174  DrivePtr += Len;
175  }
176 
177  pVirtMem->Count = PgCnt;
178 }
179 
180 
181 static VOID
183 {
184  HKEY hk = NULL;
185  TCHAR szPagingFiles[2048];
186  TCHAR szText[256];
187  INT i, nPos = 0;
188  BOOL bErr = TRUE;
189 
190  for (i = 0; i < pVirtMem->Count; ++i)
191  {
192  if (pVirtMem->Pagefile[i].bUsed &&
193  pVirtMem->Pagefile[i].NewMinSize != -1 &&
194  pVirtMem->Pagefile[i].NewMaxSize != -1)
195  {
197  _T("%s\\pagefile.sys %i %i"),
198  pVirtMem->Pagefile[i].szDrive,
199  pVirtMem->Pagefile[i].NewMinSize,
200  pVirtMem->Pagefile[i].NewMaxSize);
201 
202  /* Add it to our overall registry string */
203  lstrcpy(szPagingFiles + nPos, szText);
204 
205  /* Record the position where the next string will start */
206  nPos += (INT)lstrlen(szText) + 1;
207 
208  /* Add another NULL for REG_MULTI_SZ */
209  szPagingFiles[nPos] = _T('\0');
210  nPos++;
211  }
212  }
213 
215  lpKey,
216  0,
217  NULL,
219  KEY_WRITE,
220  NULL,
221  &hk,
222  NULL) == ERROR_SUCCESS)
223  {
224  if (RegSetValueEx(hk,
225  _T("PagingFiles"),
226  0,
227  REG_MULTI_SZ,
228  (LPBYTE) szPagingFiles,
229  (DWORD) nPos * sizeof(TCHAR)) == ERROR_SUCCESS)
230  {
231  bErr = FALSE;
232  }
233 
234  RegCloseKey(hk);
235  }
236 
237  if (bErr == FALSE)
238  {
239  /* Delete obsolete paging files on the next boot */
240  for (i = 0; i < 26; i++)
241  {
242  if (pVirtMem->Pagefile[i].OldMinSize != -1 &&
243  pVirtMem->Pagefile[i].NewMinSize == -1)
244  {
246  _T("%s\\pagefile.sys"),
247  pVirtMem->Pagefile[i].szDrive);
248 
250  }
251  }
252  }
253 
254  if (bErr)
255  ShowLastWin32Error(pVirtMem->hSelf);
256 
257 }
258 
259 
260 static VOID
262 {
263  RECT rect = {0, 0, 103, 0};
264  MapDialogRect(hwndListBox, &rect);
265 
266  SendMessage(hwndListBox, LB_SETTABSTOPS, (WPARAM)1, (LPARAM)&rect.right);
267 }
268 
269 
270 static VOID
272 {
273  /* Disable the page file custom size boxes */
276 }
277 
278 
279 static VOID
281 {
282  /* Disable the page file custom size boxes */
285 }
286 
287 
288 static VOID
290 {
291  /* Enable the page file custom size boxes */
294 }
295 
296 
297 static VOID
299 {
300  TCHAR szDisplayString[256];
301  TCHAR szSize[64];
302  INT Index;
303  INT i;
304 
305  for (i = 0; i < 26; i++)
306  {
307  if (pVirtMem->Pagefile[i].bUsed)
308  {
309  if ((pVirtMem->Pagefile[i].NewMinSize == -1) &&
310  (pVirtMem->Pagefile[i].NewMaxSize == -1))
311  {
314  szSize,
315  sizeof(szSize) / sizeof(szSize[0]));
316  }
317  else if ((pVirtMem->Pagefile[i].NewMinSize == 0) &&
318  (pVirtMem->Pagefile[i].NewMaxSize == 0))
319  {
322  szSize,
323  sizeof(szSize) / sizeof(szSize[0]));
324  }
325  else
326  {
327  _stprintf(szSize, _T("%d - %d"),
328  pVirtMem->Pagefile[i].NewMinSize,
329  pVirtMem->Pagefile[i].NewMaxSize);
330  }
331 
332  _stprintf(szDisplayString,
333  _T("%s [%s]\t%s"),
334  pVirtMem->Pagefile[i].szDrive,
335  pVirtMem->Pagefile[i].pszVolume ? pVirtMem->Pagefile[i].pszVolume : _T(""),
336  szSize);
337 
338  Index = SendMessage(pVirtMem->hListBox, LB_ADDSTRING, (WPARAM)0, (LPARAM)szDisplayString);
339  SendMessage(pVirtMem->hListBox, LB_SETITEMDATA, Index, i);
340  }
341  }
342 
343  SendMessage(pVirtMem->hListBox, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
344 
345  OnSelChange(pVirtMem->hSelf, pVirtMem);
346 }
347 
348 
349 static VOID
351  INT ListIndex,
352  INT DriveIndex)
353 {
354  TCHAR szDisplayString[256];
355  TCHAR szSize[64];
356 
357  if ((pVirtMem->Pagefile[DriveIndex].NewMinSize == -1) &&
358  (pVirtMem->Pagefile[DriveIndex].NewMaxSize == -1))
359  {
362  szSize,
363  sizeof(szSize) / sizeof(szSize[0]));
364  }
365  else if ((pVirtMem->Pagefile[DriveIndex].NewMinSize == 0) &&
366  (pVirtMem->Pagefile[DriveIndex].NewMaxSize == 0))
367  {
370  szSize,
371  sizeof(szSize) / sizeof(szSize[0]));
372  }
373  else
374  {
375  _stprintf(szSize,
376  _T("%d - %d"),
377  pVirtMem->Pagefile[DriveIndex].NewMinSize,
378  pVirtMem->Pagefile[DriveIndex].NewMaxSize);
379  }
380 
381  _stprintf(szDisplayString,
382  _T("%s [%s]\t%s"),
383  pVirtMem->Pagefile[DriveIndex].szDrive,
384  pVirtMem->Pagefile[DriveIndex].pszVolume ? pVirtMem->Pagefile[DriveIndex].pszVolume : L"",
385  szSize);
386 
387  SendMessage(pVirtMem->hListBox, LB_DELETESTRING, (WPARAM)ListIndex, 0);
388  SendMessage(pVirtMem->hListBox, LB_INSERTSTRING, (WPARAM)ListIndex, (LPARAM)szDisplayString);
389  SendMessage(pVirtMem->hListBox, LB_SETCURSEL, (WPARAM)ListIndex, 0);
390 }
391 
392 
393 static VOID
394 OnSet(PVIRTMEM pVirtMem)
395 {
396  INT Index;
397  UINT MinSize = -1;
398  UINT MaxSize = -1;
399  BOOL bTranslated;
400  INT DriveIndex = 0;
401 
402  Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
404  LB_GETCURSEL,
405  0,
406  0);
407  if (Index >= 0 && Index < pVirtMem->Count)
408  {
409  DriveIndex = SendDlgItemMessage(pVirtMem->hSelf,
412  (WPARAM)Index,
413  0);
414 
415  /* Check if custom settings are checked */
416  if (IsDlgButtonChecked(pVirtMem->hSelf,
418  {
419  MinSize = GetDlgItemInt(pVirtMem->hSelf,
421  &bTranslated,
422  FALSE);
423  if (!bTranslated)
424  {
426  NULL,
430  return;
431  }
432 
433  MaxSize = GetDlgItemInt(pVirtMem->hSelf,
434  IDC_MAXSIZE,
435  &bTranslated,
436  FALSE);
437  if (!bTranslated)
438  {
440  NULL,
444  return;
445  }
446 
447  /* Check the valid range of the minimum size */
448  if (MinSize < 2 ||
449  MinSize > pVirtMem->Pagefile[DriveIndex].FreeSize ||
450  MinSize > 4096)
451  {
453  NULL,
457  return;
458  }
459 
460  /* Check the valid range of the maximum size */
461  if (MaxSize < MinSize ||
462  MaxSize > pVirtMem->Pagefile[DriveIndex].FreeSize ||
463  MaxSize > 4096)
464  {
466  NULL,
470  return;
471  }
472 
473  pVirtMem->Pagefile[DriveIndex].NewMinSize = MinSize;
474  pVirtMem->Pagefile[DriveIndex].NewMaxSize = MaxSize;
475  pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
476  }
477  else if (IsDlgButtonChecked(pVirtMem->hSelf,
479  {
480  /* No pagefile */
481  pVirtMem->Pagefile[DriveIndex].NewMinSize = -1;
482  pVirtMem->Pagefile[DriveIndex].NewMaxSize = -1;
483  pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
484  }
485  else
486  {
487  /* System managed size*/
488  pVirtMem->Pagefile[DriveIndex].NewMinSize = 0;
489  pVirtMem->Pagefile[DriveIndex].NewMaxSize = 0;
490  pVirtMem->Pagefile[DriveIndex].bUsed = TRUE;
491  }
492 
493  /* Set the modified flag if min or max size has changed */
494  if ((pVirtMem->Pagefile[DriveIndex].OldMinSize != pVirtMem->Pagefile[DriveIndex].NewMinSize) ||
495  (pVirtMem->Pagefile[DriveIndex].OldMaxSize != pVirtMem->Pagefile[DriveIndex].NewMaxSize))
496  pVirtMem->bModified = TRUE;
497 
498  UpdatePagefileEntry(pVirtMem, Index, DriveIndex);
499  }
500 }
501 
502 
503 static BOOL
504 OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
505 {
506  TCHAR szBuffer[64];
507  MEMORYSTATUSEX MemoryStatus;
508  ULARGE_INTEGER FreeDiskSpace;
509  UINT i, FreeMemMb, RecoMemMb, PageFileSizeMb;
510  INT Index;
511  TCHAR szText[MAX_PATH], szMegabytes[8];
512  WIN32_FIND_DATAW fdata = {0};
513  HANDLE hFind;
514  ULARGE_INTEGER pfSize;
515 
516  Index = (INT)SendDlgItemMessage(hwndDlg,
518  LB_GETCURSEL,
519  0,
520  0);
521  if (Index >= 0 && Index < pVirtMem->Count)
522  {
525  szMegabytes,
526  ARRAYSIZE(szMegabytes));
527 
528  /* Set drive letter */
529  SetDlgItemText(hwndDlg, IDC_DRIVE,
530  pVirtMem->Pagefile[Index].szDrive);
531 
532  /* Set available disk space */
533  if (GetDiskFreeSpaceEx(pVirtMem->Pagefile[Index].szDrive,
534  NULL, NULL, &FreeDiskSpace))
535  {
536  pVirtMem->Pagefile[Index].FreeSize = (UINT)(FreeDiskSpace.QuadPart / (1024 * 1024));
537  _stprintf(szBuffer, szMegabytes, pVirtMem->Pagefile[Index].FreeSize);
538  SetDlgItemText(hwndDlg, IDC_SPACEAVAIL, szBuffer);
539  }
540 
541  if (pVirtMem->Pagefile[Index].NewMinSize == -1 &&
542  pVirtMem->Pagefile[Index].NewMaxSize == -1)
543  {
544  /* No pagefile */
545 
548 
550  }
551  else if (pVirtMem->Pagefile[Index].NewMinSize == 0 &&
552  pVirtMem->Pagefile[Index].NewMaxSize == 0)
553  {
554  /* System managed size*/
555 
558 
560  }
561  else
562  {
563  /* Custom size */
564 
565  /* Enable and fill the custom values */
568 
569  SetDlgItemInt(pVirtMem->hSelf,
571  pVirtMem->Pagefile[Index].NewMinSize,
572  FALSE);
573 
574  SetDlgItemInt(pVirtMem->hSelf,
575  IDC_MAXSIZE,
576  pVirtMem->Pagefile[Index].NewMaxSize,
577  FALSE);
578 
579  CheckDlgButton(pVirtMem->hSelf,
580  IDC_CUSTOM,
581  BST_CHECKED);
582  }
583 
584  /* Set minimum pagefile size (2 MB) */
585  _stprintf(szBuffer, szMegabytes, 2);
586  SetDlgItemText(hwndDlg, IDC_MINIMUM, szBuffer);
587 
588  /* Set recommended pagefile size */
589  MemoryStatus.dwLength = sizeof(MEMORYSTATUSEX);
590  if (GlobalMemoryStatusEx(&MemoryStatus))
591  {
592  FreeMemMb = (UINT)(MemoryStatus.ullTotalPhys / (1024 * 1024));
593  RecoMemMb = FreeMemMb + (FreeMemMb / 2); /* The recommended VM size is 150% of free memory. */
594  if (RecoMemMb > 4096)
595  RecoMemMb = 4096;
596  _stprintf(szBuffer, szMegabytes, RecoMemMb);
597  SetDlgItemText(hwndDlg, IDC_RECOMMENDED, szBuffer);
598  }
599 
600  /* Set current pagefile size */
601  PageFileSizeMb = 0;
602 
603  for (i = 0; i < pVirtMem->Count; i++)
604  {
606  _T("%c:\\pagefile.sys"),
607  pVirtMem->Pagefile[i].szDrive[0]);
608 
609  hFind = FindFirstFileW(szText, &fdata);
610  if (hFind == INVALID_HANDLE_VALUE)
611  {
612  DPRINT1("Unable to read PageFile size : %ls due to error %d\n", szText,GetLastError());
613  }
614  else
615  {
616  pfSize.LowPart = fdata.nFileSizeLow;
617  pfSize.HighPart = fdata.nFileSizeHigh;
618  PageFileSizeMb += pfSize.QuadPart / (1024*1024);
619  FindClose(hFind);
620  }
621  }
622 
623  _stprintf(szBuffer, szMegabytes, PageFileSizeMb);
624  SetDlgItemText(hwndDlg, IDC_CURRENT, szBuffer);
625  }
626 
627  return TRUE;
628 }
629 
630 
631 static VOID
633 {
634  if (pVirtMem->bModified != FALSE)
635  {
637  NULL,
641 
642  WritePageFileSettings(pVirtMem);
643  }
644 }
645 
646 
647 static VOID
649 {
650  INT i;
651 
652  pVirtMem->hSelf = hwnd;
654  pVirtMem->bModified = FALSE;
655 
656  SetListBoxColumns(pVirtMem->hListBox);
657 
658  for (i = 0; i < 26; i++)
659  {
660  pVirtMem->Pagefile[i].bUsed = FALSE;
661  pVirtMem->Pagefile[i].OldMinSize = -1;
662  pVirtMem->Pagefile[i].OldMaxSize = -1;
663  pVirtMem->Pagefile[i].NewMinSize = -1;
664  pVirtMem->Pagefile[i].NewMaxSize = -1;
665  }
666 
667  /* Load the pagefile systems from the reg */
668  ReadPageFileSettings(pVirtMem);
669 
670  /* Parse our settings and set up dialog */
671  ParseMemSettings(pVirtMem);
672 
673  InitPagefileList(pVirtMem);
674 }
675 
676 
677 static VOID
679 {
680  INT i;
681 
682  for (i = 0; i < 26; i++)
683  {
684  if (pVirtMem->Pagefile[i].pszVolume != NULL)
685  HeapFree(GetProcessHeap(), 0, pVirtMem->Pagefile[i].pszVolume);
686  }
687 
688  if (pVirtMem->szPagingFiles)
689  HeapFree(GetProcessHeap(), 0, pVirtMem->szPagingFiles);
690 
691  HeapFree(GetProcessHeap(), 0, pVirtMem);
692 }
693 
694 
697  UINT uMsg,
698  WPARAM wParam,
699  LPARAM lParam)
700 {
701  PVIRTMEM pVirtMem;
702 
704 
705  pVirtMem = (PVIRTMEM)GetWindowLongPtr(hwndDlg, DWLP_USER);
706 
707  switch (uMsg)
708  {
709  case WM_INITDIALOG:
710  pVirtMem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(VIRTMEM));
711  if (pVirtMem == NULL)
712  {
713  EndDialog(hwndDlg, 0);
714  return FALSE;
715  }
716 
717  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pVirtMem);
718 
719  OnInitVirtMemDialog(hwndDlg, pVirtMem);
720  break;
721 
722  case WM_DESTROY:
723  OnDestroy(pVirtMem);
724  break;
725 
726  case WM_COMMAND:
727  switch (LOWORD(wParam))
728  {
729  case IDCANCEL:
730  EndDialog(hwndDlg, 0);
731  return TRUE;
732 
733  case IDOK:
734  OnVirtMemDialogOk(pVirtMem);
735  EndDialog(hwndDlg, pVirtMem->bModified);
736  return TRUE;
737 
738  case IDC_NOPAGEFILE:
739  OnNoPagingFile(pVirtMem);
740  return TRUE;
741 
742  case IDC_SYSMANSIZE:
743  OnSysManSize(pVirtMem);
744  return TRUE;
745 
746  case IDC_CUSTOM:
747  OnCustom(pVirtMem);
748  return TRUE;
749 
750  case IDC_SET:
751  OnSet(pVirtMem);
752  return TRUE;
753 
754  case IDC_PAGEFILELIST:
755  switch (HIWORD(wParam))
756  {
757  case LBN_SELCHANGE:
758  OnSelChange(hwndDlg, pVirtMem);
759  return TRUE;
760  }
761  break;
762  }
763  break;
764  }
765 
766  return FALSE;
767 }
#define RegQueryValueEx
Definition: winreg.h:524
#define LB_SETCURSEL
Definition: winuser.h:2045
INT OldMaxSize
Definition: precomp.h:61
#define IDS_WARNMAXIMUMRANGE
Definition: resource.h:49
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDS_PAGEFILE_MB
Definition: resource.h:50
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define IDOK
Definition: winuser.h:824
#define IDC_SYSMANSIZE
Definition: resource.h:147
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hListBox
Definition: precomp.h:71
#define LB_ADDSTRING
Definition: winuser.h:2013
INT Count
Definition: precomp.h:74
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define GetDriveType
Definition: winbase.h:3652
#define LB_GETITEMDATA
Definition: winuser.h:2023
static VOID OnNoPagingFile(PVIRTMEM pVirtMem)
Definition: virtmem.c:271
#define GetLogicalDriveStrings
Definition: winbase.h:3662
#define LB_SETTABSTOPS
Definition: winuser.h:2051
#define INT
Definition: polytest.cpp:20
#define IDC_CUSTOM
Definition: resource.h:144
#define CALLBACK
Definition: compat.h:35
INT NewMaxSize
Definition: precomp.h:63
BOOL WINAPI MapDialogRect(_In_ HWND, _Inout_ LPRECT)
static VOID ParseMemSettings(PVIRTMEM pVirtMem)
Definition: virtmem.c:108
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1223
#define ZeroMemory
Definition: winbase.h:1648
$ULONG LowPart
Definition: ntbasedef.h:570
HINSTANCE hApplet
Definition: access.c:17
#define MoveFileEx
Definition: winbase.h:3718
#define IDC_PAGEFILELIST
Definition: resource.h:140
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5817
HWND hSelf
Definition: precomp.h:70
int32_t INT_PTR
Definition: typedefs.h:64
INT NewMinSize
Definition: precomp.h:62
#define IDS_WARNINITIALRANGE
Definition: resource.h:48
#define LBN_SELCHANGE
Definition: winuser.h:2057
PAGEFILE Pagefile[26]
Definition: precomp.h:76
#define IDS_WARNMAXIMUMSIZE
Definition: resource.h:47
int32_t INT
Definition: typedefs.h:58
#define SetWindowLongPtr
Definition: treelist.c:70
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
CHAR * LPTSTR
Definition: xmlstorage.h:192
static VOID OnVirtMemDialogOk(PVIRTMEM pVirtMem)
Definition: virtmem.c:632
#define MB_ICONWARNING
Definition: winuser.h:780
void ShowLastWin32Error(HWND hwndParent)
Definition: winutils.c:11
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL bUsed
Definition: precomp.h:65
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define FALSE
Definition: types.h:117
static const WCHAR szText[]
Definition: dialog.c:139
static VOID GetPageFileSizes(LPTSTR lpPageFiles, LPINT lpInitialSize, LPINT lpMaximumSize)
Definition: virtmem.c:74
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_RECOMMENDED
Definition: resource.h:152
#define IDC_SPACEAVAIL
Definition: resource.h:143
#define REG_MULTI_SZ
Definition: nt_native.h:1501
static VOID UpdatePagefileEntry(PVIRTMEM pVirtMem, INT ListIndex, INT DriveIndex)
Definition: virtmem.c:350
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
LONG_PTR LPARAM
Definition: windef.h:208
#define MOVEFILE_DELAY_UNTIL_REBOOT
Definition: winbase.h:381
#define IDC_CURRENT
Definition: resource.h:153
#define IDC_NOPAGEFILE
Definition: resource.h:148
static VOID OnSysManSize(PVIRTMEM pVirtMem)
Definition: virtmem.c:280
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_DESTROY
Definition: winuser.h:1591
struct _VIRTMEM * PVIRTMEM
#define IDC_INITIALSIZE
Definition: resource.h:145
INT OldMinSize
Definition: precomp.h:60
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
$ULONG HighPart
Definition: ntbasedef.h:571
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:283
#define IDC_MAXSIZE
Definition: resource.h:146
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDS_PAGEFILE_NONE
Definition: resource.h:51
#define MAX_PATH
Definition: compat.h:34
BOOL bModified
Definition: precomp.h:75
static BOOL ReadPageFileSettings(PVIRTMEM pVirtMem)
Definition: virtmem.c:19
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
#define Len
Definition: deflate.h:82
#define LB_SETITEMDATA
Definition: winuser.h:2047
#define SetDlgItemText
Definition: winuser.h:5824
#define IDC_MINIMUM
Definition: resource.h:151
#define IDC_DRIVE
Definition: resource.h:142
#define IDS_WARNINITIALSIZE
Definition: resource.h:46
#define MB_ICONINFORMATION
Definition: winuser.h:796
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
static const WCHAR L[]
Definition: oid.c:1250
static BOOL OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem)
Definition: virtmem.c:504
#define DWLP_USER
Definition: winuser.h:866
LPTSTR pszVolume
Definition: precomp.h:59
#define IDS_PAGEFILE_SYSTEM
Definition: resource.h:52
#define WM_COMMAND
Definition: winuser.h:1722
static VOID OnInitVirtMemDialog(HWND hwnd, PVIRTMEM pVirtMem)
Definition: virtmem.c:648
#define _tcsupr
Definition: tchar.h:1467
static LPCTSTR lpKey
Definition: virtmem.c:16
#define DRIVE_FIXED
Definition: winbase.h:249
static VOID OnCustom(PVIRTMEM pVirtMem)
Definition: virtmem.c:289
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define GetDiskFreeSpaceEx
Definition: winbase.h:3648
#define _stprintf
Definition: utility.h:124
#define GetVolumeInformation
Definition: winbase.h:3693
#define lstrlen
Definition: winbase.h:3716
#define lstrcpy
Definition: winbase.h:3714
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LB_GETCURSEL
Definition: winuser.h:2021
unsigned int UINT
Definition: ndis.h:50
#define MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
UINT FreeSize
Definition: precomp.h:64
#define BST_CHECKED
Definition: winuser.h:197
#define DPRINT1
Definition: precomp.h:8
#define SendMessage
Definition: winuser.h:5818
#define HIWORD(l)
Definition: typedefs.h:247
static VOID SetListBoxColumns(HWND hwndListBox)
Definition: virtmem.c:261
#define IDC_SET
Definition: resource.h:149
BOOL NTAPI GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer)
Definition: heapmem.c:1272
static VOID OnSet(PVIRTMEM pVirtMem)
Definition: virtmem.c:394
#define GetWindowLongPtr
Definition: treelist.c:73
static VOID InitPagefileList(PVIRTMEM pVirtMem)
Definition: virtmem.c:298
#define IDCANCEL
Definition: winuser.h:825
#define LB_DELETESTRING
Definition: winuser.h:2014
#define IDS_INFOREBOOT
Definition: resource.h:53
#define IDS_MESSAGEBOXTITLE
Definition: resource.h:45
BYTE * PBYTE
Definition: pedump.c:66
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LB_INSERTSTRING
Definition: winuser.h:2035
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static VOID OnDestroy(PVIRTMEM pVirtMem)
Definition: virtmem.c:678
int _tcsncmp(const _TCHAR *s1, const _TCHAR *s2, size_t n)
Definition: tcsncmp.h:9
#define HeapFree(x, y, z)
Definition: compat.h:483
TCHAR szDrive[3]
Definition: precomp.h:58
#define RegSetValueEx
Definition: winreg.h:533
#define LoadString
Definition: winuser.h:5794
#define RegCreateKeyEx
Definition: winreg.h:501
INT_PTR CALLBACK VirtMemDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: virtmem.c:696
LPTSTR szPagingFiles
Definition: precomp.h:72
#define lstrcpyn
Definition: winbase.h:3715
static VOID WritePageFileSettings(PVIRTMEM pVirtMem)
Definition: virtmem.c:182
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
int * LPINT
Definition: windef.h:178
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502