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

Go to the source code of this file.

Classes

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

Typedefs

typedef struct tagIP_ADDR IP_ADDR
 
typedef struct TcpipConfNotifyImplLPTcpipConfNotifyImpl
 

Enumerations

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

Functions

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

Variables

static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi
 
static const INetCfgComponentControlVtbl vt_NetCfgComponentControl
 

Typedef Documentation

◆ IP_ADDR

◆ LPTcpipConfNotifyImpl

Enumeration Type Documentation

◆ COPY_TYPE

Enumerator
METRIC 
SUBMASK 
IPADDR 

Definition at line 47 of file tcpipconf_notify.c.

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

Function Documentation

◆ AddAlternativeDialog()

VOID AddAlternativeDialog ( HWND  hDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2156 of file tcpipconf_notify.c.

2159 {
2160  HPROPSHEETPAGE hpage;
2161 
2163  if (!hpage)
2164  return;
2165 
2166  SendMessageW(hDlg, PSM_INSERTPAGE, 1, (LPARAM)hpage);
2167 }
INT_PTR CALLBACK TcpipAltConfDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDD_TCPIP_ALTCF_DLG
Definition: resource.h:9

Referenced by TcpipBasicDlg().

◆ AddItem()

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

Definition at line 338 of file tcpipconf_notify.c.

343 {
345 
346  Port.MaxNum = MaxItem;
347  Port.hDlgCtrl = hDlgCtrl;
348  Port.ResId = ResId;
349 
351 }
CPPORT Port[4]
Definition: headless.c:34
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
#define IDD_TCPIP_PORT_DLG
Definition: resource.h:18
INT_PTR CALLBACK TcpipFilterPortDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by TcpipFilterSettingsDlg().

◆ CopyIpAddrString()

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

Definition at line 2416 of file tcpipconf_notify.c.

2421 {
2422  IP_ADDR_STRING * pCurrent;
2423  IP_ADDR *pNew, *pLast;
2424 
2425  pCurrent = pSrc;
2426  pLast = NULL;
2427 
2428  while(pCurrent)
2429  {
2430  pNew = CoTaskMemAlloc(sizeof(IP_ADDR));
2431  if (!pNew)
2432  {
2433  break;
2434  }
2435  ZeroMemory(pNew, sizeof(IP_ADDR));
2437  if (!pNew->IpAddress)
2438  {
2439  CoTaskMemFree(pNew);
2440  return E_FAIL;
2441  }
2442 
2443  if (Type == SUBMASK)
2444  {
2445  pNew->u.Subnetmask = GetIpAddressFromStringA(pCurrent->IpMask.String);
2446  pNew->NTEContext = pCurrent->Context;
2447  }
2448  else if (Type == METRIC)
2449  {
2450  if (szMetric && szMetric[0] != L'\0')
2451  {
2452  pNew->u.Metric = _wtoi(szMetric);
2453  szMetric += wcslen(szMetric) + 1;
2454  }
2455  }
2456 
2457  if (!pLast)
2458  *pTarget = pNew;
2459  else
2460  pLast->Next = pNew;
2461 
2462  pLast = pNew;
2463  pCurrent = pCurrent->Next;
2464 
2465  }
2466  pLast->Next = NULL;
2467  return S_OK;
2468 }
union tagIP_ADDR::@505 u
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
Type
Definition: Type.h:6
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
char String[4 *4]
Definition: iptypes.h:42
#define ZeroMemory
Definition: winbase.h:1642
#define E_FAIL
Definition: ddrawi.h:102
DWORD Context
Definition: iptypes.h:49
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
struct tagIP_ADDR * Next
#define S_OK
Definition: intsafe.h:59
IP_MASK_STRING IpMask
Definition: iptypes.h:48
UINT GetIpAddressFromStringA(char *sBuffer)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by Initialize().

◆ CreateFilterList()

LPWSTR CreateFilterList ( HWND  hDlgCtrl,
LPDWORD  Size 
)

Definition at line 266 of file tcpipconf_notify.c.

269 {
270  INT iCount, iIndex;
271  LVITEMW li;
272  LPWSTR pData, pCur;
273  DWORD dwSize;
274  WCHAR szBuffer[10];
275 
276  iCount = ListView_GetItemCount(hDlgCtrl);
277  if (!iCount)
278  {
279  pData = (LPWSTR)CoTaskMemAlloc(3 * sizeof(WCHAR));
280  if (!pData)
281  return NULL;
282  pData[0] = L'0';
283  pData[1] = L'\0';
284  pData[2] = L'\0';
285  *Size = 3 * sizeof(WCHAR);
286  return pData;
287  }
288 
289  pData = CoTaskMemAlloc((6 * iCount + 1) * sizeof(WCHAR));
290  if (!pData)
291  return NULL;
292 
293  pCur = pData;
294  dwSize = 0;
295  for(iIndex = 0; iIndex < iCount; iIndex++)
296  {
297  ZeroMemory(&li, sizeof(LVITEMW));
298  li.mask = LVIF_TEXT;
299  li.iItem = iIndex;
300  li.pszText = szBuffer;
301  li.cchTextMax = sizeof(szBuffer) /sizeof(WCHAR);
302  if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
303  {
304  wcscpy(pCur, szBuffer);
305  dwSize += wcslen(szBuffer) + 1;
306  pCur += wcslen(szBuffer) + 1;
307  }
308  }
309  pCur[0] = L'\0';
310  *Size = (dwSize+1) * sizeof(WCHAR);
311  return pData;
312 }
#define ZeroMemory
Definition: winbase.h:1642
int32_t INT
Definition: typedefs.h:56
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2361
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT mask
Definition: commctrl.h:2356
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2386
WCHAR * LPWSTR
Definition: xmlstorage.h:184
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by StoreTcpipFilterSettings().

◆ CreateMultiSzString()

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

Definition at line 3093 of file tcpipconf_notify.c.

3094 {
3095  LPWSTR pStr, pRet;
3096  DWORD dwSize, dwIpAddr;
3097  WCHAR szBuffer[30];
3098  IP_ADDR *pTemp = pAddr;
3099 
3100 
3101  dwSize = 0;
3102  while(pTemp)
3103  {
3104  if (Type == IPADDR)
3105  {
3106  dwIpAddr = pTemp->IpAddress;
3107  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3108  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3109  }else if (Type == SUBMASK)
3110  {
3111  dwIpAddr = pTemp->u.Subnetmask;
3112  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3113  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3114  }
3115  else if (Type == METRIC)
3116  {
3117  swprintf(szBuffer, L"%u", pTemp->u.Metric);
3118  }
3119 
3120  dwSize += wcslen(szBuffer) + 1;
3121  pTemp = pTemp->Next;
3122  }
3123 
3124  if (!dwSize)
3125  return NULL;
3126 
3127  pStr = pRet = CoTaskMemAlloc((dwSize+1) * sizeof(WCHAR));
3128  if(!pStr)
3129  return NULL;
3130 
3131  pTemp = pAddr;
3132  while(pTemp)
3133  {
3134  if (Type == IPADDR)
3135  {
3136  dwIpAddr = pTemp->IpAddress;
3137  swprintf(pStr, L"%lu.%lu.%lu.%lu",
3138  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3139  }else if (Type == SUBMASK)
3140  {
3141  dwIpAddr = pTemp->u.Subnetmask;
3142  swprintf(pStr, L"%lu.%lu.%lu.%lu",
3143  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3144  }
3145  else if (Type == METRIC)
3146  {
3147  swprintf(pStr, L"%u", pTemp->u.Metric);
3148  }
3149 
3150  if (bComma)
3151  {
3152  pStr += wcslen(pStr);
3153  if (pTemp->Next)
3154  {
3155  pStr[0] = L',';
3156  pStr++;
3157  }
3158  }
3159  else
3160  {
3161  pStr += wcslen(pStr) + 1;
3162  }
3163  pTemp = pTemp->Next;
3164  }
3165  pStr[0] = L'\0';
3166  *Size = (dwSize+1) * sizeof(WCHAR);
3167  return pRet;
3168 }
union tagIP_ADDR::@505 u
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4484
Type
Definition: Type.h:6
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4487
ULONG IPADDR
Definition: rassapi.h:53
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4485
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4486
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
struct tagIP_ADDR * Next
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by INetCfgComponentControl_fnApplyRegistryChanges().

◆ DeleteItemFromList()

VOID DeleteItemFromList ( HWND  hDlgCtrl)

Definition at line 1116 of file tcpipconf_notify.c.

1117 {
1118  LVITEMW li;
1119 
1120  memset(&li, 0x0, sizeof(LVITEMW));
1121  li.iItem = GetSelectedItem(hDlgCtrl);
1122  if (li.iItem < 0)
1123  {
1125  SetFocus(hDlgCtrl);
1126  }
1127  else
1128  {
1129  (void)ListView_DeleteItem(hDlgCtrl, li.iItem);
1130  }
1131 }
#define IDS_TCPIP
Definition: resource.h:110
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
GLint x0
Definition: linetemp.h:95
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2407
#define MB_ICONINFORMATION
Definition: winuser.h:796
INT GetSelectedItem(HWND hDlgCtrl)
#define memset(x, y, z)
Definition: compat.h:39
#define IDS_NOITEMSEL
Definition: resource.h:109

Referenced by TcpipAdvancedIpDlg().

◆ DelItem()

static VOID DelItem ( HWND  hDlgCtrl)
static

Definition at line 355 of file tcpipconf_notify.c.

357 {
358  INT iIndex = GetSelectedItem(hDlgCtrl);
359 
360  if (iIndex != -1)
361  {
362  (void)ListView_DeleteItem(hDlgCtrl, iIndex);
363  return;
364  }
366 }
#define IDS_TCPIP
Definition: resource.h:110
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
int32_t INT
Definition: typedefs.h:56
#define MB_ICONWARNING
Definition: winuser.h:780
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2407
INT GetSelectedItem(HWND hDlgCtrl)
#define IDS_NOITEMSEL
Definition: resource.h:109

Referenced by TcpipFilterSettingsDlg().

◆ DisplayError()

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

Definition at line 129 of file tcpipconf_notify.c.

130 {
131  WCHAR szBuffer[300];
132  WCHAR szTitle[100];
133 
134  if (LoadStringW(netcfgx_hInstance, ResTxt, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
135  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
136  else
137  szBuffer[0] = L'\0';
138 
139  if (LoadStringW(netcfgx_hInstance, ResTitle, szTitle, sizeof(szTitle)/sizeof(WCHAR)))
140  szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = L'\0';
141  else
142  szTitle[0] = L'\0';
143 
144  MessageBoxW(NULL, szBuffer, szTitle, Type);
145 }
Type
Definition: Type.h:6
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
smooth NULL
Definition: ftsmooth.c:416
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
static const WCHAR L[]
Definition: oid.c:1250

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

◆ FreeIPAddr()

VOID FreeIPAddr ( IP_ADDR pAddr)

Definition at line 1174 of file tcpipconf_notify.c.

1175 {
1176  IP_ADDR *pNext;
1177 
1178  if (!pAddr)
1179  return;
1180 
1181  while(pAddr)
1182  {
1183  pNext = pAddr->Next;
1184  CoTaskMemFree(pAddr);
1185  pAddr = pNext;
1186  }
1187 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
struct tagIP_ADDR * Next

Referenced by StoreDNSSettings(), and TcpipAdvancedIpDlg().

◆ GetGWListEntry()

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

Definition at line 842 of file tcpipconf_notify.c.

843 {
844  LVITEMW li;
845  WCHAR szBuffer[30];
846  BOOL bRet;
847 
848  ZeroMemory(&li, sizeof(LVITEMW));
849  li.mask = LVIF_TEXT;
850  li.cchTextMax = 16;
851  li.pszText = pGwSettings->szIP;
852  li.iItem = Index;
853 
854  if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
855  return FALSE;
856  li.pszText = szBuffer;
857  li.cchTextMax = 30;
858  li.iSubItem = 1;
859 
860  bRet = SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
861  if (bRet)
862  {
863  pGwSettings->Metric = _wtoi(szBuffer);
864  }
865 
866  return bRet;
867 }
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ZeroMemory
Definition: winbase.h:1642
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2361
static const UCHAR Index[8]
Definition: usbohci.c:18
UINT mask
Definition: commctrl.h:2356
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2386

Referenced by TcpipAdvancedIpDlg().

◆ GetIpAddressFromStringA()

UINT GetIpAddressFromStringA ( char sBuffer)

Definition at line 1159 of file tcpipconf_notify.c.

1161 {
1162  WCHAR szIp[16];
1163 
1164  if (MultiByteToWideChar(CP_ACP, 0, sBuffer, -1, szIp, 16))
1165  {
1166  szIp[15] = L'\0';
1167  return GetIpAddressFromStringW(szIp);
1168  }
1169  return (UINT)-1;
1170 }
UINT GetIpAddressFromStringW(WCHAR *szBuffer)
#define CP_ACP
Definition: compat.h:99
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
unsigned int UINT
Definition: ndis.h:50
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by CopyIpAddrString().

◆ GetIpAddressFromStringW()

UINT GetIpAddressFromStringW ( WCHAR szBuffer)

Definition at line 1134 of file tcpipconf_notify.c.

1136 {
1137  DWORD dwIpAddr = 0;
1138  INT Val;
1139  UINT Index = 3;
1140  LPWSTR pLast = szBuffer;
1141  LPWSTR pNext = szBuffer;
1142 
1143 
1144  while((pNext = wcschr(pNext, L'.')))
1145  {
1146  pNext[0] = L'\0';
1147  Val = _wtoi(pLast);
1148  dwIpAddr |= (Val << Index * 8);
1149  Index--;
1150  pNext++;
1151  pLast = pNext;
1152  }
1153  dwIpAddr |= _wtoi(pLast);
1154 
1155  return dwIpAddr;
1156 }
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
int32_t INT
Definition: typedefs.h:56
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
unsigned int UINT
Definition: ndis.h:50
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

◆ GetIPListEntry()

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

Definition at line 1092 of file tcpipconf_notify.c.

1093 {
1094  LVITEMW li;
1095 
1096  ZeroMemory(&li, sizeof(LVITEMW));
1097  li.mask = LVIF_TEXT;
1098  li.cchTextMax = 16;
1099  li.pszText = pIpSettings->szIP;
1100  li.iItem = Index;
1101 
1102  if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1103  return FALSE;
1104 
1105  ZeroMemory(&li, sizeof(LVITEMW));
1106  li.mask = LVIF_TEXT;
1107  li.cchTextMax = 16;
1108  li.pszText = pIpSettings->szMask;
1109  li.iSubItem = 1;
1110  li.iItem = Index;
1111 
1112  return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1113 }
#define ZeroMemory
Definition: winbase.h:1642
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
LONG_PTR LPARAM
Definition: windef.h:208
LPWSTR pszText
Definition: commctrl.h:2361
static const UCHAR Index[8]
Definition: usbohci.c:18
UINT mask
Definition: commctrl.h:2356
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2386

Referenced by TcpipAdvancedIpDlg().

◆ GetListViewEntries()

LPWSTR GetListViewEntries ( HWND  hDlgCtrl)

Definition at line 1714 of file tcpipconf_notify.c.

1716 {
1717  DWORD dwSize;
1718  INT iCount, iIndex;
1719  INT_PTR lResult;
1720  LPWSTR pszSearchList, pItem;
1721 
1722  iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1723  if (!iCount || iCount == LB_ERR)
1724  return NULL; //BUGBUG
1725 
1726  dwSize = 0;
1727 
1728  for (iIndex = 0; iIndex < iCount; iIndex++)
1729  {
1730  lResult = SendMessageW(hDlgCtrl, LB_GETTEXTLEN, iIndex, 0);
1731  if (lResult == LB_ERR)
1732  return NULL;
1733 
1734  dwSize += lResult + 1;
1735  }
1736 
1737  pszSearchList = (LPWSTR)CoTaskMemAlloc((dwSize + 1) * sizeof(WCHAR));
1738  if (!pszSearchList)
1739  return NULL;
1740 
1741  pItem = pszSearchList;
1742  for (iIndex = 0; iIndex < iCount; iIndex++)
1743  {
1744  lResult = SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)pItem);
1745  if (lResult == LB_ERR)
1746  {
1747  CoTaskMemFree(pszSearchList);
1748  return NULL;
1749  }
1750  dwSize -= lResult + 1;
1751  pItem += wcslen(pItem);
1752  if (iIndex != iCount -1)
1753  {
1754  pItem[0] = L',';
1755  pItem++;
1756  }
1757  }
1758  pItem[0] = L'\0';
1759  return pszSearchList;
1760 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
int32_t INT_PTR
Definition: typedefs.h:62
int32_t INT
Definition: typedefs.h:56
#define LB_ERR
Definition: winuser.h:2407
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETTEXTLEN
Definition: winuser.h:2032
#define LB_GETCOUNT
Definition: winuser.h:2020
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LB_GETTEXT
Definition: winuser.h:2031
static const WCHAR L[]
Definition: oid.c:1250
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by TcpipAdvancedDnsDlg().

◆ GetListViewItem()

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

Definition at line 1190 of file tcpipconf_notify.c.

1191 {
1192  LVITEMW li;
1193 
1194  ZeroMemory(&li, sizeof(LVITEMW));
1195  li.mask = LVIF_TEXT;
1196  li.pszText = szBuffer;
1197  li.iItem = Index;
1198  li.iSubItem = SubIndex;
1199  li.cchTextMax = BufferSize;
1200  return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1201 }
#define ZeroMemory
Definition: winbase.h:1642
#define LVIF_TEXT
Definition: commctrl.h:2305
int cchTextMax
Definition: commctrl.h:2362
int iSubItem
Definition: commctrl.h:2358
LONG_PTR LPARAM
Definition: windef.h:208
LPWSTR pszText
Definition: commctrl.h:2361
static const UCHAR Index[8]
Definition: usbohci.c:18
#define BufferSize
Definition: classpnp.h:419
UINT mask
Definition: commctrl.h:2356
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2386

Referenced by StoreIPSettings().

◆ GetSelectedItem()

INT GetSelectedItem ( HWND  hDlgCtrl)

Definition at line 1066 of file tcpipconf_notify.c.

1067 {
1068  LVITEMW li;
1069  UINT iItemCount, iIndex;
1070 
1071  iItemCount = ListView_GetItemCount(hDlgCtrl);
1072  if (!iItemCount)
1073  return -1;
1074 
1075  for (iIndex = 0; iIndex < iItemCount; iIndex++)
1076  {
1077  ZeroMemory(&li, sizeof(LVITEMW));
1078  li.mask = LVIF_STATE;
1079  li.stateMask = (UINT)-1;
1080  li.iItem = iIndex;
1081  if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1082  {
1083  if (li.state & LVIS_SELECTED)
1084  return iIndex;
1085  }
1086  }
1087  return -1;
1088 }
#define ZeroMemory
Definition: winbase.h:1642
UINT stateMask
Definition: commctrl.h:2360
#define LVIS_SELECTED
Definition: commctrl.h:2315
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
UINT mask
Definition: commctrl.h:2356
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define LVM_GETITEMW
Definition: commctrl.h:2386
#define LVIF_STATE
Definition: commctrl.h:2308

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

◆ impl_from_INetCfgComponentControl()

static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl ( INetCfgComponentControl *  iface)
static

◆ INetCfgComponentControl_fnAddRef()

ULONG WINAPI INetCfgComponentControl_fnAddRef ( INetCfgComponentControl *  iface)

Definition at line 3059 of file tcpipconf_notify.c.

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

◆ INetCfgComponentControl_fnApplyPnpChanges()

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

Definition at line 3409 of file tcpipconf_notify.c.

3412 {
3413  //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyPnpChanges", NULL, MB_OK);
3414  return S_OK;
3415 }
#define S_OK
Definition: intsafe.h:59

◆ INetCfgComponentControl_fnApplyRegistryChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges ( INetCfgComponentControl *  iface)

Definition at line 3173 of file tcpipconf_notify.c.

3175 {
3176  HKEY hKey;
3177  LPOLESTR pStr;
3178  DWORD dwSize;
3179  WCHAR szBuffer[200];
3180  TcpipSettings * pCurrentConfig, *pOldConfig;
3181  ULONG NTEInstance;
3182  DWORD DhcpApiVersion;
3183 
3185 
3186  pCurrentConfig = This->pCurrentConfig;
3187  This->pCurrentConfig = NULL;
3188 
3189  if (FAILED(Initialize(This)))
3190  {
3191  This->pCurrentConfig = pCurrentConfig;
3192  return E_FAIL;
3193  }
3194  pOldConfig = This->pCurrentConfig;
3195  This->pCurrentConfig = pCurrentConfig;
3196 
3197  //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyRegistryChanges", NULL, MB_OK);
3198 
3199 
3200  if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3201  {
3202  if (pCurrentConfig->pDNS)
3203  {
3204  RegSetValueExW(hKey, L"UseDomainNameDevolution", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->pDNS->UseDomainNameDevolution, sizeof(DWORD));
3205  RegSetValueExW(hKey, L"SearchList", 0, REG_SZ, (LPBYTE)pCurrentConfig->pDNS->szSearchList,
3206  (wcslen(pCurrentConfig->pDNS->szSearchList)+1) * sizeof(WCHAR));
3207  }
3208  if (pCurrentConfig->pFilter)
3209  {
3210  RegSetValueExW(hKey, L"EnableSecurityFilters", 0, REG_DWORD,
3211  (LPBYTE)&pCurrentConfig->pFilter->EnableSecurityFilters, sizeof(DWORD));
3212  }
3213  RegCloseKey(hKey);
3214  }
3215 
3216  if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
3217  return E_FAIL;
3218 
3219  swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
3220  CoTaskMemFree(pStr);
3221 
3222  if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3223  {
3224  if (pCurrentConfig->pDNS)
3225  {
3226  RegSetValueExW(hKey, L"RegisterAdapterName", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, sizeof(DWORD));
3227  RegSetValueExW(hKey, L"RegistrationEnabled", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, sizeof(DWORD));
3228  RegSetValueExW(hKey, L"Domain", 0, REG_SZ, (LPBYTE)This->pCurrentConfig->pDNS->szDomain,
3229  (wcslen(This->pCurrentConfig->pDNS->szDomain)+1) * sizeof(WCHAR));
3230  }
3231 #if 0
3232  if (pCurrentConfig->pFilter)
3233  {
3234  if (pCurrentConfig->pFilter->szTCPAllowedPorts)
3235  {
3236  RegSetValueExW(hKey, L"TCPAllowedPorts", 0, REG_MULTI_SZ,
3237  (LPBYTE)pCurrentConfig->pFilter->szTCPAllowedPorts,
3238  pCurrentConfig->pFilter->TCPSize);
3239  }
3240  if (pCurrentConfig->pFilter->szUDPAllowedPorts)
3241  {
3242  RegSetValueExW(hKey, L"UDPAllowedPorts", 0, REG_MULTI_SZ,
3243  (LPBYTE)pCurrentConfig->pFilter->szUDPAllowedPorts,
3244  pCurrentConfig->pFilter->UDPSize);
3245  }
3246  if (pCurrentConfig->pFilter->szRawIPAllowedProtocols)
3247  {
3248  RegSetValueExW(hKey, L"RawIPAllowedProtocols", 0, REG_MULTI_SZ,
3249  (LPBYTE)pCurrentConfig->pFilter->szRawIPAllowedProtocols,
3250  pCurrentConfig->pFilter->IPSize);
3251  }
3252  }
3253 #endif
3254  RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->DhcpEnabled, sizeof(DWORD));
3255  if (pCurrentConfig->DhcpEnabled)
3256  {
3257  RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3258  RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3259  if (!pOldConfig->DhcpEnabled)
3260  {
3261  /* Delete this adapter's current IP address */
3262  DeleteIPAddress(pOldConfig->Ip->NTEContext);
3263 
3264  /* Delete all default routes for this adapter */
3265  dwSize = 0;
3267  {
3268  DWORD Index;
3270  if (pIpForwardTable)
3271  {
3272  if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3273  {
3274  for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3275  {
3276  if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3277  pIpForwardTable->table[Index].dwForwardDest == 0)
3278  {
3279  DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3280  }
3281  }
3282  }
3283  CoTaskMemFree(pIpForwardTable);
3284  }
3285  }
3286  }
3287  }
3288  else
3289  {
3290  /* Open the DHCP API if DHCP is enabled */
3291  if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR)
3292  {
3293  /* We have to tell DHCP about this */
3294  DhcpStaticRefreshParams(pCurrentConfig->Index,
3295  htonl(pCurrentConfig->Ip->IpAddress),
3296  htonl(pCurrentConfig->Ip->u.Subnetmask));
3297 
3298  /* Close the API */
3299  DhcpCApiCleanup();
3300  }
3301  else
3302  {
3303  /* Delete this adapter's current static IP address */
3304  DeleteIPAddress(pOldConfig->Ip->NTEContext);
3305 
3306  /* Add the static IP address via the standard IPHLPAPI function */
3307  AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress),
3308  htonl(pCurrentConfig->Ip->u.Subnetmask),
3309  pCurrentConfig->Index,
3310  &pCurrentConfig->Ip->NTEContext,
3311  &NTEInstance);
3312  }
3313 
3314  pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE);
3315  if(pStr)
3316  {
3317  RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3318  CoTaskMemFree(pStr);
3319  }
3320 
3321  pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE);
3322  if(pStr)
3323  {
3324  RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3325  CoTaskMemFree(pStr);
3326  }
3327 
3328  /* Delete all default routes for this adapter */
3329  dwSize = 0;
3331  {
3332  DWORD Index;
3334  if (pIpForwardTable)
3335  {
3336  if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3337  {
3338  for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3339  {
3340  if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3341  pIpForwardTable->table[Index].dwForwardDest == 0)
3342  {
3343  DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3344  }
3345  }
3346  }
3347  CoTaskMemFree(pIpForwardTable);
3348  }
3349  }
3350  }
3351 
3352  if (pCurrentConfig->Gw)
3353  {
3354  MIB_IPFORWARDROW RouterMib;
3355  ZeroMemory(&RouterMib, sizeof(MIB_IPFORWARDROW));
3356 
3357  RouterMib.dwForwardMetric1 = 1;
3358  RouterMib.dwForwardIfIndex = pOldConfig->Index;
3359  RouterMib.dwForwardNextHop = htonl(pCurrentConfig->Gw->IpAddress);
3360 
3361  //TODO
3362  // add multiple gw addresses when required
3363 
3364  if (CreateIpForwardEntry(&RouterMib) == NO_ERROR)
3365  {
3366  pStr = CreateMultiSzString(pCurrentConfig->Gw, IPADDR, &dwSize, FALSE);
3367  if(pStr)
3368  {
3369  RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3370  CoTaskMemFree(pStr);
3371  }
3372 
3373  pStr = CreateMultiSzString(pCurrentConfig->Gw, METRIC, &dwSize, FALSE);
3374  if(pStr)
3375  {
3376  RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3377  CoTaskMemFree(pStr);
3378  }
3379  }
3380  }
3381  else
3382  {
3383  RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"", 1 * sizeof(WCHAR));
3384  RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", sizeof(WCHAR) * 2);
3385  }
3386 
3387  if (!pCurrentConfig->Ns || pCurrentConfig->AutoconfigActive)
3388  {
3389  RegDeleteValueW(hKey, L"NameServer");
3390  }
3391  else
3392  {
3393  pStr = CreateMultiSzString(pCurrentConfig->Ns, IPADDR, &dwSize, TRUE);
3394  if(pStr)
3395  {
3396  RegSetValueExW(hKey, L"NameServer", 0, REG_SZ, (LPBYTE)pStr, dwSize);
3397  //RegDeleteValueW(hKey, L"DhcpNameServer");
3398  CoTaskMemFree(pStr);
3399  }
3400  }
3401 
3402  RegCloseKey(hKey);
3403  }
3404  return S_OK;
3405 }
DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute)
#define TRUE
Definition: types.h:120
union tagIP_ADDR::@505 u
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
#define htonl(x)
Definition: module.h:212
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl(INetCfgComponentControl *iface)
#define ZeroMemory
Definition: winbase.h:1642
TcpFilterSettings * pFilter
ULONG IPADDR
Definition: rassapi.h:53
HRESULT Initialize(TcpipConfNotifyImpl *This)
static LPOLESTR
Definition: stg_prop.c:27
#define NO_ERROR
Definition: dderror.h:5
#define E_FAIL
Definition: ddrawi.h:102
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:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75
#define KEY_WRITE
Definition: nt_native.h:1031
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:4895
DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
Definition: iphlpapi_main.c:71
TcpipAdvancedDNSDlgSettings * pDNS
DWORD dwForwardNextHop
Definition: ipmib.h:74
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
DWORD dwNumEntries
Definition: ipmib.h:97
static const UCHAR Index[8]
Definition: usbohci.c:18
DWORD dwForwardDest
Definition: ipmib.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
static LPWSTR CreateMultiSzString(IP_ADDR *pAddr, COPY_TYPE Type, LPDWORD Size, BOOL bComma)
MIB_IPFORWARDROW table[1]
Definition: ipmib.h:98
DWORD APIENTRY DhcpStaticRefreshParams(DWORD AdapterIndex, DWORD Address, DWORD Netmask)
Definition: dhcpcsvc.c:189
static const WCHAR L[]
Definition: oid.c:1250
DWORD APIENTRY DhcpCApiInitialize(LPDWORD Version)
Definition: dhcpcsvc.c:24
struct _MIB_IPFORWARDTABLE * PMIB_IPFORWARDTABLE
#define S_OK
Definition: intsafe.h:59
DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder)
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
LPWSTR szRawIPAllowedProtocols
unsigned int ULONG
Definition: retypes.h:1
DWORD dwForwardMetric1
Definition: ipmib.h:88
#define REG_DWORD
Definition: sdbapi.c:596
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
VOID APIENTRY DhcpCApiCleanup(VOID)
Definition: dhcpcsvc.c:69
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define REG_SZ
Definition: layer.c:22

