ReactOS 0.4.15-dev-7889-g76290a6
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 2274 of file tcpipconf_notify.c.

2277{
2278 HPROPSHEETPAGE hpage;
2279
2281 if (!hpage)
2282 return;
2283
2284 SendMessageW(hDlg, PSM_INSERTPAGE, 1, (LPARAM)hpage);
2285}
#define NULL
Definition: types.h:112
#define IDD_TCPIP_ALTCF_DLG
Definition: resource.h:9
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)
LONG_PTR LPARAM
Definition: windef.h:208
#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 338 of file tcpipconf_notify.c.

343{
345
346 Port.MaxNum = MaxItem;
347 Port.hDlgCtrl = hDlgCtrl;
348 Port.ResId = ResId;
349
351}
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 2534 of file tcpipconf_notify.c.

2539{
2540 IP_ADDR_STRING * pCurrent;
2541 IP_ADDR *pNew, *pLast;
2542
2543 pCurrent = pSrc;
2544 pLast = NULL;
2545
2546 while(pCurrent)
2547 {
2548 pNew = CoTaskMemAlloc(sizeof(IP_ADDR));
2549 if (!pNew)
2550 {
2551 break;
2552 }
2553 ZeroMemory(pNew, sizeof(IP_ADDR));
2555 if (!pNew->IpAddress)
2556 {
2557 CoTaskMemFree(pNew);
2558 return E_FAIL;
2559 }
2560
2561 if (Type == SUBMASK)
2562 {
2564 pNew->NTEContext = pCurrent->Context;
2565 }
2566 else if (Type == METRIC)
2567 {
2568 if (szMetric && szMetric[0] != L'\0')
2569 {
2570 pNew->u.Metric = _wtoi(szMetric);
2571 szMetric += wcslen(szMetric) + 1;
2572 }
2573 }
2574
2575 if (!pLast)
2576 *pTarget = pNew;
2577 else
2578 pLast->Next = pNew;
2579
2580 pLast = pNew;
2581 pCurrent = pCurrent->Next;
2582
2583 }
2584 pLast->Next = NULL;
2585 return S_OK;
2586}
Type
Definition: Type.h:7
#define E_FAIL
Definition: ddrawi.h:102
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
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define S_OK
Definition: intsafe.h:52
#define L(x)
Definition: ntvdm.h:50
char String[4 *4]
Definition: iptypes.h:42
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
IP_MASK_STRING IpMask
Definition: iptypes.h:48
DWORD Context
Definition: iptypes.h:49
union tagIP_ADDR::@524 u
struct tagIP_ADDR * Next
UINT GetIpAddressFromStringA(char *sBuffer)
#define ZeroMemory
Definition: winbase.h:1712

Referenced by Initialize().

◆ CreateFilterList()

LPWSTR CreateFilterList ( HWND  hDlgCtrl,
LPDWORD  Size 
)

Definition at line 266 of file tcpipconf_notify.c.

269{
270 INT iCount, iIndex;
271 LVITEMW li;
274 WCHAR szBuffer[10];
275
276 iCount = ListView_GetItemCount(hDlgCtrl);
277 if (!iCount)
278 {
279 pData = (LPWSTR)CoTaskMemAlloc(3 * sizeof(WCHAR));
280 if (!pData)
281 return NULL;
282 pData[0] = L'0';
283 pData[1] = L'\0';
284 pData[2] = L'\0';
285 *Size = 3 * sizeof(WCHAR);
286 return pData;
287 }
288
289 pData = CoTaskMemAlloc((6 * iCount + 1) * sizeof(WCHAR));
290 if (!pData)
291 return NULL;
292
293 pCur = pData;
294 dwSize = 0;
295 for(iIndex = 0; iIndex < iCount; iIndex++)
296 {
297 ZeroMemory(&li, sizeof(LVITEMW));
298 li.mask = LVIF_TEXT;
299 li.iItem = iIndex;
300 li.pszText = szBuffer;
301 li.cchTextMax = sizeof(szBuffer) /sizeof(WCHAR);
302 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
303 {
304 wcscpy(pCur, szBuffer);
305 dwSize += wcslen(szBuffer) + 1;
306 pCur += wcslen(szBuffer) + 1;
307 }
308 }
309 pCur[0] = L'\0';
310 *Size = (dwSize+1) * sizeof(WCHAR);
311 return pData;
312}
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:2307
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVM_GETITEMW
Definition: commctrl.h:2390
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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:4533
__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 3207 of file tcpipconf_notify.c.

3208{
3209 LPWSTR pStr, pRet;
3210 DWORD dwSize, dwIpAddr;
3211 WCHAR szBuffer[30];
3212 IP_ADDR *pTemp = pAddr;
3213
3214
3215 dwSize = 0;
3216 while(pTemp)
3217 {
3218 if (Type == IPADDR)
3219 {
3220 dwIpAddr = pTemp->IpAddress;
3221 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3222 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3223 }else if (Type == SUBMASK)
3224 {
3225 dwIpAddr = pTemp->u.Subnetmask;
3226 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3227 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3228 }
3229 else if (Type == METRIC)
3230 {
3231 swprintf(szBuffer, L"%u", pTemp->u.Metric);
3232 }
3233
3234 dwSize += wcslen(szBuffer) + 1;
3235 pTemp = pTemp->Next;
3236 }
3237
3238 if (!dwSize)
3239 return NULL;
3240
3241 pStr = pRet = CoTaskMemAlloc((dwSize+1) * sizeof(WCHAR));
3242 if(!pStr)
3243 return NULL;
3244
3245 pTemp = pAddr;
3246 while(pTemp)
3247 {
3248 if (Type == IPADDR)
3249 {
3250 dwIpAddr = pTemp->IpAddress;
3251 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3252 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3253 }else if (Type == SUBMASK)
3254 {
3255 dwIpAddr = pTemp->u.Subnetmask;
3256 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3257 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3258 }
3259 else if (Type == METRIC)
3260 {
3261 swprintf(pStr, L"%u", pTemp->u.Metric);
3262 }
3263
3264 if (bComma)
3265 {
3266 pStr += wcslen(pStr);
3267 if (pTemp->Next)
3268 {
3269 pStr[0] = L',';
3270 pStr++;
3271 }
3272 }
3273 else
3274 {
3275 pStr += wcslen(pStr) + 1;
3276 }
3277 pTemp = pTemp->Next;
3278 }
3279 pStr[0] = L'\0';
3280 *Size = (dwSize+1) * sizeof(WCHAR);
3281 return pRet;
3282}
#define swprintf
Definition: precomp.h:40
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER pAddr
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4491
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4488
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4489
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4490

Referenced by INetCfgComponentControl_fnApplyRegistryChanges().

◆ DeleteItemFromList()

VOID DeleteItemFromList ( HWND  hDlgCtrl)

Definition at line 1116 of file tcpipconf_notify.c.

1117{
1118 LVITEMW li;
1119
1120 memset(&li, 0x0, sizeof(LVITEMW));
1121 li.iItem = GetSelectedItem(hDlgCtrl);
1122 if (li.iItem < 0)
1123 {
1125 SetFocus(hDlgCtrl);
1126 }
1127 else
1128 {
1129 (void)ListView_DeleteItem(hDlgCtrl, li.iItem);
1130 }
1131}
#define IDS_NOITEMSEL
Definition: resource.h:109
#define IDS_TCPIP
Definition: resource.h:110
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2411
#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:802

Referenced by TcpipAdvancedIpDlg().

◆ DelItem()

static VOID DelItem ( HWND  hDlgCtrl)
static

Definition at line 355 of file tcpipconf_notify.c.

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

Referenced by TcpipFilterSettingsDlg().

◆ DisplayError()

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

Definition at line 129 of file tcpipconf_notify.c.

130{
131 WCHAR szBuffer[300];
132 WCHAR szTitle[100];
133
134 if (LoadStringW(netcfgx_hInstance, ResTxt, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
135 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
136 else
137 szBuffer[0] = L'\0';
138
139 if (LoadStringW(netcfgx_hInstance, ResTitle, szTitle, sizeof(szTitle)/sizeof(WCHAR)))
140 szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = L'\0';
141 else
142 szTitle[0] = L'\0';
143
144 MessageBoxW(NULL, szBuffer, szTitle, Type);
145}
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
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 1174 of file tcpipconf_notify.c.

1175{
1176 IP_ADDR *pNext;
1177
1178 if (!pAddr)
1179 return;
1180
1181 while(pAddr)
1182 {
1183 pNext = pAddr->Next;
1185 pAddr = pNext;
1186 }
1187}

Referenced by StoreDNSSettings(), and TcpipAdvancedIpDlg().

◆ GetGWListEntry()

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

Definition at line 842 of file tcpipconf_notify.c.

843{
844 LVITEMW li;
845 WCHAR szBuffer[30];
846 BOOL bRet;
847
848 ZeroMemory(&li, sizeof(LVITEMW));
849 li.mask = LVIF_TEXT;
850 li.cchTextMax = 16;
851 li.pszText = pGwSettings->szIP;
852 li.iItem = Index;
853
854 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
855 return FALSE;
856 li.pszText = szBuffer;
857 li.cchTextMax = 30;
858 li.iSubItem = 1;
859
860 bRet = SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
861 if (bRet)
862 {
863 pGwSettings->Metric = _wtoi(szBuffer);
864 }
865
866 return bRet;
867}
#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 1159 of file tcpipconf_notify.c.

1161{
1162 WCHAR szIp[16];
1163
1164 if (MultiByteToWideChar(CP_ACP, 0, sBuffer, -1, szIp, 16))
1165 {
1166 szIp[15] = L'\0';
1167 return GetIpAddressFromStringW(szIp);
1168 }
1169 return (UINT)-1;
1170}
#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 1134 of file tcpipconf_notify.c.

1136{
1137 DWORD dwIpAddr = 0;
1138 INT Val;
1139 UINT Index = 3;
1140 LPWSTR pLast = szBuffer;
1141 LPWSTR pNext = szBuffer;
1142
1143
1144 while((pNext = wcschr(pNext, L'.')))
1145 {
1146 pNext[0] = L'\0';
1147 Val = _wtoi(pLast);
1148 dwIpAddr |= (Val << Index * 8);
1149 Index--;
1150 pNext++;
1151 pLast = pNext;
1152 }
1153 dwIpAddr |= _wtoi(pLast);
1154
1155 return dwIpAddr;
1156}
#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 1092 of file tcpipconf_notify.c.

1093{
1094 LVITEMW li;
1095
1096 ZeroMemory(&li, sizeof(LVITEMW));
1097 li.mask = LVIF_TEXT;
1098 li.cchTextMax = 16;
1099 li.pszText = pIpSettings->szIP;
1100 li.iItem = Index;
1101
1102 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1103 return FALSE;
1104
1105 ZeroMemory(&li, sizeof(LVITEMW));
1106 li.mask = LVIF_TEXT;
1107 li.cchTextMax = 16;
1108 li.pszText = pIpSettings->szMask;
1109 li.iSubItem = 1;
1110 li.iItem = Index;
1111
1112 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1113}

Referenced by TcpipAdvancedIpDlg().

◆ GetListViewEntries()

LPWSTR GetListViewEntries ( HWND  hDlgCtrl)

Definition at line 1714 of file tcpipconf_notify.c.

1716{
1717 DWORD dwSize;
1718 INT iCount, iIndex;
1719 INT_PTR lResult;
1720 LPWSTR pszSearchList, pItem;
1721
1722 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1723 if (!iCount || iCount == LB_ERR)
1724 return NULL; //BUGBUG
1725
1726 dwSize = 0;
1727
1728 for (iIndex = 0; iIndex < iCount; iIndex++)
1729 {
1730 lResult = SendMessageW(hDlgCtrl, LB_GETTEXTLEN, iIndex, 0);
1731 if (lResult == LB_ERR)
1732 return NULL;
1733
1734 dwSize += lResult + 1;
1735 }
1736
1737 pszSearchList = (LPWSTR)CoTaskMemAlloc((dwSize + 1) * sizeof(WCHAR));
1738 if (!pszSearchList)
1739 return NULL;
1740
1741 pItem = pszSearchList;
1742 for (iIndex = 0; iIndex < iCount; iIndex++)
1743 {
1744 lResult = SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)pItem);
1745 if (lResult == LB_ERR)
1746 {
1747 CoTaskMemFree(pszSearchList);
1748 return NULL;
1749 }
1750 dwSize -= lResult + 1;
1751 pItem += wcslen(pItem);
1752 if (iIndex != iCount -1)
1753 {
1754 pItem[0] = L',';
1755 pItem++;
1756 }
1757 }
1758 pItem[0] = L'\0';
1759 return pszSearchList;
1760}
int32_t INT_PTR
Definition: typedefs.h:64
#define LB_ERR
Definition: winuser.h:2432
#define LB_GETCOUNT
Definition: winuser.h:2038
#define LB_GETTEXT
Definition: winuser.h:2049
#define LB_GETTEXTLEN
Definition: winuser.h:2050

