69 const INetCfgComponentPropertyUi *
lpVtbl;
135 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
175 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
179 if (pPort->MaxNum == 65536)
195 if (Num > pPort->MaxNum || Num == 0)
197 if (pPort->MaxNum == 65536)
207 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
216 li.pszText = szBuffer;
295 for(iIndex = 0; iIndex < iCount; iIndex++)
300 li.pszText = szBuffer;
301 li.cchTextMax =
sizeof(szBuffer) /
sizeof(
WCHAR);
346 Port.MaxNum = MaxItem;
347 Port.hDlgCtrl = hDlgCtrl;
470 if (pContext->pCurrentConfig->pFilter)
472 CoTaskMemFree(pContext->pCurrentConfig->pFilter->szTCPAllowedPorts);
473 CoTaskMemFree(pContext->pCurrentConfig->pFilter->szUDPAllowedPorts);
474 CoTaskMemFree(pContext->pCurrentConfig->pFilter->szRawIPAllowedProtocols);
477 pContext->pCurrentConfig->pFilter = pFilter;
549 szText[(
sizeof(szText)/
sizeof(
WCHAR))-1] =
L'\0';
556 szText[(
sizeof(szText)/
sizeof(
WCHAR))-1] =
L'\0';
612 lc.
fmt = LVCFMT_FIXED_WIDTH;
635 li.iItem = itemCount;
637 dwIpAddr =
pAddr->IpAddress;
641 li.pszText = szBuffer;
647 dwIpAddr =
pAddr->u.Subnetmask;
661 li.pszText = szBuffer;
682 if (
This->pCurrentConfig->DhcpEnabled)
688 li.pszText = szBuffer;
739 if (pGwSettings->
bAdd)
743 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
753 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
816 if (!pGwSettings->
bAdd)
851 li.pszText = pGwSettings->
szIP;
856 li.pszText = szBuffer;
900 if (pIpSettings->
bAdd)
904 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
913 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
957 else if (!pIpSettings->
bAdd)
1005 if (!pSettings->
bAdd)
1010 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1020 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1039 if (pSettings->Suffix)
1069 UINT iItemCount, iIndex;
1075 for (iIndex = 0; iIndex < iItemCount; iIndex++)
1099 li.pszText = pIpSettings->
szIP;
1144 while((pNext =
wcschr(pNext,
L'.')))
1148 dwIpAddr |= (Val <<
Index * 8);
1153 dwIpAddr |=
_wtoi(pLast);
1183 pNext =
pAddr->Next;
1196 li.pszText = szBuffer;
1198 li.iSubItem = SubIndex;
1221 for(iIndex = 0; iIndex < iCount; iIndex++)
1230 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1235 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1272 WCHAR szBuffer[200];
1299 (!
This->pCurrentConfig->DhcpEnabled);
1353 li.pszText = Ip.szIP;
1359 li.pszText = Ip.szMask;
1383 li.pszText = Ip.szIP;
1385 li.pszText = Ip.szMask;
1406 li.pszText =
Gw.szIP;
1414 li.pszText = szBuffer;
1421 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1423 li.pszText = szBuffer;
1450 li.pszText =
Gw.szIP;
1456 li.pszText = szBuffer;
1463 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1465 li.pszText = szBuffer;
1492 WCHAR szBuffer[100];
1501 if (!pSettings->
bAdd)
1505 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1515 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
1533 if (pSettings->
bAdd)
1538 if (!pSettings->
bAdd)
1569 WCHAR szBuffer[200];
1578 dwIpAddr =
pAddr->IpAddress;
1587 if (!
This->pCurrentConfig->pDNS)
1590 if (
This->pCurrentConfig->pDNS->RegisterAdapterName)
1595 if (
This->pCurrentConfig->pDNS->RegistrationEnabled)
1598 if (
This->pCurrentConfig->pDNS->szDomain[0])
1601 if (
This->pCurrentConfig->pDNS->UseDomainNameDevolution)
1604 if (!
This->pCurrentConfig->pDNS->szSearchList || (
wcslen(
This->pCurrentConfig->pDNS->szSearchList) == 0))
1612 pList =
This->pCurrentConfig->pDNS->szSearchList;
1653 if (lResult < lCount -1)
1678 WCHAR szBuffer[100];
1706 if (lResult + 1 < lCount)
1720 LPWSTR pszSearchList, pItem;
1723 if (!iCount || iCount ==
LB_ERR)
1728 for (iIndex = 0; iIndex < iCount; iIndex++)
1741 pItem = pszSearchList;
1742 for (iIndex = 0; iIndex < iCount; iIndex++)
1752 if (iIndex != iCount -1)
1759 return pszSearchList;
1775 if (!iCount || iCount ==
LB_ERR)
1781 for(iIndex = 0; iIndex < iCount; iIndex++)
1800 This->pCurrentConfig->AutoconfigActive =
FALSE;
1818 WCHAR szSuffix[100];
1819 WCHAR szFormat[200];
1820 WCHAR szBuffer[300];
1846 szSuffix[(
sizeof(szSuffix)/
sizeof(
WCHAR))-1] =
L'\0';
1851 szFormat[(
sizeof(szFormat)/
sizeof(
WCHAR))-1] =
L'\0';
1852 swprintf(szBuffer, szFormat, szSuffix);
1854 szFormat[(
sizeof(szFormat)/
sizeof(
WCHAR))-1] =
L'\0';
1856 szFormat[0] =
L'\0';
1869 if (!
This->pCurrentConfig->pDNS)
1876 This->pCurrentConfig->pDNS->szSearchList =
NULL;
1878 This->pCurrentConfig->pDNS->UseDomainNameDevolution =
TRUE;
1880 This->pCurrentConfig->pDNS->UseDomainNameDevolution =
FALSE;
1885 This->pCurrentConfig->pDNS->szSearchList =
NULL;
1886 This->pCurrentConfig->pDNS->UseDomainNameDevolution =
FALSE;
1892 This->pCurrentConfig->pDNS->RegisterAdapterName =
TRUE;
1894 This->pCurrentConfig->pDNS->RegistrationEnabled =
TRUE;
1896 This->pCurrentConfig->pDNS->RegistrationEnabled =
FALSE;
1900 This->pCurrentConfig->pDNS->RegisterAdapterName =
FALSE;
1901 This->pCurrentConfig->pDNS->RegistrationEnabled =
FALSE;
2060 Suffix.
Suffix[lLength] =
L'\0';
2107 WCHAR szBuffer[100];
2115 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
2117 szBuffer[0] =
L'\0';
2123 pinfo.u3.
phpage = hppages;
2179 This->pCurrentConfig->DhcpEnabled =
FALSE;
2189 if (!
This->pCurrentConfig->Ip)
2192 if (!
This->pCurrentConfig->Ip)
2196 This->pCurrentConfig->Ip->IpAddress = dwIpAddr;
2220 This->pCurrentConfig->Ip->u.Subnetmask = dwIpAddr;
2224 This->pCurrentConfig->DhcpEnabled =
TRUE;
2229 if (!
This->pCurrentConfig->Gw)
2232 if (!
This->pCurrentConfig->Gw)
2237 This->pCurrentConfig->Gw->IpAddress = dwIpAddr;
2241 if (
This->pCurrentConfig->Gw)
2243 IP_ADDR * pNextGw =
This->pCurrentConfig->Gw->Next;
2245 This->pCurrentConfig->Gw = pNextGw;
2252 This->pCurrentConfig->AutoconfigActive =
FALSE;
2255 if (!
This->pCurrentConfig->Ns)
2258 if (!
This->pCurrentConfig->Ns)
2262 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2264 else if (
This->pCurrentConfig->Ns)
2269 This->pCurrentConfig->Ns = pTemp;
2276 if (!
This->pCurrentConfig->Ns || bSkip)
2278 if (!
This->pCurrentConfig->Ns)
2281 if (!
This->pCurrentConfig->Ns)
2285 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2287 else if (!
This->pCurrentConfig->Ns->Next)
2290 if (!
This->pCurrentConfig->Ns->Next)
2293 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2297 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2302 if (
This->pCurrentConfig->Ns &&
This->pCurrentConfig->Ns->Next)
2304 if (
This->pCurrentConfig->Ns->Next->Next)
2306 IP_ADDR *pTemp =
This->pCurrentConfig->Ns->Next->Next;
2308 This->pCurrentConfig->Ns->Next = pTemp;
2313 This->pCurrentConfig->Ns->Next =
NULL;
2320 This->pCurrentConfig->AutoconfigActive =
TRUE;
2367 if (pCurSettings->
Ip)
2393 if (pCurSettings->
Ns)
2396 if (pCurSettings->
Ns->
Next)
2450 if (szMetric && szMetric[0] !=
L'\0')
2453 szMetric +=
wcslen(szMetric) + 1;
2463 pCurrent = pCurrent->
Next;
2493 if (
This->pCurrentConfig)
2602 INetCfgComponentPropertyUi * iface,
2637 INetCfgComponentPropertyUi * iface)
2648 INetCfgComponentPropertyUi * iface)
2663 INetCfgComponentPropertyUi * iface,
2666 INetLanConnectionUiInfo * pLanInfo;
2685 INetCfgComponentPropertyUi * iface,
2702 WCHAR szBuffer[200];
2708 if (!
This->pCurrentConfig->pDNS)
2716 swprintf(szBuffer,
L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2726 dwSize =
sizeof(
This->pCurrentConfig->pDNS->szDomain);
2741 if (
This->pCurrentConfig->pDNS->szSearchList)
2746 This->pCurrentConfig->pDNS->szSearchList =
NULL;
2783 WCHAR szBuffer[200];
2792 This->pCurrentConfig->pFilter = pFilter;
2810 swprintf(szBuffer,
L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2839 if (
This->pCurrentConfig)
2868 pCurrentAdapter = pInfo;
2870 while(pCurrentAdapter)
2872 szBuffer[0] =
L'\0';
2875 szBuffer[(
sizeof(szBuffer)/
sizeof(
WCHAR))-1] =
L'\0';
2882 pCurrentAdapter = pCurrentAdapter->
Next;
2900 This->pCurrentConfig = pCurSettings;
2902 pCurSettings->
Index = pCurrentAdapter->
Index;
2933 if (!
Info.AutoconfigActive)
2954 INetCfgComponentPropertyUi * iface,
2956 BYTE **pahpspPrivate,
2970 if (
This->pCurrentConfig->DhcpEnabled)
2996 *pahpspPrivate = (
BYTE*)hppages;
2997 *pcPages = NumPages;
3005 INetCfgComponentPropertyUi * iface,
3015 INetCfgComponentPropertyUi * iface)
3025 INetCfgComponentPropertyUi * iface)
3051 INetCfgComponentControl * iface,
3062 INetCfgComponentControl * iface)
3071 INetCfgComponentControl * iface)
3080 INetCfgComponentControl * iface,
3081 INetCfgComponent *pIComp,
3087 This->pNCfg = pINetCfg;
3088 This->pNComp = pIComp;
3123 pTemp = pTemp->
Next;
3163 pStr +=
wcslen(pStr) + 1;
3165 pTemp = pTemp->
Next;
3176 INetCfgComponentControl * iface)
3181 WCHAR szBuffer[200];
3184 DWORD DhcpApiVersion;
3188 pCurrentConfig =
This->pCurrentConfig;
3193 This->pCurrentConfig = pCurrentConfig;
3196 pOldConfig =
This->pCurrentConfig;
3197 This->pCurrentConfig = pCurrentConfig;
3204 if (pCurrentConfig->
pDNS)
3221 swprintf(szBuffer,
L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
3226 if (pCurrentConfig->
pDNS)
3272 if (pIpForwardTable)
3311 pCurrentConfig->
Index,
3336 if (pIpForwardTable)
3354 if (pCurrentConfig->
Gw)
3412 INetCfgComponentControl * iface,
3413 INetCfgPnpReconfigCallback *pICallback)
3422 INetCfgComponentControl * iface)
#define InterlockedIncrement
#define InterlockedDecrement
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
#define RegCloseKey(hKey)
#define ERROR_INSUFFICIENT_BUFFER
void WINAPI DhcpCApiCleanup(void)
DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version)
DWORD APIENTRY DhcpStaticRefreshParams(DWORD AdapterIndex, DWORD Address, DWORD Netmask)
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)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
#define MultiByteToWideChar
HINSTANCE netcfgx_hInstance
#define IDS_TCPFILTERDESC
#define IDS_DISABLE_FILTER
#define IDD_TCPIP_ADVOPT_DLG
#define IDC_DNSSUFFIXLIST
#define IDD_TCPIPADDIP_DLG
#define IDC_DNSSUFFIXDOWN
#define IDD_TCPIP_ALTCF_DLG
#define IDD_TCPIP_FILTER_DLG
#define IDD_TCPIP_ADVIP_DLG
#define IDS_DOMAIN_SUFFIX
#define IDC_UDP_ALLOW_ALL
#define IDC_TCP_ALLOW_ALL
#define IDS_NO_SUBMASK_SET
#define IDD_TCPIP_BASIC_DLG
#define IDD_TCPIPSUFFIX_DLG
#define IDD_TCPIP_ADVDNS_DLG