ReactOS 0.4.16-dev-1946-g52006dd
tcpipconf_notify.c File Reference
#include "precomp.h"
#include <winnls.h>
#include <winsock.h>
#include <iphlpapi.h>
#include <dhcpcsdk.h>
#include <dhcpcapi.h>
Include dependency graph for tcpipconf_notify.c:

Go to the source code of this file.

Classes

struct  TcpFilterSettings
 
struct  TcpipAdvancedDNSDlgSettings
 
struct  tagIP_ADDR
 
struct  TcpipSettings
 
struct  TcpipConfNotifyImpl
 
struct  TcpipGwSettings
 
struct  TcpipIpSettings
 
struct  TcpipDnsSettings
 
struct  TcpipSuffixSettings
 
struct  TcpipPortSettings
 

Typedefs

typedef struct tagIP_ADDR IP_ADDR
 
typedef struct TcpipConfNotifyImplLPTcpipConfNotifyImpl
 

Enumerations

enum  COPY_TYPE { METRIC = 1 , SUBMASK = 2 , IPADDR = 3 }
 

Functions

static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl (INetCfgComponentControl *iface)
 
INT GetSelectedItem (HWND hDlgCtrl)
 
HRESULT InitializeTcpipBasicDlgCtrls (HWND hwndDlg, TcpipSettings *pCurSettings)
 
VOID InsertColumnToListView (HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size)
 
INT_PTR StoreTcpipBasicSettings (HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)
 
HRESULT Initialize (TcpipConfNotifyImpl *This)
 
UINT GetIpAddressFromStringW (WCHAR *szBuffer)
 
VOID DisplayError (UINT ResTxt, UINT ResTitle, UINT Type)
 
INT_PTR CALLBACK TcpipFilterPortDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID InitFilterListBox (LPWSTR pData, HWND hwndDlg, HWND hDlgCtrl, UINT AllowButton, UINT RestrictButton, UINT AddButton, UINT DelButton)
 
LPWSTR CreateFilterList (HWND hDlgCtrl, LPDWORD Size)
 
TcpFilterSettingsStoreTcpipFilterSettings (HWND hwndDlg)
 
static VOID AddItem (HWND hwndDlg, HWND hDlgCtrl, UINT MaxItem, UINT ResId)
 
static VOID DelItem (HWND hDlgCtrl)
 
