ReactOS 0.4.16-dev-2522-g97cc325
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_INetCfgComponentPropertyUi (INetCfgComponentPropertyUi *iface)
 
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentSetup (INetCfgComponentSetup *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)
 
VOID FreeFilterSettings (TcpFilterSettings *pFilter)
 
VOID FreeDNSSettings (TcpipAdvancedDNSDlgSettings *pDNS)
 
VOID FreeSettings (TcpipSettings *pSettings)
 
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 INetCfgComponentSetup_fnQueryInterface (INetCfgComponentSetup *iface, REFIID iid, LPVOID *ppvObj)
 
ULONG WINAPI INetCfgComponentSetup_fnAddRef (INetCfgComponentSetup *iface)
 
ULONG WINAPI INetCfgComponentSetup_fnRelease (INetCfgComponentSetup *iface)
 
HRESULT WINAPI INetCfgComponentSetup_fnInstall (INetCfgComponentSetup *iface, DWORD dwSetupFlags)
 
HRESULT WINAPI INetCfgComponentSetup_fnUpgrade (INetCfgComponentSetup *iface, DWORD dwSetupFlags, DWORD dwUpgradeFromBuildNo)
 
HRESULT WINAPI INetCfgComponentSetup_fnReadAnswerFile (INetCfgComponentSetup *iface, LPCWSTR pszwAnswerFile, LPCWSTR pszwAnswerSections)
 
HRESULT WINAPI INetCfgComponentSetup_fnRemoving (INetCfgComponentSetup *iface)
 