◆ INetCfgComponentControl_fnCancelChanges()

HRESULT WINAPI INetCfgComponentControl_fnCancelChanges ( INetCfgComponentControl *  iface)

Definition at line 3419 of file tcpipconf_notify.c.

3421 {
3422  //MessageBoxW(NULL, L"INetCfgComponentControl_fnCancelChanges", NULL, MB_OK);
3423  return S_OK;
3424 }
#define S_OK
Definition: intsafe.h:59

◆ INetCfgComponentControl_fnInitialize()

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

Definition at line 3077 of file tcpipconf_notify.c.

3082 {
3084 
3085  This->pNCfg = pINetCfg;
3086  This->pNComp = pIComp;
3087 
3088  return S_OK;
3089 }
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl(INetCfgComponentControl *iface)
#define S_OK
Definition: intsafe.h:59

◆ INetCfgComponentControl_fnQueryInterface()

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

Definition at line 3048 of file tcpipconf_notify.c.

3052 {
3054  return INetCfgComponentPropertyUi_QueryInterface((INetCfgComponentPropertyUi*)This, iid, ppvObj);
3055 }
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl(INetCfgComponentControl *iface)
#define INetCfgComponentPropertyUi_QueryInterface(p, a, b)
Definition: netcfgn.h:77

◆ INetCfgComponentControl_fnRelease()