INT_PTR CALLBACK TcpipFilterSettingsDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HPROPSHEETPAGE InitializePropertySheetPage (LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
 
VOID InitializeTcpipAdvancedOptDlg (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
INT_PTR CALLBACK TcpipAdvancedOptDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID InsertIpAddressToListView (HWND hDlgCtrl, IP_ADDR *pAddr, BOOL bSubMask)
 
VOID InitializeTcpipAdvancedIpDlg (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
INT_PTR CALLBACK TcpipAdvGwDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL GetGWListEntry (HWND hDlgCtrl, INT Index, TcpipGwSettings *pGwSettings)
 
INT_PTR CALLBACK TcpipAddIpDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL VerifyDNSSuffix (LPWSTR szName)
 
INT_PTR CALLBACK TcpipAddSuffixDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL GetIPListEntry (HWND hDlgCtrl, INT Index, TcpipIpSettings *pIpSettings)
 
VOID DeleteItemFromList (HWND hDlgCtrl)
 
UINT GetIpAddressFromStringA (char *sBuffer)
 
VOID FreeIPAddr (IP_ADDR *pAddr)
 
BOOL GetListViewItem (HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)
 
VOID StoreIPSettings (HWND hDlgCtrl, TcpipConfNotifyImpl *This, BOOL bSubmask)
 
INT_PTR CALLBACK TcpipAdvancedIpDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK TcpipAddDNSDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID InitializeTcpipAdvancedDNSDlg (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
VOID ToggleUpDown (HWND hwndDlg, HWND hDlgCtrl, UINT UpButton, UINT DownButton, UINT ModButton, UINT DelButton)
 
VOID MoveItem (HWND hDlgCtrl, INT pos)
 
VOID RemoveItem (HWND hDlgCtrl)
 
LPWSTR GetListViewEntries (HWND hDlgCtrl)
 
VOID StoreDNSSettings (HWND hDlgCtrl, TcpipConfNotifyImpl *This)
 
INT_PTR CALLBACK TcpipAdvancedDnsDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
VOID LaunchAdvancedTcpipSettings (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
HRESULT InitializeTcpipAltDlgCtrls (HWND hwndDlg, TcpipSettings *pCurSettings)
 
INT_PTR CALLBACK TcpipAltConfDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID AddAlternativeDialog (HWND hDlg, TcpipConfNotifyImpl *This)
 
HRESULT CopyIpAddrString (IP_ADDR_STRING *pSrc, IP_ADDR **pTarget, COPY_TYPE Type, LPWSTR szMetric)
 
INT_PTR CALLBACK TcpipBasicDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryInterface (INetCfgComponentPropertyUi *iface, REFIID iid, LPVOID *ppvObj)
 
ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef (INetCfgComponentPropertyUi *iface)
 
ULONG WINAPI INetCfgComponentPropertyUi_fnRelease (INetCfgComponentPropertyUi *iface)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi (INetCfgComponentPropertyUi *iface, IUnknown *pUnkReserved)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext (INetCfgComponentPropertyUi *iface, IUnknown *pUnkReserved)
 
HRESULT LoadDNSSettings (TcpipConfNotifyImpl *This)
 
LPWSTR LoadTcpFilterSettingsFromRegistry (HKEY hKey, LPCWSTR szName, LPDWORD Size)
 
HRESULT LoadFilterSettings (TcpipConfNotifyImpl *This)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnMergePropPages (INetCfgComponentPropertyUi *iface, DWORD *pdwDefPages, BYTE **pahpspPrivate, UINT *pcPages, HWND hwndParent, LPCWSTR *pszStartPage)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties (INetCfgComponentPropertyUi *iface, HWND hwndDlg)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties (INetCfgComponentPropertyUi *iface)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties (INetCfgComponentPropertyUi *iface)
 
HRESULT WINAPI INetCfgComponentControl_fnQueryInterface (INetCfgComponentControl *iface, REFIID iid, LPVOID *ppvObj)
 
ULONG WINAPI INetCfgComponentControl_fnAddRef (INetCfgComponentControl *iface)
 
ULONG WINAPI INetCfgComponentControl_fnRelease (INetCfgComponentControl *iface)
 
HRESULT WINAPI INetCfgComponentControl_fnInitialize (INetCfgComponentControl *iface, INetCfgComponent *pIComp, INetCfg *pINetCfg, BOOL fInstalling)
 
static LPWSTR CreateMultiSzString (IP_ADDR *pAddr, COPY_TYPE Type, LPDWORD Size, BOOL bComma)
 
HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges (INetCfgComponentControl *iface)
 
HRESULT WINAPI INetCfgComponentControl_fnApplyPnpChanges (INetCfgComponentControl *iface, INetCfgPnpReconfigCallback *pICallback)
 
HRESULT WINAPI INetCfgComponentControl_fnCancelChanges (INetCfgComponentControl *iface)
 
HRESULT WINAPI TcpipConfigNotify_Constructor (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
 

Variables

static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi
 
static const INetCfgComponentControlVtbl vt_NetCfgComponentControl
 

Typedef Documentation

◆ IP_ADDR

◆ LPTcpipConfNotifyImpl

Enumeration Type Documentation

◆ COPY_TYPE

Enumerator
METRIC 
SUBMASK 
IPADDR 

Definition at line 47 of file tcpipconf_notify.c.

48{
49 METRIC = 1,
50 SUBMASK = 2,
51 IPADDR = 3
52} COPY_TYPE;
ULONG IPADDR
Definition: rassapi.h:53
COPY_TYPE
@ METRIC
@ SUBMASK

Function Documentation

◆ AddAlternativeDialog()

VOID AddAlternativeDialog ( HWND  hDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2303 of file tcpipconf_notify.c.

2306{
2307 HPROPSHEETPAGE hpage;
2308
2310 if (!hpage)
2311 return;
2312
2313 SendMessageW(hDlg, PSM_INSERTPAGE, 1, (LPARAM)hpage);
2314}
#define NULL
Definition: types.h:112
#define IDD_TCPIP_ALTCF_DLG
Definition: resource.h:9
LONG_PTR LPARAM
Definition: minwindef.h:175
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
INT_PTR CALLBACK TcpipAltConfDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by TcpipBasicDlg().

◆ AddItem()

static VOID AddItem ( HWND  hwndDlg,
HWND  hDlgCtrl,
UINT  MaxItem,
UINT  ResId 
)
static

Definition at line 339 of file tcpipconf_notify.c.

344{
346
347 Port.MaxNum = MaxItem;
348 Port.hDlgCtrl = hDlgCtrl;
349 Port.ResId = ResId;
350
352}
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
#define IDD_TCPIP_PORT_DLG
Definition: resource.h:18
CPPORT Port[4]
Definition: headless.c:35
INT_PTR CALLBACK TcpipFilterPortDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

◆ CopyIpAddrString()

HRESULT CopyIpAddrString ( IP_ADDR_STRING pSrc,
IP_ADDR **  pTarget,
COPY_TYPE  Type,
LPWSTR  szMetric 
)

Definition at line 2563 of file tcpipconf_notify.c.

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}
Type
Definition: Type.h:7
#define E_FAIL
Definition: ddrawi.h:102
#define L(x)
Definition: resources.c:13
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
#define ZeroMemory
Definition: minwinbase.h:31
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
char String[4 *4]
Definition: iptypes.h:31
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
union tagIP_ADDR::@576 u
struct tagIP_ADDR * Next
UINT GetIpAddressFromStringA(char *sBuffer)

Referenced by Initialize().

◆ CreateFilterList()

LPWSTR CreateFilterList ( HWND  hDlgCtrl,
LPDWORD  Size 
)

Definition at line 267 of file tcpipconf_notify.c.

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}
wcscpy
unsigned long DWORD
Definition: ntddk_ex.h:95
SINGLE_LIST_ENTRY * pCur
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVM_GETITEMW
Definition: commctrl.h:2395
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by StoreTcpipFilterSettings().

◆ CreateMultiSzString()

static LPWSTR CreateMultiSzString ( IP_ADDR pAddr,
COPY_TYPE  Type,
LPDWORD  Size,
BOOL  bComma 
)
static

Definition at line 3240 of file tcpipconf_notify.c.

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}
#define swprintf
Definition: precomp.h:40
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER pAddr
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4496
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4493
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4494
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4495

Referenced by INetCfgComponentControl_fnApplyRegistryChanges().

◆ DeleteItemFromList()

VOID DeleteItemFromList ( HWND  hDlgCtrl)

Definition at line 1127 of file tcpipconf_notify.c.

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}
#define IDS_NOITEMSEL
Definition: resource.h:110
#define IDS_TCPIP
Definition: resource.h:111
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2416
#define memset(x, y, z)
Definition: compat.h:39
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
INT GetSelectedItem(HWND hDlgCtrl)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MB_ICONINFORMATION
Definition: winuser.h:813

Referenced by TcpipAdvancedIpDlg().

◆ DelItem()

static VOID DelItem ( HWND  hDlgCtrl)
static

Definition at line 356 of file tcpipconf_notify.c.

358{
359 INT iIndex = GetSelectedItem(hDlgCtrl);
360
361 if (iIndex != -1)
362 {
363 (void)ListView_DeleteItem(hDlgCtrl, iIndex);
364 return;
365 }
367}
#define MB_ICONWARNING
Definition: winuser.h:797

Referenced by TcpipFilterSettingsDlg().

◆ DisplayError()

VOID DisplayError ( UINT  ResTxt,
UINT  ResTitle,
UINT  Type 
)

Definition at line 130 of file tcpipconf_notify.c.

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}
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)

Referenced by DeleteItemFromList(), DelItem(), StoreTcpipBasicSettings(), TcpipAddDNSDlg(), TcpipAddIpDlg(), TcpipAddSuffixDlg(), TcpipAdvancedDnsDlg(), TcpipAdvancedIpDlg(), TcpipAdvGwDlg(), TcpipFilterPortDlg(), and TcpipFilterSettingsDlg().

◆ FreeIPAddr()

VOID FreeIPAddr ( IP_ADDR pAddr)

Definition at line 1185 of file tcpipconf_notify.c.

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}