Referenced by TcpipAdvancedDnsDlg().

◆ GetListViewItem()

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

Definition at line 1190 of file tcpipconf_notify.c.

1191{
1192 LVITEMW li;
1193
1194 ZeroMemory(&li, sizeof(LVITEMW));
1195 li.mask = LVIF_TEXT;
1196 li.pszText = szBuffer;
1197 li.iItem = Index;
1198 li.iSubItem = SubIndex;
1199 li.cchTextMax = BufferSize;
1200 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1201}
#define BufferSize
Definition: mmc.h:75

Referenced by StoreIPSettings().

◆ GetSelectedItem()

INT GetSelectedItem ( HWND  hDlgCtrl)

Definition at line 1066 of file tcpipconf_notify.c.

1067{
1068 LVITEMW li;
1069 UINT iItemCount, iIndex;
1070
1071 iItemCount = ListView_GetItemCount(hDlgCtrl);
1072 if (!iItemCount)
1073 return -1;
1074
1075 for (iIndex = 0; iIndex < iItemCount; iIndex++)
1076 {
1077 ZeroMemory(&li, sizeof(LVITEMW));
1078 li.mask = LVIF_STATE;
1079 li.stateMask = (UINT)-1;
1080 li.iItem = iIndex;
1081 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1082 {
1083 if (li.state & LVIS_SELECTED)
1084 return iIndex;
1085 }
1086 }
1087 return -1;
1088}
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVIS_SELECTED
Definition: commctrl.h:2319

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 3173 of file tcpipconf_notify.c.

3175{
3177 return INetCfgComponentPropertyUi_AddRef((INetCfgComponentPropertyUi*)This);
3178}
#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 3523 of file tcpipconf_notify.c.

3526{
3527 //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyPnpChanges", NULL, MB_OK);
3528 return S_OK;
3529}

◆ INetCfgComponentControl_fnApplyRegistryChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges ( INetCfgComponentControl *  iface)

Definition at line 3287 of file tcpipconf_notify.c.

3289{
3290 HKEY hKey;
3291 LPOLESTR pStr;
3292 DWORD dwSize;
3293 WCHAR szBuffer[200];
3294 TcpipSettings * pCurrentConfig, *pOldConfig;
3295 ULONG NTEInstance;
3296 DWORD DhcpApiVersion;
3297
3299
3300 pCurrentConfig = This->pCurrentConfig;
3301 This->pCurrentConfig = NULL;
3302
3303 if (FAILED(Initialize(This)))
3304 {
3305 This->pCurrentConfig = pCurrentConfig;
3306 return E_FAIL;
3307 }
3308 pOldConfig = This->pCurrentConfig;
3309 This->pCurrentConfig = pCurrentConfig;
3310
3311 //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyRegistryChanges", NULL, MB_OK);
3312
3313
3314 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3315 {
3316 if (pCurrentConfig->pDNS)
3317 {
3318 RegSetValueExW(hKey, L"UseDomainNameDevolution", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->pDNS->UseDomainNameDevolution, sizeof(DWORD));
3319 RegSetValueExW(hKey, L"SearchList", 0, REG_SZ, (LPBYTE)pCurrentConfig->pDNS->szSearchList,
3320 (wcslen(pCurrentConfig->pDNS->szSearchList)+1) * sizeof(WCHAR));
3321 }
3322 if (pCurrentConfig->pFilter)
3323 {
3324 RegSetValueExW(hKey, L"EnableSecurityFilters", 0, REG_DWORD,
3325 (LPBYTE)&pCurrentConfig->pFilter->EnableSecurityFilters, sizeof(DWORD));
3326 }
3328 }
3329
3330 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
3331 return E_FAIL;
3332
3333 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
3334 CoTaskMemFree(pStr);
3335
3337 {
3338 if (pCurrentConfig->pDNS)
3339 {
3340 RegSetValueExW(hKey, L"RegisterAdapterName", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, sizeof(DWORD));
3341 RegSetValueExW(hKey, L"RegistrationEnabled", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, sizeof(DWORD));
3342 RegSetValueExW(hKey, L"Domain", 0, REG_SZ, (LPBYTE)This->pCurrentConfig->pDNS->szDomain,
3343 (wcslen(This->pCurrentConfig->pDNS->szDomain)+1) * sizeof(WCHAR));
3344 }
3345#if 0
3346 if (pCurrentConfig->pFilter)
3347 {
3348 if (pCurrentConfig->pFilter->szTCPAllowedPorts)
3349 {
3350 RegSetValueExW(hKey, L"TCPAllowedPorts", 0, REG_MULTI_SZ,
3351 (LPBYTE)pCurrentConfig->pFilter->szTCPAllowedPorts,
3352 pCurrentConfig->pFilter->TCPSize);
3353 }
3354 if (pCurrentConfig->pFilter->szUDPAllowedPorts)
3355 {
3356 RegSetValueExW(hKey, L"UDPAllowedPorts", 0, REG_MULTI_SZ,
3357 (LPBYTE)pCurrentConfig->pFilter->szUDPAllowedPorts,
3358 pCurrentConfig->pFilter->UDPSize);
3359 }
3360 if (pCurrentConfig->pFilter->szRawIPAllowedProtocols)
3361 {
3362 RegSetValueExW(hKey, L"RawIPAllowedProtocols", 0, REG_MULTI_SZ,
3363 (LPBYTE)pCurrentConfig->pFilter->szRawIPAllowedProtocols,
3364 pCurrentConfig->pFilter->IPSize);
3365 }
3366 }
3367#endif
3368 RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->DhcpEnabled, sizeof(DWORD));
3369 if (pCurrentConfig->DhcpEnabled)
3370 {
3371 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3372 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3373 if (!pOldConfig->DhcpEnabled)
3374 {
3375 /* Delete this adapter's current IP address */
3376 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3377
3378 /* Delete all default routes for this adapter */
3379 dwSize = 0;
3381 {
3382 DWORD Index;
3384 if (pIpForwardTable)
3385 {
3386 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3387 {
3388 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3389 {
3390 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3391 pIpForwardTable->table[Index].dwForwardDest == 0)
3392 {
3393 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3394 }
3395 }
3396 }
3397 CoTaskMemFree(pIpForwardTable);
3398 }
3399 }
3400 }
3401 }
3402 else
3403 {
3404 /* Open the DHCP API if DHCP is enabled */
3405 if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR)
3406 {
3407 /* We have to tell DHCP about this */
3408 DhcpStaticRefreshParams(pCurrentConfig->Index,
3409 htonl(pCurrentConfig->Ip->IpAddress),
3410 htonl(pCurrentConfig->Ip->u.Subnetmask));
3411
3412 /* Close the API */
3414 }
3415 else
3416 {
3417 /* Delete this adapter's current static IP address */
3418 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3419
3420 /* Add the static IP address via the standard IPHLPAPI function */
3421 AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress),
3422 htonl(pCurrentConfig->Ip->u.Subnetmask),
3423 pCurrentConfig->Index,
3424 &pCurrentConfig->Ip->NTEContext,
3425 &NTEInstance);
3426 }
3427
3428 pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE);
3429 if(pStr)
3430 {
3431 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3432 CoTaskMemFree(pStr);
3433 }
3434
3435 pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE);
3436 if(pStr)
3437 {
3438 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3439 CoTaskMemFree(pStr);
3440 }
3441
3442 /* Delete all default routes for this adapter */
3443 dwSize = 0;
3445 {
3446 DWORD Index;
3448 if (pIpForwardTable)
3449 {
3450 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3451 {
3452 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3453 {
3454 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3455 pIpForwardTable->table[Index].dwForwardDest == 0)
3456 {
3457 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3458 }
3459 }
3460 }
3461 CoTaskMemFree(pIpForwardTable);
3462 }
3463 }
3464 }
3465
3466 if (pCurrentConfig->Gw)
3467 {
3468 MIB_IPFORWARDROW RouterMib;
3469 ZeroMemory(&RouterMib, sizeof(MIB_IPFORWARDROW));
3470
3471 RouterMib.dwForwardMetric1 = 1;
3472 RouterMib.dwForwardIfIndex = pOldConfig->Index;
3473 RouterMib.dwForwardNextHop = htonl(pCurrentConfig->Gw->IpAddress);
3474
3475 //TODO
3476 // add multiple gw addresses when required
3477
3478 if (CreateIpForwardEntry(&RouterMib) == NO_ERROR)
3479 {
3480 pStr = CreateMultiSzString(pCurrentConfig->Gw, IPADDR, &dwSize, FALSE);
3481 if(pStr)
3482 {
3483 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3484 CoTaskMemFree(pStr);
3485 }
3486
3487 pStr = CreateMultiSzString(pCurrentConfig->Gw, METRIC, &dwSize, FALSE);
3488 if(pStr)
3489 {
3490 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3491 CoTaskMemFree(pStr);
3492 }
3493 }
3494 }
3495 else
3496 {
3497 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"", 1 * sizeof(WCHAR));
3498 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", sizeof(WCHAR) * 2);
3499 }
3500
3501 if (!pCurrentConfig->Ns || pCurrentConfig->AutoconfigActive)
3502 {
3503 RegDeleteValueW(hKey, L"NameServer");
3504 }
3505 else
3506 {
3507 pStr = CreateMultiSzString(pCurrentConfig->Ns, IPADDR, &dwSize, TRUE);
3508 if(pStr)
3509 {
3510 RegSetValueExW(hKey, L"NameServer", 0, REG_SZ, (LPBYTE)pStr, dwSize);
3511 //RegDeleteValueW(hKey, L"DhcpNameServer");
3512 CoTaskMemFree(pStr);
3513 }
3514 }
3515
3517 }
3518 return S_OK;
3519}
#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
void WINAPI DhcpCApiCleanup(void)
Definition: dhcpcsvc.c:71
DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version)
Definition: dhcpcsvc.c:26
DWORD APIENTRY DhcpStaticRefreshParams(DWORD AdapterIndex, DWORD Address, DWORD Netmask)
Definition: dhcpcsvc.c:191
#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:1501
#define KEY_WRITE
Definition: nt_native.h:1031
#define REG_DWORD
Definition: sdbapi.c:596
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 3533 of file tcpipconf_notify.c.