ULONG WINAPI INetCfgComponentControl_fnRelease ( INetCfgComponentControl *  iface)

Definition at line 3068 of file tcpipconf_notify.c.

3070 {
3072  return INetCfgComponentPropertyUi_Release((INetCfgComponentPropertyUi*)This);
3073 }
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentControl(INetCfgComponentControl *iface)
#define INetCfgComponentPropertyUi_Release(p)
Definition: netcfgn.h:79

◆ INetCfgComponentPropertyUi_fnAddRef()

ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef ( INetCfgComponentPropertyUi *  iface)

Definition at line 2636 of file tcpipconf_notify.c.

2638 {
2640  ULONG refCount = InterlockedIncrement(&This->ref);
2641 
2642  return refCount;
2643 }
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ INetCfgComponentPropertyUi_fnApplyProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3012 of file tcpipconf_notify.c.

3014 {
3015 MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnApplyProperties", NULL, MB_OK);
3016  return S_OK;
3017 }
smooth NULL
Definition: ftsmooth.c:416
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
#define MB_OK
Definition: winuser.h:784

◆ INetCfgComponentPropertyUi_fnCancelProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3022 of file tcpipconf_notify.c.

3024 {
3025 //MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnCancelProperties", NULL, MB_OK);
3026  return S_OK;
3027 }
#define S_OK
Definition: intsafe.h:59

◆ INetCfgComponentPropertyUi_fnMergePropPages()

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

Definition at line 2951 of file tcpipconf_notify.c.

