https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d58f6558e022c6426d1ef06e210d2af62c57be48

commit d58f6558e022c6426d1ef06e210d2af62c57be48
Author:     Eric Kohl <[email protected]>
AuthorDate: Tue Oct 9 23:19:48 2018 +0200
Commit:     Eric Kohl <[email protected]>
CommitDate: Tue Oct 9 23:19:48 2018 +0200

    [NETCFGX] NetworkPropertySheetProvider: Fix property selection because the 
property list box is sorted.
    
    CORE-15095
---
 dll/win32/netcfgx/propertypage.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dll/win32/netcfgx/propertypage.c b/dll/win32/netcfgx/propertypage.c
index 1c37083c9f..b069cf6062 100644
--- a/dll/win32/netcfgx/propertypage.c
+++ b/dll/win32/netcfgx/propertypage.c
@@ -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);
         }
     }

Reply via email to