3535{
3536 //MessageBoxW(NULL, L"INetCfgComponentControl_fnCancelChanges", NULL, MB_OK);
3537 return S_OK;
3538}

◆ INetCfgComponentControl_fnInitialize()

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

Definition at line 3191 of file tcpipconf_notify.c.

3196{
3198
3199 This->pNCfg = pINetCfg;
3200 This->pNComp = pIComp;
3201
3202 return S_OK;
3203}

◆ INetCfgComponentControl_fnQueryInterface()

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

Definition at line 3162 of file tcpipconf_notify.c.

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

◆ INetCfgComponentControl_fnRelease()

ULONG WINAPI INetCfgComponentControl_fnRelease ( INetCfgComponentControl *  iface)

Definition at line 3182 of file tcpipconf_notify.c.

3184{
3186 return INetCfgComponentPropertyUi_Release((INetCfgComponentPropertyUi*)This);
3187}
#define INetCfgComponentPropertyUi_Release(p)
Definition: netcfgn.h:79

◆ INetCfgComponentPropertyUi_fnAddRef()

ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef ( INetCfgComponentPropertyUi *  iface)

Definition at line 2748 of file tcpipconf_notify.c.

2750{
2752 ULONG refCount = InterlockedIncrement(&This->ref);
2753
2754 return refCount;
2755}
#define InterlockedIncrement
Definition: armddk.h:53

◆ INetCfgComponentPropertyUi_fnApplyProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3126 of file tcpipconf_notify.c.

3128{
3129MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnApplyProperties", NULL, MB_OK);
3130 return S_OK;
3131}
#define MB_OK
Definition: winuser.h:790

◆ INetCfgComponentPropertyUi_fnCancelProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3136 of file tcpipconf_notify.c.

3138{
3139//MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnCancelProperties", NULL, MB_OK);
3140 return S_OK;
3141}

◆ INetCfgComponentPropertyUi_fnMergePropPages()

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

Definition at line 3065 of file tcpipconf_notify.c.

3072{
3073 HPROPSHEETPAGE * hppages;
3074 UINT NumPages;
3075 HRESULT hr;
3077
3078 hr = Initialize(This);
3079 if (FAILED(hr))
3080 return hr;
3081
3082 if (This->pCurrentConfig->DhcpEnabled)
3083 NumPages = 2;
3084 else
3085 NumPages = 1;
3086
3087 hppages = (HPROPSHEETPAGE*) CoTaskMemAlloc(sizeof(HPROPSHEETPAGE) * NumPages);
3088 if (!hppages)
3089 return E_FAIL;
3090
3092 if (!hppages[0])
3093 {
3094 CoTaskMemFree(hppages);
3095 return E_FAIL;
3096 }
3097 if (NumPages == 2)
3098 {
3100 if (!hppages[1])
3101 {
3102 DestroyPropertySheetPage(hppages[0]);
3103 CoTaskMemFree(hppages);
3104 return E_FAIL;
3105 }
3106 }
3107
3108 *pahpspPrivate = (BYTE*)hppages;
3109 *pcPages = NumPages;
3110
3111 return S_OK;
3112}
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3152
#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 2713 of file tcpipconf_notify.c.

2717{
2718 //LPOLESTR pStr;
2720
2721 *ppvObj = NULL;
2722
2723
2724 if (IsEqualIID (iid, &IID_IUnknown) ||
2726 {
2727 *ppvObj = This;
2729 return S_OK;
2730 }
2732 {
2733 *ppvObj = (LPVOID*)&This->lpVtblCompControl;
2735 return S_OK;
2736 }
2737
2738 //StringFromCLSID(iid, &pStr);
2739 //MessageBoxW(NULL, pStr, L"INetConnectionPropertyUi_fnQueryInterface", MB_OK);
2740 //CoTaskMemFree(pStr);
2741
2742 return E_NOINTERFACE;
2743}
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:2364

◆ INetCfgComponentPropertyUi_fnQueryPropertyUi()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2774 of file tcpipconf_notify.c.

2777{
2778 INetLanConnectionUiInfo * pLanInfo;
2779 HRESULT hr;
2781
2782 hr = IUnknown_QueryInterface(pUnkReserved, &IID_INetLanConnectionUiInfo, (LPVOID*)&pLanInfo);
2783 if (FAILED(hr))
2784 return hr;
2785
2786 INetLanConnectionUiInfo_GetDeviceGuid(pLanInfo, &This->NetCfgInstanceId);
2787
2788 //FIXME
2789 // check if tcpip is enabled on that binding */
2790 IUnknown_Release(pUnkReserved);
2791 return S_OK;
2792}
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 2759 of file tcpipconf_notify.c.

2761{
2763 ULONG refCount = InterlockedDecrement(&This->ref);
2764
2765 if (!refCount)
2766 {
2768 }
2769 return refCount;
2770}
#define InterlockedDecrement
Definition: armddk.h:52

◆ INetCfgComponentPropertyUi_fnSetContext()

HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2796 of file tcpipconf_notify.c.

2799{
2801
2802 if (!iface || !pUnkReserved)
2803 return E_POINTER;
2804
2805 This->pUnknown = pUnkReserved;
2806 return S_OK;
2807}
#define E_POINTER
Definition: winerror.h:2365

◆ INetCfgComponentPropertyUi_fnValidateProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties ( INetCfgComponentPropertyUi *  iface,
HWND  hwndDlg 
)

Definition at line 3116 of file tcpipconf_notify.c.

3119{
3120MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnValidateProperties", NULL, MB_OK);
3121 return S_OK;
3122}

◆ InitFilterListBox()

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

Definition at line 231 of file tcpipconf_notify.c.

232{
233 LVITEMW li;
234 LPWSTR pCur;
235 INT iItem;
236
237 if (!pData || !_wtoi(pData))
238 {
239 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
241 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
242 return;
243 }
244
245 pCur = pData;
246 memset(&li, 0x0, sizeof(LVITEMW));
247 li.mask = LVIF_TEXT;
248 iItem = 0;
249
250 while(pCur[0])
251 {
252 li.pszText = pCur;
253 li.iItem = iItem;
254 SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
255 iItem++;
256 pCur += wcslen(pCur) + 1;
257 }
258
259 if (!iItem)
260 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
261 else
262 CheckDlgButton(hwndDlg, RestrictButton, BST_CHECKED);
263}
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
Definition: wordpad.c:155
#define LVM_INSERTITEMW
Definition: commctrl.h:2404
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 2937 of file tcpipconf_notify.c.

2938{
2940 WCHAR szBuffer[50];
2941 IP_ADAPTER_INFO * pCurrentAdapter;
2942 IP_ADAPTER_INFO * pInfo;
2943 PIP_PER_ADAPTER_INFO pPerInfo;
2945 LPOLESTR pStr;
2946 HRESULT hr;
2947 BOOL bFound;
2948 TcpipSettings * pCurSettings;
2949 ULONG uLength;
2950
2951 if (This->pCurrentConfig)
2952 return S_OK;
2953
2954 hr = StringFromCLSID(&This->NetCfgInstanceId, &pStr);
2955 if (FAILED(hr))
2956 return hr;
2957
2958
2959 dwSize = 0;
2961 {
2962 CoTaskMemFree(pStr);
2963 return E_FAIL;
2964 }
2965
2966 pInfo = CoTaskMemAlloc(dwSize);
2967 if (!pInfo)
2968 {
2969 CoTaskMemFree(pStr);
2970 return E_FAIL;
2971 }
2972
2973 if (GetAdaptersInfo(pInfo, &dwSize) != ERROR_SUCCESS)
2974 {
2975 CoTaskMemFree(pStr);
2976 CoTaskMemFree(pInfo);
2977 return E_FAIL;
2978 }
2979
2980 pCurrentAdapter = pInfo;
2981 bFound = FALSE;
2982 while(pCurrentAdapter)
2983 {
2984 szBuffer[0] = L'\0';
2985 if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
2986 {
2987 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2988 }
2989 if (!_wcsicmp(szBuffer, pStr))
2990 {
2991 bFound = TRUE;
2992 break;
2993 }
2994 pCurrentAdapter = pCurrentAdapter->Next;
2995 }
2996 CoTaskMemFree(pStr);
2997
2998 if (!bFound)
2999 {
3000 CoTaskMemFree(pInfo);
3001 return E_FAIL;
3002 }
3003
3004 pCurSettings = CoTaskMemAlloc(sizeof(TcpipSettings));
3005 if (!pCurSettings)
3006 {
3007 CoTaskMemFree(pInfo);
3008 return E_FAIL;
3009 }
3010
3011 ZeroMemory(pCurSettings, sizeof(TcpipSettings));
3012 This->pCurrentConfig = pCurSettings;
3013 pCurSettings->DhcpEnabled = pCurrentAdapter->DhcpEnabled;
3014 pCurSettings->Index = pCurrentAdapter->Index;
3015
3016 if (!pCurrentAdapter->DhcpEnabled)
3017 {
3018 CopyIpAddrString(&pCurrentAdapter->IpAddressList, &pCurSettings->Ip, SUBMASK, NULL);
3019 }
3020
3021 CopyIpAddrString(&pCurrentAdapter->GatewayList, &pCurSettings->Gw, METRIC, NULL);
3022
3023 uLength = sizeof(IP_PER_ADAPTER_INFO);
3025
3026 if (GetPerAdapterInfo(pCurrentAdapter->Index, &Info, &uLength) == ERROR_BUFFER_OVERFLOW)
3027 {
3028 pPerInfo = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(uLength);
3029 if (pPerInfo)
3030 {
3031 Status = GetPerAdapterInfo(pCurrentAdapter->Index, pPerInfo, &uLength);
3032 if (Status == NOERROR)
3033 {
3034 if (!pPerInfo->AutoconfigActive)
3035 {
3036 CopyIpAddrString(&pPerInfo->DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
3037 }
3038 pCurSettings->AutoconfigActive = pPerInfo->AutoconfigActive;
3039 }
3040 CoTaskMemFree(pPerInfo);
3041 }
3042 }
3043 else
3044 {
3045 if (!Info.AutoconfigActive)
3046 {
3047 CopyIpAddrString(&Info.DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
3048 }
3049 pCurSettings->AutoconfigActive = Info.AutoconfigActive;
3050 }
3051
3053 return E_FAIL;
3054
3056 return E_FAIL;
3057
3058 CoTaskMemFree(pInfo);
3059
3060 return S_OK;
3061}
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)
struct _IP_PER_ADAPTER_INFO IP_PER_ADAPTER_INFO
struct _IP_PER_ADAPTER_INFO * PIP_PER_ADAPTER_INFO
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:63
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:55
IP_ADDR_STRING GatewayList
Definition: iptypes.h:64
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:53
UINT DhcpEnabled
Definition: iptypes.h:61
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:77
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:185
#define NOERROR
Definition: winerror.h:2354

◆ InitializePropertySheetPage()

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

Definition at line 514 of file tcpipconf_notify.c.

515{
516 PROPSHEETPAGEW ppage;
517
518 memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW));
519 ppage.dwSize = sizeof(PROPSHEETPAGEW);
520 ppage.dwFlags = PSP_DEFAULT;
521 ppage.u.pszTemplate = resname;
522 ppage.pfnDlgProc = dlgproc;
523 ppage.lParam = lParam;
525 if (szTitle)
526 {
527 ppage.dwFlags |= PSP_USETITLE;
528 ppage.pszTitle = szTitle;
529 }
530 return CreatePropertySheetPageW(&ppage);
531}
LPARAM lParam
Definition: combotst.c:139
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3083
#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 1565 of file tcpipconf_notify.c.