2958 {
2959  HPROPSHEETPAGE * hppages;
2960  UINT NumPages;
2961  HRESULT hr;
2963 
2964  hr = Initialize(This);
2965  if (FAILED(hr))
2966  return hr;
2967 
2968  if (This->pCurrentConfig->DhcpEnabled)
2969  NumPages = 2;
2970  else
2971  NumPages = 1;
2972 
2973  hppages = (HPROPSHEETPAGE*) CoTaskMemAlloc(sizeof(HPROPSHEETPAGE) * NumPages);
2974  if (!hppages)
2975  return E_FAIL;
2976 
2978  if (!hppages[0])
2979  {
2980  CoTaskMemFree(hppages);
2981  return E_FAIL;
2982  }
2983  if (NumPages == 2)
2984  {
2986  if (!hppages[1])
2987  {
2988  DestroyPropertySheetPage(hppages[0]);
2989  CoTaskMemFree(hppages);
2990  return E_FAIL;
2991  }
2992  }
2993 
2994  *pahpspPrivate = (BYTE*)hppages;
2995  *pcPages = NumPages;
2996 
2997  return S_OK;
2998 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3144
HRESULT Initialize(TcpipConfNotifyImpl *This)
#define E_FAIL
Definition: ddrawi.h:102
INT_PTR CALLBACK TcpipAltConfDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
#define IDD_TCPIP_BASIC_DLG
Definition: resource.h:8
LONG HRESULT
Definition: typedefs.h:77
INT_PTR CALLBACK TcpipBasicDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
unsigned char BYTE
Definition: mem.h:68
#define S_OK
Definition: intsafe.h:59
unsigned int UINT
Definition: ndis.h:50
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
#define IDD_TCPIP_ALTCF_DLG
Definition: resource.h:9

◆ INetCfgComponentPropertyUi_fnQueryInterface()

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

Definition at line 2601 of file tcpipconf_notify.c.

2605 {
2606  //LPOLESTR pStr;
2608 
2609  *ppvObj = NULL;
2610 
2611 
2612  if (IsEqualIID (iid, &IID_IUnknown) ||
2614  {
2615  *ppvObj = This;
2617  return S_OK;
2618  }
2619  else if (IsEqualIID(iid, &IID_INetCfgComponentControl))
2620  {
2621  *ppvObj = (LPVOID*)&This->lpVtblCompControl;
2623  return S_OK;
2624  }
2625 
2626  //StringFromCLSID(iid, &pStr);
2627  //MessageBoxW(NULL, pStr, L"INetConnectionPropertyUi_fnQueryInterface", MB_OK);
2628  //CoTaskMemFree(pStr);
2629 
2630  return E_NOINTERFACE;
2631 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define INetCfgComponentPropertyUi_AddRef(p)
Definition: netcfgn.h:78
smooth NULL
Definition: ftsmooth.c:416
EXTERN_C const IID IID_INetCfgComponentPropertyUi
Definition: netcfgn.h:88
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
EXTERN_C const IID IID_INetCfgComponentControl
Definition: netcfgn.h:57
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ INetCfgComponentPropertyUi_fnQueryPropertyUi()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2662 of file tcpipconf_notify.c.

2665 {
2666  INetLanConnectionUiInfo * pLanInfo;
2667  HRESULT hr;
2669 
2670  hr = IUnknown_QueryInterface(pUnkReserved, &IID_INetLanConnectionUiInfo, (LPVOID*)&pLanInfo);
2671  if (FAILED(hr))
2672  return hr;
2673 
2674  INetLanConnectionUiInfo_GetDeviceGuid(pLanInfo, &This->NetCfgInstanceId);
2675 
2676  //FIXME
2677  // check if tcpip is enabled on that binding */
2678  IUnknown_Release(pUnkReserved);
2679  return S_OK;
2680 }
HRESULT hr
Definition: shlfolder.c:183
EXTERN_C const IID IID_INetLanConnectionUiInfo
Definition: netcfgn.h:109
#define INetLanConnectionUiInfo_GetDeviceGuid(p, a)
Definition: netcfgn.h:106
LONG HRESULT
Definition: typedefs.h:77
static IUnknown * pUnkReserved
Definition: asmenum.c:33
#define S_OK
Definition: intsafe.h:59

◆ INetCfgComponentPropertyUi_fnRelease()

ULONG WINAPI INetCfgComponentPropertyUi_fnRelease ( INetCfgComponentPropertyUi *  iface)

Definition at line 2647 of file tcpipconf_notify.c.

2649 {
2651  ULONG refCount = InterlockedDecrement(&This->ref);
2652 
2653  if (!refCount)
2654  {
2656  }
2657  return refCount;
2658 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1

◆ INetCfgComponentPropertyUi_fnSetContext()

HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2684 of file tcpipconf_notify.c.

2687 {
2689 
2690  if (!iface || !pUnkReserved)
2691  return E_POINTER;
2692 
2693  This->pUnknown = pUnkReserved;
2694  return S_OK;
2695 }
static IUnknown * pUnkReserved
Definition: asmenum.c:33
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ INetCfgComponentPropertyUi_fnValidateProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties ( INetCfgComponentPropertyUi *  iface,
HWND  hwndDlg 
)

Definition at line 3002 of file tcpipconf_notify.c.

3005 {
3006 MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnValidateProperties", NULL, MB_OK);
3007  return S_OK;
3008 }
smooth NULL
Definition: ftsmooth.c:416
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
#define MB_OK
Definition: winuser.h:784

◆ InitFilterListBox()

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

Definition at line 231 of file tcpipconf_notify.c.

232 {
233  LVITEMW li;
234  LPWSTR pCur;
235  INT iItem;
236 
237  if (!pData || !_wtoi(pData))
238  {
239  SendDlgItemMessageW(hwndDlg, AllowButton, BM_SETCHECK, BST_CHECKED, 0);
241  EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
242  return;
243  }
244 
245  pCur = pData;
246  memset(&li, 0x0, sizeof(LVITEMW));
247  li.mask = LVIF_TEXT;
248  iItem = 0;
249 
250  while(pCur[0])
251  {
252  li.pszText = pCur;
253  li.iItem = iItem;
254  SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
255  iItem++;
256  pCur += wcslen(pCur) + 1;
257  }
258 
259  if (!iItem)
260  SendDlgItemMessageW(hwndDlg, AllowButton, BM_SETCHECK, BST_CHECKED, 0);
261  else
262  SendDlgItemMessageW(hwndDlg, RestrictButton, BM_SETCHECK, BST_CHECKED, 0);
263 }
GLint x0
Definition: linetemp.h:95
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
int32_t INT
Definition: typedefs.h:56
#define LVIF_TEXT
Definition: commctrl.h:2305
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
Definition: wordpad.c:154
LONG_PTR LPARAM
Definition: windef.h:208
#define BM_SETCHECK
Definition: winuser.h:1903
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LPWSTR pszText
Definition: commctrl.h:2361
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT mask
Definition: commctrl.h:2356
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
WCHAR * LPWSTR
Definition: xmlstorage.h:184
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by TcpipFilterSettingsDlg().

◆ Initialize()

HRESULT Initialize ( TcpipConfNotifyImpl This)

Definition at line 2823 of file tcpipconf_notify.c.

2824 {
2825  DWORD dwSize, Status;
2826  WCHAR szBuffer[50];
2827  IP_ADAPTER_INFO * pCurrentAdapter;
2828  IP_ADAPTER_INFO * pInfo;
2829  PIP_PER_ADAPTER_INFO pPerInfo;
2831  LPOLESTR pStr;
2832  HRESULT hr;
2833  BOOL bFound;
2834  TcpipSettings * pCurSettings;
2835  ULONG uLength;
2836 
2837  if (This->pCurrentConfig)
2838  return S_OK;
2839 
2840  hr = StringFromCLSID(&This->NetCfgInstanceId, &pStr);
2841  if (FAILED(hr))
2842  return hr;
2843 
2844 
2845  dwSize = 0;
2847  {
2848  CoTaskMemFree(pStr);
2849  return E_FAIL;
2850  }
2851 
2852  pInfo = CoTaskMemAlloc(dwSize);
2853  if (!pInfo)
2854  {
2855  CoTaskMemFree(pStr);
2856  return E_FAIL;
2857  }
2858 
2859  if (GetAdaptersInfo(pInfo, &dwSize) != ERROR_SUCCESS)
2860  {
2861  CoTaskMemFree(pStr);
2862  CoTaskMemFree(pInfo);
2863  return E_FAIL;
2864  }
2865 
2866  pCurrentAdapter = pInfo;
2867  bFound = FALSE;
2868  while(pCurrentAdapter)
2869  {
2870  szBuffer[0] = L'\0';
2871  if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
2872  {
2873  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2874  }
2875  if (!_wcsicmp(szBuffer, pStr))
2876  {
2877  bFound = TRUE;
2878  break;
2879  }
2880  pCurrentAdapter = pCurrentAdapter->Next;
2881  }
2882  CoTaskMemFree(pStr);
2883 
2884  if (!bFound)
2885  {
2886  CoTaskMemFree(pInfo);
2887  return E_FAIL;
2888  }
2889 
2890  pCurSettings = CoTaskMemAlloc(sizeof(TcpipSettings));
2891  if (!pCurSettings)
2892  {
2893  CoTaskMemFree(pInfo);
2894  return E_FAIL;
2895  }
2896 
2897  ZeroMemory(pCurSettings, sizeof(TcpipSettings));
2898  This->pCurrentConfig = pCurSettings;
2899  pCurSettings->DhcpEnabled = pCurrentAdapter->DhcpEnabled;
2900  pCurSettings->Index = pCurrentAdapter->Index;
2901 
2902  if (!pCurrentAdapter->DhcpEnabled)
2903  {
2904  CopyIpAddrString(&pCurrentAdapter->IpAddressList, &pCurSettings->Ip, SUBMASK, NULL);
2905  }
2906 
2907  CopyIpAddrString(&pCurrentAdapter->GatewayList, &pCurSettings->Gw, METRIC, NULL);
2908 
2909  uLength = sizeof(IP_PER_ADAPTER_INFO);
2910  ZeroMemory(&Info, sizeof(IP_PER_ADAPTER_INFO));
2911 
2912  if (GetPerAdapterInfo(pCurrentAdapter->Index, &Info, &uLength) == ERROR_BUFFER_OVERFLOW)
2913  {
2914  pPerInfo = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(uLength);
2915  if (pPerInfo)
2916  {
2917  Status = GetPerAdapterInfo(pCurrentAdapter->Index, pPerInfo, &uLength);
2918  if (Status == NOERROR)
2919  {
2920  if (!pPerInfo->AutoconfigActive)
2921  {
2922  CopyIpAddrString(&pPerInfo->DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
2923  }
2924  pCurSettings->AutoconfigActive = pPerInfo->AutoconfigActive;
2925  }
2926  CoTaskMemFree(pPerInfo);
2927  }
2928  }
2929  else
2930  {
2931  if (!Info.AutoconfigActive)
2932  {
2933  CopyIpAddrString(&Info.DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
2934  }
2935  pCurSettings->AutoconfigActive = Info.AutoconfigActive;
2936  }
2937 
2939  return E_FAIL;
2940 
2941  if (FAILED(LoadDNSSettings(This)))
2942  return E_FAIL;
2943 
2944  CoTaskMemFree(pInfo);
2945 
2946  return S_OK;
2947 }
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define NOERROR
Definition: winerror.h:2354
UINT DhcpEnabled
Definition: iptypes.h:61
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:185
#define CP_ACP
Definition: compat.h:99
#define ZeroMemory
Definition: winbase.h:1642
ULONG IPADDR
Definition: rassapi.h:53
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
struct TraceInfo Info
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:55
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
HRESULT CopyIpAddrString(IP_ADDR_STRING *pSrc, IP_ADDR **pTarget, COPY_TYPE Type, LPWSTR szMetric)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
struct _IP_PER_ADAPTER_INFO IP_PER_ADAPTER_INFO
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _IP_PER_ADAPTER_INFO * PIP_PER_ADAPTER_INFO
static const WCHAR L[]
Definition: oid.c:1250
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:77
Status
Definition: gdiplustypes.h:24
#define S_OK
Definition: intsafe.h:59
IP_ADDR_STRING GatewayList
Definition: iptypes.h:64
HRESULT LoadFilterSettings(TcpipConfNotifyImpl *This)
#define MultiByteToWideChar
Definition: compat.h:100
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
unsigned int ULONG
Definition: retypes.h:1
HRESULT LoadDNSSettings(TcpipConfNotifyImpl *This)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:53
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:63
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412

Referenced by INetCfgComponentControl_fnApplyRegistryChanges(), and INetCfgComponentPropertyUi_fnMergePropPages().

◆ InitializePropertySheetPage()

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

Definition at line 514 of file tcpipconf_notify.c.

515 {
516  PROPSHEETPAGEW ppage;
517 
518  memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW));
519  ppage.dwSize = sizeof(PROPSHEETPAGEW);
520  ppage.dwFlags = PSP_DEFAULT;
521  ppage.u.pszTemplate = resname;
522  ppage.pfnDlgProc = dlgproc;
523  ppage.lParam = lParam;
525  if (szTitle)
526  {
527  ppage.dwFlags |= PSP_USETITLE;
528  ppage.pszTitle = szTitle;
529  }
530  return CreatePropertySheetPageW(&ppage);
531 }
LPCWSTR pszTemplate
Definition: prsht.h:209
GLint x0
Definition: linetemp.h:95
DWORD dwSize
Definition: prsht.h:205
DLGPROC pfnDlgProc
Definition: prsht.h:217
struct _PROPSHEETPAGEW PROPSHEETPAGEW
LPCWSTR pszTitle
Definition: prsht.h:216
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3075
#define PSP_DEFAULT
Definition: prsht.h:22
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
LPARAM lParam
Definition: prsht.h:218
HINSTANCE hInstance
Definition: prsht.h:207
#define PSP_USETITLE
Definition: prsht.h:26
#define memset(x, y, z)
Definition: compat.h:39
LPARAM lParam
Definition: combotst.c:139
DWORD dwFlags
Definition: prsht.h:206

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

◆ InitializeTcpipAdvancedDNSDlg()

VOID InitializeTcpipAdvancedDNSDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 1565 of file tcpipconf_notify.c.

1568 {
1569  WCHAR szBuffer[200];
1570  LPWSTR pFirst, pSep, pList;
1571  IP_ADDR * pAddr;
1572  DWORD dwIpAddr;
1573 
1574  /* insert DNS addresses */
1575  pAddr = This->pCurrentConfig->Ns;
1576  while(pAddr)
1577  {
1578  dwIpAddr = pAddr->IpAddress;
1579  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1580  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1581 
1582  SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_ADDSTRING, 0, (LPARAM)szBuffer);
1583  pAddr = pAddr->Next;
1584  }
1586 
1587  if (!This->pCurrentConfig->pDNS)
1588  return;
1589 
1590  if (This->pCurrentConfig->pDNS->RegisterAdapterName)
1592  else
1594 
1595  if (This->pCurrentConfig->pDNS->RegistrationEnabled)
1597 
1598  if (This->pCurrentConfig->pDNS->szDomain[0])
1599  SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)szBuffer);
1600 
1601  if (This->pCurrentConfig->pDNS->UseDomainNameDevolution)
1603 
1604  if (!This->pCurrentConfig->pDNS->szSearchList || (wcslen(This->pCurrentConfig->pDNS->szSearchList) == 0))
1605  {
1608 
1609  return;
1610  }
1611 
1612  pList = This->pCurrentConfig->pDNS->szSearchList;
1613  if (wcslen(pList))
1614  {
1615  pFirst = pList;
1616  do
1617  {
1618  pSep = wcschr(pFirst, L',');
1619  if (pSep)
1620  {
1621  pSep[0] = L'\0';
1623  pFirst = pSep + 1;
1624  pSep[0] = L',';
1625  }
1626  else
1627  {
1629  break;
1630  }
1631  }while(TRUE);
1632 
1636  }
1637 }
#define LB_SETCURSEL
Definition: winuser.h:2045
#define TRUE
Definition: types.h:120
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4484
#define IDC_DNSADDRLIST
Definition: resource.h:48
#define LB_ADDSTRING
Definition: winuser.h:2013
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4487
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:55
#define IDC_REGSUFFIX
Definition: resource.h:64
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4485
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4486
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define IDC_SELSUFFIX
Definition: resource.h:56
#define BM_SETCHECK
Definition: winuser.h:1903
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define IDC_SUFFIX
Definition: resource.h:63
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_DNSSUFFIXLIST
Definition: resource.h:57
static const WCHAR L[]
Definition: oid.c:1250
struct tagIP_ADDR * Next
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_PRIMSUFFIX
Definition: resource.h:54
#define BST_CHECKED
Definition: winuser.h:197
WCHAR * LPWSTR
Definition: xmlstorage.h:184
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define IDC_DNSSUFFIXADD
Definition: resource.h:60
#define IDC_USESUFFIX
Definition: resource.h:65

Referenced by TcpipAdvancedDnsDlg().

◆ InitializeTcpipAdvancedIpDlg()

VOID InitializeTcpipAdvancedIpDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 670 of file tcpipconf_notify.c.

673 {
674  RECT rect;
675  LVITEMW li;
676  WCHAR szBuffer[100];
677 
680  InsertColumnToListView(GetDlgItem(hwndDlg, IDC_IPLIST), IDS_SUBMASK, 1, (rect.right - rect.left - 100));
681 
682  if (This->pCurrentConfig->DhcpEnabled)
683  {
684  if (LoadStringW(netcfgx_hInstance, IDS_DHCPACTIVE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
685  {
686  ZeroMemory(&li, sizeof(LVITEMW));
687  li.mask = LVIF_TEXT;
688  li.pszText = szBuffer;
690  }
692  }
693  else
694  {
695  InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_IPLIST), This->pCurrentConfig->Ip, TRUE);
696  }
697 
700 
703  InsertColumnToListView(GetDlgItem(hwndDlg, IDC_GWLIST), IDS_METRIC, 1, (rect.right - rect.left - 100));
704 
705  InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_GWLIST), This->pCurrentConfig->Gw, FALSE);
706 
709 
711 }
#define EM_LIMITTEXT
Definition: winuser.h:1982
VOID InsertColumnToListView(HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size)
#define TRUE
Definition: types.h:120
#define IDC_IPDEL
Definition: resource.h:37
#define IDS_IPADDR
Definition: resource.h:103
#define ZeroMemory
Definition: winbase.h:1642
#define IDC_IPMOD
Definition: resource.h:36
#define IDC_GWLIST
Definition: resource.h:38
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
& rect
Definition: startmenu.cpp:1413
#define LVIF_TEXT
Definition: commctrl.h:2305
#define IDC_GWMOD
Definition: resource.h:40
#define IDS_SUBMASK
Definition: resource.h:104
#define IDS_METRIC
Definition: resource.h:77
#define IDS_GATEWAY
Definition: resource.h:105
#define IDC_IPLIST
Definition: resource.h:34
LONG_PTR LPARAM
Definition: windef.h:208
VOID InsertIpAddressToListView(HWND hDlgCtrl, IP_ADDR *pAddr, BOOL bSubMask)
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2361
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT mask
Definition: commctrl.h:2356
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
#define IDC_METRIC
Definition: resource.h:43
#define IDC_IPADD
Definition: resource.h:35
#define IDC_GWDEL
Definition: resource.h:41
#define IDS_DHCPACTIVE
Definition: resource.h:107