Referenced by StoreDNSSettings(), and TcpipAdvancedIpDlg().

◆ GetGWListEntry()

BOOL GetGWListEntry ( HWND  hDlgCtrl,
INT  Index,
TcpipGwSettings pGwSettings 
)

Definition at line 853 of file tcpipconf_notify.c.

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}
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by TcpipAdvancedIpDlg().

◆ GetIpAddressFromStringA()

UINT GetIpAddressFromStringA ( char sBuffer)

Definition at line 1170 of file tcpipconf_notify.c.

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}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
unsigned int UINT
Definition: ndis.h:50
UINT GetIpAddressFromStringW(WCHAR *szBuffer)

Referenced by CopyIpAddrString().

◆ GetIpAddressFromStringW()

UINT GetIpAddressFromStringW ( WCHAR szBuffer)

Definition at line 1145 of file tcpipconf_notify.c.

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}
#define wcschr
Definition: compat.h:17

Referenced by GetIpAddressFromStringA(), StoreDNSSettings(), StoreIPSettings(), TcpipAddIpDlg(), and TcpipAdvGwDlg().

◆ GetIPListEntry()

BOOL GetIPListEntry ( HWND  hDlgCtrl,
INT  Index,
TcpipIpSettings pIpSettings 
)

Definition at line 1103 of file tcpipconf_notify.c.

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}

Referenced by TcpipAdvancedIpDlg().

◆ GetListViewEntries()

LPWSTR GetListViewEntries ( HWND  hDlgCtrl)

Definition at line 1743 of file tcpipconf_notify.c.

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}
int32_t INT_PTR
Definition: typedefs.h:64
#define LB_ERR
Definition: winuser.h:2468
#define LB_GETCOUNT
Definition: winuser.h:2067
#define LB_GETTEXT
Definition: winuser.h:2085
#define LB_GETTEXTLEN
Definition: winuser.h:2086

Referenced by TcpipAdvancedDnsDlg().

◆ GetListViewItem()

BOOL GetListViewItem ( HWND  hDlgCtrl,
UINT  Index,
UINT  SubIndex,
WCHAR szBuffer,
UINT  BufferSize 
)

Definition at line 1201 of file tcpipconf_notify.c.

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}
#define BufferSize
Definition: mmc.h:75

Referenced by StoreIPSettings().

◆ GetSelectedItem()

INT GetSelectedItem ( HWND  hDlgCtrl)

Definition at line 1077 of file tcpipconf_notify.c.

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}
#define LVIF_STATE
Definition: commctrl.h:2317
#define LVIS_SELECTED
Definition: commctrl.h:2324

Referenced by DECLARE_INTERFACE_(), DeleteItemFromList(), DelItem(), and TcpipAdvancedIpDlg().

◆ impl_from_INetCfgComponentControl()

static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl ( INetCfgComponentControl *  iface)
static

◆ INetCfgComponentControl_fnAddRef()

ULONG WINAPI INetCfgComponentControl_fnAddRef ( INetCfgComponentControl *  iface)

Definition at line 3206 of file tcpipconf_notify.c.

3208{
3210 return INetCfgComponentPropertyUi_AddRef((INetCfgComponentPropertyUi*)This);
3211}
#define INetCfgComponentPropertyUi_AddRef(p)
Definition: netcfgn.h:78
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl(INetCfgComponentControl *iface)

◆ INetCfgComponentControl_fnApplyPnpChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyPnpChanges ( INetCfgComponentControl *  iface,
INetCfgPnpReconfigCallback *  pICallback 
)

Definition at line 3561 of file tcpipconf_notify.c.

3564{
3565 //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyPnpChanges", NULL, MB_OK);
3566 return S_OK;
3567}

◆ INetCfgComponentControl_fnApplyRegistryChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges ( INetCfgComponentControl *  iface)

Definition at line 3320 of file tcpipconf_notify.c.

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}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#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 TRUE
Definition: types.h:120
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 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
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
FxAutoRegKey hKey
#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 CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute)
DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
struct _MIB_IPFORWARDTABLE * PMIB_IPFORWARDTABLE
#define REG_SZ
Definition: layer.c:22
#define htonl(x)
Definition: module.h:214
static LPOLESTR
Definition: stg_prop.c:27
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define KEY_WRITE
Definition: nt_native.h:1034
#define REG_DWORD
Definition: sdbapi.c:615
LPWSTR szRawIPAllowedProtocols
TcpipAdvancedDNSDlgSettings * pDNS
TcpFilterSettings * pFilter
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
static LPWSTR CreateMultiSzString(IP_ADDR *pAddr, COPY_TYPE Type, LPDWORD Size, BOOL bComma)
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static void Initialize()
Definition: xlate.c:212