1568{
1569 WCHAR szBuffer[200];
1570 LPWSTR pFirst, pSep, pList;
1571 IP_ADDR * pAddr;
1572 DWORD dwIpAddr;
1573
1574 /* insert DNS addresses */
1575 pAddr = This->pCurrentConfig->Ns;
1576 while(pAddr)
1577 {
1578 dwIpAddr = pAddr->IpAddress;
1579 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1580 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1581
1582 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_ADDSTRING, 0, (LPARAM)szBuffer);
1583 pAddr = pAddr->Next;
1584 }
1586
1587 if (!This->pCurrentConfig->pDNS)
1588 return;
1589
1590 if (This->pCurrentConfig->pDNS->RegisterAdapterName)
1592 else
1594
1595 if (This->pCurrentConfig->pDNS->RegistrationEnabled)
1597
1598 if (This->pCurrentConfig->pDNS->szDomain[0])
1599 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)szBuffer);
1600
1601 if (This->pCurrentConfig->pDNS->UseDomainNameDevolution)
1603
1604 if (!This->pCurrentConfig->pDNS->szSearchList || (wcslen(This->pCurrentConfig->pDNS->szSearchList) == 0))
1605 {
1608
1609 return;
1610 }
1611
1612 pList = This->pCurrentConfig->pDNS->szSearchList;
1613 if (wcslen(pList))
1614 {
1615 pFirst = pList;
1616 do
1617 {
1618 pSep = wcschr(pFirst, L',');
1619 if (pSep)
1620 {
1621 pSep[0] = L'\0';
1623 pFirst = pSep + 1;
1624 pSep[0] = L',';
1625 }
1626 else
1627 {
1629 break;
1630 }
1631 }while(TRUE);
1632
1636 }
1637}
#define IDC_DNSSUFFIXLIST
Definition: resource.h:57
#define IDC_SUFFIX
Definition: resource.h:63
#define IDC_USESUFFIX
Definition: resource.h:65
#define IDC_REGSUFFIX
Definition: resource.h:64
#define IDC_PRIMSUFFIX
Definition: resource.h:54
#define IDC_SELSUFFIX
Definition: resource.h:56
#define IDC_DNSADDRLIST
Definition: resource.h:48
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:55
#define IDC_DNSSUFFIXADD
Definition: resource.h:60
FxChildList * pList
#define LB_ADDSTRING
Definition: winuser.h:2031
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1617
#define LB_SETCURSEL
Definition: winuser.h:2063

Referenced by TcpipAdvancedDnsDlg().

◆ InitializeTcpipAdvancedIpDlg()

VOID InitializeTcpipAdvancedIpDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 670 of file tcpipconf_notify.c.

673{
674 RECT rect;
675 LVITEMW li;
676 WCHAR szBuffer[100];
677
680 InsertColumnToListView(GetDlgItem(hwndDlg, IDC_IPLIST), IDS_SUBMASK, 1, (rect.right - rect.left - 100));
681
682 if (This->pCurrentConfig->DhcpEnabled)
683 {
684 if (LoadStringW(netcfgx_hInstance, IDS_DHCPACTIVE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
685 {
686 ZeroMemory(&li, sizeof(LVITEMW));
687 li.mask = LVIF_TEXT;
688 li.pszText = szBuffer;
690 }
692 }
693 else
694 {
695 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_IPLIST), This->pCurrentConfig->Ip, TRUE);
696 }
697
700
703 InsertColumnToListView(GetDlgItem(hwndDlg, IDC_GWLIST), IDS_METRIC, 1, (rect.right - rect.left - 100));
704
705 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_GWLIST), This->pCurrentConfig->Gw, FALSE);
706
709
711}
#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:104
#define IDC_IPLIST
Definition: resource.h:34
#define IDC_GWMOD
Definition: resource.h:40
#define IDC_METRIC
Definition: resource.h:43
#define IDS_DHCPACTIVE
Definition: resource.h:107
#define IDS_GATEWAY
Definition: resource.h:105
#define IDC_IPADD
Definition: resource.h:35
#define IDC_IPMOD
Definition: resource.h:36
#define IDS_IPADDR
Definition: resource.h:103
#define IDC_GWLIST
Definition: resource.h:38
& rect
Definition: startmenu.cpp:1413
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:2000
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by TcpipAdvancedIpDlg().

◆ InitializeTcpipAdvancedOptDlg()

VOID InitializeTcpipAdvancedOptDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 539 of file tcpipconf_notify.c.

542{
543 WCHAR szText[500];
544 /* store context */
546
547 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTER, szText, sizeof(szText)/sizeof(WCHAR)))
548 {
549 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
550 if (SendDlgItemMessageW(hwndDlg, IDC_OPTLIST, LB_ADDSTRING, 0, (LPARAM)szText) != LB_ERR)
552 }
553
554 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTERDESC, szText, sizeof(szText)/sizeof(WCHAR)))
555 {
556 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
557 SendDlgItemMessageW(hwndDlg, IDC_OPTDESC, WM_SETTEXT, 0, (LPARAM)szText);
558 }
559}
#define IDS_TCPFILTERDESC
Definition: resource.h:101
#define IDC_OPTLIST
Definition: resource.h:67
#define IDS_TCPFILTER
Definition: resource.h:102
#define IDC_OPTDESC
Definition: resource.h:69
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_USER
Definition: winuser.h:872

Referenced by TcpipAdvancedOptDlg().

◆ InitializeTcpipAltDlgCtrls()

HRESULT InitializeTcpipAltDlgCtrls ( HWND  hwndDlg,
TcpipSettings pCurSettings 
)

Definition at line 2140 of file tcpipconf_notify.c.

2143{
2148
2153
2158
2163
2168
2169 if (pCurSettings->DhcpEnabled)
2170 {
2177 }
2178 else
2179 {
2183
2184 if (pCurSettings->Ip)
2185 {
2186 /* Set current ip address */
2187 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2188 /* Set current hostmask */
2189 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2190 }
2191 }
2192
2193 if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2194 {
2195 /* Set current gateway */
2196 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2197 }
2198
2199 if (pCurSettings->Ns)
2200 {
2201 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2202 if (pCurSettings->Ns->Next)
2203 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2204 else
2206 }
2207 else
2208 {
2211 }
2212
2213 return S_OK;
2214}
#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:4484
#define IPM_SETADDRESS
Definition: commctrl.h:4466
#define IPM_CLEARADDRESS
Definition: commctrl.h:4465
#define IPM_SETRANGE
Definition: commctrl.h:4468
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 2444 of file tcpipconf_notify.c.

2447{
2452
2457
2462
2467
2472
2473 if (pCurSettings->DhcpEnabled)
2474 {
2480 }
2481 else
2482 {
2484
2485 if (pCurSettings->Ip)
2486 {
2487 /* set current ip address */
2488 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2489 /* set current hostmask */
2490 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2491 }
2492 }
2493
2494 if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2495 {
2496 /* set current gateway */
2497 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2498 }
2499
2500 if (pCurSettings->AutoconfigActive)
2501 {
2505 }
2506 else
2507 {
2511 if (pCurSettings->Ns)
2512 {
2513 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2514 if (pCurSettings->Ns->Next)
2515 {
2516 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2517 }
2518 else
2519 {
2521 }
2522 }
2523 else
2524 {
2527 }
2528 }
2529
2530 return S_OK;
2531}
#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 597 of file tcpipconf_notify.c.

602{
603 WCHAR szBuffer[200];
604 LVCOLUMNW lc;
605
606 if (!LoadStringW(netcfgx_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
607 return;
608
609 memset(&lc, 0, sizeof(LV_COLUMN) );
611 lc.iSubItem = SubItem;
612 lc.fmt = LVCFMT_FIXED_WIDTH;
613 lc.cx = Size;
614 lc.cchTextMax = wcslen(szBuffer);
615 lc.pszText = szBuffer;
616
617 (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, SubItem, (LPARAM)&lc);
618}
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2632
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LV_COLUMN
Definition: commctrl.h:2547
int cchTextMax
Definition: commctrl.h:2568
LPWSTR pszText
Definition: commctrl.h:2567

Referenced by InitializeTcpipAdvancedIpDlg(), and TcpipFilterSettingsDlg().

◆ InsertIpAddressToListView()

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

Definition at line 621 of file tcpipconf_notify.c.

625{
626 WCHAR szBuffer[70];
627 DWORD dwIpAddr;
628 UINT itemCount = 0;
629 LVITEMW li;
630
631 while(pAddr)
632 {
633 ZeroMemory(&li, sizeof(li));
634 li.mask = LVIF_TEXT;
635 li.iItem = itemCount;
636 li.iSubItem = 0;
637 dwIpAddr = pAddr->IpAddress;
638 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
639 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
640
641 li.pszText = szBuffer;
642 li.iItem = SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
643 if (li.iItem != -1)
644 {
645 if (bSubMask)
646 {
647 dwIpAddr = pAddr->u.Subnetmask;
648 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
649 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
650 }
651 else
652 {
653 if (pAddr->u.Metric)
654 swprintf(szBuffer, L"%u", pAddr->u.Metric);
655 else
656 LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
657 }
658
659 li.mask = LVIF_TEXT;
660 li.iSubItem = 1;
661 li.pszText = szBuffer;
662 SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
663 }
664 itemCount++;
665 pAddr = pAddr->Next;
666 }
667}
#define IDS_AUTOMATIC
Definition: resource.h:108
#define LVM_SETITEMW
Definition: commctrl.h:2397

Referenced by InitializeTcpipAdvancedIpDlg().

◆ LaunchAdvancedTcpipSettings()

VOID LaunchAdvancedTcpipSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2101 of file tcpipconf_notify.c.

2104{
2105 PROPSHEETHEADERW pinfo;
2106 HPROPSHEETPAGE hppages[3];
2107 WCHAR szBuffer[100];
2108
2112
2113
2114 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
2115 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2116 else
2117 szBuffer[0] = L'\0';
2118
2119 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
2120 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
2121 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
2123 pinfo.u3.phpage = hppages;
2124 pinfo.nPages = 3;
2125 pinfo.hwndParent = hwndDlg;
2127 pinfo.pszCaption = szBuffer;
2129 pinfo.pfnCallback = PropSheetProc;
2130
2132 if (PropertySheetW(&pinfo) > 0)
2133 {
2134 InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2135 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2136 }
2137}
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2913
#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 2810 of file tcpipconf_notify.c.

2812{
2813 LPOLESTR pStr;
2814 WCHAR szBuffer[200];
2815 HKEY hKey;
2816 DWORD dwSize;
2817
2818
2820 if (!This->pCurrentConfig->pDNS)
2821 return E_FAIL;
2822
2823 ZeroMemory(This->pCurrentConfig->pDNS, sizeof(TcpipAdvancedDNSDlgSettings));
2824
2825 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2826 return E_FAIL;
2827
2828 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2829 CoTaskMemFree(pStr);
2831 {
2832 dwSize = sizeof(DWORD);
2833 RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, &dwSize);
2834
2835 dwSize = sizeof(DWORD);
2836 RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, &dwSize);
2837
2838 dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain);
2839 RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szDomain, &dwSize);
2840
2842 }
2843
2844 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2845 {
2846 dwSize = sizeof(DWORD);
2847 RegQueryValueExW(hKey, L"UseDomainNameDevolution", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->UseDomainNameDevolution, &dwSize);
2848
2849 dwSize = 0;
2850 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, NULL, &dwSize) == ERROR_SUCCESS)
2851 {
2852 This->pCurrentConfig->pDNS->szSearchList = (LPWSTR)CoTaskMemAlloc(dwSize);
2853 if (This->pCurrentConfig->pDNS->szSearchList)
2854 {
2855 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szSearchList, &dwSize) != ERROR_SUCCESS)
2856 {
2857 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
2858 This->pCurrentConfig->pDNS->szSearchList = NULL;
2859 }
2860 }
2861 }
2863 }
2864 return S_OK;
2865}
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:1023
#define DWORD
Definition: nt_native.h:44

Referenced by Initialize().

◆ LoadFilterSettings()

HRESULT LoadFilterSettings ( TcpipConfNotifyImpl This)

Definition at line 2890 of file tcpipconf_notify.c.

2892{
2893 HKEY hKey;
2894 TcpFilterSettings *pFilter;
2895 WCHAR szBuffer[200];
2896 LPOLESTR pStr;
2897 DWORD dwVal, dwSize;
2898
2900 if (!pFilter)
2901 return E_FAIL;
2902
2903 ZeroMemory(pFilter, sizeof(TcpFilterSettings));
2904 This->pCurrentConfig->pFilter = pFilter;
2905
2906
2907 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2908 {
2909 dwSize = sizeof(DWORD);
2910 if (RegQueryValueExW(hKey, L"EnableSecurityFilters", NULL, NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
2911 pFilter->EnableSecurityFilters = dwVal;
2913 }
2914 else
2915 {
2916 pFilter->EnableSecurityFilters = FALSE;
2917 }
2918
2919 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2920 return E_FAIL;
2921
2922 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2923 CoTaskMemFree(pStr);
2925 {
2926 return S_OK;
2927 }
2928 pFilter->szTCPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"TCPAllowedPorts", &pFilter->TCPSize);
2929 pFilter->szUDPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"UDPAllowedPorts", &pFilter->UDPSize);
2930 pFilter->szRawIPAllowedProtocols = LoadTcpFilterSettingsFromRegistry(hKey, L"RawIPAllowedProtocols", &pFilter->IPSize);
2932 return S_OK;
2933}
LPWSTR LoadTcpFilterSettingsFromRegistry(HKEY hKey, LPCWSTR szName, LPDWORD Size)

Referenced by Initialize().

◆ LoadTcpFilterSettingsFromRegistry()

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

Definition at line 2868 of file tcpipconf_notify.c.

2869{
2870 DWORD dwSize;
2871 LPWSTR pData;
2872
2874 return NULL;
2875
2877 if (!pData)
2878 return NULL;
2879
2881 {
2883 return NULL;
2884 }
2885 *Size = dwSize;
2886 return pData;
2887}
static const WCHAR szName[]
Definition: powrprof.c:45

Referenced by LoadFilterSettings().

◆ MoveItem()

VOID MoveItem ( HWND  hDlgCtrl,
INT  pos 
)

Definition at line 1674 of file tcpipconf_notify.c.

1677{
1678 WCHAR szBuffer[100];
1679 LRESULT lResult;
1680
1681 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1682 if (lResult != LB_ERR)
1683 {
1684 if (SendMessageW(hDlgCtrl, LB_GETTEXTLEN, (WPARAM)lResult, 0) < sizeof(szBuffer)/sizeof(WCHAR) - 1)
1685 {
1686 if (SendMessageW(hDlgCtrl, LB_GETTEXT, (WPARAM)lResult, (LPARAM)szBuffer) != LB_ERR)
1687 {
1688 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1689 SendMessageW(hDlgCtrl, LB_INSERTSTRING, (WPARAM)lResult + pos, (LPARAM)szBuffer);
1690 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult + pos, 0);
1691 }
1692 }
1693 }
1694}
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define LB_DELETESTRING
Definition: winuser.h:2032
#define LB_INSERTSTRING
Definition: winuser.h:2053
#define LB_GETCURSEL
Definition: winuser.h:2039

Referenced by TcpipAdvancedDnsDlg().

◆ PropSheetProc()

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

Definition at line 2084 of file tcpipconf_notify.c.

2085{
2086 // NOTE: This callback is needed to set large icon correctly.
2087 HICON hIcon;
2088 switch (uMsg)
2089 {
2090 case PSCB_INITIALIZED:
2091 {
2093 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
2094 break;
2095 }
2096 }
2097 return 0;
2098}
static HICON
Definition: imagelist.c:84
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:2075

Referenced by LaunchAdvancedTcpipSettings().

◆ RemoveItem()

VOID RemoveItem ( HWND  hDlgCtrl)

Definition at line 1696 of file tcpipconf_notify.c.

1698{
1699 LRESULT lResult, lCount;
1700
1701 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1702 if (lResult != LB_ERR)
1703 {
1704 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1705 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1706 if (lResult + 1 < lCount)
1707 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult, 0);
1708 else
1709 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lCount-1, 0);
1710 }
1711}

Referenced by TcpipAdvancedDnsDlg().

◆ StoreDNSSettings()

VOID StoreDNSSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This 
)

Definition at line 1763 of file tcpipconf_notify.c.

1766{
1767 INT iCount, iIndex;
1768 WCHAR Ip[16];
1769 IP_ADDR *pCur, *pLast;
1770
1771 FreeIPAddr(This->pCurrentConfig->Ns);
1772 This->pCurrentConfig->Ns = NULL;
1773
1774 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1775 if (!iCount || iCount == LB_ERR)
1776 {
1777 return;
1778 }
1779
1780 pLast = NULL;
1781 for(iIndex = 0; iIndex < iCount; iIndex++)
1782 {
1783 if (SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)Ip) == LB_ERR)
1784 break;
1785
1786 pCur = CoTaskMemAlloc(sizeof(IP_ADDR));
1787 if (!pCur)
1788 break;
1789 ZeroMemory(pCur, sizeof(IP_ADDR));
1790 pCur->IpAddress = GetIpAddressFromStringW(Ip);
1791
1792 if (!pLast)
1793 This->pCurrentConfig->Ns = pCur;
1794 else
1795 pLast->Next = pCur;
1796
1797 pLast = pCur;
1798 pCur = pCur->Next;
1799 }
1800 This->pCurrentConfig->AutoconfigActive = FALSE;
1801}
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:629
VOID FreeIPAddr(IP_ADDR *pAddr)

Referenced by TcpipAdvancedDnsDlg().

◆ StoreIPSettings()

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

Definition at line 1204 of file tcpipconf_notify.c.