Referenced by TcpipAdvancedIpDlg().

◆ InitializeTcpipAdvancedOptDlg()

VOID InitializeTcpipAdvancedOptDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 539 of file tcpipconf_notify.c.

542 {
543  WCHAR szText[500];
544  /* store context */
546 
548  {
549  szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
552  }
553 
555  {
556  szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
558  }
559 }
#define LB_SETCURSEL
Definition: winuser.h:2045
#define IDS_TCPFILTER
Definition: resource.h:102
#define LB_ADDSTRING
Definition: winuser.h:2013
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SetWindowLongPtr
Definition: treelist.c:70
static const WCHAR szText[]
Definition: dialog.c:139
#define LB_ERR
Definition: winuser.h:2407
#define IDC_OPTDESC
Definition: resource.h:69
LONG_PTR LPARAM
Definition: windef.h:208
#define IDS_TCPFILTERDESC
Definition: resource.h:101
#define WM_SETTEXT
Definition: winuser.h:1599
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
#define IDC_OPTLIST
Definition: resource.h:67
__wchar_t WCHAR
Definition: xmlstorage.h:180
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by TcpipAdvancedOptDlg().

◆ InitializeTcpipBasicDlgCtrls()

HRESULT InitializeTcpipBasicDlgCtrls ( HWND  hwndDlg,
TcpipSettings pCurSettings 
)

Definition at line 2326 of file tcpipconf_notify.c.

2329 {
2330  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 0, MAKEIPRANGE(1, 223));
2331  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 1, MAKEIPRANGE(0, 255));
2332  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 2, MAKEIPRANGE(0, 255));
2333  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 3, MAKEIPRANGE(0, 255));
2334 
2339 
2344 
2345  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 0, MAKEIPRANGE(1, 223));
2346  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 1, MAKEIPRANGE(0, 255));
2347  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 2, MAKEIPRANGE(0, 255));
2348  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 3, MAKEIPRANGE(0, 255));
2349 
2350  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 0, MAKEIPRANGE(1, 223));
2351  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 1, MAKEIPRANGE(0, 255));
2352  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 2, MAKEIPRANGE(0, 255));
2353  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 3, MAKEIPRANGE(0, 255));
2354 
2355  if (pCurSettings->DhcpEnabled)
2356  {
2362  }
2363  else
2364  {
2366 
2367  if (pCurSettings->Ip)
2368  {
2369  /* set current ip address */
2370  SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2371  /* set current hostmask */
2372  SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2373  }
2374  }
2375 
2376  if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2377  {
2378  /* set current gateway */
2379  SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2380  }
2381 
2382  if (pCurSettings->AutoconfigActive)
2383  {
2385  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), FALSE);
2386  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), FALSE);
2387  }
2388  else
2389  {
2391  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), TRUE);
2392  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), TRUE);
2393  if (pCurSettings->Ns)
2394  {
2395  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2396  if (pCurSettings->Ns->Next)
2397  {
2398  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2399  }
2400  else
2401  {
2403  }
2404  }
2405  else
2406  {
2409  }
2410  }
2411 
2412  return S_OK;
2413 }
#define IDC_IPADDR
Definition: resource.h:25
#define TRUE
Definition: types.h:120
#define IDC_DEFGATEWAY
Definition: resource.h:27
union tagIP_ADDR::@505 u
#define IDC_NODHCP
Definition: resource.h:24
#define IDC_USEDHCP
Definition: resource.h:23
#define IPM_SETADDRESS
Definition: commctrl.h:4462
#define IDC_AUTODNS
Definition: resource.h:28
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_DNS2
Definition: resource.h:31
#define BM_SETCHECK
Definition: winuser.h:1903
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_SUBNETMASK
Definition: resource.h:26
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct tagIP_ADDR * Next
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_FIXEDDNS
Definition: resource.h:29
#define S_OK
Definition: intsafe.h:59
#define IDC_DNS1
Definition: resource.h:30
#define IPM_SETRANGE
Definition: commctrl.h:4464
#define IPM_CLEARADDRESS
Definition: commctrl.h:4461
#define BST_CHECKED
Definition: winuser.h:197
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4480
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 597 of file tcpipconf_notify.c.

