ReactOS 0.4.16-dev-2617-g01a0906
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  AlternateConfiguration
 
struct  TcpipSettings
 
struct  TcpipConfNotifyImpl
 
struct  TcpipGwSettings
 
struct  TcpipIpSettings
 
struct  TcpipDnsSettings
 
struct  TcpipSuffixSettings
 
struct  TcpipPortSettings
 

Typedefs

typedef DWORD(WINAPIPDHCPFALLBACKREFRESHPARAMS) (PWSTR pAdapterName)
 
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)
 
INT_PTR StoreTcpipAlternateSettings (HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)
 
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)
 
static BOOL NameServersChanged (TcpipSettings *pCurrentConfig, TcpipSettings *pOldConfig)
 
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 LoadTcpIpSettings (TcpipSettings *pSettings, LPOLESTR pAdapterName, IP_ADAPTER_INFO *pAdapterInfo, IP_PER_ADAPTER_INFO *pPerAdapterInfo)
 
HRESULT LoadDNSSettings (TcpipSettings *pSettings, LPOLESTR pAdapterName)
 
LPWSTR LoadTcpFilterSettingsFromRegistry (HKEY hKey, LPCWSTR szName, LPDWORD Size)
 
HRESULT LoadFilterSettings (TcpipSettings *pSettings, LPOLESTR pAdapterName)
 
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

◆ PDHCPFALLBACKREFRESHPARAMS

typedef DWORD(WINAPI * PDHCPFALLBACKREFRESHPARAMS) (PWSTR pAdapterName)

Definition at line 9 of file tcpipconf_notify.c.

Enumeration Type Documentation

◆ COPY_TYPE

Enumerator
METRIC 
SUBMASK 
IPADDR 

Definition at line 49 of file tcpipconf_notify.c.

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

Function Documentation

◆ AddAlternativeDialog()

VOID AddAlternativeDialog ( HWND  hDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2414 of file tcpipconf_notify.c.

2417{
2418 HPROPSHEETPAGE hpage;
2419
2421 if (!hpage)
2422 return;
2423
2424 SendMessageW(hDlg, PSM_INSERTPAGE, 1, (LPARAM)hpage);
2425}
#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 358 of file tcpipconf_notify.c.

363{
365
366 Port.MaxNum = MaxItem;
367 Port.hDlgCtrl = hDlgCtrl;
368 Port.ResId = ResId;
369
371}
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 2692 of file tcpipconf_notify.c.

2697{
2698 IP_ADDR_STRING * pCurrent;
2699 IP_ADDR *pNew, *pLast;
2700
2701 pCurrent = pSrc;
2702 pLast = NULL;
2703
2704 while(pCurrent)
2705 {
2706 pNew = CoTaskMemAlloc(sizeof(IP_ADDR));
2707 if (!pNew)
2708 {
2709 break;
2710 }
2711 ZeroMemory(pNew, sizeof(IP_ADDR));
2713 if (!pNew->IpAddress)
2714 {
2715 CoTaskMemFree(pNew);
2716 return E_FAIL;
2717 }
2718
2719 if (Type == SUBMASK)
2720 {
2722 pNew->NTEContext = pCurrent->Context;
2723 }
2724 else if (Type == METRIC)
2725 {
2726 if (szMetric && szMetric[0] != L'\0')
2727 {
2728 pNew->u.Metric = _wtoi(szMetric);
2729 szMetric += wcslen(szMetric) + 1;
2730 }
2731 }
2732
2733 if (!pLast)
2734 *pTarget = pNew;
2735 else
2736 pLast->Next = pNew;
2737
2738 pLast = pNew;
2739 pCurrent = pCurrent->Next;
2740
2741 }
2742 pLast->Next = NULL;
2743 return S_OK;
2744}
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 LoadTcpIpSettings().

◆ CreateFilterList()

LPWSTR CreateFilterList ( HWND  hDlgCtrl,
LPDWORD  Size 
)

Definition at line 286 of file tcpipconf_notify.c.

289{
290 INT iCount, iIndex;
291 LVITEMW li;
294 WCHAR szBuffer[10];
295
296 iCount = ListView_GetItemCount(hDlgCtrl);
297 if (!iCount)
298 {
299 pData = (LPWSTR)CoTaskMemAlloc(3 * sizeof(WCHAR));
300 if (!pData)
301 return NULL;
302 pData[0] = L'0';
303 pData[1] = L'\0';
304 pData[2] = L'\0';
305 *Size = 3 * sizeof(WCHAR);
306 return pData;
307 }
308
309 pData = CoTaskMemAlloc((6 * iCount + 1) * sizeof(WCHAR));
310 if (!pData)
311 return NULL;
312
313 pCur = pData;
314 dwSize = 0;
315 for(iIndex = 0; iIndex < iCount; iIndex++)
316 {
317 ZeroMemory(&li, sizeof(LVITEMW));
318 li.mask = LVIF_TEXT;
319 li.iItem = iIndex;
320 li.pszText = szBuffer;
321 li.cchTextMax = sizeof(szBuffer) /sizeof(WCHAR);
322 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
323 {
324 wcscpy(pCur, szBuffer);
325 dwSize += wcslen(szBuffer) + 1;
326 pCur += wcslen(szBuffer) + 1;
327 }
328 }
329 pCur[0] = L'\0';
330 *Size = (dwSize+1) * sizeof(WCHAR);
331 return pData;
332}
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
short WCHAR
Definition: pedump.c:58
#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
uint16_t * LPWSTR
Definition: typedefs.h:56
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

Referenced by StoreTcpipFilterSettings().

◆ CreateMultiSzString()

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

Definition at line 3566 of file tcpipconf_notify.c.

3567{
3568 LPWSTR pStr, pRet;
3569 DWORD dwSize, dwIpAddr;
3570 WCHAR szBuffer[30];
3571 IP_ADDR *pTemp = pAddr;
3572
3573
3574 dwSize = 0;
3575 while(pTemp)
3576 {
3577 if (Type == IPADDR)
3578 {
3579 dwIpAddr = pTemp->IpAddress;
3580 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3581 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3582 }else if (Type == SUBMASK)
3583 {
3584 dwIpAddr = pTemp->u.Subnetmask;
3585 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3586 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3587 }
3588 else if (Type == METRIC)
3589 {
3590 swprintf(szBuffer, L"%u", pTemp->u.Metric);
3591 }
3592
3593 dwSize += wcslen(szBuffer) + 1;
3594 pTemp = pTemp->Next;
3595 }
3596
3597 if (!dwSize)
3598 return NULL;
3599
3600 pStr = pRet = CoTaskMemAlloc((dwSize+1) * sizeof(WCHAR));
3601 if(!pStr)
3602 return NULL;
3603
3604 pTemp = pAddr;
3605 while(pTemp)
3606 {
3607 if (Type == IPADDR)
3608 {
3609 dwIpAddr = pTemp->IpAddress;
3610 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3611 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3612 }else if (Type == SUBMASK)
3613 {
3614 dwIpAddr = pTemp->u.Subnetmask;
3615 swprintf(pStr, L"%lu.%lu.%lu.%lu",
3616 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3617 }
3618 else if (Type == METRIC)
3619 {
3620 swprintf(pStr, L"%u", pTemp->u.Metric);
3621 }
3622
3623 if (bComma)
3624 {
3625 pStr += wcslen(pStr);
3626 if (pTemp->Next)
3627 {
3628 pStr[0] = L',';
3629 pStr++;
3630 }
3631 }
3632 else
3633 {
3634 pStr += wcslen(pStr) + 1;
3635 }
3636 pTemp = pTemp->Next;
3637 }
3638 pStr[0] = L'\0';
3639 *Size = (dwSize+1) * sizeof(WCHAR);
3640 return pRet;
3641}
#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 1146 of file tcpipconf_notify.c.

1147{
1148 LVITEMW li;
1149
1150 memset(&li, 0x0, sizeof(LVITEMW));
1151 li.iItem = GetSelectedItem(hDlgCtrl);
1152 if (li.iItem < 0)
1153 {
1155 SetFocus(hDlgCtrl);
1156 }
1157 else
1158 {
1159 (void)ListView_DeleteItem(hDlgCtrl, li.iItem);
1160 }
1161}
#define IDS_NOITEMSEL
Definition: resource.h:118
#define IDS_TCPIP
Definition: resource.h:119
#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 375 of file tcpipconf_notify.c.

377{
378 INT iIndex = GetSelectedItem(hDlgCtrl);
379
380 if (iIndex != -1)
381 {
382 (void)ListView_DeleteItem(hDlgCtrl, iIndex);
383 return;
384 }
386}
#define MB_ICONWARNING
Definition: winuser.h:797

Referenced by TcpipFilterSettingsDlg().

◆ DisplayError()

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

Definition at line 149 of file tcpipconf_notify.c.

150{
151 WCHAR szBuffer[300];
152 WCHAR szTitle[100];
153
154 if (LoadStringW(netcfgx_hInstance, ResTxt, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
155 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
156 else
157 szBuffer[0] = L'\0';
158
159 if (LoadStringW(netcfgx_hInstance, ResTitle, szTitle, sizeof(szTitle)/sizeof(WCHAR)))
160 szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = L'\0';
161 else
162 szTitle[0] = L'\0';
163
164 MessageBoxW(NULL, szBuffer, szTitle, Type);
165}
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(), StoreTcpipAlternateSettings(), StoreTcpipBasicSettings(), TcpipAddDNSDlg(), TcpipAddIpDlg(), TcpipAddSuffixDlg(), TcpipAdvancedDnsDlg(), TcpipAdvancedIpDlg(), TcpipAdvGwDlg(), TcpipFilterPortDlg(), and TcpipFilterSettingsDlg().

◆ FreeDNSSettings()

VOID FreeDNSSettings ( TcpipAdvancedDNSDlgSettings pDNS)

Definition at line 2885 of file tcpipconf_notify.c.

2887{
2888 if (pDNS == NULL)
2889 return;
2890
2891 if (pDNS->szSearchList)
2893
2894 CoTaskMemFree(pDNS);
2895}

Referenced by FreeSettings().

◆ FreeFilterSettings()

VOID FreeFilterSettings ( TcpFilterSettings pFilter)

Definition at line 2866 of file tcpipconf_notify.c.

2868{
2869 if (pFilter == NULL)
2870 return;
2871
2872 if (pFilter->szTCPAllowedPorts)
2874
2875 if (pFilter->szUDPAllowedPorts)
2877
2878 if (pFilter->szRawIPAllowedProtocols)
2880
2881 CoTaskMemFree(pFilter);
2882}
LPWSTR szRawIPAllowedProtocols

Referenced by FreeSettings().

◆ FreeIPAddr()

VOID FreeIPAddr ( IP_ADDR pAddr)

Definition at line 1204 of file tcpipconf_notify.c.

1205{
1206 IP_ADDR *pNext;
1207
1208 if (!pAddr)
1209 return;
1210
1211 while(pAddr)
1212 {
1213 pNext = pAddr->Next;
1215 pAddr = pNext;
1216 }
1217}

Referenced by StoreDNSSettings(), and TcpipAdvancedIpDlg().

◆ FreeSettings()

VOID FreeSettings ( TcpipSettings pSettings)

Definition at line 2898 of file tcpipconf_notify.c.

2900{
2901 IP_ADDR *NextIp;
2902
2903 if (pSettings == NULL)
2904 return;
2905
2906 /* Free IpAdresses */
2907 while (pSettings->Ip)
2908 {
2909 NextIp = pSettings->Ip->Next;
2910 CoTaskMemFree(pSettings->Ip);
2911 pSettings->Ip = NextIp;
2912 }
2913
2914 /* Free NameServers */
2915 while (pSettings->Ns)
2916 {
2917 NextIp = pSettings->Ns->Next;
2918 CoTaskMemFree(pSettings->Ns);
2919 pSettings->Ns = NextIp;
2920 }
2921
2922 /* Free Gateways */
2923 while (pSettings->Gw)
2924 {
2925 NextIp = pSettings->Gw->Next;
2926 CoTaskMemFree(pSettings->Gw);
2927 pSettings->Gw = NextIp;
2928 }
2929
2930 /* Free Filter Settings */
2931 if (pSettings->pFilter)
2932 FreeFilterSettings(pSettings->pFilter);
2933
2934 /* Free DNS Settings */
2935 if (pSettings->pDNS)
2936 FreeDNSSettings(pSettings->pDNS);
2937
2938 CoTaskMemFree(pSettings);
2939}
TcpipAdvancedDNSDlgSettings * pDNS
TcpFilterSettings * pFilter
VOID FreeDNSSettings(TcpipAdvancedDNSDlgSettings *pDNS)
VOID FreeFilterSettings(TcpFilterSettings *pFilter)

Referenced by INetCfgComponentControl_fnRelease(), and Initialize().

◆ GetGWListEntry()

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

Definition at line 872 of file tcpipconf_notify.c.

873{
874 LVITEMW li;
875 WCHAR szBuffer[30];
876 BOOL bRet;
877
878 ZeroMemory(&li, sizeof(LVITEMW));
879 li.mask = LVIF_TEXT;
880 li.cchTextMax = 16;
881 li.pszText = pGwSettings->szIP;
882 li.iItem = Index;
883
884 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
885 return FALSE;
886 li.pszText = szBuffer;
887 li.cchTextMax = 30;
888 li.iSubItem = 1;
889
890 bRet = SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
891 if (bRet)
892 {
893 pGwSettings->Metric = _wtoi(szBuffer);
894 }
895
896 return bRet;
897}
#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 1189 of file tcpipconf_notify.c.

1191{
1192 WCHAR szIp[16];
1193
1194 if (MultiByteToWideChar(CP_ACP, 0, sBuffer, -1, szIp, 16))
1195 {
1196 szIp[15] = L'\0';
1197 return GetIpAddressFromStringW(szIp);
1198 }
1199 return (UINT)-1;
1200}
#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 1164 of file tcpipconf_notify.c.

1166{
1167 DWORD dwIpAddr = 0;
1168 INT Val;
1169 UINT Index = 3;
1170 LPWSTR pLast = szBuffer;
1171 LPWSTR pNext = szBuffer;
1172
1173
1174 while((pNext = wcschr(pNext, L'.')))
1175 {
1176 pNext[0] = L'\0';
1177 Val = _wtoi(pLast);
1178 dwIpAddr |= (Val << Index * 8);
1179 Index--;
1180 pNext++;
1181 pLast = pNext;
1182 }
1183 dwIpAddr |= _wtoi(pLast);
1184
1185 return dwIpAddr;
1186}
#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 1122 of file tcpipconf_notify.c.

1123{
1124 LVITEMW li;
1125
1126 ZeroMemory(&li, sizeof(LVITEMW));
1127 li.mask = LVIF_TEXT;
1128 li.cchTextMax = 16;
1129 li.pszText = pIpSettings->szIP;
1130 li.iItem = Index;
1131
1132 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1133 return FALSE;
1134
1135 ZeroMemory(&li, sizeof(LVITEMW));
1136 li.mask = LVIF_TEXT;
1137 li.cchTextMax = 16;
1138 li.pszText = pIpSettings->szMask;
1139 li.iSubItem = 1;
1140 li.iItem = Index;
1141
1142 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1143}

Referenced by TcpipAdvancedIpDlg().

◆ GetListViewEntries()

LPWSTR GetListViewEntries ( HWND  hDlgCtrl)

Definition at line 1762 of file tcpipconf_notify.c.

1764{
1765 DWORD dwSize;
1766 INT iCount, iIndex;
1767 INT_PTR lResult;
1768 LPWSTR pszSearchList, pItem;
1769
1770 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1771 if (!iCount || iCount == LB_ERR)
1772 return NULL; //BUGBUG
1773
1774 dwSize = 0;
1775
1776 for (iIndex = 0; iIndex < iCount; iIndex++)
1777 {
1778 lResult = SendMessageW(hDlgCtrl, LB_GETTEXTLEN, iIndex, 0);
1779 if (lResult == LB_ERR)
1780 return NULL;
1781
1782 dwSize += lResult + 1;
1783 }
1784
1785 pszSearchList = (LPWSTR)CoTaskMemAlloc((dwSize + 1) * sizeof(WCHAR));
1786 if (!pszSearchList)
1787 return NULL;
1788
1789 pItem = pszSearchList;
1790 for (iIndex = 0; iIndex < iCount; iIndex++)
1791 {
1792 lResult = SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)pItem);
1793 if (lResult == LB_ERR)
1794 {
1795 CoTaskMemFree(pszSearchList);
1796 return NULL;
1797 }
1798 dwSize -= lResult + 1;
1799 pItem += wcslen(pItem);
1800 if (iIndex != iCount -1)
1801 {
1802 pItem[0] = L',';
1803 pItem++;
1804 }
1805 }
1806 pItem[0] = L'\0';
1807 return pszSearchList;
1808}
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 1220 of file tcpipconf_notify.c.

1221{
1222 LVITEMW li;
1223
1224 ZeroMemory(&li, sizeof(LVITEMW));
1225 li.mask = LVIF_TEXT;
1226 li.pszText = szBuffer;
1227 li.iItem = Index;
1228 li.iSubItem = SubIndex;
1229 li.cchTextMax = BufferSize;
1230 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1231}
#define BufferSize
Definition: mmc.h:75

Referenced by StoreIPSettings().

◆ GetSelectedItem()

INT GetSelectedItem ( HWND  hDlgCtrl)

Definition at line 1096 of file tcpipconf_notify.c.

1097{
1098 LVITEMW li;
1099 UINT iItemCount, iIndex;
1100
1101 iItemCount = ListView_GetItemCount(hDlgCtrl);
1102 if (!iItemCount)
1103 return -1;
1104
1105 for (iIndex = 0; iIndex < iItemCount; iIndex++)
1106 {
1107 ZeroMemory(&li, sizeof(LVITEMW));
1108 li.mask = LVIF_STATE;
1109 li.stateMask = (UINT)-1;
1110 li.iItem = iIndex;
1111 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1112 {
1113 if (li.state & LVIS_SELECTED)
1114 return iIndex;
1115 }
1116 }
1117 return -1;
1118}
#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 136 of file tcpipconf_notify.c.

137{
138 return (TcpipConfNotifyImpl*)((char *)iface - FIELD_OFFSET(TcpipConfNotifyImpl, lpVtblCompSetup));
139}

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

◆ INetCfgComponentControl_fnAddRef()

ULONG WINAPI INetCfgComponentControl_fnAddRef ( INetCfgComponentControl *  iface)

Definition at line 3507 of file tcpipconf_notify.c.

3509{
3510 TRACE("INetCfgComponentControl_fnAddRef()\n");
3512 ULONG refCount = InterlockedIncrement(&This->ref);
3513
3514 return refCount;
3515}
#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 3821 of file tcpipconf_notify.c.

3824{
3825 TcpipSettings *pCurrentConfig, *pOldConfig;
3826 LPOLESTR pAdapterName;
3827 ULONG NTEInstance;
3828 DWORD DhcpApiVersion;
3829 DWORD dwSize;
3830
3831 TRACE("INetCfgComponentControl_fnApplyPnpChanges()\n");
3832
3834
3835 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pAdapterName)))
3836 {
3837 return E_FAIL;
3838 }
3839
3840 pCurrentConfig = This->pCurrentConfig;
3841 pOldConfig = This->pOldConfig;
3842
3843 if (pCurrentConfig->DhcpEnabled)
3844 {
3845 if (!pOldConfig->DhcpEnabled)
3846 {
3847 /* Delete this adapter's current IP address */
3848 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3849
3850 /* Delete all default routes for this adapter */
3851 dwSize = 0;
3853 {
3854 DWORD Index;
3856 if (pIpForwardTable)
3857 {
3858 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3859 {
3860 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3861 {
3862 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3863 pIpForwardTable->table[Index].dwForwardDest == 0)
3864 {
3865 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3866 }
3867 }
3868 }
3869 CoTaskMemFree(pIpForwardTable);
3870 }
3871 }
3872 }
3873 }
3874 else
3875 {
3876 /* Open the DHCP API if DHCP is enabled */
3877 if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR)
3878 {
3879 /* We have to tell DHCP about this */
3880 DhcpStaticRefreshParams(pCurrentConfig->Index,
3881 htonl(pCurrentConfig->Ip->IpAddress),
3882 htonl(pCurrentConfig->Ip->u.Subnetmask));
3883
3884 /* Close the API */
3886 }
3887 else
3888 {
3889 /* Delete this adapter's current static IP address */
3890 DeleteIPAddress(pOldConfig->Ip->NTEContext);
3891
3892 /* Add the static IP address via the standard IPHLPAPI function */
3893 AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress),
3894 htonl(pCurrentConfig->Ip->u.Subnetmask),
3895 pCurrentConfig->Index,
3896 &pCurrentConfig->Ip->NTEContext,
3897 &NTEInstance);
3898 }
3899
3900 /* Delete all default routes for this adapter */
3901 dwSize = 0;
3903 {
3904 DWORD Index;
3906 if (pIpForwardTable)
3907 {
3908 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3909 {
3910 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3911 {
3912 if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3913 pIpForwardTable->table[Index].dwForwardDest == 0)
3914 {
3915 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3916 }
3917 }
3918 }
3919 CoTaskMemFree(pIpForwardTable);
3920 }
3921 }
3922 }
3923
3924 if (pCurrentConfig->Gw)
3925 {
3926 MIB_IPFORWARDROW RouterMib;
3927 ZeroMemory(&RouterMib, sizeof(MIB_IPFORWARDROW));
3928
3929 RouterMib.dwForwardMetric1 = 1;
3930 RouterMib.dwForwardIfIndex = pOldConfig->Index;
3931 RouterMib.dwForwardNextHop = htonl(pCurrentConfig->Gw->IpAddress);
3932
3933 //TODO
3934 // add multiple gw addresses when required
3935 CreateIpForwardEntry(&RouterMib);
3936 }
3937
3938
3939 /* Notify the DHCP client of the changed alternate configuration */
3940 if (!RtlEqualMemory(&pCurrentConfig->AltConfig, &pOldConfig->AltConfig, sizeof(AlternateConfiguration)))
3941 {
3942 HMODULE hDhcpModule = LoadLibraryW(L"dhcpcsvc.dll");
3943 if (hDhcpModule)
3944 {
3945 PDHCPFALLBACKREFRESHPARAMS pFunc = (PDHCPFALLBACKREFRESHPARAMS)GetProcAddress(hDhcpModule, "DhcpFallbackRefreshParams");
3946 (pFunc)(pAdapterName);
3947
3948 FreeLibrary(hDhcpModule);
3949 }
3950 }
3951
3952 /* Notify the dnscache service if the name server list changed */
3953 if (NameServersChanged(pCurrentConfig, pOldConfig))
3954 {
3955 SC_HANDLE hManager, hService;
3957
3958 TRACE("Notify the dnscache service!\n");
3959
3961 if (hManager)
3962 {
3963 hService = OpenServiceW(hManager, L"Dnscache", SERVICE_PAUSE_CONTINUE);
3964 if (hService)
3965 {
3967 CloseServiceHandle(hService);
3968 }
3969
3970 CloseServiceHandle(hManager);
3971 }
3972 }
3973
3974 return S_OK;
3975}
static SERVICE_STATUS ServiceStatus
Definition: browser.c:23
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
DWORD APIENTRY DhcpCApiInitialize(_Out_ LPDWORD Version)
Definition: dhcpcsvc.c:213
DWORD APIENTRY DhcpStaticRefreshParams(DWORD AdapterIndex, DWORD Address, DWORD Netmask)
Definition: dhcpcsvc.c:626
VOID APIENTRY DhcpCApiCleanup(VOID)
Definition: dhcpcsvc.c:227
HRESULT WINAPI StringFromCLSID(REFCLSID clsid, LPOLESTR *str)
Definition: combase.c:1515
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
#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 RtlEqualMemory(dst, src, len)
Definition: kdvm.h:18
#define htonl(x)
Definition: module.h:214
static BSTR *static LPOLESTR
Definition: varformat.c:44
#define SERVICE_CONTROL_PARAMCHANGE
Definition: winsvc.h:47
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define SERVICE_PAUSE_CONTINUE
Definition: winsvc.h:65
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2107
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:622
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2199
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
AlternateConfiguration AltConfig
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
DWORD(WINAPI * PDHCPFALLBACKREFRESHPARAMS)(PWSTR pAdapterName)
static BOOL NameServersChanged(TcpipSettings *pCurrentConfig, TcpipSettings *pOldConfig)

◆ INetCfgComponentControl_fnApplyRegistryChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges ( INetCfgComponentControl *  iface)

Definition at line 3646 of file tcpipconf_notify.c.

3648{
3649 HKEY hKey;
3650 LPOLESTR pStr, pAdapterName;
3651 DWORD dwSize;
3652 WCHAR szBuffer[200];
3653 TcpipSettings *pCurrentConfig, *pOldConfig;
3654
3655 TRACE("INetCfgComponentControl_fnApplyRegistryChanges()\n");
3656
3658
3659 pCurrentConfig = This->pCurrentConfig;
3660 pOldConfig = This->pOldConfig;
3661
3662 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3663 {
3664 if (pCurrentConfig->pDNS)
3665 {
3666 RegSetValueExW(hKey, L"UseDomainNameDevolution", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->pDNS->UseDomainNameDevolution, sizeof(DWORD));
3667 RegSetValueExW(hKey, L"SearchList", 0, REG_SZ, (LPBYTE)pCurrentConfig->pDNS->szSearchList,
3668 (wcslen(pCurrentConfig->pDNS->szSearchList)+1) * sizeof(WCHAR));
3669 }
3670 if (pCurrentConfig->pFilter)
3671 {
3672 RegSetValueExW(hKey, L"EnableSecurityFilters", 0, REG_DWORD,
3673 (LPBYTE)&pCurrentConfig->pFilter->EnableSecurityFilters, sizeof(DWORD));
3674 }
3676 }
3677
3678 if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pAdapterName)))
3679 {
3680 return E_FAIL;
3681 }
3682
3683 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pAdapterName);
3684
3686 {
3687 if (pCurrentConfig->Metric)
3688 RegSetValueExW(hKey, L"InterfaceMetric", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->Metric, sizeof(DWORD));
3689 else
3690 RegDeleteValueW(hKey, L"InterfaceMetric");
3691
3692 if (pCurrentConfig->pDNS)
3693 {
3694 RegSetValueExW(hKey, L"RegisterAdapterName", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, sizeof(DWORD));
3695 RegSetValueExW(hKey, L"RegistrationEnabled", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, sizeof(DWORD));
3696 RegSetValueExW(hKey, L"Domain", 0, REG_SZ, (LPBYTE)This->pCurrentConfig->pDNS->szDomain,
3697 (wcslen(This->pCurrentConfig->pDNS->szDomain)+1) * sizeof(WCHAR));
3698 }
3699#if 0
3700 if (pCurrentConfig->pFilter)
3701 {
3702 if (pCurrentConfig->pFilter->szTCPAllowedPorts)
3703 {
3704 RegSetValueExW(hKey, L"TCPAllowedPorts", 0, REG_MULTI_SZ,
3705 (LPBYTE)pCurrentConfig->pFilter->szTCPAllowedPorts,
3706 pCurrentConfig->pFilter->TCPSize);
3707 }
3708 if (pCurrentConfig->pFilter->szUDPAllowedPorts)
3709 {
3710 RegSetValueExW(hKey, L"UDPAllowedPorts", 0, REG_MULTI_SZ,
3711 (LPBYTE)pCurrentConfig->pFilter->szUDPAllowedPorts,
3712 pCurrentConfig->pFilter->UDPSize);
3713 }
3714 if (pCurrentConfig->pFilter->szRawIPAllowedProtocols)
3715 {
3716 RegSetValueExW(hKey, L"RawIPAllowedProtocols", 0, REG_MULTI_SZ,
3717 (LPBYTE)pCurrentConfig->pFilter->szRawIPAllowedProtocols,
3718 pCurrentConfig->pFilter->IPSize);
3719 }
3720 }
3721#endif
3722 RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->DhcpEnabled, sizeof(DWORD));
3723 if (pCurrentConfig->DhcpEnabled)
3724 {
3725 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3726 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3727 }
3728 else
3729 {
3730 pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE);
3731 if(pStr)
3732 {
3733 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3734 CoTaskMemFree(pStr);
3735 }
3736
3737 pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE);
3738 if(pStr)
3739 {
3740 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3741 CoTaskMemFree(pStr);
3742 }
3743 }
3744
3745 if (pCurrentConfig->Gw)
3746 {
3747 pStr = CreateMultiSzString(pCurrentConfig->Gw, IPADDR, &dwSize, FALSE);
3748 if(pStr)
3749 {
3750 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3751 CoTaskMemFree(pStr);
3752 }
3753
3754 pStr = CreateMultiSzString(pCurrentConfig->Gw, METRIC, &dwSize, FALSE);
3755 if(pStr)
3756 {
3757 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3758 CoTaskMemFree(pStr);
3759 }
3760 }
3761 else
3762 {
3763 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"", 1 * sizeof(WCHAR));
3764 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", sizeof(WCHAR) * 2);
3765 }
3766
3767 if (!pCurrentConfig->Ns)
3768 {
3769 RegDeleteValueW(hKey, L"NameServer");
3770 }
3771 else
3772 {
3773 pStr = CreateMultiSzString(pCurrentConfig->Ns, IPADDR, &dwSize, TRUE);
3774 if(pStr)
3775 {
3776 RegSetValueExW(hKey, L"NameServer", 0, REG_SZ, (LPBYTE)pStr, dwSize);
3777 //RegDeleteValueW(hKey, L"DhcpNameServer");
3778 CoTaskMemFree(pStr);
3779 }
3780 }
3781
3782 if (!RtlEqualMemory(&pCurrentConfig->AltConfig, &pOldConfig->AltConfig, sizeof(AlternateConfiguration)))
3783 {
3784 if (pCurrentConfig->AltConfig.IpAddress == 0)
3785 {
3786 RegDeleteValueW(hKey, L"ActiveConfigurations");
3787 }
3788 else
3789 {
3790 HKEY hConfigKey;
3791
3792 dwSize = (wcslen(L"Alternate_") + wcslen(pAdapterName) + 2) * sizeof(WCHAR);
3793 pStr = CoTaskMemAlloc(dwSize);
3794 if (pStr)
3795 {
3796 ZeroMemory(pStr, dwSize);
3797 _swprintf(pStr, L"Alternate_%s", pAdapterName);
3798 RegSetValueExW(hKey, L"ActiveConfigurations", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3799 CoTaskMemFree(pStr);
3800 }
3801
3802 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\DHCP\\Configurations\\Alternate_%s", pAdapterName);
3803 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, NULL, 0, KEY_WRITE, NULL, &hConfigKey, NULL) == ERROR_SUCCESS)
3804 {
3805 RegSetValueExW(hConfigKey, L"Options", 0, REG_BINARY, (LPBYTE)&pCurrentConfig->AltConfig, sizeof(AlternateConfiguration));
3806 RegCloseKey(hConfigKey);
3807 }
3808 }
3809 }
3810
3812 }
3813
3814 CoTaskMemFree(pAdapterName);
3815
3816 return S_OK;
3817}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#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
int WINAPIV _swprintf(wchar_t *str, const wchar_t *format,...)
Definition: wcs.c:1687
FxAutoRegKey hKey
#define REG_SZ
Definition: layer.c:22
#define REG_BINARY
Definition: nt_native.h:1499
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define KEY_WRITE
Definition: nt_native.h:1034
#define REG_DWORD
Definition: sdbapi.c:615
static LPWSTR CreateMultiSzString(IP_ADDR *pAddr, COPY_TYPE Type, LPDWORD Size, BOOL bComma)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ INetCfgComponentControl_fnCancelChanges()

HRESULT WINAPI INetCfgComponentControl_fnCancelChanges ( INetCfgComponentControl *  iface)

Definition at line 3979 of file tcpipconf_notify.c.

3981{
3982 TRACE("INetCfgComponentControl_fnCancelChanges()\n");
3983 return S_OK;
3984}

◆ INetCfgComponentControl_fnInitialize()

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

Definition at line 3539 of file tcpipconf_notify.c.

3544{
3545 TRACE("INetCfgComponentControl_fnInitialize()\n");
3547 HRESULT hr;
3548
3549 This->pNCfg = pINetCfg;
3550 This->pNComp = pIComp;
3551
3552 hr = Initialize(This);
3553 if (FAILED(hr))
3554 {
3555 ERR("INetCfgComponentControl_fnInitialize failed\n");
3556 return hr;
3557 }
3558
3559 TRACE("INetCfgComponentControl_fnInitialize success\n");
3560
3561 return S_OK;
3562}
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT hr
Definition: delayimp.cpp:573
static void Initialize()
Definition: xlate.c:212

◆ INetCfgComponentControl_fnQueryInterface()

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

Definition at line 3472 of file tcpipconf_notify.c.

3476{
3477 TRACE("INetCfgComponentControl_fnQueryInterface()\n");
3479
3480 *ppvObj = NULL;
3481
3482 if (IsEqualIID (iid, &IID_IUnknown) ||
3484 {
3485 *ppvObj = This;
3487 return S_OK;
3488 }
3490 {
3491 *ppvObj = (LPVOID*)&This->lpVtblCompPropertyUi;
3493 return S_OK;
3494 }
3495 else if (IsEqualIID(iid, &IID_INetCfgComponentSetup))
3496 {
3497 *ppvObj = (LPVOID*)&This->lpVtblCompSetup;
3499 return S_OK;
3500 }
3501
3502 return E_NOINTERFACE;
3503}
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:49
#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 3519 of file tcpipconf_notify.c.

3521{
3522 TRACE("INetCfgComponentControl_fnRelease()\n");
3524 ULONG refCount = InterlockedDecrement(&This->ref);
3525
3526 if (!refCount)
3527 {
3528 if (This->pCurrentConfig)
3529 FreeSettings(This->pCurrentConfig);
3530 if (This->pOldConfig)
3531 FreeSettings(This->pOldConfig);
3533 }
3534 return refCount;
3535}
#define InterlockedDecrement
Definition: armddk.h:52
VOID FreeSettings(TcpipSettings *pSettings)

◆ INetCfgComponentPropertyUi_fnAddRef()

ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef ( INetCfgComponentPropertyUi *  iface)

Definition at line 2992 of file tcpipconf_notify.c.

2994{
2995 TRACE("INetCfgComponentPropertyUi_fnAddRef()\n");
2997 return INetCfgComponentControl_AddRef((INetCfgComponentControl*)This);
2998}
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentPropertyUi(INetCfgComponentPropertyUi *iface)

◆ INetCfgComponentPropertyUi_fnApplyProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3437 of file tcpipconf_notify.c.

3439{
3440 TRACE("INetCfgComponentPropertyUi_fnApplyProperties()\n");
3441 return S_OK;
3442}

◆ INetCfgComponentPropertyUi_fnCancelProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3446 of file tcpipconf_notify.c.

3448{
3449 TRACE("INetCfgComponentPropertyUi_fnCancelProperties()\n");
3450 return S_OK;
3451}

◆ INetCfgComponentPropertyUi_fnMergePropPages()

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

Definition at line 3380 of file tcpipconf_notify.c.

3387{
3388 TRACE("INetCfgComponentPropertyUi_fnMergePropPages()\n");
3389 HPROPSHEETPAGE * hppages;
3390 UINT NumPages;
3392
3393 if (This->pCurrentConfig->DhcpEnabled)
3394 NumPages = 2;
3395 else
3396 NumPages = 1;
3397
3398 hppages = (HPROPSHEETPAGE*) CoTaskMemAlloc(sizeof(HPROPSHEETPAGE) * NumPages);
3399 if (!hppages)
3400 return E_FAIL;
3401
3403 if (!hppages[0])
3404 {
3405 CoTaskMemFree(hppages);
3406 return E_FAIL;
3407 }
3408 if (NumPages == 2)
3409 {
3411 if (!hppages[1])
3412 {
3413 DestroyPropertySheetPage(hppages[0]);
3414 CoTaskMemFree(hppages);
3415 return E_FAIL;
3416 }
3417 }
3418
3419 *pahpspPrivate = (BYTE*)hppages;
3420 *pcPages = NumPages;
3421
3422 return S_OK;
3423}
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 2980 of file tcpipconf_notify.c.

2984{
2985 TRACE("INetCfgComponentPropertyUi_fnQueryInterface()\n");
2987 return INetCfgComponentControl_QueryInterface((INetCfgComponentControl*)This, iid, ppvObj);
2988}
#define INetCfgComponentControl_QueryInterface(p, a, b)
Definition: netcfgn.h:48

◆ INetCfgComponentPropertyUi_fnQueryPropertyUi()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 3012 of file tcpipconf_notify.c.

3015{
3016 TRACE("INetCfgComponentPropertyUi_fnQueryPropertyUi()\n");
3017
3018 INetLanConnectionUiInfo * pLanInfo;
3019 HRESULT hr;
3021
3022 hr = IUnknown_QueryInterface(pUnkReserved, &IID_INetLanConnectionUiInfo, (LPVOID*)&pLanInfo);
3023 if (FAILED(hr))
3024 return hr;
3025
3026 INetLanConnectionUiInfo_GetDeviceGuid(pLanInfo, &This->NetCfgInstanceId);
3027
3028 //FIXME
3029 // check if tcpip is enabled on that binding */
3030 IUnknown_Release(pUnkReserved);
3031 return S_OK;
3032}
static IUnknown * pUnkReserved
Definition: asmenum.c:33
EXTERN_C const IID IID_INetLanConnectionUiInfo
Definition: netcfgn.h:234
#define INetLanConnectionUiInfo_GetDeviceGuid(p, a)
Definition: netcfgn.h:231

◆ INetCfgComponentPropertyUi_fnRelease()

ULONG WINAPI INetCfgComponentPropertyUi_fnRelease ( INetCfgComponentPropertyUi *  iface)

Definition at line 3002 of file tcpipconf_notify.c.

3004{
3005 TRACE("INetCfgComponentPropertyUi_fnRelease()\n");
3007 return INetCfgComponentControl_Release((INetCfgComponentControl*)This);
3008}
#define INetCfgComponentControl_Release(p)
Definition: netcfgn.h:50

◆ INetCfgComponentPropertyUi_fnSetContext()

HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 3036 of file tcpipconf_notify.c.

3039{
3040 TRACE("INetCfgComponentPropertyUi_fnSetContext()\n");
3042
3043 if (!iface || !pUnkReserved)
3044 return E_POINTER;
3045
3046 This->pUnknown = pUnkReserved;
3047 return S_OK;
3048}
#define E_POINTER
Definition: winerror.h:3480

◆ INetCfgComponentPropertyUi_fnValidateProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties ( INetCfgComponentPropertyUi *  iface,
HWND  hwndDlg 
)

Definition at line 3427 of file tcpipconf_notify.c.

3430{
3431 TRACE("INetCfgComponentPropertyUi_fnValidateProperties()\n");
3432 return S_OK;
3433}

◆ INetCfgComponentSetup_fnAddRef()

ULONG WINAPI INetCfgComponentSetup_fnAddRef ( INetCfgComponentSetup *  iface)

Definition at line 4016 of file tcpipconf_notify.c.

4018{
4019 TRACE("INetCfgComponentSetup_fnAddRef()\n");
4021 return INetCfgComponentControl_AddRef((INetCfgComponentControl*)This);
4022}
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentSetup(INetCfgComponentSetup *iface)

◆ INetCfgComponentSetup_fnInstall()

HRESULT WINAPI INetCfgComponentSetup_fnInstall ( INetCfgComponentSetup *  iface,
DWORD  dwSetupFlags 
)

Definition at line 4036 of file tcpipconf_notify.c.

4039{
4040 TRACE("INetCfgComponentSetup_fnInstall()\n");
4041 return S_OK;
4042}

◆ INetCfgComponentSetup_fnQueryInterface()

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

Definition at line 4004 of file tcpipconf_notify.c.

4008{
4009 TRACE("INetCfgComponentSetup_fnQueryInterface()\n");
4011 return INetCfgComponentControl_QueryInterface((INetCfgComponentControl*)This, iid, ppvObj);
4012}

◆ INetCfgComponentSetup_fnReadAnswerFile()

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

Definition at line 4057 of file tcpipconf_notify.c.

4061{
4062 TRACE("INetCfgComponentSetup_fnReadAnswerFile()\n");
4063 return S_OK;
4064}

◆ INetCfgComponentSetup_fnRelease()

ULONG WINAPI INetCfgComponentSetup_fnRelease ( INetCfgComponentSetup *  iface)

Definition at line 4026 of file tcpipconf_notify.c.

4028{
4029 TRACE("INetCfgComponentSetup_fnRelease()\n");
4031 return INetCfgComponentControl_Release((INetCfgComponentControl*)This);
4032}

◆ INetCfgComponentSetup_fnRemoving()

HRESULT WINAPI INetCfgComponentSetup_fnRemoving ( INetCfgComponentSetup *  iface)

Definition at line 4068 of file tcpipconf_notify.c.

4070{
4071 TRACE("INetCfgComponentSetup_fnRemoving()\n");
4072 return S_OK;
4073}

◆ INetCfgComponentSetup_fnUpgrade()

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

Definition at line 4046 of file tcpipconf_notify.c.

4050{
4051 TRACE("INetCfgComponentSetup_fnUpgrade()\n");
4052 return S_OK;
4053}

◆ InitFilterListBox()

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

Definition at line 251 of file tcpipconf_notify.c.

252{
253 LVITEMW li;
254 LPWSTR pCur;
255 INT iItem;
256
257 if (!pData || !_wtoi(pData))
258 {
259 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
261 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
262 return;
263 }
264
265 pCur = pData;
266 memset(&li, 0x0, sizeof(LVITEMW));
267 li.mask = LVIF_TEXT;
268 iItem = 0;
269
270 while(pCur[0])
271 {
272 li.pszText = pCur;
273 li.iItem = iItem;
274 SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
275 iItem++;
276 pCur += wcslen(pCur) + 1;
277 }
278
279 if (!iItem)
280 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
281 else
282 CheckDlgButton(hwndDlg, RestrictButton, BST_CHECKED);
283}
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 3231 of file tcpipconf_notify.c.

3232{
3233 DWORD dwSize;
3234 WCHAR szBuffer[50];
3235 IP_ADAPTER_INFO * pCurrentAdapter;
3236 IP_ADAPTER_INFO *pInfo = NULL;
3237 PIP_PER_ADAPTER_INFO pPerAdapterInfo = NULL;
3238 LPOLESTR pAdapterName = NULL;
3239 HRESULT hr;
3240 BOOL bFound;
3241 TcpipSettings *pCurrentConfig = NULL, *pOldConfig = NULL;
3242 ULONG uLength;
3243
3244 if (This->pCurrentConfig)
3245 return S_OK;
3246
3247 hr = StringFromCLSID(&This->NetCfgInstanceId, &pAdapterName);
3248 if (FAILED(hr))
3249 return hr;
3250
3251 dwSize = 0;
3253 {
3254 CoTaskMemFree(pAdapterName);
3255 return E_FAIL;
3256 }
3257
3258 pInfo = CoTaskMemAlloc(dwSize);
3259 if (!pInfo)
3260 {
3261 CoTaskMemFree(pAdapterName);
3262 return E_FAIL;
3263 }
3264
3265 if (GetAdaptersInfo(pInfo, &dwSize) != ERROR_SUCCESS)
3266 {
3267 CoTaskMemFree(pAdapterName);
3268 CoTaskMemFree(pInfo);
3269 return E_FAIL;
3270 }
3271
3272 pCurrentAdapter = pInfo;
3273 bFound = FALSE;
3274 while(pCurrentAdapter)
3275 {
3276 szBuffer[0] = L'\0';
3277 if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
3278 {
3279 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
3280 }
3281 if (!_wcsicmp(szBuffer, pAdapterName))
3282 {
3283 bFound = TRUE;
3284 break;
3285 }
3286 pCurrentAdapter = pCurrentAdapter->Next;
3287 }
3288
3289 if (!bFound)
3290 {
3291 CoTaskMemFree(pAdapterName);
3292 CoTaskMemFree(pInfo);
3293 return E_FAIL;
3294 }
3295
3296 pPerAdapterInfo = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(sizeof(IP_PER_ADAPTER_INFO));
3297 ZeroMemory(pPerAdapterInfo, sizeof(IP_PER_ADAPTER_INFO));
3298
3299 if (GetPerAdapterInfo(pCurrentAdapter->Index, pPerAdapterInfo, &uLength) == ERROR_BUFFER_OVERFLOW)
3300 {
3301 CoTaskMemFree(pPerAdapterInfo);
3302 pPerAdapterInfo = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(uLength);
3303 if (pPerAdapterInfo)
3304 {
3305 ZeroMemory(pPerAdapterInfo, uLength);
3306 GetPerAdapterInfo(pCurrentAdapter->Index, pPerAdapterInfo, &uLength);
3307 }
3308 }
3309
3310 pCurrentConfig = CoTaskMemAlloc(sizeof(TcpipSettings));
3311 if (!pCurrentConfig)
3312 {
3313 hr = E_FAIL;
3314 goto done;
3315 }
3316
3317 ZeroMemory(pCurrentConfig, sizeof(TcpipSettings));
3318
3319 pOldConfig = CoTaskMemAlloc(sizeof(TcpipSettings));
3320 if (!pOldConfig)
3321 {
3322 hr = E_FAIL;
3323 goto done;
3324 }
3325
3326 ZeroMemory(pOldConfig, sizeof(TcpipSettings));
3327
3328 hr = LoadTcpIpSettings(pCurrentConfig, pAdapterName, pCurrentAdapter, pPerAdapterInfo);
3329 if (FAILED(hr))
3330 goto done;
3331
3332 hr = LoadFilterSettings(pCurrentConfig, pAdapterName);
3333 if (FAILED(hr))
3334 goto done;
3335
3336 hr = LoadDNSSettings(pCurrentConfig, pAdapterName);
3337 if (FAILED(hr))
3338 goto done;
3339
3340 hr = LoadTcpIpSettings(pOldConfig, pAdapterName, pCurrentAdapter, pPerAdapterInfo);
3341 if (FAILED(hr))
3342 goto done;
3343
3344 hr = LoadFilterSettings(pOldConfig, pAdapterName);
3345 if (FAILED(hr))
3346 goto done;
3347
3348 hr = LoadDNSSettings(pOldConfig, pAdapterName);
3349 if (FAILED(hr))
3350 goto done;
3351
3352done:
3353 if (pPerAdapterInfo)
3354 CoTaskMemFree(pPerAdapterInfo);
3355
3356 CoTaskMemFree(pInfo);
3357
3358 if (pAdapterName)
3359 CoTaskMemFree(pAdapterName);
3360
3361 if (FAILED(hr))
3362 {
3363 if (pCurrentConfig)
3364 FreeSettings(pCurrentConfig);
3365
3366 if (pOldConfig)
3367 FreeSettings(pOldConfig);
3368 }
3369 else
3370 {
3371 This->pCurrentConfig = pCurrentConfig;
3372 This->pOldConfig = pOldConfig;
3373 }
3374
3375 return hr;
3376}
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
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
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:42
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:44
HRESULT LoadDNSSettings(TcpipSettings *pSettings, LPOLESTR pAdapterName)
HRESULT LoadFilterSettings(TcpipSettings *pSettings, LPOLESTR pAdapterName)
HRESULT LoadTcpIpSettings(TcpipSettings *pSettings, LPOLESTR pAdapterName, IP_ADAPTER_INFO *pAdapterInfo, IP_PER_ADAPTER_INFO *pPerAdapterInfo)
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:307

◆ InitializePropertySheetPage()

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

Definition at line 534 of file tcpipconf_notify.c.

535{
536 PROPSHEETPAGEW ppage;
537
538 memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW));
539 ppage.dwSize = sizeof(PROPSHEETPAGEW);
540 ppage.dwFlags = PSP_DEFAULT;
541 ppage.u.pszTemplate = resname;
542 ppage.pfnDlgProc = dlgproc;
543 ppage.lParam = lParam;
545 if (szTitle)
546 {
547 ppage.dwFlags |= PSP_USETITLE;
548 ppage.pszTitle = szTitle;
549 }
550 return CreatePropertySheetPageW(&ppage);
551}
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 1613 of file tcpipconf_notify.c.

1616{
1617 WCHAR szBuffer[200];
1618 LPWSTR pFirst, pSep, pList;
1619 IP_ADDR * pAddr;
1620 DWORD dwIpAddr;
1621
1622 /* insert DNS addresses */
1623 pAddr = This->pCurrentConfig->Ns;
1624 while(pAddr)
1625 {
1626 dwIpAddr = pAddr->IpAddress;
1627 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1628 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1629
1630 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_ADDSTRING, 0, (LPARAM)szBuffer);
1631 pAddr = pAddr->Next;
1632 }
1634
1635 if (!This->pCurrentConfig->pDNS)
1636 return;
1637
1638 if (This->pCurrentConfig->pDNS->RegisterAdapterName)
1640 else
1642
1643 if (This->pCurrentConfig->pDNS->RegistrationEnabled)
1645
1646 if (This->pCurrentConfig->pDNS->szDomain[0])
1647 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)szBuffer);
1648
1649 if (This->pCurrentConfig->pDNS->UseDomainNameDevolution)
1651
1652 if (!This->pCurrentConfig->pDNS->szSearchList || (wcslen(This->pCurrentConfig->pDNS->szSearchList) == 0))
1653 {
1656
1657 return;
1658 }
1659
1660 pList = This->pCurrentConfig->pDNS->szSearchList;
1661 if (wcslen(pList))
1662 {
1663 pFirst = pList;
1664 do
1665 {
1666 pSep = wcschr(pFirst, L',');
1667 if (pSep)
1668 {
1669 pSep[0] = L'\0';
1671 pFirst = pSep + 1;
1672 pSep[0] = L',';
1673 }
1674 else
1675 {
1677 break;
1678 }
1679 }while(TRUE);
1680
1684 }
1685}
#define IDC_DNSSUFFIXLIST
Definition: resource.h:66
#define IDC_SUFFIX
Definition: resource.h:72
#define IDC_USESUFFIX
Definition: resource.h:74
#define IDC_REGSUFFIX
Definition: resource.h:73
#define IDC_PRIMSUFFIX
Definition: resource.h:63
#define IDC_SELSUFFIX
Definition: resource.h:65
#define IDC_DNSADDRLIST
Definition: resource.h:57
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:64
#define IDC_DNSSUFFIXADD
Definition: resource.h:69
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 690 of file tcpipconf_notify.c.

693{
694 RECT rect;
695 LVITEMW li;
696 WCHAR szBuffer[100];
697
701
702 if (This->pCurrentConfig->DhcpEnabled)
703 {
704 if (LoadStringW(netcfgx_hInstance, IDS_DHCPACTIVE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
705 {
706 ZeroMemory(&li, sizeof(LVITEMW));
707 li.mask = LVIF_TEXT;
708 li.pszText = szBuffer;
710 }
712 }
713 else
714 {
715 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_IPLIST), This->pCurrentConfig->Ip, TRUE);
716 }
717
720
724
725 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_GWLIST), This->pCurrentConfig->Gw, FALSE);
726
729
731 if (This->pCurrentConfig->Metric)
732 {
734 SetDlgItemInt(hwndDlg, IDC_IFMETRIC, This->pCurrentConfig->Metric, FALSE);
735 }
736 else
737 {
740 }
741}
RECT rect
Definition: combotst.c:67
#define IDS_METRIC
Definition: resource.h:77
#define IDC_IPDEL
Definition: resource.h:45
#define IDC_GWDEL
Definition: resource.h:49
#define IDS_SUBMASK
Definition: resource.h:113
#define IDC_IPLIST
Definition: resource.h:42
#define IDC_GWMOD
Definition: resource.h:48
#define IDS_DHCPACTIVE
Definition: resource.h:116
#define IDS_GATEWAY
Definition: resource.h:114
#define IDC_IPADD
Definition: resource.h:43
#define IDC_IPMOD
Definition: resource.h:44
#define IDS_IPADDR
Definition: resource.h:112
#define IDC_IFAUTOMETRIC
Definition: resource.h:50
#define IDC_GWLIST
Definition: resource.h:46
#define IDC_IFMETRIC
Definition: resource.h:51
LONG right
Definition: windef.h:108
LONG left
Definition: windef.h:106
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 559 of file tcpipconf_notify.c.

562{
563 WCHAR szText[500];
564 /* store context */
566
567 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTER, szText, sizeof(szText)/sizeof(WCHAR)))
568 {
569 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
570 if (SendDlgItemMessageW(hwndDlg, IDC_OPTLIST, LB_ADDSTRING, 0, (LPARAM)szText) != LB_ERR)
572 }
573
574 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTERDESC, szText, sizeof(szText)/sizeof(WCHAR)))
575 {
576 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
577 SendDlgItemMessageW(hwndDlg, IDC_OPTDESC, WM_SETTEXT, 0, (LPARAM)szText);
578 }
579}
#define IDS_TCPFILTERDESC
Definition: resource.h:110
#define IDC_OPTLIST
Definition: resource.h:76
#define IDS_TCPFILTER
Definition: resource.h:111
#define IDC_OPTDESC
Definition: resource.h:78
__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 2254 of file tcpipconf_notify.c.

2257{
2262
2267
2272
2277
2282
2283 if (pCurSettings->AltConfig.IpAddress == 0)
2284 {
2291 }
2292 else
2293 {
2295
2296 /* Set ip address */
2297 if (pCurSettings->AltConfig.IpAddress)
2299
2300 /* Set subnet mask */
2301 if (pCurSettings->AltConfig.SubnetMask)
2303
2304 /* Set default gateway */
2305 if (pCurSettings->AltConfig.DefaultGateway)
2307
2308 /* Set primary dns server */
2309 if (pCurSettings->AltConfig.DnsServer1)
2311
2312 /* Set secondary dns server */
2313 if (pCurSettings->AltConfig.DnsServer2)
2315 }
2316
2317 return S_OK;
2318}
#define IDC_ALTDNS2
Definition: resource.h:40
#define IDC_ALTSTATIC
Definition: resource.h:35
#define IDC_ALTIPADDR
Definition: resource.h:36
#define IDC_ALTDNS1
Definition: resource.h:39
#define IDC_ALTAPIPA
Definition: resource.h:34
#define IDC_ALTSUBNETMASK
Definition: resource.h:37
#define IDC_ALTDEFGATEWAY
Definition: resource.h:38
#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)

Referenced by TcpipAltConfDlg().

◆ InitializeTcpipBasicDlgCtrls()

HRESULT InitializeTcpipBasicDlgCtrls ( HWND  hwndDlg,
TcpipSettings pCurSettings 
)

Definition at line 2602 of file tcpipconf_notify.c.

2605{
2610
2615
2620
2625
2630
2631 if (pCurSettings->DhcpEnabled)
2632 {
2638 }
2639 else
2640 {
2642
2643 if (pCurSettings->Ip)
2644 {
2645 /* set current ip address */
2646 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2647 /* set current hostmask */
2648 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2649 }
2650
2651 if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2652 {
2653 /* set current gateway */
2654 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2655 }
2656 }
2657
2658 if (pCurSettings->DnsDhcpEnabled)
2659 {
2663 }
2664 else
2665 {
2669 if (pCurSettings->Ns)
2670 {
2671 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2672 if (pCurSettings->Ns->Next)
2673 {
2674 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2675 }
2676 else
2677 {
2679 }
2680 }
2681 else
2682 {
2685 }
2686 }
2687
2688 return S_OK;
2689}
#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_FIXEDDNS
Definition: resource.h:29
#define IDC_AUTODNS
Definition: resource.h:28
#define IDC_DNS2
Definition: resource.h:31
#define IDC_DEFGATEWAY
Definition: resource.h:27
#define IDC_IPADDR
Definition: resource.h:25
#define IPM_CLEARADDRESS
Definition: commctrl.h:4470
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ InsertColumnToListView()

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

Definition at line 617 of file tcpipconf_notify.c.

