mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 17:05:45 +00:00
fix a crash and the selchange notification code
svn path=/trunk/; revision=27982
This commit is contained in:
parent
105b544d6c
commit
5cd0ce3185
1 changed files with 14 additions and 21 deletions
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
static BOOL OnSelChange(PVIRTMEM pVirtMem);
|
||||||
static LPCTSTR lpKey = _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
|
static LPCTSTR lpKey = _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
|
@ -89,7 +90,7 @@ ParseMemSettings(PVIRTMEM pVirtMem)
|
||||||
{
|
{
|
||||||
TCHAR szDrives[1024]; // all drives
|
TCHAR szDrives[1024]; // all drives
|
||||||
LPTSTR DrivePtr = szDrives;
|
LPTSTR DrivePtr = szDrives;
|
||||||
TCHAR szDrive[4]; // single drive
|
TCHAR szDrive[3]; // single drive
|
||||||
TCHAR szVolume[MAX_PATH];
|
TCHAR szVolume[MAX_PATH];
|
||||||
TCHAR *szDisplayString;
|
TCHAR *szDisplayString;
|
||||||
INT InitialSize = 0;
|
INT InitialSize = 0;
|
||||||
|
@ -97,10 +98,11 @@ ParseMemSettings(PVIRTMEM pVirtMem)
|
||||||
INT DriveLen;
|
INT DriveLen;
|
||||||
INT PgCnt = 0;
|
INT PgCnt = 0;
|
||||||
|
|
||||||
|
ZeroMemory(&szDrives, sizeof(szDrives) * sizeof(TCHAR));
|
||||||
DriveLen = GetLogicalDriveStrings(1023,
|
DriveLen = GetLogicalDriveStrings(1023,
|
||||||
szDrives);
|
szDrives);
|
||||||
|
|
||||||
szDisplayString = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (MAX_PATH * 2 + 70) * sizeof(TCHAR));
|
szDisplayString = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (MAX_PATH * 2 + 69) * sizeof(TCHAR));
|
||||||
if (szDisplayString == NULL)
|
if (szDisplayString == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -178,6 +180,7 @@ ParseMemSettings(PVIRTMEM pVirtMem)
|
||||||
SendMessage(pVirtMem->hListBox, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
SendMessage(pVirtMem->hListBox, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
|
||||||
HeapFree(GetProcessHeap(), 0, szDisplayString);
|
HeapFree(GetProcessHeap(), 0, szDisplayString);
|
||||||
pVirtMem->Count = PgCnt;
|
pVirtMem->Count = PgCnt;
|
||||||
|
OnSelChange(pVirtMem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -338,14 +341,11 @@ OnSet(PVIRTMEM pVirtMem)
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
OnSelChange(PVIRTMEM pVirtMem,
|
OnSelChange(PVIRTMEM pVirtMem)
|
||||||
LPNMLISTVIEW pnmv)
|
|
||||||
{
|
{
|
||||||
TCHAR szCustVals[255];
|
TCHAR szCustVals[255];
|
||||||
INT Index;
|
INT Index;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(pnmv);
|
|
||||||
|
|
||||||
Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
|
Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
|
||||||
IDC_PAGEFILELIST,
|
IDC_PAGEFILELIST,
|
||||||
LB_GETCURSEL,
|
LB_GETCURSEL,
|
||||||
|
@ -519,22 +519,15 @@ VirtMemDlgProc(HWND hwndDlg,
|
||||||
case IDC_SET:
|
case IDC_SET:
|
||||||
OnSet(pVirtMem);
|
OnSet(pVirtMem);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case IDC_PAGEFILELIST:
|
||||||
{
|
switch HIWORD(wParam)
|
||||||
LPNMHDR pnmhdr = (LPNMHDR)lParam;
|
{
|
||||||
|
case LBN_SELCHANGE:
|
||||||
switch (pnmhdr->code)
|
OnSelChange(pVirtMem);
|
||||||
{
|
return TRUE;
|
||||||
case LVN_ITEMCHANGED:
|
}
|
||||||
{
|
break;
|
||||||
LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
|
|
||||||
|
|
||||||
OnSelChange(pVirtMem, pnmv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue