ReactOS  0.4.13-dev-52-g0efcfec
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)
 
static VOID EnableIpButtons (HWND hwndDlg)
 
static VOID EnableGwButtons (HWND hwndDlg)
 
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 2165 of file tcpipconf_notify.c.

2168 {
2169  HPROPSHEETPAGE hpage;
2170 
2172  if (!hpage)
2173  return;
2174 
2175  SendMessageW(hDlg, PSM_INSERTPAGE, 1, (LPARAM)hpage);
2176 }
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 2422 of file tcpipconf_notify.c.

2427 {
2428  IP_ADDR_STRING * pCurrent;
2429  IP_ADDR *pNew, *pLast;
2430 
2431  pCurrent = pSrc;
2432  pLast = NULL;
2433 
2434  while(pCurrent)
2435  {
2436  pNew = CoTaskMemAlloc(sizeof(IP_ADDR));
2437  if (!pNew)
2438  {
2439  break;
2440  }
2441  ZeroMemory(pNew, sizeof(IP_ADDR));
2443  if (!pNew->IpAddress)
2444  {
2445  CoTaskMemFree(pNew);
2446  return E_FAIL;
2447  }
2448 
2449  if (Type == SUBMASK)
2450  {
2451  pNew->u.Subnetmask = GetIpAddressFromStringA(pCurrent->IpMask.String);
2452  pNew->NTEContext = pCurrent->Context;
2453  }
2454  else if (Type == METRIC)
2455  {
2456  if (szMetric && szMetric[0] != L'\0')
2457  {
2458  pNew->u.Metric = _wtoi(szMetric);
2459  szMetric += wcslen(szMetric) + 1;
2460  }
2461  }
2462 
2463  if (!pLast)
2464  *pTarget = pNew;
2465  else
2466  pLast->Next = pNew;
2467 
2468  pLast = pNew;
2469  pCurrent = pCurrent->Next;
2470 
2471  }
2472  pLast->Next = NULL;
2473  return S_OK;
2474 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
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:1635
#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)
union tagIP_ADDR::@487 u
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
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:1635
int32_t INT
Definition: typedefs.h:56
#define LVIF_TEXT
Definition: commctrl.h:2281
int cchTextMax
Definition: commctrl.h:2338
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2337
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT mask
Definition: commctrl.h:2332
_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:2362
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:406
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 3098 of file tcpipconf_notify.c.

3099 {
3100  LPWSTR pStr, pRet;
3101  DWORD dwSize, dwIpAddr;
3102  WCHAR szBuffer[30];
3103  IP_ADDR *pTemp = pAddr;
3104 
3105 
3106  dwSize = 0;
3107  while(pTemp)
3108  {
3109  if (Type == IPADDR)
3110  {
3111  dwIpAddr = pTemp->IpAddress;
3112  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3113  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3114  }else if (Type == SUBMASK)
3115  {
3116  dwIpAddr = pTemp->u.Subnetmask;
3117  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
3118  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3119  }
3120  else if (Type == METRIC)
3121  {
3122  swprintf(szBuffer, L"%u", pTemp->u.Metric);
3123  }
3124 
3125  dwSize += wcslen(szBuffer) + 1;
3126  pTemp = pTemp->Next;
3127  }
3128 
3129  if (!dwSize)
3130  return NULL;
3131 
3132  pStr = pRet = CoTaskMemAlloc((dwSize+1) * sizeof(WCHAR));
3133  if(!pStr)
3134  return NULL;
3135 
3136  pTemp = pAddr;
3137  while(pTemp)
3138  {
3139  if (Type == IPADDR)
3140  {
3141  dwIpAddr = pTemp->IpAddress;
3142  swprintf(pStr, L"%lu.%lu.%lu.%lu",
3143  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3144  }else if (Type == SUBMASK)
3145  {
3146  dwIpAddr = pTemp->u.Subnetmask;
3147  swprintf(pStr, L"%lu.%lu.%lu.%lu",
3148  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
3149  }
3150  else if (Type == METRIC)
3151  {
3152  swprintf(pStr, L"%u", pTemp->u.Metric);
3153  }
3154 
3155  if (bComma)
3156  {
3157  pStr += wcslen(pStr);
3158  if (pTemp->Next)
3159  {
3160  pStr[0] = L',';
3161  pStr++;
3162  }
3163  }
3164  else
3165  {
3166  pStr += wcslen(pStr) + 1;
3167  }
3168  pTemp = pTemp->Next;
3169  }
3170  pStr[0] = L'\0';
3171  *Size = (dwSize+1) * sizeof(WCHAR);
3172  return pRet;
3173 }
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4460
Type
Definition: Type.h:6
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4463
ULONG IPADDR
Definition: rassapi.h:53
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4461
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4462
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
union tagIP_ADDR::@487 u
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
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 1143 of file tcpipconf_notify.c.

1144 {
1145  LVITEMW li;
1146 
1147  memset(&li, 0x0, sizeof(LVITEMW));
1148  li.iItem = GetSelectedItem(hDlgCtrl);
1149  if (li.iItem < 0)
1150  {
1152  SetFocus(hDlgCtrl);
1153  }
1154  else
1155  {
1156  (void)ListView_DeleteItem(hDlgCtrl, li.iItem);
1157  }
1158 }
#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:2383
#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:2383
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:36
static const WCHAR L[]
Definition: oid.c:1250

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

◆ EnableGwButtons()

static VOID EnableGwButtons ( HWND  hwndDlg)
static

Definition at line 684 of file tcpipconf_notify.c.

686 {
687  BOOL bEnable;
688 
690 
693 }
#define IDC_GWLIST
Definition: resource.h:38
#define IDC_GWMOD
Definition: resource.h:40
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
_In_ BOOL bEnable
Definition: winddi.h:3426
#define IDC_GWDEL
Definition: resource.h:41

Referenced by InitializeTcpipAdvancedIpDlg(), and TcpipAdvancedIpDlg().

◆ EnableIpButtons()

static VOID EnableIpButtons ( HWND  hwndDlg)
static

Definition at line 671 of file tcpipconf_notify.c.

673 {
674  BOOL bEnable;
675 
677 
680 }
#define IDC_IPDEL
Definition: resource.h:37
#define IDC_IPMOD
Definition: resource.h:36
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDC_IPLIST
Definition: resource.h:34
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
_In_ BOOL bEnable
Definition: winddi.h:3426

Referenced by InitializeTcpipAdvancedIpDlg(), and TcpipAdvancedIpDlg().

◆ FreeIPAddr()

VOID FreeIPAddr ( IP_ADDR pAddr)

Definition at line 1201 of file tcpipconf_notify.c.

1202 {
1203  IP_ADDR *pNext;
1204 
1205  if (!pAddr)
1206  return;
1207 
1208  while(pAddr)
1209  {
1210  pNext = pAddr->Next;
1211  CoTaskMemFree(pAddr);
1212  pAddr = pNext;
1213  }
1214 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
struct tagIP_ADDR * Next

Referenced by StoreDNSSettings(), and TcpipAdvancedIpDlg().

◆ GetGWListEntry()

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

Definition at line 868 of file tcpipconf_notify.c.

869 {
870  LVITEMW li;
871  WCHAR szBuffer[30];
872  BOOL bRet;
873 
874  ZeroMemory(&li, sizeof(LVITEMW));
875  li.mask = LVIF_TEXT;
876  li.cchTextMax = 16;
877  li.pszText = pGwSettings->szIP;
878  li.iItem = Index;
879 
880  if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
881  return FALSE;
882  li.pszText = szBuffer;
883  li.cchTextMax = 30;
884  li.iSubItem = 1;
885 
886  bRet = SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
887  if (bRet)
888  {
889  pGwSettings->Metric = _wtoi(szBuffer);
890  }
891 
892  return bRet;
893 }
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ZeroMemory
Definition: winbase.h:1635
#define LVIF_TEXT
Definition: commctrl.h:2281
int cchTextMax
Definition: commctrl.h:2338
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:2337
static const UCHAR Index[8]
Definition: usbohci.c:18
UINT mask
Definition: commctrl.h:2332
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2362

Referenced by TcpipAdvancedIpDlg().

◆ GetIpAddressFromStringA()

UINT GetIpAddressFromStringA ( char sBuffer)

Definition at line 1186 of file tcpipconf_notify.c.

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

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

1120 {
1121  LVITEMW li;
1122 
1123  ZeroMemory(&li, sizeof(LVITEMW));
1124  li.mask = LVIF_TEXT;
1125  li.cchTextMax = 16;
1126  li.pszText = pIpSettings->szIP;
1127  li.iItem = Index;
1128 
1129  if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1130  return FALSE;
1131 
1132  ZeroMemory(&li, sizeof(LVITEMW));
1133  li.mask = LVIF_TEXT;
1134  li.cchTextMax = 16;
1135  li.pszText = pIpSettings->szMask;
1136  li.iSubItem = 1;
1137  li.iItem = Index;
1138 
1139  return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1140 }
#define ZeroMemory
Definition: winbase.h:1635
#define LVIF_TEXT
Definition: commctrl.h:2281
int cchTextMax
Definition: commctrl.h:2338
LONG_PTR LPARAM
Definition: windef.h:208
LPWSTR pszText
Definition: commctrl.h:2337
static const UCHAR Index[8]
Definition: usbohci.c:18
UINT mask
Definition: commctrl.h:2332
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2362

Referenced by TcpipAdvancedIpDlg().

◆ GetListViewEntries()

LPWSTR GetListViewEntries ( HWND  hDlgCtrl)

Definition at line 1724 of file tcpipconf_notify.c.

1726 {
1727  DWORD dwSize;
1728  INT iCount, iIndex;
1729  INT_PTR lResult;
1730  LPWSTR pszSearchList, pItem;
1731 
1732  iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1733  if (!iCount || iCount == LB_ERR)
1734  return NULL; //BUGBUG
1735 
1736  dwSize = 0;
1737 
1738  for (iIndex = 0; iIndex < iCount; iIndex++)
1739  {
1740  lResult = SendMessageW(hDlgCtrl, LB_GETTEXTLEN, iIndex, 0);
1741  if (lResult == LB_ERR)
1742  return NULL;
1743 
1744  dwSize += lResult + 1;
1745  }
1746 
1747  pszSearchList = (LPWSTR)CoTaskMemAlloc((dwSize + 1) * sizeof(WCHAR));
1748  if (!pszSearchList)
1749  return NULL;
1750 
1751  pItem = pszSearchList;
1752  for (iIndex = 0; iIndex < iCount; iIndex++)
1753  {
1754  lResult = SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)pItem);
1755  if (lResult == LB_ERR)
1756  {
1757  CoTaskMemFree(pszSearchList);
1758  return NULL;
1759  }
1760  dwSize -= lResult + 1;
1761  pItem += wcslen(pItem);
1762  if (iIndex != iCount -1)
1763  {
1764  pItem[0] = L',';
1765  pItem++;
1766  }
1767  }
1768  pItem[0] = L'\0';
1769  return pszSearchList;
1770 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
int32_t INT_PTR
Definition: typedefs.h:62
int32_t INT
Definition: typedefs.h:56
#define LB_ERR
Definition: winuser.h:2386
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETTEXTLEN
Definition: winuser.h:2011
#define LB_GETCOUNT
Definition: winuser.h:1999
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LB_GETTEXT
Definition: winuser.h:2010
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:406
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 1217 of file tcpipconf_notify.c.

1218 {
1219  LVITEMW li;
1220 
1221  ZeroMemory(&li, sizeof(LVITEMW));
1222  li.mask = LVIF_TEXT;
1223  li.pszText = szBuffer;
1224  li.iItem = Index;
1225  li.iSubItem = SubIndex;
1226  li.cchTextMax = BufferSize;
1227  return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1228 }
#define ZeroMemory
Definition: winbase.h:1635
#define LVIF_TEXT
Definition: commctrl.h:2281
int cchTextMax
Definition: commctrl.h:2338
int iSubItem
Definition: commctrl.h:2334
LONG_PTR LPARAM
Definition: windef.h:208
LPWSTR pszText
Definition: commctrl.h:2337
static const UCHAR Index[8]
Definition: usbohci.c:18
#define BufferSize
Definition: classpnp.h:419
UINT mask
Definition: commctrl.h:2332
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LVM_GETITEMW
Definition: commctrl.h:2362

Referenced by StoreIPSettings().

◆ GetSelectedItem()

INT GetSelectedItem ( HWND  hDlgCtrl)

Definition at line 1093 of file tcpipconf_notify.c.

1094 {
1095  LVITEMW li;
1096  UINT iItemCount, iIndex;
1097 
1098  iItemCount = ListView_GetItemCount(hDlgCtrl);
1099  if (!iItemCount)
1100  return -1;
1101 
1102  for (iIndex = 0; iIndex < iItemCount; iIndex++)
1103  {
1104  ZeroMemory(&li, sizeof(LVITEMW));
1105  li.mask = LVIF_STATE;
1106  li.stateMask = (UINT)-1;
1107  li.iItem = iIndex;
1108  if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1109  {
1110  if (li.state & LVIS_SELECTED)
1111  return iIndex;
1112  }
1113  }
1114  return -1;
1115 }
#define ZeroMemory
Definition: winbase.h:1635
UINT stateMask
Definition: commctrl.h:2336
#define LVIS_SELECTED
Definition: commctrl.h:2291
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
UINT mask
Definition: commctrl.h:2332
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define LVM_GETITEMW
Definition: commctrl.h:2362
#define LVIF_STATE
Definition: commctrl.h:2284

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

3066 {
3068  return INetCfgComponentPropertyUi_AddRef((INetCfgComponentPropertyUi*)This);
3069 }
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 3416 of file tcpipconf_notify.c.

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

◆ INetCfgComponentControl_fnApplyRegistryChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges ( INetCfgComponentControl *  iface)

Definition at line 3178 of file tcpipconf_notify.c.

3180 {
3181  HKEY hKey;
3182  LPOLESTR pStr;
3183  DWORD dwSize;
3184  WCHAR szBuffer[200];
3185  TcpipSettings * pCurrentConfig, *pOldConfig;
3186  ULONG NTEInstance;
3187  DWORD DhcpApiVersion;
3188 
3190 
3191  pCurrentConfig = This->pCurrentConfig;
3192  This->pCurrentConfig = NULL;
3193 
3194  if (FAILED(Initialize(This)))
3195  {
3196  This->pCurrentConfig = pCurrentConfig;
3197  return E_FAIL;
3198  }
3199  pOldConfig = This->pCurrentConfig;
3200  This->pCurrentConfig = pCurrentConfig;
3201 
3202  //MessageBoxW(NULL, L"INetCfgComponentControl_fnApplyRegistryChanges", NULL, MB_OK);
3203 
3204 
3205  if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3206  {
3207  if (pCurrentConfig->pDNS)
3208  {
3209  RegSetValueExW(hKey, L"UseDomainNameDevolution", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->pDNS->UseDomainNameDevolution, sizeof(DWORD));
3210  RegSetValueExW(hKey, L"SearchList", 0, REG_SZ, (LPBYTE)pCurrentConfig->pDNS->szSearchList,
3211  (wcslen(pCurrentConfig->pDNS->szSearchList)+1) * sizeof(WCHAR));
3212  }
3213  if (pCurrentConfig->pFilter)
3214  {
3215  RegSetValueExW(hKey, L"EnableSecurityFilters", 0, REG_DWORD,
3216  (LPBYTE)&pCurrentConfig->pFilter->EnableSecurityFilters, sizeof(DWORD));
3217  }
3218  RegCloseKey(hKey);
3219  }
3220 
3221  if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
3222  return E_FAIL;
3223 
3224  swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
3225  CoTaskMemFree(pStr);
3226 
3227  if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
3228  {
3229  if (pCurrentConfig->pDNS)
3230  {
3231  RegSetValueExW(hKey, L"RegisterAdapterName", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, sizeof(DWORD));
3232  RegSetValueExW(hKey, L"RegistrationEnabled", 0, REG_DWORD, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, sizeof(DWORD));
3233  RegSetValueExW(hKey, L"Domain", 0, REG_SZ, (LPBYTE)This->pCurrentConfig->pDNS->szDomain,
3234  (wcslen(This->pCurrentConfig->pDNS->szDomain)+1) * sizeof(WCHAR));
3235  }
3236 #if 0
3237  if (pCurrentConfig->pFilter)
3238  {
3239  if (pCurrentConfig->pFilter->szTCPAllowedPorts)
3240  {
3241  RegSetValueExW(hKey, L"TCPAllowedPorts", 0, REG_MULTI_SZ,
3242  (LPBYTE)pCurrentConfig->pFilter->szTCPAllowedPorts,
3243  pCurrentConfig->pFilter->TCPSize);
3244  }
3245  if (pCurrentConfig->pFilter->szUDPAllowedPorts)
3246  {
3247  RegSetValueExW(hKey, L"UDPAllowedPorts", 0, REG_MULTI_SZ,
3248  (LPBYTE)pCurrentConfig->pFilter->szUDPAllowedPorts,
3249  pCurrentConfig->pFilter->UDPSize);
3250  }
3251  if (pCurrentConfig->pFilter->szRawIPAllowedProtocols)
3252  {
3253  RegSetValueExW(hKey, L"RawIPAllowedProtocols", 0, REG_MULTI_SZ,
3254  (LPBYTE)pCurrentConfig->pFilter->szRawIPAllowedProtocols,
3255  pCurrentConfig->pFilter->IPSize);
3256  }
3257  }
3258 #endif
3259  RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (LPBYTE)&pCurrentConfig->DhcpEnabled, sizeof(DWORD));
3260  if (pCurrentConfig->DhcpEnabled)
3261  {
3262  RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3263  RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
3264  RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"\0", 2 * sizeof(WCHAR));
3265  RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", 2 * sizeof(WCHAR));
3266  if (!pOldConfig->DhcpEnabled)
3267  {
3268  /* Delete this adapter's current IP address */
3269  DeleteIPAddress(pOldConfig->Ip->NTEContext);
3270 
3271  /* Delete all default routes for this adapter */
3272  dwSize = 0;
3274  {
3275  DWORD Index;
3277  if (pIpForwardTable)
3278  {
3279  if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3280  {
3281  for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3282  {
3283  if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3284  pIpForwardTable->table[Index].dwForwardDest == 0)
3285  {
3286  DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3287  }
3288  }
3289  }
3290  CoTaskMemFree(pIpForwardTable);
3291  }
3292  }
3293  }
3294  }
3295  else
3296  {
3297  /* Open the DHCP API if DHCP is enabled */
3298  if (pOldConfig->DhcpEnabled && DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR)
3299  {
3300  /* We have to tell DHCP about this */
3301  DhcpStaticRefreshParams(pCurrentConfig->Index,
3302  htonl(pCurrentConfig->Ip->IpAddress),
3303  htonl(pCurrentConfig->Ip->u.Subnetmask));
3304 
3305  /* Close the API */
3306  DhcpCApiCleanup();
3307  }
3308  else
3309  {
3310  /* Delete this adapter's current static IP address */
3311  DeleteIPAddress(pOldConfig->Ip->NTEContext);
3312 
3313  /* Add the static IP address via the standard IPHLPAPI function */
3314  AddIPAddress(htonl(pCurrentConfig->Ip->IpAddress),
3315  htonl(pCurrentConfig->Ip->u.Subnetmask),
3316  pCurrentConfig->Index,
3317  &pCurrentConfig->Ip->NTEContext,
3318  &NTEInstance);
3319  }
3320 
3321  pStr = CreateMultiSzString(pCurrentConfig->Ip, IPADDR, &dwSize, FALSE);
3322  if(pStr)
3323  {
3324  RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3325  CoTaskMemFree(pStr);
3326  }
3327 
3328  pStr = CreateMultiSzString(pCurrentConfig->Ip, SUBMASK, &dwSize, FALSE);
3329  if(pStr)
3330  {
3331  RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3332  CoTaskMemFree(pStr);
3333  }
3334 
3335  /* Delete all default routes for this adapter */
3336  dwSize = 0;
3338  {
3339  DWORD Index;
3341  if (pIpForwardTable)
3342  {
3343  if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
3344  {
3345  for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
3346  {
3347  if (pIpForwardTable->table[Index].dwForwardIfIndex == pOldConfig->Index &&
3348  pIpForwardTable->table[Index].dwForwardDest == 0)
3349  {
3350  DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
3351  }
3352  }
3353  }
3354  CoTaskMemFree(pIpForwardTable);
3355  }
3356  }
3357 
3358  if (pCurrentConfig->Gw)
3359  {
3360  MIB_IPFORWARDROW RouterMib;
3361  ZeroMemory(&RouterMib, sizeof(MIB_IPFORWARDROW));
3362 
3363  RouterMib.dwForwardMetric1 = 1;
3364  RouterMib.dwForwardIfIndex = pOldConfig->Index;
3365  RouterMib.dwForwardNextHop = htonl(pCurrentConfig->Gw->IpAddress);
3366 
3367  //TODO
3368  // add multiple gw addresses when required
3369 
3370  if (CreateIpForwardEntry(&RouterMib) == NO_ERROR)
3371  {
3372  pStr = CreateMultiSzString(pCurrentConfig->Gw, IPADDR, &dwSize, FALSE);
3373  if(pStr)
3374  {
3375  RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3376  CoTaskMemFree(pStr);
3377  }
3378 
3379  pStr = CreateMultiSzString(pCurrentConfig->Gw, METRIC, &dwSize, FALSE);
3380  if(pStr)
3381  {
3382  RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
3383  CoTaskMemFree(pStr);
3384  }
3385  }
3386  }
3387  else
3388  {
3389  RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"", 1 * sizeof(WCHAR));
3390  RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", sizeof(WCHAR) * 2);
3391  }
3392  }
3393 
3394  if (!pCurrentConfig->Ns || pCurrentConfig->AutoconfigActive)
3395  {
3396  RegDeleteValueW(hKey, L"NameServer");
3397  }
3398  else
3399  {
3400  pStr = CreateMultiSzString(pCurrentConfig->Ns, IPADDR, &dwSize, TRUE);
3401  if(pStr)
3402  {
3403  RegSetValueExW(hKey, L"NameServer", 0, REG_SZ, (LPBYTE)pStr, dwSize);
3404  //RegDeleteValueW(hKey, L"DhcpNameServer");
3405  CoTaskMemFree(pStr);
3406  }
3407  }
3408 
3409  RegCloseKey(hKey);
3410  }
3411  return S_OK;
3412 }
DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute)
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#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:1635
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:1094
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:4917
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:2368
LPWSTR szRawIPAllowedProtocols
unsigned int ULONG
Definition: retypes.h:1
DWORD dwForwardMetric1
Definition: ipmib.h:88
#define REG_DWORD
Definition: sdbapi.c:596
union tagIP_ADDR::@487 u
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
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:2321
#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 3426 of file tcpipconf_notify.c.