HRESULT WINAPI TcpipConfigNotify_Constructor (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
 

Variables

static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi
 
static const INetCfgComponentControlVtbl vt_NetCfgComponentControl
 
static const INetCfgComponentSetupVtbl vt_NetCfgComponentSetup
 

Typedef Documentation

◆ IP_ADDR

◆ LPTcpipConfNotifyImpl

Enumeration Type Documentation

◆ COPY_TYPE

Enumerator
METRIC 
SUBMASK 
IPADDR 

Definition at line 47 of file tcpipconf_notify.c.

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

Function Documentation

◆ AddAlternativeDialog()

VOID AddAlternativeDialog ( HWND  hDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2303 of file tcpipconf_notify.c.

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

Referenced by TcpipBasicDlg().

◆ AddItem()

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

Definition at line 345 of file tcpipconf_notify.c.

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

◆ CopyIpAddrString()

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

Definition at line 2563 of file tcpipconf_notify.c.

2568{
2569 IP_ADDR_STRING * pCurrent;
2570 IP_ADDR *pNew, *pLast;
2571
2572 pCurrent = pSrc;
2573 pLast = NULL;
2574
2575 while(pCurrent)
2576 {
2577 pNew = CoTaskMemAlloc(sizeof(IP_ADDR));
2578 if (!pNew)
2579 {
2580 break;
2581 }
2582 ZeroMemory(pNew, sizeof(IP_ADDR));
2584 if (!pNew->IpAddress)
2585 {
2586 CoTaskMemFree(pNew);
2587 return E_FAIL;
2588 }
2589
2590 if (Type == SUBMASK)
2591 {
2593 pNew->NTEContext = pCurrent->Context;
2594 }
2595 else if (Type == METRIC)
2596 {
2597 if (szMetric && szMetric[0] != L'\0')
2598 {
2599 pNew->u.Metric = _wtoi(szMetric);
2600 szMetric += wcslen(szMetric) + 1;
2601 }
2602 }
2603
2604 if (!pLast)
2605 *pTarget = pNew;
2606 else
2607 pLast->Next = pNew;
2608
2609 pLast = pNew;
2610 pCurrent = pCurrent->Next;
2611
2612 }
2613 pLast->Next = NULL;
2614 return S_OK;
2615}
Type
Definition: Type.h:7
#define E_FAIL
Definition: ddrawi.h:102
_ACRTIMP int __cdecl _wtoi(const wchar_t *)
Definition: wcs.c:2773
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
#define L(x)
Definition: resources.c:13
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
#define S_OK
Definition: intsafe.h:52
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define ZeroMemory
Definition: minwinbase.h:31
char String[4 *4]
Definition: iptypes.h:31
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:35
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:36
IP_MASK_STRING IpMask
Definition: iptypes.h:37
DWORD Context
Definition: iptypes.h:38
union tagIP_ADDR::@542 u
struct tagIP_ADDR * Next
UINT GetIpAddressFromStringA(char *sBuffer)

Referenced by Initialize().

◆ CreateFilterList()

LPWSTR CreateFilterList ( HWND  hDlgCtrl,
LPDWORD  Size 
)

Definition at line 273 of file tcpipconf_notify.c.

276{
277 INT iCount, iIndex;
278 LVITEMW li;
281 WCHAR szBuffer[10];
282
283 iCount = ListView_GetItemCount(hDlgCtrl);
284 if (!iCount)
285 {
286 pData = (LPWSTR)CoTaskMemAlloc(3 * sizeof(WCHAR));
287 if (!pData)
288 return NULL;
289 pData[0] = L'0';
290 pData[1] = L'\0';
291 pData[2] = L'\0';
292 *Size = 3 * sizeof(WCHAR);
293 return pData;
294 }
295
296 pData = CoTaskMemAlloc((6 * iCount + 1) * sizeof(WCHAR));
297 if (!pData)
298 return NULL;
299
300 pCur = pData;
301 dwSize = 0;
302 for(iIndex = 0; iIndex < iCount; iIndex++)
303 {
304 ZeroMemory(&li, sizeof(LVITEMW));
305 li.mask = LVIF_TEXT;
306 li.iItem = iIndex;
307 li.pszText = szBuffer;
308 li.cchTextMax = sizeof(szBuffer) /sizeof(WCHAR);
309 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
310 {
311 wcscpy(pCur, szBuffer);
312 dwSize += wcslen(szBuffer) + 1;
313 pCur += wcslen(szBuffer) + 1;
314 }
315 }
316 pCur[0] = L'\0';
317 *Size = (dwSize+1) * sizeof(WCHAR);
318 return pData;
319}
unsigned long DWORD
Definition: ntddk_ex.h:95
SINGLE_LIST_ENTRY * pCur
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVM_GETITEMW
Definition: commctrl.h:2395
wcscpy
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by StoreTcpipFilterSettings().

◆ CreateMultiSzString()

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

Definition at line 3333 of file tcpipconf_notify.c.

3334{
3335 LPWSTR pStr, pRet;
3336 DWORD dwSize, dwIpAddr;
3337 WCHAR szBuffer[30];
3338 IP_ADDR *pTemp = pAddr;
3339
3340
3341 dwSize = 0;
3342 while(pTemp)
3343 {
3344 if (Type == IPADDR)
3345 {
3346 dwIpAddr = pTemp->IpAddress;
3347 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3348 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3349 }else if (Type == SUBMASK)
3350 {
3351 dwIpAddr = pTemp->u.Subnetmask;
3352 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3353 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3354 }
3355 else if (Type == METRIC)
3356 {
3357 swprintf(szBuffer, L"%u", pTemp->u.Metric);
3358 }
3359
3360 dwSize += wcslen(szBuffer) + 1;
3361 pTemp = pTemp->Next;
3362 }
3363
3364 if (!dwSize)
3365 return NULL;
3366
3367 pStr = pRet = CoTaskMemAlloc((dwSize+1) * sizeof(WCHAR));
3368 if(!pStr)
3369 return NULL;
3370
3371 pTemp = pAddr;
3372 while(pTemp)
3373 {
3374 if (Type == IPADDR)
3375 {
3376 dwIpAddr = pTemp->IpAddress;
3377 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3378 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3379 }else if (Type == SUBMASK)
3380 {
3381 dwIpAddr = pTemp->u.Subnetmask;
3382 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3383 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3384 }
3385 else if (Type == METRIC)
3386 {
3387 swprintf(pStr, L"%u", pTemp->u.Metric);
3388 }
3389
3390 if (bComma)
3391 {
3392 pStr += wcslen(pStr);
3393 if (pTemp->Next)
3394 {
3395 pStr[0] = L',';
3396 pStr++;
3397 }
3398 }
3399 else
3400 {
3401 pStr += wcslen(pStr) + 1;
3402 }
3403 pTemp = pTemp->Next;
3404 }
3405 pStr[0] = L'\0';
3406 *Size = (dwSize+1) * sizeof(WCHAR);
3407 return pRet;
3408}
#define swprintf
Definition: precomp.h:40
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER pAddr
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4496
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4493
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4494
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4495

Referenced by INetCfgComponentControl_fnApplyRegistryChanges().

◆ DeleteItemFromList()

VOID DeleteItemFromList ( HWND  hDlgCtrl)

Definition at line 1133 of file tcpipconf_notify.c.

1134{
1135 LVITEMW li;
1136
1137 memset(&li, 0x0, sizeof(LVITEMW));
1138 li.iItem = GetSelectedItem(hDlgCtrl);
1139 if (li.iItem < 0)
1140 {
1142 SetFocus(hDlgCtrl);
1143 }
1144 else
1145 {
1146 (void)ListView_DeleteItem(hDlgCtrl, li.iItem);
1147 }
1148}
#define IDS_NOITEMSEL
Definition: resource.h:110
#define IDS_TCPIP
Definition: resource.h:111
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2416
#define memset(x, y, z)
Definition: compat.h:39
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
INT GetSelectedItem(HWND hDlgCtrl)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MB_ICONINFORMATION
Definition: winuser.h:813

Referenced by TcpipAdvancedIpDlg().

◆ DelItem()

static VOID DelItem ( HWND  hDlgCtrl)
static

Definition at line 362 of file tcpipconf_notify.c.

364{
365 INT iIndex = GetSelectedItem(hDlgCtrl);
366
367 if (iIndex != -1)
368 {
369 (void)ListView_DeleteItem(hDlgCtrl, iIndex);
370 return;
371 }
373}
#define MB_ICONWARNING
Definition: winuser.h:797

Referenced by TcpipFilterSettingsDlg().

◆ DisplayError()

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

Definition at line 136 of file tcpipconf_notify.c.

137{
138 WCHAR szBuffer[300];
139 WCHAR szTitle[100];
140
141 if (LoadStringW(netcfgx_hInstance, ResTxt, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
142 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
143 else
144 szBuffer[0] = L'\0';
145
146 if (LoadStringW(netcfgx_hInstance, ResTitle, szTitle, sizeof(szTitle)/sizeof(WCHAR)))
147 szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = L'\0';
148 else
149 szTitle[0] = L'\0';
150
151 MessageBoxW(NULL, szBuffer, szTitle, Type);
152}
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define LoadStringW
Definition: utils.h:64
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().

◆ FreeDNSSettings()

VOID FreeDNSSettings ( TcpipAdvancedDNSDlgSettings pDNS)

Definition at line 2756 of file tcpipconf_notify.c.

2758{
2759 if (pDNS == NULL)
2760 return;
2761
2762 if (pDNS->szSearchList)
2764
2765 CoTaskMemFree(pDNS);
2766}

Referenced by FreeSettings().

◆ FreeFilterSettings()

VOID FreeFilterSettings ( TcpFilterSettings pFilter)

Definition at line 2737 of file tcpipconf_notify.c.

2739{
2740 if (pFilter == NULL)
2741 return;
2742
2743 if (pFilter->szTCPAllowedPorts)
2745
2746 if (pFilter->szUDPAllowedPorts)
2748
2749 if (pFilter->szRawIPAllowedProtocols)
2751
2752 CoTaskMemFree(pFilter);
2753}
LPWSTR szRawIPAllowedProtocols

Referenced by FreeSettings().

◆ FreeIPAddr()

VOID FreeIPAddr ( IP_ADDR pAddr)

Definition at line 1191 of file tcpipconf_notify.c.

1192{
1193 IP_ADDR *pNext;
1194
1195 if (!pAddr)
1196 return;
1197
1198 while(pAddr)
1199 {
1200 pNext = pAddr->Next;
1202 pAddr = pNext;
1203 }
1204}

Referenced by StoreDNSSettings(), and TcpipAdvancedIpDlg().

◆ FreeSettings()

VOID FreeSettings ( TcpipSettings pSettings)

Definition at line 2769 of file tcpipconf_notify.c.

2771{
2772 IP_ADDR *NextIp;
2773
2774 if (pSettings == NULL)
2775 return;
2776
2777 /* Free IpAdresses */
2778 while (pSettings->Ip)
2779 {
2780 NextIp = pSettings->Ip->Next;
2781 CoTaskMemFree(pSettings->Ip);
2782 pSettings->Ip = NextIp;
2783 }
2784
2785 /* Free NameServers */
2786 while (pSettings->Ns)
2787 {
2788 NextIp = pSettings->Ns->Next;
2789 CoTaskMemFree(pSettings->Ns);
2790 pSettings->Ns = NextIp;
2791 }
2792
2793 /* Free Gateways */
2794 while (pSettings->Gw)
2795 {
2796 NextIp = pSettings->Gw->Next;
2797 CoTaskMemFree(pSettings->Gw);
2798 pSettings->Gw = NextIp;
2799 }
2800
2801 /* Free Filter Settings */
2802 if (pSettings->pFilter)
2803 FreeFilterSettings(pSettings->pFilter);
2804
2805 /* Free DNS Settings */
2806 if (pSettings->pDNS)
2807 FreeDNSSettings(pSettings->pDNS);
2808
2809 CoTaskMemFree(pSettings);
2810}
TcpipAdvancedDNSDlgSettings * pDNS
TcpFilterSettings * pFilter
VOID FreeDNSSettings(TcpipAdvancedDNSDlgSettings *pDNS)
VOID FreeFilterSettings(TcpFilterSettings *pFilter)

Referenced by INetCfgComponentControl_fnApplyRegistryChanges(), and INetCfgComponentControl_fnRelease().

◆ GetGWListEntry()

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

Definition at line 859 of file tcpipconf_notify.c.

860{
861 LVITEMW li;
862 WCHAR szBuffer[30];
863 BOOL bRet;
864
865 ZeroMemory(&li, sizeof(LVITEMW));
866 li.mask = LVIF_TEXT;
867 li.cchTextMax = 16;
868 li.pszText = pGwSettings->szIP;
869 li.iItem = Index;
870
871 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
872 return FALSE;
873 li.pszText = szBuffer;
874 li.cchTextMax = 30;
875 li.iSubItem = 1;
876
877 bRet = SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
878 if (bRet)
879 {
880 pGwSettings->Metric = _wtoi(szBuffer);
881 }
882
883 return bRet;
884}
#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 1176 of file tcpipconf_notify.c.

1178{
1179 WCHAR szIp[16];
1180
1181 if (MultiByteToWideChar(CP_ACP, 0, sBuffer, -1, szIp, 16))
1182 {
1183 szIp[15] = L'\0';
1184 return GetIpAddressFromStringW(szIp);
1185 }
1186 return (UINT)-1;
1187}
#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 1151 of file tcpipconf_notify.c.

1153{
1154 DWORD dwIpAddr = 0;
1155 INT Val;
1156 UINT Index = 3;
1157 LPWSTR pLast = szBuffer;
1158 LPWSTR pNext = szBuffer;
1159
1160
1161 while((pNext = wcschr(pNext, L'.')))
1162 {
1163 pNext[0] = L'\0';
1164 Val = _wtoi(pLast);
1165 dwIpAddr |= (Val << Index * 8);
1166 Index--;
1167 pNext++;
1168 pLast = pNext;
1169 }
1170 dwIpAddr |= _wtoi(pLast);
1171
1172 return dwIpAddr;
1173}
#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 1109 of file tcpipconf_notify.c.

1110{
1111 LVITEMW li;
1112
1113 ZeroMemory(&li, sizeof(LVITEMW));
1114 li.mask = LVIF_TEXT;
1115 li.cchTextMax = 16;
1116 li.pszText = pIpSettings->szIP;
1117 li.iItem = Index;
1118
1119 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1120 return FALSE;
1121
1122 ZeroMemory(&li, sizeof(LVITEMW));
1123 li.mask = LVIF_TEXT;
1124 li.cchTextMax = 16;
1125 li.pszText = pIpSettings->szMask;
1126 li.iSubItem = 1;
1127 li.iItem = Index;
1128
1129 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1130}

Referenced by TcpipAdvancedIpDlg().

◆ GetListViewEntries()

LPWSTR GetListViewEntries ( HWND  hDlgCtrl)

Definition at line 1749 of file tcpipconf_notify.c.

1751{
1752 DWORD dwSize;
1753 INT iCount, iIndex;
1754 INT_PTR lResult;
1755 LPWSTR pszSearchList, pItem;
1756
1757 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1758 if (!iCount || iCount == LB_ERR)
1759 return NULL; //BUGBUG
1760
1761 dwSize = 0;
1762
1763 for (iIndex = 0; iIndex < iCount; iIndex++)
1764 {
1765 lResult = SendMessageW(hDlgCtrl, LB_GETTEXTLEN, iIndex, 0);
1766 if (lResult == LB_ERR)
1767 return NULL;
1768
1769 dwSize += lResult + 1;
1770 }
1771
1772 pszSearchList = (LPWSTR)CoTaskMemAlloc((dwSize + 1) * sizeof(WCHAR));
1773 if (!pszSearchList)
1774 return NULL;
1775
1776 pItem = pszSearchList;
1777 for (iIndex = 0; iIndex < iCount; iIndex++)
1778 {
1779 lResult = SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)pItem);
1780 if (lResult == LB_ERR)
1781 {
1782 CoTaskMemFree(pszSearchList);
1783 return NULL;
1784 }
1785 dwSize -= lResult + 1;
1786 pItem += wcslen(pItem);
1787 if (iIndex != iCount -1)
1788 {
1789 pItem[0] = L',';
1790 pItem++;
1791 }
1792 }
1793 pItem[0] = L'\0';
1794 return pszSearchList;
1795}
int32_t INT_PTR
Definition: typedefs.h:64
#define LB_ERR
Definition: winuser.h:2468
#define LB_GETCOUNT
Definition: winuser.h:2067
#define LB_GETTEXT
Definition: winuser.h:2085
#define LB_GETTEXTLEN
Definition: winuser.h:2086

Referenced by TcpipAdvancedDnsDlg().

◆ GetListViewItem()

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

Definition at line 1207 of file tcpipconf_notify.c.

1208{
1209 LVITEMW li;
1210
1211 ZeroMemory(&li, sizeof(LVITEMW));
1212 li.mask = LVIF_TEXT;
1213 li.pszText = szBuffer;
1214 li.iItem = Index;
1215 li.iSubItem = SubIndex;
1216 li.cchTextMax = BufferSize;
1217 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1218}
#define BufferSize
Definition: mmc.h:75

Referenced by StoreIPSettings().

◆ GetSelectedItem()

INT GetSelectedItem ( HWND  hDlgCtrl)

Definition at line 1083 of file tcpipconf_notify.c.

1084{
1085 LVITEMW li;
1086 UINT iItemCount, iIndex;
1087
1088 iItemCount = ListView_GetItemCount(hDlgCtrl);
1089 if (!iItemCount)
1090 return -1;
1091
1092 for (iIndex = 0; iIndex < iItemCount; iIndex++)
1093 {
1094 ZeroMemory(&li, sizeof(LVITEMW));
1095 li.mask = LVIF_STATE;
1096 li.stateMask = (UINT)-1;
1097 li.iItem = iIndex;
1098 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1099 {
1100 if (li.state & LVIS_SELECTED)
1101 return iIndex;
1102 }
1103 }
1104 return -1;
1105}
#define LVIF_STATE
Definition: commctrl.h:2317
#define LVIS_SELECTED
Definition: commctrl.h:2324

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

◆ impl_from_INetCfgComponentPropertyUi()

◆ impl_from_INetCfgComponentSetup()

static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentSetup ( INetCfgComponentSetup *  iface)
static

Definition at line 123 of file tcpipconf_notify.c.

124{
125 return (TcpipConfNotifyImpl*)((char *)iface - FIELD_OFFSET(TcpipConfNotifyImpl, lpVtblCompSetup));
126}

Referenced by INetCfgComponentSetup_fnAddRef(), INetCfgComponentSetup_fnQueryInterface(), and INetCfgComponentSetup_fnRelease().

◆ INetCfgComponentControl_fnAddRef()

ULONG WINAPI INetCfgComponentControl_fnAddRef ( INetCfgComponentControl *  iface)

Definition at line 3276 of file tcpipconf_notify.c.

3278{
3279 TRACE("INetCfgComponentControl_fnAddRef()\n");
3281 ULONG refCount = InterlockedIncrement(&This->ref);
3282
3283 return refCount;
3284}
#define InterlockedIncrement
Definition: armddk.h:53
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t ULONG
Definition: typedefs.h:59

◆ INetCfgComponentControl_fnApplyPnpChanges()

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

Definition at line 3662 of file tcpipconf_notify.c.

3665{
3666 //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyPnpChanges", NULL, MB_OK);
3667 return S_OK;
3668}

◆ INetCfgComponentControl_fnApplyRegistryChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges ( INetCfgComponentControl *  iface)

Definition at line 3413 of file tcpipconf_notify.c.

3415{
3416 HKEY hKey;
3417 LPOLESTR pStr;
3418 DWORD dwSize;
3419 WCHAR szBuffer[200];
3420 TcpipSettings * pCurrentConfig, *pOldConfig;
3421 ULONG NTEInstance;
3422 DWORD DhcpApiVersion;
3423
3425
3426 pCurrentConfig = This->pCurrentConfig;
3427 This->pCurrentConfig = NULL;
3428
3429 if (FAILED(Initialize(This)))
3430 {
3431 This->pCurrentConfig = pCurrentConfig;
3432 return E_FAIL;
3433 }
3434 pOldConfig = This->pCurrentConfig;
3435 This->pCurrentConfig = pCurrentConfig;
3436
3437 //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyRegistryChanges", NULL, MB_OK);
3438
3439
3440 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3441 {
3442 if (pCurrentConfig->pDNS)
3443 {
3444 RegSetValueExW(hKey, L"UseDomainNameDevolution", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->pDNS->UseDomainNameDevolution, sizeof(DWORD));
3445 RegSetValueExW(hKey, L"SearchList", 0, REG_SZ, (LPBYTE)pCurrentConfig->pDNS->szSearchList,
3446 (wcslen(pCurrentConfig->pDNS->szSearchList)+1) * sizeof(WCHAR));
3447 }
3448 if (pCurrentConfig->pFilter)
3449 {
3450 RegSetValueExW(hKey, L"EnableSecurityFilters", 0, REG_DWORD,
3451 (LPBYTE)&pCurrentConfig->pFilter->EnableSecurityFilters, sizeof(DWORD));
3452 }
3454 }
3455
3456 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
3457 {
3458 if (pOldConfig)
3459 FreeSettings(pOldConfig);
3460 return E_FAIL;
3461 }
3462
3463 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
3464 CoTaskMemFree(pStr);
3465
3467 {
3468 if (pCurrentConfig->Metric)
3469 RegSetValueExW(hKey, L"InterfaceMetric", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->Metric, sizeof(DWORD));
3470 else
3471 RegDeleteValueW(hKey, L"InterfaceMetric");
3472
3473 if (pCurrentConfig->pDNS)
3474 {
3475 RegSetValueExW(hKey, L"RegisterAdapterName", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, sizeof(DWORD));
3476 RegSetValueExW(hKey, L"RegistrationEnabled", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, sizeof(DWORD));
3477 RegSetValueExW(hKey, L"Domain", 0, REG_SZ, (LPBYTE)This->pCurrentConfig->pDNS->szDomain,
3478 (wcslen(This->pCurrentConfig->pDNS->szDomain)+1) * sizeof(WCHAR));
3479 }
3480#if 0
3481 if (pCurrentConfig->pFilter)
3482 {
3483 if (pCurrentConfig->pFilter->szTCPAllowedPorts)
3484 {
3485 RegSetValueExW(hKey, L"TCPAllowedPorts", 0, REG_MULTI_SZ,
3486 (LPBYTE)pCurrentConfig->pFilter->szTCPAllowedPorts,
3487 pCurrentConfig->pFilter->TCPSize);
3488 }
3489 if (pCurrentConfig->pFilter->szUDPAllowedPorts)
3490 {
3491 RegSetValueExW(hKey, L"UDPAllowedPorts", 0, REG_MULTI_SZ,
3492 (LPBYTE)pCurrentConfig->pFilter->szUDPAllowedPorts,
3493 pCurrentConfig->pFilter->UDPSize);
3494 }
3495 if (pCurrentConfig->pFilter->szRawIPAllowedProtocols)
3496 {
3497 RegSetValueExW(hKey, L"RawIPAllowedProtocols", 0, REG_MULTI_SZ,
3498 (LPBYTE)pCurrentConfig->pFilter->szRawIPAllowedProtocols,
3499 pCurrentConfig->pFilter->IPSize);
3500 }
3501 }
3502#endif
3503 RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->DhcpEnabled, sizeof(DWORD));
3504 if (pCurrentConfig->DhcpEnabled)
3505 {
3506 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3507 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3508 if (!pOldConfig->DhcpEnabled)
3509 {
3510 /* Delete this adapter's current IP address */
3511 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3512
3513 /* Delete all default routes for this adapter */
3514 dwSize = 0;
3516 {
3517 DWORD Index;
3519 if (pIpForwardTable)
3520 {
3521 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3522 {
3523 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3524 {
3525 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3526 pIpForwardTable->table[Index].dwForwardDest == 0)
3527 {
3528 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3529 }
3530 }
3531 }
3532 CoTaskMemFree(pIpForwardTable);
3533 }
3534 }
3535 }
3536 }
3537 else
3538 {
3539 /* Open the DHCP API if DHCP is enabled */
3540 if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR)
3541 {
3542 /* We have to tell DHCP about this */
3543 DhcpStaticRefreshParams(pCurrentConfig->Index,
3544 htonl(pCurrentConfig->Ip->IpAddress),
3545 htonl(pCurrentConfig->Ip->u.Subnetmask));
3546
3547 /* Close the API */
3549 }
3550 else
3551 {
3552 /* Delete this adapter's current static IP address */
3553 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3554
3555 /* Add the static IP address via the standard IPHLPAPI function */
3556 AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress),
3557 htonl(pCurrentConfig->Ip->u.Subnetmask),
3558 pCurrentConfig->Index,
3559 &pCurrentConfig->Ip->NTEContext,
3560 &NTEInstance);
3561 }
3562
3563 pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE);
3564 if(pStr)
3565 {
3566 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3567 CoTaskMemFree(pStr);
3568 }
3569
3570 pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE);
3571 if(pStr)
3572 {
3573 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3574 CoTaskMemFree(pStr);
3575 }
3576
3577 /* Delete all default routes for this adapter */
3578 dwSize = 0;
3580 {
3581 DWORD Index;
3583 if (pIpForwardTable)
3584 {
3585 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3586 {
3587 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3588 {
3589 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3590 pIpForwardTable->table[Index].dwForwardDest == 0)
3591 {
3592 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3593 }
3594 }
3595 }
3596 CoTaskMemFree(pIpForwardTable);
3597 }
3598 }
3599 }
3600
3601 if (pCurrentConfig->Gw)
3602 {
3603 MIB_IPFORWARDROW RouterMib;
3604 ZeroMemory(&RouterMib, sizeof(MIB_IPFORWARDROW));
3605
3606 RouterMib.dwForwardMetric1 = 1;
3607 RouterMib.dwForwardIfIndex = pOldConfig->Index;
3608 RouterMib.dwForwardNextHop = htonl(pCurrentConfig->Gw->IpAddress);
3609
3610 //TODO
3611 // add multiple gw addresses when required
3612
3613 if (CreateIpForwardEntry(&RouterMib) == NO_ERROR)
3614 {
3615 pStr = CreateMultiSzString(pCurrentConfig->Gw, IPADDR, &dwSize, FALSE);
3616 if(pStr)
3617 {
3618 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3619 CoTaskMemFree(pStr);
3620 }
3621
3622 pStr = CreateMultiSzString(pCurrentConfig->Gw, METRIC, &dwSize, FALSE);
3623 if(pStr)
3624 {
3625 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3626 CoTaskMemFree(pStr);
3627 }
3628 }
3629 }
3630 else
3631 {
3632 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"", 1 * sizeof(WCHAR));
3633 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", sizeof(WCHAR) * 2);
3634 }
3635
3636 if (!pCurrentConfig->Ns || pCurrentConfig->AutoconfigActive)
3637 {
3638 RegDeleteValueW(hKey, L"NameServer");
3639 }
3640 else
3641 {
3642 pStr = CreateMultiSzString(pCurrentConfig->Ns, IPADDR, &dwSize, TRUE);
3643 if(pStr)
3644 {
3645 RegSetValueExW(hKey, L"NameServer", 0, REG_SZ, (LPBYTE)pStr, dwSize);
3646 //RegDeleteValueW(hKey, L"DhcpNameServer");
3647 CoTaskMemFree(pStr);
3648 }
3649 }
3650
3652 }
3653
3654 if (pOldConfig)
3655 FreeSettings(pOldConfig);
3656
3657 return S_OK;
3658}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD APIENTRY DhcpCApiInitialize(_Out_ LPDWORD Version)
Definition: dhcpcsvc.c:213
DWORD APIENTRY DhcpStaticRefreshParams(DWORD AdapterIndex, DWORD Address, DWORD Netmask)
Definition: dhcpcsvc.c:477
VOID APIENTRY DhcpCApiCleanup(VOID)
Definition: dhcpcsvc.c:227
#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 clsid, LPOLESTR *str)
Definition: combase.c:1515
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 BSTR *static LPOLESTR
Definition: varformat.c:44
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define KEY_WRITE
Definition: nt_native.h:1034
#define REG_DWORD
Definition: sdbapi.c:615
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)
VOID FreeSettings(TcpipSettings *pSettings)
unsigned char * LPBYTE
Definition: typedefs.h:53
#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 3672 of file tcpipconf_notify.c.