602 {
603  WCHAR szBuffer[200];
604  LVCOLUMNW lc;
605 
606  if (!LoadStringW(netcfgx_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
607  return;
608 
609  memset(&lc, 0, sizeof(LV_COLUMN) );
611  lc.iSubItem = SubItem;
612  lc.fmt = LVCFMT_FIXED_WIDTH;
613  lc.cx = Size;
614  lc.cchTextMax = wcslen(szBuffer);
615  lc.pszText = szBuffer;
616 
617  (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, SubItem, (LPARAM)&lc);
618 }
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2583
#define LVCF_TEXT
Definition: commctrl.h:2584
#define LV_COLUMN
Definition: commctrl.h:2543
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define LVCF_SUBITEM
Definition: commctrl.h:2585
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2628
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2563
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
int cchTextMax
Definition: commctrl.h:2564
#define LVCF_FMT
Definition: commctrl.h:2582
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define memset(x, y, z)
Definition: compat.h:39
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by InitializeTcpipAdvancedIpDlg(), and TcpipFilterSettingsDlg().

◆ InsertIpAddressToListView()

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

Definition at line 621 of file tcpipconf_notify.c.

625 {
626  WCHAR szBuffer[70];
627  DWORD dwIpAddr;
628  UINT itemCount = 0;
629  LVITEMW li;
630 
631  while(pAddr)
632  {
633  ZeroMemory(&li, sizeof(li));
634  li.mask = LVIF_TEXT;
635  li.iItem = itemCount;
636  li.iSubItem = 0;
637  dwIpAddr = pAddr->IpAddress;
638  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
639  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
640 
641  li.pszText = szBuffer;
642  li.iItem = SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
643  if (li.iItem != -1)
644  {
645  if (bSubMask)
646  {
647  dwIpAddr = pAddr->u.Subnetmask;
648  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
649  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
650  }
651  else
652  {
653  if (pAddr->u.Metric)
654  swprintf(szBuffer, L"%u", pAddr->u.Metric);
655  else
656  LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
657  }
658 
659  li.mask = LVIF_TEXT;
660  li.iSubItem = 1;
661  li.pszText = szBuffer;
662  SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
663  }
664  itemCount++;
665  pAddr = pAddr->Next;
666  }
667 }
union tagIP_ADDR::@505 u
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4484
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4487
#define ZeroMemory
Definition: winbase.h:1642
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4485
#define LVIF_TEXT
Definition: commctrl.h:2305
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4486
int iSubItem
Definition: commctrl.h:2358
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2361
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT mask
Definition: commctrl.h:2356
static const WCHAR L[]
Definition: oid.c:1250
struct tagIP_ADDR * Next
#define IDS_AUTOMATIC
Definition: resource.h:108
#define LVM_INSERTITEMW
Definition: commctrl.h:2400
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define LVM_SETITEMW
Definition: commctrl.h:2393

Referenced by InitializeTcpipAdvancedIpDlg().

◆ LaunchAdvancedTcpipSettings()

VOID LaunchAdvancedTcpipSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2101 of file tcpipconf_notify.c.

2104 {
2105  PROPSHEETHEADERW pinfo;
2106  HPROPSHEETPAGE hppages[3];
2107  WCHAR szBuffer[100];
2108 
2112 
2113 
2114  if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
2115  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2116  else
2117  szBuffer[0] = L'\0';
2118 
2119  ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
2120  pinfo.dwSize = sizeof(PROPSHEETHEADERW);
2121  pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
2123  pinfo.u3.phpage = hppages;
2124  pinfo.nPages = 3;
2125  pinfo.hwndParent = hwndDlg;
2126  pinfo.hInstance = netcfgx_hInstance;
2127  pinfo.pszCaption = szBuffer;
2129  pinfo.pfnCallback = PropSheetProc;
2130 
2131  StoreTcpipBasicSettings(hwndDlg, This, FALSE);
2132  if (PropertySheetW(&pinfo) > 0)
2133  {
2134  InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2135  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2136  }
2137 }
#define IDS_TCPIP
Definition: resource.h:110
HWND hwndParent
Definition: prsht.h:277
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define IDD_TCPIP_ADVDNS_DLG
Definition: resource.h:11
#define ZeroMemory
Definition: winbase.h:1642
#define IDI_NETWORK
Definition: resource.h:4
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_USECALLBACK
Definition: prsht.h:48
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define PSH_USEICONID
Definition: prsht.h:42
LPCWSTR pszCaption
Definition: prsht.h:283
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define IDD_TCPIP_ADVIP_DLG
Definition: resource.h:10
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:293
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
INT_PTR CALLBACK TcpipAdvancedOptDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
HINSTANCE hInstance
Definition: prsht.h:278
LPCWSTR pszIcon
Definition: prsht.h:281
DWORD dwSize
Definition: prsht.h:275
DWORD dwFlags
Definition: prsht.h:276
static const WCHAR L[]
Definition: oid.c:1250
INT_PTR CALLBACK TcpipAdvancedDnsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HPROPSHEETPAGE * phpage
Definition: prsht.h:291
#define IDD_TCPIP_ADVOPT_DLG
Definition: resource.h:12
HWND WINAPI GetParent(_In_ HWND)
HRESULT InitializeTcpipBasicDlgCtrls(HWND hwndDlg, TcpipSettings *pCurSettings)
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
INT_PTR StoreTcpipBasicSettings(HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)
INT_PTR CALLBACK TcpipAdvancedIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)

Referenced by TcpipBasicDlg().

◆ LoadDNSSettings()

HRESULT LoadDNSSettings ( TcpipConfNotifyImpl This)

Definition at line 2698 of file tcpipconf_notify.c.

2700 {
2701  LPOLESTR pStr;
2702  WCHAR szBuffer[200];
2703  HKEY hKey;
2704  DWORD dwSize;
2705 
2706 
2707  This->pCurrentConfig->pDNS = (TcpipAdvancedDNSDlgSettings*) CoTaskMemAlloc(sizeof(TcpipAdvancedDNSDlgSettings));
2708  if (!This->pCurrentConfig->pDNS)
2709  return E_FAIL;
2710 
2711  ZeroMemory(This->pCurrentConfig->pDNS, sizeof(TcpipAdvancedDNSDlgSettings));
2712 
2713  if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2714  return E_FAIL;
2715 
2716  swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2717  CoTaskMemFree(pStr);
2718  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2719  {
2720  dwSize = sizeof(DWORD);
2721  RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, &dwSize);
2722  RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, &dwSize);
2723 
2724  dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain);
2725  RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szDomain, &dwSize);
2726 
2727  RegCloseKey(hKey);
2728  }
2729 
2730  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2731  {
2732  dwSize = sizeof(DWORD);
2733  RegQueryValueExW(hKey, L"UseDomainNameDevolution", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->UseDomainNameDevolution, &dwSize);
2734 
2735  dwSize = 0;
2736  if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, NULL, &dwSize) == ERROR_SUCCESS)
2737  {
2738  This->pCurrentConfig->pDNS->szSearchList = (LPWSTR)CoTaskMemAlloc(dwSize);
2739  if (This->pCurrentConfig->pDNS->szSearchList)
2740  {
2741  if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szSearchList, &dwSize) != ERROR_SUCCESS)
2742  {
2743  CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
2744  This->pCurrentConfig->pDNS->szSearchList = NULL;
2745  }
2746  }
2747  }
2748  RegCloseKey(hKey);
2749  }
2750  return S_OK;
2751 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define ZeroMemory
Definition: winbase.h:1642
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412

Referenced by Initialize().

◆ LoadFilterSettings()

HRESULT LoadFilterSettings ( TcpipConfNotifyImpl This)

Definition at line 2776 of file tcpipconf_notify.c.

2778 {
2779  HKEY hKey;
2780  TcpFilterSettings *pFilter;
2781  WCHAR szBuffer[200];
2782  LPOLESTR pStr;
2783  DWORD dwVal, dwSize;
2784 
2785  pFilter = (TcpFilterSettings*)CoTaskMemAlloc(sizeof(TcpFilterSettings));
2786  if (!pFilter)
2787  return E_FAIL;
2788 
2789  ZeroMemory(pFilter, sizeof(TcpFilterSettings));
2790  This->pCurrentConfig->pFilter = pFilter;
2791 
2792 
2793  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2794  {
2795  dwSize = sizeof(DWORD);
2796  if (RegQueryValueExW(hKey, L"EnableSecurityFilters", NULL, NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
2797  pFilter->EnableSecurityFilters = dwVal;
2798  RegCloseKey(hKey);
2799  }
2800  else
2801  {
2802  pFilter->EnableSecurityFilters = FALSE;
2803  }
2804 
2805  if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2806  return E_FAIL;
2807 
2808  swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2809  CoTaskMemFree(pStr);
2810  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
2811  {
2812  return S_OK;
2813  }
2814  pFilter->szTCPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"TCPAllowedPorts", &pFilter->TCPSize);
2815  pFilter->szUDPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"UDPAllowedPorts", &pFilter->UDPSize);
2816  pFilter->szRawIPAllowedProtocols = LoadTcpFilterSettingsFromRegistry(hKey, L"RawIPAllowedProtocols", &pFilter->IPSize);
2817  RegCloseKey(hKey);
2818  return S_OK;
2819 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define ZeroMemory
Definition: winbase.h:1642
static LPOLESTR
Definition: stg_prop.c:27
#define E_FAIL
Definition: ddrawi.h:102
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
LPWSTR LoadTcpFilterSettingsFromRegistry(HKEY hKey, LPCWSTR szName, LPDWORD Size)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:59
LPWSTR szRawIPAllowedProtocols
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412

Referenced by Initialize().

◆ LoadTcpFilterSettingsFromRegistry()

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

Definition at line 2754 of file tcpipconf_notify.c.

2755 {
2756  DWORD dwSize;
2757  LPWSTR pData;
2758 
2760  return NULL;
2761 
2763  if (!pData)
2764  return NULL;
2765 
2767  {
2769  return NULL;
2770  }
2771  *Size = dwSize;
2772  return pData;
2773 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
unsigned long DWORD
Definition: ntddk_ex.h:95
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static const WCHAR szName[]
Definition: msipriv.h:1194
WCHAR * LPWSTR
Definition: xmlstorage.h:184
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by LoadFilterSettings().

◆ MoveItem()

VOID MoveItem ( HWND  hDlgCtrl,
INT  pos 
)

Definition at line 1674 of file tcpipconf_notify.c.

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

Referenced by TcpipAdvancedDnsDlg().

◆ PropSheetProc()

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

Definition at line 2084 of file tcpipconf_notify.c.

2085 {
2086  // NOTE: This callback is needed to set large icon correctly.
2087  HICON hIcon;
2088  switch (uMsg)
2089  {
2090  case PSCB_INITIALIZED:
2091  {
2093  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
2094  break;
2095  }
2096  }
2097  return 0;
2098 }
static HICON
Definition: imagelist.c:84
#define IDI_NETWORK
Definition: resource.h:4
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by LaunchAdvancedTcpipSettings().

◆ RemoveItem()

VOID RemoveItem ( HWND  hDlgCtrl)

Definition at line 1696 of file tcpipconf_notify.c.

1698 {
1699  LRESULT lResult, lCount;
1700 
1701  lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1702  if (lResult != LB_ERR)
1703  {
1704  SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1705  lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1706  if (lResult + 1 < lCount)
1707  SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult, 0);
1708  else
1709  SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lCount-1, 0);
1710  }
1711 }
#define LB_SETCURSEL
Definition: winuser.h:2045
UINT_PTR WPARAM
Definition: windef.h:207
#define LB_ERR
Definition: winuser.h:2407
#define LB_GETCOUNT
Definition: winuser.h:2020
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2021
LONG_PTR LRESULT
Definition: windef.h:209
#define LB_DELETESTRING
Definition: winuser.h:2014

Referenced by TcpipAdvancedDnsDlg().

◆ StoreDNSSettings()

VOID StoreDNSSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This 
)

Definition at line 1763 of file tcpipconf_notify.c.

