Author: janderwald
Date: Mon Aug 27 01:42:48 2007
New Revision: 28583
URL:
http://svn.reactos.org/svn/reactos?rev=28583&view=rev
Log:
- creation of empty environment variables should not be possible (tested under Windows XP
SP2)
- dont create variables when cancel is hit
- bug report + patch by Gregor Schneider (aka DosX)
See issue #2600 for more details.
Modified:
trunk/reactos/dll/cpl/sysdm/environment.c
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 Aug 27 01:42:48 2007
@@ -266,6 +266,8 @@
/* Set user environment variables */
hwndListView = GetDlgItem(hwndDlg, IDC_USER_VARIABLE_LIST);
+ (void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);
+
SetListViewColumns(hwndListView);
SetEnvironmentVariables(hwndListView,
@@ -273,11 +275,16 @@
_T("Environment"));
(void)ListView_SetColumnWidth(hwndListView,2,LVSCW_AUTOSIZE_USEHEADER);
+
+ ListView_SetItemState(hwndListView,0,LVIS_FOCUSED,LVIS_FOCUSED);
+
(void)ListView_Update(hwndListView,0);
/* Set system environment variables */
hwndListView = GetDlgItem(hwndDlg, IDC_SYSTEM_VARIABLE_LIST);
+
+ (void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);
SetListViewColumns(hwndListView);
@@ -286,6 +293,9 @@
_T("SYSTEM\\CurrentControlSet\\Control\\Session
Manager\\Environment"));
(void)ListView_SetColumnWidth(hwndListView,2,LVSCW_AUTOSIZE_USEHEADER);
+
+ ListView_SetItemState(hwndListView,0,LVIS_FOCUSED,LVIS_FOCUSED);
+
(void)ListView_Update(hwndListView,0);
}
@@ -319,17 +329,22 @@
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,
+ }
+ else
+ {
+ if(VarData->lpName != NULL && (VarData->lpCookedValue ||
VarData->lpRawValue))
+ {
+ 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);
+ }
+ }
}