◆ INetCfgComponentControl_fnCancelChanges()

HRESULT WINAPI INetCfgComponentControl_fnCancelChanges ( INetCfgComponentControl *  iface)

Definition at line 3571 of file tcpipconf_notify.c.

3573{
3574 //MessageBoxW(NULL, L"INetCfgComponentControl_fnCancelChanges", NULL, MB_OK);
3575 return S_OK;
3576}

◆ INetCfgComponentControl_fnInitialize()

HRESULT WINAPI INetCfgComponentControl_fnInitialize ( INetCfgComponentControl *  iface,
INetCfgComponent *  pIComp,
INetCfg *  pINetCfg,
BOOL  fInstalling 
)

Definition at line 3224 of file tcpipconf_notify.c.

3229{
3231
3232 This->pNCfg = pINetCfg;
3233 This->pNComp = pIComp;
3234
3235 return S_OK;
3236}

◆ INetCfgComponentControl_fnQueryInterface()

HRESULT WINAPI INetCfgComponentControl_fnQueryInterface ( INetCfgComponentControl *  iface,
REFIID  iid,
LPVOID ppvObj 
)

Definition at line 3195 of file tcpipconf_notify.c.

3199{
3201 return INetCfgComponentPropertyUi_QueryInterface((INetCfgComponentPropertyUi*)This, iid, ppvObj);
3202}
#define INetCfgComponentPropertyUi_QueryInterface(p, a, b)
Definition: netcfgn.h:77

◆ INetCfgComponentControl_fnRelease()

ULONG WINAPI INetCfgComponentControl_fnRelease ( INetCfgComponentControl *  iface)

Definition at line 3215 of file tcpipconf_notify.c.

3217{
3219 return INetCfgComponentPropertyUi_Release((INetCfgComponentPropertyUi*)This);
3220}
#define INetCfgComponentPropertyUi_Release(p)
Definition: netcfgn.h:79

◆ INetCfgComponentPropertyUi_fnAddRef()

ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef ( INetCfgComponentPropertyUi *  iface)

Definition at line 2777 of file tcpipconf_notify.c.

2779{
2781 ULONG refCount = InterlockedIncrement(&This->ref);
2782
2783 return refCount;
2784}
#define InterlockedIncrement
Definition: armddk.h:53

◆ INetCfgComponentPropertyUi_fnApplyProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3159 of file tcpipconf_notify.c.

3161{
3162MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnApplyProperties", NULL, MB_OK);
3163 return S_OK;
3164}
#define MB_OK
Definition: winuser.h:801

◆ INetCfgComponentPropertyUi_fnCancelProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3169 of file tcpipconf_notify.c.

3171{
3172//MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnCancelProperties", NULL, MB_OK);
3173 return S_OK;
3174}

◆ INetCfgComponentPropertyUi_fnMergePropPages()

HRESULT WINAPI INetCfgComponentPropertyUi_fnMergePropPages ( INetCfgComponentPropertyUi *  iface,
DWORD pdwDefPages,
BYTE **  pahpspPrivate,
UINT pcPages,
HWND  hwndParent,
LPCWSTR pszStartPage 
)

Definition at line 3098 of file tcpipconf_notify.c.

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}
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3155
#define IDD_TCPIP_BASIC_DLG
Definition: resource.h:8
HRESULT hr
Definition: shlfolder.c:183
INT_PTR CALLBACK TcpipBasicDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
unsigned char BYTE
Definition: xxhash.c:193

◆ INetCfgComponentPropertyUi_fnQueryInterface()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryInterface ( INetCfgComponentPropertyUi *  iface,
REFIID  iid,
LPVOID ppvObj 
)

Definition at line 2742 of file tcpipconf_notify.c.

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}
const GUID IID_IUnknown
EXTERN_C const IID IID_INetCfgComponentPropertyUi
Definition: netcfgn.h:88
EXTERN_C const IID IID_INetCfgComponentControl
Definition: netcfgn.h:57
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ INetCfgComponentPropertyUi_fnQueryPropertyUi()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2803 of file tcpipconf_notify.c.

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}
static IUnknown * pUnkReserved
Definition: asmenum.c:33
EXTERN_C const IID IID_INetLanConnectionUiInfo
Definition: netcfgn.h:109
#define INetLanConnectionUiInfo_GetDeviceGuid(p, a)
Definition: netcfgn.h:106

◆ INetCfgComponentPropertyUi_fnRelease()

ULONG WINAPI INetCfgComponentPropertyUi_fnRelease ( INetCfgComponentPropertyUi *  iface)

Definition at line 2788 of file tcpipconf_notify.c.

2790{
2792 ULONG refCount = InterlockedDecrement(&This->ref);
2793
2794 if (!refCount)
2795 {
2797 }
2798 return refCount;
2799}
#define InterlockedDecrement
Definition: armddk.h:52

◆ INetCfgComponentPropertyUi_fnSetContext()

HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2825 of file tcpipconf_notify.c.

2828{
2830
2831 if (!iface || !pUnkReserved)
2832 return E_POINTER;
2833
2834 This->pUnknown = pUnkReserved;
2835 return S_OK;
2836}
#define E_POINTER
Definition: winerror.h:3480

◆ INetCfgComponentPropertyUi_fnValidateProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties ( INetCfgComponentPropertyUi *  iface,
HWND  hwndDlg 
)

Definition at line 3149 of file tcpipconf_notify.c.

3152{
3153MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnValidateProperties", NULL, MB_OK);
3154 return S_OK;
3155}

◆ InitFilterListBox()

VOID InitFilterListBox ( LPWSTR  pData,
HWND  hwndDlg,
HWND  hDlgCtrl,
UINT  AllowButton,
UINT  RestrictButton,
UINT  AddButton,
UINT  DelButton 
)