1766 {
1767  INT iCount, iIndex;
1768  WCHAR Ip[16];
1769  IP_ADDR *pCur, *pLast;
1770 
1771  FreeIPAddr(This->pCurrentConfig->Ns);
1772  This->pCurrentConfig->Ns = NULL;
1773 
1774  iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1775  if (!iCount || iCount == LB_ERR)
1776  {
1777  return;
1778  }
1779 
1780  pLast = NULL;
1781  for(iIndex = 0; iIndex < iCount; iIndex++)
1782  {
1783  if (SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)Ip) == LB_ERR)
1784  break;
1785 
1786  pCur = CoTaskMemAlloc(sizeof(IP_ADDR));
1787  if (!pCur)
1788  break;
1789  ZeroMemory(pCur, sizeof(IP_ADDR));
1790  pCur->IpAddress = GetIpAddressFromStringW(Ip);
1791 
1792  if (!pLast)
1793  This->pCurrentConfig->Ns = pCur;
1794  else
1795  pLast->Next = pCur;
1796 
1797  pLast = pCur;
1798  pCur = pCur->Next;
1799  }
1800  This->pCurrentConfig->AutoconfigActive = FALSE;
1801 }
UINT GetIpAddressFromStringW(WCHAR *szBuffer)
#define ZeroMemory
Definition: winbase.h:1642
int32_t INT
Definition: typedefs.h:56
#define LB_ERR
Definition: winuser.h:2407
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:2020
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LB_GETTEXT
Definition: winuser.h:2031
struct tagIP_ADDR * Next
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
VOID FreeIPAddr(IP_ADDR *pAddr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by TcpipAdvancedDnsDlg().

◆ StoreIPSettings()

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

Definition at line 1204 of file tcpipconf_notify.c.

1208 {
1209  WCHAR szBuffer[30];
1210 
1211  INT iIndex, iCount;
1212  IP_ADDR *pCur, *pLast;
1213 
1214  iCount = ListView_GetItemCount(hDlgCtrl);
1215  if (!iCount)
1216  {
1217  return;
1218  }
1219 
1220  pLast = NULL;
1221  for(iIndex = 0; iIndex < iCount; iIndex++)
1222  {
1223  if (GetListViewItem(hDlgCtrl, iIndex, 0, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1224  {
1225  pCur = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
1226  if (!pCur)
1227  break;
1228  ZeroMemory(pCur, sizeof(IP_ADDR));
1229 
1230  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1231  pCur->IpAddress = GetIpAddressFromStringW(szBuffer);
1232 
1233  if (GetListViewItem(hDlgCtrl, iIndex, 1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR) ))
1234  {
1235  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1236  if (bSubmask)
1237  pCur->u.Subnetmask = GetIpAddressFromStringW(szBuffer);
1238  else
1239  pCur->u.Metric = _wtoi(szBuffer);
1240  }
1241 
1242  if (!pLast)
1243  {
1244  if (bSubmask)
1245  This->pCurrentConfig->Ip = pCur;
1246  else
1247  This->pCurrentConfig->Gw = pCur;
1248  }
1249  else
1250  {
1251  pLast->Next = pCur;
1252  }
1253 
1254  pLast = pCur;
1255  }
1256  }
1257 }
union tagIP_ADDR::@505 u
UINT GetIpAddressFromStringW(WCHAR *szBuffer)
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ZeroMemory
Definition: winbase.h:1642
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
struct tagIP_ADDR * Next
BOOL GetListViewItem(HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by TcpipAdvancedIpDlg().

◆ StoreTcpipBasicSettings()

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

Definition at line 2170 of file tcpipconf_notify.c.

2174 {
2175  DWORD dwIpAddr;
2176 
2177  if (SendDlgItemMessageW(hwndDlg, IDC_NODHCP, BM_GETCHECK, 0, 0) == BST_CHECKED)
2178  {
2179  This->pCurrentConfig->DhcpEnabled = FALSE;
2180  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2181  {
2182  if (bApply)
2183  {
2185  SetFocus(GetDlgItem(hwndDlg, IDC_IPADDR));
2186  return E_FAIL;
2187  }
2188  }
2189  if (!This->pCurrentConfig->Ip)
2190  {
2191  This->pCurrentConfig->Ip = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2192  if (!This->pCurrentConfig->Ip)
2193  return E_OUTOFMEMORY;
2194  ZeroMemory(This->pCurrentConfig->Ip, sizeof(IP_ADDR));
2195  }
2196  This->pCurrentConfig->Ip->IpAddress = dwIpAddr;
2197 
2198  if (SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2199  {
2200  if (bApply)
2202  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2203  {
2204  if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2205  dwIpAddr = MAKEIPADDRESS(255, 0, 0, 0);
2206  else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2207  dwIpAddr = MAKEIPADDRESS(255, 255, 0, 0);
2208  else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2209  dwIpAddr = MAKEIPADDRESS(255, 255, 255, 0);
2210 
2211  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)dwIpAddr);
2212  }
2213  if (bApply)
2214  {
2215  SetFocus(GetDlgItem(hwndDlg, IDC_SUBNETMASK));
2216  return E_FAIL;
2217  }
2218  }
2219  /* store subnetmask */
2220  This->pCurrentConfig->Ip->u.Subnetmask = dwIpAddr;
2221  }
2222  else
2223  {
2224  This->pCurrentConfig->DhcpEnabled = TRUE;
2225  }
2226 
2227  if (SendDlgItemMessageW(hwndDlg, IDC_DEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2228  {
2229  if (!This->pCurrentConfig->Gw)
2230  {
2231  This->pCurrentConfig->Gw = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2232  if (!This->pCurrentConfig->Gw)
2233  return E_OUTOFMEMORY;
2234  ZeroMemory(This->pCurrentConfig->Gw, sizeof(IP_ADDR));
2235  }
2236  /* store default gateway */
2237  This->pCurrentConfig->Gw->IpAddress = dwIpAddr;
2238  }
2239  else
2240  {
2241  if (This->pCurrentConfig->Gw)
2242  {
2243  IP_ADDR * pNextGw = This->pCurrentConfig->Gw->Next;
2244  CoTaskMemFree(This->pCurrentConfig->Gw);
2245  This->pCurrentConfig->Gw = pNextGw;
2246  }
2247  }
2248 
2249  if (SendDlgItemMessageW(hwndDlg, IDC_FIXEDDNS, BM_GETCHECK, 0, 0) == BST_CHECKED)
2250  {
2251  BOOL bSkip = FALSE;
2252  This->pCurrentConfig->AutoconfigActive = FALSE;
2253  if (SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2254  {
2255  if (!This->pCurrentConfig->Ns)
2256  {
2257  This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2258  if (!This->pCurrentConfig->Ns)
2259  return E_OUTOFMEMORY;
2260  ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2261  }
2262  This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2263  }
2264  else if (This->pCurrentConfig->Ns)
2265  {
2266  IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next;
2267 
2268  CoTaskMemFree(This->pCurrentConfig->Ns);
2269  This->pCurrentConfig->Ns = pTemp;
2270  bSkip = TRUE;
2271  }
2272 
2273 
2274  if (SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2275  {
2276  if (!This->pCurrentConfig->Ns || bSkip)
2277  {
2278  if (!This->pCurrentConfig->Ns)
2279  {
2280  This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2281  if (!This->pCurrentConfig->Ns)
2282  return E_OUTOFMEMORY;
2283  ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2284  }
2285  This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2286  }
2287  else if (!This->pCurrentConfig->Ns->Next)
2288  {
2289  This->pCurrentConfig->Ns->Next = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2290  if (!This->pCurrentConfig->Ns->Next)
2291  return E_OUTOFMEMORY;
2292  ZeroMemory(This->pCurrentConfig->Ns->Next, sizeof(IP_ADDR));
2293  This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2294  }
2295  else
2296  {
2297  This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2298  }
2299  }
2300  else
2301  {
2302  if (This->pCurrentConfig->Ns && This->pCurrentConfig->Ns->Next)
2303  {
2304  if (This->pCurrentConfig->Ns->Next->Next)
2305  {
2306  IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next->Next;
2307  CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2308  This->pCurrentConfig->Ns->Next = pTemp;
2309  }
2310  else
2311  {
2312  CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2313  This->pCurrentConfig->Ns->Next = NULL;
2314  }
2315  }
2316  }
2317  }
2318  else
2319  {
2320  This->pCurrentConfig->AutoconfigActive = TRUE;
2321  }
2322  return S_OK;
2323 }
#define IDC_IPADDR
Definition: resource.h:25
#define IDS_TCPIP
Definition: resource.h:110
#define TRUE
Definition: types.h:120
#define IDC_DEFGATEWAY
Definition: resource.h:27
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define IDC_NODHCP
Definition: resource.h:24
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
#define ZeroMemory
Definition: winbase.h:1642
HWND WINAPI SetFocus(_In_opt_ HWND)
#define E_FAIL
Definition: ddrawi.h:102
#define MB_ICONWARNING
Definition: winuser.h:780
#define IDS_NO_SUBMASK_SET
Definition: resource.h:100
#define IPM_SETADDRESS
Definition: commctrl.h:4462
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IPM_GETADDRESS
Definition: commctrl.h:4463
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_DNS2
Definition: resource.h:31
#define BM_GETCHECK
Definition: winuser.h:1900
#define IDS_NO_IPADDR_SET
Definition: resource.h:99
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_SUBNETMASK
Definition: resource.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_FIXEDDNS
Definition: resource.h:29
#define S_OK
Definition: intsafe.h:59
#define IDC_DNS1
Definition: resource.h:30
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4482
#define BST_CHECKED
Definition: winuser.h:197
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ StoreTcpipFilterSettings()

TcpFilterSettings* StoreTcpipFilterSettings ( HWND  hwndDlg)

Definition at line 315 of file tcpipconf_notify.c.

317 {
318  TcpFilterSettings * pFilter;
319 
320  pFilter = CoTaskMemAlloc(sizeof(TcpFilterSettings));
321  if (!pFilter)
322  return NULL;
323 
325  pFilter->EnableSecurityFilters = TRUE;
326  else
327  pFilter->EnableSecurityFilters = FALSE;
328 
329  pFilter->szTCPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_TCP_LIST), &pFilter->TCPSize);
330  pFilter->szUDPAllowedPorts = CreateFilterList(GetDlgItem(hwndDlg, IDC_UDP_LIST), &pFilter->UDPSize);
331  pFilter->szRawIPAllowedProtocols = CreateFilterList(GetDlgItem(hwndDlg, IDC_IP_LIST), &pFilter->IPSize);
332 
333  return pFilter;
334 }
#define TRUE
Definition: types.h:120
#define IDC_USE_FILTER
Definition: resource.h:86
#define IDC_UDP_LIST
Definition: resource.h:78
LPWSTR CreateFilterList(HWND hDlgCtrl, LPDWORD Size)
smooth NULL
Definition: ftsmooth.c:416
#define BM_GETCHECK
Definition: winuser.h:1900
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_TCP_LIST
Definition: resource.h:73
#define IDC_IP_LIST
Definition: resource.h:83
#define BST_CHECKED
Definition: winuser.h:197
LPWSTR szRawIPAllowedProtocols
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

Referenced by TcpipFilterSettingsDlg().

◆ TcpipAddDNSDlg()

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

Definition at line 1484 of file tcpipconf_notify.c.

1490 {
1491  TcpipDnsSettings * pSettings;
1492  WCHAR szBuffer[100];
1493  DWORD dwIpAddr;
1494  LPNMIPADDRESS lpnmipa;
1495 
1496  switch(uMsg)
1497  {
1498  case WM_INITDIALOG:
1499  pSettings = (TcpipDnsSettings*)lParam;
1501  if (!pSettings->bAdd)
1502  {
1503  if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1504  {
1505  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1506  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1507  }
1508  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_SETTEXT, 0, (LPARAM)pSettings->szIP);
1509  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1510  }
1511  else
1512  {
1513  if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1514  {
1515  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1516  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1517  }
1518  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1519  }
1520  return TRUE;
1521  case WM_COMMAND:
1522  if (LOWORD(wParam) == IDCANCEL)
1523  {
1524  EndDialog(hwndDlg, FALSE);
1525  break;
1526  }
1527  else if (LOWORD(wParam) == IDC_OK)
1528  {
1529  pSettings = (TcpipDnsSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1530  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pSettings->szIP);
1531  if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->szIP) == LB_ERR)
1532  {
1533  if (pSettings->bAdd)
1534  SendMessageW(pSettings->hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)pSettings->szIP);
1535  EndDialog(hwndDlg, TRUE);
1536  break;
1537  }
1538  if (!pSettings->bAdd)
1539  {
1540  EndDialog(hwndDlg, FALSE);
1541  break;
1542  }
1544  break;
1545  }
1546  break;
1547  case WM_NOTIFY:
1548  lpnmipa = (LPNMIPADDRESS) lParam;
1549  if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1550  {
1551  if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1552  {
1553  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1554  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1555  }
1556  }
1557  break;
1558  }
1559  return FALSE;
1560 }
#define IDC_IPADDR
Definition: resource.h:25
#define IDS_TCPIP
Definition: resource.h:110
#define TRUE
Definition: types.h:120
#define IDS_DUP_SUFFIX
Definition: resource.h:123
#define LB_ADDSTRING
Definition: winuser.h:2013
#define IDS_ADD
Definition: resource.h:111
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
#define IPN_FIELDCHANGED
Definition: commctrl.h:4473
#define WM_GETTEXT
Definition: winuser.h:1600
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3134
struct tagNMIPADDRESS * LPNMIPADDRESS
#define LB_ERR
Definition: winuser.h:2407
#define IPM_GETADDRESS
Definition: commctrl.h:4463
UINT_PTR idFrom
Definition: winuser.h:3133
#define IDS_MOD
Definition: resource.h:112
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
#define MB_ICONERROR
Definition: winuser.h:781
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LB_FINDSTRING
Definition: winuser.h:2016
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define IDC_OK
Definition: resource.h:59
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAddIpDlg()

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