3428 {
3429  //MessageBoxW(NULL, L"INetCfgComponentControl_fnCancelChanges", NULL, MB_OK);
3430  return S_OK;
3431 }
#define S_OK
Definition: intsafe.h:59

◆ INetCfgComponentControl_fnInitialize()

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

Definition at line 3082 of file tcpipconf_notify.c.

3087 {
3089 
3090  This->pNCfg = pINetCfg;
3091  This->pNComp = pIComp;
3092 
3093  return S_OK;
3094 }
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 3053 of file tcpipconf_notify.c.

3057 {
3059  return INetCfgComponentPropertyUi_QueryInterface((INetCfgComponentPropertyUi*)This, iid, ppvObj);
3060 }
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 3073 of file tcpipconf_notify.c.

3075 {
3077  return INetCfgComponentPropertyUi_Release((INetCfgComponentPropertyUi*)This);
3078 }
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 2642 of file tcpipconf_notify.c.

2644 {
2646  ULONG refCount = InterlockedIncrement(&This->ref);
2647 
2648  return refCount;
2649 }
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ INetCfgComponentPropertyUi_fnApplyProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3017 of file tcpipconf_notify.c.

3019 {
3020 MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnApplyProperties", NULL, MB_OK);
3021  return S_OK;
3022 }
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 3027 of file tcpipconf_notify.c.

3029 {
3030 //MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnCancelProperties", NULL, MB_OK);
3031  return S_OK;
3032 }
#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 2956 of file tcpipconf_notify.c.

2963 {
2964  HPROPSHEETPAGE * hppages;
2965  UINT NumPages;
2966  HRESULT hr;
2968 
2969  hr = Initialize(This);
2970  if (FAILED(hr))
2971  return hr;
2972 
2973  if (This->pCurrentConfig->DhcpEnabled)
2974  NumPages = 2;
2975  else
2976  NumPages = 1;
2977 
2978  hppages = (HPROPSHEETPAGE*) CoTaskMemAlloc(sizeof(HPROPSHEETPAGE) * NumPages);
2979  if (!hppages)
2980  return E_FAIL;
2981 
2983  if (!hppages[0])
2984  {
2985  CoTaskMemFree(hppages);
2986  return E_FAIL;
2987  }
2988  if (NumPages == 2)
2989  {
2991  if (!hppages[1])
2992  {
2993  DestroyPropertySheetPage(hppages[0]);
2994  CoTaskMemFree(hppages);
2995  return E_FAIL;
2996  }
2997  }
2998 
2999  *pahpspPrivate = (BYTE*)hppages;
3000  *pcPages = NumPages;
3001 
3002  return S_OK;
3003 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3135
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:406
#define IDD_TCPIP_ALTCF_DLG
Definition: resource.h:9

◆ INetCfgComponentPropertyUi_fnQueryInterface()

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

Definition at line 2607 of file tcpipconf_notify.c.

2611 {
2612  //LPOLESTR pStr;
2614 
2615  *ppvObj = NULL;
2616 
2617 
2618  if (IsEqualIID (iid, &IID_IUnknown) ||
2620  {
2621  *ppvObj = This;
2623  return S_OK;
2624  }
2625  else if (IsEqualIID(iid, &IID_INetCfgComponentControl))
2626  {
2627  *ppvObj = (LPVOID*)&This->lpVtblCompControl;
2629  return S_OK;
2630  }
2631 
2632  //StringFromCLSID(iid, &pStr);
2633  //MessageBoxW(NULL, pStr, L"INetConnectionPropertyUi_fnQueryInterface", MB_OK);
2634  //CoTaskMemFree(pStr);
2635 
2636  return E_NOINTERFACE;
2637 }
#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:90

◆ INetCfgComponentPropertyUi_fnQueryPropertyUi()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 2668 of file tcpipconf_notify.c.

2671 {
2672  INetLanConnectionUiInfo * pLanInfo;
2673  HRESULT hr;
2675 
2676  hr = IUnknown_QueryInterface(pUnkReserved, &IID_INetLanConnectionUiInfo, (LPVOID*)&pLanInfo);
2677  if (FAILED(hr))
2678  return hr;
2679 
2680  INetLanConnectionUiInfo_GetDeviceGuid(pLanInfo, &This->NetCfgInstanceId);
2681 
2682  //FIXME
2683  // check if tcpip is enabled on that binding */
2684  IUnknown_Release(pUnkReserved);
2685  return S_OK;
2686 }
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 2653 of file tcpipconf_notify.c.

2655 {
2657  ULONG refCount = InterlockedDecrement(&This->ref);
2658 
2659  if (!refCount)
2660  {
2662  }
2663  return refCount;
2664 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#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 2690 of file tcpipconf_notify.c.

2693 {
2695 
2696  if (!iface || !pUnkReserved)
2697  return E_POINTER;
2698 
2699  This->pUnknown = pUnkReserved;
2700  return S_OK;
2701 }
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 3007 of file tcpipconf_notify.c.

3010 {
3011 MessageBoxW(NULL, L"INetCfgComponentPropertyUi_fnValidateProperties", NULL, MB_OK);
3012  return S_OK;
3013 }
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:2281
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:1882
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LPWSTR pszText
Definition: commctrl.h:2337
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT mask
Definition: commctrl.h:2332
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LVM_INSERTITEMW
Definition: commctrl.h:2376
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 2829 of file tcpipconf_notify.c.

2830 {
2831  DWORD dwSize, Status;
2832  WCHAR szBuffer[50];
2833  IP_ADAPTER_INFO * pCurrentAdapter;
2834  IP_ADAPTER_INFO * pInfo;
2835  PIP_PER_ADAPTER_INFO pPerInfo;
2837  LPOLESTR pStr;
2838  HRESULT hr;
2839  BOOL bFound;
2840  TcpipSettings * pCurSettings;
2841  ULONG uLength;
2842 
2843  if (This->pCurrentConfig)
2844  return S_OK;
2845 
2846  hr = StringFromCLSID(&This->NetCfgInstanceId, &pStr);
2847  if (FAILED(hr))
2848  return hr;
2849 
2850 
2851  dwSize = 0;
2853  {
2854  CoTaskMemFree(pStr);
2855  return E_FAIL;
2856  }
2857 
2858  pInfo = CoTaskMemAlloc(dwSize);
2859  if (!pInfo)
2860  {
2861  CoTaskMemFree(pStr);
2862  return E_FAIL;
2863  }
2864 
2865  if (GetAdaptersInfo(pInfo, &dwSize) != ERROR_SUCCESS)
2866  {
2867  CoTaskMemFree(pStr);
2868  CoTaskMemFree(pInfo);
2869  return E_FAIL;
2870  }
2871 
2872  pCurrentAdapter = pInfo;
2873  bFound = FALSE;
2874  while(pCurrentAdapter)
2875  {
2876  szBuffer[0] = L'\0';
2877  if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
2878  {
2879  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2880  }
2881  if (!_wcsicmp(szBuffer, pStr))
2882  {
2883  bFound = TRUE;
2884  break;
2885  }
2886  pCurrentAdapter = pCurrentAdapter->Next;
2887  }
2888  CoTaskMemFree(pStr);
2889 
2890  if (!bFound)
2891  {
2892  CoTaskMemFree(pInfo);
2893  return E_FAIL;
2894  }
2895 
2896  pCurSettings = CoTaskMemAlloc(sizeof(TcpipSettings));
2897  if (!pCurSettings)
2898  {
2899  CoTaskMemFree(pInfo);
2900  return E_FAIL;
2901  }
2902 
2903  ZeroMemory(pCurSettings, sizeof(TcpipSettings));
2904  This->pCurrentConfig = pCurSettings;
2905  pCurSettings->DhcpEnabled = pCurrentAdapter->DhcpEnabled;
2906  pCurSettings->Index = pCurrentAdapter->Index;
2907 
2908  if (!pCurrentAdapter->DhcpEnabled)
2909  {
2910  CopyIpAddrString(&pCurrentAdapter->IpAddressList, &pCurSettings->Ip, SUBMASK, NULL);
2911  CopyIpAddrString(&pCurrentAdapter->GatewayList, &pCurSettings->Gw, METRIC, NULL); //FIXME
2912  }
2913 
2914  uLength = sizeof(IP_PER_ADAPTER_INFO);
2915  ZeroMemory(&Info, sizeof(IP_PER_ADAPTER_INFO));
2916 
2917  if (GetPerAdapterInfo(pCurrentAdapter->Index, &Info, &uLength) == ERROR_BUFFER_OVERFLOW)
2918  {
2919  pPerInfo = (PIP_PER_ADAPTER_INFO)CoTaskMemAlloc(uLength);
2920  if (pPerInfo)
2921  {
2922  Status = GetPerAdapterInfo(pCurrentAdapter->Index, pPerInfo, &uLength);
2923  if (Status == NOERROR)
2924  {
2925  if (!pPerInfo->AutoconfigActive)
2926  {
2927  CopyIpAddrString(&pPerInfo->DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
2928  }
2929  pCurSettings->AutoconfigActive = pPerInfo->AutoconfigActive;
2930  }
2931  CoTaskMemFree(pPerInfo);
2932  }
2933  }
2934  else
2935  {
2936  if (!Info.AutoconfigActive)
2937  {
2938  CopyIpAddrString(&Info.DnsServerList, &pCurSettings->Ns, IPADDR, NULL);
2939  }
2940  pCurSettings->AutoconfigActive = Info.AutoconfigActive;
2941  }
2942 
2944  return E_FAIL;
2945 
2946  if (FAILED(LoadDNSSettings(This)))
2947  return E_FAIL;
2948 
2949  CoTaskMemFree(pInfo);
2950 
2951  return S_OK;
2952 }
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#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:1635
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:406
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:2321

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:3066
#define PSP_DEFAULT
Definition: prsht.h:22
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:36
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 1575 of file tcpipconf_notify.c.

1578 {
1579  WCHAR szBuffer[200];
1580  LPWSTR pFirst, pSep, pList;
1581  IP_ADDR * pAddr;
1582  DWORD dwIpAddr;
1583 
1584  /* insert DNS addresses */
1585  pAddr = This->pCurrentConfig->Ns;
1586  while(pAddr)
1587  {
1588  dwIpAddr = pAddr->IpAddress;
1589  swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1590  FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1591 
1592  SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_ADDSTRING, 0, (LPARAM)szBuffer);
1593  pAddr = pAddr->Next;
1594  }
1596 
1597  if (!This->pCurrentConfig->pDNS)
1598  return;
1599 
1600  if (This->pCurrentConfig->pDNS->RegisterAdapterName)
1602  else
1604 
1605  if (This->pCurrentConfig->pDNS->RegistrationEnabled)
1607 
1608  if (This->pCurrentConfig->pDNS->szDomain[0])
1609  SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)szBuffer);
1610 
1611  if (This->pCurrentConfig->pDNS->UseDomainNameDevolution)
1613 
1614  if (!This->pCurrentConfig->pDNS->szSearchList || (wcslen(This->pCurrentConfig->pDNS->szSearchList) == 0))
1615  {
1618 
1619  return;
1620  }
1621 
1622  pList = This->pCurrentConfig->pDNS->szSearchList;
1623  if (wcslen(pList))
1624  {
1625  pFirst = pList;
1626  do
1627  {
1628  pSep = wcschr(pFirst, L',');
1629  if (pSep)
1630  {
1631  pSep[0] = L'\0';
1633  pFirst = pSep + 1;
1634  pSep[0] = L',';
1635  }
1636  else
1637  {
1639  break;
1640  }
1641  }while(TRUE);
1642 
1646  }
1647 }
#define LB_SETCURSEL
Definition: winuser.h:2024
#define TRUE
Definition: types.h:120
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4460
#define IDC_DNSADDRLIST
Definition: resource.h:48
#define LB_ADDSTRING
Definition: winuser.h:1992
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4463
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:55
#define IDC_REGSUFFIX
Definition: resource.h:64
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4461
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4462
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:1882
_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 696 of file tcpipconf_notify.c.

699 {
700 
701  RECT rect;
702  LVITEMW li;
703  WCHAR szBuffer[100];
704 
707  InsertColumnToListView(GetDlgItem(hwndDlg, IDC_IPLIST), IDS_SUBMASK, 1, (rect.right - rect.left - 100));
708 
709  if (This->pCurrentConfig->DhcpEnabled)
710  {
711  if (LoadStringW(netcfgx_hInstance, IDS_DHCPACTIVE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
712  {
713  ZeroMemory(&li, sizeof(LVITEMW));
714  li.mask = LVIF_TEXT;
715  li.pszText = szBuffer;
717  }
721  }
722  else
723  {
724  InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_IPLIST), This->pCurrentConfig->Ip, TRUE);
725  EnableIpButtons(hwndDlg);
726  }
727 
730  InsertColumnToListView(GetDlgItem(hwndDlg, IDC_GWLIST), IDS_METRIC, 1, (rect.right - rect.left - 100));
731 
732  InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_GWLIST), This->pCurrentConfig->Gw, FALSE);
733  EnableGwButtons(hwndDlg);
734 
736 
737 }
#define EM_LIMITTEXT
Definition: winuser.h:1961
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:1635
#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:2281
#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)
static VOID EnableIpButtons(HWND hwndDlg)
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static VOID EnableGwButtons(HWND hwndDlg)
LPWSTR pszText
Definition: commctrl.h:2337
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT mask
Definition: commctrl.h:2332
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVM_INSERTITEMW
Definition: commctrl.h:2376
#define IDC_METRIC
Definition: resource.h:43
#define IDC_IPADD
Definition: resource.h:35
#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:2024
#define IDS_TCPFILTER
Definition: resource.h:102
#define LB_ADDSTRING
Definition: winuser.h:1992
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:2386
#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 2334 of file tcpipconf_notify.c.

2337 {
2338  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 0, MAKEIPRANGE(1, 223));
2339  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 1, MAKEIPRANGE(0, 255));
2340  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 2, MAKEIPRANGE(0, 255));
2341  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_SETRANGE, 3, MAKEIPRANGE(0, 255));
2342 
2347 
2352 
2353  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 0, MAKEIPRANGE(1, 223));
2354  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 1, MAKEIPRANGE(0, 255));
2355  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 2, MAKEIPRANGE(0, 255));
2356  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETRANGE, 3, MAKEIPRANGE(0, 255));
2357 
2358  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 0, MAKEIPRANGE(1, 223));
2359  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 1, MAKEIPRANGE(0, 255));
2360  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 2, MAKEIPRANGE(0, 255));
2361  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETRANGE, 3, MAKEIPRANGE(0, 255));
2362 
2363  if (pCurSettings->DhcpEnabled)
2364  {
2370  }
2371  else
2372  {
2374 
2375  if (pCurSettings->Ip)
2376  {
2377  /* set current ip address */
2378  SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->IpAddress);
2379  /* set current hostmask */
2380  SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ip->u.Subnetmask);
2381  }
2382  if (pCurSettings->Gw && pCurSettings->Gw->IpAddress)
2383  {
2384  /* set current gateway */
2385  SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Gw->IpAddress);
2386  }
2387  }
2388  if (pCurSettings->AutoconfigActive)
2389  {
2391  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), FALSE);
2392  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), FALSE);
2393  }
2394  else
2395  {
2397  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS1), TRUE);
2398  EnableWindow(GetDlgItem(hwndDlg, IDC_DNS2), TRUE);
2399  if (pCurSettings->Ns)
2400  {
2401  SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->IpAddress);
2402  if (pCurSettings->Ns->Next)
2403  {
2404  SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)pCurSettings->Ns->Next->IpAddress);
2405  }
2406  else
2407  {
2409  }
2410  }
2411  else
2412  {
2415  }
2416  }
2417 
2418  return S_OK;
2419 }
#define IDC_IPADDR
Definition: resource.h:25
#define TRUE
Definition: types.h:120
#define IDC_DEFGATEWAY
Definition: resource.h:27
#define IDC_NODHCP
Definition: resource.h:24
#define IDC_USEDHCP
Definition: resource.h:23
#define IPM_SETADDRESS
Definition: commctrl.h:4438
#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:1882
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:4440
#define IPM_CLEARADDRESS
Definition: commctrl.h:4437
#define BST_CHECKED
Definition: winuser.h:197
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4456
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
union tagIP_ADDR::@487 u

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:2559
#define LVCF_TEXT
Definition: commctrl.h:2560
#define LV_COLUMN
Definition: commctrl.h:2519
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:2561
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2604
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:2539
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
int cchTextMax
Definition: commctrl.h:2540
#define LVCF_FMT
Definition: commctrl.h:2558
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 }
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4460
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4463
#define ZeroMemory
Definition: winbase.h:1635
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:4461
#define LVIF_TEXT
Definition: commctrl.h:2281
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4462
int iSubItem
Definition: commctrl.h:2334
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:2337
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
UINT mask
Definition: commctrl.h:2332
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:2376
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
unsigned int UINT
Definition: ndis.h:50
#define LVM_SETITEMW
Definition: commctrl.h:2369
union tagIP_ADDR::@487 u

Referenced by InitializeTcpipAdvancedIpDlg().

◆ LaunchAdvancedTcpipSettings()

VOID LaunchAdvancedTcpipSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2111 of file tcpipconf_notify.c.

2114 {
2115  PROPSHEETHEADERW pinfo;
2116  HPROPSHEETPAGE hppages[3];
2117  WCHAR szBuffer[100];
2118 
2122 
2123 
2124  if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
2125  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2126  else
2127  szBuffer[0] = L'\0';
2128 
2129  ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
2130  pinfo.dwSize = sizeof(PROPSHEETHEADERW);
2131  pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
2133  pinfo.u3.phpage = hppages;
2134  pinfo.nPages = 3;
2135  pinfo.hwndParent = hwndDlg;
2136  pinfo.hInstance = netcfgx_hInstance;
2137  pinfo.pszCaption = szBuffer;
2139  pinfo.pfnCallback = PropSheetProc;
2140 
2141  StoreTcpipBasicSettings(hwndDlg, This, FALSE);
2142  PropertySheetW(&pinfo);
2143 
2144  InitializeTcpipBasicDlgCtrls(hwndDlg, This->pCurrentConfig);
2145  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2146 }
#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:1635
#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:2896
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 2704 of file tcpipconf_notify.c.

2706 {
2707  LPOLESTR pStr;
2708  WCHAR szBuffer[200];
2709  HKEY hKey;
2710  DWORD dwSize;
2711 
2712 
2713  This->pCurrentConfig->pDNS = (TcpipAdvancedDNSDlgSettings*) CoTaskMemAlloc(sizeof(TcpipAdvancedDNSDlgSettings));
2714  if (!This->pCurrentConfig->pDNS)
2715  return E_FAIL;
2716 
2717  ZeroMemory(This->pCurrentConfig->pDNS, sizeof(TcpipAdvancedDNSDlgSettings));
2718 
2719  if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2720  return E_FAIL;
2721 
2722  swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2723  CoTaskMemFree(pStr);
2724  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2725  {
2726  dwSize = sizeof(DWORD);
2727  RegQueryValueExW(hKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegisterAdapterName, &dwSize);
2728  RegQueryValueExW(hKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->RegistrationEnabled, &dwSize);
2729 
2730  dwSize = sizeof(This->pCurrentConfig->pDNS->szDomain);
2731  RegQueryValueExW(hKey, L"Domain", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szDomain, &dwSize);
2732 
2733  RegCloseKey(hKey);
2734  }
2735 
2736  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2737  {
2738  dwSize = sizeof(DWORD);
2739  RegQueryValueExW(hKey, L"UseDomainNameDevolution", NULL, NULL, (LPBYTE)&This->pCurrentConfig->pDNS->UseDomainNameDevolution, &dwSize);
2740 
2741  dwSize = 0;
2742  if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, NULL, &dwSize) == ERROR_SUCCESS)
2743  {
2744  This->pCurrentConfig->pDNS->szSearchList = (LPWSTR)CoTaskMemAlloc(dwSize);
2745  if (This->pCurrentConfig->pDNS->szSearchList)
2746  {
2747  if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, (LPBYTE)This->pCurrentConfig->pDNS->szSearchList, &dwSize) != ERROR_SUCCESS)
2748  {
2749  CoTaskMemFree(This->pCurrentConfig->pDNS->szSearchList);
2750  This->pCurrentConfig->pDNS->szSearchList = NULL;
2751  }
2752  }
2753  }
2754  RegCloseKey(hKey);
2755  }
2756  return S_OK;
2757 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define ZeroMemory
Definition: winbase.h:1635
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:4134
__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:3381
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
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:2321