1208{
1209 WCHAR szBuffer[30];
1210
1211 INT iIndex, iCount;
1212 IP_ADDR *pCur, *pLast;
1213
1214 iCount = ListView_GetItemCount(hDlgCtrl);
1215 if (!iCount)
1216 {
1217 return;
1218 }
1219
1220 pLast = NULL;
1221 for(iIndex = 0; iIndex < iCount; iIndex++)
1222 {
1223 if (GetListViewItem(hDlgCtrl, iIndex, 0, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1224 {
1225 pCur = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
1226 if (!pCur)
1227 break;
1228 ZeroMemory(pCur, sizeof(IP_ADDR));
1229
1230 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1231 pCur->IpAddress = GetIpAddressFromStringW(szBuffer);
1232
1233 if (GetListViewItem(hDlgCtrl, iIndex, 1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR) ))
1234 {
1235 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1236 if (bSubmask)
1237 pCur->u.Subnetmask = GetIpAddressFromStringW(szBuffer);
1238 else
1239 pCur->u.Metric = _wtoi(szBuffer);
1240 }
1241
1242 if (!pLast)
1243 {
1244 if (bSubmask)
1245 This->pCurrentConfig->Ip = pCur;
1246 else
1247 This->pCurrentConfig->Gw = pCur;
1248 }
1249 else
1250 {
1251 pLast->Next = pCur;
1252 }
1253
1254 pLast = pCur;
1255 }
1256 }
1257}
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 2288 of file tcpipconf_notify.c.

2292{
2293 DWORD dwIpAddr;
2294
2295 if (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED)
2296 {
2297 This->pCurrentConfig->DhcpEnabled = FALSE;
2298 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2299 {
2300 if (bApply)
2301 {
2303 SetFocus(GetDlgItem(hwndDlg, IDC_IPADDR));
2304 return E_FAIL;
2305 }
2306 }
2307 if (!This->pCurrentConfig->Ip)
2308 {
2309 This->pCurrentConfig->Ip = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2310 if (!This->pCurrentConfig->Ip)
2311 return E_OUTOFMEMORY;
2312 ZeroMemory(This->pCurrentConfig->Ip, sizeof(IP_ADDR));
2313 }
2314 This->pCurrentConfig->Ip->IpAddress = dwIpAddr;
2315
2316 if (SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2317 {
2318 if (bApply)
2320 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2321 {
2322 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2323 dwIpAddr = MAKEIPADDRESS(255, 0, 0, 0);
2324 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2325 dwIpAddr = MAKEIPADDRESS(255, 255, 0, 0);
2326 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2327 dwIpAddr = MAKEIPADDRESS(255, 255, 255, 0);
2328
2330 }
2331 if (bApply)
2332 {
2334 return E_FAIL;
2335 }
2336 }
2337 /* store subnetmask */
2338 This->pCurrentConfig->Ip->u.Subnetmask = dwIpAddr;
2339 }
2340 else
2341 {
2342 This->pCurrentConfig->DhcpEnabled = TRUE;
2343 }
2344
2345 if (SendDlgItemMessageW(hwndDlg, IDC_DEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2346 {
2347 if (!This->pCurrentConfig->Gw)
2348 {
2349 This->pCurrentConfig->Gw = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2350 if (!This->pCurrentConfig->Gw)
2351 return E_OUTOFMEMORY;
2352 ZeroMemory(This->pCurrentConfig->Gw, sizeof(IP_ADDR));
2353 }
2354 /* store default gateway */
2355 This->pCurrentConfig->Gw->IpAddress = dwIpAddr;
2356 }
2357 else
2358 {
2359 if (This->pCurrentConfig->Gw)
2360 {
2361 IP_ADDR * pNextGw = This->pCurrentConfig->Gw->Next;
2362 CoTaskMemFree(This->pCurrentConfig->Gw);
2363 This->pCurrentConfig->Gw = pNextGw;
2364 }
2365 }
2366
2368 {
2369 BOOL bSkip = FALSE;
2370 This->pCurrentConfig->AutoconfigActive = FALSE;
2371 if (SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2372 {
2373 if (!This->pCurrentConfig->Ns)
2374 {
2375 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2376 if (!This->pCurrentConfig->Ns)
2377 return E_OUTOFMEMORY;
2378 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2379 }
2380 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2381 }
2382 else if (This->pCurrentConfig->Ns)
2383 {
2384 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next;
2385
2386 CoTaskMemFree(This->pCurrentConfig->Ns);
2387 This->pCurrentConfig->Ns = pTemp;
2388 bSkip = TRUE;
2389 }
2390
2391
2392 if (SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2393 {
2394 if (!This->pCurrentConfig->Ns || bSkip)
2395 {
2396 if (!This->pCurrentConfig->Ns)
2397 {
2398 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2399 if (!This->pCurrentConfig->Ns)
2400 return E_OUTOFMEMORY;
2401 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2402 }
2403 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2404 }
2405 else if (!This->pCurrentConfig->Ns->Next)
2406 {
2407 This->pCurrentConfig->Ns->Next = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2408 if (!This->pCurrentConfig->Ns->Next)
2409 return E_OUTOFMEMORY;
2410 ZeroMemory(This->pCurrentConfig->Ns->Next, sizeof(IP_ADDR));
2411 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2412 }
2413 else
2414 {
2415 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2416 }
2417 }
2418 else
2419 {
2420 if (This->pCurrentConfig->Ns && This->pCurrentConfig->Ns->Next)
2421 {
2422 if (This->pCurrentConfig->Ns->Next->Next)
2423 {
2424 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next->Next;
2425 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2426 This->pCurrentConfig->Ns->Next = pTemp;
2427 }
2428 else
2429 {
2430 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2431 This->pCurrentConfig->Ns->Next = NULL;
2432 }
2433 }
2434 }
2435 }
2436 else
2437 {
2438 This->pCurrentConfig->AutoconfigActive = TRUE;
2439 }
2440 return S_OK;
2441}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define IDS_NO_SUBMASK_SET
Definition: resource.h:100
#define IDS_NO_IPADDR_SET
Definition: resource.h:99
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4486
#define IPM_GETADDRESS
Definition: commctrl.h:4467
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ StoreTcpipFilterSettings()

TcpFilterSettings * StoreTcpipFilterSettings ( HWND  hwndDlg)

Definition at line 315 of file tcpipconf_notify.c.

317{
318 TcpFilterSettings * pFilter;
319
320 pFilter = CoTaskMemAlloc(sizeof(TcpFilterSettings));
321 if (!pFilter)
322 return NULL;
323
325 pFilter->EnableSecurityFilters = TRUE;
326 else
327 pFilter->EnableSecurityFilters = FALSE;
328
329 pFilter->szTCPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_TCP_LIST), &pFilter->TCPSize);
330 pFilter->szUDPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_UDP_LIST), &pFilter->UDPSize);
332
333 return pFilter;
334}
#define IDC_USE_FILTER
Definition: resource.h:86
#define IDC_IP_LIST
Definition: resource.h:83
#define IDC_UDP_LIST
Definition: resource.h:78
#define IDC_TCP_LIST
Definition: resource.h:73
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 1484 of file tcpipconf_notify.c.

1490{
1491 TcpipDnsSettings * pSettings;
1492 WCHAR szBuffer[100];
1493 DWORD dwIpAddr;
1494 LPNMIPADDRESS lpnmipa;
1495
1496 switch(uMsg)
1497 {
1498 case WM_INITDIALOG:
1499 pSettings = (TcpipDnsSettings*)lParam;
1501 if (!pSettings->bAdd)
1502 {
1503 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1504 {
1505 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1506 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1507 }
1508 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_SETTEXT, 0, (LPARAM)pSettings->szIP);
1509 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1510 }
1511 else
1512 {
1513 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1514 {
1515 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1516 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1517 }
1518 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1519 }
1520 return TRUE;
1521 case WM_COMMAND:
1522 if (LOWORD(wParam) == IDCANCEL)
1523 {
1524 EndDialog(hwndDlg, FALSE);
1525 break;
1526 }
1527 else if (LOWORD(wParam) == IDC_OK)
1528 {
1529 pSettings = (TcpipDnsSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1530 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pSettings->szIP);
1531 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->szIP) == LB_ERR)
1532 {
1533 if (pSettings->bAdd)
1534 SendMessageW(pSettings->hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)pSettings->szIP);
1535 EndDialog(hwndDlg, TRUE);
1536 break;
1537 }
1538 if (!pSettings->bAdd)
1539 {
1540 EndDialog(hwndDlg, FALSE);
1541 break;
1542 }
1544 break;
1545 }
1546 break;
1547 case WM_NOTIFY:
1548 lpnmipa = (LPNMIPADDRESS) lParam;
1549 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1550 {
1551 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1552 {
1553 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1554 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1555 }
1556 }
1557 break;
1558 }
1559 return FALSE;
1560}
#define IDC_OK
Definition: resource.h:59
WPARAM wParam
Definition: combotst.c:138
#define IDS_ADD
Definition: resource.h:111
#define IDS_MOD
Definition: resource.h:112
#define IDS_DUP_SUFFIX
Definition: resource.h:123
#define LOWORD(l)
Definition: pedump.c:82
struct tagNMIPADDRESS * LPNMIPADDRESS
#define IPN_FIELDCHANGED
Definition: commctrl.h:4477
#define WM_NOTIFY
Definition: richedit.h:61
UINT_PTR idFrom
Definition: winuser.h:3158
UINT code
Definition: winuser.h:3159
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:831
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_GETTEXT
Definition: winuser.h:1618
#define WM_INITDIALOG
Definition: winuser.h:1739
#define MB_ICONERROR
Definition: winuser.h:787
#define LB_FINDSTRING
Definition: winuser.h:2034
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 871 of file tcpipconf_notify.c.

