Author: cfinck
Date: Mon Jul 23 14:26:55 2007
New Revision: 27785
URL:
http://svn.reactos.org/svn/reactos?rev=27785&view=rev
Log:
[FORMATTING] Use a consistent indentation (TABs) for all parts of sysdm.cpl
No code changes
Modified:
trunk/reactos/dll/cpl/sysdm/advanced.c
trunk/reactos/dll/cpl/sysdm/environment.c
trunk/reactos/dll/cpl/sysdm/general.c
trunk/reactos/dll/cpl/sysdm/hardprof.c
trunk/reactos/dll/cpl/sysdm/hardware.c
trunk/reactos/dll/cpl/sysdm/licence.c
trunk/reactos/dll/cpl/sysdm/startrec.c
trunk/reactos/dll/cpl/sysdm/sysdm.c
trunk/reactos/dll/cpl/sysdm/userprofile.c
trunk/reactos/dll/cpl/sysdm/virtmem.c
Modified: trunk/reactos/dll/cpl/sysdm/advanced.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/advanced.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/advanced.c (original)
+++ trunk/reactos/dll/cpl/sysdm/advanced.c Mon Jul 23 14:26:55 2007
@@ -15,72 +15,71 @@
/* Property page dialog callback */
INT_PTR CALLBACK
AdvancedPageProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(lParam);
- switch (uMsg)
- {
- case WM_INITDIALOG:
- break;
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ break;
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDC_PERFOR:
- {
- DialogBox(hApplet,
- MAKEINTRESOURCE(IDD_VIRTMEM),
- hwndDlg,
- (DLGPROC)VirtMemDlgProc);
- }
- break;
+ case WM_COMMAND:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_PERFOR:
+ {
+ DialogBox(hApplet,
+ MAKEINTRESOURCE(IDD_VIRTMEM),
+ hwndDlg,
+ (DLGPROC)VirtMemDlgProc);
+ }
+ break;
- case IDC_USERPROFILE:
- {
- DialogBox(hApplet,
- MAKEINTRESOURCE(IDD_USERPROFILE),
- hwndDlg,
- (DLGPROC)UserProfileDlgProc);
- }
- break;
+ case IDC_USERPROFILE:
+ {
+ DialogBox(hApplet,
+ MAKEINTRESOURCE(IDD_USERPROFILE),
+ hwndDlg,
+ (DLGPROC)UserProfileDlgProc);
+ }
+ break;
- case IDC_STAREC:
- {
- DialogBox(hApplet,
- MAKEINTRESOURCE(IDD_STARTUPRECOVERY),
- hwndDlg,
- (DLGPROC)StartRecDlgProc);
- }
- break;
+ case IDC_STAREC:
+ {
+ DialogBox(hApplet,
+ MAKEINTRESOURCE(IDD_STARTUPRECOVERY),
+ hwndDlg,
+ (DLGPROC)StartRecDlgProc);
+ }
+ break;
- case IDC_ENVVAR:
- {
- DialogBox(hApplet,
- MAKEINTRESOURCE(IDD_ENVIRONMENT_VARIABLES),
- hwndDlg,
- (DLGPROC)EnvironmentDlgProc);
- }
- break;
+ case IDC_ENVVAR:
+ {
+ DialogBox(hApplet,
+ MAKEINTRESOURCE(IDD_ENVIRONMENT_VARIABLES),
+ hwndDlg,
+ (DLGPROC)EnvironmentDlgProc);
+ }
+ break;
- case IDC_ERRORREPORT:
- {
- ShellExecute(NULL,
- _T("open"),
- BugLink,
- NULL,
- NULL,
- SW_SHOWNORMAL);
- }
- break;
+ case IDC_ERRORREPORT:
+ {
+ ShellExecute(NULL,
+ _T("open"),
+ BugLink,
+ NULL,
+ NULL,
+ SW_SHOWNORMAL);
+ }
+ break;
+ }
+ }
- }
- }
- break;
-
- }
- return FALSE;
+ break;
+ }
+ return FALSE;
}
Modified: trunk/reactos/dll/cpl/sysdm/environment.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/environment.…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/environment.c (original)
+++ trunk/reactos/dll/cpl/sysdm/environment.c Mon Jul 23 14:26:55 2007
@@ -12,11 +12,10 @@
typedef struct _VARIABLE_DATA
{
- LPTSTR lpName;
- LPTSTR lpRawValue;
- LPTSTR lpCookedValue;
+ LPTSTR lpName;
+ LPTSTR lpRawValue;
+ LPTSTR lpCookedValue;
} VARIABLE_DATA, *PVARIABLE_DATA;
-
INT_PTR CALLBACK
@@ -25,573 +24,574 @@
WPARAM wParam,
LPARAM lParam)
{
- PVARIABLE_DATA VarData;
- DWORD dwNameLength;
- DWORD dwValueLength;
-
- VarData = (PVARIABLE_DATA)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
-
- switch (uMsg)
- {
- case WM_INITDIALOG:
- SetWindowLongPtr(hwndDlg, GWL_USERDATA, (LONG_PTR)lParam);
- VarData = (PVARIABLE_DATA)lParam;
-
- if (VarData->lpName != NULL)
- {
- SendDlgItemMessage(hwndDlg, IDC_VARIABLE_NAME, WM_SETTEXT, 0,
(LPARAM)VarData->lpName);
- }
-
- if (VarData->lpRawValue != NULL)
- {
- SendDlgItemMessage(hwndDlg, IDC_VARIABLE_VALUE, WM_SETTEXT, 0,
(LPARAM)VarData->lpRawValue);
- }
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDOK:
- dwNameLength = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VARIABLE_NAME,
WM_GETTEXTLENGTH, 0, 0);
- dwValueLength = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VARIABLE_VALUE,
WM_GETTEXTLENGTH, 0, 0);
- if (dwNameLength != 0 && dwValueLength != 0)
- {
- if (VarData->lpName == NULL)
- {
- VarData->lpName = GlobalAlloc(GPTR, (dwNameLength + 1) *
sizeof(TCHAR));
- }
- else if (_tcslen(VarData->lpName) < dwNameLength)
- {
- GlobalFree(VarData->lpName);
- VarData->lpName = GlobalAlloc(GPTR, (dwNameLength + 1) *
sizeof(TCHAR));
- }
- SendDlgItemMessage(hwndDlg, IDC_VARIABLE_NAME, WM_GETTEXT, dwNameLength + 1,
(LPARAM)VarData->lpName);
-
- if (VarData->lpRawValue == NULL)
- {
- VarData->lpRawValue = GlobalAlloc(GPTR, (dwValueLength + 1) *
sizeof(TCHAR));
- }
- else if (_tcslen(VarData->lpRawValue) < dwValueLength)
- {
- GlobalFree(VarData->lpRawValue);
- VarData->lpRawValue = GlobalAlloc(GPTR, (dwValueLength + 1) *
sizeof(TCHAR));
- }
- SendDlgItemMessage(hwndDlg, IDC_VARIABLE_VALUE, WM_GETTEXT, dwValueLength +
1, (LPARAM)VarData->lpRawValue);
-
- if (_tcschr(VarData->lpRawValue, _T('%')))
- {
- if (VarData->lpCookedValue == NULL)
- {
- VarData->lpCookedValue = GlobalAlloc(GPTR, 2 * MAX_PATH *
sizeof(TCHAR));
- }
-
- ExpandEnvironmentStrings(VarData->lpRawValue,
- VarData->lpCookedValue,
- 2 * MAX_PATH);
- }
- else if (VarData->lpCookedValue)
- {
- GlobalFree(VarData->lpCookedValue);
- }
- }
- EndDialog(hwndDlg, 1);
- return TRUE;
-
- case IDCANCEL:
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
- }
-
- return FALSE;
+ PVARIABLE_DATA VarData;
+ DWORD dwNameLength;
+ DWORD dwValueLength;
+
+ VarData = (PVARIABLE_DATA)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ SetWindowLongPtr(hwndDlg, GWL_USERDATA, (LONG_PTR)lParam);
+ VarData = (PVARIABLE_DATA)lParam;
+
+ if (VarData->lpName != NULL)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_VARIABLE_NAME, WM_SETTEXT, 0,
(LPARAM)VarData->lpName);
+ }
+
+ if (VarData->lpRawValue != NULL)
+ {
+ SendDlgItemMessage(hwndDlg, IDC_VARIABLE_VALUE, WM_SETTEXT, 0,
(LPARAM)VarData->lpRawValue);
+ }
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ dwNameLength = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VARIABLE_NAME,
WM_GETTEXTLENGTH, 0, 0);
+ dwValueLength = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VARIABLE_VALUE,
WM_GETTEXTLENGTH, 0, 0);
+ if (dwNameLength != 0 && dwValueLength != 0)
+ {
+ if (VarData->lpName == NULL)
+ {
+ VarData->lpName = GlobalAlloc(GPTR, (dwNameLength + 1) * sizeof(TCHAR));
+ }
+ else if (_tcslen(VarData->lpName) < dwNameLength)
+ {
+ GlobalFree(VarData->lpName);
+ VarData->lpName = GlobalAlloc(GPTR, (dwNameLength + 1) * sizeof(TCHAR));
+ }
+ SendDlgItemMessage(hwndDlg, IDC_VARIABLE_NAME, WM_GETTEXT, dwNameLength + 1,
(LPARAM)VarData->lpName);
+
+ if (VarData->lpRawValue == NULL)
+ {
+ VarData->lpRawValue = GlobalAlloc(GPTR, (dwValueLength + 1) * sizeof(TCHAR));
+ }
+ else if (_tcslen(VarData->lpRawValue) < dwValueLength)
+ {
+ GlobalFree(VarData->lpRawValue);
+ VarData->lpRawValue = GlobalAlloc(GPTR, (dwValueLength + 1) * sizeof(TCHAR));
+ }
+ SendDlgItemMessage(hwndDlg, IDC_VARIABLE_VALUE, WM_GETTEXT, dwValueLength + 1,
(LPARAM)VarData->lpRawValue);
+
+ if (_tcschr(VarData->lpRawValue, _T('%')))
+ {
+ if (VarData->lpCookedValue == NULL)
+ {
+ VarData->lpCookedValue = GlobalAlloc(GPTR, 2 * MAX_PATH * sizeof(TCHAR));
+ }
+
+ ExpandEnvironmentStrings(VarData->lpRawValue,
+ VarData->lpCookedValue,
+ 2 * MAX_PATH);
+ }
+ else if (VarData->lpCookedValue)
+ {
+ GlobalFree(VarData->lpCookedValue);
+ }
+ }
+ EndDialog(hwndDlg, 1);
+ return TRUE;
+
+ case IDCANCEL:
+ EndDialog(hwndDlg, 0);
+ return TRUE;
+ }
+ break;
+ }
+
+ return FALSE;
}
static VOID
SetEnvironmentVariables(HWND hwndListView,
- HKEY hRootKey,
- LPTSTR lpSubKeyName)
-{
- HKEY hKey;
- DWORD dwValues;
- DWORD dwMaxValueNameLength;
- DWORD dwMaxValueDataLength;
- DWORD i;
- LPTSTR lpName;
- LPTSTR lpData;
- LPTSTR lpExpandData = NULL;
- DWORD dwNameLength;
- DWORD dwDataLength;
- DWORD dwType;
- PVARIABLE_DATA VarData;
-
- LV_ITEM lvi;
- int iItem;
-
- if (RegOpenKeyEx(hRootKey,
- lpSubKeyName,
- 0,
- KEY_READ,
- &hKey))
- return;
-
- if (RegQueryInfoKey(hKey,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- &dwValues,
- &dwMaxValueNameLength,
- &dwMaxValueDataLength,
- NULL,
- NULL))
- {
- RegCloseKey(hKey);
- return;
- }
-
- lpName = GlobalAlloc(GPTR, (dwMaxValueNameLength + 1) * sizeof(TCHAR));
- if (lpName == NULL)
- {
- RegCloseKey(hKey);
- return;
- }
-
- lpData = GlobalAlloc(GPTR, (dwMaxValueDataLength + 1) * sizeof(TCHAR));
- if (lpData == NULL)
- {
- GlobalFree(lpData);
- RegCloseKey(hKey);
- return;
- }
-
- for (i = 0; i < dwValues; i++)
- {
- dwNameLength = dwMaxValueNameLength + 1;
- dwDataLength = dwMaxValueDataLength + 1;
- if (RegEnumValue(hKey,
- i,
- lpName,
- &dwNameLength,
- NULL,
- &dwType,
- (LPBYTE)lpData,
- &dwDataLength))
- {
- GlobalFree(lpName);
- GlobalFree(lpData);
- RegCloseKey(hKey);
- return;
- }
-
- VarData = GlobalAlloc(GPTR, sizeof(VARIABLE_DATA));
-
- VarData->lpName = GlobalAlloc(GPTR, (dwNameLength + 1) * sizeof(TCHAR));
- _tcscpy(VarData->lpName, lpName);
-
- VarData->lpRawValue = GlobalAlloc(GPTR, (dwDataLength + 1) * sizeof(TCHAR));
- _tcscpy(VarData->lpRawValue, lpData);
-
- if (dwType == REG_EXPAND_SZ)
- {
- lpExpandData = GlobalAlloc(GPTR, MAX_PATH * 2* sizeof(TCHAR));
- if (lpExpandData == NULL)
- {
- GlobalFree(lpName);
- GlobalFree(lpData);
- RegCloseKey(hKey);
- return;
- }
-
- ExpandEnvironmentStrings(lpData,
- lpExpandData,
- 2 * MAX_PATH);
-
- VarData->lpCookedValue = GlobalAlloc(GPTR, (_tcslen(lpExpandData) + 1) *
sizeof(TCHAR));
- _tcscpy(VarData->lpCookedValue, lpExpandData);
- GlobalFree(lpExpandData);
- }
-
- memset(&lvi, 0x00, sizeof(lvi));
- lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
- lvi.lParam = (LPARAM)VarData;
- lvi.pszText = VarData->lpName;
- lvi.state = (i == 0) ? LVIS_SELECTED : 0;
- iItem = ListView_InsertItem(hwndListView, &lvi);
-
- ListView_SetItemText(hwndListView, iItem, 1,
- (VarData->lpCookedValue) ? VarData->lpCookedValue :
VarData->lpRawValue);
- }
-
- GlobalFree(lpName);
- GlobalFree(lpData);
- RegCloseKey(hKey);
+ HKEY hRootKey,
+ LPTSTR lpSubKeyName)
+{
+ HKEY hKey;
+ DWORD dwValues;
+ DWORD dwMaxValueNameLength;
+ DWORD dwMaxValueDataLength;
+ DWORD i;
+ LPTSTR lpName;
+ LPTSTR lpData;
+ LPTSTR lpExpandData = NULL;
+ DWORD dwNameLength;
+ DWORD dwDataLength;
+ DWORD dwType;
+ PVARIABLE_DATA VarData;
+
+ LV_ITEM lvi;
+ int iItem;
+
+ if (RegOpenKeyEx(hRootKey,
+ lpSubKeyName,
+ 0,
+ KEY_READ,
+ &hKey))
+ return;
+
+ if (RegQueryInfoKey(hKey,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &dwValues,
+ &dwMaxValueNameLength,
+ &dwMaxValueDataLength,
+ NULL,
+ NULL))
+ {
+ RegCloseKey(hKey);
+ return;
+ }
+
+ lpName = GlobalAlloc(GPTR, (dwMaxValueNameLength + 1) * sizeof(TCHAR));
+ if (lpName == NULL)
+ {
+ RegCloseKey(hKey);
+ return;
+ }
+
+ lpData = GlobalAlloc(GPTR, (dwMaxValueDataLength + 1) * sizeof(TCHAR));
+ if (lpData == NULL)
+ {
+ GlobalFree(lpData);
+ RegCloseKey(hKey);
+ return;
+ }
+
+ for (i = 0; i < dwValues; i++)
+ {
+ dwNameLength = dwMaxValueNameLength + 1;
+ dwDataLength = dwMaxValueDataLength + 1;
+
+ if (RegEnumValue(hKey,
+ i,
+ lpName,
+ &dwNameLength,
+ NULL,
+ &dwType,
+ (LPBYTE)lpData,
+ &dwDataLength))
+ {
+ GlobalFree(lpName);
+ GlobalFree(lpData);
+ RegCloseKey(hKey);
+ return;
+ }
+
+ VarData = GlobalAlloc(GPTR, sizeof(VARIABLE_DATA));
+
+ VarData->lpName = GlobalAlloc(GPTR, (dwNameLength + 1) * sizeof(TCHAR));
+ _tcscpy(VarData->lpName, lpName);
+
+ VarData->lpRawValue = GlobalAlloc(GPTR, (dwDataLength + 1) * sizeof(TCHAR));
+ _tcscpy(VarData->lpRawValue, lpData);
+
+ if (dwType == REG_EXPAND_SZ)
+ {
+ lpExpandData = GlobalAlloc(GPTR, MAX_PATH * 2* sizeof(TCHAR));
+ if (lpExpandData == NULL)
+ {
+ GlobalFree(lpName);
+ GlobalFree(lpData);
+ RegCloseKey(hKey);
+ return;
+ }
+
+ ExpandEnvironmentStrings(lpData,
+ lpExpandData,
+ 2 * MAX_PATH);
+
+ VarData->lpCookedValue = GlobalAlloc(GPTR, (_tcslen(lpExpandData) + 1) *
sizeof(TCHAR));
+ _tcscpy(VarData->lpCookedValue, lpExpandData);
+ GlobalFree(lpExpandData);
+ }
+
+ memset(&lvi, 0x00, sizeof(lvi));
+ lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
+ lvi.lParam = (LPARAM)VarData;
+ lvi.pszText = VarData->lpName;
+ lvi.state = (i == 0) ? LVIS_SELECTED : 0;
+ iItem = ListView_InsertItem(hwndListView, &lvi);
+
+ ListView_SetItemText(hwndListView, iItem, 1,
+ (VarData->lpCookedValue) ? VarData->lpCookedValue :
VarData->lpRawValue);
+ }
+
+ GlobalFree(lpName);
+ GlobalFree(lpData);
+ RegCloseKey(hKey);
}
static VOID
SetListViewColumns(HWND hwndListView)
{
- RECT rect;
- LV_COLUMN column;
- TCHAR szStr[32];
-
- GetClientRect(hwndListView, &rect);
-
- memset(&column, 0x00, sizeof(column));
- column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
- column.fmt=LVCFMT_LEFT;
- column.cx = (INT)((rect.right - rect.left) * 0.32);
- column.iSubItem = 0;
- LoadString(hApplet, IDS_VARIABLE, szStr, sizeof(szStr) / sizeof(szStr[0]));
- column.pszText = szStr;
- (void)ListView_InsertColumn(hwndListView, 0, &column);
-
- column.cx = (INT)((rect.right - rect.left) * 0.63);
- column.iSubItem = 1;
- LoadString(hApplet, IDS_VALUE, szStr, sizeof(szStr) / sizeof(szStr[0]));
- column.pszText = szStr;
- (void)ListView_InsertColumn(hwndListView, 1, &column);
+ RECT rect;
+ LV_COLUMN column;
+ TCHAR szStr[32];
+
+ GetClientRect(hwndListView, &rect);
+
+ memset(&column, 0x00, sizeof(column));
+ column.mask=LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
+ column.fmt=LVCFMT_LEFT;
+ column.cx = (INT)((rect.right - rect.left) * 0.32);
+ column.iSubItem = 0;
+ LoadString(hApplet, IDS_VARIABLE, szStr, sizeof(szStr) / sizeof(szStr[0]));
+ column.pszText = szStr;
+ (void)ListView_InsertColumn(hwndListView, 0, &column);
+
+ column.cx = (INT)((rect.right - rect.left) * 0.63);
+ column.iSubItem = 1;
+ LoadString(hApplet, IDS_VALUE, szStr, sizeof(szStr) / sizeof(szStr[0]));
+ column.pszText = szStr;
+ (void)ListView_InsertColumn(hwndListView, 1, &column);
}
static VOID
OnInitDialog(HWND hwndDlg)
{
- HWND hwndListView;
-
- /* Set user environment variables */
- hwndListView = GetDlgItem(hwndDlg, IDC_USER_VARIABLE_LIST);
-
- SetListViewColumns(hwndListView);
-
- SetEnvironmentVariables(hwndListView,
- HKEY_CURRENT_USER,
- _T("Environment"));
-
- (void)ListView_SetColumnWidth(hwndListView,2,LVSCW_AUTOSIZE_USEHEADER);
- (void)ListView_Update(hwndListView,0);
-
-
- /* Set system environment variables */
- hwndListView = GetDlgItem(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
-
- SetListViewColumns(hwndListView);
-
- SetEnvironmentVariables(hwndListView,
- HKEY_LOCAL_MACHINE,
- _T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"));
-
- (void)ListView_SetColumnWidth(hwndListView,2,LVSCW_AUTOSIZE_USEHEADER);
- (void)ListView_Update(hwndListView,0);
+ HWND hwndListView;
+
+ /* Set user environment variables */
+ hwndListView = GetDlgItem(hwndDlg, IDC_USER_VARIABLE_LIST);
+
+ SetListViewColumns(hwndListView);
+
+ SetEnvironmentVariables(hwndListView,
+ HKEY_CURRENT_USER,
+ _T("Environment"));
+
+ (void)ListView_SetColumnWidth(hwndListView,2,LVSCW_AUTOSIZE_USEHEADER);
+ (void)ListView_Update(hwndListView,0);
+
+
+ /* Set system environment variables */
+ hwndListView = GetDlgItem(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
+
+ SetListViewColumns(hwndListView);
+
+ SetEnvironmentVariables(hwndListView,
+ HKEY_LOCAL_MACHINE,
+ _T("SYSTEM\\CurrentControlSet\\Control\\Session
Manager\\Environment"));
+
+ (void)ListView_SetColumnWidth(hwndListView,2,LVSCW_AUTOSIZE_USEHEADER);
+ (void)ListView_Update(hwndListView,0);
}
VOID
OnNewVariable(HWND hwndDlg,
- int iDlgItem)
-{
- HWND hwndListView;
- PVARIABLE_DATA VarData;
- LV_ITEM lvi;
- int iItem;
-
- hwndListView = GetDlgItem(hwndDlg, iDlgItem);
-
- VarData = GlobalAlloc(GPTR, sizeof(VARIABLE_DATA));
-
- if (!DialogBoxParam(hApplet,
- MAKEINTRESOURCE(IDD_EDIT_VARIABLE),
- hwndDlg,
- (DLGPROC) EditVariableDlgProc,
- (LPARAM)VarData) > 0)
- {
- if (VarData->lpName != NULL)
- GlobalFree(VarData->lpName);
-
- if (VarData->lpRawValue != NULL)
- GlobalFree(VarData->lpRawValue);
-
- if (VarData->lpCookedValue != NULL)
- GlobalFree(VarData->lpCookedValue);
-
- GlobalFree(VarData);
- }
-
- memset(&lvi, 0x00, sizeof(lvi));
- lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
- lvi.lParam = (LPARAM)VarData;
- lvi.pszText = VarData->lpName;
- lvi.state = 0;
- iItem = ListView_InsertItem(hwndListView, &lvi);
-
- ListView_SetItemText(hwndListView, iItem, 1,
- (VarData->lpCookedValue) ? VarData->lpCookedValue :
VarData->lpRawValue);
+ int iDlgItem)
+{
+ HWND hwndListView;
+ PVARIABLE_DATA VarData;
+ LV_ITEM lvi;
+ int iItem;
+
+ hwndListView = GetDlgItem(hwndDlg, iDlgItem);
+
+ VarData = GlobalAlloc(GPTR, sizeof(VARIABLE_DATA));
+
+ if (!DialogBoxParam(hApplet,
+ MAKEINTRESOURCE(IDD_EDIT_VARIABLE),
+ hwndDlg,
+ (DLGPROC) EditVariableDlgProc,
+ (LPARAM)VarData) > 0)
+ {
+ if (VarData->lpName != NULL)
+ GlobalFree(VarData->lpName);
+
+ if (VarData->lpRawValue != NULL)
+ GlobalFree(VarData->lpRawValue);
+
+ if (VarData->lpCookedValue != NULL)
+ GlobalFree(VarData->lpCookedValue);
+
+ GlobalFree(VarData);
+ }
+
+ memset(&lvi, 0x00, sizeof(lvi));
+ lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
+ lvi.lParam = (LPARAM)VarData;
+ lvi.pszText = VarData->lpName;
+ lvi.state = 0;
+ iItem = ListView_InsertItem(hwndListView, &lvi);
+
+ ListView_SetItemText(hwndListView, iItem, 1,
+ (VarData->lpCookedValue) ? VarData->lpCookedValue :
VarData->lpRawValue);
}
VOID
OnEditVariable(HWND hwndDlg,
- int iDlgItem)
-{
- HWND hwndListView;
- PVARIABLE_DATA VarData;
- LV_ITEM lvi;
- int iItem;
-
- hwndListView = GetDlgItem(hwndDlg, iDlgItem);
-
- iItem = ListView_GetSelectionMark(hwndListView);
- if (iItem != -1)
- {
- memset(&lvi, 0x00, sizeof(lvi));
- lvi.mask = LVIF_PARAM;
- lvi.iItem = iItem;
-
- if (ListView_GetItem(hwndListView, &lvi))
- {
- VarData = (PVARIABLE_DATA)lvi.lParam;
-
- if (DialogBoxParam(hApplet,
- MAKEINTRESOURCE(IDD_EDIT_VARIABLE),
- hwndDlg,
- (DLGPROC) EditVariableDlgProc,
- (LPARAM)VarData) > 0)
- {
- ListView_SetItemText(hwndListView, iItem, 0, VarData->lpName);
- ListView_SetItemText(hwndListView, iItem, 1,
- (VarData->lpCookedValue) ? VarData->lpCookedValue :
VarData->lpRawValue);
- }
- }
- }
+ int iDlgItem)
+{
+ HWND hwndListView;
+ PVARIABLE_DATA VarData;
+ LV_ITEM lvi;
+ int iItem;
+
+ hwndListView = GetDlgItem(hwndDlg, iDlgItem);
+
+ iItem = ListView_GetSelectionMark(hwndListView);
+ if (iItem != -1)
+ {
+ memset(&lvi, 0x00, sizeof(lvi));
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = iItem;
+
+ if (ListView_GetItem(hwndListView, &lvi))
+ {
+ VarData = (PVARIABLE_DATA)lvi.lParam;
+
+ if (DialogBoxParam(hApplet,
+ MAKEINTRESOURCE(IDD_EDIT_VARIABLE),
+ hwndDlg,
+ (DLGPROC) EditVariableDlgProc,
+ (LPARAM)VarData) > 0)
+ {
+ ListView_SetItemText(hwndListView, iItem, 0, VarData->lpName);
+ ListView_SetItemText(hwndListView, iItem, 1,
+ (VarData->lpCookedValue) ? VarData->lpCookedValue :
VarData->lpRawValue);
+ }
+ }
+ }
}
VOID
OnDeleteVariable(HWND hwndDlg,
- int iDlgItem)
-{
- HWND hwndListView;
- PVARIABLE_DATA VarData;
- LV_ITEM lvi;
- int iItem;
-
- hwndListView = GetDlgItem(hwndDlg, iDlgItem);
-
- iItem = ListView_GetSelectionMark(hwndListView);
- if (iItem != -1)
- {
- memset(&lvi, 0x00, sizeof(lvi));
- lvi.mask = LVIF_PARAM;
- lvi.iItem = iItem;
-
- if (ListView_GetItem(hwndListView, &lvi))
- {
- VarData = (PVARIABLE_DATA)lvi.lParam;
- if (VarData != NULL)
- {
- if (VarData->lpName != NULL)
- GlobalFree(VarData->lpName);
-
- if (VarData->lpRawValue != NULL)
- GlobalFree(VarData->lpRawValue);
-
- if (VarData->lpCookedValue != NULL)
- GlobalFree(VarData->lpCookedValue);
-
- GlobalFree(VarData);
- lvi.lParam = 0;
- }
- }
-
- (void)ListView_DeleteItem(hwndListView, iItem);
- }
+ int iDlgItem)
+{
+ HWND hwndListView;
+ PVARIABLE_DATA VarData;
+ LV_ITEM lvi;
+ int iItem;
+
+ hwndListView = GetDlgItem(hwndDlg, iDlgItem);
+
+ iItem = ListView_GetSelectionMark(hwndListView);
+ if (iItem != -1)
+ {
+ memset(&lvi, 0x00, sizeof(lvi));
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = iItem;
+
+ if (ListView_GetItem(hwndListView, &lvi))
+ {
+ VarData = (PVARIABLE_DATA)lvi.lParam;
+ if (VarData != NULL)
+ {
+ if (VarData->lpName != NULL)
+ GlobalFree(VarData->lpName);
+
+ if (VarData->lpRawValue != NULL)
+ GlobalFree(VarData->lpRawValue);
+
+ if (VarData->lpCookedValue != NULL)
+ GlobalFree(VarData->lpCookedValue);
+
+ GlobalFree(VarData);
+ lvi.lParam = 0;
+ }
+ }
+
+ (void)ListView_DeleteItem(hwndListView, iItem);
+ }
}
VOID
ReleaseListViewItems(HWND hwndDlg,
- int iDlgItem)
-{
- HWND hwndListView;
- PVARIABLE_DATA VarData;
- int nItemCount;
- LV_ITEM lvi;
- int i;
-
- hwndListView = GetDlgItem(hwndDlg, iDlgItem);
-
- memset(&lvi, 0x00, sizeof(lvi));
-
- nItemCount = ListView_GetItemCount(hwndListView);
- for (i = 0; i < nItemCount; i++)
- {
- lvi.mask = LVIF_PARAM;
- lvi.iItem = i;
-
- if (ListView_GetItem(hwndListView, &lvi))
- {
- VarData = (PVARIABLE_DATA)lvi.lParam;
- if (VarData != NULL)
- {
- if (VarData->lpName != NULL)
- GlobalFree(VarData->lpName);
-
- if (VarData->lpRawValue != NULL)
- GlobalFree(VarData->lpRawValue);
-
- if (VarData->lpCookedValue != NULL)
- GlobalFree(VarData->lpCookedValue);
-
- GlobalFree(VarData);
- lvi.lParam = 0;
- }
- }
- }
+ int iDlgItem)
+{
+ HWND hwndListView;
+ PVARIABLE_DATA VarData;
+ int nItemCount;
+ LV_ITEM lvi;
+ int i;
+
+ hwndListView = GetDlgItem(hwndDlg, iDlgItem);
+
+ memset(&lvi, 0x00, sizeof(lvi));
+
+ nItemCount = ListView_GetItemCount(hwndListView);
+ for (i = 0; i < nItemCount; i++)
+ {
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = i;
+
+ if (ListView_GetItem(hwndListView, &lvi))
+ {
+ VarData = (PVARIABLE_DATA)lvi.lParam;
+ if (VarData != NULL)
+ {
+ if (VarData->lpName != NULL)
+ GlobalFree(VarData->lpName);
+
+ if (VarData->lpRawValue != NULL)
+ GlobalFree(VarData->lpRawValue);
+
+ if (VarData->lpCookedValue != NULL)
+ GlobalFree(VarData->lpCookedValue);
+
+ GlobalFree(VarData);
+ lvi.lParam = 0;
+ }
+ }
+ }
}
VOID
SetAllVars(HWND hwndDlg,
- INT iDlgItem)
-{
- HWND hwndListView;
- PVARIABLE_DATA VarData;
- LV_ITEM lvi;
- INT iItem;
- HKEY hk;
- DWORD Type = 0;
-
- memset(&lvi, 0x00, sizeof(lvi));
-
- /* Get the handle to the list box with all system vars in it */
- hwndListView = GetDlgItem(hwndDlg, iDlgItem);
- /* first item is 0 */
- iItem = 0;
- /* set up struct to retreive item */
- lvi.mask = LVIF_PARAM;
- lvi.iItem = iItem;
-
- /* Open or create the key */
- if (RegCreateKeyEx((iDlgItem == IDC_SYSTEM_VARIABLE_LIST ? HKEY_LOCAL_MACHINE :
HKEY_CURRENT_USER),
- (iDlgItem == IDC_SYSTEM_VARIABLE_LIST ?
_T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment") :
_T("Environment")),
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_WRITE | KEY_READ,
- NULL,
- &hk,
- NULL))
- {
- return;
- }
-
- /* loop through all system variables */
- while(ListView_GetItem(hwndListView, &lvi))
- {
- /* Get the data in each item */
- VarData = (PVARIABLE_DATA)lvi.lParam;
- if (VarData != NULL)
- {
- /* Get the type */
- RegQueryValueEx(hk,VarData->lpName,NULL,&Type,NULL,NULL);
-
- /* Set the new value */
- if (RegSetValueEx(hk,
- VarData->lpName,
- 0,
- Type,
- (LPBYTE) VarData->lpRawValue,
- (DWORD) (_tcslen(VarData->lpRawValue)* sizeof(TCHAR))+1)) // was
_tcsclen. lstrlen?
- {
- RegCloseKey(hk);
- return;
- }
- }
- /* Fill struct for next item */
- lvi.mask = LVIF_PARAM;
- lvi.iItem = ++iItem;
- }
-
- RegCloseKey(hk);
+ INT iDlgItem)
+{
+ HWND hwndListView;
+ PVARIABLE_DATA VarData;
+ LV_ITEM lvi;
+ INT iItem;
+ HKEY hk;
+ DWORD Type = 0;
+
+ memset(&lvi, 0x00, sizeof(lvi));
+
+ /* Get the handle to the list box with all system vars in it */
+ hwndListView = GetDlgItem(hwndDlg, iDlgItem);
+ /* first item is 0 */
+ iItem = 0;
+ /* set up struct to retreive item */
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = iItem;
+
+ /* Open or create the key */
+ if (RegCreateKeyEx((iDlgItem == IDC_SYSTEM_VARIABLE_LIST ? HKEY_LOCAL_MACHINE :
HKEY_CURRENT_USER),
+ (iDlgItem == IDC_SYSTEM_VARIABLE_LIST ?
_T("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment") :
_T("Environment")),
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_WRITE | KEY_READ,
+ NULL,
+ &hk,
+ NULL))
+ {
+ return;
+ }
+
+ /* loop through all system variables */
+ while(ListView_GetItem(hwndListView, &lvi))
+ {
+ /* Get the data in each item */
+ VarData = (PVARIABLE_DATA)lvi.lParam;
+ if (VarData != NULL)
+ {
+ /* Get the type */
+ RegQueryValueEx(hk,VarData->lpName,NULL,&Type,NULL,NULL);
+
+ /* Set the new value */
+ if (RegSetValueEx(hk,
+ VarData->lpName,
+ 0,
+ Type,
+ (LPBYTE) VarData->lpRawValue,
+ (DWORD) (_tcslen(VarData->lpRawValue)* sizeof(TCHAR))+1)) // was _tcsclen.
lstrlen?
+ {
+ RegCloseKey(hk);
+ return;
+ }
+ }
+ /* Fill struct for next item */
+ lvi.mask = LVIF_PARAM;
+ lvi.iItem = ++iItem;
+ }
+
+ RegCloseKey(hk);
}
/* Environment dialog procedure */
INT_PTR CALLBACK
EnvironmentDlgProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
-{
- switch (uMsg)
- {
- case WM_INITDIALOG:
- OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDC_USER_VARIABLE_NEW:
- OnNewVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
- return TRUE;
-
- case IDC_USER_VARIABLE_EDIT:
- OnEditVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
- return TRUE;
-
- case IDC_USER_VARIABLE_DELETE:
- OnDeleteVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
- return TRUE;
-
- case IDC_SYSTEM_VARIABLE_NEW:
- OnNewVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
- return TRUE;
-
- case IDC_SYSTEM_VARIABLE_EDIT:
- OnEditVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
- return TRUE;
-
- case IDC_SYSTEM_VARIABLE_DELETE:
- OnDeleteVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
- return TRUE;
-
- case IDOK:
- SetAllVars(hwndDlg, IDC_USER_VARIABLE_LIST);
- SetAllVars(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
-
- case IDCANCEL:
- ReleaseListViewItems(hwndDlg, IDC_USER_VARIABLE_LIST);
- ReleaseListViewItems(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
- EndDialog(hwndDlg, 0);
- return TRUE;
- }
- break;
-
- case WM_NOTIFY:
- {
- NMHDR *phdr;
-
- phdr = (NMHDR*)lParam;
- switch(phdr->code)
- {
- case NM_DBLCLK:
- {
- if (phdr->idFrom == IDC_USER_VARIABLE_LIST ||
- phdr->idFrom == IDC_SYSTEM_VARIABLE_LIST)
- {
- OnEditVariable(hwndDlg, (INT)phdr->idFrom);
- return TRUE;
- }
- }
- }
- }
- break;
- }
-
- return FALSE;
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDC_USER_VARIABLE_NEW:
+ OnNewVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
+ return TRUE;
+
+ case IDC_USER_VARIABLE_EDIT:
+ OnEditVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
+ return TRUE;
+
+ case IDC_USER_VARIABLE_DELETE:
+ OnDeleteVariable(hwndDlg, IDC_USER_VARIABLE_LIST);
+ return TRUE;
+
+ case IDC_SYSTEM_VARIABLE_NEW:
+ OnNewVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
+ return TRUE;
+
+ case IDC_SYSTEM_VARIABLE_EDIT:
+ OnEditVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
+ return TRUE;
+
+ case IDC_SYSTEM_VARIABLE_DELETE:
+ OnDeleteVariable(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
+ return TRUE;
+
+ case IDOK:
+ SetAllVars(hwndDlg, IDC_USER_VARIABLE_LIST);
+ SetAllVars(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
+
+ case IDCANCEL:
+ ReleaseListViewItems(hwndDlg, IDC_USER_VARIABLE_LIST);
+ ReleaseListViewItems(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
+ EndDialog(hwndDlg, 0);
+ return TRUE;
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ NMHDR *phdr;
+
+ phdr = (NMHDR*)lParam;
+ switch(phdr->code)
+ {
+ case NM_DBLCLK:
+ {
+ if (phdr->idFrom == IDC_USER_VARIABLE_LIST ||
+ phdr->idFrom == IDC_SYSTEM_VARIABLE_LIST)
+ {
+ OnEditVariable(hwndDlg, (INT)phdr->idFrom);
+ return TRUE;
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ return FALSE;
}
/* EOF */
Modified: trunk/reactos/dll/cpl/sysdm/general.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/general.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/general.c (original)
+++ trunk/reactos/dll/cpl/sysdm/general.c Mon Jul 23 14:26:55 2007
@@ -14,60 +14,60 @@
typedef struct _IMGINFO
{
- HBITMAP hBitmap;
- INT cxSource;
- INT cySource;
+ HBITMAP hBitmap;
+ INT cxSource;
+ INT cySource;
} IMGINFO, *PIMGINFO;
void
ShowLastWin32Error(HWND hWndOwner)
{
- LPTSTR lpMsg;
- DWORD LastError;
-
- LastError = GetLastError();
-
- if((LastError == 0) ||
- !FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- LastError,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR)&lpMsg,
- 0,
- NULL))
- {
- return;
- }
-
- MessageBox(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
-
- LocalFree((LPVOID)lpMsg);
+ LPTSTR lpMsg;
+ DWORD LastError;
+
+ LastError = GetLastError();
+
+ if((LastError == 0) ||
+ !FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ LastError,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&lpMsg,
+ 0,
+ NULL))
+ {
+ return;
+ }
+
+ MessageBox(hWndOwner, lpMsg, NULL, MB_OK | MB_ICONERROR);
+
+ LocalFree((LPVOID)lpMsg);
}
static VOID
InitImageInfo(PIMGINFO ImgInfo)
{
- BITMAP bitmap;
-
- ZeroMemory(ImgInfo, sizeof(*ImgInfo));
-
- ImgInfo->hBitmap = LoadImage(hApplet,
- MAKEINTRESOURCE(IDB_ROSBMP),
- IMAGE_BITMAP,
- 0,
- 0,
- LR_DEFAULTCOLOR);
-
- if (ImgInfo->hBitmap != NULL)
- {
- GetObject(ImgInfo->hBitmap, sizeof(BITMAP), &bitmap);
-
- ImgInfo->cxSource = bitmap.bmWidth;
- ImgInfo->cySource = bitmap.bmHeight;
- }
+ BITMAP bitmap;
+
+ ZeroMemory(ImgInfo, sizeof(*ImgInfo));
+
+ ImgInfo->hBitmap = LoadImage(hApplet,
+ MAKEINTRESOURCE(IDB_ROSBMP),
+ IMAGE_BITMAP,
+ 0,
+ 0,
+ LR_DEFAULTCOLOR);
+
+ if (ImgInfo->hBitmap != NULL)
+ {
+ GetObject(ImgInfo->hBitmap, sizeof(BITMAP), &bitmap);
+
+ ImgInfo->cxSource = bitmap.bmWidth;
+ ImgInfo->cySource = bitmap.bmHeight;
+ }
}
@@ -77,38 +77,38 @@
LPTSTR Value,
UINT uID)
{
- LPTSTR lpBuf = NULL;
- DWORD BufSize = 0;
- DWORD Type;
-
- if (RegQueryValueEx(hKey,
- Value,
- NULL,
- &Type,
- NULL,
- &BufSize) == ERROR_SUCCESS)
- {
- lpBuf = HeapAlloc(GetProcessHeap(),
- 0,
- BufSize);
- if (!lpBuf) return;
-
- if (RegQueryValueEx(hKey,
- Value,
- NULL,
- &Type,
- (PBYTE)lpBuf,
- &BufSize) == ERROR_SUCCESS)
- {
- SetDlgItemText(hwnd,
- uID,
- lpBuf);
- }
-
- HeapFree(GetProcessHeap(),
- 0,
- lpBuf);
- }
+ LPTSTR lpBuf = NULL;
+ DWORD BufSize = 0;
+ DWORD Type;
+
+ if (RegQueryValueEx(hKey,
+ Value,
+ NULL,
+ &Type,
+ NULL,
+ &BufSize) == ERROR_SUCCESS)
+ {
+ lpBuf = HeapAlloc(GetProcessHeap(),
+ 0,
+ BufSize);
+ if (!lpBuf) return;
+
+ if (RegQueryValueEx(hKey,
+ Value,
+ NULL,
+ &Type,
+ (PBYTE)lpBuf,
+ &BufSize) == ERROR_SUCCESS)
+ {
+ SetDlgItemText(hwnd,
+ uID,
+ lpBuf);
+ }
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ lpBuf);
+ }
}
static INT
@@ -207,145 +207,145 @@
UINT uID)
{
- TCHAR szBuf[64];
- DWORD BufSize = sizeof(DWORD);
- DWORD Type = REG_SZ;
- PROCESSOR_POWER_INFORMATION ppi;
-
- ZeroMemory(&ppi,
- sizeof(ppi));
-
- if ((CallNtPowerInformation(ProcessorInformation,
- NULL,
- 0,
- (PVOID)&ppi,
- sizeof(ppi)) == STATUS_SUCCESS &&
- ppi.CurrentMhz != 0) ||
- RegQueryValueEx(hKey,
- Value,
- NULL,
- &Type,
- (PBYTE)&ppi.CurrentMhz,
- &BufSize) == ERROR_SUCCESS)
- {
- if (ppi.CurrentMhz < 1000)
- {
- _stprintf(szBuf, _T("%lu MHz"), ppi.CurrentMhz);
- }
- else
- {
- double flt = ppi.CurrentMhz / 1000.0;
- _stprintf(szBuf, _T("%.2f GHz"), flt);
- }
-
- SetDlgItemText(hwnd,
- uID,
- szBuf);
- }
+ TCHAR szBuf[64];
+ DWORD BufSize = sizeof(DWORD);
+ DWORD Type = REG_SZ;
+ PROCESSOR_POWER_INFORMATION ppi;
+
+ ZeroMemory(&ppi,
+ sizeof(ppi));
+
+ if ((CallNtPowerInformation(ProcessorInformation,
+ NULL,
+ 0,
+ (PVOID)&ppi,
+ sizeof(ppi)) == STATUS_SUCCESS &&
+ ppi.CurrentMhz != 0) ||
+ RegQueryValueEx(hKey,
+ Value,
+ NULL,
+ &Type,
+ (PBYTE)&ppi.CurrentMhz,
+ &BufSize) == ERROR_SUCCESS)
+ {
+ if (ppi.CurrentMhz < 1000)
+ {
+ _stprintf(szBuf, _T("%lu MHz"), ppi.CurrentMhz);
+ }
+ else
+ {
+ double flt = ppi.CurrentMhz / 1000.0;
+ _stprintf(szBuf, _T("%.2f GHz"), flt);
+ }
+
+ SetDlgItemText(hwnd,
+ uID,
+ szBuf);
+ }
}
static VOID
GetSystemInformation(HWND hwnd)
{
- HKEY hKey;
- TCHAR ProcKey[] =
_T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
- MEMORYSTATUSEX MemStat;
- TCHAR Buf[32];
- INT Ret = 0;
- INT CurMachineLine = IDC_MACHINELINE1;
-
-
- /* Get Processor information *
- * although undocumented, this information is being pulled
- * directly out of the registry instead of via setupapi as it
- * contains all the info we need, and should remain static
- */
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- ProcKey,
- 0,
- KEY_READ,
- &hKey) == ERROR_SUCCESS)
- {
- SetRegTextData(hwnd,
- hKey,
- _T("VendorIdentifier"),
- CurMachineLine);
- CurMachineLine++;
-
- Ret = SetProcNameString(hwnd,
- hKey,
- _T("ProcessorNameString"),
- CurMachineLine,
- CurMachineLine+1);
- CurMachineLine += Ret;
-
- SetProcSpeed(hwnd,
- hKey,
- _T("~MHz"),
- CurMachineLine);
- CurMachineLine++;
- }
-
-
- /* Get total physical RAM */
- MemStat.dwLength = sizeof(MemStat);
- if (GlobalMemoryStatusEx(&MemStat))
- {
- TCHAR szStr[32];
- double dTotalPhys;
- UINT i = 0;
- static const UINT uStrId[] = {
- IDS_MEGABYTE,
- IDS_GIGABYTE,
- IDS_TERABYTE,
- IDS_PETABYTE
- };
-
- if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
- {
- /* We're dealing with GBs or more */
- MemStat.ullTotalPhys /= 1024 * 1024;
- i++;
-
- if (MemStat.ullTotalPhys > 1024 * 1024)
- {
- /* We're dealing with TBs or more */
- MemStat.ullTotalPhys /= 1024;
- i++;
-
- if (MemStat.ullTotalPhys > 1024 * 1024)
- {
- /* We're dealing with PBs or more */
-
- MemStat.ullTotalPhys /= 1024;
- i++;
-
- dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
- }
- else
- dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
- }
- else
- dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
- }
- else
- {
- /* We're daling with MBs */
- dTotalPhys = (double)MemStat.ullTotalPhys / 1024 / 1024;
- }
-
- if (LoadString(hApplet, uStrId[i], szStr, sizeof(szStr) / sizeof(szStr[0])))
- {
- Ret = _stprintf(Buf, _T("%.2f %s"), dTotalPhys, szStr);
- }
- }
-
- if (Ret)
- {
- SetDlgItemText(hwnd,
- CurMachineLine,
- Buf);
- }
+ HKEY hKey;
+ TCHAR ProcKey[] = _T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
+ MEMORYSTATUSEX MemStat;
+ TCHAR Buf[32];
+ INT Ret = 0;
+ INT CurMachineLine = IDC_MACHINELINE1;
+
+
+ /* Get Processor information *
+ * although undocumented, this information is being pulled
+ * directly out of the registry instead of via setupapi as it
+ * contains all the info we need, and should remain static
+ */
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ ProcKey,
+ 0,
+ KEY_READ,
+ &hKey) == ERROR_SUCCESS)
+ {
+ SetRegTextData(hwnd,
+ hKey,
+ _T("VendorIdentifier"),
+ CurMachineLine);
+ CurMachineLine++;
+
+ Ret = SetProcNameString(hwnd,
+ hKey,
+ _T("ProcessorNameString"),
+ CurMachineLine,
+ CurMachineLine+1);
+ CurMachineLine += Ret;
+
+ SetProcSpeed(hwnd,
+ hKey,
+ _T("~MHz"),
+ CurMachineLine);
+ CurMachineLine++;
+ }
+
+
+ /* Get total physical RAM */
+ MemStat.dwLength = sizeof(MemStat);
+ if (GlobalMemoryStatusEx(&MemStat))
+ {
+ TCHAR szStr[32];
+ double dTotalPhys;
+ UINT i = 0;
+ static const UINT uStrId[] = {
+ IDS_MEGABYTE,
+ IDS_GIGABYTE,
+ IDS_TERABYTE,
+ IDS_PETABYTE
+ };
+
+ if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
+ {
+ /* We're dealing with GBs or more */
+ MemStat.ullTotalPhys /= 1024 * 1024;
+ i++;
+
+ if (MemStat.ullTotalPhys > 1024 * 1024)
+ {
+ /* We're dealing with TBs or more */
+ MemStat.ullTotalPhys /= 1024;
+ i++;
+
+ if (MemStat.ullTotalPhys > 1024 * 1024)
+ {
+ /* We're dealing with PBs or more */
+
+ MemStat.ullTotalPhys /= 1024;
+ i++;
+
+ dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
+ }
+ else
+ dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
+ }
+ else
+ dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
+ }
+ else
+ {
+ /* We're daling with MBs */
+ dTotalPhys = (double)MemStat.ullTotalPhys / 1024 / 1024;
+ }
+
+ if (LoadString(hApplet, uStrId[i], szStr, sizeof(szStr) / sizeof(szStr[0])))
+ {
+ Ret = _stprintf(Buf, _T("%.2f %s"), dTotalPhys, szStr);
+ }
+ }
+
+ if (Ret)
+ {
+ SetDlgItemText(hwnd,
+ CurMachineLine,
+ Buf);
+ }
}
@@ -356,89 +356,84 @@
WPARAM wParam,
LPARAM lParam)
{
- static IMGINFO ImgInfo;
-
- UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(wParam);
-
- switch(uMsg)
- {
- case WM_INITDIALOG:
- {
- InitImageInfo(&ImgInfo);
- GetSystemInformation(hwndDlg);
- }
- break;
-
- case WM_COMMAND:
- {
- if (LOWORD(wParam) == IDC_LICENCE)
- {
- DialogBox(hApplet,
- MAKEINTRESOURCE(IDD_LICENCE),
- hwndDlg,
- LicenceDlgProc);
-
- return TRUE;
- }
- }
- break;
-
- case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT lpDrawItem;
- lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
- if(lpDrawItem->CtlID == IDC_ROSIMG)
- {
- HDC hdcMem;
- LONG left;
-
- /* position image in centre of dialog */
- left = (lpDrawItem->rcItem.right - ImgInfo.cxSource) / 2;
-
- hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
- if (hdcMem != NULL)
- {
- SelectObject(hdcMem, ImgInfo.hBitmap);
- BitBlt(lpDrawItem->hDC,
- left,
- lpDrawItem->rcItem.top,
- lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
- lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
- hdcMem,
- 0,
- 0,
- SRCCOPY);
- DeleteDC(hdcMem);
- }
- }
- return TRUE;
- }
-
- case WM_NOTIFY:
- {
- NMHDR *nmhdr = (NMHDR *)lParam;
-
- if (nmhdr->idFrom == IDC_ROSHOMEPAGE_LINK && nmhdr->code ==
NM_CLICK)
- {
- PNMLINK nml = (PNMLINK)nmhdr;
-
- ShellExecuteW(hwndDlg,
- L"open",
- nml->item.szUrl,
- NULL,
- NULL,
- SW_SHOWNORMAL);
- }
- break;
- }
-
- }
-
- return FALSE;
-}
-
-
-
-
-
+ static IMGINFO ImgInfo;
+
+ UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(wParam);
+
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ InitImageInfo(&ImgInfo);
+ GetSystemInformation(hwndDlg);
+ }
+ break;
+
+ case WM_COMMAND:
+ {
+ if (LOWORD(wParam) == IDC_LICENCE)
+ {
+ DialogBox(hApplet,
+ MAKEINTRESOURCE(IDD_LICENCE),
+ hwndDlg,
+ LicenceDlgProc);
+
+ return TRUE;
+ }
+ }
+ break;
+
+ case WM_DRAWITEM:
+ {
+ LPDRAWITEMSTRUCT lpDrawItem;
+ lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
+ if(lpDrawItem->CtlID == IDC_ROSIMG)
+ {
+ HDC hdcMem;
+ LONG left;
+
+ /* position image in centre of dialog */
+ left = (lpDrawItem->rcItem.right - ImgInfo.cxSource) / 2;
+
+ hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
+ if (hdcMem != NULL)
+ {
+ SelectObject(hdcMem, ImgInfo.hBitmap);
+ BitBlt(lpDrawItem->hDC,
+ left,
+ lpDrawItem->rcItem.top,
+ lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
+ lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
+ hdcMem,
+ 0,
+ 0,
+ SRCCOPY);
+ DeleteDC(hdcMem);
+ }
+ }
+ return TRUE;
+ }
+
+ case WM_NOTIFY:
+ {
+ NMHDR *nmhdr = (NMHDR *)lParam;
+
+ if (nmhdr->idFrom == IDC_ROSHOMEPAGE_LINK && nmhdr->code == NM_CLICK)
+ {
+ PNMLINK nml = (PNMLINK)nmhdr;
+
+ ShellExecuteW(hwndDlg,
+ L"open",
+ nml->item.szUrl,
+ NULL,
+ NULL,
+ SW_SHOWNORMAL);
+ }
+ break;
+ }
+
+ }
+
+ return FALSE;
+}
Modified: trunk/reactos/dll/cpl/sysdm/hardprof.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/hardprof.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/hardprof.c (original)
+++ trunk/reactos/dll/cpl/sysdm/hardprof.c Mon Jul 23 14:26:55 2007
@@ -12,77 +12,76 @@
/* Property page dialog callback */
static INT_PTR CALLBACK
RenameProfDlgProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(hwndDlg);
- switch(uMsg)
- {
- case WM_INITDIALOG:
- {
- MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
- }
- break;
+ UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(wParam);
+ UNREFERENCED_PARAMETER(hwndDlg);
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
+ }
+ break;
- case WM_COMMAND:
- {
- if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
- {
- EndDialog(hwndDlg,
- LOWORD(wParam));
- return TRUE;
- }
- }
- break;
- }
- return FALSE;
+ case WM_COMMAND:
+ {
+ if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
+ {
+ EndDialog(hwndDlg,
+ LOWORD(wParam));
+ return TRUE;
+ }
+ }
+ break;
+ }
+ return FALSE;
}
/* Property page dialog callback */
INT_PTR CALLBACK
HardProfDlgProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(hwndDlg);
- switch(uMsg)
- {
- case WM_INITDIALOG:
- {
- MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
- }
- break;
+ UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(wParam);
+ UNREFERENCED_PARAMETER(hwndDlg);
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
+ }
+ break;
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_HRDPROFRENAME:
- {
- DialogBox(hApplet,
- MAKEINTRESOURCE(IDD_RENAMEPROFILE),
- hwndDlg,
- (DLGPROC)RenameProfDlgProc);
- }
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_HRDPROFRENAME:
+ {
+ DialogBox(hApplet,
+ MAKEINTRESOURCE(IDD_RENAMEPROFILE),
+ hwndDlg,
+ (DLGPROC)RenameProfDlgProc);
+ }
- case IDOK:
- case IDCANCEL:
- {
- EndDialog(hwndDlg,
- LOWORD(wParam));
- return TRUE;
- }
- }
-
- }
- break;
- }
- return FALSE;
+ case IDOK:
+ case IDCANCEL:
+ {
+ EndDialog(hwndDlg,
+ LOWORD(wParam));
+ return TRUE;
+ }
+ }
+ }
+ break;
+ }
+ return FALSE;
}
Modified: trunk/reactos/dll/cpl/sysdm/hardware.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/hardware.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/hardware.c (original)
+++ trunk/reactos/dll/cpl/sysdm/hardware.c Mon Jul 23 14:26:55 2007
@@ -16,72 +16,71 @@
{
/* hack for ROS to start our devmgmt until we have mmc */
#ifdef __REACTOS__
- return ((INT)ShellExecuteW(NULL, L"open", L"devmgmt.exe", NULL,
NULL, SW_SHOWNORMAL) > 32);
+ return ((INT)ShellExecuteW(NULL, L"open", L"devmgmt.exe", NULL,
NULL, SW_SHOWNORMAL) > 32);
#else
- HMODULE hDll;
- PDEVMGREXEC DevMgrExec;
- BOOL Ret;
+ HMODULE hDll;
+ PDEVMGREXEC DevMgrExec;
+ BOOL Ret;
- hDll = LoadLibrary(_TEXT("devmgr.dll"));
- if(!hDll)
- return FALSE;
+ hDll = LoadLibrary(_TEXT("devmgr.dll"));
+ if(!hDll)
+ return FALSE;
- DevMgrExec = (PDEVMGREXEC)GetProcAddress(hDll, "DeviceManager_ExecuteW");
- if(!DevMgrExec)
- {
- FreeLibrary(hDll);
- return FALSE;
- }
+ DevMgrExec = (PDEVMGREXEC)GetProcAddress(hDll, "DeviceManager_ExecuteW");
+ if(!DevMgrExec)
+ {
+ FreeLibrary(hDll);
+ return FALSE;
+ }
- /* run the Device Manager */
- Ret = DevMgrExec(hWndParent, hApplet, NULL /* ??? */, SW_SHOW);
- FreeLibrary(hDll);
- return Ret;
+ /* run the Device Manager */
+ Ret = DevMgrExec(hWndParent, hApplet, NULL /* ??? */, SW_SHOW);
+ FreeLibrary(hDll);
+ return Ret;
#endif /* __REACTOS__ */
}
/* Property page dialog callback */
INT_PTR CALLBACK
HardwarePageProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(lParam);
- switch(uMsg)
- {
- case WM_INITDIALOG:
- break;
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ break;
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDC_HARDWARE_DEVICE_MANAGER:
- {
- if(!LaunchDeviceManager(hwndDlg))
- {
- /* FIXME */
- }
+ case WM_COMMAND:
+ {
+ switch(LOWORD(wParam))
+ {
+ case IDC_HARDWARE_DEVICE_MANAGER:
+ {
+ if(!LaunchDeviceManager(hwndDlg))
+ {
+ /* FIXME */
+ }
- return TRUE;
- }
+ return TRUE;
+ }
- case IDC_HARDWARE_PROFILE:
- {
- DialogBox(hApplet,
- MAKEINTRESOURCE(IDD_HARDWAREPROFILES),
- hwndDlg,
- (DLGPROC)HardProfDlgProc);
+ case IDC_HARDWARE_PROFILE:
+ {
+ DialogBox(hApplet,
+ MAKEINTRESOURCE(IDD_HARDWAREPROFILES),
+ hwndDlg,
+ (DLGPROC)HardProfDlgProc);
- return TRUE;
- }
- }
- }
- break;
- }
+ return TRUE;
+ }
+ }
+ }
+ break;
+ }
- return FALSE;
+ return FALSE;
}
-
Modified: trunk/reactos/dll/cpl/sysdm/licence.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/licence.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/licence.c (original)
+++ trunk/reactos/dll/cpl/sysdm/licence.c Mon Jul 23 14:26:55 2007
@@ -12,70 +12,70 @@
INT_PTR CALLBACK
LicenceDlgProc(HWND hDlg,
- UINT message,
- WPARAM wParam,
- LPARAM lParam)
+ UINT message,
+ WPARAM wParam,
+ LPARAM lParam)
{
- HRSRC hResInfo;
- HGLOBAL hResMem;
- WCHAR *LicenseText;
- static HICON hIcon;
+ HRSRC hResInfo;
+ HGLOBAL hResMem;
+ WCHAR *LicenseText;
+ static HICON hIcon;
- UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(lParam);
- switch (message)
- {
- case WM_INITDIALOG:
- {
- hIcon = LoadImage(hApplet,
- MAKEINTRESOURCE(IDI_CPLSYSTEM),
- IMAGE_ICON,
- 16,
- 16,
- 0);
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ {
+ hIcon = LoadImage(hApplet,
+ MAKEINTRESOURCE(IDI_CPLSYSTEM),
+ IMAGE_ICON,
+ 16,
+ 16,
+ 0);
- SendMessage(hDlg,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM)hIcon);
+ SendMessage(hDlg,
+ WM_SETICON,
+ ICON_SMALL,
+ (LPARAM)hIcon);
- /* load license from resource */
- if(!(hResInfo = FindResource(hApplet,
- MAKEINTRESOURCE(RC_LICENSE),
- MAKEINTRESOURCE(RTDATA))) ||
- !(hResMem = LoadResource(hApplet, hResInfo)) ||
- !(LicenseText = LockResource(hResMem)))
- {
- ShowLastWin32Error(hDlg);
- break;
- }
+ /* load license from resource */
+ if(!(hResInfo = FindResource(hApplet,
+ MAKEINTRESOURCE(RC_LICENSE),
+ MAKEINTRESOURCE(RTDATA))) ||
+ !(hResMem = LoadResource(hApplet, hResInfo)) ||
+ !(LicenseText = LockResource(hResMem)))
+ {
+ ShowLastWin32Error(hDlg);
+ break;
+ }
- /* insert the license into the edit control (unicode!) */
- SetDlgItemText(hDlg,
- IDC_LICENCEEDIT,
- LicenseText);
+ /* insert the license into the edit control (unicode!) */
+ SetDlgItemText(hDlg,
+ IDC_LICENCEEDIT,
+ LicenseText);
- SendDlgItemMessage(hDlg,
- IDC_LICENCEEDIT,
- EM_SETSEL,
- -1,
- 0);
+ SendDlgItemMessage(hDlg,
+ IDC_LICENCEEDIT,
+ EM_SETSEL,
+ -1,
+ 0);
- return TRUE;
- }
+ return TRUE;
+ }
- case WM_COMMAND:
- {
- if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
- {
- DestroyIcon(hIcon);
- EndDialog(hDlg,
- LOWORD(wParam));
- return TRUE;
- }
- }
- break;
- }
+ case WM_COMMAND:
+ {
+ if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
+ {
+ DestroyIcon(hIcon);
+ EndDialog(hDlg,
+ LOWORD(wParam));
+ return TRUE;
+ }
+ }
+ break;
+ }
- return FALSE;
+ return FALSE;
}
Modified: trunk/reactos/dll/cpl/sysdm/startrec.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/startrec.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/startrec.c (original)
+++ trunk/reactos/dll/cpl/sysdm/startrec.c Mon Jul 23 14:26:55 2007
@@ -29,9 +29,9 @@
/* Property page dialog callback */
INT_PTR CALLBACK
StartRecDlgProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
TCHAR *szSystemDrive;
TCHAR szDefaultOS[MAX_PATH];
@@ -40,7 +40,7 @@
int iTimeout;
UNREFERENCED_PARAMETER(lParam);
-
+
switch(uMsg)
{
case WM_INITDIALOG:
@@ -89,7 +89,7 @@
HeapFree(GetProcessHeap(), 0, szSystemDrive);
}
}
-
+
SetDlgItemText(hwndDlg, IDC_STRRECDUMPFILE, _T("%SystemRoot%\\MiniDump"));
/* load settings from freeldr.ini */
@@ -143,6 +143,6 @@
}
}
break;
- }
- return FALSE;
+ }
+ return FALSE;
}
Modified: trunk/reactos/dll/cpl/sysdm/sysdm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/sysdm.c?rev=…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/sysdm.c (original)
+++ trunk/reactos/dll/cpl/sysdm/sysdm.c Mon Jul 23 14:26:55 2007
@@ -15,7 +15,7 @@
/* Applets */
APPLET Applets[NUM_APPLETS] =
{
- {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
+ {IDI_CPLSYSTEM, IDS_CPLSYSTEMNAME, IDS_CPLSYSTEMDESCRIPTION, SystemApplet}
};
#define MAX_SYSTEM_PAGES 32
@@ -23,39 +23,39 @@
static BOOL CALLBACK
PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
{
- PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam;
- if (ppsh != NULL && ppsh->nPages < MAX_SYSTEM_PAGES)
- {
- ppsh->phpage[ppsh->nPages++] = hpage;
- return TRUE;
- }
-
- return FALSE;
+ PROPSHEETHEADER *ppsh = (PROPSHEETHEADER *)lParam;
+ if (ppsh != NULL && ppsh->nPages < MAX_SYSTEM_PAGES)
+ {
+ ppsh->phpage[ppsh->nPages++] = hpage;
+ return TRUE;
+ }
+
+ return FALSE;
}
static BOOL
InitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc)
{
- HPROPSHEETPAGE hPage;
- PROPSHEETPAGE psp;
-
- if (ppsh->nPages < MAX_SYSTEM_PAGES)
- {
- ZeroMemory(&psp, sizeof(psp));
- psp.dwSize = sizeof(psp);
- psp.dwFlags = PSP_DEFAULT;
- psp.hInstance = hApplet;
- psp.pszTemplate = MAKEINTRESOURCE(idDlg);
- psp.pfnDlgProc = DlgProc;
-
- hPage = CreatePropertySheetPage(&psp);
- if (hPage != NULL)
- {
- return PropSheetAddPage(hPage, (LPARAM)ppsh);
- }
- }
-
- return FALSE;
+ HPROPSHEETPAGE hPage;
+ PROPSHEETPAGE psp;
+
+ if (ppsh->nPages < MAX_SYSTEM_PAGES)
+ {
+ ZeroMemory(&psp, sizeof(psp));
+ psp.dwSize = sizeof(psp);
+ psp.dwFlags = PSP_DEFAULT;
+ psp.hInstance = hApplet;
+ psp.pszTemplate = MAKEINTRESOURCE(idDlg);
+ psp.pfnDlgProc = DlgProc;
+
+ hPage = CreatePropertySheetPage(&psp);
+ if (hPage != NULL)
+ {
+ return PropSheetAddPage(hPage, (LPARAM)ppsh);
+ }
+ }
+
+ return FALSE;
}
typedef HPROPSHEETPAGE (WINAPI *PCreateNetIDPropertyPage)(VOID);
@@ -63,87 +63,87 @@
static HMODULE
AddNetIdPage(PROPSHEETHEADER *ppsh)
{
- HPROPSHEETPAGE hPage;
- HMODULE hMod;
- PCreateNetIDPropertyPage pCreateNetIdPage;
-
- hMod = LoadLibrary(TEXT("netid.dll"));
- if (hMod != NULL)
- {
- pCreateNetIdPage = (PCreateNetIDPropertyPage)GetProcAddress(hMod,
-
"CreateNetIDPropertyPage");
- if (pCreateNetIdPage != NULL)
- {
- hPage = pCreateNetIdPage();
- if (hPage == NULL)
- goto Fail;
-
- if (!PropSheetAddPage(hPage, (LPARAM)ppsh))
- {
- DestroyPropertySheetPage(hPage);
- goto Fail;
- }
- }
- else
- {
+ HPROPSHEETPAGE hPage;
+ HMODULE hMod;
+ PCreateNetIDPropertyPage pCreateNetIdPage;
+
+ hMod = LoadLibrary(TEXT("netid.dll"));
+ if (hMod != NULL)
+ {
+ pCreateNetIdPage = (PCreateNetIDPropertyPage)GetProcAddress(hMod,
+ "CreateNetIDPropertyPage");
+ if (pCreateNetIdPage != NULL)
+ {
+ hPage = pCreateNetIdPage();
+ if (hPage == NULL)
+ goto Fail;
+
+ if (!PropSheetAddPage(hPage, (LPARAM)ppsh))
+ {
+ DestroyPropertySheetPage(hPage);
+ goto Fail;
+ }
+ }
+ else
+ {
Fail:
- FreeLibrary(hMod);
- hMod = NULL;
- }
- }
-
- return hMod;
+ FreeLibrary(hMod);
+ hMod = NULL;
+ }
+ }
+
+ return hMod;
}
/* First Applet */
LONG CALLBACK
SystemApplet(VOID)
{
- HPROPSHEETPAGE hpsp[MAX_SYSTEM_PAGES];
- PROPSHEETHEADER psh;
- HMODULE hNetIdDll;
- HPSXA hpsxa = NULL;
- LONG Ret;
- static INITCOMMONCONTROLSEX icc = {sizeof(INITCOMMONCONTROLSEX), ICC_LINK_CLASS};
-
- if (!InitCommonControlsEx(&icc))
- return 0;
-
- ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
- psh.dwSize = sizeof(PROPSHEETHEADER);
- psh.dwFlags = PSH_PROPTITLE;
- psh.hwndParent = NULL;
- psh.hInstance = hApplet;
- psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
- psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME);
- psh.nPages = 0;
- psh.nStartPage = 0;
- psh.phpage = hpsp;
- psh.pfnCallback = NULL;
-
- InitPropSheetPage(&psh, IDD_PROPPAGEGENERAL, (DLGPROC) GeneralPageProc);
- hNetIdDll = AddNetIdPage(&psh);
- InitPropSheetPage(&psh, IDD_PROPPAGEHARDWARE, (DLGPROC) HardwarePageProc);
- InitPropSheetPage(&psh, IDD_PROPPAGEADVANCED, (DLGPROC) AdvancedPageProc);
-
- /* Load additional pages provided by shell extensions */
- hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER
TEXT("\\System"), MAX_SYSTEM_PAGES - psh.nPages);
- if (hpsxa != NULL)
- {
- SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh);
- }
-
- Ret = (LONG)(PropertySheet(&psh) != -1);
-
- if (hpsxa != NULL)
- {
- SHDestroyPropSheetExtArray(hpsxa);
- }
-
- if (hNetIdDll != NULL)
- FreeLibrary(hNetIdDll);
-
- return Ret;
+ HPROPSHEETPAGE hpsp[MAX_SYSTEM_PAGES];
+ PROPSHEETHEADER psh;
+ HMODULE hNetIdDll;
+ HPSXA hpsxa = NULL;
+ LONG Ret;
+ static INITCOMMONCONTROLSEX icc = {sizeof(INITCOMMONCONTROLSEX), ICC_LINK_CLASS};
+
+ if (!InitCommonControlsEx(&icc))
+ return 0;
+
+ ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
+ psh.dwSize = sizeof(PROPSHEETHEADER);
+ psh.dwFlags = PSH_PROPTITLE;
+ psh.hwndParent = NULL;
+ psh.hInstance = hApplet;
+ psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_CPLSYSTEM));
+ psh.pszCaption = MAKEINTRESOURCE(IDS_CPLSYSTEMNAME);
+ psh.nPages = 0;
+ psh.nStartPage = 0;
+ psh.phpage = hpsp;
+ psh.pfnCallback = NULL;
+
+ InitPropSheetPage(&psh, IDD_PROPPAGEGENERAL, (DLGPROC) GeneralPageProc);
+ hNetIdDll = AddNetIdPage(&psh);
+ InitPropSheetPage(&psh, IDD_PROPPAGEHARDWARE, (DLGPROC) HardwarePageProc);
+ InitPropSheetPage(&psh, IDD_PROPPAGEADVANCED, (DLGPROC) AdvancedPageProc);
+
+ /* Load additional pages provided by shell extensions */
+ hpsxa = SHCreatePropSheetExtArray(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER
TEXT("\\System"), MAX_SYSTEM_PAGES - psh.nPages);
+ if (hpsxa != NULL)
+ {
+ SHAddFromPropSheetExtArray(hpsxa, PropSheetAddPage, (LPARAM)&psh);
+ }
+
+ Ret = (LONG)(PropertySheet(&psh) != -1);
+
+ if (hpsxa != NULL)
+ {
+ SHDestroyPropSheetExtArray(hpsxa);
+ }
+
+ if (hNetIdDll != NULL)
+ FreeLibrary(hNetIdDll);
+
+ return Ret;
}
/* Control Panel Callback */
@@ -154,35 +154,35 @@
LPARAM lParam1,
LPARAM lParam2)
{
- int i = (int)lParam1;
- UNREFERENCED_PARAMETER(hwndCPl);
-
- switch(uMsg)
- {
- case CPL_INIT:
- {
- return TRUE;
- }
- case CPL_GETCOUNT:
- {
- return NUM_APPLETS;
- }
- case CPL_INQUIRE:
- {
- CPLINFO *CPlInfo = (CPLINFO*)lParam2;
- CPlInfo->lData = 0;
- CPlInfo->idIcon = Applets[i].idIcon;
- CPlInfo->idName = Applets[i].idName;
- CPlInfo->idInfo = Applets[i].idDescription;
- break;
- }
- case CPL_DBLCLK:
- {
- Applets[i].AppletProc();
- break;
- }
- }
- return FALSE;
+ int i = (int)lParam1;
+ UNREFERENCED_PARAMETER(hwndCPl);
+
+ switch(uMsg)
+ {
+ case CPL_INIT:
+ {
+ return TRUE;
+ }
+ case CPL_GETCOUNT:
+ {
+ return NUM_APPLETS;
+ }
+ case CPL_INQUIRE:
+ {
+ CPLINFO *CPlInfo = (CPLINFO*)lParam2;
+ CPlInfo->lData = 0;
+ CPlInfo->idIcon = Applets[i].idIcon;
+ CPlInfo->idName = Applets[i].idName;
+ CPlInfo->idInfo = Applets[i].idDescription;
+ break;
+ }
+ case CPL_DBLCLK:
+ {
+ Applets[i].AppletProc();
+ break;
+ }
+ }
+ return FALSE;
}
@@ -192,14 +192,13 @@
DWORD dwReason,
LPVOID lpvReserved)
{
- UNREFERENCED_PARAMETER(lpvReserved);
- switch(dwReason)
- {
- case DLL_PROCESS_ATTACH:
- case DLL_THREAD_ATTACH:
- hApplet = hinstDLL;
- break;
- }
- return TRUE;
-}
-
+ UNREFERENCED_PARAMETER(lpvReserved);
+ switch(dwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ hApplet = hinstDLL;
+ break;
+ }
+ return TRUE;
+}
Modified: trunk/reactos/dll/cpl/sysdm/userprofile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/userprofile.…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/userprofile.c (original)
+++ trunk/reactos/dll/cpl/sysdm/userprofile.c Mon Jul 23 14:26:55 2007
@@ -13,48 +13,48 @@
/* Property page dialog callback */
INT_PTR CALLBACK
UserProfileDlgProc(HWND hwndDlg,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam)
+ UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(hwndDlg);
+ UNREFERENCED_PARAMETER(lParam);
+ UNREFERENCED_PARAMETER(wParam);
+ UNREFERENCED_PARAMETER(hwndDlg);
- switch(uMsg)
- {
- case WM_INITDIALOG:
- {
- MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
- }
- break;
+ switch(uMsg)
+ {
+ case WM_INITDIALOG:
+ {
+ MessageBox(hwndDlg, _T("Dialog not yet implemented!"), NULL, 0);
+ }
+ break;
- case WM_COMMAND:
- {
- if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
- {
- EndDialog(hwndDlg,
- LOWORD(wParam));
- return TRUE;
- }
- }
- break;
+ case WM_COMMAND:
+ {
+ if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
+ {
+ EndDialog(hwndDlg,
+ LOWORD(wParam));
+ return TRUE;
+ }
+ }
+ break;
- case WM_NOTIFY:
- {
- NMHDR *nmhdr = (NMHDR *)lParam;
+ case WM_NOTIFY:
+ {
+ NMHDR *nmhdr = (NMHDR *)lParam;
- if (nmhdr->idFrom == IDC_USERACCOUNT_LINK && nmhdr->code ==
NM_CLICK)
- {
- ShellExecute(hwndDlg,
- TEXT("open"),
- TEXT("rundll32.exe"),
- TEXT("shell32.dll, Control_RunDLL nusrmgr.cpl"),
- NULL,
- SW_SHOWNORMAL);
- }
- break;
- }
- }
- return FALSE;
+ if (nmhdr->idFrom == IDC_USERACCOUNT_LINK && nmhdr->code == NM_CLICK)
+ {
+ ShellExecute(hwndDlg,
+ TEXT("open"),
+ TEXT("rundll32.exe"),
+ TEXT("shell32.dll, Control_RunDLL nusrmgr.cpl"),
+ NULL,
+ SW_SHOWNORMAL);
+ }
+ break;
+ }
+ }
+ return FALSE;
}
Modified: trunk/reactos/dll/cpl/sysdm/virtmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/virtmem.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/virtmem.c (original)
+++ trunk/reactos/dll/cpl/sysdm/virtmem.c Mon Jul 23 14:26:55 2007
@@ -14,351 +14,350 @@
static BOOL
ReadPageFileSettings(PVIRTMEM pVirtMem)
{
- HKEY hkey = NULL;
- DWORD dwType;
- DWORD dwDataSize;
- BOOL bRet = FALSE;
-
- if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,
- lpKey,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_QUERY_VALUE,
- NULL,
- &hkey,
- NULL) == ERROR_SUCCESS)
- {
- if(RegQueryValueEx(hkey,
- _T("PagingFiles"),
- NULL,
- &dwType,
- NULL,
- &dwDataSize) == ERROR_SUCCESS)
+ HKEY hkey = NULL;
+ DWORD dwType;
+ DWORD dwDataSize;
+ BOOL bRet = FALSE;
+
+ if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,
+ lpKey,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_QUERY_VALUE,
+ NULL,
+ &hkey,
+ NULL) == ERROR_SUCCESS)
+ {
+ if(RegQueryValueEx(hkey,
+ _T("PagingFiles"),
+ NULL,
+ &dwType,
+ NULL,
+ &dwDataSize) == ERROR_SUCCESS)
{
- pVirtMem->szPagingFiles = (LPTSTR)HeapAlloc(GetProcessHeap(),
- 0,
- dwDataSize);
- if (pVirtMem->szPagingFiles != NULL)
- {
- ZeroMemory(pVirtMem->szPagingFiles,
- dwDataSize);
- if(RegQueryValueEx(hkey,
- _T("PagingFiles"),
- NULL,
- &dwType,
- (PBYTE)pVirtMem->szPagingFiles,
- &dwDataSize) == ERROR_SUCCESS)
- {
- bRet = TRUE;
- }
- }
-
- }
- }
-
- if (!bRet)
- ShowLastWin32Error(pVirtMem->hSelf);
-
- if (hkey != NULL)
- RegCloseKey(hkey);
-
- return bRet;
+ pVirtMem->szPagingFiles = (LPTSTR)HeapAlloc(GetProcessHeap(),
+ 0,
+ dwDataSize);
+ if (pVirtMem->szPagingFiles != NULL)
+ {
+ ZeroMemory(pVirtMem->szPagingFiles,
+ dwDataSize);
+ if(RegQueryValueEx(hkey,
+ _T("PagingFiles"),
+ NULL,
+ &dwType,
+ (PBYTE)pVirtMem->szPagingFiles,
+ &dwDataSize) == ERROR_SUCCESS)
+ {
+ bRet = TRUE;
+ }
+ }
+ }
+ }
+
+ if (!bRet)
+ ShowLastWin32Error(pVirtMem->hSelf);
+
+ if (hkey != NULL)
+ RegCloseKey(hkey);
+
+ return bRet;
}
static INT
GetPageFileSizes(LPTSTR lpPageFiles)
{
- while (*lpPageFiles != _T('\0'))
- {
- if (*lpPageFiles == _T(' '))
- {
- lpPageFiles++;
- return (INT)_ttoi(lpPageFiles);
- }
-
- lpPageFiles++;
- }
-
- return -1;
+ while (*lpPageFiles != _T('\0'))
+ {
+ if (*lpPageFiles == _T(' '))
+ {
+ lpPageFiles++;
+ return (INT)_ttoi(lpPageFiles);
+ }
+
+ lpPageFiles++;
+ }
+
+ return -1;
}
static VOID
ParseMemSettings(PVIRTMEM pVirtMem)
{
- TCHAR szDrives[1024]; // all drives
- LPTSTR DrivePtr = szDrives;
- TCHAR szDrive[MAX_PATH]; // single drive
- TCHAR szVolume[MAX_PATH];
- INT InitialSize = 0;
- INT MaxSize = 0;
- INT DriveLen;
- INT PgCnt = 0;
-
- DriveLen = GetLogicalDriveStrings(1023,
- szDrives);
-
- while (DriveLen != 0)
- {
- LVITEM Item;
- INT Len;
-
- Len = lstrlen(DrivePtr) + 1;
- DriveLen -= Len;
-
- DrivePtr = _tcsupr(DrivePtr);
-
- /* copy the 'X:' portion */
- lstrcpyn(szDrive, DrivePtr, 3);
-
- if(GetDriveType(DrivePtr) == DRIVE_FIXED)
- {
- /* does drive match the one in the registry ? */
- if(!_tcsncmp(pVirtMem->szPagingFiles, szDrive, 2))
- {
- /* FIXME: we only check the first available pagefile in the reg */
- InitialSize = GetPageFileSizes(pVirtMem->szPagingFiles);
- MaxSize = GetPageFileSizes(pVirtMem->szPagingFiles);
-
- pVirtMem->Pagefile[PgCnt].InitialValue = InitialSize;
- pVirtMem->Pagefile[PgCnt].MaxValue = MaxSize;
- 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].bUsed = FALSE;
- lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive);
- }
-
- /* fill out the listview */
- ZeroMemory(&Item, sizeof(Item));
- Item.mask = LVIF_TEXT;
- Item.iItem = ListView_GetItemCount(pVirtMem->hListView);
- Item.pszText = szDrive;
- (void)ListView_InsertItem(pVirtMem->hListView, &Item);
-
- /* set a volume label if there is one */
- if (GetVolumeInformation(DrivePtr,
- szVolume,
- 255,
- NULL,
- NULL,
- NULL,
- NULL,
- 0))
- {
- if (szVolume[0] != _T('\0'))
- {
- TCHAR szVol[MAX_PATH + 2];
-
- _stprintf(szVol, _T("[%s]"), szVolume);
-
- Item.iSubItem = 1;
- Item.pszText = szVol;
- (void)ListView_InsertItem(pVirtMem->hListView, &Item);
- }
- }
-
- if ((InitialSize != 0) || (MaxSize != 0))
- {
- TCHAR szSize[64];
-
- _stprintf(szSize, _T("%i - %i"), InitialSize, MaxSize);
-
- Item.iSubItem = 2;
- Item.pszText = szSize;
- (void)ListView_InsertItem(pVirtMem->hListView, &Item);
- }
-
- PgCnt++;
- }
-
- DrivePtr += Len;
- }
-
- pVirtMem->Count = PgCnt;
+ TCHAR szDrives[1024]; // all drives
+ LPTSTR DrivePtr = szDrives;
+ TCHAR szDrive[MAX_PATH]; // single drive
+ TCHAR szVolume[MAX_PATH];
+ INT InitialSize = 0;
+ INT MaxSize = 0;
+ INT DriveLen;
+ INT PgCnt = 0;
+
+ DriveLen = GetLogicalDriveStrings(1023,
+ szDrives);
+
+ while (DriveLen != 0)
+ {
+ LVITEM Item;
+ INT Len;
+
+ Len = lstrlen(DrivePtr) + 1;
+ DriveLen -= Len;
+
+ DrivePtr = _tcsupr(DrivePtr);
+
+ /* copy the 'X:' portion */
+ lstrcpyn(szDrive, DrivePtr, 3);
+
+ if(GetDriveType(DrivePtr) == DRIVE_FIXED)
+ {
+ /* does drive match the one in the registry ? */
+ if(!_tcsncmp(pVirtMem->szPagingFiles, szDrive, 2))
+ {
+ /* FIXME: we only check the first available pagefile in the reg */
+ InitialSize = GetPageFileSizes(pVirtMem->szPagingFiles);
+ MaxSize = GetPageFileSizes(pVirtMem->szPagingFiles);
+
+ pVirtMem->Pagefile[PgCnt].InitialValue = InitialSize;
+ pVirtMem->Pagefile[PgCnt].MaxValue = MaxSize;
+ 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].bUsed = FALSE;
+ lstrcpy(pVirtMem->Pagefile[PgCnt].szDrive, szDrive);
+ }
+
+ /* fill out the listview */
+ ZeroMemory(&Item, sizeof(Item));
+ Item.mask = LVIF_TEXT;
+ Item.iItem = ListView_GetItemCount(pVirtMem->hListView);
+ Item.pszText = szDrive;
+ (void)ListView_InsertItem(pVirtMem->hListView, &Item);
+
+ /* set a volume label if there is one */
+ if (GetVolumeInformation(DrivePtr,
+ szVolume,
+ 255,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0))
+ {
+ if (szVolume[0] != _T('\0'))
+ {
+ TCHAR szVol[MAX_PATH + 2];
+
+ _stprintf(szVol, _T("[%s]"), szVolume);
+
+ Item.iSubItem = 1;
+ Item.pszText = szVol;
+ (void)ListView_InsertItem(pVirtMem->hListView, &Item);
+ }
+ }
+
+ if ((InitialSize != 0) || (MaxSize != 0))
+ {
+ TCHAR szSize[64];
+
+ _stprintf(szSize, _T("%i - %i"), InitialSize, MaxSize);
+
+ Item.iSubItem = 2;
+ Item.pszText = szSize;
+ (void)ListView_InsertItem(pVirtMem->hListView, &Item);
+ }
+
+ PgCnt++;
+ }
+
+ DrivePtr += Len;
+ }
+
+ pVirtMem->Count = PgCnt;
}
static VOID
WritePageFileSettings(PVIRTMEM pVirtMem)
{
- HKEY hk = NULL;
- TCHAR szPagingFiles[2048];
- INT i;
- INT nPos = 0;
- BOOL bErr = TRUE;
-
- for(i = 0; i < pVirtMem->Count; ++i)
- {
- if(pVirtMem->Pagefile[i].bUsed)
- {
- TCHAR szText[256];
-
- _stprintf(szText, _T("%s\\pagefile.sys %i %i"),
- pVirtMem->Pagefile[i].szDrive,
- pVirtMem->Pagefile[i].InitialValue,
- pVirtMem->Pagefile[i].MaxValue);
-
- /* Add it to our overall registry string */
- lstrcat(szPagingFiles + nPos, szText);
-
- /* Record the position where the next string will start */
- nPos += (INT)lstrlen(szText) + 1;
-
- /* add another NULL for REG_MULTI_SZ */
- szPagingFiles[nPos] = _T('\0');
- nPos++;
- }
- }
-
- if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,
- lpKey,
- 0,
- NULL,
- REG_OPTION_NON_VOLATILE,
- KEY_WRITE,
- NULL,
- &hk,
- NULL) == ERROR_SUCCESS)
- {
- if (RegSetValueEx(hk,
- _T("PagingFiles"),
- 0,
- REG_MULTI_SZ,
- (LPBYTE) szPagingFiles,
- (DWORD) nPos * sizeof(TCHAR)))
- {
- bErr = FALSE;
- }
-
- RegCloseKey(hk);
- }
-
- if (bErr)
- ShowLastWin32Error(pVirtMem->hSelf);
+ HKEY hk = NULL;
+ TCHAR szPagingFiles[2048];
+ INT i;
+ INT nPos = 0;
+ BOOL bErr = TRUE;
+
+ for(i = 0; i < pVirtMem->Count; ++i)
+ {
+ if(pVirtMem->Pagefile[i].bUsed)
+ {
+ TCHAR szText[256];
+
+ _stprintf(szText, _T("%s\\pagefile.sys %i %i"),
+ pVirtMem->Pagefile[i].szDrive,
+ pVirtMem->Pagefile[i].InitialValue,
+ pVirtMem->Pagefile[i].MaxValue);
+
+ /* Add it to our overall registry string */
+ lstrcat(szPagingFiles + nPos, szText);
+
+ /* Record the position where the next string will start */
+ nPos += (INT)lstrlen(szText) + 1;
+
+ /* add another NULL for REG_MULTI_SZ */
+ szPagingFiles[nPos] = _T('\0');
+ nPos++;
+ }
+ }
+
+ if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,
+ lpKey,
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_WRITE,
+ NULL,
+ &hk,
+ NULL) == ERROR_SUCCESS)
+ {
+ if (RegSetValueEx(hk,
+ _T("PagingFiles"),
+ 0,
+ REG_MULTI_SZ,
+ (LPBYTE) szPagingFiles,
+ (DWORD) nPos * sizeof(TCHAR)))
+ {
+ bErr = FALSE;
+ }
+
+ RegCloseKey(hk);
+ }
+
+ if (bErr)
+ ShowLastWin32Error(pVirtMem->hSelf);
}
static VOID
SetListViewColumns(HWND hwndListView)
{
- RECT rect;
- LV_COLUMN lvc;
-
- GetClientRect(hwndListView, &rect);
-
- (void)ListView_SetExtendedListViewStyle(hwndListView,
- LVS_EX_FULLROWSELECT);
-
- ZeroMemory(&lvc, sizeof(lvc));
- lvc.mask = LVCF_SUBITEM | LVCF_WIDTH | LVCF_FMT;
- lvc.fmt = LVCFMT_LEFT;
-
- lvc.cx = (INT)((rect.right - rect.left) * 0.1);
- lvc.iSubItem = 0;
- (void)ListView_InsertColumn(hwndListView, 0, &lvc);
-
- lvc.cx = (INT)((rect.right - rect.left) * 0.3);
- lvc.iSubItem = 1;
- (void)ListView_InsertColumn(hwndListView, 1, &lvc);
-
- lvc.cx = (INT)((rect.right - rect.left) * 0.6);
- lvc.iSubItem = 2;
- (void)ListView_InsertColumn(hwndListView, 2, &lvc);
+ RECT rect;
+ LV_COLUMN lvc;
+
+ GetClientRect(hwndListView, &rect);
+
+ (void)ListView_SetExtendedListViewStyle(hwndListView,
+ LVS_EX_FULLROWSELECT);
+
+ ZeroMemory(&lvc, sizeof(lvc));
+ lvc.mask = LVCF_SUBITEM | LVCF_WIDTH | LVCF_FMT;
+ lvc.fmt = LVCFMT_LEFT;
+
+ lvc.cx = (INT)((rect.right - rect.left) * 0.1);
+ lvc.iSubItem = 0;
+ (void)ListView_InsertColumn(hwndListView, 0, &lvc);
+
+ lvc.cx = (INT)((rect.right - rect.left) * 0.3);
+ lvc.iSubItem = 1;
+ (void)ListView_InsertColumn(hwndListView, 1, &lvc);
+
+ lvc.cx = (INT)((rect.right - rect.left) * 0.6);
+ lvc.iSubItem = 2;
+ (void)ListView_InsertColumn(hwndListView, 2, &lvc);
}
static VOID
OnNoPagingFile(PVIRTMEM pVirtMem)
{
- /* Disable the page file custom size boxes */
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
+ /* Disable the page file custom size boxes */
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
}
static VOID
OnSysManSize(PVIRTMEM pVirtMem)
{
- /* Disable the page file custom size boxes */
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
+ /* Disable the page file custom size boxes */
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
}
static VOID
OnCustom(PVIRTMEM pVirtMem)
{
- /* Enable the page file custom size boxes */
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), TRUE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
+ /* Enable the page file custom size boxes */
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), TRUE);
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
}
static VOID
OnSet(PVIRTMEM pVirtMem)
{
- INT Index;
-
- pVirtMem->bSave = TRUE;
-
- Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
- IDC_PAGEFILELIST,
- LB_GETCURSEL,
- 0,
- 0);
-
- if(Index < pVirtMem->Count)
- {
- TCHAR szText[255];
-
- /* check if custom settings are checked */
- if(SendDlgItemMessage(pVirtMem->hSelf,
- IDC_CUSTOM,
- BM_GETCHECK,
- 0,
- 0) == BST_CHECKED)
- {
- SendDlgItemMessage(pVirtMem->hSelf,
- IDC_INITIALSIZE,
- WM_GETTEXT,
- 254,
- (LPARAM)szText);
- pVirtMem->Pagefile[Index].InitialValue = _ttoi(szText);
-
- SendDlgItemMessage(pVirtMem->hSelf,
- IDC_MAXSIZE,
- WM_GETTEXT,
- 254,
- (LPARAM)szText);
- pVirtMem->Pagefile[Index].MaxValue = _ttoi(szText);
- }
- else
- {
- /* set sizes to 0 */
- pVirtMem->Pagefile[Index].InitialValue =
pVirtMem->Pagefile[Index].MaxValue = 0;
-
- // check to see if this drive is used for a paging file
- if (SendDlgItemMessage(pVirtMem->hSelf,
- IDC_NOPAGEFILE,
- BM_GETCHECK,
- 0,
- 0) == BST_UNCHECKED)
- {
- pVirtMem->Pagefile[Index].bUsed = TRUE;
- }
- else
- {
- pVirtMem->Pagefile[Index].bUsed = FALSE;
- }
- }
- }
+ INT Index;
+
+ pVirtMem->bSave = TRUE;
+
+ Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_PAGEFILELIST,
+ LB_GETCURSEL,
+ 0,
+ 0);
+
+ if(Index < pVirtMem->Count)
+ {
+ TCHAR szText[255];
+
+ /* check if custom settings are checked */
+ if(SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_CUSTOM,
+ BM_GETCHECK,
+ 0,
+ 0) == BST_CHECKED)
+ {
+ SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_INITIALSIZE,
+ WM_GETTEXT,
+ 254,
+ (LPARAM)szText);
+ pVirtMem->Pagefile[Index].InitialValue = _ttoi(szText);
+
+ SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_MAXSIZE,
+ WM_GETTEXT,
+ 254,
+ (LPARAM)szText);
+ pVirtMem->Pagefile[Index].MaxValue = _ttoi(szText);
+ }
+ else
+ {
+ /* set sizes to 0 */
+ pVirtMem->Pagefile[Index].InitialValue = pVirtMem->Pagefile[Index].MaxValue =
0;
+
+ // check to see if this drive is used for a paging file
+ if (SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_NOPAGEFILE,
+ BM_GETCHECK,
+ 0,
+ 0) == BST_UNCHECKED)
+ {
+ pVirtMem->Pagefile[Index].bUsed = TRUE;
+ }
+ else
+ {
+ pVirtMem->Pagefile[Index].bUsed = FALSE;
+ }
+ }
+ }
}
@@ -366,135 +365,135 @@
OnSelChange(PVIRTMEM pVirtMem,
LPNMLISTVIEW pnmv)
{
- TCHAR szCustVals[255];
- INT Index;
-
- UNREFERENCED_PARAMETER(pnmv);
-
- Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
- IDC_PAGEFILELIST,
- LB_GETCURSEL,
- 0,
- 0);
-
- if(Index < pVirtMem->Count)
- {
-
- if(pVirtMem->Pagefile[Index].InitialValue != 0 &&
- pVirtMem->Pagefile[Index].MaxValue != 0)
- {
- /* enable and fill the custom values */
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), TRUE);
-
- _itot(pVirtMem->Pagefile[Index].InitialValue , szCustVals, 10);
- SendDlgItemMessage(pVirtMem->hSelf,
- IDC_INITIALSIZE,
- WM_SETTEXT,
- 0,
- (LPARAM)szCustVals);
-
- _itot(pVirtMem->Pagefile[Index].MaxValue, szCustVals, 10);
- SendDlgItemMessage(pVirtMem->hSelf,
- IDC_MAXSIZE,
- WM_SETTEXT,
- 0,
- (LPARAM)szCustVals);
-
- SendDlgItemMessage(pVirtMem->hSelf,
- IDC_CUSTOM,
- BM_SETCHECK,
- 1,
- 0);
- }
- else
- {
- /* It's not a custom value */
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
- EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
-
- /* is it system managed */
- if(pVirtMem->Pagefile[Index].bUsed)
- {
- SendDlgItemMessage(pVirtMem->hSelf,
- IDC_SYSMANSIZE,
- BM_SETCHECK,
- 1,
- 0);
- }
- else
- {
- SendDlgItemMessage(pVirtMem->hSelf,
- IDC_NOPAGEFILE,
- BM_SETCHECK,
- 1,
- 0);
- }
- }
- }
-
- return TRUE;
+ TCHAR szCustVals[255];
+ INT Index;
+
+ UNREFERENCED_PARAMETER(pnmv);
+
+ Index = (INT)SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_PAGEFILELIST,
+ LB_GETCURSEL,
+ 0,
+ 0);
+
+ if(Index < pVirtMem->Count)
+ {
+
+ if(pVirtMem->Pagefile[Index].InitialValue != 0 &&
+ pVirtMem->Pagefile[Index].MaxValue != 0)
+ {
+ /* enable and fill the custom values */
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), TRUE);
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), TRUE);
+
+ _itot(pVirtMem->Pagefile[Index].InitialValue , szCustVals, 10);
+ SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_INITIALSIZE,
+ WM_SETTEXT,
+ 0,
+ (LPARAM)szCustVals);
+
+ _itot(pVirtMem->Pagefile[Index].MaxValue, szCustVals, 10);
+ SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_MAXSIZE,
+ WM_SETTEXT,
+ 0,
+ (LPARAM)szCustVals);
+
+ SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_CUSTOM,
+ BM_SETCHECK,
+ 1,
+ 0);
+ }
+ else
+ {
+ /* It's not a custom value */
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_MAXSIZE), FALSE);
+ EnableWindow(GetDlgItem(pVirtMem->hSelf, IDC_INITIALSIZE), FALSE);
+
+ /* is it system managed */
+ if(pVirtMem->Pagefile[Index].bUsed)
+ {
+ SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_SYSMANSIZE,
+ BM_SETCHECK,
+ 1,
+ 0);
+ }
+ else
+ {
+ SendDlgItemMessage(pVirtMem->hSelf,
+ IDC_NOPAGEFILE,
+ BM_SETCHECK,
+ 1,
+ 0);
+ }
+ }
+ }
+
+ return TRUE;
}
static VOID
OnOk(PVIRTMEM pVirtMem)
{
- if(pVirtMem->bSave == TRUE)
- {
- WritePageFileSettings(pVirtMem);
- }
-
- if (pVirtMem->szPagingFiles)
- HeapFree(GetProcessHeap(),
- 0,
- pVirtMem->szPagingFiles);
-
- HeapFree(GetProcessHeap(),
- 0,
- pVirtMem);
+ if(pVirtMem->bSave == TRUE)
+ {
+ WritePageFileSettings(pVirtMem);
+ }
+
+ if (pVirtMem->szPagingFiles)
+ HeapFree(GetProcessHeap(),
+ 0,
+ pVirtMem->szPagingFiles);
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ pVirtMem);
}
static VOID
OnCancel(PVIRTMEM pVirtMem)
{
- if (pVirtMem->szPagingFiles)
- HeapFree(GetProcessHeap(),
- 0,
- pVirtMem->szPagingFiles);
-
- HeapFree(GetProcessHeap(),
- 0,
- pVirtMem);
+ if (pVirtMem->szPagingFiles)
+ HeapFree(GetProcessHeap(),
+ 0,
+ pVirtMem->szPagingFiles);
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ pVirtMem);
}
static PVIRTMEM
OnInitDialog(HWND hwnd)
{
- PVIRTMEM pVirtMem = (PVIRTMEM)HeapAlloc(GetProcessHeap(),
- HEAP_ZERO_MEMORY,
- sizeof(VIRTMEM));
- if (pVirtMem == NULL)
- {
- EndDialog(hwnd, 0);
- }
-
- pVirtMem->hSelf = hwnd;
- pVirtMem->hListView = GetDlgItem(hwnd, IDC_PAGEFILELIST);
- pVirtMem->bSave = FALSE;
-
- SetListViewColumns(pVirtMem->hListView);
-
- /* Load the pagefile systems from the reg */
- if (ReadPageFileSettings(pVirtMem))
- {
- /* Parse our settings and set up dialog */
- ParseMemSettings(pVirtMem);
- }
-
- return pVirtMem;
+ PVIRTMEM pVirtMem = (PVIRTMEM)HeapAlloc(GetProcessHeap(),
+ HEAP_ZERO_MEMORY,
+ sizeof(VIRTMEM));
+ if (pVirtMem == NULL)
+ {
+ EndDialog(hwnd, 0);
+ }
+
+ pVirtMem->hSelf = hwnd;
+ pVirtMem->hListView = GetDlgItem(hwnd, IDC_PAGEFILELIST);
+ pVirtMem->bSave = FALSE;
+
+ SetListViewColumns(pVirtMem->hListView);
+
+ /* Load the pagefile systems from the reg */
+ if (ReadPageFileSettings(pVirtMem))
+ {
+ /* Parse our settings and set up dialog */
+ ParseMemSettings(pVirtMem);
+ }
+
+ return pVirtMem;
}
@@ -504,67 +503,66 @@
WPARAM wParam,
LPARAM lParam)
{
- /* there can only be one instance of this dialog */
- static PVIRTMEM pVirtMem = NULL;
-
- UNREFERENCED_PARAMETER(lParam);
-
- switch (uMsg)
- {
- case WM_INITDIALOG:
- pVirtMem = OnInitDialog(hwndDlg);
- break;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDCANCEL:
- OnCancel(pVirtMem);
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case IDOK:
- OnOk(pVirtMem);
- EndDialog(hwndDlg, 0);
- return TRUE;
-
- case IDC_NOPAGEFILE:
- OnNoPagingFile(pVirtMem);
- return TRUE;
-
- case IDC_SYSMANSIZE:
- OnSysManSize(pVirtMem);
- return TRUE;
-
- case IDC_CUSTOM:
- OnCustom(pVirtMem);
- return TRUE;
-
- case IDC_SET:
- OnSet(pVirtMem);
- return TRUE;
- }
- }
- break;
-
- case WM_NOTIFY:
- {
- LPNMHDR pnmhdr = (LPNMHDR)lParam;
-
- switch (pnmhdr->code)
- {
- case LVN_ITEMCHANGED:
- {
- LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
-
- OnSelChange(pVirtMem, pnmv);
-
- }
- }
- }
- break;
- }
-
- return FALSE;
-}
+ /* there can only be one instance of this dialog */
+ static PVIRTMEM pVirtMem = NULL;
+
+ UNREFERENCED_PARAMETER(lParam);
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ pVirtMem = OnInitDialog(hwndDlg);
+ break;
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDCANCEL:
+ OnCancel(pVirtMem);
+ EndDialog(hwndDlg, 0);
+ return TRUE;
+
+ case IDOK:
+ OnOk(pVirtMem);
+ EndDialog(hwndDlg, 0);
+ return TRUE;
+
+ case IDC_NOPAGEFILE:
+ OnNoPagingFile(pVirtMem);
+ return TRUE;
+
+ case IDC_SYSMANSIZE:
+ OnSysManSize(pVirtMem);
+ return TRUE;
+
+ case IDC_CUSTOM:
+ OnCustom(pVirtMem);
+ return TRUE;
+
+ case IDC_SET:
+ OnSet(pVirtMem);
+ return TRUE;
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ LPNMHDR pnmhdr = (LPNMHDR)lParam;
+
+ switch (pnmhdr->code)
+ {
+ case LVN_ITEMCHANGED:
+ {
+ LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
+
+ OnSelChange(pVirtMem, pnmv);
+ }
+ }
+ }
+ break;
+ }
+
+ return FALSE;
+}