Referenced by Initialize().

◆ LoadFilterSettings()

HRESULT LoadFilterSettings ( TcpipConfNotifyImpl This)

Definition at line 2782 of file tcpipconf_notify.c.

2784 {
2785  HKEY hKey;
2786  TcpFilterSettings *pFilter;
2787  WCHAR szBuffer[200];
2788  LPOLESTR pStr;
2789  DWORD dwVal, dwSize;
2790 
2791  pFilter = (TcpFilterSettings*)CoTaskMemAlloc(sizeof(TcpFilterSettings));
2792  if (!pFilter)
2793  return E_FAIL;
2794 
2795  ZeroMemory(pFilter, sizeof(TcpFilterSettings));
2796  This->pCurrentConfig->pFilter = pFilter;
2797 
2798 
2799  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
2800  {
2801  dwSize = sizeof(DWORD);
2802  if (RegQueryValueExW(hKey, L"EnableSecurityFilters", NULL, NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
2803  pFilter->EnableSecurityFilters = dwVal;
2804  RegCloseKey(hKey);
2805  }
2806  else
2807  {
2808  pFilter->EnableSecurityFilters = FALSE;
2809  }
2810 
2811  if (FAILED(StringFromCLSID(&This->NetCfgInstanceId, &pStr)))
2812  return E_FAIL;
2813 
2814  swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pStr);
2815  CoTaskMemFree(pStr);
2816  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
2817  {
2818  return S_OK;
2819  }
2820  pFilter->szTCPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"TCPAllowedPorts", &pFilter->TCPSize);
2821  pFilter->szUDPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hKey, L"UDPAllowedPorts", &pFilter->UDPSize);
2822  pFilter->szRawIPAllowedProtocols = LoadTcpFilterSettingsFromRegistry(hKey, L"RawIPAllowedProtocols", &pFilter->IPSize);
2823  RegCloseKey(hKey);
2824  return S_OK;
2825 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define ZeroMemory
Definition: winbase.h:1635
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:4134
__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:3381
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
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:2321

Referenced by Initialize().

◆ LoadTcpFilterSettingsFromRegistry()

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

Definition at line 2760 of file tcpipconf_notify.c.

2761 {
2762  DWORD dwSize;
2763  LPWSTR pData;
2764 
2766  return NULL;
2767 
2769  if (!pData)
2770  return NULL;
2771 
2773  {
2775  return NULL;
2776  }
2777  *Size = dwSize;
2778  return pData;
2779 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#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:4134
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:406
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by LoadFilterSettings().

◆ MoveItem()

VOID MoveItem ( HWND  hDlgCtrl,
INT  pos 
)

Definition at line 1684 of file tcpipconf_notify.c.

1687 {
1688  WCHAR szBuffer[100];
1689  LRESULT lResult;
1690 
1691  lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1692  if (lResult != LB_ERR)
1693  {
1694  if (SendMessageW(hDlgCtrl, LB_GETTEXTLEN, (WPARAM)lResult, 0) < sizeof(szBuffer)/sizeof(WCHAR) - 1)
1695  {
1696  if (SendMessageW(hDlgCtrl, LB_GETTEXT, (WPARAM)lResult, (LPARAM)szBuffer) != LB_ERR)
1697  {
1698  SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1699  SendMessageW(hDlgCtrl, LB_INSERTSTRING, (WPARAM)lResult + pos, (LPARAM)szBuffer);
1700  SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult + pos, 0);
1701  }
1702  }
1703  }
1704 }
#define LB_SETCURSEL
Definition: winuser.h:2024
UINT_PTR WPARAM
Definition: windef.h:207
#define LB_ERR
Definition: winuser.h:2386
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETTEXTLEN
Definition: winuser.h:2011
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LB_GETTEXT
Definition: winuser.h:2010
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2000
LONG_PTR LRESULT
Definition: windef.h:209
#define LB_DELETESTRING
Definition: winuser.h:1993
#define LB_INSERTSTRING
Definition: winuser.h:2014

Referenced by TcpipAdvancedDnsDlg().

◆ PropSheetProc()

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

Definition at line 2094 of file tcpipconf_notify.c.

2095 {
2096  // NOTE: This callback is needed to set large icon correctly.
2097  HICON hIcon;
2098  switch (uMsg)
2099  {
2100  case PSCB_INITIALIZED:
2101  {
2103  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
2104  break;
2105  }
2106  }
2107  return 0;
2108 }
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 1706 of file tcpipconf_notify.c.

1708 {
1709  LRESULT lResult, lCount;
1710 
1711  lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
1712  if (lResult != LB_ERR)
1713  {
1714  SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
1715  lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1716  if (lResult + 1 < lCount)
1717  SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult, 0);
1718  else
1719  SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lCount-1, 0);
1720  }
1721 }
#define LB_SETCURSEL
Definition: winuser.h:2024
UINT_PTR WPARAM
Definition: windef.h:207
#define LB_ERR
Definition: winuser.h:2386
#define LB_GETCOUNT
Definition: winuser.h:1999
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define LB_GETCURSEL
Definition: winuser.h:2000
LONG_PTR LRESULT
Definition: windef.h:209
#define LB_DELETESTRING
Definition: winuser.h:1993

