ReactOS 0.4.16-dev-1946-g52006dd
tcpipconf_notify.c
Go to the documentation of this file.
1#include "precomp.h"
2
3#include <winnls.h>
4#include <winsock.h>
5#include <iphlpapi.h>
6#include <dhcpcsdk.h>
7#include <dhcpcapi.h>
8
9typedef struct
10{
12 LPWSTR szTCPAllowedPorts; // KEY: Tcpip\Parameter\{InstanceGuid}\TCPAllowedPorts
13 LPWSTR szUDPAllowedPorts; // KEY: Tcpip\Parameter\{InstanceGuid}\UDPAllowedPorts
14 LPWSTR szRawIPAllowedProtocols; // KEY: Tcpip\Parameter\{InstanceGuid}\RawIPAllowedProtocols
19
20// KEY: Tcpip\Parameter\{InstanceGuid}\IpAddress | DhcpIpAddress
21// KEY: Tcpip\Parameter\{InstanceGuid}\SubnetMask | DhcpSubnetMask
22// KEY: Tcpip\Parameter\{InstanceGuid}\DefaultGateway | DhcpDefaultGateway
23// KEY: Tcpip\Parameter\{InstanceGuid}\NameServer | DhcpNameServer
24// KEY: Services\NetBT\Parameters\Interfaces\Tcpip_{INSTANCE_GUID}
25
26typedef struct
27{
31 WCHAR szDomain[100];
34
35typedef struct tagIP_ADDR
36{
38 union
39 {
42 } u;
46
47typedef enum
48{
49 METRIC = 1,
51 IPADDR = 3
53
54typedef struct
55{
59
67
68typedef struct
69{
70 const INetCfgComponentPropertyUi *lpVtbl;
71 const INetCfgComponentControl *lpVtblCompControl;
74 INetCfg *pNCfg;
75 INetCfgComponent *pNComp;
79
80typedef struct
81{
84 WCHAR szIP[16];
87
88typedef struct
89{
92 WCHAR szIP[16];
93 WCHAR szMask[16];
95
96typedef struct
97{
100 WCHAR szIP[16];
102
103typedef struct
104{
109
110typedef struct
111{
116
118{
119 return (TcpipConfNotifyImpl*)((char *)iface - FIELD_OFFSET(TcpipConfNotifyImpl, lpVtblCompControl));
120}
121
122INT GetSelectedItem(HWND hDlgCtrl);
124VOID InsertColumnToListView(HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size);
128
129VOID
130DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
131{
132 WCHAR szBuffer[300];
133 WCHAR szTitle[100];
134
135 if (LoadStringW(netcfgx_hInstance, ResTxt, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
136 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
137 else
138 szBuffer[0] = L'\0';
139
140 if (LoadStringW(netcfgx_hInstance, ResTitle, szTitle, sizeof(szTitle)/sizeof(WCHAR)))
141 szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = L'\0';
142 else
143 szTitle[0] = L'\0';
144
145 MessageBoxW(NULL, szBuffer, szTitle, Type);
146}
147
148
149/***************************************************************
150 * TCP/IP Filter Dialog
151 *
152 */
153
157 HWND hwndDlg,
158 UINT uMsg,
161)
162{
163 TcpipPortSettings * pPort;
164 UINT Num;
166 LVITEMW li;
167 WCHAR szBuffer[100];
168
169 switch(uMsg)
170 {
171 case WM_INITDIALOG:
172 pPort = (TcpipPortSettings*)lParam;
173 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPort);
174 if (LoadStringW(netcfgx_hInstance, pPort->ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
175 {
176 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
177 SendDlgItemMessageW(hwndDlg, IDC_PORT_DESC, WM_SETTEXT, 0, (LPARAM)szBuffer);
178 }
179
180 if (pPort->MaxNum == 65536)
182 else
184
185 return TRUE;
186 case WM_COMMAND:
187 if (LOWORD(wParam) == IDCANCEL)
188 {
189 EndDialog(hwndDlg, FALSE);
190 break;
191 }
192 else if (LOWORD(wParam) == IDC_OK)
193 {
194 pPort = (TcpipPortSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
195 Num = GetDlgItemInt(hwndDlg, IDC_PORT_VAL, NULL, TRUE);
196 if (Num > pPort->MaxNum || Num == 0)
197 {
198 if (pPort->MaxNum == 65536)
200 else
202
204 break;
205 }
206 if (GetWindowTextW(GetDlgItem(hwndDlg, IDC_PORT_VAL), szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
207 {
208 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
209 ZeroMemory(&find, sizeof(LVFINDINFOW));
210 find.flags = LVFI_STRING;
211 find.psz = szBuffer;
212 if (SendMessageW(pPort->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
213 {
214 ZeroMemory(&li, sizeof(LVITEMW));
215 li.mask = LVIF_TEXT;
216 li.iItem = ListView_GetItemCount(pPort->hDlgCtrl);
217 li.pszText = szBuffer;
218 SendMessageW(pPort->hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
219 EndDialog(hwndDlg, TRUE);
220 break;
221 }
224 break;
225 }
226 }
227 }
228 return FALSE;
229}
230
231VOID
232InitFilterListBox(LPWSTR pData, HWND hwndDlg, HWND hDlgCtrl, UINT AllowButton, UINT RestrictButton, UINT AddButton, UINT DelButton)
233{
234 LVITEMW li;
235 LPWSTR pCur;
236 INT iItem;
237
238 if (!pData || !_wtoi(pData))
239 {
240 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
242 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
243 return;
244 }
245
246 pCur = pData;
247 memset(&li, 0x0, sizeof(LVITEMW));
248 li.mask = LVIF_TEXT;
249 iItem = 0;
250
251 while(pCur[0])
252 {
253 li.pszText = pCur;
254 li.iItem = iItem;
255 SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
256 iItem++;
257 pCur += wcslen(pCur) + 1;
258 }
259
260 if (!iItem)
261 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
262 else
263 CheckDlgButton(hwndDlg, RestrictButton, BST_CHECKED);
264}
265
266LPWSTR
268 HWND hDlgCtrl,
270{
271 INT iCount, iIndex;
272 LVITEMW li;
275 WCHAR szBuffer[10];
276
277 iCount = ListView_GetItemCount(hDlgCtrl);
278 if (!iCount)
279 {
280 pData = (LPWSTR)CoTaskMemAlloc(3 * sizeof(WCHAR));
281 if (!pData)
282 return NULL;
283 pData[0] = L'0';
284 pData[1] = L'\0';
285 pData[2] = L'\0';
286 *Size = 3 * sizeof(WCHAR);
287 return pData;
288 }
289
290 pData = CoTaskMemAlloc((6 * iCount + 1) * sizeof(WCHAR));
291 if (!pData)
292 return NULL;
293
294 pCur = pData;
295 dwSize = 0;
296 for(iIndex = 0; iIndex < iCount; iIndex++)
297 {
298 ZeroMemory(&li, sizeof(LVITEMW));
299 li.mask = LVIF_TEXT;
300 li.iItem = iIndex;
301 li.pszText = szBuffer;
302 li.cchTextMax = sizeof(szBuffer) /sizeof(WCHAR);
303 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
304 {
305 wcscpy(pCur, szBuffer);
306 dwSize += wcslen(szBuffer) + 1;
307 pCur += wcslen(szBuffer) + 1;
308 }
309 }
310 pCur[0] = L'\0';
311 *Size = (dwSize+1) * sizeof(WCHAR);
312 return pData;
313}
314
317 HWND hwndDlg)
318{
319 TcpFilterSettings * pFilter;
320
321 pFilter = CoTaskMemAlloc(sizeof(TcpFilterSettings));
322 if (!pFilter)
323 return NULL;
324
326 pFilter->EnableSecurityFilters = TRUE;
327 else
328 pFilter->EnableSecurityFilters = FALSE;
329
330 pFilter->szTCPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_TCP_LIST), &pFilter->TCPSize);
331 pFilter->szUDPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_UDP_LIST), &pFilter->UDPSize);
333
334 return pFilter;
335}
336
337static
338VOID
340 HWND hwndDlg,
341 HWND hDlgCtrl,
342 UINT MaxItem,
343 UINT ResId)
344{
346
347 Port.MaxNum = MaxItem;
348 Port.hDlgCtrl = hDlgCtrl;
349 Port.ResId = ResId;
350
352}
353
354static
355VOID
357 HWND hDlgCtrl)
358{
359 INT iIndex = GetSelectedItem(hDlgCtrl);
360
361 if (iIndex != -1)
362 {
363 (void)ListView_DeleteItem(hDlgCtrl, iIndex);
364 return;
365 }
367}
368
372 HWND hwndDlg,
373 UINT uMsg,
376)
377{
378 TcpipConfNotifyImpl *pContext;
379 TcpFilterSettings *pFilter;
380
381 switch(uMsg)
382 {
383 case WM_INITDIALOG:
384 pContext = (TcpipConfNotifyImpl*)lParam;
388 if (pContext->pCurrentConfig->pFilter)
389 {
395 }
396 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
397 return TRUE;
398 case WM_COMMAND:
399 if (HIWORD(wParam) == BN_CLICKED)
400 {
401 switch (LOWORD(wParam))
402 {
405 {
410 }
411 break;
412 case IDC_TCP_RESTRICT:
414 {
419 }
420 break;
423 {
428 }
429 break;
430 case IDC_UDP_RESTRICT:
432 {
437 }
438 break;
439 case IDC_IP_ALLOW_ALL:
441 {
446 }
447 break;
448 case IDC_IP_RESTRICT:
450 {
455 }
456 break;
457 case IDC_USE_FILTER:
460
461 break;
462 }
463 }
464 switch(LOWORD(wParam))
465 {
466 case IDC_OK:
467 pContext = (TcpipConfNotifyImpl*)GetWindowLongPtr(hwndDlg, DWLP_USER);
468 pFilter = StoreTcpipFilterSettings(hwndDlg);
469 if (pFilter)
470 {
471 if (pContext->pCurrentConfig->pFilter)
472 {
473 CoTaskMemFree(pContext->pCurrentConfig->pFilter->szTCPAllowedPorts);
474 CoTaskMemFree(pContext->pCurrentConfig->pFilter->szUDPAllowedPorts);
475 CoTaskMemFree(pContext->pCurrentConfig->pFilter->szRawIPAllowedProtocols);
476 CoTaskMemFree(pContext->pCurrentConfig->pFilter);
477 }
478 pContext->pCurrentConfig->pFilter = pFilter;
479 }
480 EndDialog(hwndDlg, (INT_PTR)TRUE);
481 break;
482 case IDCANCEL:
483 EndDialog(hwndDlg, FALSE);
484 break;
485 case IDC_TCP_ADD:
486 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_TCP_LIST), 65536, IDS_TCP_PORTS);
487 break;
488 case IDC_TCP_DEL:
490 break;
491 case IDC_UDP_ADD:
492 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_UDP_LIST), 65536, IDS_UDP_PORTS);
493 break;
494 case IDC_UDP_DEL:
496 break;
497 case IDC_IP_ADD:
498 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_IP_LIST), 256, IDS_IP_PROTO);
499 break;
500 case IDC_IP_DEL:
501 DelItem(GetDlgItem(hwndDlg, IDC_IP_LIST));
502 break;
503 default:
504 break;
505 }
506 default:
507 break;
508 }
509
510 return FALSE;
511}
512
513
516{
517 PROPSHEETPAGEW ppage;
518
519 memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW));
520 ppage.dwSize = sizeof(PROPSHEETPAGEW);
521 ppage.dwFlags = PSP_DEFAULT;
522 ppage.u.pszTemplate = resname;
523 ppage.pfnDlgProc = dlgproc;
524 ppage.lParam = lParam;
526 if (szTitle)
527 {
528 ppage.dwFlags |= PSP_USETITLE;
529 ppage.pszTitle = szTitle;
530 }
531 return CreatePropertySheetPageW(&ppage);
532}
533
534/***************************************************************
535 * TCP/IP Advanced Option Dialog
536 *
537 */
538
539VOID
541 HWND hwndDlg,
543{
544 WCHAR szText[500];
545 /* store context */
547
548 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTER, szText, sizeof(szText)/sizeof(WCHAR)))
549 {
550 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
551 if (SendDlgItemMessageW(hwndDlg, IDC_OPTLIST, LB_ADDSTRING, 0, (LPARAM)szText) != LB_ERR)
553 }
554
555 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTERDESC, szText, sizeof(szText)/sizeof(WCHAR)))
556 {
557 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
558 SendDlgItemMessageW(hwndDlg, IDC_OPTDESC, WM_SETTEXT, 0, (LPARAM)szText);
559 }
560}
561
562
563
567 HWND hwndDlg,
568 UINT uMsg,
571)
572{
575
576 switch(uMsg)
577 {
578 case WM_INITDIALOG:
580 This = (TcpipConfNotifyImpl*)page->lParam;
582 return TRUE;
583 case WM_COMMAND:
584 if (LOWORD(wParam) == IDC_OPTPROP)
585 {
588 GetParent(hwndDlg),
591 break;
592 }
593 }
594 return FALSE;
595}
596
597VOID
599 HWND hDlgCtrl,
600 UINT ResId,
601 UINT SubItem,
602 UINT Size)
603{
604 WCHAR szBuffer[200];
605 LVCOLUMNW lc;
606
607 if (!LoadStringW(netcfgx_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
608 return;
609
610 memset(&lc, 0, sizeof(LV_COLUMN) );
612 lc.iSubItem = SubItem;
613 lc.fmt = LVCFMT_FIXED_WIDTH;
614 lc.cx = Size;
615 lc.cchTextMax = wcslen(szBuffer);
616 lc.pszText = szBuffer;
617
618 (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, SubItem, (LPARAM)&lc);
619}
620
621VOID
623 HWND hDlgCtrl,
624 IP_ADDR * pAddr,
625 BOOL bSubMask)
626{
627 WCHAR szBuffer[70];
628 DWORD dwIpAddr;
629 UINT itemCount = 0;
630 LVITEMW li;
631
632 while(pAddr)
633 {
634 ZeroMemory(&li, sizeof(li));
635 li.mask = LVIF_TEXT;
636 li.iItem = itemCount;
637 li.iSubItem = 0;
638 dwIpAddr = pAddr->IpAddress;
639 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
640 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
641
642 li.pszText = szBuffer;
643 li.iItem = SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
644 if (li.iItem != -1)
645 {
646 if (bSubMask)
647 {
648 dwIpAddr = pAddr->u.Subnetmask;
649 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
650 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
651 }
652 else
653 {
654 if (pAddr->u.Metric)
655 swprintf(szBuffer, L"%u", pAddr->u.Metric);
656 else
657 LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
658 }
659
660 li.mask = LVIF_TEXT;
661 li.iSubItem = 1;
662 li.pszText = szBuffer;
663 SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
664 }
665 itemCount++;
666 pAddr = pAddr->Next;
667 }
668}
669
670VOID
672 HWND hwndDlg,
674{
675 RECT rect;
676 LVITEMW li;
677 WCHAR szBuffer[100];
678
681 InsertColumnToListView(GetDlgItem(hwndDlg, IDC_IPLIST), IDS_SUBMASK, 1, (rect.right - rect.left - 100));
682
683 if (This->pCurrentConfig->DhcpEnabled)
684 {
685 if (LoadStringW(netcfgx_hInstance, IDS_DHCPACTIVE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
686 {
687 ZeroMemory(&li, sizeof(LVITEMW));
688 li.mask = LVIF_TEXT;
689 li.pszText = szBuffer;
691 }
693 }
694 else
695 {
696 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_IPLIST), This->pCurrentConfig->Ip, TRUE);
697 }
698
701
704 InsertColumnToListView(GetDlgItem(hwndDlg, IDC_GWLIST), IDS_METRIC, 1, (rect.right - rect.left - 100));
705
706 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_GWLIST), This->pCurrentConfig->Gw, FALSE);
707
710
712 if (This->pCurrentConfig->Metric)
713 {
715 SetDlgItemInt(hwndDlg, IDC_IFMETRIC, This->pCurrentConfig->Metric, FALSE);
716 }
717 else
718 {
721 }
722}
723
727 HWND hwndDlg,
728 UINT uMsg,
731)
732{
733 WCHAR szBuffer[70];
734 TcpipGwSettings *pGwSettings;
735 DWORD dwIpAddr;
736 LPNMIPADDRESS lpnmipa;
738
739 switch(uMsg)
740 {
741 case WM_INITDIALOG:
742 pGwSettings = (TcpipGwSettings *)lParam;
744
749
750 if (pGwSettings->bAdd)
751 {
752 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
753 {
754 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
755 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
756 }
759 }
760 else
761 {
762 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
763 {
764 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
765 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
766 }
767
769
770 if (pGwSettings->Metric)
771 {
772 SetDlgItemInt(hwndDlg, IDC_GWMETRIC, pGwSettings->Metric, FALSE);
775 }
776 else
777 {
781 }
782 }
783 return TRUE;
784 case WM_COMMAND:
786 {
788 {
792 }
793 else
794 {
797 }
798 break;
799 }
800 else if (LOWORD(wParam) == IDCANCEL)
801 {
802 EndDialog(hwndDlg, FALSE);
803 break;
804 }
805 else if (LOWORD(wParam) == IDC_OK)
806 {
807 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
808 {
809 pGwSettings = (TcpipGwSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
810 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pGwSettings->szIP);
811
812 ZeroMemory(&find, sizeof(LVFINDINFOW));
813 find.flags = LVFI_STRING;
814 find.psz = pGwSettings->szIP;
815
817 pGwSettings->Metric = GetDlgItemInt(hwndDlg, IDC_GWMETRIC, NULL, FALSE);
818 else
819 pGwSettings->Metric = 0;
820
821
822 if (SendMessageW(pGwSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
823 {
824 EndDialog(hwndDlg, TRUE);
825 break;
826 }
827 if (!pGwSettings->bAdd)
828 {
829 EndDialog(hwndDlg, FALSE);
830 break;
831 }
833 }
834 break;
835 }
836 break;
837 case WM_NOTIFY:
838 lpnmipa = (LPNMIPADDRESS) lParam;
839 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
840 {
841 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
842 {
843 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
845 }
846 }
847 break;
848 }
849 return FALSE;
850}
851
852BOOL
853GetGWListEntry(HWND hDlgCtrl, INT Index, TcpipGwSettings * pGwSettings)
854{
855 LVITEMW li;
856 WCHAR szBuffer[30];
857 BOOL bRet;
858
859 ZeroMemory(&li, sizeof(LVITEMW));
860 li.mask = LVIF_TEXT;
861 li.cchTextMax = 16;
862 li.pszText = pGwSettings->szIP;
863 li.iItem = Index;
864
865 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
866 return FALSE;
867 li.pszText = szBuffer;
868 li.cchTextMax = 30;
869 li.iSubItem = 1;
870
871 bRet = SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
872 if (bRet)
873 {
874 pGwSettings->Metric = _wtoi(szBuffer);
875 }
876
877 return bRet;
878}
879
883 HWND hwndDlg,
884 UINT uMsg,
887)
888{
889 LPNMIPADDRESS lpnmipa;
890 DWORD dwIpAddr;
891 TcpipIpSettings *pIpSettings;
892 WCHAR szBuffer[50];
894 LRESULT lResult;
895
896 switch(uMsg)
897 {
898 case WM_INITDIALOG:
899 pIpSettings = (TcpipIpSettings*)lParam;
901
910
911 if (pIpSettings->bAdd)
912 {
913 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
914 {
915 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
916 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
917 }
919 }
920 else
921 {
922 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
923 {
924 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
925 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
926 }
927
930 }
931 return TRUE;
932 case WM_NOTIFY:
933 lpnmipa = (LPNMIPADDRESS) lParam;
934 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
935 {
936 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
937 {
938 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
939 {
940 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
942 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
944 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
945 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
947 }
948 }
949 }
950 break;
951 case WM_COMMAND:
952 if (LOWORD(wParam) == IDC_OK)
953 {
954 pIpSettings = (TcpipIpSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
955 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pIpSettings->szIP);
956 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, WM_GETTEXT, 16, (LPARAM)pIpSettings->szMask);
957
958 ZeroMemory(&find, sizeof(LVFINDINFOW));
959 find.flags = LVFI_STRING;
960 find.psz = pIpSettings->szIP;
961 lResult = SendMessageW(pIpSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find);
962
963 if (lResult == -1)
964 {
965 EndDialog(hwndDlg, TRUE);
966 break;
967 }
968 else if (!pIpSettings->bAdd)
969 {
970 EndDialog(hwndDlg, FALSE);
971 break;
972 }
974 break;
975 }
976 else if (LOWORD(wParam) == IDCANCEL)
977 {
978 EndDialog(hwndDlg, FALSE);
979 }
980 break;
981 }
982 return FALSE;
983}
984
985BOOL
988{
989 UINT Index;
991
992 for(Index = 0; Index < Length; Index++)
993 if (iswalnum(szName[Index]) == 0 && szName[Index] != '.' && szName[Index] != '-')
994 return FALSE;
995
996 return TRUE;
997}
998
1002 HWND hwndDlg,
1003 UINT uMsg,
1004 WPARAM wParam,
1006)
1007{
1008 WCHAR szBuffer[100];
1009 TcpipSuffixSettings * pSettings;
1010 LRESULT lLength;
1011
1012 switch(uMsg)
1013 {
1014 case WM_INITDIALOG:
1015 pSettings = (TcpipSuffixSettings*)lParam;
1016 if (!pSettings->bAdd)
1017 {
1018 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)pSettings->Suffix);
1019 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1020 {
1021 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1022 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1023 }
1024 CoTaskMemFree(pSettings->Suffix);
1025 pSettings->Suffix = NULL;
1026 }
1027 else
1028 {
1029 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1030 {
1031 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1032 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1033 }
1034 }
1035 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSettings);
1036 return TRUE;
1037 case WM_COMMAND:
1038 if (LOWORD(wParam) == IDCANCEL)
1039 {
1040 EndDialog(hwndDlg, FALSE);
1041 break;
1042 }
1043 else if (LOWORD(wParam) == IDC_OK)
1044 {
1045 lLength = SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXTLENGTH, 0, 0);
1046 if (lLength)
1047 {
1048 pSettings = (TcpipSuffixSettings*) GetWindowLongPtr(hwndDlg, DWLP_USER);
1049 pSettings->Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1)* sizeof(WCHAR));
1050 if (pSettings->Suffix)
1051 {
1052 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, lLength + 1, (LPARAM)pSettings->Suffix);
1053 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->Suffix) != LB_ERR)
1054 {
1056 CoTaskMemFree(pSettings->Suffix);
1057 break;
1058 }
1059
1060 if (!VerifyDNSSuffix(pSettings->Suffix))
1061 {
1063 CoTaskMemFree(pSettings->Suffix);
1064 break;
1065 }
1066 EndDialog(hwndDlg, TRUE);
1067 }
1068 }
1069 break;
1070 }
1071 }
1072 return FALSE;
1073}
1074
1075
1076INT
1078{
1079 LVITEMW li;
1080 UINT iItemCount, iIndex;
1081
1082 iItemCount = ListView_GetItemCount(hDlgCtrl);
1083 if (!iItemCount)
1084 return -1;
1085
1086 for (iIndex = 0; iIndex < iItemCount; iIndex++)
1087 {
1088 ZeroMemory(&li, sizeof(LVITEMW));
1089 li.mask = LVIF_STATE;
1090 li.stateMask = (UINT)-1;
1091 li.iItem = iIndex;
1092 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1093 {
1094 if (li.state & LVIS_SELECTED)
1095 return iIndex;
1096 }
1097 }
1098 return -1;
1099}
1100
1101
1102BOOL
1104{
1105 LVITEMW li;
1106
1107 ZeroMemory(&li, sizeof(LVITEMW));
1108 li.mask = LVIF_TEXT;
1109 li.cchTextMax = 16;
1110 li.pszText = pIpSettings->szIP;
1111 li.iItem = Index;
1112
1113 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1114 return FALSE;
1115
1116 ZeroMemory(&li, sizeof(LVITEMW));
1117 li.mask = LVIF_TEXT;
1118 li.cchTextMax = 16;
1119 li.pszText = pIpSettings->szMask;
1120 li.iSubItem = 1;
1121 li.iItem = Index;
1122
1123 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1124}
1125
1126VOID
1128{
1129 LVITEMW li;
1130
1131 memset(&li, 0x0, sizeof(LVITEMW));
1132 li.iItem = GetSelectedItem(hDlgCtrl);
1133 if (li.iItem < 0)
1134 {
1136 SetFocus(hDlgCtrl);
1137 }
1138 else
1139 {
1140 (void)ListView_DeleteItem(hDlgCtrl, li.iItem);
1141 }
1142}
1143
1144UINT
1146 WCHAR * szBuffer)
1147{
1148 DWORD dwIpAddr = 0;
1149 INT Val;
1150 UINT Index = 3;
1151 LPWSTR pLast = szBuffer;
1152 LPWSTR pNext = szBuffer;
1153
1154
1155 while((pNext = wcschr(pNext, L'.')))
1156 {
1157 pNext[0] = L'\0';
1158 Val = _wtoi(pLast);
1159 dwIpAddr |= (Val << Index * 8);
1160 Index--;
1161 pNext++;
1162 pLast = pNext;
1163 }
1164 dwIpAddr |= _wtoi(pLast);
1165
1166 return dwIpAddr;
1167}
1168
1169UINT
1171 char * sBuffer)
1172{
1173 WCHAR szIp[16];
1174
1175 if (MultiByteToWideChar(CP_ACP, 0, sBuffer, -1, szIp, 16))
1176 {
1177 szIp[15] = L'\0';
1178 return GetIpAddressFromStringW(szIp);
1179 }
1180 return (UINT)-1;
1181}
1182
1183
1184VOID
1186{
1187 IP_ADDR *pNext;
1188
1189 if (!pAddr)
1190 return;
1191
1192 while(pAddr)
1193 {
1194 pNext = pAddr->Next;
1196 pAddr = pNext;
1197 }
1198}
1199
1200BOOL
1201GetListViewItem(HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR * szBuffer, UINT BufferSize)
1202{
1203 LVITEMW li;
1204
1205 ZeroMemory(&li, sizeof(LVITEMW));
1206 li.mask = LVIF_TEXT;
1207 li.pszText = szBuffer;
1208 li.iItem = Index;
1209 li.iSubItem = SubIndex;
1210 li.cchTextMax = BufferSize;
1211 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1212}
1213
1214VOID
1216 HWND hDlgCtrl,
1218 BOOL bSubmask)
1219{
1220 WCHAR szBuffer[30];
1221
1222 INT iIndex, iCount;
1223 IP_ADDR *pCur, *pLast;
1224
1225 iCount = ListView_GetItemCount(hDlgCtrl);
1226 if (!iCount)
1227 {
1228 return;
1229 }
1230
1231 pLast = NULL;
1232 for(iIndex = 0; iIndex < iCount; iIndex++)
1233 {
1234 if (GetListViewItem(hDlgCtrl, iIndex, 0, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1235 {
1236 pCur = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
1237 if (!pCur)
1238 break;
1239 ZeroMemory(pCur, sizeof(IP_ADDR));
1240
1241 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1242 pCur->IpAddress = GetIpAddressFromStringW(szBuffer);
1243
1244 if (GetListViewItem(hDlgCtrl, iIndex, 1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR) ))
1245 {
1246 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1247 if (bSubmask)
1248 pCur->u.Subnetmask = GetIpAddressFromStringW(szBuffer);
1249 else
1250 pCur->u.Metric = _wtoi(szBuffer);
1251 }
1252
1253 if (!pLast)
1254 {
1255 if (bSubmask)
1256 This->pCurrentConfig->Ip = pCur;
1257 else
1258 This->pCurrentConfig->Gw = pCur;
1259 }
1260 else
1261 {
1262 pLast->Next = pCur;
1263 }
1264
1265 pLast = pCur;
1266 }
1267 }
1268}
1269
1270
1271INT_PTR
1274 HWND hwndDlg,
1275 UINT uMsg,
1276 WPARAM wParam,
1278)
1279{
1282 INT_PTR res;
1283 WCHAR szBuffer[200];
1284 LPPSHNOTIFY lppsn;
1286 TcpipIpSettings Ip;
1287
1288 LVITEMW li;
1289
1290 switch(uMsg)
1291 {
1292 case WM_INITDIALOG:
1294 This = (TcpipConfNotifyImpl*)page->lParam;
1297 return TRUE;
1298 case WM_NOTIFY:
1299 lppsn = (LPPSHNOTIFY) lParam;
1300 if (lppsn->hdr.code == LVN_ITEMCHANGED)
1301 {
1303 BOOL bEnable;
1304
1305 if (lplv->hdr.idFrom == IDC_IPLIST)
1306 {
1308
1309 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0) &&
1310 (!This->pCurrentConfig->DhcpEnabled);
1311
1314 }
1315 else if (lplv->hdr.idFrom == IDC_GWLIST)
1316 {
1317 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0);
1318
1321 }
1322 }
1323 else if (lppsn->hdr.code == PSN_KILLACTIVE)
1324 {
1326 if (!This->pCurrentConfig->DhcpEnabled && ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST)) == 0)
1327 {
1330 return TRUE;
1331 }
1332
1334 {
1336 if ((val < 1) || (val > 9999))
1337 {
1340 return TRUE;
1341 }
1342 }
1343 }
1344 else if (lppsn->hdr.code == PSN_APPLY)
1345 {
1347 FreeIPAddr(This->pCurrentConfig->Gw);
1348 This->pCurrentConfig->Gw = NULL;
1349 FreeIPAddr(This->pCurrentConfig->Ip);
1350 This->pCurrentConfig->Ip = NULL;
1353
1355 This->pCurrentConfig->Metric = 0;
1356 else
1357 This->pCurrentConfig->Metric = GetDlgItemInt(hwndDlg, IDC_IFMETRIC, NULL, FALSE);
1358
1360 return TRUE;
1361 }
1362 break;
1363 case WM_COMMAND:
1365 {
1368 else
1370 }
1371 else if (LOWORD(wParam) == IDC_IPADD)
1372 {
1373 Ip.bAdd = TRUE;
1374 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1376 if (res)
1377 {
1378 memset(&li, 0x0, sizeof(LVITEMW));
1379 li.mask = LVIF_TEXT | LVIF_PARAM;
1380 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST));
1381 li.pszText = Ip.szIP;
1382 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_IPLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1383 if (li.iItem != -1)
1384 {
1385 li.mask = LVIF_TEXT;
1386 li.iSubItem = 1;
1387 li.pszText = Ip.szMask;
1389 }
1390 }
1391 }
1392 else if (LOWORD(wParam) == IDC_IPMOD)
1393 {
1394 memset(&li, 0x0, sizeof(LVITEMW));
1395 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_IPLIST));
1396 if (li.iItem < 0)
1397 {
1398 /* no item selected */
1400 SetFocus(GetDlgItem(hwndDlg, IDC_IPLIST));
1401 break;
1402 }
1403 Ip.bAdd = FALSE;
1404 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1405 if (GetIPListEntry(GetDlgItem(hwndDlg, IDC_IPLIST), li.iItem, &Ip))
1406 {
1408 if (res)
1409 {
1410 li.mask = LVIF_TEXT;
1411 li.pszText = Ip.szIP;
1413 li.pszText = Ip.szMask;
1414 li.iSubItem = 1;
1416 }
1417 }
1418 }
1419 else if (LOWORD(wParam) == IDC_IPDEL)
1420 {
1422 break;
1423 }
1424 else if (LOWORD(wParam) == IDC_GWADD)
1425 {
1426 Gw.bAdd = TRUE;
1427 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1429 if (res)
1430 {
1431 memset(&li, 0x0, sizeof(LVITEMW));
1432 li.mask = LVIF_TEXT;
1433 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_GWLIST));
1434 li.pszText = Gw.szIP;
1435 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_GWLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1436 if (li.iItem >= 0)
1437 {
1438 if (Gw.Metric)
1439 {
1440 swprintf(szBuffer, L"%u", Gw.Metric);
1441 li.iSubItem = 1;
1442 li.pszText = szBuffer;
1444 }
1445 else
1446 {
1447 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1448 {
1449 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1450 li.iSubItem = 1;
1451 li.pszText = szBuffer;
1453 }
1454 }
1455 }
1456 }
1457 break;
1458 }
1459 else if (LOWORD(wParam) == IDC_GWMOD)
1460 {
1461 memset(&li, 0x0, sizeof(LVITEMW));
1462 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_GWLIST));
1463 if (li.iItem < 0)
1464 {
1465 /* no item selected */
1467 SetFocus(GetDlgItem(hwndDlg, IDC_GWLIST));
1468 break;
1469 }
1470 if (GetGWListEntry(GetDlgItem(hwndDlg, IDC_GWLIST), li.iItem, &Gw))
1471 {
1472 Gw.bAdd = FALSE;
1473 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1475 if (res)
1476 {
1477 li.mask = LVIF_TEXT;
1478 li.pszText = Gw.szIP;
1480 if (Gw.Metric)
1481 {
1482 swprintf(szBuffer, L"%u", Gw.Metric);
1483 li.iSubItem = 1;
1484 li.pszText = szBuffer;
1486 }
1487 else
1488 {
1489 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1490 {
1491 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1492 li.iSubItem = 1;
1493 li.pszText = szBuffer;
1495 }
1496 }
1497 }
1498 }
1499 break;
1500 }
1501 else if (LOWORD(wParam) == IDC_GWDEL)
1502 {
1504 break;
1505 }
1506 break;
1507 }
1508 return FALSE;
1509}
1510
1511INT_PTR
1514 HWND hwndDlg,
1515 UINT uMsg,
1516 WPARAM wParam,
1518)
1519{
1520 TcpipDnsSettings * pSettings;
1521 WCHAR szBuffer[100];
1522 DWORD dwIpAddr;
1523 LPNMIPADDRESS lpnmipa;
1524
1525 switch(uMsg)
1526 {
1527 case WM_INITDIALOG:
1528 pSettings = (TcpipDnsSettings*)lParam;
1530 if (!pSettings->bAdd)
1531 {
1532 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1533 {
1534 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1535 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1536 }
1537 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_SETTEXT, 0, (LPARAM)pSettings->szIP);
1538 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1539 }
1540 else
1541 {
1542 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1543 {
1544 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1545 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1546 }
1547 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1548 }
1549 return TRUE;
1550 case WM_COMMAND:
1551 if (LOWORD(wParam) == IDCANCEL)
1552 {
1553 EndDialog(hwndDlg, FALSE);
1554 break;
1555 }
1556 else if (LOWORD(wParam) == IDC_OK)
1557 {
1558 pSettings = (TcpipDnsSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1559 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pSettings->szIP);
1560 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->szIP) == LB_ERR)
1561 {
1562 if (pSettings->bAdd)
1563 SendMessageW(pSettings->hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)pSettings->szIP);
1564 EndDialog(hwndDlg, TRUE);
1565 break;
1566 }
1567 if (!pSettings->bAdd)
1568 {
1569 EndDialog(hwndDlg, FALSE);
1570 break;
1571 }
1573 break;
1574 }
1575 break;
1576 case WM_NOTIFY:
1577 lpnmipa = (LPNMIPADDRESS) lParam;
1578 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1579 {
1580 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1581 {
1582 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1583 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1584 }
1585 }
1586 break;
1587 }
1588 return FALSE;
1589}
1590
1591
1592
1593VOID
1595 HWND hwndDlg,
1597{
1598 WCHAR szBuffer[200];
1599 LPWSTR pFirst, pSep, pList;
1600 IP_ADDR * pAddr;
1601 DWORD dwIpAddr;
1602
1603 /* insert DNS addresses */
1604 pAddr = This->pCurrentConfig->Ns;
1605 while(pAddr)
1606 {
1607 dwIpAddr = pAddr->IpAddress;
1608 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1609 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1610
1611 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_ADDSTRING, 0, (LPARAM)szBuffer);
1612 pAddr = pAddr->Next;
1613 }
1615
1616 if (!This->pCurrentConfig->pDNS)
1617 return;
1618
1619 if (This->pCurrentConfig->pDNS->RegisterAdapterName)
1621 else
1623
1624 if (This->pCurrentConfig->pDNS->RegistrationEnabled)
1626
1627 if (This->pCurrentConfig->pDNS->szDomain[0])
1628 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)szBuffer);
1629
1630 if (This->pCurrentConfig->pDNS->UseDomainNameDevolution)
1632
1633 if (!This->pCurrentConfig->pDNS->szSearchList || (wcslen(This->pCurrentConfig->pDNS->szSearchList) == 0))
1634 {
1637
1638 return;
1639 }
1640
1641 pList = This->pCurrentConfig->pDNS->szSearchList;
1642 if (wcslen(pList))
1643 {
1644 pFirst = pList;
1645 do
1646 {
1647 pSep = wcschr(pFirst, L',');
1648 if (pSep)
1649 {
1650 pSep[0] = L'\0';
1652 pFirst = pSep + 1;
1653 pSep[0] = L',';
1654 }
1655 else
1656 {
1658 break;
1659 }
1660 }while(TRUE);
1661
1665 }
1666}
1667
1668VOID
1669ToggleUpDown(HWND hwndDlg, HWND hDlgCtrl, UINT UpButton, UINT DownButton, UINT ModButton, UINT DelButton)
1670{
1671 LRESULT lResult, lCount;
1672
1673 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1674 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1675 if (lResult != LB_ERR)
1676 {
1677 if (lResult == 0)
1678 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
1679 else
1680 EnableWindow(GetDlgItem(hwndDlg, UpButton), TRUE);
1681
1682 if (lResult < lCount -1)
1683 EnableWindow(GetDlgItem(hwndDlg, DownButton), TRUE);
1684 else
1685 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
1686 }
1687
1688 if (lCount)
1689 {
1690 EnableWindow(GetDlgItem(hwndDlg, ModButton), TRUE);
1691 EnableWindow(GetDlgItem(hwndDlg, DelButton), TRUE);
1692 }
1693 else
1694 {
1695 EnableWindow(GetDlgItem(hwndDlg, ModButton), FALSE);
1696 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
1697 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
1698 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
1699 }
1700}
1701
1702VOID
1704 HWND hDlgCtrl,
1705 INT pos)
1706{
1707 WCHAR szBuffer[100];
1708 LRESULT lResult;
1709
1710 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1711 if (lResult != LB_ERR)
1712 {
1713 if (SendMessageW(hDlgCtrl, LB_GETTEXTLEN, (WPARAM)lResult, 0) < sizeof(szBuffer)/sizeof(WCHAR) - 1)
1714 {
1715 if (SendMessageW(hDlgCtrl, LB_GETTEXT, (WPARAM)lResult, (LPARAM)szBuffer) != LB_ERR)
1716 {
1717 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1718 SendMessageW(hDlgCtrl, LB_INSERTSTRING, (WPARAM)lResult + pos, (LPARAM)szBuffer);
1719 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult + pos, 0);
1720 }
1721 }
1722 }
1723}
1724VOID
1726 HWND hDlgCtrl)
1727{
1728 LRESULT lResult, lCount;
1729
1730 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1731 if (lResult != LB_ERR)
1732 {
1733 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1734 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1735 if (lResult + 1 < lCount)
1736 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult, 0);
1737 else
1738 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lCount-1, 0);
1739 }
1740}
1741
1742LPWSTR
1744 HWND hDlgCtrl)
1745{
1746 DWORD dwSize;
1747 INT iCount, iIndex;
1748 INT_PTR lResult;
1749 LPWSTR pszSearchList, pItem;
1750
1751 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1752 if (!iCount || iCount == LB_ERR)
1753 return NULL; //BUGBUG
1754
1755 dwSize = 0;
1756
1757 for (iIndex = 0; iIndex < iCount; iIndex++)
1758 {
1759 lResult = SendMessageW(hDlgCtrl, LB_GETTEXTLEN, iIndex, 0);
1760 if (lResult == LB_ERR)
1761 return NULL;
1762
1763 dwSize += lResult + 1;
1764 }
1765
1766 pszSearchList = (LPWSTR)CoTaskMemAlloc((dwSize + 1) * sizeof(WCHAR));
1767 if (!pszSearchList)
1768 return NULL;
1769
1770 pItem = pszSearchList;
1771 for (iIndex = 0; iIndex < iCount; iIndex++)
1772 {
1773 lResult = SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)pItem);
1774 if (lResult == LB_ERR)
1775 {
1776 CoTaskMemFree(pszSearchList);
1777 return NULL;
1778 }
1779 dwSize -= lResult + 1;
1780 pItem += wcslen(pItem);
1781 if (iIndex != iCount -1)
1782 {
1783 pItem[0] = L',';
1784 pItem++;
1785 }
1786 }
1787 pItem[0] = L'\0';
1788 return pszSearchList;
1789}
1790
1791VOID
1793 HWND hDlgCtrl,
1795{
1796 INT iCount, iIndex;
1797 WCHAR Ip[16];
1798 IP_ADDR *pCur, *pLast;
1799
1800 FreeIPAddr(This->pCurrentConfig->Ns);
1801 This->pCurrentConfig->Ns = NULL;
1802
1803 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1804 if (!iCount || iCount == LB_ERR)
1805 {
1806 return;
1807 }
1808
1809 pLast = NULL;
1810 for(iIndex = 0; iIndex < iCount; iIndex++)
1811 {
1812 if (SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)Ip) == LB_ERR)
1813 break;
1814
1815 pCur = CoTaskMemAlloc(sizeof(IP_ADDR));
1816 if (!pCur)
1817 break;
1818 ZeroMemory(pCur, sizeof(IP_ADDR));
1819 pCur->IpAddress = GetIpAddressFromStringW(Ip);
1820
1821 if (!pLast)
1822 This->pCurrentConfig->Ns = pCur;
1823 else
1824 pLast->Next = pCur;
1825
1826 pLast = pCur;
1827 pCur = pCur->Next;
1828 }
1829 This->pCurrentConfig->AutoconfigActive = FALSE;
1830}
1831
1832INT_PTR
1835 HWND hwndDlg,
1836 UINT uMsg,
1837 WPARAM wParam,
1839)
1840{
1843 TcpipDnsSettings Dns;
1844 LRESULT lIndex, lLength;
1845 TcpipSuffixSettings Suffix;
1846 LPPSHNOTIFY lppsn;
1847 WCHAR szSuffix[100];
1848 WCHAR szFormat[200];
1849 WCHAR szBuffer[300];
1850
1851
1852 switch(uMsg)
1853 {
1854 case WM_INITDIALOG:
1856 This = (TcpipConfNotifyImpl*)page->lParam;
1861 return TRUE;
1862 case WM_NOTIFY:
1863 lppsn = (LPPSHNOTIFY) lParam;
1864 if (lppsn->hdr.code == PSN_KILLACTIVE)
1865 {
1866 if (IsDlgButtonChecked(hwndDlg, IDC_SELSUFFIX) == BST_CHECKED &&
1868 {
1871 return TRUE;
1872 }
1873 if (SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, sizeof(szSuffix)/sizeof(WCHAR), (LPARAM)szSuffix))
1874 {
1875 szSuffix[(sizeof(szSuffix)/sizeof(WCHAR))-1] = L'\0';
1876 if (VerifyDNSSuffix(szSuffix) == FALSE)
1877 {
1878 if (LoadStringW(netcfgx_hInstance, IDS_DNS_SUFFIX, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1879 {
1880 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1881 swprintf(szBuffer, szFormat, szSuffix);
1882 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1883 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1884 else
1885 szFormat[0] = L'\0';
1886
1887 MessageBoxW(hwndDlg, szBuffer, szFormat, MB_ICONWARNING);
1889 SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
1890 return TRUE;
1891 }
1892 }
1893 }
1894 }
1895 else if (lppsn->hdr.code == PSN_APPLY)
1896 {
1898 if (!This->pCurrentConfig->pDNS)
1899 break;
1900
1903 {
1904 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1905 This->pCurrentConfig->pDNS->szSearchList = NULL;
1907 This->pCurrentConfig->pDNS->UseDomainNameDevolution = TRUE;
1908 else
1909 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1910 }
1911 else
1912 {
1913 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1914 This->pCurrentConfig->pDNS->szSearchList = NULL;
1915 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1916 This->pCurrentConfig->pDNS->szSearchList = GetListViewEntries(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST));
1917 }
1918
1920 {
1921 This->pCurrentConfig->pDNS->RegisterAdapterName = TRUE;
1923 This->pCurrentConfig->pDNS->RegistrationEnabled = TRUE;
1924 else
1925 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1926 }
1927 else
1928 {
1929 This->pCurrentConfig->pDNS->RegisterAdapterName = FALSE;
1930 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1931 }
1932 }
1933 break;
1934 case WM_COMMAND:
1936 {
1938 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1939 break;
1940 }
1942 {
1944 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1945 break;
1946 }
1947 else if (LOWORD(wParam) == IDC_PRIMSUFFIX && HIWORD(wParam) == BN_CLICKED)
1948 {
1950 {
1958 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1959 }
1960 }
1961 else if (LOWORD(wParam) == IDC_SELSUFFIX && HIWORD(wParam) == BN_CLICKED)
1962 {
1964 {
1968 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1969 }
1970 break;
1971 }
1972 else if (LOWORD(wParam) == IDC_REGSUFFIX && HIWORD(wParam) == BN_CLICKED)
1973 {
1976 else
1978 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1979 }
1980 else if (LOWORD(wParam) == IDC_DNSADDRUP && HIWORD(wParam) == BN_CLICKED)
1981 {
1982 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), -1);
1985 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1986 break;
1987 }
1989 {
1990 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), 1);
1993 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1994 break;
1995 }
1997 {
1998 MoveItem(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST), -1);
2001 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2002 break;
2003 }
2005 {
2009 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2010 break;
2011 }
2012 else if (LOWORD(wParam) == IDC_DNSADDRDEL && HIWORD(wParam) == BN_CLICKED)
2013 {
2017 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2018 break;
2019 }
2021 {
2025 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2026 break;
2027 }
2028 else if (LOWORD(wParam) == IDC_DNSADDRADD && HIWORD(wParam) == BN_CLICKED)
2029 {
2030 Dns.bAdd = TRUE;
2031 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2033 {
2035 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2036 }
2037 break;
2038 }
2039 else if (LOWORD(wParam) == IDC_DNSADDRMOD && HIWORD(wParam) == BN_CLICKED)
2040 {
2041 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSADDRLIST, LB_GETCURSEL, 0, 0);
2042 if (lIndex != LB_ERR)
2043 {
2044 Dns.bAdd = FALSE;
2045 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2048 {
2050 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_INSERTSTRING, lIndex, (LPARAM)Dns.szIP);
2051 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_SETCURSEL, lIndex, 0);
2053 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2054 }
2055 }
2056 break;
2057 }
2059 {
2060 Suffix.bAdd = TRUE;
2061 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2062 Suffix.Suffix = NULL;
2064 {
2066 lIndex = SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_ADDSTRING, 0, (LPARAM)Suffix.Suffix);
2067 if (lIndex != LB_ERR)
2070 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2071 CoTaskMemFree(Suffix.Suffix);
2072 }
2073 break;
2074 }
2076 {
2077 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSSUFFIXLIST, LB_GETCURSEL, 0, 0);
2078 if (lIndex != LB_ERR)
2079 {
2080 Suffix.bAdd = FALSE;
2081 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2082 lLength = SendMessageW(Suffix.hDlgCtrl, LB_GETTEXTLEN, lIndex, 0);
2083 if (lLength != LB_ERR)
2084 {
2085 Suffix.Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1) * sizeof(WCHAR));
2086 if (Suffix.Suffix)
2087 {
2088 SendMessageW(Suffix.hDlgCtrl, LB_GETTEXT, lIndex, (LPARAM)Suffix.Suffix);
2089 Suffix.Suffix[lLength] = L'\0';
2091 {
2092 if (Suffix.Suffix)
2093 {
2095 SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_INSERTSTRING, lIndex, (LPARAM)Suffix.Suffix);
2098 CoTaskMemFree(Suffix.Suffix);
2099 }
2101 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2102 }
2103 }
2104 }
2105 }
2106 break;
2107 }
2108 }
2109 return FALSE;
2110}
2111
2112static int CALLBACK
2114{
2115 // NOTE: This callback is needed to set large icon correctly.
2116 HICON hIcon;
2117 switch (uMsg)
2118 {
2119 case PSCB_INITIALIZED:
2120 {
2122 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
2123 break;
2124 }
2125 }
2126 return 0;
2127}
2128
2129VOID
2131 HWND hwndDlg,
2133{
2134 PROPSHEETHEADERW pinfo;
2135 HPROPSHEETPAGE hppages[3];
2136 WCHAR szBuffer[100];
2137
2141
2142
2143 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
2144 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2145 else
2146 szBuffer[0] = L'\0';
2147
2148 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
2149 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
2150 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
2152 pinfo.u3.phpage = hppages;
2153 pinfo.nPages = 3;
2154 pinfo.hwndParent = hwndDlg;
2156 pinfo.pszCaption = szBuffer;
2158 pinfo.pfnCallback = PropSheetProc;
2159
2161 if (PropertySheetW(&pinfo) > 0)
2162 {
2163 InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2164 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2165 }
2166}
2167
2168HRESULT
2170 HWND hwndDlg,
2171 TcpipSettings *pCurSettings)
2172{
2177
2182
2187
2192
2197
2198 if (pCurSettings->DhcpEnabled)
2199 {
2206 }
2207 else
2208 {
2212
2213 if (pCurSettings->Ip)
2214 {
2215 /* Set current ip address */
2216 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2217 /* Set current hostmask */
2218 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2219 }
2220 }
2221
2222 if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2223 {
2224 /* Set current gateway */
2225 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2226 }
2227
2228 if (pCurSettings->Ns)
2229 {
2230 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2231 if (pCurSettings->Ns->Next)
2232 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2233 else
2235 }
2236 else
2237 {
2240 }
2241
2242 return S_OK;
2243}
2244
2245INT_PTR
2248 HWND hwndDlg,
2249 UINT uMsg,
2250 WPARAM wParam,
2251 LPARAM lParam)
2252{
2255 BOOL bNoDHCP;
2256
2257 switch (uMsg)
2258 {
2259 case WM_INITDIALOG:
2260 {
2262 This = (TcpipConfNotifyImpl*)page->lParam;
2264 if (This->pCurrentConfig)
2265 InitializeTcpipAltDlgCtrls(hwndDlg, This->pCurrentConfig);
2266 return TRUE;
2267 }
2268 case WM_COMMAND:
2269 {
2270 switch (LOWORD(wParam))
2271 {
2272 case IDC_USEDHCP:
2273 case IDC_NODHCP:
2274 {
2275 if (HIWORD(wParam) == BN_CLICKED)
2276 {
2277 bNoDHCP = (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED);
2278 if (bNoDHCP)
2279 {
2283 }
2284
2285 EnableWindow(GetDlgItem(hwndDlg, IDC_IPADDR), bNoDHCP);
2286 EnableWindow(GetDlgItem(hwndDlg, IDC_SUBNETMASK), bNoDHCP);
2287 EnableWindow(GetDlgItem(hwndDlg, IDC_DEFGATEWAY), bNoDHCP);
2288 EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), bNoDHCP);
2289 EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), bNoDHCP);
2290
2291 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2292 }
2293 break;
2294 }
2295 }
2296 break;
2297 }
2298 }
2299 return FALSE;
2300}
2301
2302VOID
2304 HWND hDlg,
2306{
2307 HPROPSHEETPAGE hpage;
2308
2310 if (!hpage)
2311 return;
2312
2313 SendMessageW(hDlg, PSM_INSERTPAGE, 1, (LPARAM)hpage);
2314}
2315
2316INT_PTR
2318 HWND hwndDlg,
2320 BOOL bApply)
2321{
2322 DWORD dwIpAddr;
2323
2324 if (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED)
2325 {
2326 This->pCurrentConfig->DhcpEnabled = FALSE;
2327 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2328 {
2329 if (bApply)
2330 {
2332 SetFocus(GetDlgItem(hwndDlg, IDC_IPADDR));
2333 return E_FAIL;
2334 }
2335 }
2336 if (!This->pCurrentConfig->Ip)
2337 {
2338 This->pCurrentConfig->Ip = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2339 if (!This->pCurrentConfig->Ip)
2340 return E_OUTOFMEMORY;
2341 ZeroMemory(This->pCurrentConfig->Ip, sizeof(IP_ADDR));
2342 }
2343 This->pCurrentConfig->Ip->IpAddress = dwIpAddr;
2344
2345 if (SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2346 {
2347 if (bApply)
2349 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2350 {
2351 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2352 dwIpAddr = MAKEIPADDRESS(255, 0, 0, 0);
2353 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2354 dwIpAddr = MAKEIPADDRESS(255, 255, 0, 0);
2355 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2356 dwIpAddr = MAKEIPADDRESS(255, 255, 255, 0);
2357
2359 }
2360 if (bApply)
2361 {
2363 return E_FAIL;
2364 }
2365 }
2366 /* store subnetmask */
2367 This->pCurrentConfig->Ip->u.Subnetmask = dwIpAddr;
2368 }
2369 else
2370 {
2371 This->pCurrentConfig->DhcpEnabled = TRUE;
2372 }
2373
2374 if (SendDlgItemMessageW(hwndDlg, IDC_DEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2375 {
2376 if (!This->pCurrentConfig->Gw)
2377 {
2378 This->pCurrentConfig->Gw = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2379 if (!This->pCurrentConfig->Gw)
2380 return E_OUTOFMEMORY;
2381 ZeroMemory(This->pCurrentConfig->Gw, sizeof(IP_ADDR));
2382 }
2383 /* store default gateway */
2384 This->pCurrentConfig->Gw->IpAddress = dwIpAddr;
2385 }
2386 else
2387 {
2388 if (This->pCurrentConfig->Gw)
2389 {
2390 IP_ADDR * pNextGw = This->pCurrentConfig->Gw->Next;
2391 CoTaskMemFree(This->pCurrentConfig->Gw);
2392 This->pCurrentConfig->Gw = pNextGw;
2393 }
2394 }
2395
2397 {
2398 BOOL bSkip = FALSE;
2399 This->pCurrentConfig->AutoconfigActive = FALSE;
2400 if (SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2401 {
2402 if (!This->pCurrentConfig->Ns)
2403 {
2404 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2405 if (!This->pCurrentConfig->Ns)
2406 return E_OUTOFMEMORY;
2407 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2408 }
2409 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2410 }
2411 else if (This->pCurrentConfig->Ns)
2412 {
2413 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next;
2414
2415 CoTaskMemFree(This->pCurrentConfig->Ns);
2416 This->pCurrentConfig->Ns = pTemp;
2417 bSkip = TRUE;
2418 }
2419
2420
2421 if (SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2422 {
2423 if (!This->pCurrentConfig->Ns || bSkip)
2424 {
2425 if (!This->pCurrentConfig->Ns)
2426 {
2427 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2428 if (!This->pCurrentConfig->Ns)
2429 return E_OUTOFMEMORY;
2430 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2431 }
2432 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2433 }
2434 else if (!This->pCurrentConfig->Ns->Next)
2435 {
2436 This->pCurrentConfig->Ns->Next = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2437 if (!This->pCurrentConfig->Ns->Next)
2438 return E_OUTOFMEMORY;
2439 ZeroMemory(This->pCurrentConfig->Ns->Next, sizeof(IP_ADDR));
2440 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2441 }
2442 else
2443 {
2444 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2445 }
2446 }
2447 else
2448 {
2449 if (This->pCurrentConfig->Ns && This->pCurrentConfig->Ns->Next)
2450 {
2451 if (This->pCurrentConfig->Ns->Next->Next)
2452 {
2453 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next->Next;
2454 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2455 This->pCurrentConfig->Ns->Next = pTemp;
2456 }
2457 else
2458 {
2459 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2460 This->pCurrentConfig->Ns->Next = NULL;
2461 }
2462 }
2463 }
2464 }
2465 else
2466 {
2467 This->pCurrentConfig->AutoconfigActive = TRUE;
2468 }
2469 return S_OK;
2470}
2471
2472HRESULT
2474 HWND hwndDlg,
2475 TcpipSettings * pCurSettings)
2476{
2481
2486
2491
2496
2501
2502 if (pCurSettings->DhcpEnabled)
2503 {
2509 }
2510 else
2511 {
2513
2514 if (pCurSettings->Ip)
2515 {
2516 /* set current ip address */
2517 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2518 /* set current hostmask */
2519 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2520 }
2521 }
2522
2523 if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2524 {
2525 /* set current gateway */
2526 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2527 }
2528
2529 if (pCurSettings->AutoconfigActive)
2530 {
2534 }
2535 else
2536 {
2540 if (pCurSettings->Ns)
2541 {
2542 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2543 if (pCurSettings->Ns->Next)
2544 {
2545 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2546 }
2547 else
2548 {
2550 }
2551 }
2552 else
2553 {
2556 }
2557 }
2558
2559 return S_OK;
2560}
2561
2562HRESULT
2564 IP_ADDR_STRING * pSrc,
2565 IP_ADDR ** pTarget,
2567 LPWSTR szMetric)
2568{
2569 IP_ADDR_STRING * pCurrent;
2570 IP_ADDR *pNew, *pLast;
2571
2572 pCurrent = pSrc;
2573 pLast = NULL;
2574
2575 while(pCurrent)
2576 {
2577 pNew = CoTaskMemAlloc(sizeof(IP_ADDR));
2578 if (!pNew)
2579 {
2580 break;
2581 }
2582 ZeroMemory(pNew, sizeof(IP_ADDR));
2584 if (!pNew->IpAddress)
2585 {
2586 CoTaskMemFree(pNew);
2587 return E_FAIL;
2588 }
2589
2590 if (Type == SUBMASK)
2591 {
2593 pNew->NTEContext = pCurrent->Context;
2594 }
2595 else if (Type == METRIC)
2596 {
2597 if (szMetric && szMetric[0] != L'\0')
2598 {
2599 pNew->u.Metric = _wtoi(szMetric);
2600 szMetric += wcslen(szMetric) + 1;
2601 }
2602 }
2603
2604 if (!pLast)
2605 *pTarget = pNew;
2606 else
2607 pLast->Next = pNew;
2608
2609 pLast = pNew;
2610 pCurrent = pCurrent->Next;
2611
2612 }
2613 pLast->Next = NULL;
2614 return S_OK;
2615}
2616
2617
2618
2619INT_PTR
2622 HWND hwndDlg,
2623 UINT uMsg,
2624 WPARAM wParam,
2626)
2627{
2630 LPNMIPADDRESS lpnmipa;
2631 LPPSHNOTIFY lppsn;
2632 DWORD dwIpAddr;
2633
2634
2635 switch(uMsg)
2636 {
2637 case WM_INITDIALOG:
2639 This = (TcpipConfNotifyImpl*)page->lParam;
2640 if (This->pCurrentConfig)
2641 InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2643 return TRUE;
2644 case WM_NOTIFY:
2645 lppsn = (LPPSHNOTIFY) lParam;
2646 lpnmipa = (LPNMIPADDRESS) lParam;
2647 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
2648 {
2649 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2650 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
2651 {
2652 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2653 {
2654 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2656 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2658 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2659 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
2660 }
2661 }
2662 }
2663 else if (lppsn->hdr.code == PSN_APPLY)
2664 {
2668 else
2670
2671 return TRUE;
2672 }
2673 break;
2674 case WM_COMMAND:
2675 if (HIWORD(wParam) == BN_CLICKED)
2676 {
2677 switch (LOWORD(wParam))
2678 {
2679 case IDC_USEDHCP:
2680 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) == 0)
2681 {
2682 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2691 }
2692 break;
2693 case IDC_NODHCP:
2694 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) != 0)
2695 {
2696 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2701 {
2703 }
2708 SendMessageW(GetParent(hwndDlg), PSM_REMOVEPAGE, 1, 0);
2709 }
2710 break;
2711 case IDC_AUTODNS:
2712 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2717 break;
2718 case IDC_FIXEDDNS:
2719 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2722 break;
2723 case IDC_ADVANCED:
2725 break;
2726 }
2727 break;
2728 }
2729 default:
2730 break;
2731
2732 }
2733 return FALSE;
2734}
2735
2736/***************************************************************
2737 * INetCfgComponentPropertyUi interface
2738 */
2739
2740HRESULT
2741WINAPI
2743 INetCfgComponentPropertyUi * iface,
2744 REFIID iid,
2745 LPVOID * ppvObj)
2746{
2747 //LPOLESTR pStr;
2749
2750 *ppvObj = NULL;
2751
2752
2753 if (IsEqualIID (iid, &IID_IUnknown) ||
2755 {
2756 *ppvObj = This;
2758 return S_OK;
2759 }
2761 {
2762 *ppvObj = (LPVOID*)&This->lpVtblCompControl;
2764 return S_OK;
2765 }
2766
2767 //StringFromCLSID(iid, &pStr);
2768 //MessageBoxW(NULL, pStr, L"INetConnectionPropertyUi_fnQueryInterface", MB_OK);
2769 //CoTaskMemFree(pStr);
2770
2771 return E_NOINTERFACE;
2772}
2773
2774
2775ULONG
2776WINAPI
2778 INetCfgComponentPropertyUi * iface)
2779{
2781 ULONG refCount = InterlockedIncrement(&This->ref);
2782
2783 return refCount;
2784}
2785
2786ULONG
2787WINAPI
2789 INetCfgComponentPropertyUi * iface)
2790{
2792 ULONG refCount = InterlockedDecrement(&This->ref);
2793
2794 if (!refCount)
2795 {
2797 }
2798 return refCount;
2799}
2800
2801HRESULT
2802WINAPI
2804 INetCfgComponentPropertyUi * iface,
2806{
2807 INetLanConnectionUiInfo * pLanInfo;
2808 HRESULT hr;
2810
2811 hr = IUnknown_QueryInterface(pUnkReserved, &IID_INetLanConnectionUiInfo, (LPVOID*)&pLanInfo);
2812 if (FAILED(hr))
2813 return hr;
2814
2815 INetLanConnectionUiInfo_GetDeviceGuid(pLanInfo, &This->NetCfgInstanceId);
2816
2817 //FIXME
2818 // check if tcpip is enabled on that binding */
2819 IUnknown_Release(pUnkReserved);
2820 return S_OK;
2821}
2822
2823HRESULT
2824WINAPI
2826 INetCfgComponentPropertyUi * iface,
2828{
2830
2831 if (!iface || !pUnkReserved)
2832 return E_POINTER;
2833
2834 This->pUnknown = pUnkReserved;
2835 return S_OK;
2836}
2837
2838HRESULT
2841{
2842 LPOLESTR pStr;
2843 WCHAR szBuffer[200];
2844 HKEY hKey;
2845 DWORD dwSize;
2846
2847
2849 if (!This->pCurrentConfig->pDNS)
2850 return E_FAIL;
2851
2852 ZeroMemory(This->pCurrentConfig->pDNS, sizeof(TcpipAdvancedDNSDlgSettings));
2853
2854 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2855 return E_FAIL;
2856
2857 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2858 CoTaskMemFree(pStr);
2860 {
2861 dwSize = sizeof(DWORD);
2862 RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, &dwSize);
2863
2864 dwSize = sizeof(DWORD);
2865 RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, &dwSize);
2866
2867 dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain);
2868 RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szDomain, &dwSize);
2869
2870 dwSize = sizeof(DWORD);
2871 if (RegQueryValueExW(hKey, L"InterfaceMetric", NULL, NULL, (LPBYTE)&This->pCurrentConfig->Metric, &dwSize) != ERROR_SUCCESS)
2872 This->pCurrentConfig->Metric = 0;
2873
2875 }
2876
2877 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2878 {
2879 dwSize = sizeof(DWORD);
2880 RegQueryValueExW(hKey, L"UseDomainNameDevolution", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->UseDomainNameDevolution, &dwSize);
2881
2882 dwSize = 0;
2883 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, NULL, &dwSize) == ERROR_SUCCESS)
2884 {
2885 This->pCurrentConfig->pDNS->szSearchList = (LPWSTR)CoTaskMemAlloc(dwSize);
2886 if (This->pCurrentConfig->pDNS->szSearchList)
2887 {
2888 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szSearchList, &dwSize) != ERROR_SUCCESS)
2889 {
2890 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
2891 This->pCurrentConfig->pDNS->szSearchList = NULL;
2892 }
2893 }
2894 }
2896 }
2897 return S_OK;
2898}
2899
2900LPWSTR
2902{
2903 DWORD dwSize;
2904 LPWSTR pData;
2905
2907 return NULL;
2908
2910 if (!pData)
2911 return NULL;
2912
2914 {
2916 return NULL;
2917 }
2918 *Size = dwSize;
2919 return pData;
2920}
2921
2922HRESULT
2925{
2926 HKEY hKey;
2927 TcpFilterSettings *pFilter;
2928 WCHAR szBuffer[200];
2929 LPOLESTR pStr;
2930 DWORD dwVal, dwSize;
2931
2933 if (!pFilter)
2934 return E_FAIL;
2935
2936 ZeroMemory(pFilter, sizeof(TcpFilterSettings));
2937 This->pCurrentConfig->pFilter = pFilter;
2938
2939
2940 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2941 {
2942 dwSize = sizeof(DWORD);
2943 if (RegQueryValueExW(hKey, L"EnableSecurityFilters", NULL, NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
2944 pFilter->EnableSecurityFilters = dwVal;
2946 }
2947 else
2948 {
2949 pFilter->EnableSecurityFilters = FALSE;
2950 }
2951
2952 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2953 return E_FAIL;
2954
2955 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2956 CoTaskMemFree(pStr);
2958 {
2959 return S_OK;
2960 }
2961 pFilter->szTCPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"TCPAllowedPorts", &pFilter->TCPSize);
2962 pFilter->szUDPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"UDPAllowedPorts", &pFilter->UDPSize);
2963 pFilter->szRawIPAllowedProtocols = LoadTcpFilterSettingsFromRegistry(hKey, L"RawIPAllowedProtocols", &pFilter->IPSize);
2965 return S_OK;
2966}
2967
2968
2969HRESULT
2971{
2973 WCHAR szBuffer[50];
2974 IP_ADAPTER_INFO * pCurrentAdapter;
2975 IP_ADAPTER_INFO * pInfo;
2976 PIP_PER_ADAPTER_INFO pPerInfo;
2978 LPOLESTR pStr;
2979 HRESULT hr;
2980 BOOL bFound;
2981 TcpipSettings * pCurSettings;
2982 ULONG uLength;
2983
2984 if (This->pCurrentConfig)
2985 return S_OK;
2986
2987 hr = StringFromCLSID(&This->NetCfgInstanceId, &pStr);
2988 if (FAILED(hr))
2989 return hr;
2990
2991
2992 dwSize = 0;
2994 {
2995 CoTaskMemFree(pStr);
2996 return E_FAIL;
2997 }
2998
2999 pInfo = CoTaskMemAlloc(dwSize);
3000 if (!pInfo)
3001 {
3002 CoTaskMemFree(pStr);
3003 return E_FAIL;
3004 }
3005
3006 if (GetAdaptersInfo(pInfo, &dwSize) != ERROR_SUCCESS)
3007 {
3008 CoTaskMemFree(pStr);
3009 CoTaskMemFree(pInfo);
3010 return E_FAIL;
3011 }
3012
3013 pCurrentAdapter = pInfo;
3014 bFound = FALSE;
3015 while(pCurrentAdapter)
3016 {
3017 szBuffer[0] = L'\0';
3018 if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
3019 {
3020 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
3021 }
3022 if (!_wcsicmp(szBuffer, pStr))
3023 {
3024 bFound = TRUE;
3025 break;
3026 }
3027 pCurrentAdapter = pCurrentAdapter->Next;
3028 }
3029 CoTaskMemFree(pStr);
3030
3031 if (!bFound)
3032 {
3033 CoTaskMemFree(pInfo);
3034 return E_FAIL;
3035 }
3036
3037 pCurSettings = CoTaskMemAlloc(sizeof(TcpipSettings));
3038 if (!pCurSettings)
3039 {
3040 CoTaskMemFree(pInfo);
3041 return E_FAIL;
3042 }
3043
3044 ZeroMemory(pCurSettings, sizeof(TcpipSettings));
3045 This->pCurrentConfig = pCurSettings;
3046 pCurSettings->DhcpEnabled = pCurrentAdapter->DhcpEnabled;
3047 pCurSettings->Index = pCurrentAdapter->Index;
3048
3049 if (!pCurrentAdapter->DhcpEnabled)
3050 {
3051 CopyIpAddrString(&pCurrentAdapter->IpAddressList, &pCurSettings->Ip, SUBMASK, NULL);
3052 }
3053
3054 CopyIpAddrString(&pCurrentAdapter->GatewayList, &pCurSettings->Gw, METRIC, NULL);
3055
3056 uLength = sizeof(IP_PER_ADAPTER_INFO);
3058
3059 if (GetPerAdapterInfo(pCurrentAdapter->Index, &Info, &uLength) == ERROR_BUFFER_OVERFLOW)
3060 {
3061 pPerInfo = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(uLength);
3062 if (pPerInfo)
3063 {
3064 Status = GetPerAdapterInfo(pCurrentAdapter->Index, pPerInfo, &uLength);
3065 if (Status == NOERROR)
3066 {
3067 if (!pPerInfo->AutoconfigActive)
3068 {
3069 CopyIpAddrString(&pPerInfo->DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
3070 }
3071 pCurSettings->AutoconfigActive = pPerInfo->AutoconfigActive;
3072 }
3073 CoTaskMemFree(pPerInfo);
3074 }
3075 }
3076 else
3077 {
3078 if (!Info.AutoconfigActive)
3079 {
3080 CopyIpAddrString(&Info.DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
3081 }
3082 pCurSettings->AutoconfigActive = Info.AutoconfigActive;
3083 }
3084
3086 return E_FAIL;
3087
3089 return E_FAIL;
3090
3091 CoTaskMemFree(pInfo);
3092
3093 return S_OK;
3094}
3095
3096HRESULT
3097WINAPI
3099 INetCfgComponentPropertyUi * iface,
3100 DWORD *pdwDefPages,
3101 BYTE **pahpspPrivate,
3102 UINT *pcPages,
3104 LPCWSTR *pszStartPage)
3105{
3106 HPROPSHEETPAGE * hppages;
3107 UINT NumPages;
3108 HRESULT hr;
3110
3111 hr = Initialize(This);
3112 if (FAILED(hr))
3113 return hr;
3114
3115 if (This->pCurrentConfig->DhcpEnabled)
3116 NumPages = 2;
3117 else
3118 NumPages = 1;
3119
3120 hppages = (HPROPSHEETPAGE*) CoTaskMemAlloc(sizeof(HPROPSHEETPAGE) * NumPages);
3121 if (!hppages)
3122 return E_FAIL;
3123
3125 if (!hppages[0])
3126 {
3127 CoTaskMemFree(hppages);
3128 return E_FAIL;
3129 }
3130 if (NumPages == 2)
3131 {
3133 if (!hppages[1])
3134 {
3135 DestroyPropertySheetPage(hppages[0]);
3136 CoTaskMemFree(hppages);
3137 return E_FAIL;
3138 }
3139 }
3140
3141 *pahpspPrivate = (BYTE*)hppages;
3142 *pcPages = NumPages;
3143
3144 return S_OK;
3145}
3146
3147HRESULT
3148WINAPI
3150 INetCfgComponentPropertyUi * iface,
3151 HWND hwndDlg)
3152{
3153MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnValidateProperties", NULL, MB_OK);
3154 return S_OK;
3155}
3156
3157HRESULT
3158WINAPI
3160 INetCfgComponentPropertyUi * iface)
3161{
3162MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnApplyProperties", NULL, MB_OK);
3163 return S_OK;
3164}
3165
3166
3167HRESULT
3168WINAPI
3170 INetCfgComponentPropertyUi * iface)
3171{
3172//MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnCancelProperties", NULL, MB_OK);
3173 return S_OK;
3174}
3175
3176static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi =
3177{
3187};
3188
3189/***************************************************************
3190 * INetCfgComponentControl interface
3191 */
3192
3193HRESULT
3194WINAPI
3196 INetCfgComponentControl * iface,
3197 REFIID iid,
3198 LPVOID * ppvObj)
3199{
3201 return INetCfgComponentPropertyUi_QueryInterface((INetCfgComponentPropertyUi*)This, iid, ppvObj);
3202}
3203
3204ULONG
3205WINAPI
3207 INetCfgComponentControl * iface)
3208{
3210 return INetCfgComponentPropertyUi_AddRef((INetCfgComponentPropertyUi*)This);
3211}
3212
3213ULONG
3214WINAPI
3216 INetCfgComponentControl * iface)
3217{
3219 return INetCfgComponentPropertyUi_Release((INetCfgComponentPropertyUi*)This);
3220}
3221
3222HRESULT
3223WINAPI
3225 INetCfgComponentControl * iface,
3226 INetCfgComponent *pIComp,
3227 INetCfg *pINetCfg,
3228 BOOL fInstalling)
3229{
3231
3232 This->pNCfg = pINetCfg;
3233 This->pNComp = pIComp;
3234
3235 return S_OK;
3236}
3237
3238static
3239LPWSTR
3241{
3242 LPWSTR pStr, pRet;
3243 DWORD dwSize, dwIpAddr;
3244 WCHAR szBuffer[30];
3245 IP_ADDR *pTemp = pAddr;
3246
3247
3248 dwSize = 0;
3249 while(pTemp)
3250 {
3251 if (Type == IPADDR)
3252 {
3253 dwIpAddr = pTemp->IpAddress;
3254 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3255 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3256 }else if (Type == SUBMASK)
3257 {
3258 dwIpAddr = pTemp->u.Subnetmask;
3259 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3260 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3261 }
3262 else if (Type == METRIC)
3263 {
3264 swprintf(szBuffer, L"%u", pTemp->u.Metric);
3265 }
3266
3267 dwSize += wcslen(szBuffer) + 1;
3268 pTemp = pTemp->Next;
3269 }
3270
3271 if (!dwSize)
3272 return NULL;
3273
3274 pStr = pRet = CoTaskMemAlloc((dwSize+1) * sizeof(WCHAR));
3275 if(!pStr)
3276 return NULL;
3277
3278 pTemp = pAddr;
3279 while(pTemp)
3280 {
3281 if (Type == IPADDR)
3282 {
3283 dwIpAddr = pTemp->IpAddress;
3284 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3285 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3286 }else if (Type == SUBMASK)
3287 {
3288 dwIpAddr = pTemp->u.Subnetmask;
3289 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3290 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3291 }
3292 else if (Type == METRIC)
3293 {
3294 swprintf(pStr, L"%u", pTemp->u.Metric);
3295 }
3296
3297 if (bComma)
3298 {
3299 pStr += wcslen(pStr);
3300 if (pTemp->Next)
3301 {
3302 pStr[0] = L',';
3303 pStr++;
3304 }
3305 }
3306 else
3307 {
3308 pStr += wcslen(pStr) + 1;
3309 }
3310 pTemp = pTemp->Next;
3311 }
3312 pStr[0] = L'\0';
3313 *Size = (dwSize+1) * sizeof(WCHAR);
3314 return pRet;
3315}
3316
3317
3318HRESULT
3319WINAPI
3321 INetCfgComponentControl * iface)
3322{
3323 HKEY hKey;
3324 LPOLESTR pStr;
3325 DWORD dwSize;
3326 WCHAR szBuffer[200];
3327 TcpipSettings * pCurrentConfig, *pOldConfig;
3328 ULONG NTEInstance;
3329 DWORD DhcpApiVersion;
3330
3332
3333 pCurrentConfig = This->pCurrentConfig;
3334 This->pCurrentConfig = NULL;
3335
3336 if (FAILED(Initialize(This)))
3337 {
3338 This->pCurrentConfig = pCurrentConfig;
3339 return E_FAIL;
3340 }
3341 pOldConfig = This->pCurrentConfig;
3342 This->pCurrentConfig = pCurrentConfig;
3343
3344 //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyRegistryChanges", NULL, MB_OK);
3345
3346
3347 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3348 {
3349 if (pCurrentConfig->pDNS)
3350 {
3351 RegSetValueExW(hKey, L"UseDomainNameDevolution", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->pDNS->UseDomainNameDevolution, sizeof(DWORD));
3352 RegSetValueExW(hKey, L"SearchList", 0, REG_SZ, (LPBYTE)pCurrentConfig->pDNS->szSearchList,
3353 (wcslen(pCurrentConfig->pDNS->szSearchList)+1) * sizeof(WCHAR));
3354 }
3355 if (pCurrentConfig->pFilter)
3356 {
3357 RegSetValueExW(hKey, L"EnableSecurityFilters", 0, REG_DWORD,
3358 (LPBYTE)&pCurrentConfig->pFilter->EnableSecurityFilters, sizeof(DWORD));
3359 }
3361 }
3362
3363 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
3364 return E_FAIL;
3365
3366 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
3367 CoTaskMemFree(pStr);
3368
3370 {
3371 if (pCurrentConfig->Metric)
3372 RegSetValueExW(hKey, L"InterfaceMetric", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->Metric, sizeof(DWORD));
3373 else
3374 RegDeleteValueW(hKey, L"InterfaceMetric");
3375
3376 if (pCurrentConfig->pDNS)
3377 {
3378 RegSetValueExW(hKey, L"RegisterAdapterName", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, sizeof(DWORD));
3379 RegSetValueExW(hKey, L"RegistrationEnabled", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, sizeof(DWORD));
3380 RegSetValueExW(hKey, L"Domain", 0, REG_SZ, (LPBYTE)This->pCurrentConfig->pDNS->szDomain,
3381 (wcslen(This->pCurrentConfig->pDNS->szDomain)+1) * sizeof(WCHAR));
3382 }
3383#if 0
3384 if (pCurrentConfig->pFilter)
3385 {
3386 if (pCurrentConfig->pFilter->szTCPAllowedPorts)
3387 {
3388 RegSetValueExW(hKey, L"TCPAllowedPorts", 0, REG_MULTI_SZ,
3389 (LPBYTE)pCurrentConfig->pFilter->szTCPAllowedPorts,
3390 pCurrentConfig->pFilter->TCPSize);
3391 }
3392 if (pCurrentConfig->pFilter->szUDPAllowedPorts)
3393 {
3394 RegSetValueExW(hKey, L"UDPAllowedPorts", 0, REG_MULTI_SZ,
3395 (LPBYTE)pCurrentConfig->pFilter->szUDPAllowedPorts,
3396 pCurrentConfig->pFilter->UDPSize);
3397 }
3398 if (pCurrentConfig->pFilter->szRawIPAllowedProtocols)
3399 {
3400 RegSetValueExW(hKey, L"RawIPAllowedProtocols", 0, REG_MULTI_SZ,
3401 (LPBYTE)pCurrentConfig->pFilter->szRawIPAllowedProtocols,
3402 pCurrentConfig->pFilter->IPSize);
3403 }
3404 }
3405#endif
3406 RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->DhcpEnabled, sizeof(DWORD));
3407 if (pCurrentConfig->DhcpEnabled)
3408 {
3409 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3410 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3411 if (!pOldConfig->DhcpEnabled)
3412 {
3413 /* Delete this adapter's current IP address */
3414 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3415
3416 /* Delete all default routes for this adapter */
3417 dwSize = 0;
3419 {
3420 DWORD Index;
3422 if (pIpForwardTable)
3423 {
3424 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3425 {
3426 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3427 {
3428 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3429 pIpForwardTable->table[Index].dwForwardDest == 0)
3430 {
3431 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3432 }
3433 }
3434 }
3435 CoTaskMemFree(pIpForwardTable);
3436 }
3437 }
3438 }
3439 }
3440 else
3441 {
3442 /* Open the DHCP API if DHCP is enabled */
3443 if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR)
3444 {
3445 /* We have to tell DHCP about this */
3446 DhcpStaticRefreshParams(pCurrentConfig->Index,
3447 htonl(pCurrentConfig->Ip->IpAddress),
3448 htonl(pCurrentConfig->Ip->u.Subnetmask));
3449
3450 /* Close the API */
3452 }
3453 else
3454 {
3455 /* Delete this adapter's current static IP address */
3456 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3457
3458 /* Add the static IP address via the standard IPHLPAPI function */
3459 AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress),
3460 htonl(pCurrentConfig->Ip->u.Subnetmask),
3461 pCurrentConfig->Index,
3462 &pCurrentConfig->Ip->NTEContext,
3463 &NTEInstance);
3464 }
3465
3466 pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE);
3467 if(pStr)
3468 {
3469 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3470 CoTaskMemFree(pStr);
3471 }
3472
3473 pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE);
3474 if(pStr)
3475 {
3476 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3477 CoTaskMemFree(pStr);
3478 }
3479
3480 /* Delete all default routes for this adapter */
3481 dwSize = 0;
3483 {
3484 DWORD Index;
3486 if (pIpForwardTable)
3487 {
3488 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3489 {
3490 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3491 {
3492 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3493 pIpForwardTable->table[Index].dwForwardDest == 0)
3494 {
3495 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3496 }
3497 }
3498 }
3499 CoTaskMemFree(pIpForwardTable);
3500 }
3501 }
3502 }
3503
3504 if (pCurrentConfig->Gw)
3505 {
3506 MIB_IPFORWARDROW RouterMib;
3507 ZeroMemory(&RouterMib, sizeof(MIB_IPFORWARDROW));
3508
3509 RouterMib.dwForwardMetric1 = 1;
3510 RouterMib.dwForwardIfIndex = pOldConfig->Index;
3511 RouterMib.dwForwardNextHop = htonl(pCurrentConfig->Gw->IpAddress);
3512
3513 //TODO
3514 // add multiple gw addresses when required
3515
3516 if (CreateIpForwardEntry(&RouterMib) == NO_ERROR)
3517 {
3518 pStr = CreateMultiSzString(pCurrentConfig->Gw, IPADDR, &dwSize, FALSE);
3519 if(pStr)
3520 {
3521 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3522 CoTaskMemFree(pStr);
3523 }
3524
3525 pStr = CreateMultiSzString(pCurrentConfig->Gw, METRIC, &dwSize, FALSE);
3526 if(pStr)
3527 {
3528 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3529 CoTaskMemFree(pStr);
3530 }
3531 }
3532 }
3533 else
3534 {
3535 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"", 1 * sizeof(WCHAR));
3536 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", sizeof(WCHAR) * 2);
3537 }
3538
3539 if (!pCurrentConfig->Ns || pCurrentConfig->AutoconfigActive)
3540 {
3541 RegDeleteValueW(hKey, L"NameServer");
3542 }
3543 else
3544 {
3545 pStr = CreateMultiSzString(pCurrentConfig->Ns, IPADDR, &dwSize, TRUE);
3546 if(pStr)
3547 {
3548 RegSetValueExW(hKey, L"NameServer", 0, REG_SZ, (LPBYTE)pStr, dwSize);
3549 //RegDeleteValueW(hKey, L"DhcpNameServer");
3550 CoTaskMemFree(pStr);
3551 }
3552 }
3553
3555 }
3556 return S_OK;
3557}
3558
3559HRESULT
3560WINAPI
3562 INetCfgComponentControl * iface,
3563 INetCfgPnpReconfigCallback *pICallback)
3564{
3565 //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyPnpChanges", NULL, MB_OK);
3566 return S_OK;
3567}
3568
3569HRESULT
3570WINAPI
3572 INetCfgComponentControl * iface)
3573{
3574 //MessageBoxW(NULL, L"INetCfgComponentControl_fnCancelChanges", NULL, MB_OK);
3575 return S_OK;
3576}
3577
3578static const INetCfgComponentControlVtbl vt_NetCfgComponentControl =
3579{
3587};
3588
3589HRESULT
3590WINAPI
3592{
3594
3595 if (!ppv)
3596 return E_POINTER;
3597
3599 if (!This)
3600 return E_OUTOFMEMORY;
3601
3602 This->ref = 1;
3603 This->lpVtbl = (const INetCfgComponentPropertyUi*)&vt_NetCfgComponentPropertyUi;
3604 This->lpVtblCompControl = (const INetCfgComponentControl*)&vt_NetCfgComponentControl;
3605 This->pNCfg = NULL;
3606 This->pUnknown = NULL;
3607 This->pNComp = NULL;
3608 This->pCurrentConfig = NULL;
3609
3610 if (!SUCCEEDED (INetCfgComponentPropertyUi_QueryInterface ((INetCfgComponentPropertyUi*)This, riid, ppv)))
3611 {
3612 INetCfgComponentPropertyUi_Release((INetCfgComponentPropertyUi*)This);
3613 return E_NOINTERFACE;
3614 }
3615
3616 INetCfgComponentPropertyUi_Release((INetCfgComponentPropertyUi*)This);
3617 return S_OK;
3618}
Type
Definition: Type.h:7
#define __inline
Definition: _wctype.cpp:15
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define IDC_OK
Definition: resource.h:59
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
Definition: wordpad.c:155
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
wcscpy
static HWND hwndParent
Definition: cryptui.c:300
static TAGID TAGID find
Definition: db.cpp:156
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
#define BufferSize
Definition: mmc.h:75
#define DLGPROC
Definition: maze.c:62
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD APIENTRY DhcpCApiInitialize(_Out_ LPDWORD Version)
Definition: dhcpcsvc.c:102
DWORD APIENTRY DhcpStaticRefreshParams(DWORD AdapterIndex, DWORD Address, DWORD Netmask)
Definition: dhcpcsvc.c:314
VOID APIENTRY DhcpCApiCleanup(VOID)
Definition: dhcpcsvc.c:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_METRIC
Definition: resource.h:77
#define IDC_ADVANCED
Definition: resource.h:11
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3086
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3155
#define wcschr
Definition: compat.h:17
#define CP_ACP
Definition: compat.h:109
#define CALLBACK
Definition: compat.h:35
#define MultiByteToWideChar
Definition: compat.h:110
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
#define IDC_NODHCP
Definition: resource.h:24
#define IDS_TCPFILTERDESC
Definition: resource.h:102
#define IDC_IPDEL
Definition: resource.h:37
#define IDS_DISABLE_FILTER
Definition: resource.h:120
#define IDC_GWADD
Definition: resource.h:39
#define IDC_IP_RESTRICT
Definition: resource.h:83
#define IDC_DNS1
Definition: resource.h:30
#define IDC_DNSADDRMOD
Definition: resource.h:53
#define IDD_TCPIP_ADVOPT_DLG
Definition: resource.h:12
#define IDC_OPTLIST
Definition: resource.h:68
#define IDC_DNSSUFFIXLIST
Definition: resource.h:58
#define IDS_PROT_RANGE
Definition: resource.h:118
#define IDS_TCP_PORTS
Definition: resource.h:114
#define IDD_TCPIPADDIP_DLG
Definition: resource.h:14
#define IDC_PORT_VAL
Definition: resource.h:89
#define IDC_IP_DEL
Definition: resource.h:86
#define IDC_DNSSUFFIXUP
Definition: resource.h:59
#define IDC_DNSSUFFIXDEL
Definition: resource.h:63
#define IDC_GWDEL
Definition: resource.h:41
#define IDC_IP_ALLOW_ALL
Definition: resource.h:82
#define IDS_SUBMASK
Definition: resource.h:105
#define IDS_DUP_GW
Definition: resource.h:126
#define IDC_DNSSUFFIXDOWN
Definition: resource.h:60
#define IDS_NOITEMSEL
Definition: resource.h:110
#define IDD_TCPIP_ALTCF_DLG
Definition: resource.h:9
#define IDC_USEDHCP
Definition: resource.h:23
#define IDC_SUBNETMASK
Definition: resource.h:26
#define IDC_FIXEDDNS
Definition: resource.h:29
#define IDD_TCPIP_FILTER_DLG
Definition: resource.h:13
#define IDC_SUFFIX
Definition: resource.h:64
#define IDD_TCPIPDNS_DLG
Definition: resource.h:16
#define IDC_IPLIST
Definition: resource.h:34
#define IDC_OPTPROP
Definition: resource.h:69
#define IDC_USESUFFIX
Definition: resource.h:66
#define IDC_DNSADDRADD
Definition: resource.h:52
#define IDC_USE_FILTER
Definition: resource.h:87
#define IDC_IP_LIST
Definition: resource.h:84
#define IDD_TCPIPGW_DLG
Definition: resource.h:15
#define IDC_AUTODNS
Definition: resource.h:28
#define IDD_TCPIP_ADVIP_DLG
Definition: resource.h:10
#define IDC_UDP_LIST
Definition: resource.h:79
#define IDS_IP_PROTO
Definition: resource.h:116
#define IDC_TCP_RESTRICT
Definition: resource.h:73
#define IDC_GWMOD
Definition: resource.h:40
#define IDS_AUTOMATIC
Definition: resource.h:109
#define IDC_DNS2
Definition: resource.h:31
#define IDC_TCP_ADD
Definition: resource.h:75
#define IDS_DHCPACTIVE
Definition: resource.h:108
#define IDS_TCPIP
Definition: resource.h:111
#define IDC_DEFGATEWAY
Definition: resource.h:27
#define IDC_UDP_DEL
Definition: resource.h:81
#define IDC_IP_ADD
Definition: resource.h:85
#define IDS_DOMAIN_SUFFIX
Definition: resource.h:122
#define IDC_DNSADDRDEL
Definition: resource.h:54
#define IDS_UDP_PORTS
Definition: resource.h:115
#define IDC_UDP_ALLOW_ALL
Definition: resource.h:77
#define IDC_TCP_ALLOW_ALL
Definition: resource.h:72
#define IDC_DNSADDRUP
Definition: resource.h:50
#define IDS_NO_SUBMASK_SET
Definition: resource.h:101
#define IDS_TCPFILTER
Definition: resource.h:103
#define IDS_DUP_NUMBER
Definition: resource.h:119
#define IDC_GWMETRICTXT
Definition: resource.h:45
#define IDC_REGSUFFIX
Definition: resource.h:65
#define IDC_PRIMSUFFIX
Definition: resource.h:55
#define IDS_NO_SUFFIX
Definition: resource.h:121
#define IDS_METRIC_RANGE
Definition: resource.h:127
#define IDC_GWMETRIC
Definition: resource.h:46
#define IDC_GWAUTOMETRIC
Definition: resource.h:44
#define IDD_TCPIP_BASIC_DLG
Definition: resource.h:8
#define IDS_GATEWAY
Definition: resource.h:106
#define IDD_TCPIPSUFFIX_DLG
Definition: resource.h:17
#define IDS_PORT_RANGE
Definition: resource.h:117
#define IDC_IPADD
Definition: resource.h:35
#define IDC_IPMOD
Definition: resource.h:36
#define IDD_TCPIP_ADVDNS_DLG
Definition: resource.h:11
#define IDC_TCP_LIST
Definition: resource.h:74
#define IDS_ADD
Definition: resource.h:112
#define IDC_UDP_ADD
Definition: resource.h:80
#define IDS_DUP_IPADDR
Definition: resource.h:125
#define IDC_UDP_RESTRICT
Definition: resource.h:78
#define IDC_SELSUFFIX
Definition: resource.h:57
#define IDS_MOD
Definition: resource.h:113
#define IDC_IPADDR
Definition: resource.h:25
#define IDI_NETWORK
Definition: resource.h:4
#define IDS_DUP_SUFFIX
Definition: resource.h:124
#define IDC_DNSADDRDOWN
Definition: resource.h:51
#define IDS_IPADDR
Definition: resource.h:104
#define IDC_PORT_DESC
Definition: resource.h:88
#define IDS_DNS_SUFFIX
Definition: resource.h:123
#define IDS_NO_IPADDR_SET
Definition: resource.h:100
#define IDC_OPTDESC
Definition: resource.h:70
#define IDC_IFAUTOMETRIC
Definition: resource.h:42
#define IDC_DNSADDRLIST
Definition: resource.h:49
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:56
#define IDC_GWLIST
Definition: resource.h:38
#define IDC_TCP_DEL
Definition: resource.h:76
#define IDC_IFMETRIC
Definition: resource.h:43
#define IDD_TCPIP_PORT_DLG
Definition: resource.h:18
#define IDC_DNSSUFFIXMOD
Definition: resource.h:62
#define IDC_DNSSUFFIXADD
Definition: resource.h:61
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define swprintf
Definition: precomp.h:40
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxChildList * pList
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER pAddr
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
SINGLE_LIST_ENTRY * pCur
FxAutoRegKey hKey
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
Status
Definition: gdiplustypes.h:25
GLuint res
Definition: glext.h:9613
GLuint GLfloat * val
Definition: glext.h:7180
CPPORT Port[4]
Definition: headless.c:35
#define Gw
Definition: i386-dis.c:364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define iswalnum(_c)
Definition: ctype.h:671
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
Definition: iphlpapi_main.c:67
DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder)
DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute)
DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
struct _MIB_IPFORWARDTABLE * PMIB_IPFORWARDTABLE
#define REG_SZ
Definition: layer.c:22
if(dx< 0)
Definition: linetemp.h:194
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define htonl(x)
Definition: module.h:214
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static HICON
Definition: imagelist.c:80
static IUnknown * pUnkReserved
Definition: asmenum.c:33
static LPOLESTR
Definition: stg_prop.c:27
HICON hIcon
Definition: msconfig.c:44
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define INetCfgComponentPropertyUi_AddRef(p)
Definition: netcfgn.h:78
#define INetCfgComponentPropertyUi_QueryInterface(p, a, b)
Definition: netcfgn.h:77
EXTERN_C const IID IID_INetCfgComponentPropertyUi
Definition: netcfgn.h:88
#define INetCfgComponentPropertyUi_Release(p)
Definition: netcfgn.h:79
EXTERN_C const IID IID_INetCfgComponentControl
Definition: netcfgn.h:57
EXTERN_C const IID IID_INetLanConnectionUiInfo
Definition: netcfgn.h:109
#define INetLanConnectionUiInfo_GetDeviceGuid(p, a)
Definition: netcfgn.h:106
#define KEY_READ
Definition: nt_native.h:1026
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define KEY_WRITE
Definition: nt_native.h:1034
#define DWORD
Definition: nt_native.h:44
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
static const WCHAR szName[]
Definition: powrprof.c:45
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSNRET_INVALID
Definition: prsht.h:130
#define PSM_REMOVEPAGE
Definition: prsht.h:166
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSP_USETITLE
Definition: prsht.h:26
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_APPLY
Definition: prsht.h:117
struct _PROPSHEETPAGEW PROPSHEETPAGEW
#define PSNRET_NOERROR
Definition: prsht.h:129
#define LPPROPSHEETPAGE
Definition: prsht.h:390
#define PSH_USEICONID
Definition: prsht.h:42
#define PSCB_INITIALIZED
Definition: prsht.h:75
struct _PROPSHEETHEADERW PROPSHEETHEADERW
struct _PSHNOTIFY * LPPSHNOTIFY
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4496
struct tagNMIPADDRESS * LPNMIPADDRESS
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4491
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4493
#define LVFI_STRING
Definition: commctrl.h:2442
#define LVIF_STATE
Definition: commctrl.h:2317
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4489
#define LVM_FINDITEMW
Definition: commctrl.h:2471
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVM_SETITEMW
Definition: commctrl.h:2402
#define IPM_SETADDRESS
Definition: commctrl.h:4471
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define IPN_FIELDCHANGED
Definition: commctrl.h:4482
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4494
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LVIF_PARAM
Definition: commctrl.h:2316
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2637
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVCF_FMT
Definition: commctrl.h:2591
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4495
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define IPM_CLEARADDRESS
Definition: commctrl.h:4470
#define IPM_GETADDRESS
Definition: commctrl.h:4472
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2416
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LVM_GETITEMW
Definition: commctrl.h:2395
#define IPM_SETRANGE
Definition: commctrl.h:4473
#define LV_COLUMN
Definition: commctrl.h:2552
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
IP_PER_ADAPTER_INFO_W2KSP1 * PIP_PER_ADAPTER_INFO
Definition: iptypes.h:70
IP_PER_ADAPTER_INFO_W2KSP1 IP_PER_ADAPTER_INFO
Definition: iptypes.h:69
ULONG IPADDR
Definition: rassapi.h:53
#define WM_NOTIFY
Definition: richedit.h:61
#define REG_DWORD
Definition: sdbapi.c:615
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
& rect
Definition: startmenu.cpp:1413
char String[4 *4]
Definition: iptypes.h:31
LPWSTR szRawIPAllowedProtocols
INetCfgComponent * pNComp
const INetCfgComponentControl * lpVtblCompControl
const INetCfgComponentPropertyUi * lpVtbl
TcpipSettings * pCurrentConfig
TcpipAdvancedDNSDlgSettings * pDNS
TcpFilterSettings * pFilter
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:42
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:52
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:44
IP_ADDR_STRING GatewayList
Definition: iptypes.h:53
UINT DhcpEnabled
Definition: iptypes.h:50
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:35
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:36
IP_MASK_STRING IpMask
Definition: iptypes.h:37
DWORD Context
Definition: iptypes.h:38
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:66
DWORD dwForwardNextHop
Definition: ipmib.h:74
DWORD dwForwardMetric1
Definition: ipmib.h:88
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75
DWORD dwForwardDest
Definition: ipmib.h:71
DWORD dwNumEntries
Definition: ipmib.h:97
MIB_IPFORWARDROW table[1]
Definition: ipmib.h:98
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
LPCWSTR pszIcon
Definition: prsht.h:299
HWND hwndParent
Definition: prsht.h:295
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
LPCWSTR pszCaption
Definition: prsht.h:301
DLGPROC pfnDlgProc
Definition: prsht.h:226
DWORD dwSize
Definition: prsht.h:214
DWORD dwFlags
Definition: prsht.h:215
LPARAM lParam
Definition: prsht.h:227
LPCWSTR pszTemplate
Definition: prsht.h:218
LPCWSTR pszTitle
Definition: prsht.h:225
HINSTANCE hInstance
Definition: prsht.h:216
NMHDR hdr
Definition: prsht.h:330
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:641
Definition: module.h:576
union tagIP_ADDR::@576 u
struct tagIP_ADDR * Next
int cchTextMax
Definition: commctrl.h:2573
LPWSTR pszText
Definition: commctrl.h:2572
UINT_PTR idFrom
Definition: winuser.h:3260
UINT code
Definition: winuser.h:3261
UINT uNewState
Definition: commctrl.h:3041
Definition: windef.h:99
INT_PTR CALLBACK TcpipFilterSettingsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties(INetCfgComponentPropertyUi *iface)
HRESULT InitializeTcpipBasicDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)
struct tagIP_ADDR IP_ADDR
HRESULT CopyIpAddrString(IP_ADDR_STRING *pSrc, IP_ADDR **pTarget, COPY_TYPE Type, LPWSTR szMetric)
HRESULT WINAPI INetCfgComponentPropertyUi_fnMergePropPages(INetCfgComponentPropertyUi *iface, DWORD *pdwDefPages, BYTE **pahpspPrivate, UINT *pcPages, HWND hwndParent, LPCWSTR *pszStartPage)
UINT GetIpAddressFromStringW(WCHAR *szBuffer)
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
VOID InitializeTcpipAdvancedIpDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
HRESULT WINAPI INetCfgComponentControl_fnQueryInterface(INetCfgComponentControl *iface, REFIID iid, LPVOID *ppvObj)
VOID FreeIPAddr(IP_ADDR *pAddr)
LPWSTR LoadTcpFilterSettingsFromRegistry(HKEY hKey, LPCWSTR szName, LPDWORD Size)
VOID InsertIpAddressToListView(HWND hDlgCtrl, IP_ADDR *pAddr, BOOL bSubMask)
VOID StoreIPSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This, BOOL bSubmask)
VOID LaunchAdvancedTcpipSettings(HWND hwndDlg, TcpipConfNotifyImpl *This)
LPWSTR CreateFilterList(HWND hDlgCtrl, LPDWORD Size)
VOID DeleteItemFromList(HWND hDlgCtrl)
BOOL GetGWListEntry(HWND hDlgCtrl, INT Index, TcpipGwSettings *pGwSettings)
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
VOID AddAlternativeDialog(HWND hDlg, TcpipConfNotifyImpl *This)
HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi(INetCfgComponentPropertyUi *iface, IUnknown *pUnkReserved)
static VOID DelItem(HWND hDlgCtrl)
UINT GetIpAddressFromStringA(char *sBuffer)
INT_PTR CALLBACK TcpipAdvancedDnsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
COPY_TYPE
@ METRIC
@ SUBMASK
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl(INetCfgComponentControl *iface)
HRESULT WINAPI INetCfgComponentControl_fnCancelChanges(INetCfgComponentControl *iface)
HRESULT WINAPI INetCfgComponentControl_fnInitialize(INetCfgComponentControl *iface, INetCfgComponent *pIComp, INetCfg *pINetCfg, BOOL fInstalling)
BOOL VerifyDNSSuffix(LPWSTR szName)
HRESULT LoadFilterSettings(TcpipConfNotifyImpl *This)
VOID InsertColumnToListView(HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size)
VOID MoveItem(HWND hDlgCtrl, INT pos)
HRESULT WINAPI INetCfgComponentControl_fnApplyPnpChanges(INetCfgComponentControl *iface, INetCfgPnpReconfigCallback *pICallback)
HRESULT LoadDNSSettings(TcpipConfNotifyImpl *This)
INT GetSelectedItem(HWND hDlgCtrl)
ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef(INetCfgComponentPropertyUi *iface)
INT_PTR CALLBACK TcpipFilterPortDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
TcpFilterSettings * StoreTcpipFilterSettings(HWND hwndDlg)
BOOL GetListViewItem(HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)
HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties(INetCfgComponentPropertyUi *iface)
HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext(INetCfgComponentPropertyUi *iface, IUnknown *pUnkReserved)
VOID RemoveItem(HWND hDlgCtrl)
static LPWSTR CreateMultiSzString(IP_ADDR *pAddr, COPY_TYPE Type, LPDWORD Size, BOOL bComma)
INT_PTR CALLBACK TcpipAddSuffixDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK TcpipAdvancedOptDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR StoreTcpipBasicSettings(HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)
HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties(INetCfgComponentPropertyUi *iface, HWND hwndDlg)
HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryInterface(INetCfgComponentPropertyUi *iface, REFIID iid, LPVOID *ppvObj)
ULONG WINAPI INetCfgComponentPropertyUi_fnRelease(INetCfgComponentPropertyUi *iface)
HRESULT InitializeTcpipAltDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)
static const INetCfgComponentControlVtbl vt_NetCfgComponentControl
VOID InitializeTcpipAdvancedDNSDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
INT_PTR CALLBACK TcpipAdvancedIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitFilterListBox(LPWSTR pData, HWND hwndDlg, HWND hDlgCtrl, UINT AllowButton, UINT RestrictButton, UINT AddButton, UINT DelButton)
VOID StoreDNSSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This)
INT_PTR CALLBACK TcpipAltConfDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID ToggleUpDown(HWND hwndDlg, HWND hDlgCtrl, UINT UpButton, UINT DownButton, UINT ModButton, UINT DelButton)
INT_PTR CALLBACK TcpipAddDNSDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitializeTcpipAdvancedOptDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi
ULONG WINAPI INetCfgComponentControl_fnRelease(INetCfgComponentControl *iface)
INT_PTR CALLBACK TcpipAddIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT WINAPI TcpipConfigNotify_Constructor(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
ULONG WINAPI INetCfgComponentControl_fnAddRef(INetCfgComponentControl *iface)
HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges(INetCfgComponentControl *iface)
LPWSTR GetListViewEntries(HWND hDlgCtrl)
BOOL GetIPListEntry(HWND hDlgCtrl, INT Index, TcpipIpSettings *pIpSettings)
INT_PTR CALLBACK TcpipAdvGwDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK TcpipBasicDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
struct TcpipConfNotifyImpl * LPTcpipConfNotifyImpl
#define ICON_BIG
Definition: tnclass.cpp:51
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
int32_t INT_PTR
Definition: typedefs.h:64
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
#define AddItem
Definition: userenv.h:209
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
_In_ BOOL bEnable
Definition: winddi.h:3426
#define WINAPI
Definition: msvc.h:6
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:307
#define E_NOINTERFACE
Definition: winerror.h:3479
#define NOERROR
Definition: winerror.h:3448
#define E_POINTER
Definition: winerror.h:3480
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define LB_ERR
Definition: winuser.h:2468
#define LB_GETCOUNT
Definition: winuser.h:2067
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define EM_LIMITTEXT
Definition: winuser.h:2029
#define DWLP_USER
Definition: winuser.h:883
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:842
#define LB_GETTEXT
Definition: winuser.h:2085
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_GETTEXT
Definition: winuser.h:1646
#define WM_INITDIALOG
Definition: winuser.h:1767
#define LB_ADDSTRING
Definition: winuser.h:2060
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:798
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_SETTEXT
Definition: winuser.h:1645
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define LB_DELETESTRING
Definition: winuser.h:2061
HWND WINAPI SetFocus(_In_opt_ HWND)
#define LB_FINDSTRING
Definition: winuser.h:2063
#define LB_INSERTSTRING
Definition: winuser.h:2089
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MB_OK
Definition: winuser.h:801
#define LB_GETTEXTLEN
Definition: winuser.h:2086
#define MB_ICONWARNING
Definition: winuser.h:797
HWND WINAPI GetParent(_In_ HWND)
#define LBN_SELCHANGE
Definition: winuser.h:2111
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define MB_ICONINFORMATION
Definition: winuser.h:813
#define BN_CLICKED
Definition: winuser.h:1954
#define LB_SETCURSEL
Definition: winuser.h:2099
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LB_GETCURSEL
Definition: winuser.h:2068
#define SendDlgItemMessage
Definition: winuser.h:5953
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2427
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define BM_GETCHECK
Definition: winuser.h:1947
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static void Initialize()
Definition: xlate.c:212
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned char BYTE
Definition: xxhash.c:193