877{
878 LPNMIPADDRESS lpnmipa;
879 DWORD dwIpAddr;
880 TcpipIpSettings *pIpSettings;
881 WCHAR szBuffer[50];
883 LRESULT lResult;
884
885 switch(uMsg)
886 {
887 case WM_INITDIALOG:
888 pIpSettings = (TcpipIpSettings*)lParam;
890
899
900 if (pIpSettings->bAdd)
901 {
902 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
903 {
904 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
905 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
906 }
908 }
909 else
910 {
911 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
912 {
913 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
914 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
915 }
916
919 }
920 return TRUE;
921 case WM_NOTIFY:
922 lpnmipa = (LPNMIPADDRESS) lParam;
923 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
924 {
925 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
926 {
927 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
928 {
929 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
931 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
933 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
934 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
936 }
937 }
938 }
939 break;
940 case WM_COMMAND:
941 if (LOWORD(wParam) == IDC_OK)
942 {
943 pIpSettings = (TcpipIpSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
944 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pIpSettings->szIP);
945 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, WM_GETTEXT, 16, (LPARAM)pIpSettings->szMask);
946
947 ZeroMemory(&find, sizeof(LVFINDINFOW));
948 find.flags = LVFI_STRING;
949 find.psz = pIpSettings->szIP;
950 lResult = SendMessageW(pIpSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find);
951
952 if (lResult == -1)
953 {
954 EndDialog(hwndDlg, TRUE);
955 break;
956 }
957 else if (!pIpSettings->bAdd)
958 {
959 EndDialog(hwndDlg, FALSE);
960 break;
961 }
963 break;
964 }
965 else if (LOWORD(wParam) == IDCANCEL)
966 {
967 EndDialog(hwndDlg, FALSE);
968 }
969 break;
970 }
971 return FALSE;
972}
static TAGID TAGID find
Definition: db.cpp:155
#define IDS_DUP_IPADDR
Definition: resource.h:124
#define LVFI_STRING
Definition: commctrl.h:2437
#define LVM_FINDITEMW
Definition: commctrl.h:2466

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAddSuffixDlg()

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

Definition at line 990 of file tcpipconf_notify.c.

996{
997 WCHAR szBuffer[100];
998 TcpipSuffixSettings * pSettings;
999 LRESULT lLength;
1000
1001 switch(uMsg)
1002 {
1003 case WM_INITDIALOG:
1004 pSettings = (TcpipSuffixSettings*)lParam;
1005 if (!pSettings->bAdd)
1006 {
1007 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)pSettings->Suffix);
1008 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1009 {
1010 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1011 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1012 }
1013 CoTaskMemFree(pSettings->Suffix);
1014 pSettings->Suffix = NULL;
1015 }
1016 else
1017 {
1018 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1019 {
1020 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1021 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1022 }
1023 }
1024 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSettings);
1025 return TRUE;
1026 case WM_COMMAND:
1027 if (LOWORD(wParam) == IDCANCEL)
1028 {
1029 EndDialog(hwndDlg, FALSE);
1030 break;
1031 }
1032 else if (LOWORD(wParam) == IDC_OK)
1033 {
1034 lLength = SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXTLENGTH, 0, 0);
1035 if (lLength)
1036 {
1037 pSettings = (TcpipSuffixSettings*) GetWindowLongPtr(hwndDlg, DWLP_USER);
1038 pSettings->Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1)* sizeof(WCHAR));
1039 if (pSettings->Suffix)
1040 {
1041 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, lLength + 1, (LPARAM)pSettings->Suffix);
1042 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->Suffix) != LB_ERR)
1043 {
1045 CoTaskMemFree(pSettings->Suffix);
1046 break;
1047 }
1048
1049 if (!VerifyDNSSuffix(pSettings->Suffix))
1050 {
1052 CoTaskMemFree(pSettings->Suffix);
1053 break;
1054 }
1055 EndDialog(hwndDlg, TRUE);
1056 }
1057 }
1058 break;
1059 }
1060 }
1061 return FALSE;
1062}
#define IDS_DOMAIN_SUFFIX
Definition: resource.h:121
BOOL VerifyDNSSuffix(LPWSTR szName)
#define WM_GETTEXTLENGTH
Definition: winuser.h:1619

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAdvancedDnsDlg()

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

Definition at line 1805 of file tcpipconf_notify.c.

1811{
1814 TcpipDnsSettings Dns;
1815 LRESULT lIndex, lLength;
1816 TcpipSuffixSettings Suffix;
1817 LPPSHNOTIFY lppsn;
1818 WCHAR szSuffix[100];
1819 WCHAR szFormat[200];
1820 WCHAR szBuffer[300];
1821
1822
1823 switch(uMsg)
1824 {
1825 case WM_INITDIALOG:
1827 This = (TcpipConfNotifyImpl*)page->lParam;
1832 return TRUE;
1833 case WM_NOTIFY:
1834 lppsn = (LPPSHNOTIFY) lParam;
1835 if (lppsn->hdr.code == PSN_KILLACTIVE)
1836 {
1837 if (IsDlgButtonChecked(hwndDlg, IDC_SELSUFFIX) == BST_CHECKED &&
1839 {
1842 return TRUE;
1843 }
1844 if (SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, sizeof(szSuffix)/sizeof(WCHAR), (LPARAM)szSuffix))
1845 {
1846 szSuffix[(sizeof(szSuffix)/sizeof(WCHAR))-1] = L'\0';
1847 if (VerifyDNSSuffix(szSuffix) == FALSE)
1848 {
1849 if (LoadStringW(netcfgx_hInstance, IDS_DNS_SUFFIX, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1850 {
1851 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1852 swprintf(szBuffer, szFormat, szSuffix);
1853 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1854 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1855 else
1856 szFormat[0] = L'\0';
1857
1858 MessageBoxW(hwndDlg, szBuffer, szFormat, MB_ICONWARNING);
1860 SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
1861 return TRUE;
1862 }
1863 }
1864 }
1865 }
1866 else if (lppsn->hdr.code == PSN_APPLY)
1867 {
1869 if (!This->pCurrentConfig->pDNS)
1870 break;
1871
1874 {
1875 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1876 This->pCurrentConfig->pDNS->szSearchList = NULL;
1878 This->pCurrentConfig->pDNS->UseDomainNameDevolution = TRUE;
1879 else
1880 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1881 }
1882 else
1883 {
1884 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1885 This->pCurrentConfig->pDNS->szSearchList = NULL;
1886 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1887 This->pCurrentConfig->pDNS->szSearchList = GetListViewEntries(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST));
1888 }
1889
1891 {
1892 This->pCurrentConfig->pDNS->RegisterAdapterName = TRUE;
1894 This->pCurrentConfig->pDNS->RegistrationEnabled = TRUE;
1895 else
1896 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1897 }
1898 else
1899 {
1900 This->pCurrentConfig->pDNS->RegisterAdapterName = FALSE;
1901 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1902 }
1903 }
1904 break;
1905 case WM_COMMAND:
1907 {
1909 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1910 break;
1911 }
1913 {
1915 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1916 break;
1917 }
1918 else if (LOWORD(wParam) == IDC_PRIMSUFFIX && HIWORD(wParam) == BN_CLICKED)
1919 {
1921 {
1929 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1930 }
1931 }
1932 else if (LOWORD(wParam) == IDC_SELSUFFIX && HIWORD(wParam) == BN_CLICKED)
1933 {
1935 {
1939 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1940 }
1941 break;
1942 }
1943 else if (LOWORD(wParam) == IDC_REGSUFFIX && HIWORD(wParam) == BN_CLICKED)
1944 {
1947 else
1949 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1950 }
1951 else if (LOWORD(wParam) == IDC_DNSADDRUP && HIWORD(wParam) == BN_CLICKED)
1952 {
1953 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), -1);
1956 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1957 break;
1958 }
1960 {
1961 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), 1);
1964 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1965 break;
1966 }
1968 {
1969 MoveItem(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST), -1);
1972 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1973 break;
1974 }
1976 {
1980 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1981 break;
1982 }
1983 else if (LOWORD(wParam) == IDC_DNSADDRDEL && HIWORD(wParam) == BN_CLICKED)
1984 {
1988 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1989 break;
1990 }
1992 {
1996 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1997 break;
1998 }
1999 else if (LOWORD(wParam) == IDC_DNSADDRADD && HIWORD(wParam) == BN_CLICKED)
2000 {
2001 Dns.bAdd = TRUE;
2002 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2004 {
2006 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2007 }
2008 break;
2009 }
2010 else if (LOWORD(wParam) == IDC_DNSADDRMOD && HIWORD(wParam) == BN_CLICKED)
2011 {
2012 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSADDRLIST, LB_GETCURSEL, 0, 0);
2013 if (lIndex != LB_ERR)
2014 {
2015 Dns.bAdd = FALSE;
2016 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2017 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_GETTEXT, (WPARAM)lIndex, (LPARAM)Dns.szIP);
2019 {
2021 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_INSERTSTRING, lIndex, (LPARAM)Dns.szIP);
2022 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_SETCURSEL, lIndex, 0);
2024 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2025 }
2026 }
2027 break;
2028 }
2030 {
2031 Suffix.bAdd = TRUE;
2032 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2033 Suffix.Suffix = NULL;
2035 {
2037 lIndex = SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_ADDSTRING, 0, (LPARAM)Suffix.Suffix);
2038 if (lIndex != LB_ERR)
2041 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2042 CoTaskMemFree(Suffix.Suffix);
2043 }
2044 break;
2045 }
2047 {
2048 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSSUFFIXLIST, LB_GETCURSEL, 0, 0);
2049 if (lIndex != LB_ERR)
2050 {
2051 Suffix.bAdd = FALSE;
2052 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2053 lLength = SendMessageW(Suffix.hDlgCtrl, LB_GETTEXTLEN, lIndex, 0);
2054 if (lLength != LB_ERR)
2055 {
2056 Suffix.Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1) * sizeof(WCHAR));
2057 if (Suffix.Suffix)
2058 {
2059 SendMessageW(Suffix.hDlgCtrl, LB_GETTEXT, lIndex, (LPARAM)Suffix.Suffix);
2060 Suffix.Suffix[lLength] = L'\0';
2062 {
2063 if (Suffix.Suffix)
2064 {
2066 SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_INSERTSTRING, lIndex, (LPARAM)Suffix.Suffix);
2069 CoTaskMemFree(Suffix.Suffix);
2070 }
2072 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2073 }
2074 }
2075 }
2076 }
2077 break;
2078 }
2079 }
2080 return FALSE;
2081}
#define IDC_DNSADDRMOD
Definition: resource.h:52
#define IDC_DNSSUFFIXUP
Definition: resource.h:58
#define IDC_DNSSUFFIXDEL
Definition: resource.h:62
#define IDC_DNSSUFFIXDOWN
Definition: resource.h:59
#define IDD_TCPIPDNS_DLG
Definition: resource.h:16
#define IDC_DNSADDRADD
Definition: resource.h:51
#define IDC_DNSADDRDEL
Definition: resource.h:53
#define IDC_DNSADDRUP
Definition: resource.h:49
#define IDS_NO_SUFFIX
Definition: resource.h:120
#define IDD_TCPIPSUFFIX_DLG
Definition: resource.h:17
#define IDC_DNSADDRDOWN
Definition: resource.h:50
#define IDS_DNS_SUFFIX
Definition: resource.h:122
#define IDC_DNSSUFFIXMOD
Definition: resource.h:61
#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:2055
#define LBN_SELCHANGE
Definition: winuser.h:2075
#define DWLP_MSGRESULT
Definition: winuser.h:870
#define BN_CLICKED
Definition: winuser.h:1925
#define SendDlgItemMessage
Definition: winuser.h:5842
#define BM_GETCHECK
Definition: winuser.h:1918

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedIpDlg()

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