Referenced by TcpipAdvancedDnsDlg().

◆ StoreDNSSettings()

VOID StoreDNSSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This 
)

Definition at line 1773 of file tcpipconf_notify.c.

1776 {
1777  INT iCount, iIndex;
1778  WCHAR Ip[16];
1779  IP_ADDR *pCur, *pLast;
1780 
1781  FreeIPAddr(This->pCurrentConfig->Ns);
1782  This->pCurrentConfig->Ns = NULL;
1783 
1784  iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
1785  if (!iCount || iCount == LB_ERR)
1786  {
1787  return;
1788  }
1789 
1790  pLast = NULL;
1791  for(iIndex = 0; iIndex < iCount; iIndex++)
1792  {
1793  if (SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)Ip) == LB_ERR)
1794  break;
1795 
1796  pCur = CoTaskMemAlloc(sizeof(IP_ADDR));
1797  if (!pCur)
1798  break;
1799  ZeroMemory(pCur, sizeof(IP_ADDR));
1800  pCur->IpAddress = GetIpAddressFromStringW(Ip);
1801 
1802  if (!pLast)
1803  This->pCurrentConfig->Ns = pCur;
1804  else
1805  pLast->Next = pCur;
1806 
1807  pLast = pCur;
1808  pCur = pCur->Next;
1809  }
1810  This->pCurrentConfig->AutoconfigActive = FALSE;
1811 }
UINT GetIpAddressFromStringW(WCHAR *szBuffer)
#define ZeroMemory
Definition: winbase.h:1635
int32_t INT
Definition: typedefs.h:56
#define LB_ERR
Definition: winuser.h:2386
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define LB_GETCOUNT
Definition: winuser.h:1999
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LB_GETTEXT
Definition: winuser.h:2010
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:406

Referenced by TcpipAdvancedDnsDlg().

◆ StoreIPSettings()

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

Definition at line 1231 of file tcpipconf_notify.c.

1235 {
1236  WCHAR szBuffer[30];
1237 
1238  INT iIndex, iCount;
1239  IP_ADDR *pCur, *pLast;
1240 
1241  iCount = ListView_GetItemCount(hDlgCtrl);
1242  if (!iCount)
1243  {
1244  return;
1245  }
1246 
1247  pLast = NULL;
1248  for(iIndex = 0; iIndex < iCount; iIndex++)
1249  {
1250  if (GetListViewItem(hDlgCtrl, iIndex, 0, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1251  {
1252  pCur = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
1253  if (!pCur)
1254  break;
1255  ZeroMemory(pCur, sizeof(IP_ADDR));
1256 
1257  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1258  pCur->IpAddress = GetIpAddressFromStringW(szBuffer);
1259 
1260  if (GetListViewItem(hDlgCtrl, iIndex, 1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR) ))
1261  {
1262  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1263  if (bSubmask)
1264  pCur->u.Subnetmask = GetIpAddressFromStringW(szBuffer);
1265  else
1266  pCur->u.Metric = _wtoi(szBuffer);
1267  }
1268 
1269  if (!pLast)
1270  {
1271  if (bSubmask)
1272  This->pCurrentConfig->Ip = pCur;
1273  else
1274  This->pCurrentConfig->Gw = pCur;
1275  }
1276  else
1277  {
1278  pLast->Next = pCur;
1279  }
1280 
1281  pLast = pCur;
1282  }
1283  }
1284 }
UINT GetIpAddressFromStringW(WCHAR *szBuffer)
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define ZeroMemory
Definition: winbase.h:1635
int32_t INT
Definition: typedefs.h:56
smooth NULL
Definition: ftsmooth.c:416
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
__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)
union tagIP_ADDR::@487 u
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by TcpipAdvancedIpDlg().

◆ StoreTcpipBasicSettings()

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

Definition at line 2179 of file tcpipconf_notify.c.