622{
623 WCHAR szBuffer[200];
624 LVCOLUMNW lc;
625
626 if (!LoadStringW(netcfgx_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
627 return;
628
629 memset(&lc, 0, sizeof(LV_COLUMN) );
631 lc.iSubItem = SubItem;
632 lc.fmt = LVCFMT_FIXED_WIDTH;
633 lc.cx = Size;
634 lc.cchTextMax = wcslen(szBuffer);
635 lc.pszText = szBuffer;
636
637 (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, SubItem, (LPARAM)&lc);
638}
#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 641 of file tcpipconf_notify.c.

645{
646 WCHAR szBuffer[70];
647 DWORD dwIpAddr;
648 UINT itemCount = 0;
649 LVITEMW li;
650
651 while(pAddr)
652 {
653 ZeroMemory(&li, sizeof(li));
654 li.mask = LVIF_TEXT;
655 li.iItem = itemCount;
656 li.iSubItem = 0;
657 dwIpAddr = pAddr->IpAddress;
658 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
659 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
660
661 li.pszText = szBuffer;
662 li.iItem = SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
663 if (li.iItem != -1)
664 {
665 if (bSubMask)
666 {
667 dwIpAddr = pAddr->u.Subnetmask;
668 swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
669 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
670 }
671 else
672 {
673 if (pAddr->u.Metric)
674 swprintf(szBuffer, L"%u", pAddr->u.Metric);
675 else
676 LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
677 }
678
679 li.mask = LVIF_TEXT;
680 li.iSubItem = 1;
681 li.pszText = szBuffer;
682 SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
683 }
684 itemCount++;
685 pAddr = pAddr->Next;
686 }
687}
#define IDS_AUTOMATIC
Definition: resource.h:117
#define LVM_SETITEMW
Definition: commctrl.h:2402

Referenced by InitializeTcpipAdvancedIpDlg().

◆ LaunchAdvancedTcpipSettings()

VOID LaunchAdvancedTcpipSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2148 of file tcpipconf_notify.c.

2151{
2152 PROPSHEETHEADERW pinfo;
2153 HPROPSHEETPAGE hppages[3];
2154 WCHAR szBuffer[100];
2155
2159
2160
2161 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
2162 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2163 else
2164 szBuffer[0] = L'\0';
2165
2166 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
2167 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
2168 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
2170 pinfo.u3.phpage = hppages;
2171 pinfo.nPages = 3;
2172 pinfo.hwndParent = hwndDlg;
2174 pinfo.pszCaption = szBuffer;
2176 pinfo.pfnCallback = PropSheetProc;
2177
2179 if (PropertySheetW(&pinfo) > 0)
2180 {
2181 InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2182 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2183 }
2184}
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 ( TcpipSettings pSettings,
LPOLESTR  pAdapterName 
)

Definition at line 3109 of file tcpipconf_notify.c.

3112{
3114 WCHAR szBuffer[200];
3115 HKEY hKey;
3116 DWORD dwSize;
3117
3119 if (!pDNS)
3120 return E_FAIL;
3121
3123
3124 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pAdapterName);
3126 {
3127 dwSize = sizeof(DWORD);
3128 RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&pDNS->RegisterAdapterName, &dwSize);
3129
3130 dwSize = sizeof(DWORD);
3131 RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&pDNS->RegistrationEnabled, &dwSize);
3132
3133 dwSize = sizeof(pDNS->szDomain);
3134 RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)pDNS->szDomain, &dwSize);
3135
3137 }
3138
3139 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
3140 {
3141 dwSize = sizeof(DWORD);
3142 RegQueryValueExW(hKey, L"UseDomainNameDevolution", NULL, NULL, (LPBYTE)&pDNS->UseDomainNameDevolution, &dwSize);
3143
3144 dwSize = 0;
3145 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, NULL, &dwSize) == ERROR_SUCCESS)
3146 {
3148 if (pDNS->szSearchList)
3149 {
3150 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, (LPBYTE)pDNS->szSearchList, &dwSize) != ERROR_SUCCESS)
3151 {
3153 pDNS->szSearchList = NULL;
3154 }
3155 }
3156 }
3158 }
3159
3160 pSettings->pDNS = pDNS;
3161
3162 return S_OK;
3163}
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 ( TcpipSettings pSettings,
LPOLESTR  pAdapterName 
)

Definition at line 3188 of file tcpipconf_notify.c.

3191{
3192 HKEY hKey;
3193 TcpFilterSettings *pFilter;
3194 WCHAR szBuffer[200];
3195 DWORD dwVal, dwSize;
3196
3198 if (!pFilter)
3199 return E_FAIL;
3200
3201 ZeroMemory(pFilter, sizeof(TcpFilterSettings));
3202
3203 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
3204 {
3205 dwSize = sizeof(DWORD);
3206 if (RegQueryValueExW(hKey, L"EnableSecurityFilters", NULL, NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
3207 pFilter->EnableSecurityFilters = dwVal;
3209 }
3210 else
3211 {
3212 pFilter->EnableSecurityFilters = FALSE;
3213 }
3214
3215 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pAdapterName);
3217 {
3218 pFilter->szTCPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"TCPAllowedPorts", &pFilter->TCPSize);
3219 pFilter->szUDPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"UDPAllowedPorts", &pFilter->UDPSize);
3220 pFilter->szRawIPAllowedProtocols = LoadTcpFilterSettingsFromRegistry(hKey, L"RawIPAllowedProtocols", &pFilter->IPSize);
3222 }
3223
3224 pSettings->pFilter = pFilter;
3225
3226 return S_OK;
3227}
LPWSTR LoadTcpFilterSettingsFromRegistry(HKEY hKey, LPCWSTR szName, LPDWORD Size)

Referenced by Initialize().

◆ LoadTcpFilterSettingsFromRegistry()

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

Definition at line 3166 of file tcpipconf_notify.c.

3167{
3168 DWORD dwSize;
3169 LPWSTR pData;
3170
3172 return NULL;
3173
3175 if (!pData)
3176 return NULL;
3177
3179 {
3181 return NULL;
3182 }
3183 *Size = dwSize;
3184 return pData;
3185}
static const WCHAR szName[]
Definition: powrprof.c:45

Referenced by LoadFilterSettings().

◆ LoadTcpIpSettings()

HRESULT LoadTcpIpSettings ( TcpipSettings pSettings,
LPOLESTR  pAdapterName,
IP_ADAPTER_INFO pAdapterInfo,
IP_PER_ADAPTER_INFO pPerAdapterInfo 
)

Definition at line 3051 of file tcpipconf_notify.c.

3056{
3057 HKEY hInterfaceKey, hConfigKey;
3058 WCHAR szBuffer[200];
3059 DWORD dwSize;
3060 HRESULT hr = S_OK;
3061
3062
3063 pSettings->DhcpEnabled = pAdapterInfo->DhcpEnabled;
3064 pSettings->Index = pAdapterInfo->Index;
3065
3066 if (!pAdapterInfo->DhcpEnabled)
3067 {
3068 CopyIpAddrString(&pAdapterInfo->IpAddressList, &pSettings->Ip, SUBMASK, NULL);
3069 }
3070
3071 CopyIpAddrString(&pAdapterInfo->GatewayList, &pSettings->Gw, METRIC, NULL);
3072
3073 CopyIpAddrString(&pPerAdapterInfo->DnsServerList, &pSettings->Ns, IPADDR, NULL);
3074
3075 pSettings->DnsDhcpEnabled = (pSettings->DhcpEnabled && (pSettings->Ns == NULL));
3076
3077 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pAdapterName);
3078 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hInterfaceKey) != ERROR_SUCCESS)
3079 {
3080 return E_FAIL;
3081 }
3082
3083 /* InterfaceMetric */
3084 dwSize = sizeof(DWORD);
3085 if (RegQueryValueExW(hInterfaceKey, L"InterfaceMetric", NULL, NULL, (LPBYTE)&pSettings->Metric, &dwSize) != ERROR_SUCCESS)
3086 pSettings->Metric = 0;
3087
3088
3089 /* Read the alternate configuration, if available */
3090 dwSize = 0;
3091 RegQueryValueExW(hInterfaceKey, L"ActiveConfigurations", NULL, NULL, NULL, &dwSize);
3092 if (dwSize)
3093 {
3094 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\DHCP\\Configurations\\Alternate_%s", pAdapterName);
3095 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hConfigKey) == ERROR_SUCCESS)
3096 {
3098 RegQueryValueExW(hConfigKey, L"Options", NULL, NULL, (LPBYTE)&pSettings->AltConfig, &dwSize);
3099 RegCloseKey(hConfigKey);
3100 }
3101 }
3102
3103 RegCloseKey(hInterfaceKey);
3104
3105 return hr;
3106}
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:52
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)

Referenced by Initialize().

◆ MoveItem()

VOID MoveItem ( HWND  hDlgCtrl,
INT  pos 
)

Definition at line 1722 of file tcpipconf_notify.c.

1725{
1726 WCHAR szBuffer[100];
1727 LRESULT lResult;
1728
1729 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1730 if (lResult != LB_ERR)
1731 {
1732 if (SendMessageW(hDlgCtrl, LB_GETTEXTLEN, (WPARAM)lResult, 0) < sizeof(szBuffer)/sizeof(WCHAR) - 1)
1733 {
1734 if (SendMessageW(hDlgCtrl, LB_GETTEXT, (WPARAM)lResult, (LPARAM)szBuffer) != LB_ERR)
1735 {
1736 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1737 SendMessageW(hDlgCtrl, LB_INSERTSTRING, (WPARAM)lResult + pos, (LPARAM)szBuffer);
1738 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult + pos, 0);
1739 }
1740 }
1741 }
1742}
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().

◆ NameServersChanged()

static BOOL NameServersChanged ( TcpipSettings pCurrentConfig,
TcpipSettings pOldConfig 
)
static

Definition at line 2943 of file tcpipconf_notify.c.

2946{
2947 IP_ADDR *pCurrentNs, *pOldNs;
2948 BOOL Changed = FALSE;
2949
2950 pCurrentNs = pCurrentConfig->Ns;
2951 pOldNs = pOldConfig->Ns;
2952 while (pCurrentNs && pOldNs)
2953 {
2954 if (pCurrentNs->IpAddress != pOldNs->IpAddress)
2955 {
2956 Changed = TRUE;
2957 break;
2958 }
2959
2960 pCurrentNs = pCurrentNs->Next;
2961 pOldNs = pOldNs->Next;
2962 }
2963
2964 if (Changed == FALSE)
2965 {
2966 if (((pCurrentNs == NULL) && (pOldNs != NULL)) ||
2967 ((pCurrentNs != NULL) && (pOldNs == NULL)))
2968 Changed = TRUE;
2969 }
2970
2971 return Changed;
2972}

Referenced by INetCfgComponentControl_fnApplyPnpChanges().

◆ PropSheetProc()

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

Definition at line 2131 of file tcpipconf_notify.c.

2132{
2133 // NOTE: This callback is needed to set large icon correctly.
2134 HICON hIcon;
2135 switch (uMsg)
2136 {
2137 case PSCB_INITIALIZED:
2138 {
2140 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
2141 break;
2142 }
2143 }
2144 return 0;
2145}
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 1744 of file tcpipconf_notify.c.

1746{
1747 LRESULT lResult, lCount;
1748
1749 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1750 if (lResult != LB_ERR)
1751 {
1752 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1753 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1754 if (lResult + 1 < lCount)
1755 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult, 0);
1756 else
1757 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lCount-1, 0);
1758 }
1759}

Referenced by TcpipAdvancedDnsDlg().

◆ StoreDNSSettings()

VOID StoreDNSSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This 
)

Definition at line 1811 of file tcpipconf_notify.c.

1814{
1815 INT iCount, iIndex;
1816 WCHAR Ip[16];
1817 IP_ADDR *pCur, *pLast;
1818
1819 FreeIPAddr(This->pCurrentConfig->Ns);
1820 This->pCurrentConfig->Ns = NULL;
1821
1822 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1823 if (!iCount || iCount == LB_ERR)
1824 {
1825 return;
1826 }
1827
1828 pLast = NULL;
1829 for(iIndex = 0; iIndex < iCount; iIndex++)
1830 {
1831 if (SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)Ip) == LB_ERR)
1832 break;
1833
1834 pCur = CoTaskMemAlloc(sizeof(IP_ADDR));
1835 if (!pCur)
1836 break;
1837 ZeroMemory(pCur, sizeof(IP_ADDR));
1838 pCur->IpAddress = GetIpAddressFromStringW(Ip);
1839
1840 if (!pLast)
1841 This->pCurrentConfig->Ns = pCur;
1842 else
1843 pLast->Next = pCur;
1844
1845 pLast = pCur;
1846 pCur = pCur->Next;
1847 }
1848}
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 1234 of file tcpipconf_notify.c.