Definition at line 232 of file tcpipconf_notify.c.

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}
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
Definition: wordpad.c:155
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by TcpipFilterSettingsDlg().

◆ Initialize()

HRESULT Initialize ( TcpipConfNotifyImpl This)

Definition at line 2970 of file tcpipconf_notify.c.

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}
Status
Definition: gdiplustypes.h:25
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
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
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
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
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:66
HRESULT CopyIpAddrString(IP_ADDR_STRING *pSrc, IP_ADDR **pTarget, COPY_TYPE Type, LPWSTR szMetric)
HRESULT LoadFilterSettings(TcpipConfNotifyImpl *This)
HRESULT LoadDNSSettings(TcpipConfNotifyImpl *This)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:307
#define NOERROR
Definition: winerror.h:3448

◆ InitializePropertySheetPage()

HPROPSHEETPAGE InitializePropertySheetPage ( LPWSTR  resname,
DLGPROC  dlgproc,
LPARAM  lParam,
LPWSTR  szTitle 
)

Definition at line 515 of file tcpipconf_notify.c.

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}
LPARAM lParam
Definition: combotst.c:139
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3086
#define PSP_USETITLE
Definition: prsht.h:26
#define PSP_DEFAULT
Definition: prsht.h:22
struct _PROPSHEETPAGEW PROPSHEETPAGEW
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

Referenced by AddAlternativeDialog(), INetCfgComponentPropertyUi_fnMergePropPages(), and LaunchAdvancedTcpipSettings().

◆ InitializeTcpipAdvancedDNSDlg()

VOID InitializeTcpipAdvancedDNSDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 1594 of file tcpipconf_notify.c.

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}
#define IDC_DNSSUFFIXLIST
Definition: resource.h:58
#define IDC_SUFFIX
Definition: resource.h:64
#define IDC_USESUFFIX
Definition: resource.h:66
#define IDC_REGSUFFIX
Definition: resource.h:65
#define IDC_PRIMSUFFIX
Definition: resource.h:55
#define IDC_SELSUFFIX
Definition: resource.h:57
#define IDC_DNSADDRLIST
Definition: resource.h:49
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:56
#define IDC_DNSSUFFIXADD
Definition: resource.h:61
FxChildList * pList
#define LB_ADDSTRING
Definition: winuser.h:2060
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1645
#define LB_SETCURSEL
Definition: winuser.h:2099

Referenced by TcpipAdvancedDnsDlg().

◆ InitializeTcpipAdvancedIpDlg()

VOID InitializeTcpipAdvancedIpDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 671 of file tcpipconf_notify.c.

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}
#define IDS_METRIC
Definition: resource.h:77
#define IDC_IPDEL
Definition: resource.h:37
#define IDC_GWDEL
Definition: resource.h:41
#define IDS_SUBMASK
Definition: resource.h:105
#define IDC_IPLIST
Definition: resource.h:34
#define IDC_GWMOD
Definition: resource.h:40
#define IDS_DHCPACTIVE
Definition: resource.h:108
#define IDS_GATEWAY
Definition: resource.h:106
#define IDC_IPADD
Definition: resource.h:35
#define IDC_IPMOD
Definition: resource.h:36
#define IDS_IPADDR
Definition: resource.h:104
#define IDC_IFAUTOMETRIC
Definition: resource.h:42
#define IDC_GWLIST
Definition: resource.h:38
#define IDC_IFMETRIC
Definition: resource.h:43
& rect
Definition: startmenu.cpp:1413
Definition: windef.h:99
VOID InsertIpAddressToListView(HWND hDlgCtrl, IP_ADDR *pAddr, BOOL bSubMask)
VOID InsertColumnToListView(HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size)
#define EM_LIMITTEXT
Definition: winuser.h:2029
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)

Referenced by TcpipAdvancedIpDlg().

◆ InitializeTcpipAdvancedOptDlg()

VOID InitializeTcpipAdvancedOptDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 540 of file tcpipconf_notify.c.

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}
#define IDS_TCPFILTERDESC
Definition: resource.h:102
#define IDC_OPTLIST
Definition: resource.h:68
#define IDS_TCPFILTER
Definition: resource.h:103
#define IDC_OPTDESC
Definition: resource.h:70
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_USER
Definition: winuser.h:883

Referenced by TcpipAdvancedOptDlg().

◆ InitializeTcpipAltDlgCtrls()

HRESULT InitializeTcpipAltDlgCtrls ( HWND  hwndDlg,
TcpipSettings pCurSettings 
)

Definition at line 2169 of file tcpipconf_notify.c.

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}
#define IDC_NODHCP
Definition: resource.h:24
#define IDC_DNS1
Definition: resource.h:30
#define IDC_USEDHCP
Definition: resource.h:23
#define IDC_SUBNETMASK
Definition: resource.h:26
#define IDC_DNS2
Definition: resource.h:31
#define IDC_DEFGATEWAY
Definition: resource.h:27
#define IDC_IPADDR
Definition: resource.h:25
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4489
#define IPM_SETADDRESS
Definition: commctrl.h:4471
#define IPM_CLEARADDRESS
Definition: commctrl.h:4470
#define IPM_SETRANGE
Definition: commctrl.h:4473
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by TcpipAltConfDlg().

◆ InitializeTcpipBasicDlgCtrls()

HRESULT InitializeTcpipBasicDlgCtrls ( HWND  hwndDlg,
TcpipSettings pCurSettings 
)

Definition at line 2473 of file tcpipconf_notify.c.

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}
#define IDC_FIXEDDNS
Definition: resource.h:29
#define IDC_AUTODNS
Definition: resource.h:28

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ InsertColumnToListView()

VOID InsertColumnToListView ( HWND  hDlgCtrl,
UINT  ResId,
UINT  SubItem,
UINT  Size 
)