2183 {
2184  DWORD dwIpAddr;
2185 
2186  if (SendDlgItemMessageW(hwndDlg, IDC_NODHCP, BM_GETCHECK, 0, 0) == BST_CHECKED)
2187  {
2188  This->pCurrentConfig->DhcpEnabled = FALSE;
2189  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2190  {
2191  if (bApply)
2192  {
2194  SetFocus(GetDlgItem(hwndDlg, IDC_IPADDR));
2195  return E_FAIL;
2196  }
2197  }
2198  if (!This->pCurrentConfig->Ip)
2199  {
2200  This->pCurrentConfig->Ip = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2201  if (!This->pCurrentConfig->Ip)
2202  return E_OUTOFMEMORY;
2203  ZeroMemory(This->pCurrentConfig->Ip, sizeof(IP_ADDR));
2204  }
2205  This->pCurrentConfig->Ip->IpAddress = dwIpAddr;
2206 
2207  if (SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2208  {
2209  if (bApply)
2211  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2212  {
2213  if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2214  dwIpAddr = MAKEIPADDRESS(255, 0, 0, 0);
2215  else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2216  dwIpAddr = MAKEIPADDRESS(255, 255, 0, 0);
2217  else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2218  dwIpAddr = MAKEIPADDRESS(255, 255, 255, 0);
2219 
2220  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)dwIpAddr);
2221  }
2222  if (bApply)
2223  {
2224  SetFocus(GetDlgItem(hwndDlg, IDC_SUBNETMASK));
2225  return E_FAIL;
2226  }
2227  }
2228  /* store subnetmask */
2229  This->pCurrentConfig->Ip->u.Subnetmask = dwIpAddr;
2230 
2231  if (SendDlgItemMessageW(hwndDlg, IDC_DEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2232  {
2233  if (!This->pCurrentConfig->Gw)
2234  {
2235  This->pCurrentConfig->Gw = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2236  if (!This->pCurrentConfig->Gw)
2237  return E_OUTOFMEMORY;
2238  ZeroMemory(This->pCurrentConfig->Gw, sizeof(IP_ADDR));
2239  }
2240  /* store default gateway */
2241  This->pCurrentConfig->Gw->IpAddress = dwIpAddr;
2242  }
2243  else
2244  {
2245  if (This->pCurrentConfig->Gw)
2246  {
2247  IP_ADDR * pNextGw = This->pCurrentConfig->Gw->Next;
2248  CoTaskMemFree(This->pCurrentConfig->Gw);
2249  This->pCurrentConfig->Gw = pNextGw;
2250  }
2251  }
2252  }
2253  else
2254  {
2255  This->pCurrentConfig->DhcpEnabled = TRUE;
2256  }
2257  if (SendDlgItemMessageW(hwndDlg, IDC_FIXEDDNS, BM_GETCHECK, 0, 0) == BST_CHECKED)
2258  {
2259  BOOL bSkip = FALSE;
2260  This->pCurrentConfig->AutoconfigActive = FALSE;
2261  if (SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2262  {
2263  if (!This->pCurrentConfig->Ns)
2264  {
2265  This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2266  if (!This->pCurrentConfig->Ns)
2267  return E_OUTOFMEMORY;
2268  ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2269  }
2270  This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2271  }
2272  else if (This->pCurrentConfig->Ns)
2273  {
2274  IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next;
2275 
2276  CoTaskMemFree(This->pCurrentConfig->Ns);
2277  This->pCurrentConfig->Ns = pTemp;
2278  bSkip = TRUE;
2279  }
2280 
2281 
2282  if (SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2283  {
2284  if (!This->pCurrentConfig->Ns || bSkip)
2285  {
2286  if (!This->pCurrentConfig->Ns)
2287  {
2288  This->pCurrentConfig->Ns = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2289  if (!This->pCurrentConfig->Ns)
2290  return E_OUTOFMEMORY;
2291  ZeroMemory(This->pCurrentConfig->Ns, sizeof(IP_ADDR));
2292  }
2293  This->pCurrentConfig->Ns->IpAddress = dwIpAddr;
2294  }
2295  else if (!This->pCurrentConfig->Ns->Next)
2296  {
2297  This->pCurrentConfig->Ns->Next = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2298  if (!This->pCurrentConfig->Ns->Next)
2299  return E_OUTOFMEMORY;
2300  ZeroMemory(This->pCurrentConfig->Ns->Next, sizeof(IP_ADDR));
2301  This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2302  }
2303  else
2304  {
2305  This->pCurrentConfig->Ns->Next->IpAddress = dwIpAddr;
2306  }
2307  }
2308  else
2309  {
2310  if (This->pCurrentConfig->Ns && This->pCurrentConfig->Ns->Next)
2311  {
2312  if (This->pCurrentConfig->Ns->Next->Next)
2313  {
2314  IP_ADDR *pTemp = This->pCurrentConfig->Ns->Next->Next;
2315  CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2316  This->pCurrentConfig->Ns->Next = pTemp;
2317  }
2318  else
2319  {
2320  CoTaskMemFree(This->pCurrentConfig->Ns->Next);
2321  This->pCurrentConfig->Ns->Next = NULL;
2322  }
2323  }
2324  }
2325  }
2326  else
2327  {
2328  This->pCurrentConfig->AutoconfigActive = TRUE;
2329  }
2330  return S_OK;
2331 }
#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:422
#define IDC_NODHCP
Definition: resource.h:24
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
#define ZeroMemory
Definition: winbase.h:1635
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:4438
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IPM_GETADDRESS
Definition: commctrl.h:4439
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:1879
#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:4458
#define BST_CHECKED
Definition: winuser.h:197
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

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:1879
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:406

Referenced by TcpipFilterSettingsDlg().

◆ TcpipAddDNSDlg()

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

Definition at line 1494 of file tcpipconf_notify.c.

1500 {
1501  TcpipDnsSettings * pSettings;
1502  WCHAR szBuffer[100];
1503  DWORD dwIpAddr;
1504  LPNMIPADDRESS lpnmipa;
1505 
1506  switch(uMsg)
1507  {
1508  case WM_INITDIALOG:
1509  pSettings = (TcpipDnsSettings*)lParam;
1511  if (!pSettings->bAdd)
1512  {
1513  if (LoadStringW(netcfgx_hInstance, IDS_MOD, 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  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_SETTEXT, 0, (LPARAM)pSettings->szIP);
1519  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1520  }
1521  else
1522  {
1523  if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1524  {
1525  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1526  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1527  }
1528  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1529  }
1530  return TRUE;
1531  case WM_COMMAND:
1532  if (LOWORD(wParam) == IDCANCEL)
1533  {
1534  EndDialog(hwndDlg, FALSE);
1535  break;
1536  }
1537  else if (LOWORD(wParam) == IDC_OK)
1538  {
1539  pSettings = (TcpipDnsSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1540  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pSettings->szIP);
1541  if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->szIP) == LB_ERR)
1542  {
1543  if (pSettings->bAdd)
1544  SendMessageW(pSettings->hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)pSettings->szIP);
1545  EndDialog(hwndDlg, TRUE);
1546  break;
1547  }
1548  if (!pSettings->bAdd)
1549  {
1550  EndDialog(hwndDlg, FALSE);
1551  break;
1552  }
1554  break;
1555  }
1556  break;
1557  case WM_NOTIFY:
1558  lpnmipa = (LPNMIPADDRESS) lParam;
1559  if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1560  {
1561  if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1562  {
1563  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1564  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1565  }
1566  }
1567  break;
1568  }
1569  return FALSE;
1570 }
#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:1992
#define IDS_ADD
Definition: resource.h:111
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
#define IPN_FIELDCHANGED
Definition: commctrl.h:4449
#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:3112
struct tagNMIPADDRESS * LPNMIPADDRESS
#define LB_ERR
Definition: winuser.h:2386
#define IPM_GETADDRESS
Definition: commctrl.h:4439
UINT_PTR idFrom
Definition: winuser.h:3111
#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:1716
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define LB_FINDSTRING
Definition: winuser.h:1995
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:1715
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 897 of file tcpipconf_notify.c.

903 {
904  LPNMIPADDRESS lpnmipa;
905  DWORD dwIpAddr;
906  TcpipIpSettings *pIpSettings;
907  WCHAR szBuffer[50];
909  LRESULT lResult;
910 
911  switch(uMsg)
912  {
913  case WM_INITDIALOG:
914  pIpSettings = (TcpipIpSettings*)lParam;
916 
925 
926  if (pIpSettings->bAdd)
927  {
928  if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
929  {
930  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
931  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
932  }
933  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
934  }
935  else
936  {
937  if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
938  {
939  szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
940  SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
941  }
942 
945  }
946  return TRUE;
947  case WM_NOTIFY:
948  lpnmipa = (LPNMIPADDRESS) lParam;
949  if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
950  {
951  if (lpnmipa->hdr.idFrom == IDC_IPADDR)
952  {
953  if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
954  {
955  if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
957  else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
958  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 0, 0));
959  else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
960  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
961  EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
962  }
963  }
964  }
965  break;
966  case WM_COMMAND:
967  if (LOWORD(wParam) == IDC_OK)
968  {
969  pIpSettings = (TcpipIpSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
970  SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pIpSettings->szIP);
971  SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, WM_GETTEXT, 16, (LPARAM)pIpSettings->szMask);
972 
973  ZeroMemory(&find, sizeof(LVFINDINFOW));
974  find.flags = LVFI_STRING;
975  find.psz = pIpSettings->szIP;
976  lResult = SendMessageW(pIpSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find);
977 
978  if (lResult == -1)
979  {
980  EndDialog(hwndDlg, TRUE);
981  break;
982  }
983  else if (!pIpSettings->bAdd)
984  {
985  EndDialog(hwndDlg, FALSE);
986  break;
987  }
989  break;
990  }
991  else if (LOWORD(wParam) == IDCANCEL)
992  {
993  EndDialog(hwndDlg, FALSE);
994  }
995  break;
996  }
997  return FALSE;
998 }
#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:2438
#define IPN_FIELDCHANGED
Definition: commctrl.h:4449
#define WM_GETTEXT
Definition: winuser.h:1600
#define ZeroMemory
Definition: winbase.h:1635
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:3112
struct tagNMIPADDRESS * LPNMIPADDRESS
#define IPM_SETADDRESS
Definition: commctrl.h:4438
#define IPM_GETADDRESS
Definition: commctrl.h:4439
UINT_PTR idFrom
Definition: winuser.h:3111
#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:1716
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:4440
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4458
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4456
static TAGID TAGID find
Definition: db.cpp:153
#define LVFI_STRING
Definition: commctrl.h:2409
#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:1715
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 1016 of file tcpipconf_notify.c.

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

1821 {
1824  TcpipDnsSettings Dns;
1825  LRESULT lIndex, lLength;
1826  TcpipSuffixSettings Suffix;
1827  LPPSHNOTIFY lppsn;
1828  WCHAR szSuffix[100];
1829  WCHAR szFormat[200];
1830  WCHAR szBuffer[300];
1831 
1832 
1833  switch(uMsg)
1834  {
1835  case WM_INITDIALOG:
1837  This = (TcpipConfNotifyImpl*)page->lParam;
1838  SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)This);
1842  return TRUE;
1843  case WM_NOTIFY:
1844  lppsn = (LPPSHNOTIFY) lParam;
1845  if (lppsn->hdr.code == PSN_KILLACTIVE)
1846  {
1847  if (SendDlgItemMessageW(hwndDlg, IDC_SELSUFFIX, BM_GETCHECK, 0, 0) == BST_CHECKED &&
1848  SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_GETCOUNT, 0, 0) == 0)
1849  {
1852  return TRUE;
1853  }
1854  if (SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, sizeof(szSuffix)/sizeof(WCHAR), (LPARAM)szSuffix))
1855  {
1856  szSuffix[(sizeof(szSuffix)/sizeof(WCHAR))-1] = L'\0';
1857  if (VerifyDNSSuffix(szSuffix) == FALSE)
1858  {
1859  if (LoadStringW(netcfgx_hInstance, IDS_DNS_SUFFIX, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1860  {
1861  szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1862  swprintf(szBuffer, szFormat, szSuffix);
1863  if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
1864  szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
1865  else
1866  szFormat[0] = L'\0';
1867 
1868  MessageBoxW(hwndDlg, szBuffer, szFormat, MB_ICONWARNING);