3674{
3675 //MessageBoxW(NULL, L"INetCfgComponentControl_fnCancelChanges", NULL, MB_OK);
3676 return S_OK;
3677}

◆ INetCfgComponentControl_fnInitialize()

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

Definition at line 3306 of file tcpipconf_notify.c.

3311{
3312 TRACE("INetCfgComponentControl_fnInitialize()\n");
3314 HRESULT hr;
3315
3316 This->pNCfg = pINetCfg;
3317 This->pNComp = pIComp;
3318
3319 hr = Initialize(This);
3320 if (FAILED(hr))
3321 {
3322 ERR("INetCfgComponentControl_fnInitialize failed\n");
3323 return hr;
3324 }
3325
3326 TRACE("INetCfgComponentControl_fnInitialize success\n");
3327
3328 return S_OK;
3329}
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT hr
Definition: delayimp.cpp:573

◆ INetCfgComponentControl_fnQueryInterface()

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

Definition at line 3241 of file tcpipconf_notify.c.

3245{
3246 TRACE("INetCfgComponentControl_fnQueryInterface()\n");
3248
3249 *ppvObj = NULL;
3250
3251 if (IsEqualIID (iid, &IID_IUnknown) ||
3253 {
3254 *ppvObj = This;
3256 return S_OK;
3257 }
3259 {
3260 *ppvObj = (LPVOID*)&This->lpVtblCompPropertyUi;
3262 return S_OK;
3263 }
3264 else if (IsEqualIID(iid, &IID_INetCfgComponentSetup))
3265 {
3266 *ppvObj = (LPVOID*)&This->lpVtblCompSetup;
3268 return S_OK;
3269 }
3270
3271 return E_NOINTERFACE;
3272}
const GUID IID_IUnknown
EXTERN_C const IID IID_INetCfgComponentPropertyUi
Definition: netcfgn.h:88
EXTERN_C const IID IID_INetCfgComponentControl
Definition: netcfgn.h:57
EXTERN_C const IID IID_INetCfgComponentSetup
Definition: netcfgn.h:165
#define INetCfgComponentControl_AddRef(p)
Definition: netcfgn.h:157
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ INetCfgComponentControl_fnRelease()

ULONG WINAPI INetCfgComponentControl_fnRelease ( INetCfgComponentControl *  iface)

Definition at line 3288 of file tcpipconf_notify.c.

3290{
3291 TRACE("INetCfgComponentControl_fnRelease()\n");
3293 ULONG refCount = InterlockedDecrement(&This->ref);
3294
3295 if (!refCount)
3296 {
3297 if (This->pCurrentConfig)
3298 FreeSettings(This->pCurrentConfig);
3300 }
3301 return refCount;
3302}
#define InterlockedDecrement
Definition: armddk.h:52

◆ INetCfgComponentPropertyUi_fnAddRef()

ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef ( INetCfgComponentPropertyUi *  iface)

Definition at line 2831 of file tcpipconf_notify.c.

2833{
2834 TRACE("INetCfgComponentPropertyUi_fnAddRef()\n");
2836 return INetCfgComponentControl_AddRef((INetCfgComponentControl*)This);
2837}
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentPropertyUi(INetCfgComponentPropertyUi *iface)

◆ INetCfgComponentPropertyUi_fnApplyProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3206 of file tcpipconf_notify.c.

3208{
3209MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnApplyProperties", NULL, MB_OK);
3210 return S_OK;
3211}
#define MB_OK
Definition: winuser.h:801

◆ INetCfgComponentPropertyUi_fnCancelProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3215 of file tcpipconf_notify.c.

3217{
3218//MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnCancelProperties", NULL, MB_OK);
3219 return S_OK;
3220}

◆ INetCfgComponentPropertyUi_fnMergePropPages()

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

Definition at line 3149 of file tcpipconf_notify.c.

3156{
3157 TRACE("INetCfgComponentPropertyUi_fnMergePropPages()\n");
3158 HPROPSHEETPAGE * hppages;
3159 UINT NumPages;
3161
3162 if (This->pCurrentConfig->DhcpEnabled)
3163 NumPages = 2;
3164 else
3165 NumPages = 1;
3166
3167 hppages = (HPROPSHEETPAGE*) CoTaskMemAlloc(sizeof(HPROPSHEETPAGE) * NumPages);
3168 if (!hppages)
3169 return E_FAIL;
3170
3172 if (!hppages[0])
3173 {
3174 CoTaskMemFree(hppages);
3175 return E_FAIL;
3176 }
3177 if (NumPages == 2)
3178 {
3180 if (!hppages[1])
3181 {
3182 DestroyPropertySheetPage(hppages[0]);
3183 CoTaskMemFree(hppages);
3184 return E_FAIL;
3185 }
3186 }
3187
3188 *pahpspPrivate = (BYTE*)hppages;
3189 *pcPages = NumPages;
3190
3191 return S_OK;
3192}
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3155
#define IDD_TCPIP_BASIC_DLG
Definition: resource.h:8
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 2819 of file tcpipconf_notify.c.

2823{
2824 TRACE("INetCfgComponentPropertyUi_fnQueryInterface()\n");
2826 return INetCfgComponentControl_QueryInterface((INetCfgComponentControl*)This, iid, ppvObj);
2827}
#define INetCfgComponentControl_QueryInterface(p, a, b)
Definition: netcfgn.h:156

◆ INetCfgComponentPropertyUi_fnQueryPropertyUi()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2851 of file tcpipconf_notify.c.

2854{
2855 TRACE("INetCfgComponentPropertyUi_fnQueryPropertyUi()\n");
2856
2857 INetLanConnectionUiInfo * pLanInfo;
2858 HRESULT hr;
2860
2861 hr = IUnknown_QueryInterface(pUnkReserved, &IID_INetLanConnectionUiInfo, (LPVOID*)&pLanInfo);
2862 if (FAILED(hr))
2863 return hr;
2864
2865 INetLanConnectionUiInfo_GetDeviceGuid(pLanInfo, &This->NetCfgInstanceId);
2866
2867 //FIXME
2868 // check if tcpip is enabled on that binding */
2869 IUnknown_Release(pUnkReserved);
2870 return S_OK;
2871}
static IUnknown * pUnkReserved
Definition: asmenum.c:33
EXTERN_C const IID IID_INetLanConnectionUiInfo
Definition: netcfgn.h:186
#define INetLanConnectionUiInfo_GetDeviceGuid(p, a)
Definition: netcfgn.h:183

◆ INetCfgComponentPropertyUi_fnRelease()

ULONG WINAPI INetCfgComponentPropertyUi_fnRelease ( INetCfgComponentPropertyUi *  iface)

Definition at line 2841 of file tcpipconf_notify.c.

2843{
2844 TRACE("INetCfgComponentPropertyUi_fnRelease()\n");
2846 return INetCfgComponentControl_Release((INetCfgComponentControl*)This);
2847}
#define INetCfgComponentControl_Release(p)
Definition: netcfgn.h:158

◆ INetCfgComponentPropertyUi_fnSetContext()

HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2875 of file tcpipconf_notify.c.

2878{
2879 TRACE("INetCfgComponentPropertyUi_fnSetContext()\n");
2881
2882 if (!iface || !pUnkReserved)
2883 return E_POINTER;
2884
2885 This->pUnknown = pUnkReserved;
2886 return S_OK;
2887}
#define E_POINTER
Definition: winerror.h:3480

◆ INetCfgComponentPropertyUi_fnValidateProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties ( INetCfgComponentPropertyUi *  iface,
HWND  hwndDlg 
)

Definition at line 3196 of file tcpipconf_notify.c.

3199{
3200MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnValidateProperties", NULL, MB_OK);
3201 return S_OK;
3202}

◆ INetCfgComponentSetup_fnAddRef()

ULONG WINAPI INetCfgComponentSetup_fnAddRef ( INetCfgComponentSetup *  iface)

Definition at line 3709 of file tcpipconf_notify.c.

3711{
3712 TRACE("INetCfgComponentSetup_fnAddRef()\n");
3714 return INetCfgComponentControl_AddRef((INetCfgComponentControl*)This);
3715}
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentSetup(INetCfgComponentSetup *iface)

◆ INetCfgComponentSetup_fnInstall()

HRESULT WINAPI INetCfgComponentSetup_fnInstall ( INetCfgComponentSetup *  iface,
DWORD  dwSetupFlags 
)

Definition at line 3729 of file tcpipconf_notify.c.

3732{
3733 TRACE("INetCfgComponentSetup_fnInstall()\n");
3734 return S_OK;
3735}

◆ INetCfgComponentSetup_fnQueryInterface()

HRESULT WINAPI INetCfgComponentSetup_fnQueryInterface ( INetCfgComponentSetup *  iface,
REFIID  iid,
LPVOID ppvObj 
)

Definition at line 3697 of file tcpipconf_notify.c.

3701{
3702 TRACE("INetCfgComponentSetup_fnQueryInterface()\n");
3704 return INetCfgComponentControl_QueryInterface((INetCfgComponentControl*)This, iid, ppvObj);
3705}

◆ INetCfgComponentSetup_fnReadAnswerFile()

HRESULT WINAPI INetCfgComponentSetup_fnReadAnswerFile ( INetCfgComponentSetup *  iface,
LPCWSTR  pszwAnswerFile,
LPCWSTR  pszwAnswerSections 
)

Definition at line 3750 of file tcpipconf_notify.c.

3754{
3755 TRACE("INetCfgComponentSetup_fnReadAnswerFile()\n");
3756 return S_OK;
3757}

◆ INetCfgComponentSetup_fnRelease()

ULONG WINAPI INetCfgComponentSetup_fnRelease ( INetCfgComponentSetup *  iface)

Definition at line 3719 of file tcpipconf_notify.c.

3721{
3722 TRACE("INetCfgComponentSetup_fnRelease()\n");
3724 return INetCfgComponentControl_Release((INetCfgComponentControl*)This);
3725}

◆ INetCfgComponentSetup_fnRemoving()

HRESULT WINAPI INetCfgComponentSetup_fnRemoving ( INetCfgComponentSetup *  iface)

Definition at line 3761 of file tcpipconf_notify.c.

3763{
3764 TRACE("INetCfgComponentSetup_fnRemoving()\n");
3765 return S_OK;
3766}

◆ INetCfgComponentSetup_fnUpgrade()

HRESULT WINAPI INetCfgComponentSetup_fnUpgrade ( INetCfgComponentSetup *  iface,
DWORD  dwSetupFlags,
DWORD  dwUpgradeFromBuildNo 
)

Definition at line 3739 of file tcpipconf_notify.c.

3743{
3744 TRACE("INetCfgComponentSetup_fnUpgrade()\n");
3745 return S_OK;
3746}

◆ InitFilterListBox()

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

Definition at line 238 of file tcpipconf_notify.c.

239{
240 LVITEMW li;
241 LPWSTR pCur;
242 INT iItem;
243
244 if (!pData || !_wtoi(pData))
245 {
246 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
248 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
249 return;
250 }
251
252 pCur = pData;
253 memset(&li, 0x0, sizeof(LVITEMW));
254 li.mask = LVIF_TEXT;
255 iItem = 0;
256
257 while(pCur[0])
258 {
259 li.pszText = pCur;
260 li.iItem = iItem;
261 SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
262 iItem++;
263 pCur += wcslen(pCur) + 1;
264 }
265
266 if (!iItem)
267 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
268 else
269 CheckDlgButton(hwndDlg, RestrictButton, BST_CHECKED);
270}
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
Definition: wordpad.c:155
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by TcpipFilterSettingsDlg().

◆ Initialize()

HRESULT Initialize ( TcpipConfNotifyImpl This)

Definition at line 3021 of file tcpipconf_notify.c.

3022{
3024 WCHAR szBuffer[50];
3025 IP_ADAPTER_INFO * pCurrentAdapter;
3026 IP_ADAPTER_INFO * pInfo;
3027 PIP_PER_ADAPTER_INFO pPerInfo;
3029 LPOLESTR pStr;
3030 HRESULT hr;
3031 BOOL bFound;
3032 TcpipSettings * pCurSettings;
3033 ULONG uLength;
3034
3035 if (This->pCurrentConfig)
3036 return S_OK;
3037
3038 hr = StringFromCLSID(&This->NetCfgInstanceId, &pStr);
3039 if (FAILED(hr))
3040 return hr;
3041
3042
3043 dwSize = 0;
3045 {
3046 CoTaskMemFree(pStr);
3047 return E_FAIL;
3048 }
3049
3050 pInfo = CoTaskMemAlloc(dwSize);
3051 if (!pInfo)
3052 {
3053 CoTaskMemFree(pStr);
3054 return E_FAIL;
3055 }
3056
3057 if (GetAdaptersInfo(pInfo, &dwSize) != ERROR_SUCCESS)
3058 {
3059 CoTaskMemFree(pStr);
3060 CoTaskMemFree(pInfo);
3061 return E_FAIL;
3062 }
3063
3064 pCurrentAdapter = pInfo;
3065 bFound = FALSE;
3066 while(pCurrentAdapter)
3067 {
3068 szBuffer[0] = L'\0';
3069 if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
3070 {
3071 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
3072 }
3073 if (!_wcsicmp(szBuffer, pStr))
3074 {
3075 bFound = TRUE;
3076 break;
3077 }
3078 pCurrentAdapter = pCurrentAdapter->Next;
3079 }
3080 CoTaskMemFree(pStr);
3081
3082 if (!bFound)
3083 {
3084 CoTaskMemFree(pInfo);
3085 return E_FAIL;
3086 }
3087
3088 pCurSettings = CoTaskMemAlloc(sizeof(TcpipSettings));
3089 if (!pCurSettings)
3090 {
3091 CoTaskMemFree(pInfo);
3092 return E_FAIL;
3093 }
3094
3095 ZeroMemory(pCurSettings, sizeof(TcpipSettings));
3096 This->pCurrentConfig = pCurSettings;
3097 pCurSettings->DhcpEnabled = pCurrentAdapter->DhcpEnabled;
3098 pCurSettings->Index = pCurrentAdapter->Index;
3099
3100 if (!pCurrentAdapter->DhcpEnabled)
3101 {
3102 CopyIpAddrString(&pCurrentAdapter->IpAddressList, &pCurSettings->Ip, SUBMASK, NULL);
3103 }
3104
3105 CopyIpAddrString(&pCurrentAdapter->GatewayList, &pCurSettings->Gw, METRIC, NULL);
3106
3107 uLength = sizeof(IP_PER_ADAPTER_INFO);
3109
3110 if (GetPerAdapterInfo(pCurrentAdapter->Index, &Info, &uLength) == ERROR_BUFFER_OVERFLOW)
3111 {
3112 pPerInfo = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(uLength);
3113 if (pPerInfo)
3114 {
3115 Status = GetPerAdapterInfo(pCurrentAdapter->Index, pPerInfo, &uLength);
3116 if (Status == NOERROR)
3117 {
3118 if (!pPerInfo->AutoconfigActive)
3119 {
3120 CopyIpAddrString(&pPerInfo->DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
3121 }
3122 pCurSettings->AutoconfigActive = pPerInfo->AutoconfigActive;
3123 }
3124 CoTaskMemFree(pPerInfo);
3125 }
3126 }
3127 else
3128 {
3129 if (!Info.AutoconfigActive)
3130 {
3131 CopyIpAddrString(&Info.DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
3132 }
3133 pCurSettings->AutoconfigActive = Info.AutoconfigActive;
3134 }
3135
3137 return E_FAIL;
3138
3140 return E_FAIL;
3141
3142 CoTaskMemFree(pInfo);
3143
3144 return S_OK;
3145}
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
Status
Definition: gdiplustypes.h:25
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
IP_PER_ADAPTER_INFO_W2KSP1 * PIP_PER_ADAPTER_INFO
Definition: iptypes.h:70
IP_PER_ADAPTER_INFO_W2KSP1 IP_PER_ADAPTER_INFO
Definition: iptypes.h:69
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:42
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:52
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:44
IP_ADDR_STRING GatewayList
Definition: iptypes.h:53
UINT DhcpEnabled
Definition: iptypes.h:50
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:66
HRESULT CopyIpAddrString(IP_ADDR_STRING *pSrc, IP_ADDR **pTarget, COPY_TYPE Type, LPWSTR szMetric)
HRESULT LoadFilterSettings(TcpipConfNotifyImpl *This)
HRESULT LoadDNSSettings(TcpipConfNotifyImpl *This)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:307
#define NOERROR
Definition: winerror.h:3448

◆ InitializePropertySheetPage()

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

Definition at line 521 of file tcpipconf_notify.c.

522{
523 PROPSHEETPAGEW ppage;
524
525 memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW));
526 ppage.dwSize = sizeof(PROPSHEETPAGEW);
527 ppage.dwFlags = PSP_DEFAULT;
528 ppage.u.pszTemplate = resname;
529 ppage.pfnDlgProc = dlgproc;
530 ppage.lParam = lParam;
532 if (szTitle)
533 {
534 ppage.dwFlags |= PSP_USETITLE;
535 ppage.pszTitle = szTitle;
536 }
537 return CreatePropertySheetPageW(&ppage);
538}
LPARAM lParam
Definition: combotst.c:139
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3086
#define PSP_USETITLE
Definition: prsht.h:26
#define PSP_DEFAULT
Definition: prsht.h:22
struct _PROPSHEETPAGEW PROPSHEETPAGEW
DLGPROC pfnDlgProc
Definition: prsht.h:226
DWORD dwSize
Definition: prsht.h:214
DWORD dwFlags
Definition: prsht.h:215
LPARAM lParam
Definition: prsht.h:227
LPCWSTR pszTemplate
Definition: prsht.h:218
LPCWSTR pszTitle
Definition: prsht.h:225
HINSTANCE hInstance
Definition: prsht.h:216

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

◆ InitializeTcpipAdvancedDNSDlg()

VOID InitializeTcpipAdvancedDNSDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 1600 of file tcpipconf_notify.c.

1603{
1604 WCHAR szBuffer[200];
1605 LPWSTR pFirst, pSep, pList;
1606 IP_ADDR * pAddr;
1607 DWORD dwIpAddr;
1608
1609 /* insert DNS addresses */
1610 pAddr = This->pCurrentConfig->Ns;
1611 while(pAddr)
1612 {
1613 dwIpAddr = pAddr->IpAddress;
1614 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1615 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1616
1617 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_ADDSTRING, 0, (LPARAM)szBuffer);
1618 pAddr = pAddr->Next;
1619 }
1621
1622 if (!This->pCurrentConfig->pDNS)
1623 return;
1624
1625 if (This->pCurrentConfig->pDNS->RegisterAdapterName)
1627 else
1629
1630 if (This->pCurrentConfig->pDNS->RegistrationEnabled)
1632
1633 if (This->pCurrentConfig->pDNS->szDomain[0])
1634 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)szBuffer);
1635
1636 if (This->pCurrentConfig->pDNS->UseDomainNameDevolution)
1638
1639 if (!This->pCurrentConfig->pDNS->szSearchList || (wcslen(This->pCurrentConfig->pDNS->szSearchList) == 0))
1640 {
1643
1644 return;
1645 }
1646
1647 pList = This->pCurrentConfig->pDNS->szSearchList;
1648 if (wcslen(pList))
1649 {
1650 pFirst = pList;
1651 do
1652 {
1653 pSep = wcschr(pFirst, L',');
1654 if (pSep)
1655 {
1656 pSep[0] = L'\0';
1658 pFirst = pSep + 1;
1659 pSep[0] = L',';
1660 }
1661 else
1662 {
1664 break;
1665 }
1666 }while(TRUE);
1667
1671 }
1672}
#define IDC_DNSSUFFIXLIST
Definition: resource.h:58
#define IDC_SUFFIX
Definition: resource.h:64
#define IDC_USESUFFIX
Definition: resource.h:66
#define IDC_REGSUFFIX
Definition: resource.h:65
#define IDC_PRIMSUFFIX
Definition: resource.h:55
#define IDC_SELSUFFIX
Definition: resource.h:57
#define IDC_DNSADDRLIST
Definition: resource.h:49
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:56
#define IDC_DNSSUFFIXADD
Definition: resource.h:61
FxChildList * pList
#define LB_ADDSTRING
Definition: winuser.h:2060
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1645
#define LB_SETCURSEL
Definition: winuser.h:2099