Definition at line 1262 of file tcpipconf_notify.c.

1268{
1271 INT_PTR res;
1272 WCHAR szBuffer[200];
1273 LPPSHNOTIFY lppsn;
1275 TcpipIpSettings Ip;
1276
1277 LVITEMW li;
1278
1279 switch(uMsg)
1280 {
1281 case WM_INITDIALOG:
1283 This = (TcpipConfNotifyImpl*)page->lParam;
1286 return TRUE;
1287 case WM_NOTIFY:
1288 lppsn = (LPPSHNOTIFY) lParam;
1289 if (lppsn->hdr.code == LVN_ITEMCHANGED)
1290 {
1292 BOOL bEnable;
1293
1294 if (lplv->hdr.idFrom == IDC_IPLIST)
1295 {
1297
1298 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0) &&
1299 (!This->pCurrentConfig->DhcpEnabled);
1300
1303 }
1304 else if (lplv->hdr.idFrom == IDC_GWLIST)
1305 {
1306 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0);
1307
1310 }
1311 }
1312 else if (lppsn->hdr.code == PSN_KILLACTIVE)
1313 {
1315 if (!This->pCurrentConfig->DhcpEnabled && ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST)) == 0)
1316 {
1319 return TRUE;
1320 }
1321 }
1322 else if (lppsn->hdr.code == PSN_APPLY)
1323 {
1325 FreeIPAddr(This->pCurrentConfig->Gw);
1326 This->pCurrentConfig->Gw = NULL;
1327 FreeIPAddr(This->pCurrentConfig->Ip);
1328 This->pCurrentConfig->Ip = NULL;
1332 return TRUE;
1333 }
1334 break;
1335 case WM_COMMAND:
1337 {
1340 else
1342 }
1343 else if (LOWORD(wParam) == IDC_IPADD)
1344 {
1345 Ip.bAdd = TRUE;
1346 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1348 if (res)
1349 {
1350 memset(&li, 0x0, sizeof(LVITEMW));
1351 li.mask = LVIF_TEXT | LVIF_PARAM;
1352 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST));
1353 li.pszText = Ip.szIP;
1354 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_IPLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1355 if (li.iItem != -1)
1356 {
1357 li.mask = LVIF_TEXT;
1358 li.iSubItem = 1;
1359 li.pszText = Ip.szMask;
1361 }
1362 }
1363 }
1364 else if (LOWORD(wParam) == IDC_IPMOD)
1365 {
1366 memset(&li, 0x0, sizeof(LVITEMW));
1367 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_IPLIST));
1368 if (li.iItem < 0)
1369 {
1370 /* no item selected */
1372 SetFocus(GetDlgItem(hwndDlg, IDC_IPLIST));
1373 break;
1374 }
1375 Ip.bAdd = FALSE;
1376 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1377 if (GetIPListEntry(GetDlgItem(hwndDlg, IDC_IPLIST), li.iItem, &Ip))
1378 {
1380 if (res)
1381 {
1382 li.mask = LVIF_TEXT;
1383 li.pszText = Ip.szIP;
1385 li.pszText = Ip.szMask;
1386 li.iSubItem = 1;
1388 }
1389 }
1390 }
1391 else if (LOWORD(wParam) == IDC_IPDEL)
1392 {
1394 break;
1395 }
1396 else if (LOWORD(wParam) == IDC_GWADD)
1397 {
1398 Gw.bAdd = TRUE;
1399 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1401 if (res)
1402 {
1403 memset(&li, 0x0, sizeof(LVITEMW));
1404 li.mask = LVIF_TEXT;
1405 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_GWLIST));
1406 li.pszText = Gw.szIP;
1407 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_GWLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1408 if (li.iItem >= 0)
1409 {
1410 if (Gw.Metric)
1411 {
1412 swprintf(szBuffer, L"%u", Gw.Metric);
1413 li.iSubItem = 1;
1414 li.pszText = szBuffer;
1416 }
1417 else
1418 {
1419 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1420 {
1421 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1422 li.iSubItem = 1;
1423 li.pszText = szBuffer;
1425 }
1426 }
1427 }
1428 }
1429 break;
1430 }
1431 else if (LOWORD(wParam) == IDC_GWMOD)
1432 {
1433 memset(&li, 0x0, sizeof(LVITEMW));
1434 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_GWLIST));
1435 if (li.iItem < 0)
1436 {
1437 /* no item selected */
1439 SetFocus(GetDlgItem(hwndDlg, IDC_GWLIST));
1440 break;
1441 }
1442 if (GetGWListEntry(GetDlgItem(hwndDlg, IDC_GWLIST), li.iItem, &Gw))
1443 {
1444 Gw.bAdd = FALSE;
1445 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1447 if (res)
1448 {
1449 li.mask = LVIF_TEXT;
1450 li.pszText = Gw.szIP;
1452 if (Gw.Metric)
1453 {
1454 swprintf(szBuffer, L"%u", Gw.Metric);
1455 li.iSubItem = 1;
1456 li.pszText = szBuffer;
1458 }
1459 else
1460 {
1461 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1462 {
1463 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1464 li.iSubItem = 1;
1465 li.pszText = szBuffer;
1467 }
1468 }
1469 }
1470 }
1471 break;
1472 }
1473 else if (LOWORD(wParam) == IDC_GWDEL)
1474 {
1476 break;
1477 }
1478 }
1479 return FALSE;
1480}
#define IDC_GWADD
Definition: resource.h:39
#define IDD_TCPIPADDIP_DLG
Definition: resource.h:14
#define IDC_AUTOMETRIC
Definition: resource.h:42
#define IDD_TCPIPGW_DLG
Definition: resource.h:15
GLuint res
Definition: glext.h:9613
#define Gw
Definition: i386-dis.c:364
#define PSNRET_NOERROR
Definition: prsht.h:129
#define LVIF_PARAM
Definition: commctrl.h:2311
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
UINT uNewState
Definition: commctrl.h:3036
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

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedOptDlg()

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

Definition at line 565 of file tcpipconf_notify.c.

571{
574
575 switch(uMsg)
576 {
577 case WM_INITDIALOG:
579 This = (TcpipConfNotifyImpl*)page->lParam;
581 return TRUE;
582 case WM_COMMAND:
583 if (LOWORD(wParam) == IDC_OPTPROP)
584 {
587 GetParent(hwndDlg),
590 break;
591 }
592 }
593 return FALSE;
594}
#define IDD_TCPIP_FILTER_DLG
Definition: resource.h:13
#define IDC_OPTPROP
Definition: resource.h:68
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 715 of file tcpipconf_notify.c.

721{
722 WCHAR szBuffer[70];
723 TcpipGwSettings *pGwSettings;
724 DWORD dwIpAddr;
725 LPNMIPADDRESS lpnmipa;
727
728 switch(uMsg)
729 {
730 case WM_INITDIALOG:
731 pGwSettings = (TcpipGwSettings *)lParam;
733
738
739 if (pGwSettings->bAdd)
740 {
741 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
742 {
743 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
744 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
745 }
748 }
749 else
750 {
751 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
752 {
753 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
754 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
755 }
756
758
759 if (pGwSettings->Metric)
760 {
761 SetDlgItemInt(hwndDlg, IDC_METRIC, pGwSettings->Metric, FALSE);
764 }
765 else
766 {
770 }
771 }
772 return TRUE;
773 case WM_COMMAND:
775 {
777 {
781 }
782 else
783 {
786 }
787 break;
788 }
789 else if (LOWORD(wParam) == IDCANCEL)
790 {
791 EndDialog(hwndDlg, FALSE);
792 break;
793 }
794 else if (LOWORD(wParam) == IDC_OK)
795 {
796 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
797 {
798 pGwSettings = (TcpipGwSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
799 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pGwSettings->szIP);
800
801 ZeroMemory(&find, sizeof(LVFINDINFOW));
802 find.flags = LVFI_STRING;
803 find.psz = pGwSettings->szIP;
804
806 pGwSettings->Metric = GetDlgItemInt(hwndDlg, IDC_METRIC, NULL, FALSE);
807 else
808 pGwSettings->Metric = 0;
809
810
811 if (SendMessageW(pGwSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
812 {
813 EndDialog(hwndDlg, TRUE);
814 break;
815 }
816 if (!pGwSettings->bAdd)
817 {
818 EndDialog(hwndDlg, FALSE);
819 break;
820 }
822 }
823 break;
824 }
825 break;
826 case WM_NOTIFY:
827 lpnmipa = (LPNMIPADDRESS) lParam;
828 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
829 {
830 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
831 {
832 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
834 }
835 }
836 break;
837 }
838 return FALSE;
839}
#define IDS_DUP_GW
Definition: resource.h:125
#define IDC_USEMETRIC
Definition: resource.h:45
#define IDC_METRICTXT
Definition: resource.h:44
#define BST_UNCHECKED
Definition: winuser.h:199
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAltConfDlg()

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

Definition at line 2218 of file tcpipconf_notify.c.

2223{
2226 BOOL bNoDHCP;
2227
2228 switch (uMsg)
2229 {
2230 case WM_INITDIALOG:
2231 {
2233 This = (TcpipConfNotifyImpl*)page->lParam;
2235 if (This->pCurrentConfig)
2236 InitializeTcpipAltDlgCtrls(hwndDlg, This->pCurrentConfig);
2237 return TRUE;
2238 }
2239 case WM_COMMAND:
2240 {
2241 switch (LOWORD(wParam))
2242 {
2243 case IDC_USEDHCP:
2244 case IDC_NODHCP:
2245 {
2246 if (HIWORD(wParam) == BN_CLICKED)
2247 {
2248 bNoDHCP = (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED);
2249 if (bNoDHCP)
2250 {
2254 }
2255
2256 EnableWindow(GetDlgItem(hwndDlg, IDC_IPADDR), bNoDHCP);
2257 EnableWindow(GetDlgItem(hwndDlg, IDC_SUBNETMASK), bNoDHCP);
2258 EnableWindow(GetDlgItem(hwndDlg, IDC_DEFGATEWAY), bNoDHCP);
2259 EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), bNoDHCP);
2260 EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), bNoDHCP);
2261
2262 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2263 }
2264 break;
2265 }
2266 }
2267 break;
2268 }
2269 }
2270 return FALSE;
2271}
HRESULT InitializeTcpipAltDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)

Referenced by AddAlternativeDialog(), and