1238{
1239 WCHAR szBuffer[30];
1240
1241 INT iIndex, iCount;
1242 IP_ADDR *pCur, *pLast;
1243
1244 iCount = ListView_GetItemCount(hDlgCtrl);
1245 if (!iCount)
1246 {
1247 return;
1248 }
1249
1250 pLast = NULL;
1251 for(iIndex = 0; iIndex < iCount; iIndex++)
1252 {
1253 if (GetListViewItem(hDlgCtrl, iIndex, 0, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1254 {
1255 pCur = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
1256 if (!pCur)
1257 break;
1258 ZeroMemory(pCur, sizeof(IP_ADDR));
1259
1260 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1261 pCur->IpAddress = GetIpAddressFromStringW(szBuffer);
1262
1263 if (GetListViewItem(hDlgCtrl, iIndex, 1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR) ))
1264 {
1265 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1266 if (bSubmask)
1267 pCur->u.Subnetmask = GetIpAddressFromStringW(szBuffer);
1268 else
1269 pCur->u.Metric = _wtoi(szBuffer);
1270 }
1271
1272 if (!pLast)
1273 {
1274 if (bSubmask)
1275 This->pCurrentConfig->Ip = pCur;
1276 else
1277 This->pCurrentConfig->Gw = pCur;
1278 }
1279 else
1280 {
1281 pLast->Next = pCur;
1282 }
1283
1284 pLast = pCur;
1285 }
1286 }
1287}
BOOL GetListViewItem(HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)

Referenced by TcpipAdvancedIpDlg().

◆ StoreTcpipAlternateSettings()

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

Definition at line 2187 of file tcpipconf_notify.c.

2191{
2192 DWORD dwAddr;
2193
2195 {
2196 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) != 4)
2197 {
2198 if (bApply)
2199 {
2202 return E_FAIL;
2203 }
2204 }
2205
2206 if (SendDlgItemMessageW(hwndDlg, IDC_ALTSUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) != 4)
2207 {
2208 if (bApply)
2210 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2211 {
2212 if (dwAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2213 dwAddr = MAKEIPADDRESS(255, 0, 0, 0);
2214 else if (dwAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2215 dwAddr = MAKEIPADDRESS(255, 255, 0, 0);
2216 else if (dwAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2217 dwAddr = MAKEIPADDRESS(255, 255, 255, 0);
2218
2220 }
2221 if (bApply)
2222 {
2224 return E_FAIL;
2225 }
2226 }
2227
2228 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2229 This->pCurrentConfig->AltConfig.IpAddress = dwAddr;
2230
2231 if (SendDlgItemMessageW(hwndDlg, IDC_ALTSUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2232 This->pCurrentConfig->AltConfig.SubnetMask = dwAddr;
2233
2234 if (SendDlgItemMessageW(hwndDlg, IDC_ALTDEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2235 This->pCurrentConfig->AltConfig.DefaultGateway = dwAddr;
2236
2237 if (SendDlgItemMessageW(hwndDlg, IDC_ALTDNS1, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2238 This->pCurrentConfig->AltConfig.DnsServer1 = dwAddr;
2239
2240 if (SendDlgItemMessageW(hwndDlg, IDC_ALTDNS2, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2241 This->pCurrentConfig->AltConfig.DnsServer2 = dwAddr;
2242 }
2243 else
2244 {
2245 ZeroMemory(&This->pCurrentConfig->AltConfig, sizeof(AlternateConfiguration));
2246 }
2247
2248 return S_OK;
2249}
#define IDS_NO_SUBMASK_SET
Definition: resource.h:109
#define IDS_NO_IPADDR_SET
Definition: resource.h:108
#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 TcpipAltConfDlg().

◆ StoreTcpipBasicSettings()

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

Definition at line 2428 of file tcpipconf_notify.c.

2432{
2433 DWORD dwIpAddr;
2434
2435 if (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED)
2436 {
2437 This->pCurrentConfig->DhcpEnabled = FALSE;
2438
2439 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2440 {
2441 if (bApply)
2442 {
2444 SetFocus(GetDlgItem(hwndDlg, IDC_IPADDR));
2445 return E_FAIL;
2446 }
2447 }
2448 if (!This->pCurrentConfig->Ip)
2449 {
2450 This->pCurrentConfig->Ip = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2451 if (!This->pCurrentConfig->Ip)
2452 return E_OUTOFMEMORY;
2453 ZeroMemory(This->pCurrentConfig->Ip, sizeof(IP_ADDR));
2454 }
2455 This->pCurrentConfig->Ip->IpAddress = dwIpAddr;
2456
2457 if (SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2458 {
2459 if (bApply)
2461 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2462 {
2463 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2464 dwIpAddr = MAKEIPADDRESS(255, 0, 0, 0);
2465 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2466 dwIpAddr = MAKEIPADDRESS(255, 255, 0, 0);
2467 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2468 dwIpAddr = MAKEIPADDRESS(255, 255, 255, 0);
2469
2471 }
2472 if (bApply)
2473 {
2475 return E_FAIL;
2476 }
2477 }
2478 /* store subnetmask */
2479 This->pCurrentConfig->Ip->u.Subnetmask = dwIpAddr;
2480
2481 if (SendDlgItemMessageW(hwndDlg, IDC_DEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2482 {
2483 if (!This->pCurrentConfig->Gw)
2484 {
2485 This->pCurrentConfig->Gw = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2486 if (!This->pCurrentConfig->Gw)
2487 return E_OUTOFMEMORY;
2488 ZeroMemory(This->pCurrentConfig->Gw, sizeof(IP_ADDR));
2489 }
2490
2491 /* store default gateway */
2492 This->pCurrentConfig->Gw->IpAddress = dwIpAddr;
2493 }
2494 }
2495 else
2496 {
2497 This->pCurrentConfig->DhcpEnabled = TRUE;
2498
2499 /* Delete all configured ip addresses */
2500 if (This->pCurrentConfig->Ip)
2501 {
2502 IP_ADDR * pNextIp = This->pCurrentConfig->Ip->Next;
2503 CoTaskMemFree(This->pCurrentConfig->Ip);
2504 This->pCurrentConfig->Ip = pNextIp;
2505 }
2506
2507 /* Delete all configured gateway addresses */
2508 if (This->pCurrentConfig->Gw)
2509 {
2510 IP_ADDR * pNextGw = This->pCurrentConfig->Gw->Next;
2511 CoTaskMemFree(This->pCurrentConfig->Gw);
2512 This->pCurrentConfig->Gw = pNextGw;
2513 }
2514 }
2515
2517 {
2518 This->pCurrentConfig->DnsDhcpEnabled = FALSE;
2519
2520 BOOL bSkip = FALSE;
2521 if (SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2522 {
2523 if (!This->pCurrentConfig->Ns)
2524 {
2525 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2526 if (!This->pCurrentConfig->Ns)
2527 return E_OUTOFMEMORY;
2528 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2529 }
2530 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2531 }
2532 else if (This->pCurrentConfig->Ns)
2533 {
2534 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next;
2535
2536 CoTaskMemFree(This->pCurrentConfig->Ns);
2537 This->pCurrentConfig->Ns = pTemp;
2538 bSkip = TRUE;
2539 }
2540
2541 if (SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2542 {
2543 if (!This->pCurrentConfig->Ns || bSkip)
2544 {
2545 if (!This->pCurrentConfig->Ns)
2546 {
2547 This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2548 if (!This->pCurrentConfig->Ns)
2549 return E_OUTOFMEMORY;
2550 ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2551 }
2552 This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2553 }
2554 else if (!This->pCurrentConfig->Ns->Next)
2555 {
2556 This->pCurrentConfig->Ns->Next = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2557 if (!This->pCurrentConfig->Ns->Next)
2558 return E_OUTOFMEMORY;
2559 ZeroMemory(This->pCurrentConfig->Ns->Next, sizeof(IP_ADDR));
2560 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2561 }
2562 else
2563 {
2564 This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2565 }
2566 }
2567 else
2568 {
2569 if (This->pCurrentConfig->Ns && This->pCurrentConfig->Ns->Next)
2570 {
2571 if (This->pCurrentConfig->Ns->Next->Next)
2572 {
2573 IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next->Next;
2574 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2575 This->pCurrentConfig->Ns->Next = pTemp;
2576 }
2577 else
2578 {
2579 CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2580 This->pCurrentConfig->Ns->Next = NULL;
2581 }
2582 }
2583 }
2584 }
2585 else
2586 {
2587 This->pCurrentConfig->DnsDhcpEnabled = TRUE;
2588
2589 /* Delete all configured name server addresses */
2590 if (This->pCurrentConfig->Ns)
2591 {
2592 IP_ADDR * pNextNs = This->pCurrentConfig->Ns->Next;
2593 CoTaskMemFree(This->pCurrentConfig->Ns);
2594 This->pCurrentConfig->Ns = pNextNs;
2595 }
2596 }
2597
2598 return S_OK;
2599}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ StoreTcpipFilterSettings()

TcpFilterSettings * StoreTcpipFilterSettings ( HWND  hwndDlg)

Definition at line 335 of file tcpipconf_notify.c.

337{
338 TcpFilterSettings * pFilter;
339
340 pFilter = CoTaskMemAlloc(sizeof(TcpFilterSettings));
341 if (!pFilter)
342 return NULL;
343
345 pFilter->EnableSecurityFilters = TRUE;
346 else
347 pFilter->EnableSecurityFilters = FALSE;
348
349 pFilter->szTCPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_TCP_LIST), &pFilter->TCPSize);
350 pFilter->szUDPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_UDP_LIST), &pFilter->UDPSize);
352
353 return pFilter;
354}
#define IDC_USE_FILTER
Definition: resource.h:95
#define IDC_IP_LIST
Definition: resource.h:92
#define IDC_UDP_LIST
Definition: resource.h:87
#define IDC_TCP_LIST
Definition: resource.h:82
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 1532 of file tcpipconf_notify.c.

1538{
1539 TcpipDnsSettings * pSettings;
1540 WCHAR szBuffer[100];
1541 DWORD dwIpAddr;
1542 LPNMIPADDRESS lpnmipa;
1543
1544 switch(uMsg)
1545 {
1546 case WM_INITDIALOG:
1547 pSettings = (TcpipDnsSettings*)lParam;
1549 if (!pSettings->bAdd)
1550 {
1551 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1552 {
1553 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1554 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1555 }
1556 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_SETTEXT, 0, (LPARAM)pSettings->szIP);
1557 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1558 }
1559 else
1560 {
1561 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1562 {
1563 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1564 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1565 }
1566 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1567 }
1568 return TRUE;
1569 case WM_COMMAND:
1570 if (LOWORD(wParam) == IDCANCEL)
1571 {
1572 EndDialog(hwndDlg, FALSE);
1573 break;
1574 }
1575 else if (LOWORD(wParam) == IDC_OK)
1576 {
1577 pSettings = (TcpipDnsSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1578 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pSettings->szIP);
1579 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->szIP) == LB_ERR)
1580 {
1581 if (pSettings->bAdd)
1582 SendMessageW(pSettings->hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)pSettings->szIP);
1583 EndDialog(hwndDlg, TRUE);
1584 break;
1585 }
1586 if (!pSettings->bAdd)
1587 {
1588 EndDialog(hwndDlg, FALSE);
1589 break;
1590 }
1592 break;
1593 }
1594 break;
1595 case WM_NOTIFY:
1596 lpnmipa = (LPNMIPADDRESS) lParam;
1597 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1598 {
1599 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1600 {
1601 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1602 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1603 }
1604 }
1605 break;
1606 }
1607 return FALSE;
1608}
#define IDC_OK
Definition: resource.h:59
WPARAM wParam
Definition: combotst.c:138
#define IDS_ADD
Definition: resource.h:120
#define IDS_MOD
Definition: resource.h:121
#define IDS_DUP_SUFFIX
Definition: resource.h:132
#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 901 of file tcpipconf_notify.c.

907{
908 LPNMIPADDRESS lpnmipa;
909 DWORD dwIpAddr;
910 TcpipIpSettings *pIpSettings;
911 WCHAR szBuffer[50];
913 LRESULT lResult;
914
915 switch(uMsg)
916 {
917 case WM_INITDIALOG:
918 pIpSettings = (TcpipIpSettings*)lParam;
920
929
930 if (pIpSettings->bAdd)
931 {
932 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
933 {
934 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
935 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
936 }
938 }
939 else
940 {
941 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
942 {
943 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
944 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
945 }
946
949 }
950 return TRUE;
951 case WM_NOTIFY:
952 lpnmipa = (LPNMIPADDRESS) lParam;
953 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
954 {
955 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
956 {
957 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
958 {
959 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
961 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
963 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
964 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
966 }
967 }
968 }
969 break;
970 case WM_COMMAND:
971 if (LOWORD(wParam) == IDC_OK)
972 {
973 pIpSettings = (TcpipIpSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
974 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pIpSettings->szIP);
975 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, WM_GETTEXT, 16, (LPARAM)pIpSettings->szMask);
976
977 ZeroMemory(&find, sizeof(LVFINDINFOW));
978 find.flags = LVFI_STRING;
979 find.psz = pIpSettings->szIP;
980 lResult = SendMessageW(pIpSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find);
981
982 if (lResult == -1)
983 {
984 EndDialog(hwndDlg, TRUE);
985 break;
986 }
987 else if (!pIpSettings->bAdd)
988 {
989 EndDialog(hwndDlg, FALSE);
990 break;
991 }
993 break;
994 }
995 else if (LOWORD(wParam) == IDCANCEL)
996 {
997 EndDialog(hwndDlg, FALSE);
998 }
999 break;
1000 }
1001 return FALSE;
1002}
static TAGID TAGID find
Definition: db.cpp:156
#define IDS_DUP_IPADDR
Definition: resource.h:133
#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 1020 of file tcpipconf_notify.c.

1026{
1027 WCHAR szBuffer[100];
1028 TcpipSuffixSettings * pSettings;
1029 LRESULT lLength;
1030
1031 switch(uMsg)
1032 {
1033 case WM_INITDIALOG:
1034 pSettings = (TcpipSuffixSettings*)lParam;
1035 if (!pSettings->bAdd)
1036 {
1037 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)pSettings->Suffix);
1038 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1039 {
1040 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1041 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1042 }
1043 CoTaskMemFree(pSettings->Suffix);
1044 pSettings->Suffix = NULL;
1045 }
1046 else
1047 {
1048 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1049 {
1050 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1051 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1052 }
1053 }
1054 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSettings);
1055 return TRUE;
1056 case WM_COMMAND:
1057 if (LOWORD(wParam) == IDCANCEL)
1058 {
1059 EndDialog(hwndDlg, FALSE);
1060 break;
1061 }
1062 else if (LOWORD(wParam) == IDC_OK)
1063 {
1064 lLength = SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXTLENGTH, 0, 0);
1065 if (lLength)
1066 {
1067 pSettings = (TcpipSuffixSettings*) GetWindowLongPtr(hwndDlg, DWLP_USER);
1068 pSettings->Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1)* sizeof(WCHAR));
1069 if (pSettings->Suffix)
1070 {
1071 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, lLength + 1, (LPARAM)pSettings->Suffix);
1072 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->Suffix) != LB_ERR)
1073 {
1075 CoTaskMemFree(pSettings->Suffix);
1076 break;
1077 }
1078
1079 if (!VerifyDNSSuffix(pSettings->Suffix))
1080 {
1082 CoTaskMemFree(pSettings->Suffix);
1083 break;
1084 }
1085 EndDialog(hwndDlg, TRUE);
1086 }
1087 }
1088 break;
1089 }
1090 }
1091 return FALSE;
1092}
#define IDS_DOMAIN_SUFFIX
Definition: resource.h:130
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 1852 of file tcpipconf_notify.c.