Referenced by TcpipAdvancedDnsDlg().

◆ InitializeTcpipAdvancedIpDlg()

VOID InitializeTcpipAdvancedIpDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 677 of file tcpipconf_notify.c.

680{
681 RECT rect;
682 LVITEMW li;
683 WCHAR szBuffer[100];
684
687 InsertColumnToListView(GetDlgItem(hwndDlg, IDC_IPLIST), IDS_SUBMASK, 1, (rect.right - rect.left - 100));
688
689 if (This->pCurrentConfig->DhcpEnabled)
690 {
691 if (LoadStringW(netcfgx_hInstance, IDS_DHCPACTIVE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
692 {
693 ZeroMemory(&li, sizeof(LVITEMW));
694 li.mask = LVIF_TEXT;
695 li.pszText = szBuffer;
697 }
699 }
700 else
701 {
702 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_IPLIST), This->pCurrentConfig->Ip, TRUE);
703 }
704
707
710 InsertColumnToListView(GetDlgItem(hwndDlg, IDC_GWLIST), IDS_METRIC, 1, (rect.right - rect.left - 100));
711
712 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_GWLIST), This->pCurrentConfig->Gw, FALSE);
713
716
718 if (This->pCurrentConfig->Metric)
719 {
721 SetDlgItemInt(hwndDlg, IDC_IFMETRIC, This->pCurrentConfig->Metric, FALSE);
722 }
723 else
724 {
727 }
728}
#define IDS_METRIC
Definition: resource.h:77
#define IDC_IPDEL
Definition: resource.h:37
#define IDC_GWDEL
Definition: resource.h:41
#define IDS_SUBMASK
Definition: resource.h:105
#define IDC_IPLIST
Definition: resource.h:34
#define IDC_GWMOD
Definition: resource.h:40
#define IDS_DHCPACTIVE
Definition: resource.h:108
#define IDS_GATEWAY
Definition: resource.h:106
#define IDC_IPADD
Definition: resource.h:35
#define IDC_IPMOD
Definition: resource.h:36
#define IDS_IPADDR
Definition: resource.h:104
#define IDC_IFAUTOMETRIC
Definition: resource.h:42
#define IDC_GWLIST
Definition: resource.h:38
#define IDC_IFMETRIC
Definition: resource.h:43
& rect
Definition: startmenu.cpp:1413
VOID InsertIpAddressToListView(HWND hDlgCtrl, IP_ADDR *pAddr, BOOL bSubMask)
VOID InsertColumnToListView(HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size)
#define EM_LIMITTEXT
Definition: winuser.h:2029
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)

Referenced by TcpipAdvancedIpDlg().

◆ InitializeTcpipAdvancedOptDlg()

VOID InitializeTcpipAdvancedOptDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 546 of file tcpipconf_notify.c.

549{
550 WCHAR szText[500];
551 /* store context */
553
554 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTER, szText, sizeof(szText)/sizeof(WCHAR)))
555 {
556 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
557 if (SendDlgItemMessageW(hwndDlg, IDC_OPTLIST, LB_ADDSTRING, 0, (LPARAM)szText) != LB_ERR)
559 }
560
561 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTERDESC, szText, sizeof(szText)/sizeof(WCHAR)))
562 {
563 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
564 SendDlgItemMessageW(hwndDlg, IDC_OPTDESC, WM_SETTEXT, 0, (LPARAM)szText);
565 }
566}
#define IDS_TCPFILTERDESC
Definition: resource.h:102
#define IDC_OPTLIST
Definition: resource.h:68
#define IDS_TCPFILTER
Definition: resource.h:103
#define IDC_OPTDESC
Definition: resource.h:70
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_USER
Definition: winuser.h:883

Referenced by TcpipAdvancedOptDlg().

◆ InitializeTcpipAltDlgCtrls()

HRESULT InitializeTcpipAltDlgCtrls ( HWND  hwndDlg,
TcpipSettings pCurSettings 
)

Definition at line 2175 of file tcpipconf_notify.c.

2178{
2183
2188
2193
2198
2203
2204 if (pCurSettings->DhcpEnabled)
2205 {
2212 }
2213 else
2214 {
2216
2217 if (pCurSettings->Ip)
2218 {
2219 /* Set current ip address */
2220 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2221 /* Set current hostmask */
2222 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2223 }
2224
2225 if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2226 {
2227 /* Set current gateway */
2228 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2229 }
2230
2231 if (pCurSettings->Ns)
2232 {
2233 /* Set name server addresses */
2234 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2235 if (pCurSettings->Ns->Next)
2236 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2237 }
2238 }
2239
2240 return S_OK;
2241}
#define IDC_NODHCP
Definition: resource.h:24
#define IDC_DNS1
Definition: resource.h:30
#define IDC_USEDHCP
Definition: resource.h:23
#define IDC_SUBNETMASK
Definition: resource.h:26
#define IDC_DNS2
Definition: resource.h:31
#define IDC_DEFGATEWAY
Definition: resource.h:27
#define IDC_IPADDR
Definition: resource.h:25
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4489
#define IPM_SETADDRESS
Definition: commctrl.h:4471
#define IPM_SETRANGE
Definition: commctrl.h:4473
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by TcpipAltConfDlg().

◆ InitializeTcpipBasicDlgCtrls()

HRESULT InitializeTcpipBasicDlgCtrls ( HWND  hwndDlg,
TcpipSettings pCurSettings 
)

Definition at line 2473 of file tcpipconf_notify.c.

2476{
2481
2486
2491
2496
2501
2502 if (pCurSettings->DhcpEnabled)
2503 {
2509 }
2510 else
2511 {
2513
2514 if (pCurSettings->Ip)
2515 {
2516 /* set current ip address */
2517 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2518 /* set current hostmask */
2519 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2520 }
2521
2522 if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2523 {
2524 /* set current gateway */
2525 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2526 }
2527 }
2528
2529 if (pCurSettings->AutoconfigActive)
2530 {
2534 }
2535 else
2536 {
2540 if (pCurSettings->Ns)
2541 {
2542 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2543 if (pCurSettings->Ns->Next)
2544 {
2545 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2546 }
2547 else
2548 {
2550 }
2551 }
2552 else
2553 {
2556 }
2557 }
2558
2559 return S_OK;
2560}
#define IDC_FIXEDDNS
Definition: resource.h:29
#define IDC_AUTODNS
Definition: resource.h:28
#define IPM_CLEARADDRESS
Definition: commctrl.h:4470

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ InsertColumnToListView()

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

Definition at line 604 of file tcpipconf_notify.c.

