[NETCFGX] NetworkPropertySheetProvider: Fix property selection because the property...
authorEric Kohl <eric.kohl@reactos.org>
Tue, 9 Oct 2018 21:19:48 +0000 (23:19 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 9 Oct 2018 21:19:48 +0000 (23:19 +0200)
CORE-15095

dll/win32/netcfgx/propertypage.c

index 1c37083..b069cf6 100644 (file)
@@ -789,6 +789,7 @@ OnInitDialog(
     HWND hwndControl;
     PWSTR pszText;
     DWORD i;
+    INT idx;
 
     TRACE("OnInitDialog()\n");
 
@@ -811,13 +812,15 @@ OnInitDialog(
             else
                 pszText = pParamArray->Array[i].pszName;
 
-            ListBox_AddString(hwndControl, pszText);
+            idx = ListBox_AddString(hwndControl, pszText);
+            if (idx != LB_ERR)
+                ListBox_SetItemData(hwndControl, idx, (LPARAM)&pParamArray->Array[i]);
         }
 
         if (pParamArray->dwCount > 0)
         {
             ListBox_SetCurSel(hwndControl, 0);
-            pParamArray->pCurrentParam = &pParamArray->Array[0];
+            pParamArray->pCurrentParam = (PPARAMETER)ListBox_GetItemData(hwndControl, 0);
             DisplayParameter(hwnd, pParamArray->pCurrentParam);
         }
     }
@@ -855,7 +858,7 @@ OnCommand(
         iIndex = ListBox_GetCurSel((HWND)lParam);
         if (iIndex != LB_ERR && iIndex < pParamArray->dwCount)
         {
-            pParamArray->pCurrentParam = &pParamArray->Array[iIndex];
+            pParamArray->pCurrentParam = (PPARAMETER)ListBox_GetItemData((HWND)lParam, iIndex);
             DisplayParameter(hwnd, pParamArray->pCurrentParam);
         }
     }