25 #define ITEM_CHECKED (INDEXTOSTATEIMAGEMASK(2))
26 #define ITEM_UNCHECKED (INDEXTOSTATEIMAGEMASK(1))
28 static VOID FreeAdaptersEntry(
32 if (Entry->InterfaceGuid)
38 static VOID ClearAdaptersList(
42 for (ULONG i = 0; i < FilterList->Count; i++)
50 static VOID CopyAdaptersList(
55 for (ULONG i = 0; i < Source->Count; i++)
78 while (remaining.
Length != 0)
120 for (SIZE_T i = 0; i < FilterList->Count; i++)
138 static VOID AddNetworkAdapterToListView(
140 _In_ PIP_ADAPTER_ADDRESSES Adapter
153 Context->ListViewHandle,
155 Adapter->Description,
159 for (ULONG i = 0; i < Context->NetworkAdaptersListEdited->Count; i++)
167 ListView_SetItemState(Context->ListViewHandle, index,
ITEM_CHECKED, LVIS_STATEIMAGEMASK);
175 ListView_SetItemState(Context->ListViewHandle, index,
ITEM_CHECKED, LVIS_STATEIMAGEMASK);
182 static VOID FindNetworkAdapters(
186 ULONG bufferLength = 0;
189 ULONG flags = GAA_FLAG_SKIP_UNICAST | GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER;
196 if (GetAdaptersAddresses(AF_UNSPEC, flags, NULL, NULL, &bufferLength) != ERROR_BUFFER_OVERFLOW)
199 buffer = PhAllocate(bufferLength);
200 memset(buffer, 0, bufferLength);
202 if (GetAdaptersAddresses(AF_UNSPEC, flags, NULL, buffer, &bufferLength) == ERROR_SUCCESS)
204 PIP_ADAPTER_ADDRESSES addressesBuffer = buffer;
206 while (addressesBuffer)
209 AddNetworkAdapterToListView(Context, addressesBuffer);
210 addressesBuffer = addressesBuffer->Next;
232 if (uMsg == WM_INITDIALOG)
237 SetProp(hwndDlg, L
"Context", (HANDLE)context);
243 if (uMsg == WM_DESTROY)
278 RemoveProp(hwndDlg, L
"Context");
294 ListView_SetExtendedListViewStyleEx(context->
ListViewHandle, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
302 FindNetworkAdapters(context);
307 switch (LOWORD(wParam))
310 EndDialog(hwndDlg, IDCANCEL);
313 EndDialog(hwndDlg, IDOK);
324 _In_ HWND ParentHandle