609{
610 WCHAR szBuffer[200];
611 LVCOLUMNW lc;
612
613 if (!LoadStringW(netcfgx_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
614 return;
615
616 memset(&lc, 0, sizeof(LV_COLUMN) );
618 lc.iSubItem = SubItem;
619 lc.fmt = LVCFMT_FIXED_WIDTH;
620 lc.cx = Size;
621 lc.cchTextMax = wcslen(szBuffer);
622 lc.pszText = szBuffer;
623
624 (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, SubItem, (LPARAM)&lc);
625}
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2637
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LV_COLUMN
Definition: commctrl.h:2552
int cchTextMax
Definition: commctrl.h:2573
LPWSTR pszText
Definition: commctrl.h:2572

Referenced by InitializeTcpipAdvancedIpDlg(), and TcpipFilterSettingsDlg().

◆ InsertIpAddressToListView()

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

Definition at line 628 of file tcpipconf_notify.c.

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

Referenced by InitializeTcpipAdvancedIpDlg().

◆ LaunchAdvancedTcpipSettings()

VOID LaunchAdvancedTcpipSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2136 of file tcpipconf_notify.c.

2139{
2140 PROPSHEETHEADERW pinfo;
2141 HPROPSHEETPAGE hppages[3];
2142 WCHAR szBuffer[100];
2143
2147
2148
2149 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
2150 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2151 else
2152 szBuffer[0] = L'\0';
2153
2154 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
2155 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
2156 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
2158 pinfo.u3.phpage = hppages;
2159 pinfo.nPages = 3;
2160 pinfo.hwndParent = hwndDlg;
2162 pinfo.pszCaption = szBuffer;
2164 pinfo.pfnCallback = PropSheetProc;
2165
2167 if (PropertySheetW(&pinfo) > 0)
2168 {
2169 InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2170 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2171 }
2172}
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
#define IDD_TCPIP_ADVOPT_DLG
Definition: resource.h:12
#define IDD_TCPIP_ADVIP_DLG
Definition: resource.h:10
#define IDD_TCPIP_ADVDNS_DLG
Definition: resource.h:11
#define IDI_NETWORK
Definition: resource.h:4
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSH_USEICONID
Definition: prsht.h:42
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
LPCWSTR pszIcon
Definition: prsht.h:299
HWND hwndParent
Definition: prsht.h:295
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
LPCWSTR pszCaption
Definition: prsht.h:301
HRESULT InitializeTcpipBasicDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
INT_PTR CALLBACK TcpipAdvancedDnsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR CALLBACK TcpipAdvancedOptDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR StoreTcpipBasicSettings(HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)
INT_PTR CALLBACK TcpipAdvancedIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND WINAPI GetParent(_In_ HWND)

Referenced by TcpipBasicDlg().

◆ LoadDNSSettings()

HRESULT LoadDNSSettings ( TcpipConfNotifyImpl This)

Definition at line 2890 of file tcpipconf_notify.c.

2892{
2893 LPOLESTR pStr;
2894 WCHAR szBuffer[200];
2895 HKEY hKey;
2896 DWORD dwSize;
2897
2898
2900 if (!This->pCurrentConfig->pDNS)
2901 return E_FAIL;
2902
2903 ZeroMemory(This->pCurrentConfig->pDNS, sizeof(TcpipAdvancedDNSDlgSettings));
2904
2905 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2906 return E_FAIL;
2907
2908 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2909 CoTaskMemFree(pStr);
2911 {
2912 dwSize = sizeof(DWORD);
2913 RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, &dwSize);
2914
2915 dwSize = sizeof(DWORD);
2916 RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, &dwSize);
2917
2918 dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain);
2919 RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szDomain, &dwSize);
2920
2921 dwSize = sizeof(DWORD);
2922 if (RegQueryValueExW(hKey, L"InterfaceMetric", NULL, NULL, (LPBYTE)&This->pCurrentConfig->Metric, &dwSize) != ERROR_SUCCESS)
2923 This->pCurrentConfig->Metric = 0;
2924
2926 }
2927
2928 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2929 {
2930 dwSize = sizeof(DWORD);
2931 RegQueryValueExW(hKey, L"UseDomainNameDevolution", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->UseDomainNameDevolution, &dwSize);
2932
2933 dwSize = 0;
2934 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, NULL, &dwSize) == ERROR_SUCCESS)
2935 {
2936 This->pCurrentConfig->pDNS->szSearchList = (LPWSTR)CoTaskMemAlloc(dwSize);
2937 if (This->pCurrentConfig->pDNS->szSearchList)
2938 {
2939 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szSearchList, &dwSize) != ERROR_SUCCESS)
2940 {
2941 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
2942 This->pCurrentConfig->pDNS->szSearchList = NULL;
2943 }
2944 }
2945 }
2947 }
2948 return S_OK;
2949}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define KEY_READ
Definition: nt_native.h:1026
#define DWORD
Definition: nt_native.h:44

Referenced by Initialize().

◆ LoadFilterSettings()

HRESULT LoadFilterSettings ( TcpipConfNotifyImpl This)

Definition at line 2974 of file tcpipconf_notify.c.

2976{
2977 HKEY hKey;
2978 TcpFilterSettings *pFilter;
2979 WCHAR szBuffer[200];
2980 LPOLESTR pStr;
2981 DWORD dwVal, dwSize;
2982
2984 if (!pFilter)
2985 return E_FAIL;
2986
2987 ZeroMemory(pFilter, sizeof(TcpFilterSettings));
2988 This->pCurrentConfig->pFilter = pFilter;
2989
2990
2991 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2992 {
2993 dwSize = sizeof(DWORD);
2994 if (RegQueryValueExW(hKey, L"EnableSecurityFilters", NULL, NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
2995 pFilter->EnableSecurityFilters = dwVal;
2997 }
2998 else
2999 {
3000 pFilter->EnableSecurityFilters = FALSE;
3001 }
3002
3003 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
3004 return E_FAIL;
3005
3006 swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
3007 CoTaskMemFree(pStr);
3009 {
3010 return S_OK;
3011 }
3012 pFilter->szTCPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"TCPAllowedPorts", &pFilter->TCPSize);
3013 pFilter->szUDPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"UDPAllowedPorts", &pFilter->UDPSize);
3014 pFilter->szRawIPAllowedProtocols = LoadTcpFilterSettingsFromRegistry(hKey, L"RawIPAllowedProtocols", &pFilter->IPSize);
3016 return S_OK;
3017}
LPWSTR LoadTcpFilterSettingsFromRegistry(HKEY hKey, LPCWSTR szName, LPDWORD Size)

Referenced by Initialize().

◆ LoadTcpFilterSettingsFromRegistry()

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

Definition at line 2952 of file tcpipconf_notify.c.

2953{
2954 DWORD dwSize;
2955 LPWSTR pData;
2956
2958 return NULL;
2959
2961 if (!pData)
2962 return NULL;
2963
2965 {
2967 return NULL;
2968 }
2969 *Size = dwSize;
2970 return pData;
2971}
static const WCHAR szName[]
Definition: powrprof.c:45

Referenced by LoadFilterSettings().

◆ MoveItem()

VOID MoveItem ( HWND  hDlgCtrl,
INT  pos 
)

Definition at line 1709 of file tcpipconf_notify.c.

1712{
1713 WCHAR szBuffer[100];
1714 LRESULT lResult;
1715
1716 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1717 if (lResult != LB_ERR)
1718 {
1719 if (SendMessageW(hDlgCtrl, LB_GETTEXTLEN, (WPARAM)lResult, 0) < sizeof(szBuffer)/sizeof(WCHAR) - 1)
1720 {
1721 if (SendMessageW(hDlgCtrl, LB_GETTEXT, (WPARAM)lResult, (LPARAM)szBuffer) != LB_ERR)
1722 {
1723 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1724 SendMessageW(hDlgCtrl, LB_INSERTSTRING, (WPARAM)lResult + pos, (LPARAM)szBuffer);
1725 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult + pos, 0);
1726 }
1727 }
1728 }
1729}
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define LB_DELETESTRING
Definition: winuser.h:2061
#define LB_INSERTSTRING
Definition: winuser.h:2089
#define LB_GETCURSEL
Definition: winuser.h:2068

Referenced by TcpipAdvancedDnsDlg().

◆ PropSheetProc()

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

Definition at line 2119 of file tcpipconf_notify.c.

2120{
2121 // NOTE: This callback is needed to set large icon correctly.
2122 HICON hIcon;
2123 switch (uMsg)
2124 {
2125 case PSCB_INITIALIZED:
2126 {
2128 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
2129 break;
2130 }
2131 }
2132 return 0;
2133}
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ICON_BIG
Definition: tnclass.cpp:51
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444

Referenced by LaunchAdvancedTcpipSettings().

◆ RemoveItem()

VOID RemoveItem ( HWND  hDlgCtrl)

Definition at line 1731 of file tcpipconf_notify.c.

1733{
1734 LRESULT lResult, lCount;
1735
1736 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1737 if (lResult != LB_ERR)
1738 {
1739 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1740 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1741 if (lResult + 1 < lCount)
1742 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult, 0);
1743 else
1744 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lCount-1, 0);
1745 }
1746}

Referenced by TcpipAdvancedDnsDlg().

◆ StoreDNSSettings()

VOID StoreDNSSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This 
)

Definition at line 1798 of file tcpipconf_notify.c.

1801{
1802 INT iCount, iIndex;
1803 WCHAR Ip[16];
1804 IP_ADDR *pCur, *pLast;
1805
1806 FreeIPAddr(This->pCurrentConfig->Ns);
1807 This->pCurrentConfig->Ns = NULL;
1808
1809 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1810 if (!iCount || iCount == LB_ERR)
1811 {
1812 return;
1813 }
1814
1815 pLast = NULL;
1816 for(iIndex = 0; iIndex < iCount; iIndex++)
1817 {
1818 if (SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)Ip) == LB_ERR)
1819 break;
1820
1821 pCur = CoTaskMemAlloc(sizeof(IP_ADDR));
1822 if (!pCur)
1823 break;
1824 ZeroMemory(pCur, sizeof(IP_ADDR));
1825 pCur->IpAddress = GetIpAddressFromStringW(Ip);
1826
1827 if (!pLast)
1828 This->pCurrentConfig->Ns = pCur;
1829 else
1830 pLast->Next = pCur;
1831
1832 pLast = pCur;
1833 pCur = pCur->Next;
1834 }
1835 This->pCurrentConfig->AutoconfigActive = FALSE;
1836}
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:641
VOID FreeIPAddr(IP_ADDR *pAddr)

Referenced by TcpipAdvancedDnsDlg().

◆ StoreIPSettings()

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

Definition at line 1221 of file tcpipconf_notify.c.