Definition at line 598 of file tcpipconf_notify.c.

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}
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2637
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LV_COLUMN
Definition: commctrl.h:2552
int cchTextMax
Definition: commctrl.h:2573
LPWSTR pszText
Definition: commctrl.h:2572

Referenced by InitializeTcpipAdvancedIpDlg(), and TcpipFilterSettingsDlg().

◆ InsertIpAddressToListView()

VOID InsertIpAddressToListView ( HWND  hDlgCtrl,
IP_ADDR pAddr,
BOOL  bSubMask 
)

Definition at line 622 of file tcpipconf_notify.c.

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}
#define IDS_AUTOMATIC
Definition: resource.h:109
#define LVM_SETITEMW
Definition: commctrl.h:2402

Referenced by InitializeTcpipAdvancedIpDlg().

◆ LaunchAdvancedTcpipSettings()

VOID LaunchAdvancedTcpipSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2130 of file tcpipconf_notify.c.

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}
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
#define IDD_TCPIP_ADVOPT_DLG
Definition: resource.h:12
#define IDD_TCPIP_ADVIP_DLG
Definition: resource.h:10
#define IDD_TCPIP_ADVDNS_DLG
Definition: resource.h:11
#define IDI_NETWORK
Definition: resource.h:4
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSH_USEICONID
Definition: prsht.h:42
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
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
HRESULT InitializeTcpipBasicDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
INT_PTR CALLBACK TcpipAdvancedDnsDlg(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)
INT_PTR CALLBACK TcpipAdvancedIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND WINAPI GetParent(_In_ HWND)

Referenced by TcpipBasicDlg().

◆ LoadDNSSettings()

HRESULT LoadDNSSettings ( TcpipConfNotifyImpl This)

Definition at line 2839 of file tcpipconf_notify.c.

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}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
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
#define KEY_READ
Definition: nt_native.h:1026
#define DWORD
Definition: nt_native.h:44

Referenced by Initialize().

◆ LoadFilterSettings()

HRESULT LoadFilterSettings ( TcpipConfNotifyImpl This)

Definition at line 2923 of file tcpipconf_notify.c.

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}
LPWSTR LoadTcpFilterSettingsFromRegistry(HKEY hKey, LPCWSTR szName, LPDWORD Size)

Referenced by Initialize().

◆ LoadTcpFilterSettingsFromRegistry()

LPWSTR LoadTcpFilterSettingsFromRegistry ( HKEY  hKey,
LPCWSTR  szName,
LPDWORD  Size 
)

Definition at line 2901 of file tcpipconf_notify.c.

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}
static const WCHAR szName[]
Definition: powrprof.c:45

Referenced by LoadFilterSettings().

◆ MoveItem()

VOID MoveItem ( HWND  hDlgCtrl,
INT  pos 
)

Definition at line 1703 of file tcpipconf_notify.c.

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}
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define LB_DELETESTRING
Definition: winuser.h:2061
#define LB_INSERTSTRING
Definition: winuser.h:2089
#define LB_GETCURSEL
Definition: winuser.h:2068

Referenced by TcpipAdvancedDnsDlg().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 2113 of file tcpipconf_notify.c.

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}
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ICON_BIG
Definition: tnclass.cpp:51
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2427

Referenced by LaunchAdvancedTcpipSettings().

◆ RemoveItem()

VOID RemoveItem ( HWND  hDlgCtrl)

Definition at line 1725 of file tcpipconf_notify.c.

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}

Referenced by TcpipAdvancedDnsDlg().

◆ StoreDNSSettings()

VOID StoreDNSSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This 
)

Definition at line 1792 of file tcpipconf_notify.c.

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}
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:641
VOID FreeIPAddr(IP_ADDR *pAddr)

Referenced by TcpipAdvancedDnsDlg().

◆ StoreIPSettings()

VOID StoreIPSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This,
BOOL  bSubmask 
)

Definition at line 1215 of file tcpipconf_notify.c.

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}
BOOL GetListViewItem(HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)

Referenced by TcpipAdvancedIpDlg().

◆ StoreTcpipBasicSettings()

INT_PTR StoreTcpipBasicSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This,
BOOL  bApply 
)

Definition at line 2317 of file tcpipconf_notify.c.

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}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define IDS_NO_SUBMASK_SET
Definition: resource.h:101
#define IDS_NO_IPADDR_SET
Definition: resource.h:100
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4491
#define IPM_GETADDRESS
Definition: commctrl.h:4472
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ StoreTcpipFilterSettings()

TcpFilterSettings * StoreTcpipFilterSettings ( HWND  hwndDlg)

Definition at line 316 of file tcpipconf_notify.c.

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}
#define IDC_USE_FILTER
Definition: resource.h:87
#define IDC_IP_LIST
Definition: resource.h:84
#define IDC_UDP_LIST
Definition: resource.h:79
#define IDC_TCP_LIST
Definition: resource.h:74
LPWSTR CreateFilterList(HWND hDlgCtrl, LPDWORD Size)

Referenced by TcpipFilterSettingsDlg().

◆ TcpipAddDNSDlg()

INT_PTR CALLBACK TcpipAddDNSDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1513 of file tcpipconf_notify.c.

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}
#define IDC_OK
Definition: resource.h:59
WPARAM wParam
Definition: combotst.c:138
#define IDS_ADD
Definition: resource.h:112
#define IDS_MOD
Definition: resource.h:113
#define IDS_DUP_SUFFIX
Definition: resource.h:124
#define LOWORD(l)
Definition: pedump.c:82
struct tagNMIPADDRESS * LPNMIPADDRESS
#define IPN_FIELDCHANGED
Definition: commctrl.h:4482
#define WM_NOTIFY
Definition: richedit.h:61
UINT_PTR idFrom
Definition: winuser.h:3260
UINT code
Definition: winuser.h:3261
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:842
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_GETTEXT
Definition: winuser.h:1646
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_ICONERROR
Definition: winuser.h:798
#define LB_FINDSTRING
Definition: winuser.h:2063
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAddIpDlg()