1858{
1861 TcpipDnsSettings Dns;
1862 LRESULT lIndex, lLength;
1863 TcpipSuffixSettings Suffix;
1864 LPPSHNOTIFY lppsn;
1865 WCHAR szSuffix[100];
1866 WCHAR szFormat[200];
1867 WCHAR szBuffer[300];
1868
1869
1870 switch(uMsg)
1871 {
1872 case WM_INITDIALOG:
1874 This = (TcpipConfNotifyImpl*)page->lParam;
1879 return TRUE;
1880 case WM_NOTIFY:
1881 lppsn = (LPPSHNOTIFY) lParam;
1882 if (lppsn->hdr.code == PSN_KILLACTIVE)
1883 {
1884 if (IsDlgButtonChecked(hwndDlg, IDC_SELSUFFIX) == BST_CHECKED &&
1886 {
1889 return TRUE;
1890 }
1891 if (SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, sizeof(szSuffix)/sizeof(WCHAR), (LPARAM)szSuffix))
1892 {
1893 szSuffix[(sizeof(szSuffix)/sizeof(WCHAR))-1] = L'\0';
1894 if (VerifyDNSSuffix(szSuffix) == FALSE)
1895 {
1896 if (LoadStringW(netcfgx_hInstance, IDS_DNS_SUFFIX, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1897 {
1898 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1899 swprintf(szBuffer, szFormat, szSuffix);
1900 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1901 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1902 else
1903 szFormat[0] = L'\0';
1904
1905 MessageBoxW(hwndDlg, szBuffer, szFormat, MB_ICONWARNING);
1907 SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
1908 return TRUE;
1909 }
1910 }
1911 }
1912 }
1913 else if (lppsn->hdr.code == PSN_APPLY)
1914 {
1916 if (!This->pCurrentConfig->pDNS)
1917 break;
1918
1921 {
1922 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1923 This->pCurrentConfig->pDNS->szSearchList = NULL;
1925 This->pCurrentConfig->pDNS->UseDomainNameDevolution = TRUE;
1926 else
1927 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1928 }
1929 else
1930 {
1931 CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1932 This->pCurrentConfig->pDNS->szSearchList = NULL;
1933 This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1934 This->pCurrentConfig->pDNS->szSearchList = GetListViewEntries(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST));
1935 }
1936
1938 {
1939 This->pCurrentConfig->pDNS->RegisterAdapterName = TRUE;
1941 This->pCurrentConfig->pDNS->RegistrationEnabled = TRUE;
1942 else
1943 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1944 }
1945 else
1946 {
1947 This->pCurrentConfig->pDNS->RegisterAdapterName = FALSE;
1948 This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1949 }
1950 }
1951 break;
1952 case WM_COMMAND:
1954 {
1956 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1957 break;
1958 }
1960 {
1962 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1963 break;
1964 }
1965 else if (LOWORD(wParam) == IDC_PRIMSUFFIX && HIWORD(wParam) == BN_CLICKED)
1966 {
1968 {
1976 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1977 }
1978 }
1979 else if (LOWORD(wParam) == IDC_SELSUFFIX && HIWORD(wParam) == BN_CLICKED)
1980 {
1982 {
1986 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1987 }
1988 break;
1989 }
1990 else if (LOWORD(wParam) == IDC_REGSUFFIX && HIWORD(wParam) == BN_CLICKED)
1991 {
1994 else
1996 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1997 }
1998 else if (LOWORD(wParam) == IDC_DNSADDRUP && HIWORD(wParam) == BN_CLICKED)
1999 {
2000 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), -1);
2003 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2004 break;
2005 }
2007 {
2008 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), 1);
2011 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2012 break;
2013 }
2015 {
2016 MoveItem(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST), -1);
2019 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2020 break;
2021 }
2023 {
2027 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2028 break;
2029 }
2030 else if (LOWORD(wParam) == IDC_DNSADDRDEL && HIWORD(wParam) == BN_CLICKED)
2031 {
2035 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2036 break;
2037 }
2039 {
2043 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2044 break;
2045 }
2046 else if (LOWORD(wParam) == IDC_DNSADDRADD && HIWORD(wParam) == BN_CLICKED)
2047 {
2048 Dns.bAdd = TRUE;
2049 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2051 {
2053 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2054 }
2055 break;
2056 }
2057 else if (LOWORD(wParam) == IDC_DNSADDRMOD && HIWORD(wParam) == BN_CLICKED)
2058 {
2059 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSADDRLIST, LB_GETCURSEL, 0, 0);
2060 if (lIndex != LB_ERR)
2061 {
2062 Dns.bAdd = FALSE;
2063 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2064 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_GETTEXT, (WPARAM)lIndex, (LPARAM)Dns.szIP);
2066 {
2068 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_INSERTSTRING, lIndex, (LPARAM)Dns.szIP);
2069 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_SETCURSEL, lIndex, 0);
2071 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2072 }
2073 }
2074 break;
2075 }
2077 {
2078 Suffix.bAdd = TRUE;
2079 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2080 Suffix.Suffix = NULL;
2082 {
2084 lIndex = SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_ADDSTRING, 0, (LPARAM)Suffix.Suffix);
2085 if (lIndex != LB_ERR)
2088 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2089 CoTaskMemFree(Suffix.Suffix);
2090 }
2091 break;
2092 }
2094 {
2095 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSSUFFIXLIST, LB_GETCURSEL, 0, 0);
2096 if (lIndex != LB_ERR)
2097 {
2098 Suffix.bAdd = FALSE;
2099 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2100 lLength = SendMessageW(Suffix.hDlgCtrl, LB_GETTEXTLEN, lIndex, 0);
2101 if (lLength != LB_ERR)
2102 {
2103 Suffix.Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1) * sizeof(WCHAR));
2104 if (Suffix.Suffix)
2105 {
2106 SendMessageW(Suffix.hDlgCtrl, LB_GETTEXT, lIndex, (LPARAM)Suffix.Suffix);
2107 Suffix.Suffix[lLength] = L'\0';
2109 {
2110 if (Suffix.Suffix)
2111 {
2113 SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_INSERTSTRING, lIndex, (LPARAM)Suffix.Suffix);
2116 CoTaskMemFree(Suffix.Suffix);
2117 }
2119 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2120 }
2121 }
2122 }
2123 }
2124 break;
2125 }
2126 }
2127 return FALSE;
2128}
#define IDC_DNSADDRMOD
Definition: resource.h:61
#define IDC_DNSSUFFIXUP
Definition: resource.h:67
#define IDC_DNSSUFFIXDEL
Definition: resource.h:71
#define IDC_DNSSUFFIXDOWN
Definition: resource.h:68
#define IDD_TCPIPDNS_DLG
Definition: resource.h:16
#define IDC_DNSADDRADD
Definition: resource.h:60
#define IDC_DNSADDRDEL
Definition: resource.h:62
#define IDC_DNSADDRUP
Definition: resource.h:58
#define IDS_NO_SUFFIX
Definition: resource.h:129
#define IDD_TCPIPSUFFIX_DLG
Definition: resource.h:17
#define IDC_DNSADDRDOWN
Definition: resource.h:59
#define IDS_DNS_SUFFIX
Definition: resource.h:131
#define IDC_DNSSUFFIXMOD
Definition: resource.h:70
#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 1292 of file tcpipconf_notify.c.

1298{
1301 INT_PTR res;
1302 WCHAR szBuffer[200];
1303 LPPSHNOTIFY lppsn;
1305 TcpipIpSettings Ip;
1306
1307 LVITEMW li;
1308
1309 switch(uMsg)
1310 {
1311 case WM_INITDIALOG:
1313 This = (TcpipConfNotifyImpl*)page->lParam;
1316 return TRUE;
1317 case WM_NOTIFY:
1318 lppsn = (LPPSHNOTIFY) lParam;
1319 if (lppsn->hdr.code == LVN_ITEMCHANGED)
1320 {
1322 BOOL bEnable;
1323
1324 if (lplv->hdr.idFrom == IDC_IPLIST)
1325 {
1327
1328 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0) &&
1329 (!This->pCurrentConfig->DhcpEnabled);
1330
1333 }
1334 else if (lplv->hdr.idFrom == IDC_GWLIST)
1335 {
1336 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0);
1337
1340 }
1341 }
1342 else if (lppsn->hdr.code == PSN_KILLACTIVE)
1343 {
1345 if (!This->pCurrentConfig->DhcpEnabled && ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST)) == 0)
1346 {
1349 return TRUE;
1350 }
1351
1353 {
1355 if ((val < 1) || (val > 9999))
1356 {
1359 return TRUE;
1360 }
1361 }
1362 }
1363 else if (lppsn->hdr.code == PSN_APPLY)
1364 {
1366 FreeIPAddr(This->pCurrentConfig->Gw);
1367 This->pCurrentConfig->Gw = NULL;
1368 FreeIPAddr(This->pCurrentConfig->Ip);
1369 This->pCurrentConfig->Ip = NULL;
1372
1374 This->pCurrentConfig->Metric = 0;
1375 else
1376 This->pCurrentConfig->Metric = GetDlgItemInt(hwndDlg, IDC_IFMETRIC, NULL, FALSE);
1377
1379 return TRUE;
1380 }
1381 break;
1382 case WM_COMMAND:
1384 {
1387 else
1389 }
1390 else if (LOWORD(wParam) == IDC_IPADD)
1391 {
1392 Ip.bAdd = TRUE;
1393 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1395 if (res)
1396 {
1397 memset(&li, 0x0, sizeof(LVITEMW));
1398 li.mask = LVIF_TEXT | LVIF_PARAM;
1399 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST));
1400 li.pszText = Ip.szIP;
1401 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_IPLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1402 if (li.iItem != -1)
1403 {
1404 li.mask = LVIF_TEXT;
1405 li.iSubItem = 1;
1406 li.pszText = Ip.szMask;
1408 }
1409 }
1410 }
1411 else if (LOWORD(wParam) == IDC_IPMOD)
1412 {
1413 memset(&li, 0x0, sizeof(LVITEMW));
1414 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_IPLIST));
1415 if (li.iItem < 0)
1416 {
1417 /* no item selected */
1419 SetFocus(GetDlgItem(hwndDlg, IDC_IPLIST));
1420 break;
1421 }
1422 Ip.bAdd = FALSE;
1423 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1424 if (GetIPListEntry(GetDlgItem(hwndDlg, IDC_IPLIST), li.iItem, &Ip))
1425 {
1427 if (res)
1428 {
1429 li.mask = LVIF_TEXT;
1430 li.pszText = Ip.szIP;
1432 li.pszText = Ip.szMask;
1433 li.iSubItem = 1;
1435 }
1436 }
1437 }
1438 else if (LOWORD(wParam) == IDC_IPDEL)
1439 {
1441 break;
1442 }
1443 else if (LOWORD(wParam) == IDC_GWADD)
1444 {
1445 Gw.bAdd = TRUE;
1446 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1448 if (res)
1449 {
1450 memset(&li, 0x0, sizeof(LVITEMW));
1451 li.mask = LVIF_TEXT;
1452 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_GWLIST));
1453 li.pszText = Gw.szIP;
1454 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_GWLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1455 if (li.iItem >= 0)
1456 {
1457 if (Gw.Metric)
1458 {
1459 swprintf(szBuffer, L"%u", Gw.Metric);
1460 li.iSubItem = 1;
1461 li.pszText = szBuffer;
1463 }
1464 else
1465 {
1466 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1467 {
1468 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1469 li.iSubItem = 1;
1470 li.pszText = szBuffer;
1472 }
1473 }
1474 }
1475 }
1476 break;
1477 }
1478 else if (LOWORD(wParam) == IDC_GWMOD)
1479 {
1480 memset(&li, 0x0, sizeof(LVITEMW));
1481 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_GWLIST));
1482 if (li.iItem < 0)
1483 {
1484 /* no item selected */
1486 SetFocus(GetDlgItem(hwndDlg, IDC_GWLIST));
1487 break;
1488 }
1489 if (GetGWListEntry(GetDlgItem(hwndDlg, IDC_GWLIST), li.iItem, &Gw))
1490 {
1491 Gw.bAdd = FALSE;
1492 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1494 if (res)
1495 {
1496 li.mask = LVIF_TEXT;
1497 li.pszText = Gw.szIP;
1499 if (Gw.Metric)
1500 {
1501 swprintf(szBuffer, L"%u", Gw.Metric);
1502 li.iSubItem = 1;
1503 li.pszText = szBuffer;
1505 }
1506 else
1507 {
1508 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1509 {
1510 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1511 li.iSubItem = 1;
1512 li.pszText = szBuffer;
1514 }
1515 }
1516 }
1517 }
1518 break;
1519 }
1520 else if (LOWORD(wParam) == IDC_GWDEL)
1521 {
1523 break;
1524 }
1525 break;
1526 }
1527 return FALSE;
1528}
#define IDC_GWADD
Definition: resource.h:47
#define IDD_TCPIPADDIP_DLG
Definition: resource.h:14
#define IDD_TCPIPGW_DLG
Definition: resource.h:15
#define IDS_METRIC_RANGE
Definition: resource.h:135
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 585 of file tcpipconf_notify.c.

591{
594
595 switch(uMsg)
596 {
597 case WM_INITDIALOG:
599 This = (TcpipConfNotifyImpl*)page->lParam;
601 return TRUE;
602 case WM_COMMAND:
603 if (LOWORD(wParam) == IDC_OPTPROP)
604 {
607 GetParent(hwndDlg),
610 break;
611 }
612 }
613 return FALSE;
614}
#define IDD_TCPIP_FILTER_DLG
Definition: resource.h:13
#define IDC_OPTPROP
Definition: resource.h:77
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 745 of file tcpipconf_notify.c.