1225{
1226 WCHAR szBuffer[30];
1227
1228 INT iIndex, iCount;
1229 IP_ADDR *pCur, *pLast;
1230
1231 iCount = ListView_GetItemCount(hDlgCtrl);
1232 if (!iCount)
1233 {
1234 return;
1235 }
1236
1237 pLast = NULL;
1238 for(iIndex = 0; iIndex < iCount; iIndex++)
1239 {
1240 if (GetListViewItem(hDlgCtrl, iIndex, 0, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1241 {
1242 pCur = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
1243 if (!pCur)
1244 break;
1245 ZeroMemory(pCur, sizeof(IP_ADDR));
1246
1247 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1248 pCur->IpAddress = GetIpAddressFromStringW(szBuffer);
1249
1250 if (GetListViewItem(hDlgCtrl, iIndex, 1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR) ))
1251 {
1252 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1253 if (bSubmask)
1254 pCur->u.Subnetmask = GetIpAddressFromStringW(szBuffer);
1255 else
1256 pCur->u.Metric = _wtoi(szBuffer);
1257 }
1258
1259 if (!pLast)
1260 {
1261 if (bSubmask)
1262 This->pCurrentConfig->Ip = pCur;
1263 else
1264 This->pCurrentConfig->Gw = pCur;
1265 }
1266 else
1267 {
1268 pLast->Next = pCur;
1269 }
1270
1271 pLast = pCur;
1272 }
1273 }
1274}
BOOL GetListViewItem(HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)

Referenced by TcpipAdvancedIpDlg().

◆ StoreTcpipBasicSettings()

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

Definition at line 2317 of file tcpipconf_notify.c.

2321{
2322 DWORD dwIpAddr;
2323
2324 if (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED)
2325 {
2326 This->pCurrentConfig->DhcpEnabled = FALSE;
2327 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2328 {
2329 if (bApply)
2330 {
2332 SetFocus(GetDlgItem(hwndDlg, IDC_IPADDR));
2333 return E_FAIL;
2334 }
2335 }
2336 if (!This->pCurrentConfig->Ip)
2337 {
2338 This->pCurrentConfig->Ip = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2339 if (!This->pCurrentConfig->Ip)
2340 return E_OUTOFMEMORY;
2341 ZeroMemory(This->pCurrentConfig->Ip, sizeof(IP_ADDR));
2342 }
2343 This->pCurrentConfig->Ip->IpAddress = dwIpAddr;
2344
2345 if (SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2346 {
2347 if (bApply)
2349 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2350 {
2351 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2352 dwIpAddr = MAKEIPADDRESS(255, 0, 0, 0);
2353 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2354 dwIpAddr = MAKEIPADDRESS(255, 255, 0, 0);
2355 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2356 dwIpAddr = MAKEIPADDRESS(255, 255, 255, 0);
2357
2359 }
2360 if (bApply)
2361 {
2363 return E_FAIL;
2364 }
2365 }
2366 /* store subnetmask */
2367 This->pCurrentConfig->Ip->u.Subnetmask = dwIpAddr;
2368 }
2369 else
2370 {
2371 This->pCurrentConfig->DhcpEnabled = TRUE;
2372 }
2373
2374 if (SendDlgItemMessageW(hwndDlg, IDC_DEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2375 {
2376 if (!This->pCurrentConfig->Gw)
2377 {
2378 This->pCurrentConfig->Gw = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2379 if (!This->pCurrentConfig->Gw)
2380 return E_OUTOFMEMORY;
2381 ZeroMemory(This->pCurrentConfig->Gw, sizeof(IP_ADDR));
2382 }
2383 /* store default gateway */
2384 This->pCurrentConfig->Gw->IpAddress = dwIpAddr;
2385 }
2386 else
2387 {
2388 if (This->pCurrentConfig->Gw)
2389 {
2390 IP_ADDR * pNextGw = This->pCurrentConfig->Gw->Next;
2391 CoTaskMemFree(This->pCurrentConfig->Gw);
2392 This->pCurrentConfig->Gw = pNextGw;
2393 }
2394 }
2395
2397 {
2398 BOOL bSkip = FALSE;
2399 This->pCurrentConfig->AutoconfigActive = FALSE;
2400 if (SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2401 {
2402 if (!This->pCurrentConfig->Ns)
2403 {
2404 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2405 if (!This->pCurrentConfig->Ns)
2406 return E_OUTOFMEMORY;
2407 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2408 }
2409 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2410 }
2411 else if (This->pCurrentConfig->Ns)
2412 {
2413 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next;
2414
2415 CoTaskMemFree(This->pCurrentConfig->Ns);
2416 This->pCurrentConfig->Ns = pTemp;
2417 bSkip = TRUE;
2418 }
2419
2420
2421 if (SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2422 {
2423 if (!This->pCurrentConfig->Ns || bSkip)
2424 {
2425 if (!This->pCurrentConfig->Ns)
2426 {
2427 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2428 if (!This->pCurrentConfig->Ns)
2429 return E_OUTOFMEMORY;
2430 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2431 }
2432 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2433 }
2434 else if (!This->pCurrentConfig->Ns->Next)
2435 {
2436 This->pCurrentConfig->Ns->Next = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2437 if (!This->pCurrentConfig->Ns->Next)
2438 return E_OUTOFMEMORY;
2439 ZeroMemory(This->pCurrentConfig->Ns->Next, sizeof(IP_ADDR));
2440 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2441 }
2442 else
2443 {
2444 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2445 }
2446 }
2447 else
2448 {
2449 if (This->pCurrentConfig->Ns && This->pCurrentConfig->Ns->Next)
2450 {
2451 if (This->pCurrentConfig->Ns->Next->Next)
2452 {
2453 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next->Next;
2454 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2455 This->pCurrentConfig->Ns->Next = pTemp;
2456 }
2457 else
2458 {
2459 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2460 This->pCurrentConfig->Ns->Next = NULL;
2461 }
2462 }
2463 }
2464 }
2465 else
2466 {
2467 This->pCurrentConfig->AutoconfigActive = TRUE;
2468 }
2469 return S_OK;
2470}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define IDS_NO_SUBMASK_SET
Definition: resource.h:101
#define IDS_NO_IPADDR_SET
Definition: resource.h:100
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4491
#define IPM_GETADDRESS
Definition: commctrl.h:4472
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ StoreTcpipFilterSettings()

TcpFilterSettings * StoreTcpipFilterSettings ( HWND  hwndDlg)

Definition at line 322 of file tcpipconf_notify.c.

324{
325 TcpFilterSettings * pFilter;
326
327 pFilter = CoTaskMemAlloc(sizeof(TcpFilterSettings));
328 if (!pFilter)
329 return NULL;
330
332 pFilter->EnableSecurityFilters = TRUE;
333 else
334 pFilter->EnableSecurityFilters = FALSE;
335
336 pFilter->szTCPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_TCP_LIST), &pFilter->TCPSize);
337 pFilter->szUDPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_UDP_LIST), &pFilter->UDPSize);
339
340 return pFilter;
341}
#define IDC_USE_FILTER
Definition: resource.h:87
#define IDC_IP_LIST
Definition: resource.h:84
#define IDC_UDP_LIST
Definition: resource.h:79
#define IDC_TCP_LIST
Definition: resource.h:74
LPWSTR CreateFilterList(HWND hDlgCtrl, LPDWORD Size)

Referenced by TcpipFilterSettingsDlg().

◆ TcpipAddDNSDlg()

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

Definition at line 1519 of file tcpipconf_notify.c.

1525{
1526 TcpipDnsSettings * pSettings;
1527 WCHAR szBuffer[100];
1528 DWORD dwIpAddr;
1529 LPNMIPADDRESS lpnmipa;
1530
1531 switch(uMsg)
1532 {
1533 case WM_INITDIALOG:
1534 pSettings = (TcpipDnsSettings*)lParam;
1536 if (!pSettings->bAdd)
1537 {
1538 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1539 {
1540 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1541 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1542 }
1543 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_SETTEXT, 0, (LPARAM)pSettings->szIP);
1544 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1545 }
1546 else
1547 {
1548 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1549 {
1550 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1551 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1552 }
1553 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1554 }
1555 return TRUE;
1556 case WM_COMMAND:
1557 if (LOWORD(wParam) == IDCANCEL)
1558 {
1559 EndDialog(hwndDlg, FALSE);
1560 break;
1561 }
1562 else if (LOWORD(wParam) == IDC_OK)
1563 {
1564 pSettings = (TcpipDnsSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1565 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pSettings->szIP);
1566 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->szIP) == LB_ERR)
1567 {
1568 if (pSettings->bAdd)
1569 SendMessageW(pSettings->hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)pSettings->szIP);
1570 EndDialog(hwndDlg, TRUE);
1571 break;
1572 }
1573 if (!pSettings->bAdd)
1574 {
1575 EndDialog(hwndDlg, FALSE);
1576 break;
1577 }
1579 break;
1580 }
1581 break;
1582 case WM_NOTIFY:
1583 lpnmipa = (LPNMIPADDRESS) lParam;
1584 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1585 {
1586 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1587 {
1588 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1589 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1590 }
1591 }
1592 break;
1593 }
1594 return FALSE;
1595}
#define IDC_OK
Definition: resource.h:59
WPARAM wParam
Definition: combotst.c:138
#define IDS_ADD
Definition: resource.h:112
#define IDS_MOD
Definition: resource.h:113
#define IDS_DUP_SUFFIX
Definition: resource.h:124
#define LOWORD(l)
Definition: pedump.c:82
struct tagNMIPADDRESS * LPNMIPADDRESS
#define IPN_FIELDCHANGED
Definition: commctrl.h:4482
#define WM_NOTIFY
Definition: richedit.h:61
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:842
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_GETTEXT
Definition: winuser.h:1646
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_ICONERROR
Definition: winuser.h:798
#define LB_FINDSTRING
Definition: winuser.h:2063
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAddIpDlg()

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

Definition at line 888 of file tcpipconf_notify.c.

894{
895 LPNMIPADDRESS lpnmipa;
896 DWORD dwIpAddr;
897 TcpipIpSettings *pIpSettings;
898 WCHAR szBuffer[50];
900 LRESULT lResult;
901
902 switch(uMsg)
903 {
904 case WM_INITDIALOG:
905 pIpSettings = (TcpipIpSettings*)lParam;
907
916
917 if (pIpSettings->bAdd)
918 {
919 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
920 {
921 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
922 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
923 }
925 }
926 else
927 {
928 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
929 {
930 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
931 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
932 }
933
936 }
937 return TRUE;
938 case WM_NOTIFY:
939 lpnmipa = (LPNMIPADDRESS) lParam;
940 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
941 {
942 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
943 {
944 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
945 {
946 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
948 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
950 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
951 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
953 }
954 }
955 }
956 break;
957 case WM_COMMAND:
958 if (LOWORD(wParam) == IDC_OK)
959 {
960 pIpSettings = (TcpipIpSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
961 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pIpSettings->szIP);
962 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, WM_GETTEXT, 16, (LPARAM)pIpSettings->szMask);
963
964 ZeroMemory(&find, sizeof(LVFINDINFOW));
965 find.flags = LVFI_STRING;
966 find.psz = pIpSettings->szIP;
967 lResult = SendMessageW(pIpSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find);
968
969 if (lResult == -1)
970 {
971 EndDialog(hwndDlg, TRUE);
972 break;
973 }
974 else if (!pIpSettings->bAdd)
975 {
976 EndDialog(hwndDlg, FALSE);
977 break;
978 }
980 break;
981 }
982 else if (LOWORD(wParam) == IDCANCEL)
983 {
984 EndDialog(hwndDlg, FALSE);
985 }
986 break;
987 }
988 return FALSE;
989}
static TAGID TAGID find
Definition: db.cpp:156
#define IDS_DUP_IPADDR
Definition: resource.h:125
#define LVFI_STRING
Definition: commctrl.h:2442
#define LVM_FINDITEMW
Definition: commctrl.h:2471

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAddSuffixDlg()

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

Definition at line 1007 of file tcpipconf_notify.c.

1013{
1014 WCHAR szBuffer[100];
1015 TcpipSuffixSettings * pSettings;
1016 LRESULT lLength;
1017
1018 switch(uMsg)
1019 {
1020 case WM_INITDIALOG:
1021 pSettings = (TcpipSuffixSettings*)lParam;
1022 if (!pSettings->bAdd)
1023 {
1024 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)pSettings->Suffix);
1025 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1026 {
1027 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1028 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1029 }
1030 CoTaskMemFree(pSettings->Suffix);
1031 pSettings->Suffix = NULL;
1032 }
1033 else
1034 {
1035 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1036 {
1037 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1038 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1039 }
1040 }
1041 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSettings);
1042 return TRUE;
1043 case WM_COMMAND:
1044 if (LOWORD(wParam) == IDCANCEL)
1045 {
1046 EndDialog(hwndDlg, FALSE);
1047 break;
1048 }
1049 else if (LOWORD(wParam) == IDC_OK)
1050 {
1051 lLength = SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXTLENGTH, 0, 0);
1052 if (lLength)
1053 {
1054 pSettings = (TcpipSuffixSettings*) GetWindowLongPtr(hwndDlg, DWLP_USER);
1055 pSettings->Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1)* sizeof(WCHAR));
1056 if (pSettings->Suffix)
1057 {
1058 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, lLength + 1, (LPARAM)pSettings->Suffix);
1059 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->Suffix) != LB_ERR)
1060 {
1062 CoTaskMemFree(pSettings->Suffix);
1063 break;
1064 }
1065
1066 if (!VerifyDNSSuffix(pSettings->Suffix))
1067 {
1069 CoTaskMemFree(pSettings->Suffix);
1070 break;
1071 }
1072 EndDialog(hwndDlg, TRUE);
1073 }
1074 }
1075 break;
1076 }
1077 }
1078 return FALSE;
1079}
#define IDS_DOMAIN_SUFFIX
Definition: resource.h:122
BOOL VerifyDNSSuffix(LPWSTR szName)
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAdvancedDnsDlg()

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

Definition at line 1840 of file tcpipconf_notify.c.