INT_PTR CALLBACK TcpipAddIpDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 882 of file tcpipconf_notify.c.

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}
static TAGID TAGID find
Definition: db.cpp:156
#define IDS_DUP_IPADDR
Definition: resource.h:125
#define LVFI_STRING
Definition: commctrl.h:2442
#define LVM_FINDITEMW
Definition: commctrl.h:2471

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAddSuffixDlg()

INT_PTR CALLBACK TcpipAddSuffixDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1001 of file tcpipconf_notify.c.

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}
#define IDS_DOMAIN_SUFFIX
Definition: resource.h:122
BOOL VerifyDNSSuffix(LPWSTR szName)
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAdvancedDnsDlg()

INT_PTR CALLBACK TcpipAdvancedDnsDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1834 of file tcpipconf_notify.c.

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);
2046 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_GETTEXT, (WPARAM)lIndex, (LPARAM)Dns.szIP);
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}
#define IDC_DNSADDRMOD
Definition: resource.h:53
#define IDC_DNSSUFFIXUP
Definition: resource.h:59
#define IDC_DNSSUFFIXDEL
Definition: resource.h:63
#define IDC_DNSSUFFIXDOWN
Definition: resource.h:60
#define IDD_TCPIPDNS_DLG
Definition: resource.h:16
#define IDC_DNSADDRADD
Definition: resource.h:52
#define IDC_DNSADDRDEL
Definition: resource.h:54
#define IDC_DNSADDRUP
Definition: resource.h:50
#define IDS_NO_SUFFIX
Definition: resource.h:121
#define IDD_TCPIPSUFFIX_DLG
Definition: resource.h:17
#define IDC_DNSADDRDOWN
Definition: resource.h:51
#define IDS_DNS_SUFFIX
Definition: resource.h:123
#define IDC_DNSSUFFIXMOD
Definition: resource.h:62
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _PSHNOTIFY * LPPSHNOTIFY
NMHDR hdr
Definition: prsht.h:330
Definition: module.h:576
VOID MoveItem(HWND hDlgCtrl, INT pos)
VOID RemoveItem(HWND hDlgCtrl)
INT_PTR CALLBACK TcpipAddSuffixDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitializeTcpipAdvancedDNSDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID StoreDNSSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This)
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)
LPWSTR GetListViewEntries(HWND hDlgCtrl)
#define HIWORD(l)
Definition: typedefs.h:247
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define LBN_SELCHANGE
Definition: winuser.h:2111
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define BN_CLICKED
Definition: winuser.h:1954
#define SendDlgItemMessage
Definition: winuser.h:5953
#define BM_GETCHECK
Definition: winuser.h:1947

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedIpDlg()

INT_PTR CALLBACK TcpipAdvancedIpDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1273 of file tcpipconf_notify.c.

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}
#define IDC_GWADD
Definition: resource.h:39
#define IDD_TCPIPADDIP_DLG
Definition: resource.h:14
#define IDD_TCPIPGW_DLG
Definition: resource.h:15
#define IDS_METRIC_RANGE
Definition: resource.h:127
GLuint res
Definition: glext.h:9613
GLuint GLfloat * val
Definition: glext.h:7180
#define Gw
Definition: i386-dis.c:364
#define PSNRET_NOERROR
Definition: prsht.h:129
#define LVIF_PARAM
Definition: commctrl.h:2316
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
UINT uNewState
Definition: commctrl.h:3041
VOID InitializeTcpipAdvancedIpDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID StoreIPSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This, BOOL bSubmask)
VOID DeleteItemFromList(HWND hDlgCtrl)
BOOL GetGWListEntry(HWND hDlgCtrl, INT Index, TcpipGwSettings *pGwSettings)
INT_PTR CALLBACK TcpipAddIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL GetIPListEntry(HWND hDlgCtrl, INT Index, TcpipIpSettings *pIpSettings)
INT_PTR CALLBACK TcpipAdvGwDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
_In_ BOOL bEnable
Definition: winddi.h:3426
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedOptDlg()

INT_PTR CALLBACK TcpipAdvancedOptDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 566 of file tcpipconf_notify.c.

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}
#define IDD_TCPIP_FILTER_DLG
Definition: resource.h:13
#define IDC_OPTPROP
Definition: resource.h:69
INT_PTR CALLBACK TcpipFilterSettingsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitializeTcpipAdvancedOptDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvGwDlg()

INT_PTR CALLBACK TcpipAdvGwDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 726 of file tcpipconf_notify.c.

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}
#define IDS_DUP_GW
Definition: resource.h:126
#define IDC_GWMETRICTXT
Definition: resource.h:45
#define IDC_GWMETRIC
Definition: resource.h:46
#define IDC_GWAUTOMETRIC
Definition: resource.h:44
#define BST_UNCHECKED
Definition: winuser.h:199

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAltConfDlg()

INT_PTR CALLBACK TcpipAltConfDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2247 of file tcpipconf_notify.c.

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}
HRESULT InitializeTcpipAltDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)

Referenced by AddAlternativeDialog(), and INetCfgComponentPropertyUi_fnMergePropPages().

◆ TcpipBasicDlg()