751{
752 WCHAR szBuffer[70];
753 TcpipGwSettings *pGwSettings;
754 DWORD dwIpAddr;
755 LPNMIPADDRESS lpnmipa;
757
758 switch(uMsg)
759 {
760 case WM_INITDIALOG:
761 pGwSettings = (TcpipGwSettings *)lParam;
763
768
769 if (pGwSettings->bAdd)
770 {
771 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
772 {
773 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
774 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
775 }
778 }
779 else
780 {
781 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
782 {
783 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
784 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
785 }
786
788
789 if (pGwSettings->Metric)
790 {
791 SetDlgItemInt(hwndDlg, IDC_GWMETRIC, pGwSettings->Metric, FALSE);
794 }
795 else
796 {
800 }
801 }
802 return TRUE;
803 case WM_COMMAND:
805 {
807 {
811 }
812 else
813 {
816 }
817 break;
818 }
819 else if (LOWORD(wParam) == IDCANCEL)
820 {
821 EndDialog(hwndDlg, FALSE);
822 break;
823 }
824 else if (LOWORD(wParam) == IDC_OK)
825 {
826 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
827 {
828 pGwSettings = (TcpipGwSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
829 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pGwSettings->szIP);
830
831 ZeroMemory(&find, sizeof(LVFINDINFOW));
832 find.flags = LVFI_STRING;
833 find.psz = pGwSettings->szIP;
834
836 pGwSettings->Metric = GetDlgItemInt(hwndDlg, IDC_GWMETRIC, NULL, FALSE);
837 else
838 pGwSettings->Metric = 0;
839
840
841 if (SendMessageW(pGwSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
842 {
843 EndDialog(hwndDlg, TRUE);
844 break;
845 }
846 if (!pGwSettings->bAdd)
847 {
848 EndDialog(hwndDlg, FALSE);
849 break;
850 }
852 }
853 break;
854 }
855 break;
856 case WM_NOTIFY:
857 lpnmipa = (LPNMIPADDRESS) lParam;
858 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
859 {
860 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
861 {
862 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
864 }
865 }
866 break;
867 }
868 return FALSE;
869}
#define IDS_DUP_GW
Definition: resource.h:134
#define IDC_GWMETRICTXT
Definition: resource.h:53
#define IDC_GWMETRIC
Definition: resource.h:54
#define IDC_GWAUTOMETRIC
Definition: resource.h:52
#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 2322 of file tcpipconf_notify.c.

2327{
2330 LPNMIPADDRESS lpnmipa;
2331 LPPSHNOTIFY lppsn;
2332
2333 switch (uMsg)
2334 {
2335 case WM_INITDIALOG:
2336 {
2338 This = (TcpipConfNotifyImpl*)page->lParam;
2340 if (This->pCurrentConfig)
2341 InitializeTcpipAltDlgCtrls(hwndDlg, This->pCurrentConfig);
2342 return TRUE;
2343 }
2344 case WM_NOTIFY:
2345 lppsn = (LPPSHNOTIFY) lParam;
2346 lpnmipa = (LPNMIPADDRESS) lParam;
2347 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
2348 {
2349 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2350 if (lpnmipa->hdr.idFrom == IDC_ALTIPADDR)
2351 {
2352 DWORD dwIpAddr;
2353
2354 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2355 {
2356 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2358 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2360 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2362 }
2363 }
2364 }
2365 else if (lppsn->hdr.code == PSN_APPLY)
2366 {
2370 else
2372
2373 return TRUE;
2374 }
2375 break;
2376
2377 case WM_COMMAND:
2378 {
2379 switch (LOWORD(wParam))
2380 {
2381 case IDC_ALTAPIPA:
2382 case IDC_ALTSTATIC:
2383 {
2384 if (HIWORD(wParam) == BN_CLICKED)
2385 {
2386 BOOL bStatic = (IsDlgButtonChecked(hwndDlg, IDC_ALTSTATIC) == BST_CHECKED);
2387 if (bStatic)
2388 {
2394 }
2395
2396 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTIPADDR), bStatic);
2397 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTSUBNETMASK), bStatic);
2398 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTDEFGATEWAY), bStatic);
2399 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTDNS1), bStatic);
2400 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTDNS2), bStatic);
2401
2402 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2403 }
2404 break;
2405 }
2406 }
2407 break;
2408 }
2409 }
2410 return FALSE;
2411}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define PSNRET_INVALID
Definition: prsht.h:130
HRESULT InitializeTcpipAltDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)
INT_PTR StoreTcpipAlternateSettings(HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)

Referenced by AddAlternativeDialog(), and INetCfgComponentPropertyUi_fnMergePropPages().

◆ TcpipBasicDlg()

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

Definition at line 2750 of file tcpipconf_notify.c.

2756{
2759 LPNMIPADDRESS lpnmipa;
2760 LPPSHNOTIFY lppsn;
2761 DWORD dwIpAddr;
2762
2763
2764 switch(uMsg)
2765 {
2766 case WM_INITDIALOG:
2768 This = (TcpipConfNotifyImpl*)page->lParam;
2769 if (This->pCurrentConfig)
2770 InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2772 return TRUE;
2773 case WM_NOTIFY:
2774 lppsn = (LPPSHNOTIFY) lParam;
2775 lpnmipa = (LPNMIPADDRESS) lParam;
2776 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
2777 {
2778 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2779 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
2780 {
2781 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2782 {
2783 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2785 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2787 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2788 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
2789 }
2790 }
2791 }
2792 else if (lppsn->hdr.code == PSN_APPLY)
2793 {
2797 else
2799
2800 return TRUE;
2801 }
2802 break;
2803 case WM_COMMAND:
2804 if (HIWORD(wParam) == BN_CLICKED)
2805 {
2806 switch (LOWORD(wParam))
2807 {
2808 case IDC_USEDHCP:
2809 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) == 0)
2810 {
2811 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2820 }
2821 break;
2822 case IDC_NODHCP:
2823 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) != 0)
2824 {
2825 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2830 {
2832 }
2837 SendMessageW(GetParent(hwndDlg), PSM_REMOVEPAGE, 1, 0);
2838 }
2839 break;
2840 case IDC_AUTODNS:
2841 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2846 break;
2847 case IDC_FIXEDDNS:
2848 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2851 break;
2852 case IDC_ADVANCED:
2854 break;
2855 }
2856 break;
2857 }
2858 default:
2859 break;
2860
2861 }
2862 return FALSE;
2863}
#define IDC_ADVANCED
Definition: resource.h:11
if(dx< 0)
Definition: linetemp.h:194
#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 4088 of file tcpipconf_notify.c.

4089{
4091
4092 if (!ppv)
4093 return E_POINTER;
4094
4096 if (!This)
4097 return E_OUTOFMEMORY;
4098
4099 This->ref = 1;
4100 This->lpVtbl = (const INetCfgComponentControl*)&vt_NetCfgComponentControl;
4101 This->lpVtblCompPropertyUi = (const INetCfgComponentPropertyUi*)&vt_NetCfgComponentPropertyUi;
4102 This->lpVtblCompSetup = (const INetCfgComponentSetup*)&vt_NetCfgComponentSetup;
4103 This->pNCfg = NULL;
4104 This->pUnknown = NULL;
4105 This->pNComp = NULL;
4106 This->pCurrentConfig = NULL;
4107
4108 if (!SUCCEEDED (INetCfgComponentControl_QueryInterface ((INetCfgComponentControl*)This, riid, ppv)))
4109 {
4110 INetCfgComponentControl_Release((INetCfgComponentControl*)This);
4111 return E_NOINTERFACE;
4112 }
4113
4114 INetCfgComponentControl_Release((INetCfgComponentControl*)This);
4115 return S_OK;
4116}
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 175 of file tcpipconf_notify.c.

181{
182 TcpipPortSettings * pPort;
183 UINT Num;
185 LVITEMW li;
186 WCHAR szBuffer[100];
187
188 switch(uMsg)
189 {
190 case WM_INITDIALOG:
191 pPort = (TcpipPortSettings*)lParam;
192 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPort);
193 if (LoadStringW(netcfgx_hInstance, pPort->ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
194 {
195 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
196 SendDlgItemMessageW(hwndDlg, IDC_PORT_DESC, WM_SETTEXT, 0, (LPARAM)szBuffer);
197 }
198
199 if (pPort->MaxNum == 65536)
201 else
203
204 return TRUE;
205 case WM_COMMAND:
206 if (LOWORD(wParam) == IDCANCEL)
207 {
208 EndDialog(hwndDlg, FALSE);
209 break;
210 }
211 else if (LOWORD(wParam) == IDC_OK)
212 {
213 pPort = (TcpipPortSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
214 Num = GetDlgItemInt(hwndDlg, IDC_PORT_VAL, NULL, TRUE);
215 if (Num > pPort->MaxNum || Num == 0)
216 {
217 if (pPort->MaxNum == 65536)
219 else
221
223 break;
224 }
225 if (GetWindowTextW(GetDlgItem(hwndDlg, IDC_PORT_VAL), szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
226 {
227 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
228 ZeroMemory(&find, sizeof(LVFINDINFOW));
229 find.flags = LVFI_STRING;
230 find.psz = szBuffer;
231 if (SendMessageW(pPort->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
232 {
233 ZeroMemory(&li, sizeof(LVITEMW));
234 li.mask = LVIF_TEXT;
235 li.iItem = ListView_GetItemCount(pPort->hDlgCtrl);
236 li.pszText = szBuffer;
238 EndDialog(hwndDlg, TRUE);
239 break;
240 }
243 break;
244 }
245 }
246 }
247 return FALSE;
248}
#define IDS_PROT_RANGE
Definition: resource.h:126
#define IDC_PORT_VAL
Definition: resource.h:97
#define IDS_DUP_NUMBER
Definition: resource.h:127
#define IDS_PORT_RANGE
Definition: resource.h:125
#define IDC_PORT_DESC
Definition: resource.h:96
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 390 of file tcpipconf_notify.c.

396{
397 TcpipConfNotifyImpl *pContext;
398 TcpFilterSettings *pFilter;
399
400 switch(uMsg)
401 {
402 case WM_INITDIALOG:
403 pContext = (TcpipConfNotifyImpl*)lParam;
407 if (pContext->pCurrentConfig->pFilter)
408 {
414 }
415 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
416 return TRUE;
417 case WM_COMMAND:
418 if (HIWORD(wParam) == BN_CLICKED)
419 {
420 switch (LOWORD(wParam))
421 {
424 {
429 }
430 break;
431 case IDC_TCP_RESTRICT:
433 {
438 }
439 break;
442 {
447 }
448 break;
449 case IDC_UDP_RESTRICT:
451 {
456 }
457 break;
458 case IDC_IP_ALLOW_ALL:
460 {
465 }
466 break;
467 case IDC_IP_RESTRICT:
469 {
474 }
475 break;
476 case IDC_USE_FILTER:
479
480 break;
481 }
482 }
483 switch(LOWORD(wParam))
484 {
485 case IDC_OK:
486 pContext = (TcpipConfNotifyImpl*)GetWindowLongPtr(hwndDlg, DWLP_USER);
487 pFilter = StoreTcpipFilterSettings(hwndDlg);
488 if (pFilter)
489 {
490 if (pContext->pCurrentConfig->pFilter)
491 {
496 }
497 pContext->pCurrentConfig->pFilter = pFilter;
498 }
499 EndDialog(hwndDlg, (INT_PTR)TRUE);
500 break;
501 case IDCANCEL:
502 EndDialog(hwndDlg, FALSE);
503 break;
504 case IDC_TCP_ADD:
505 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_TCP_LIST), 65536, IDS_TCP_PORTS);
506 break;
507 case IDC_TCP_DEL:
509 break;
510 case IDC_UDP_ADD:
511 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_UDP_LIST), 65536, IDS_UDP_PORTS);
512 break;
513 case IDC_UDP_DEL:
515 break;
516 case IDC_IP_ADD:
517 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_IP_LIST), 256, IDS_IP_PROTO);
518 break;
519 case IDC_IP_DEL:
520 DelItem(GetDlgItem(hwndDlg, IDC_IP_LIST));
521 break;
522 default:
523 break;
524 }
525 default:
526 break;
527 }
528
529 return FALSE;
530}
#define IDS_DISABLE_FILTER
Definition: resource.h:128
#define IDC_IP_RESTRICT
Definition: resource.h:91
#define IDS_TCP_PORTS
Definition: resource.h:122
#define IDC_IP_DEL
Definition: resource.h:94
#define IDC_IP_ALLOW_ALL
Definition: resource.h:90
#define IDS_IP_PROTO
Definition: resource.h:124
#define IDC_TCP_RESTRICT
Definition: resource.h:81
#define IDC_TCP_ADD
Definition: resource.h:83
#define IDC_UDP_DEL
Definition: resource.h:89
#define IDC_IP_ADD
Definition: resource.h:93
#define IDS_UDP_PORTS
Definition: resource.h:123
#define IDC_UDP_ALLOW_ALL
Definition: resource.h:85
#define IDC_TCP_ALLOW_ALL
Definition: resource.h:80
#define IDC_UDP_ADD
Definition: resource.h:88
#define IDC_UDP_RESTRICT
Definition: resource.h:86
#define IDC_TCP_DEL
Definition: resource.h:84
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
#define MB_OK
Definition: winuser.h:801

Referenced by TcpipAdvancedOptDlg().

◆ ToggleUpDown()

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

Definition at line 1688 of file tcpipconf_notify.c.

1689{
1690 LRESULT lResult, lCount;
1691
1692 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1693 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1694 if (lResult != LB_ERR)
1695 {
1696 if (lResult == 0)
1697 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
1698 else
1699 EnableWindow(GetDlgItem(hwndDlg, UpButton), TRUE);
1700
1701 if (lResult < lCount -1)
1702 EnableWindow(GetDlgItem(hwndDlg, DownButton), TRUE);
1703 else
1704 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
1705 }
1706
1707 if (lCount)
1708 {
1709 EnableWindow(GetDlgItem(hwndDlg, ModButton), TRUE);
1710 EnableWindow(GetDlgItem(hwndDlg, DelButton), TRUE);
1711 }
1712 else
1713 {
1714 EnableWindow(GetDlgItem(hwndDlg, ModButton), FALSE);
1715 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
1716 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
1717 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
1718 }
1719}

Referenced by TcpipAdvancedDnsDlg().

◆ VerifyDNSSuffix()

BOOL VerifyDNSSuffix ( LPWSTR  szName)

Definition at line 1005 of file tcpipconf_notify.c.

1007{
1008 UINT Index;
1010
1011 for(Index = 0; Index < Length; Index++)
1012 if (iswalnum(szName[Index]) == 0 && szName[Index] != '.' && szName[Index] != '-')
1013 return FALSE;
1014
1015 return TRUE;
1016}
_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 3986 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 3453 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 4075 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().