1846{
1849 TcpipDnsSettings Dns;
1850 LRESULT lIndex, lLength;
1851 TcpipSuffixSettings Suffix;
1852 LPPSHNOTIFY lppsn;
1853 WCHAR szSuffix[100];
1854 WCHAR szFormat[200];
1855 WCHAR szBuffer[300];
1856
1857
1858 switch(uMsg)
1859 {
1860 case WM_INITDIALOG:
1862 This = (TcpipConfNotifyImpl*)page->lParam;
1867 return TRUE;
1868 case WM_NOTIFY:
1869 lppsn = (LPPSHNOTIFY) lParam;
1870 if (lppsn->hdr.code == PSN_KILLACTIVE)
1871 {
1872 if (IsDlgButtonChecked(hwndDlg, IDC_SELSUFFIX) == BST_CHECKED &&
1874 {
1877 return TRUE;
1878 }
1879 if (SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, sizeof(szSuffix)/sizeof(WCHAR), (LPARAM)szSuffix))
1880 {
1881 szSuffix[(sizeof(szSuffix)/sizeof(WCHAR))-1] = L'\0';
1882 if (VerifyDNSSuffix(szSuffix) == FALSE)
1883 {
1884 if (LoadStringW(netcfgx_hInstance, IDS_DNS_SUFFIX, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1885 {
1886 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1887 swprintf(szBuffer, szFormat, szSuffix);
1888 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1889 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1890 else
1891 szFormat[0] = L'\0';
1892
1893 MessageBoxW(hwndDlg, szBuffer, szFormat, MB_ICONWARNING);
1895 SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
1896 return TRUE;
1897 }
1898 }
1899 }
1900 }
1901 else if (lppsn->hdr.code == PSN_APPLY)
1902 {
1904 if (!This->pCurrentConfig->pDNS)
1905 break;
1906
1909 {
1910 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1911 This->pCurrentConfig->pDNS->szSearchList = NULL;
1913 This->pCurrentConfig->pDNS->UseDomainNameDevolution = TRUE;
1914 else
1915 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1916 }
1917 else
1918 {
1919 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1920 This->pCurrentConfig->pDNS->szSearchList = NULL;
1921 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1922 This->pCurrentConfig->pDNS->szSearchList = GetListViewEntries(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST));
1923 }
1924
1926 {
1927 This->pCurrentConfig->pDNS->RegisterAdapterName = TRUE;
1929 This->pCurrentConfig->pDNS->RegistrationEnabled = TRUE;
1930 else
1931 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1932 }
1933 else
1934 {
1935 This->pCurrentConfig->pDNS->RegisterAdapterName = FALSE;
1936 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1937 }
1938 }
1939 break;
1940 case WM_COMMAND:
1942 {
1944 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1945 break;
1946 }
1948 {
1950 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1951 break;
1952 }
1953 else if (LOWORD(wParam) == IDC_PRIMSUFFIX && HIWORD(wParam) == BN_CLICKED)
1954 {
1956 {
1964 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1965 }
1966 }
1967 else if (LOWORD(wParam) == IDC_SELSUFFIX && HIWORD(wParam) == BN_CLICKED)
1968 {
1970 {
1974 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1975 }
1976 break;
1977 }
1978 else if (LOWORD(wParam) == IDC_REGSUFFIX && HIWORD(wParam) == BN_CLICKED)
1979 {
1982 else
1984 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1985 }
1986 else if (LOWORD(wParam) == IDC_DNSADDRUP && HIWORD(wParam) == BN_CLICKED)
1987 {
1988 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), -1);
1991 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1992 break;
1993 }
1995 {
1996 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), 1);
1999 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2000 break;
2001 }
2003 {
2004 MoveItem(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST), -1);
2007 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2008 break;
2009 }
2011 {
2015 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2016 break;
2017 }
2018 else if (LOWORD(wParam) == IDC_DNSADDRDEL && HIWORD(wParam) == BN_CLICKED)
2019 {
2023 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2024 break;
2025 }
2027 {
2031 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2032 break;
2033 }
2034 else if (LOWORD(wParam) == IDC_DNSADDRADD && HIWORD(wParam) == BN_CLICKED)
2035 {
2036 Dns.bAdd = TRUE;
2037 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2039 {
2041 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2042 }
2043 break;
2044 }
2045 else if (LOWORD(wParam) == IDC_DNSADDRMOD && HIWORD(wParam) == BN_CLICKED)
2046 {
2047 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSADDRLIST, LB_GETCURSEL, 0, 0);
2048 if (lIndex != LB_ERR)
2049 {
2050 Dns.bAdd = FALSE;
2051 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2052 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_GETTEXT, (WPARAM)lIndex, (LPARAM)Dns.szIP);
2054 {
2056 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_INSERTSTRING, lIndex, (LPARAM)Dns.szIP);
2057 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_SETCURSEL, lIndex, 0);
2059 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2060 }
2061 }
2062 break;
2063 }
2065 {
2066 Suffix.bAdd = TRUE;
2067 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2068 Suffix.Suffix = NULL;
2070 {
2072 lIndex = SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_ADDSTRING, 0, (LPARAM)Suffix.Suffix);
2073 if (lIndex != LB_ERR)
2076 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2077 CoTaskMemFree(Suffix.Suffix);
2078 }
2079 break;
2080 }
2082 {
2083 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSSUFFIXLIST, LB_GETCURSEL, 0, 0);
2084 if (lIndex != LB_ERR)
2085 {
2086 Suffix.bAdd = FALSE;
2087 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2088 lLength = SendMessageW(Suffix.hDlgCtrl, LB_GETTEXTLEN, lIndex, 0);
2089 if (lLength != LB_ERR)
2090 {
2091 Suffix.Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1) * sizeof(WCHAR));
2092 if (Suffix.Suffix)
2093 {
2094 SendMessageW(Suffix.hDlgCtrl, LB_GETTEXT, lIndex, (LPARAM)Suffix.Suffix);
2095 Suffix.Suffix[lLength] = L'\0';
2097 {
2098 if (Suffix.Suffix)
2099 {
2101 SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_INSERTSTRING, lIndex, (LPARAM)Suffix.Suffix);
2104 CoTaskMemFree(Suffix.Suffix);
2105 }
2107 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2108 }
2109 }
2110 }
2111 }
2112 break;
2113 }
2114 }
2115 return FALSE;
2116}
#define IDC_DNSADDRMOD
Definition: resource.h:53
#define IDC_DNSSUFFIXUP
Definition: resource.h:59
#define IDC_DNSSUFFIXDEL
Definition: resource.h:63
#define IDC_DNSSUFFIXDOWN
Definition: resource.h:60
#define IDD_TCPIPDNS_DLG
Definition: resource.h:16
#define IDC_DNSADDRADD
Definition: resource.h:52
#define IDC_DNSADDRDEL
Definition: resource.h:54
#define IDC_DNSADDRUP
Definition: resource.h:50
#define IDS_NO_SUFFIX
Definition: resource.h:121
#define IDD_TCPIPSUFFIX_DLG
Definition: resource.h:17
#define IDC_DNSADDRDOWN
Definition: resource.h:51
#define IDS_DNS_SUFFIX
Definition: resource.h:123
#define IDC_DNSSUFFIXMOD
Definition: resource.h:62
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _PSHNOTIFY * LPPSHNOTIFY
NMHDR hdr
Definition: prsht.h:330
Definition: module.h:576
VOID MoveItem(HWND hDlgCtrl, INT pos)
VOID RemoveItem(HWND hDlgCtrl)
INT_PTR CALLBACK TcpipAddSuffixDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitializeTcpipAdvancedDNSDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID StoreDNSSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This)
VOID ToggleUpDown(HWND hwndDlg, HWND hDlgCtrl, UINT UpButton, UINT DownButton, UINT ModButton, UINT DelButton)
INT_PTR CALLBACK TcpipAddDNSDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LPWSTR GetListViewEntries(HWND hDlgCtrl)
#define HIWORD(l)
Definition: typedefs.h:247
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define LBN_SELCHANGE
Definition: winuser.h:2111
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define BN_CLICKED
Definition: winuser.h:1954
#define SendDlgItemMessage
Definition: winuser.h:6008
#define BM_GETCHECK
Definition: winuser.h:1947

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedIpDlg()

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

Definition at line 1279 of file tcpipconf_notify.c.

1285{
1288 INT_PTR res;
1289 WCHAR szBuffer[200];
1290 LPPSHNOTIFY lppsn;
1292 TcpipIpSettings Ip;
1293
1294 LVITEMW li;
1295
1296 switch(uMsg)
1297 {
1298 case WM_INITDIALOG:
1300 This = (TcpipConfNotifyImpl*)page->lParam;
1303 return TRUE;
1304 case WM_NOTIFY:
1305 lppsn = (LPPSHNOTIFY) lParam;
1306 if (lppsn->hdr.code == LVN_ITEMCHANGED)
1307 {
1309 BOOL bEnable;
1310
1311 if (lplv->hdr.idFrom == IDC_IPLIST)
1312 {
1314
1315 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0) &&
1316 (!This->pCurrentConfig->DhcpEnabled);
1317
1320 }
1321 else if (lplv->hdr.idFrom == IDC_GWLIST)
1322 {
1323 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0);
1324
1327 }
1328 }
1329 else if (lppsn->hdr.code == PSN_KILLACTIVE)
1330 {
1332 if (!This->pCurrentConfig->DhcpEnabled && ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST)) == 0)
1333 {
1336 return TRUE;
1337 }
1338
1340 {
1342 if ((val < 1) || (val > 9999))
1343 {
1346 return TRUE;
1347 }
1348 }
1349 }
1350 else if (lppsn->hdr.code == PSN_APPLY)
1351 {
1353 FreeIPAddr(This->pCurrentConfig->Gw);
1354 This->pCurrentConfig->Gw = NULL;
1355 FreeIPAddr(This->pCurrentConfig->Ip);
1356 This->pCurrentConfig->Ip = NULL;
1359
1361 This->pCurrentConfig->Metric = 0;
1362 else
1363 This->pCurrentConfig->Metric = GetDlgItemInt(hwndDlg, IDC_IFMETRIC, NULL, FALSE);
1364
1366 return TRUE;
1367 }
1368 break;
1369 case WM_COMMAND:
1371 {
1374 else
1376 }
1377 else if (LOWORD(wParam) == IDC_IPADD)
1378 {
1379 Ip.bAdd = TRUE;
1380 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1382 if (res)
1383 {
1384 memset(&li, 0x0, sizeof(LVITEMW));
1385 li.mask = LVIF_TEXT | LVIF_PARAM;
1386 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST));
1387 li.pszText = Ip.szIP;
1388 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_IPLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1389 if (li.iItem != -1)
1390 {
1391 li.mask = LVIF_TEXT;
1392 li.iSubItem = 1;
1393 li.pszText = Ip.szMask;
1395 }
1396 }
1397 }
1398 else if (LOWORD(wParam) == IDC_IPMOD)
1399 {
1400 memset(&li, 0x0, sizeof(LVITEMW));
1401 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_IPLIST));
1402 if (li.iItem < 0)
1403 {
1404 /* no item selected */
1406 SetFocus(GetDlgItem(hwndDlg, IDC_IPLIST));
1407 break;
1408 }
1409 Ip.bAdd = FALSE;
1410 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1411 if (GetIPListEntry(GetDlgItem(hwndDlg, IDC_IPLIST), li.iItem, &Ip))
1412 {
1414 if (res)
1415 {
1416 li.mask = LVIF_TEXT;
1417 li.pszText = Ip.szIP;
1419 li.pszText = Ip.szMask;
1420 li.iSubItem = 1;
1422 }
1423 }
1424 }
1425 else if (LOWORD(wParam) == IDC_IPDEL)
1426 {
1428 break;
1429 }
1430 else if (LOWORD(wParam) == IDC_GWADD)
1431 {
1432 Gw.bAdd = TRUE;
1433 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1435 if (res)
1436 {
1437 memset(&li, 0x0, sizeof(LVITEMW));
1438 li.mask = LVIF_TEXT;
1439 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_GWLIST));
1440 li.pszText = Gw.szIP;
1441 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_GWLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1442 if (li.iItem >= 0)
1443 {
1444 if (Gw.Metric)
1445 {
1446 swprintf(szBuffer, L"%u", Gw.Metric);
1447 li.iSubItem = 1;
1448 li.pszText = szBuffer;
1450 }
1451 else
1452 {
1453 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1454 {
1455 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1456 li.iSubItem = 1;
1457 li.pszText = szBuffer;
1459 }
1460 }
1461 }
1462 }
1463 break;
1464 }
1465 else if (LOWORD(wParam) == IDC_GWMOD)
1466 {
1467 memset(&li, 0x0, sizeof(LVITEMW));
1468 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_GWLIST));
1469 if (li.iItem < 0)
1470 {
1471 /* no item selected */
1473 SetFocus(GetDlgItem(hwndDlg, IDC_GWLIST));
1474 break;
1475 }
1476 if (GetGWListEntry(GetDlgItem(hwndDlg, IDC_GWLIST), li.iItem, &Gw))
1477 {
1478 Gw.bAdd = FALSE;
1479 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1481 if (res)
1482 {
1483 li.mask = LVIF_TEXT;
1484 li.pszText = Gw.szIP;
1486 if (Gw.Metric)
1487 {
1488 swprintf(szBuffer, L"%u", Gw.Metric);
1489 li.iSubItem = 1;
1490 li.pszText = szBuffer;
1492 }
1493 else
1494 {
1495 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1496 {
1497 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1498 li.iSubItem = 1;
1499 li.pszText = szBuffer;
1501 }
1502 }
1503 }
1504 }
1505 break;
1506 }
1507 else if (LOWORD(wParam) == IDC_GWDEL)
1508 {
1510 break;
1511 }
1512 break;
1513 }
1514 return FALSE;
1515}
#define IDC_GWADD
Definition: resource.h:39
#define IDD_TCPIPADDIP_DLG
Definition: resource.h:14
#define IDD_TCPIPGW_DLG
Definition: resource.h:15
#define IDS_METRIC_RANGE
Definition: resource.h:127
GLuint res
Definition: glext.h:9613
GLuint GLfloat * val
Definition: glext.h:7180
#define Gw
Definition: i386-dis.c:364
#define PSNRET_NOERROR
Definition: prsht.h:129
#define LVIF_PARAM
Definition: commctrl.h:2316
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
UINT uNewState
Definition: commctrl.h:3041
VOID InitializeTcpipAdvancedIpDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID StoreIPSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This, BOOL bSubmask)
VOID DeleteItemFromList(HWND hDlgCtrl)
BOOL GetGWListEntry(HWND hDlgCtrl, INT Index, TcpipGwSettings *pGwSettings)
INT_PTR CALLBACK TcpipAddIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL GetIPListEntry(HWND hDlgCtrl, INT Index, TcpipIpSettings *pIpSettings)
INT_PTR CALLBACK TcpipAdvGwDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
_In_ BOOL bEnable
Definition: winddi.h:3426
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedOptDlg()

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

Definition at line 572 of file tcpipconf_notify.c.

578{
581
582 switch(uMsg)
583 {
584 case WM_INITDIALOG:
586 This = (TcpipConfNotifyImpl*)page->lParam;
588 return TRUE;
589 case WM_COMMAND:
590 if (LOWORD(wParam) == IDC_OPTPROP)
591 {
594 GetParent(hwndDlg),
597 break;
598 }
599 }
600 return FALSE;
601}
#define IDD_TCPIP_FILTER_DLG
Definition: resource.h:13
#define IDC_OPTPROP
Definition: resource.h:69
INT_PTR CALLBACK TcpipFilterSettingsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitializeTcpipAdvancedOptDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvGwDlg()

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

Definition at line 732 of file tcpipconf_notify.c.

738{
739 WCHAR szBuffer[70];
740 TcpipGwSettings *pGwSettings;
741 DWORD dwIpAddr;
742 LPNMIPADDRESS lpnmipa;
744
745 switch(uMsg)
746 {
747 case WM_INITDIALOG:
748 pGwSettings = (TcpipGwSettings *)lParam;
750
755
756 if (pGwSettings->bAdd)
757 {
758 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
759 {
760 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
761 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
762 }
765 }
766 else
767 {
768 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
769 {
770 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
771 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
772 }
773
775
776 if (pGwSettings->Metric)
777 {
778 SetDlgItemInt(hwndDlg, IDC_GWMETRIC, pGwSettings->Metric, FALSE);
781 }
782 else
783 {
787 }
788 }
789 return TRUE;
790 case WM_COMMAND:
792 {
794 {
798 }
799 else
800 {
803 }
804 break;
805 }
806 else if (LOWORD(wParam) == IDCANCEL)
807 {
808 EndDialog(hwndDlg, FALSE);
809 break;
810 }
811 else if (LOWORD(wParam) == IDC_OK)
812 {
813 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
814 {
815 pGwSettings = (TcpipGwSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
816 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pGwSettings->szIP);
817
818 ZeroMemory(&find, sizeof(LVFINDINFOW));
819 find.flags = LVFI_STRING;
820 find.psz = pGwSettings->szIP;
821
823 pGwSettings->Metric = GetDlgItemInt(hwndDlg, IDC_GWMETRIC, NULL, FALSE);
824 else
825 pGwSettings->Metric = 0;
826
827
828 if (SendMessageW(pGwSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
829 {
830 EndDialog(hwndDlg, TRUE);
831 break;
832 }
833 if (!pGwSettings->bAdd)
834 {
835 EndDialog(hwndDlg, FALSE);
836 break;
837 }
839 }
840 break;
841 }
842 break;
843 case WM_NOTIFY:
844 lpnmipa = (LPNMIPADDRESS) lParam;
845 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
846 {
847 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
848 {
849 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
851 }
852 }
853 break;
854 }
855 return FALSE;
856}
#define IDS_DUP_GW
Definition: resource.h:126
#define IDC_GWMETRICTXT
Definition: resource.h:45
#define IDC_GWMETRIC
Definition: resource.h:46
#define IDC_GWAUTOMETRIC
Definition: resource.h:44
#define BST_UNCHECKED
Definition: winuser.h:199

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAltConfDlg()

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

Definition at line 2245 of file tcpipconf_notify.c.

2250{
2253 BOOL bNoDHCP;
2254
2255 switch (uMsg)
2256 {
2257 case WM_INITDIALOG:
2258 {
2260 This = (TcpipConfNotifyImpl*)page->lParam;
2262 if (This->pCurrentConfig)
2263 InitializeTcpipAltDlgCtrls(hwndDlg, This->pCurrentConfig);
2264 return TRUE;
2265 }
2266 case WM_COMMAND:
2267 {
2268 switch (LOWORD(wParam))
2269 {
2270 case IDC_USEDHCP:
2271 case IDC_NODHCP:
2272 {
2273 if (HIWORD(wParam) == BN_CLICKED)
2274 {
2275 bNoDHCP = (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED);
2276 if (bNoDHCP)
2277 {
2283 }
2284
2285 EnableWindow(GetDlgItem(hwndDlg, IDC_IPADDR), bNoDHCP);
2286 EnableWindow(GetDlgItem(hwndDlg, IDC_SUBNETMASK), bNoDHCP);
2287 EnableWindow(GetDlgItem(hwndDlg, IDC_DEFGATEWAY), bNoDHCP);
2288 EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), bNoDHCP);
2289 EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), bNoDHCP);
2290
2291 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2292 }
2293 break;
2294 }
2295 }
2296 break;
2297 }
2298 }
2299 return FALSE;
2300}
HRESULT InitializeTcpipAltDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)