Definition at line 871 of file tcpipconf_notify.c.

877 {
878  LPNMIPADDRESS lpnmipa;
879  DWORD dwIpAddr;
880  TcpipIpSettings *pIpSettings;
881  WCHAR szBuffer[50];
883  LRESULT lResult;
884 
885  switch(uMsg)
886  {
887  case WM_INITDIALOG:
888  pIpSettings = (TcpipIpSettings*)lParam;
890 
899 
900  if (pIpSettings->bAdd)
901  {
902  if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
903  {
904  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
905  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
906  }
907  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
908  }
909  else
910  {
911  if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
912  {
913  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
914  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
915  }
916 
919  }
920  return TRUE;
921  case WM_NOTIFY:
922  lpnmipa = (LPNMIPADDRESS) lParam;
923  if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
924  {
925  if (lpnmipa->hdr.idFrom == IDC_IPADDR)
926  {
927  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
928  {
929  if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
931  else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
932  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 0, 0));
933  else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
934  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
935  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
936  }
937  }
938  }
939  break;
940  case WM_COMMAND:
941  if (LOWORD(wParam) == IDC_OK)
942  {
943  pIpSettings = (TcpipIpSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
944  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pIpSettings->szIP);
945  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, WM_GETTEXT, 16, (LPARAM)pIpSettings->szMask);
946 
947  ZeroMemory(&find, sizeof(LVFINDINFOW));
948  find.flags = LVFI_STRING;
949  find.psz = pIpSettings->szIP;
950  lResult = SendMessageW(pIpSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find);
951 
952  if (lResult == -1)
953  {
954  EndDialog(hwndDlg, TRUE);
955  break;
956  }
957  else if (!pIpSettings->bAdd)
958  {
959  EndDialog(hwndDlg, FALSE);
960  break;
961  }
963  break;
964  }
965  else if (LOWORD(wParam) == IDCANCEL)
966  {
967  EndDialog(hwndDlg, FALSE);
968  }
969  break;
970  }
971  return FALSE;
972 }
#define IDC_IPADDR
Definition: resource.h:25
#define IDS_DUP_IPADDR
Definition: resource.h:124
#define IDS_TCPIP
Definition: resource.h:110
#define TRUE
Definition: types.h:120
#define IDS_ADD
Definition: resource.h:111
UINT GetIpAddressFromStringW(WCHAR *szBuffer)
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
#define LVM_FINDITEMW
Definition: commctrl.h:2462
#define IPN_FIELDCHANGED
Definition: commctrl.h:4473
#define WM_GETTEXT
Definition: winuser.h:1600
#define ZeroMemory
Definition: winbase.h:1642
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3134
struct tagNMIPADDRESS * LPNMIPADDRESS
#define IPM_SETADDRESS
Definition: commctrl.h:4462
#define IPM_GETADDRESS
Definition: commctrl.h:4463
UINT_PTR idFrom
Definition: winuser.h:3133
#define IDS_MOD
Definition: resource.h:112
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_SUBNETMASK
Definition: resource.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONINFORMATION
Definition: winuser.h:796
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define IPM_SETRANGE
Definition: commctrl.h:4464
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4482
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4480
static TAGID TAGID find
Definition: db.cpp:153
#define LVFI_STRING
Definition: commctrl.h:2433
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
#define IDC_OK
Definition: resource.h:59
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAddSuffixDlg()

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

Definition at line 990 of file tcpipconf_notify.c.

996 {
997  WCHAR szBuffer[100];
998  TcpipSuffixSettings * pSettings;
999  LRESULT lLength;
1000 
1001  switch(uMsg)
1002  {
1003  case WM_INITDIALOG:
1004  pSettings = (TcpipSuffixSettings*)lParam;
1005  if (!pSettings->bAdd)
1006  {
1007  SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)pSettings->Suffix);
1008  if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1009  {
1010  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1011  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1012  }
1013  CoTaskMemFree(pSettings->Suffix);
1014  pSettings->Suffix = NULL;
1015  }
1016  else
1017  {
1018  if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1019  {
1020  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1021  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1022  }
1023  }
1024  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSettings);
1025  return TRUE;
1026  case WM_COMMAND:
1027  if (LOWORD(wParam) == IDCANCEL)
1028  {
1029  EndDialog(hwndDlg, FALSE);
1030  break;
1031  }
1032  else if (LOWORD(wParam) == IDC_OK)
1033  {
1034  lLength = SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXTLENGTH, 0, 0);
1035  if (lLength)
1036  {
1037  pSettings = (TcpipSuffixSettings*) GetWindowLongPtr(hwndDlg, DWLP_USER);
1038  pSettings->Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1)* sizeof(WCHAR));
1039  if (pSettings->Suffix)
1040  {
1041  SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, lLength + 1, (LPARAM)pSettings->Suffix);
1042  if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->Suffix) != LB_ERR)
1043  {
1045  CoTaskMemFree(pSettings->Suffix);
1046  break;
1047  }
1048 
1049  if (!VerifyDNSSuffix(pSettings->Suffix))
1050  {
1052  CoTaskMemFree(pSettings->Suffix);
1053  break;
1054  }
1055  EndDialog(hwndDlg, TRUE);
1056  }
1057  }
1058  break;
1059  }
1060  }
1061  return FALSE;
1062 }
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define IDS_TCPIP
Definition: resource.h:110
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define IDS_DUP_SUFFIX
Definition: resource.h:123
#define IDS_ADD
Definition: resource.h:111
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
#define WM_GETTEXT
Definition: winuser.h:1600
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define MB_ICONWARNING
Definition: winuser.h:780
#define LB_ERR
Definition: winuser.h:2407
#define IDS_MOD
Definition: resource.h:112
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1599
#define IDS_DOMAIN_SUFFIX
Definition: resource.h:121
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_SUFFIX
Definition: resource.h:63
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
#define LB_FINDSTRING
Definition: winuser.h:2016
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
BOOL VerifyDNSSuffix(LPWSTR szName)
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
#define IDC_OK
Definition: resource.h:59
#define WM_INITDIALOG
Definition: winuser.h:1721
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAdvancedDnsDlg()

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

Definition at line 1805 of file tcpipconf_notify.c.

1811 {
1814  TcpipDnsSettings Dns;
1815  LRESULT lIndex, lLength;
1816  TcpipSuffixSettings Suffix;
1817  LPPSHNOTIFY lppsn;
1818  WCHAR szSuffix[100];
1819  WCHAR szFormat[200];
1820  WCHAR szBuffer[300];
1821 
1822 
1823  switch(uMsg)
1824  {
1825  case WM_INITDIALOG:
1827  This = (TcpipConfNotifyImpl*)page->lParam;
1828  SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)This);
1832  return TRUE;
1833  case WM_NOTIFY:
1834  lppsn = (LPPSHNOTIFY) lParam;
1835  if (lppsn->hdr.code == PSN_KILLACTIVE)
1836  {
1837  if (SendDlgItemMessageW(hwndDlg, IDC_SELSUFFIX, BM_GETCHECK, 0, 0) == BST_CHECKED &&
1838  SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_GETCOUNT, 0, 0) == 0)
1839  {
1842  return TRUE;
1843  }
1844  if (SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, sizeof(szSuffix)/sizeof(WCHAR), (LPARAM)szSuffix))
1845  {
1846  szSuffix[(sizeof(szSuffix)/sizeof(WCHAR))-1] = L'\0';
1847  if (VerifyDNSSuffix(szSuffix) == FALSE)
1848  {
1849  if (LoadStringW(netcfgx_hInstance, IDS_DNS_SUFFIX, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1850  {
1851  szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1852  swprintf(szBuffer, szFormat, szSuffix);
1853  if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1854  szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1855  else
1856  szFormat[0] = L'\0';
1857 
1858  MessageBoxW(hwndDlg, szBuffer, szFormat, MB_ICONWARNING);
1860  SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
1861  return TRUE;
1862  }
1863  }
1864  }
1865  }
1866  else if (lppsn->hdr.code == PSN_APPLY)
1867  {
1869  if (!This->pCurrentConfig->pDNS)
1870  break;
1871 
1874  {
1875  CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1876  This->pCurrentConfig->pDNS->szSearchList = NULL;
1878  This->pCurrentConfig->pDNS->UseDomainNameDevolution = TRUE;
1879  else
1880  This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1881  }
1882  else
1883  {
1884  CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
1885  This->pCurrentConfig->pDNS->szSearchList = NULL;
1886  This->pCurrentConfig->pDNS->UseDomainNameDevolution = FALSE;
1887  This->pCurrentConfig->pDNS->szSearchList = GetListViewEntries(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST));
1888  }
1889 
1890  if (SendDlgItemMessageW(hwndDlg, IDC_REGSUFFIX, BM_GETCHECK, 0, 0) == BST_CHECKED)
1891  {
1892  This->pCurrentConfig->pDNS->RegisterAdapterName = TRUE;
1893  if (SendDlgItemMessageW(hwndDlg, IDC_USESUFFIX, BM_GETCHECK, 0, 0) == BST_CHECKED)
1894  This->pCurrentConfig->pDNS->RegistrationEnabled = TRUE;
1895  else
1896  This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1897  }
1898  else
1899  {
1900  This->pCurrentConfig->pDNS->RegisterAdapterName = FALSE;
1901  This->pCurrentConfig->pDNS->RegistrationEnabled = FALSE;
1902  }
1903  }
1904  break;
1905  case WM_COMMAND:
1907  {
1909  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
1910  break;
1911  }
1912  else if (LOWORD(wParam) == IDC_DNSSUFFIXLIST && HIWORD(wParam) ==