INT_PTR CALLBACK TcpipBasicDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2621 of file tcpipconf_notify.c.

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}
#define IDC_ADVANCED
Definition: resource.h:11
#define SUCCEEDED(hr)
Definition: intsafe.h:50
if(dx< 0)
Definition: linetemp.h:194
#define PSNRET_INVALID
Definition: prsht.h:130
#define PSM_REMOVEPAGE
Definition: prsht.h:166
VOID LaunchAdvancedTcpipSettings(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID AddAlternativeDialog(HWND hDlg, TcpipConfNotifyImpl *This)

Referenced by INetCfgComponentPropertyUi_fnMergePropPages().

◆ TcpipConfigNotify_Constructor()

HRESULT WINAPI TcpipConfigNotify_Constructor ( IUnknown pUnkOuter,
REFIID  riid,
LPVOID ppv 
)

Definition at line 3591 of file tcpipconf_notify.c.

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}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const INetCfgComponentControlVtbl vt_NetCfgComponentControl
static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi

◆ TcpipFilterPortDlg()

INT_PTR CALLBACK TcpipFilterPortDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 156 of file tcpipconf_notify.c.

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;
219 EndDialog(hwndDlg, TRUE);
220 break;
221 }
224 break;
225 }
226 }
227 }
228 return FALSE;
229}
#define IDS_PROT_RANGE
Definition: resource.h:118
#define IDC_PORT_VAL
Definition: resource.h:89
#define IDS_DUP_NUMBER
Definition: resource.h:119
#define IDS_PORT_RANGE
Definition: resource.h:117
#define IDC_PORT_DESC
Definition: resource.h:88
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382

Referenced by AddItem().

◆ TcpipFilterSettingsDlg()

INT_PTR CALLBACK TcpipFilterSettingsDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 371 of file tcpipconf_notify.c.

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 {
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}
#define IDS_DISABLE_FILTER
Definition: resource.h:120
#define IDC_IP_RESTRICT
Definition: resource.h:83
#define IDS_TCP_PORTS
Definition: resource.h:114
#define IDC_IP_DEL
Definition: resource.h:86
#define IDC_IP_ALLOW_ALL
Definition: resource.h:82
#define IDS_IP_PROTO
Definition: resource.h:116
#define IDC_TCP_RESTRICT
Definition: resource.h:73
#define IDC_TCP_ADD
Definition: resource.h:75
#define IDC_UDP_DEL
Definition: resource.h:81
#define IDC_IP_ADD
Definition: resource.h:85
#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_UDP_ADD
Definition: resource.h:80
#define IDC_UDP_RESTRICT
Definition: resource.h:78
#define IDC_TCP_DEL
Definition: resource.h:76
TcpipSettings * pCurrentConfig
static VOID DelItem(HWND hDlgCtrl)
TcpFilterSettings * StoreTcpipFilterSettings(HWND hwndDlg)
VOID InitFilterListBox(LPWSTR pData, HWND hwndDlg, HWND hDlgCtrl, UINT AllowButton, UINT RestrictButton, UINT AddButton, UINT DelButton)
#define AddItem
Definition: userenv.h:209

Referenced by TcpipAdvancedOptDlg().

◆ ToggleUpDown()

VOID ToggleUpDown ( HWND  hwndDlg,
HWND  hDlgCtrl,
UINT  UpButton,
UINT  DownButton,
UINT  ModButton,
UINT  DelButton 
)

Definition at line 1669 of file tcpipconf_notify.c.

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}

Referenced by TcpipAdvancedDnsDlg().

◆ VerifyDNSSuffix()

BOOL VerifyDNSSuffix ( LPWSTR  szName)

Definition at line 986 of file tcpipconf_notify.c.

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}
#define iswalnum(_c)
Definition: ctype.h:671
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

Referenced by TcpipAddSuffixDlg(), and TcpipAdvancedDnsDlg().

Variable Documentation

◆ vt_NetCfgComponentControl

const INetCfgComponentControlVtbl vt_NetCfgComponentControl
static
Initial value:
=
{
}
HRESULT WINAPI INetCfgComponentControl_fnQueryInterface(INetCfgComponentControl *iface, REFIID iid, LPVOID *ppvObj)
HRESULT WINAPI INetCfgComponentControl_fnCancelChanges(INetCfgComponentControl *iface)
HRESULT WINAPI INetCfgComponentControl_fnInitialize(INetCfgComponentControl *iface, INetCfgComponent *pIComp, INetCfg *pINetCfg, BOOL fInstalling)
HRESULT WINAPI INetCfgComponentControl_fnApplyPnpChanges(INetCfgComponentControl *iface, INetCfgPnpReconfigCallback *pICallback)
ULONG WINAPI INetCfgComponentControl_fnRelease(INetCfgComponentControl *iface)
ULONG WINAPI INetCfgComponentControl_fnAddRef(INetCfgComponentControl *iface)
HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges(INetCfgComponentControl *iface)

Definition at line 3578 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().

◆ vt_NetCfgComponentPropertyUi

const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi
static
Initial value:
=
{
}
HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties(INetCfgComponentPropertyUi *iface)
HRESULT WINAPI INetCfgComponentPropertyUi_fnMergePropPages(INetCfgComponentPropertyUi *iface, DWORD *pdwDefPages, BYTE **pahpspPrivate, UINT *pcPages, HWND hwndParent, LPCWSTR *pszStartPage)
HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi(INetCfgComponentPropertyUi *iface, IUnknown *pUnkReserved)
ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef(INetCfgComponentPropertyUi *iface)
HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties(INetCfgComponentPropertyUi *iface)
HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext(INetCfgComponentPropertyUi *iface, IUnknown *pUnkReserved)
HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties(INetCfgComponentPropertyUi *iface, HWND hwndDlg)
HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryInterface(INetCfgComponentPropertyUi *iface, REFIID iid, LPVOID *ppvObj)
ULONG WINAPI INetCfgComponentPropertyUi_fnRelease(INetCfgComponentPropertyUi *iface)

Definition at line 3176 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().