Referenced by AddAlternativeDialog(), and INetCfgComponentPropertyUi_fnMergePropPages().

◆ TcpipBasicDlg()

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

Definition at line 2621 of file tcpipconf_notify.c.

2627{
2630 LPNMIPADDRESS lpnmipa;
2631 LPPSHNOTIFY lppsn;
2632 DWORD dwIpAddr;
2633
2634
2635 switch(uMsg)
2636 {
2637 case WM_INITDIALOG:
2639 This = (TcpipConfNotifyImpl*)page->lParam;
2640 if (This->pCurrentConfig)
2641 InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2643 return TRUE;
2644 case WM_NOTIFY:
2645 lppsn = (LPPSHNOTIFY) lParam;
2646 lpnmipa = (LPNMIPADDRESS) lParam;
2647 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
2648 {
2649 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2650 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
2651 {
2652 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2653 {
2654 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2656 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2658 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2659 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
2660 }
2661 }
2662 }
2663 else if (lppsn->hdr.code == PSN_APPLY)
2664 {
2668 else
2670
2671 return TRUE;
2672 }
2673 break;
2674 case WM_COMMAND:
2675 if (HIWORD(wParam) == BN_CLICKED)
2676 {
2677 switch (LOWORD(wParam))
2678 {
2679 case IDC_USEDHCP:
2680 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) == 0)
2681 {
2682 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2691 }
2692 break;
2693 case IDC_NODHCP:
2694 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) != 0)
2695 {
2696 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2701 {
2703 }
2708 SendMessageW(GetParent(hwndDlg), PSM_REMOVEPAGE, 1, 0);
2709 }
2710 break;
2711 case IDC_AUTODNS:
2712 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2717 break;
2718 case IDC_FIXEDDNS:
2719 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2722 break;
2723 case IDC_ADVANCED:
2725 break;
2726 }
2727 break;
2728 }
2729 default:
2730 break;
2731
2732 }
2733 return FALSE;
2734}
#define IDC_ADVANCED
Definition: resource.h:11
#define SUCCEEDED(hr)
Definition: intsafe.h:50
if(dx< 0)
Definition: linetemp.h:194
#define PSNRET_INVALID
Definition: prsht.h:130
#define PSM_REMOVEPAGE
Definition: prsht.h:166
VOID LaunchAdvancedTcpipSettings(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID AddAlternativeDialog(HWND hDlg, TcpipConfNotifyImpl *This)

Referenced by INetCfgComponentPropertyUi_fnMergePropPages().

◆ TcpipConfigNotify_Constructor()

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

Definition at line 3781 of file tcpipconf_notify.c.

3782{
3784
3785 if (!ppv)
3786 return E_POINTER;
3787
3789 if (!This)
3790 return E_OUTOFMEMORY;
3791
3792 This->ref = 1;
3793 This->lpVtbl = (const INetCfgComponentControl*)&vt_NetCfgComponentControl;
3794 This->lpVtblCompPropertyUi = (const INetCfgComponentPropertyUi*)&vt_NetCfgComponentPropertyUi;
3795 This->lpVtblCompSetup = (const INetCfgComponentSetup*)&vt_NetCfgComponentSetup;
3796 This->pNCfg = NULL;
3797 This->pUnknown = NULL;
3798 This->pNComp = NULL;
3799 This->pCurrentConfig = NULL;
3800
3801 if (!SUCCEEDED (INetCfgComponentControl_QueryInterface ((INetCfgComponentPropertyUi*)This, riid, ppv)))
3802 {
3803 INetCfgComponentControl_Release((INetCfgComponentPropertyUi*)This);
3804 return E_NOINTERFACE;
3805 }
3806
3807 INetCfgComponentControl_Release((INetCfgComponentPropertyUi*)This);
3808 return S_OK;
3809}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const INetCfgComponentSetupVtbl vt_NetCfgComponentSetup
static const INetCfgComponentControlVtbl vt_NetCfgComponentControl
static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi

◆ TcpipFilterPortDlg()

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

Definition at line 162 of file tcpipconf_notify.c.

168{
169 TcpipPortSettings * pPort;
170 UINT Num;
172 LVITEMW li;
173 WCHAR szBuffer[100];
174
175 switch(uMsg)
176 {
177 case WM_INITDIALOG:
178 pPort = (TcpipPortSettings*)lParam;
179 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPort);
180 if (LoadStringW(netcfgx_hInstance, pPort->ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
181 {
182 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
183 SendDlgItemMessageW(hwndDlg, IDC_PORT_DESC, WM_SETTEXT, 0, (LPARAM)szBuffer);
184 }
185
186 if (pPort->MaxNum == 65536)
188 else
190
191 return TRUE;
192 case WM_COMMAND:
193 if (LOWORD(wParam) == IDCANCEL)
194 {
195 EndDialog(hwndDlg, FALSE);
196 break;
197 }
198 else if (LOWORD(wParam) == IDC_OK)
199 {
200 pPort = (TcpipPortSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
201 Num = GetDlgItemInt(hwndDlg, IDC_PORT_VAL, NULL, TRUE);
202 if (Num > pPort->MaxNum || Num == 0)
203 {
204 if (pPort->MaxNum == 65536)
206 else
208
210 break;
211 }
212 if (GetWindowTextW(GetDlgItem(hwndDlg, IDC_PORT_VAL), szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
213 {
214 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
215 ZeroMemory(&find, sizeof(LVFINDINFOW));
216 find.flags = LVFI_STRING;
217 find.psz = szBuffer;
218 if (SendMessageW(pPort->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
219 {
220 ZeroMemory(&li, sizeof(LVITEMW));
221 li.mask = LVIF_TEXT;
222 li.iItem = ListView_GetItemCount(pPort->hDlgCtrl);
223 li.pszText = szBuffer;
225 EndDialog(hwndDlg, TRUE);
226 break;
227 }
230 break;
231 }
232 }
233 }
234 return FALSE;
235}
#define IDS_PROT_RANGE
Definition: resource.h:118
#define IDC_PORT_VAL
Definition: resource.h:89
#define IDS_DUP_NUMBER
Definition: resource.h:119
#define IDS_PORT_RANGE
Definition: resource.h:117
#define IDC_PORT_DESC
Definition: resource.h:88
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382

Referenced by AddItem().

◆ TcpipFilterSettingsDlg()

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

Definition at line 377 of file tcpipconf_notify.c.

383{
384 TcpipConfNotifyImpl *pContext;
385 TcpFilterSettings *pFilter;
386
387 switch(uMsg)
388 {
389 case WM_INITDIALOG:
390 pContext = (TcpipConfNotifyImpl*)lParam;
394 if (pContext->pCurrentConfig->pFilter)
395 {
401 }
402 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
403 return TRUE;
404 case WM_COMMAND:
405 if (HIWORD(wParam) == BN_CLICKED)
406 {
407 switch (LOWORD(wParam))
408 {
411 {
416 }
417 break;
418 case IDC_TCP_RESTRICT:
420 {
425 }
426 break;
429 {
434 }
435 break;
436 case IDC_UDP_RESTRICT:
438 {
443 }
444 break;
445 case IDC_IP_ALLOW_ALL:
447 {
452 }
453 break;
454 case IDC_IP_RESTRICT:
456 {
461 }
462 break;
463 case IDC_USE_FILTER:
466
467 break;
468 }
469 }
470 switch(LOWORD(wParam))
471 {
472 case IDC_OK:
473 pContext = (TcpipConfNotifyImpl*)GetWindowLongPtr(hwndDlg, DWLP_USER);
474 pFilter = StoreTcpipFilterSettings(hwndDlg);
475 if (pFilter)
476 {
477 if (pContext->pCurrentConfig->pFilter)
478 {
483 }
484 pContext->pCurrentConfig->pFilter = pFilter;
485 }
486 EndDialog(hwndDlg, (INT_PTR)TRUE);
487 break;
488 case IDCANCEL:
489 EndDialog(hwndDlg, FALSE);
490 break;
491 case IDC_TCP_ADD:
492 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_TCP_LIST), 65536, IDS_TCP_PORTS);
493 break;
494 case IDC_TCP_DEL:
496 break;
497 case IDC_UDP_ADD:
498 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_UDP_LIST), 65536, IDS_UDP_PORTS);
499 break;
500 case IDC_UDP_DEL:
502 break;
503 case IDC_IP_ADD:
504 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_IP_LIST), 256, IDS_IP_PROTO);
505 break;
506 case IDC_IP_DEL:
507 DelItem(GetDlgItem(hwndDlg, IDC_IP_LIST));
508 break;
509 default:
510 break;
511 }
512 default:
513 break;
514 }
515
516 return FALSE;
517}
#define IDS_DISABLE_FILTER
Definition: resource.h:120
#define IDC_IP_RESTRICT
Definition: resource.h:83
#define IDS_TCP_PORTS
Definition: resource.h:114
#define IDC_IP_DEL
Definition: resource.h:86
#define IDC_IP_ALLOW_ALL
Definition: resource.h:82
#define IDS_IP_PROTO
Definition: resource.h:116
#define IDC_TCP_RESTRICT
Definition: resource.h:73
#define IDC_TCP_ADD
Definition: resource.h:75
#define IDC_UDP_DEL
Definition: resource.h:81
#define IDC_IP_ADD
Definition: resource.h:85
#define IDS_UDP_PORTS
Definition: resource.h:115
#define IDC_UDP_ALLOW_ALL
Definition: resource.h:77
#define IDC_TCP_ALLOW_ALL
Definition: resource.h:72
#define IDC_UDP_ADD
Definition: resource.h:80
#define IDC_UDP_RESTRICT
Definition: resource.h:78
#define IDC_TCP_DEL
Definition: resource.h:76
TcpipSettings * pCurrentConfig
static VOID DelItem(HWND hDlgCtrl)
TcpFilterSettings * StoreTcpipFilterSettings(HWND hwndDlg)
VOID InitFilterListBox(LPWSTR pData, HWND hwndDlg, HWND hDlgCtrl, UINT AllowButton, UINT RestrictButton, UINT AddButton, UINT DelButton)
#define AddItem
Definition: userenv.h:209

Referenced by TcpipAdvancedOptDlg().

◆ ToggleUpDown()

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

Definition at line 1675 of file tcpipconf_notify.c.

1676{
1677 LRESULT lResult, lCount;
1678
1679 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1680 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1681 if (lResult != LB_ERR)
1682 {
1683 if (lResult == 0)
1684 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
1685 else
1686 EnableWindow(GetDlgItem(hwndDlg, UpButton), TRUE);
1687
1688 if (lResult < lCount -1)
1689 EnableWindow(GetDlgItem(hwndDlg, DownButton), TRUE);
1690 else
1691 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
1692 }
1693
1694 if (lCount)
1695 {
1696 EnableWindow(GetDlgItem(hwndDlg, ModButton), TRUE);
1697 EnableWindow(GetDlgItem(hwndDlg, DelButton), TRUE);
1698 }
1699 else
1700 {
1701 EnableWindow(GetDlgItem(hwndDlg, ModButton), FALSE);
1702 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
1703 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
1704 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
1705 }
1706}

Referenced by TcpipAdvancedDnsDlg().

◆ VerifyDNSSuffix()

BOOL VerifyDNSSuffix ( LPWSTR  szName)

Definition at line 992 of file tcpipconf_notify.c.

994{
995 UINT Index;
997
998 for(Index = 0; Index < Length; Index++)
999 if (iswalnum(szName[Index]) == 0 && szName[Index] != '.' && szName[Index] != '-')
1000 return FALSE;
1001
1002 return TRUE;
1003}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define iswalnum(_c)
Definition: ctype.h:671

Referenced by TcpipAddSuffixDlg(), and TcpipAdvancedDnsDlg().

Variable Documentation

◆ vt_NetCfgComponentControl

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

Definition at line 3679 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().

◆ vt_NetCfgComponentPropertyUi

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

Definition at line 3222 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().

◆ vt_NetCfgComponentSetup

const INetCfgComponentSetupVtbl vt_NetCfgComponentSetup
static
Initial value:
=
{
}
ULONG WINAPI INetCfgComponentSetup_fnAddRef(INetCfgComponentSetup *iface)
HRESULT WINAPI INetCfgComponentSetup_fnInstall(INetCfgComponentSetup *iface, DWORD dwSetupFlags)
HRESULT WINAPI INetCfgComponentSetup_fnUpgrade(INetCfgComponentSetup *iface, DWORD dwSetupFlags, DWORD dwUpgradeFromBuildNo)
HRESULT WINAPI INetCfgComponentSetup_fnRemoving(INetCfgComponentSetup *iface)
ULONG WINAPI INetCfgComponentSetup_fnRelease(INetCfgComponentSetup *iface)
HRESULT WINAPI INetCfgComponentSetup_fnReadAnswerFile(INetCfgComponentSetup *iface, LPCWSTR pszwAnswerFile, LPCWSTR pszwAnswerSections)
HRESULT WINAPI INetCfgComponentSetup_fnQueryInterface(INetCfgComponentSetup *iface, REFIID iid, LPVOID *ppvObj)

Definition at line 3768 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().