ReactOS 0.4.17-dev-116-ga4b6fe9
tcpipconf_notify.c File Reference
#include "precomp.h"
#include <winnls.h>
#include <winsock.h>
#include <iphlpapi.h>
#include <dhcpcsdk.h>
#include <dhcpcapi.h>
#include <inaddr.h>
#include <ip2string.h>
#include <ntstatus.h>
Include dependency graph for tcpipconf_notify.c:

Go to the source code of this file.

Classes

struct  tagIP_ADDR
 
struct  AlternateConfiguration
 
struct  TcpipSettings
 
struct  _AdapterSettings
 
struct  TcpipConfNotifyImpl
 
struct  TcpipGwSettings
 
struct  TcpipIpSettings
 
struct  TcpipDnsSettings
 
struct  TcpipSuffixSettings
 
struct  TcpipPortSettings
 

Macros

#define IP_STRING_MIN_LENGTH   8 /* 0.0.0.0 + NULL */
 
#define IP_STRING_MAX_LENGTH   16 /* xxx.xxx.xxx.xxx + NULL */
 

Typedefs

typedef DWORD(WINAPIPDHCPFALLBACKREFRESHPARAMS) (PWSTR pAdapterName)
 
typedef struct tagIP_ADDR IP_ADDR
 
typedef struct _AdapterSettings AdapterSettings
 
typedef struct TcpipConfNotifyImplLPTcpipConfNotifyImpl
 

Enumerations

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

Functions

static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentPropertyUi (INetCfgComponentPropertyUi *iface)
 
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentSetup (INetCfgComponentSetup *iface)
 
static __inline LPTcpipConfNotifyImpl impl_from_ITcpipProperties (ITcpipProperties *iface)
 
INT GetSelectedItem (HWND hDlgCtrl)
 
HRESULT InitializeTcpipBasicDlgCtrls (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
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)
 
static AdapterSettingsGetAdapterByGuid (TcpipConfNotifyImpl *This, GUID *pAdapterGuid)
 
static HRESULT BuildIpAddressString (AdapterSettings *pAdapter, LPWSTR *ppszIpAddress)
 
static HRESULT BuildSubnetMaskString (AdapterSettings *pAdapter, LPWSTR *ppszSubnetMask)
 
static HRESULT BuildParametersString (AdapterSettings *pAdapter, LPWSTR *ppszParameters)
 
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)
 
static VOID AddItem (HWND hwndDlg, HWND hDlgCtrl, UINT MaxItem, UINT ResId)
 
static VOID DelItem (HWND hDlgCtrl)
 
INT_PTR CALLBACK TcpipFilterSettingsDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HPROPSHEETPAGE InitializePropertySheetPage (LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
 
VOID InitializeTcpipAdvancedOptDlg (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
INT_PTR CALLBACK TcpipAdvancedOptDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID InsertIpAddressToListView (HWND hDlgCtrl, IP_ADDR *pAddr, BOOL bSubMask)
 
VOID InitializeTcpipAdvancedIpDlg (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
INT_PTR CALLBACK TcpipAdvGwDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL GetGWListEntry (HWND hDlgCtrl, INT Index, TcpipGwSettings *pGwSettings)
 
INT_PTR CALLBACK TcpipAddIpDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL VerifyDNSSuffix (LPWSTR szName)
 
INT_PTR CALLBACK TcpipAddSuffixDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL GetIPListEntry (HWND hDlgCtrl, INT Index, TcpipIpSettings *pIpSettings)
 
VOID DeleteItemFromList (HWND hDlgCtrl)
 
UINT GetIpAddressFromStringA (char *sBuffer)
 
VOID FreeIPAddr (IP_ADDR *pAddr)
 
BOOL GetListViewItem (HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)
 
VOID StoreIPSettings (HWND hDlgCtrl, TcpipConfNotifyImpl *This, BOOL bSubmask)
 
INT_PTR CALLBACK TcpipAdvancedIpDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK TcpipAddDNSDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID InitializeTcpipAdvancedDNSDlg (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
VOID ToggleUpDown (HWND hwndDlg, HWND hDlgCtrl, UINT UpButton, UINT DownButton, UINT ModButton, UINT DelButton)
 
VOID MoveItem (HWND hDlgCtrl, INT pos)
 
VOID RemoveItem (HWND hDlgCtrl)
 
LPWSTR GetListViewEntries (HWND hDlgCtrl)
 
VOID StoreDNSSettings (HWND hDlgCtrl, TcpipConfNotifyImpl *This)
 
INT_PTR CALLBACK TcpipAdvancedDnsDlg (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
VOID LaunchAdvancedTcpipSettings (HWND hwndDlg, TcpipConfNotifyImpl *This)
 
INT_PTR StoreTcpipAlternateSettings (HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)
 
HRESULT InitializeTcpipAltDlgCtrls (HWND hwndDlg, 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)
 
VOID FreeSettings (TcpipConfNotifyImpl *This)
 
static BOOL IpAddressesChanged (AdapterSettings *pAdapter)
 
static BOOL GatewaysChanged (AdapterSettings *pAdapter)
 
static BOOL NameServersChanged (AdapterSettings *pAdapter)
 
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)
 
LPWSTR LoadTcpFilterSettingsFromRegistry (HKEY hKey, LPCWSTR szName, LPDWORD Size)
 
HRESULT LoadTcpipSettings (TcpipConfNotifyImpl *This)
 
HRESULT ParseNameServer (HKEY hAdapterKey, AdapterSettings *pAdapter)
 
HRESULT LoadAdapterSettings (TcpipConfNotifyImpl *This, LPOLESTR pAdapterName, IP_ADAPTER_INFO *pAdapterInfo)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnMergePropPages (INetCfgComponentPropertyUi *iface, DWORD *pdwDefPages, BYTE **pahpspPrivate, UINT *pcPages, HWND hwndParent, LPCWSTR *pszStartPage)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties (INetCfgComponentPropertyUi *iface, HWND hwndDlg)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties (INetCfgComponentPropertyUi *iface)
 
HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties (INetCfgComponentPropertyUi *iface)
 
HRESULT WINAPI INetCfgComponentControl_fnQueryInterface (INetCfgComponentControl *iface, REFIID iid, LPVOID *ppvObj)
 
ULONG WINAPI INetCfgComponentControl_fnAddRef (INetCfgComponentControl *iface)
 
ULONG WINAPI INetCfgComponentControl_fnRelease (INetCfgComponentControl *iface)
 
HRESULT WINAPI INetCfgComponentControl_fnInitialize (INetCfgComponentControl *iface, INetCfgComponent *pIComp, INetCfg *pINetCfg, BOOL fInstalling)
 
static LPWSTR CreateMultiSzString (IP_ADDR *pAddr, COPY_TYPE Type, LPDWORD Size, BOOL bComma)
 
HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges (INetCfgComponentControl *iface)
 
HRESULT WINAPI INetCfgComponentControl_fnApplyPnpChanges (INetCfgComponentControl *iface, INetCfgPnpReconfigCallback *pICallback)
 
HRESULT WINAPI INetCfgComponentControl_fnCancelChanges (INetCfgComponentControl *iface)
 
HRESULT WINAPI INetCfgComponentSetup_fnQueryInterface (INetCfgComponentSetup *iface, REFIID iid, LPVOID *ppvObj)
 
ULONG WINAPI INetCfgComponentSetup_fnAddRef (INetCfgComponentSetup *iface)
 
ULONG WINAPI INetCfgComponentSetup_fnRelease (INetCfgComponentSetup *iface)
 
HRESULT WINAPI INetCfgComponentSetup_fnInstall (INetCfgComponentSetup *iface, DWORD dwSetupFlags)
 
HRESULT WINAPI INetCfgComponentSetup_fnUpgrade (INetCfgComponentSetup *iface, DWORD dwSetupFlags, DWORD dwUpgradeFromBuildNo)
 
HRESULT WINAPI INetCfgComponentSetup_fnReadAnswerFile (INetCfgComponentSetup *iface, LPCWSTR pszwAnswerFile, LPCWSTR pszwAnswerSections)
 
HRESULT WINAPI INetCfgComponentSetup_fnRemoving (INetCfgComponentSetup *iface)
 
HRESULT WINAPI ITcpipProperties_fnQueryInterface (ITcpipProperties *iface, REFIID iid, LPVOID *ppvObj)
 
ULONG WINAPI ITcpipProperties_fnAddRef (ITcpipProperties *iface)
 
ULONG WINAPI ITcpipProperties_fnRelease (ITcpipProperties *iface)
 
HRESULT WINAPI ITcpipProperties_fnUnknown1 (ITcpipProperties *iface, GUID *pAdapterName, PTCPIP_PROPERTIES *ppProperties)
 
HRESULT WINAPI TcpipConfigNotify_Constructor (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv)
 

Variables

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

Macro Definition Documentation

◆ IP_STRING_MAX_LENGTH

#define IP_STRING_MAX_LENGTH   16 /* xxx.xxx.xxx.xxx + NULL */

Definition at line 14 of file tcpipconf_notify.c.

◆ IP_STRING_MIN_LENGTH

#define IP_STRING_MIN_LENGTH   8 /* 0.0.0.0 + NULL */

Definition at line 13 of file tcpipconf_notify.c.

Typedef Documentation

◆ AdapterSettings

◆ IP_ADDR

◆ LPTcpipConfNotifyImpl

◆ PDHCPFALLBACKREFRESHPARAMS

typedef DWORD(WINAPI * PDHCPFALLBACKREFRESHPARAMS) (PWSTR pAdapterName)

Definition at line 16 of file tcpipconf_notify.c.

Enumeration Type Documentation

◆ COPY_TYPE

Enumerator
METRIC 
SUBMASK 
IPADDR 

Definition at line 36 of file tcpipconf_notify.c.

37{
38 METRIC = 1,
39 SUBMASK = 2,
40 IPADDR = 3
41} COPY_TYPE;
ULONG IPADDR
Definition: rassapi.h:53
COPY_TYPE
@ METRIC
@ SUBMASK

Function Documentation

◆ AddAlternativeDialog()

VOID AddAlternativeDialog ( HWND  hDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2743 of file tcpipconf_notify.c.

2746{
2747 HPROPSHEETPAGE hpage;
2748
2750 if (!hpage)
2751 return;
2752
2753 SendMessageW(hDlg, PSM_INSERTPAGE, 1, (LPARAM)hpage);
2754}
#define NULL
Definition: types.h:112
#define IDD_TCPIP_ALTCF_DLG
Definition: resource.h:9
LONG_PTR LPARAM
Definition: minwindef.h:175
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
INT_PTR CALLBACK TcpipAltConfDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by TcpipBasicDlg().

◆ AddItem()

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

Definition at line 675 of file tcpipconf_notify.c.

680{
682
683 Port.MaxNum = MaxItem;
684 Port.hDlgCtrl = hDlgCtrl;
685 Port.ResId = ResId;
686
688}
HINSTANCE netcfgx_hInstance
Definition: netcfgx.c:15
#define IDD_TCPIP_PORT_DLG
Definition: resource.h:18
CPPORT Port[4]
Definition: headless.c:38
INT_PTR CALLBACK TcpipFilterPortDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

◆ BuildIpAddressString()

static HRESULT BuildIpAddressString ( AdapterSettings pAdapter,
LPWSTR ppszIpAddress 
)
static

Definition at line 219 of file tcpipconf_notify.c.

222{
223 PWSTR pszIpAddress, pString;
225 IP_ADDR *pAddr;
227
228 if (pAdapter->NewDhcpEnabled)
229 {
231 }
232 else
233 {
234 dwSize = 0;
235 pAddr = pAdapter->NewIp;
236 while (pAddr != NULL)
237 {
238 dwSize++;
239 pAddr = pAddr->Next;
240 }
241
243 }
244
245 pszIpAddress = CoTaskMemAlloc(dwSize * sizeof(WCHAR));
246 if (pszIpAddress == NULL)
247 return E_OUTOFMEMORY;
248
249 ZeroMemory(pszIpAddress, dwSize * sizeof(WCHAR));
250
251 if (pAdapter->NewDhcpEnabled)
252 {
253 wcscpy(pszIpAddress, L"0.0.0.0");
254 }
255 else
256 {
257 pString = pszIpAddress;
258 pAddr = pAdapter->NewIp;
259 while (pAddr != NULL)
260 {
261 if (pString != pszIpAddress)
262 {
263 *pString = L',';
264 pString++;
265 }
266
267 Address.S_un.S_addr = htonl(pAddr->IpAddress);
269
270 pAddr = pAddr->Next;
271 }
272 }
273
274 *ppszIpAddress = pszIpAddress;
275
276 return S_OK;
277}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
PWDF_CHILD_ADDRESS_DESCRIPTION_HEADER pAddr
FxString * pString
#define S_OK
Definition: intsafe.h:52
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
#define ZeroMemory
Definition: minwinbase.h:31
#define htonl(x)
Definition: module.h:214
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
NTSYSAPI PWSTR NTAPI RtlIpv4AddressToStringW(_In_ const struct in_addr *Addr, _Out_writes_(16) PWCHAR S)
short WCHAR
Definition: pedump.c:58
static WCHAR Address[46]
Definition: ping.c:68
wcscpy
Definition: tcpip.h:126
#define IP_STRING_MAX_LENGTH
#define IP_STRING_MIN_LENGTH
uint16_t * PWSTR
Definition: typedefs.h:56

Referenced by ITcpipProperties_fnUnknown1().

◆ BuildParametersString()

static HRESULT BuildParametersString ( AdapterSettings pAdapter,
LPWSTR ppszParameters 
)
static

Definition at line 344 of file tcpipconf_notify.c.

347{
348 PWSTR pszParameters, pString;
349 PWSTR pszDefGateway = NULL;
350 PWSTR pszGatewayMetric = NULL;
351 PWSTR pszNameServers = NULL;
352 DWORD dwCount;
353 INT nLength;
354 IP_ADDR *pAddr;
356 HRESULT hr = S_OK;
357
358 /* Format: "DefGw=;GwMetric=;IfMetric=0;DNS=;WINS=;DynamicUpdate=1;NameRegistration=0;" */
359
360 /* Count Gateway entries */
361 dwCount = 0;
362 pAddr = pAdapter->NewGw;
363 while (pAddr != NULL)
364 {
365 dwCount++;
366 pAddr = pAddr->Next;
367 }
368
369 /* Build Default Gateway string */
370 pszDefGateway = CoTaskMemAlloc(dwCount * IP_STRING_MAX_LENGTH * sizeof(WCHAR));
371 if (pszDefGateway == NULL)
372 {
374 goto done;
375 }
376
377 ZeroMemory(pszDefGateway, dwCount * IP_STRING_MAX_LENGTH * sizeof(WCHAR));
378
379 pString = pszDefGateway;
380 pAddr = pAdapter->NewGw;
381 while (pAddr != NULL)
382 {
383 if (pString != pszDefGateway)
384 {
385 *pString = L',';
386 pString++;
387 }
388
389 Address.S_un.S_addr = htonl(pAddr->u.SubnetMask);
391
392 pAddr = pAddr->Next;
393 }
394
395 TRACE("DefaultGateway %S\n", pszDefGateway);
396
397 /* Build Gateway Metric string */
398 pszGatewayMetric = CoTaskMemAlloc(dwCount * 5 * sizeof(WCHAR));
399 if (pszGatewayMetric == NULL)
400 {
402 goto done;
403 }
404
405 ZeroMemory(pszGatewayMetric, dwCount * 5 * sizeof(WCHAR));
406
407 pString = pszGatewayMetric;
408 pAddr = pAdapter->NewGw;
409 while (pAddr != NULL)
410 {
411 if (pString != pszGatewayMetric)
412 {
413 *pString = L',';
414 pString++;
415 }
416
417 nLength = _swprintf(pString, L"%hu", pAddr->u.Metric);
418 pString += nLength;
419
420 pAddr = pAddr->Next;
421 }
422
423 TRACE("Gateway Metric %S\n", pszGatewayMetric);
424
425 /* Build the DNS string */
426 dwCount = 0;
427 pAddr = pAdapter->NewNs;
428 while (pAddr != NULL)
429 {
430 dwCount++;
431 pAddr = pAddr->Next;
432 }
433
434 pszNameServers = CoTaskMemAlloc(dwCount * IP_STRING_MAX_LENGTH * sizeof(WCHAR));
435 if (pszNameServers == NULL)
436 {
438 goto done;
439 }
440
441 ZeroMemory(pszNameServers, dwCount * IP_STRING_MAX_LENGTH * sizeof(WCHAR));
442
443 pString = pszNameServers;
444 pAddr = pAdapter->NewNs;
445 while (pAddr != NULL)
446 {
447 if (pString != pszNameServers)
448 {
449 *pString = L',';
450 pString++;
451 }
452
453 Address.S_un.S_addr = htonl(pAddr->IpAddress);
455
456 pAddr = pAddr->Next;
457 }
458
459 TRACE("Name Servers %S\n", pszNameServers);
460
461 /* Get the Parameters string length */
462 nLength = _scwprintf(L"DefGw=%s;GwMetric=%s;IfMetric=%lu;DNS=%s;",
463 pszDefGateway,
464 pszGatewayMetric,
465 pAdapter->NewMetric,
466 pszNameServers);
467
468 TRACE("Param string length %d\n", nLength);
469 if (nLength == -1)
470 {
471 hr = E_FAIL;
472 goto done;
473 }
474
475 /* Allocate the Parameters buffer */
476 pszParameters = CoTaskMemAlloc((nLength + 1) * sizeof(WCHAR));
477 if (pszParameters == NULL)
478 return E_OUTOFMEMORY;
479
480 ZeroMemory(pszParameters, (nLength + 1) * sizeof(WCHAR));
481
482 /* Fill the Parameters buffer */
483 _swprintf(pszParameters,
484 L"DefGw=%s;GwMetric=%s;IfMetric=%lu;DNS=%s;",
485 pszDefGateway,
486 pszGatewayMetric,
487 pAdapter->NewMetric,
488 pszNameServers);
489
490 TRACE("Parameters %S\n", pszParameters);
491
492 *ppszParameters = pszParameters;
493
494done:
495 if (pszDefGateway)
496 CoTaskMemFree(pszDefGateway);
497
498 if (pszGatewayMetric)
499 CoTaskMemFree(pszGatewayMetric);
500
501 if (pszNameServers)
502 CoTaskMemFree(pszNameServers);
503
504 return hr;
505}
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:573
_ACRTIMP int __cdecl _scwprintf(const wchar_t *,...)
Definition: wcs.c:1673
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
#define TRACE(s)
Definition: solgame.cpp:4
int32_t INT
Definition: typedefs.h:58
WINBASEAPI _In_ DWORD nLength
Definition: wincon.h:682

Referenced by ITcpipProperties_fnUnknown1().

◆ BuildSubnetMaskString()

static HRESULT BuildSubnetMaskString ( AdapterSettings pAdapter,
LPWSTR ppszSubnetMask 
)
static

Definition at line 281 of file tcpipconf_notify.c.

284{
285 PWSTR pszSubnetMask, pString;
287 IP_ADDR *pAddr;
289
290 /* Build the SubnetMask string */
291 if (pAdapter->NewDhcpEnabled)
292 {
294 }
295 else
296 {
297 dwSize = 0;
298 pAddr = pAdapter->NewIp;
299 while (pAddr != NULL)
300 {
301 dwSize++;
302 pAddr = pAddr->Next;
303 }
304
306 }
307
308 pszSubnetMask = CoTaskMemAlloc(dwSize * sizeof(WCHAR));
309 if (pszSubnetMask == NULL)
310 return E_OUTOFMEMORY;
311
312 ZeroMemory(pszSubnetMask, dwSize * sizeof(WCHAR));
313
314 if (pAdapter->NewDhcpEnabled)
315 {
316 wcscpy(pszSubnetMask, L"0.0.0.0");
317 }
318 else
319 {
320 pString = pszSubnetMask;
321 pAddr = pAdapter->NewIp;
322 while (pAddr != NULL)
323 {
324 if (pString != pszSubnetMask)
325 {
326 *pString = L',';
327 pString++;
328 }
329
330 Address.S_un.S_addr = htonl(pAddr->u.SubnetMask);
332
333 pAddr = pAddr->Next;
334 }
335 }
336
337 *ppszSubnetMask = pszSubnetMask;
338
339 return S_OK;
340}

Referenced by ITcpipProperties_fnUnknown1().

◆ CopyIpAddrString()

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

Definition at line 3024 of file tcpipconf_notify.c.

3029{
3030 IP_ADDR_STRING * pCurrent;
3031 IP_ADDR *pNew, *pLast;
3032
3033 pCurrent = pSrc;
3034 pLast = NULL;
3035
3036 while(pCurrent)
3037 {
3038 pNew = CoTaskMemAlloc(sizeof(IP_ADDR));
3039 if (!pNew)
3040 {
3041 break;
3042 }
3043 ZeroMemory(pNew, sizeof(IP_ADDR));
3045 if (!pNew->IpAddress)
3046 {
3047 CoTaskMemFree(pNew);
3048 return E_FAIL;
3049 }
3050
3051 if (Type == SUBMASK)
3052 {
3054 pNew->NTEContext = pCurrent->Context;
3055 }
3056 else if (Type == METRIC)
3057 {
3058 if (szMetric && szMetric[0] != L'\0')
3059 {
3060 pNew->u.Metric = _wtoi(szMetric);
3061 szMetric += wcslen(szMetric) + 1;
3062 }
3063 }
3064
3065 if (!pLast)
3066 *pTarget = pNew;
3067 else
3068 pLast->Next = pNew;
3069
3070 pLast = pNew;
3071 pCurrent = pCurrent->Next;
3072
3073 }
3074 pLast->Next = NULL;
3075 return S_OK;
3076}
Type
Definition: Type.h:7
_ACRTIMP int __cdecl _wtoi(const wchar_t *)
Definition: wcs.c:2773
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
char String[4 *4]
Definition: iptypes.h:31
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:35
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:36
IP_MASK_STRING IpMask
Definition: iptypes.h:37
DWORD Context
Definition: iptypes.h:38
union tagIP_ADDR::@542 u
struct tagIP_ADDR * Next
UINT GetIpAddressFromStringA(char *sBuffer)

Referenced by LoadAdapterSettings().

◆ CreateFilterList()

LPWSTR CreateFilterList ( HWND  hDlgCtrl,
LPDWORD  Size 
)

Definition at line 625 of file tcpipconf_notify.c.

628{
629 INT iCount, iIndex;
630 LVITEMW li;
633 WCHAR szBuffer[10];
634
635 iCount = ListView_GetItemCount(hDlgCtrl);
636 if (!iCount)
637 {
638 pData = (LPWSTR)CoTaskMemAlloc(3 * sizeof(WCHAR));
639 if (!pData)
640 return NULL;
641 pData[0] = L'0';
642 pData[1] = L'\0';
643 pData[2] = L'\0';
644 *Size = 3 * sizeof(WCHAR);
645 return pData;
646 }
647
648 pData = CoTaskMemAlloc((6 * iCount + 1) * sizeof(WCHAR));
649 if (!pData)
650 return NULL;
651
652 pCur = pData;
653 dwSize = 0;
654 for(iIndex = 0; iIndex < iCount; iIndex++)
655 {
656 ZeroMemory(&li, sizeof(LVITEMW));
657 li.mask = LVIF_TEXT;
658 li.iItem = iIndex;
659 li.pszText = szBuffer;
660 li.cchTextMax = sizeof(szBuffer) /sizeof(WCHAR);
661 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
662 {
663 wcscpy(pCur, szBuffer);
664 dwSize += wcslen(szBuffer) + 1;
665 pCur += wcslen(szBuffer) + 1;
666 }
667 }
668 pCur[0] = L'\0';
669 *Size = (dwSize+1) * sizeof(WCHAR);
670 return pData;
671}
SINGLE_LIST_ENTRY * pCur
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVM_GETITEMW
Definition: commctrl.h:2395
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint16_t * LPWSTR
Definition: typedefs.h:56
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539

Referenced by TcpipFilterSettingsDlg().

◆ CreateMultiSzString()

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

Definition at line 3992 of file tcpipconf_notify.c.

3993{
3994 LPWSTR pStr, pRet;
3995 DWORD dwSize, dwIpAddr;
3996 WCHAR szBuffer[30];
3997 IP_ADDR *pTemp = pAddr;
3998
3999
4000 dwSize = 0;
4001 while(pTemp)
4002 {
4003 if (Type == IPADDR)
4004 {
4005 dwIpAddr = pTemp->IpAddress;
4006 _swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
4007 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
4008 }else if (Type == SUBMASK)
4009 {
4010 dwIpAddr = pTemp->u.SubnetMask;
4011 _swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
4012 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
4013 }
4014 else if (Type == METRIC)
4015 {
4016 _swprintf(szBuffer, L"%u", pTemp->u.Metric);
4017 }
4018
4019 dwSize += wcslen(szBuffer) + 1;
4020 pTemp = pTemp->Next;
4021 }
4022
4023 if (!dwSize)
4024 return NULL;
4025
4026 pStr = pRet = CoTaskMemAlloc((dwSize+1) * sizeof(WCHAR));
4027 if(!pStr)
4028 return NULL;
4029
4030 pTemp = pAddr;
4031 while(pTemp)
4032 {
4033 if (Type == IPADDR)
4034 {
4035 dwIpAddr = pTemp->IpAddress;
4036 _swprintf(pStr, L"%lu.%lu.%lu.%lu",
4037 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
4038 }else if (Type == SUBMASK)
4039 {
4040 dwIpAddr = pTemp->u.SubnetMask;
4041 _swprintf(pStr, L"%lu.%lu.%lu.%lu",
4042 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
4043 }
4044 else if (Type == METRIC)
4045 {
4046 _swprintf(pStr, L"%u", pTemp->u.Metric);
4047 }
4048
4049 if (bComma)
4050 {
4051 pStr += wcslen(pStr);
4052 if (pTemp->Next)
4053 {
4054 pStr[0] = L',';
4055 pStr++;
4056 }
4057 }
4058 else
4059 {
4060 pStr += wcslen(pStr) + 1;
4061 }
4062 pTemp = pTemp->Next;
4063 }
4064 pStr[0] = L'\0';
4065 *Size = (dwSize+1) * sizeof(WCHAR);
4066 return pRet;
4067}
#define FOURTH_IPADDRESS(x)
Definition: commctrl.h:4496
#define FIRST_IPADDRESS(x)
Definition: commctrl.h:4493
#define SECOND_IPADDRESS(x)
Definition: commctrl.h:4494
#define THIRD_IPADDRESS(x)
Definition: commctrl.h:4495

Referenced by INetCfgComponentControl_fnApplyRegistryChanges().

◆ DeleteItemFromList()

VOID DeleteItemFromList ( HWND  hDlgCtrl)

Definition at line 1481 of file tcpipconf_notify.c.

1482{
1483 LVITEMW li;
1484
1485 memset(&li, 0x0, sizeof(LVITEMW));
1486 li.iItem = GetSelectedItem(hDlgCtrl);
1487 if (li.iItem < 0)
1488 {
1490 SetFocus(hDlgCtrl);
1491 }
1492 else
1493 {
1494 (void)ListView_DeleteItem(hDlgCtrl, li.iItem);
1495 }
1496}
#define IDS_NOITEMSEL
Definition: resource.h:118
#define IDS_TCPIP
Definition: resource.h:119
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2416
#define memset(x, y, z)
Definition: compat.h:39
VOID DisplayError(UINT ResTxt, UINT ResTitle, UINT Type)
INT GetSelectedItem(HWND hDlgCtrl)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MB_ICONINFORMATION
Definition: winuser.h:813

Referenced by TcpipAdvancedIpDlg().

◆ DelItem()

static VOID DelItem ( HWND  hDlgCtrl)
static

Definition at line 692 of file tcpipconf_notify.c.

694{
695 INT iIndex = GetSelectedItem(hDlgCtrl);
696
697 if (iIndex != -1)
698 {
699 (void)ListView_DeleteItem(hDlgCtrl, iIndex);
700 return;
701 }
703}
#define MB_ICONWARNING
Definition: winuser.h:797

Referenced by TcpipFilterSettingsDlg().

◆ DisplayError()

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

Definition at line 179 of file tcpipconf_notify.c.

180{
181 WCHAR szBuffer[300];
182 WCHAR szTitle[100];
183
184 if (LoadStringW(netcfgx_hInstance, ResTxt, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
185 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
186 else
187 szBuffer[0] = L'\0';
188
189 if (LoadStringW(netcfgx_hInstance, ResTitle, szTitle, sizeof(szTitle)/sizeof(WCHAR)))
190 szTitle[(sizeof(szTitle)/sizeof(WCHAR))-1] = L'\0';
191 else
192 szTitle[0] = L'\0';
193
194 MessageBoxW(NULL, szBuffer, szTitle, Type);
195}
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define LoadStringW
Definition: utils.h:64
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)

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

◆ FreeIPAddr()

VOID FreeIPAddr ( IP_ADDR pAddr)

Definition at line 1539 of file tcpipconf_notify.c.

1540{
1541 IP_ADDR *pNext;
1542
1543 if (!pAddr)
1544 return;
1545
1546 while(pAddr)
1547 {
1548 pNext = pAddr->Next;
1550 pAddr = pNext;
1551 }
1552}

Referenced by StoreDNSSettings(), and TcpipAdvancedIpDlg().

◆ FreeSettings()

VOID FreeSettings ( TcpipConfNotifyImpl This)

Definition at line 3198 of file tcpipconf_notify.c.

3200{
3201 AdapterSettings *pAdapter;
3202 IP_ADDR *NextIp;
3203
3204 if (This == NULL)
3205 return;
3206
3207 if (This->pTcpIpSettings)
3208 {
3209 if (This->pTcpIpSettings->szSearchList)
3210 CoTaskMemFree(This->pTcpIpSettings->szSearchList);
3211
3212 CoTaskMemFree(This->pTcpIpSettings);
3213 }
3214
3215 while (This->pAdapterListHead)
3216 {
3217 pAdapter = This->pAdapterListHead;
3218
3219 /* Free IpAdresses */
3220 while (pAdapter->NewIp)
3221 {
3222 NextIp = pAdapter->NewIp->Next;
3223 CoTaskMemFree(pAdapter->NewIp);
3224 pAdapter->NewIp = NextIp;
3225 }
3226
3227 while (pAdapter->OldIp)
3228 {
3229 NextIp = pAdapter->OldIp->Next;
3230 CoTaskMemFree(pAdapter->OldIp);
3231 pAdapter->OldIp = NextIp;
3232 }
3233
3234 /* Free Gateways */
3235 while (pAdapter->NewGw)
3236 {
3237 NextIp = pAdapter->NewGw->Next;
3238 CoTaskMemFree(pAdapter->NewGw);
3239 pAdapter->NewGw = NextIp;
3240 }
3241
3242 while (pAdapter->OldGw)
3243 {
3244 NextIp = pAdapter->OldGw->Next;
3245 CoTaskMemFree(pAdapter->OldGw);
3246 pAdapter->OldGw = NextIp;
3247 }
3248
3249 /* Free NameServers */
3250 while (pAdapter->NewNs)
3251 {
3252 NextIp = pAdapter->NewNs->Next;
3253 CoTaskMemFree(pAdapter->NewNs);
3254 pAdapter->NewNs = NextIp;
3255 }
3256
3257 while (pAdapter->OldNs)
3258 {
3259 NextIp = pAdapter->OldNs->Next;
3260 CoTaskMemFree(pAdapter->OldNs);
3261 pAdapter->OldNs = NextIp;
3262 }
3263
3264 if (pAdapter->szTCPAllowedPorts)
3266
3267 if (pAdapter->szUDPAllowedPorts)
3269
3270 if (pAdapter->szRawIPAllowedProtocols)
3272
3273
3274 This->pAdapterListHead = pAdapter->pNext;
3275 CoTaskMemFree(pAdapter);
3276 }
3277
3278 This->pAdapterListTail = NULL;
3279 This->pCurrentAdapter = NULL;
3280}
LPWSTR szRawIPAllowedProtocols
struct _AdapterSettings * pNext

Referenced by INetCfgComponentControl_fnRelease(), and Initialize().

◆ GatewaysChanged()

static BOOL GatewaysChanged ( AdapterSettings pAdapter)
static

Definition at line 3317 of file tcpipconf_notify.c.

3319{
3320 IP_ADDR *pNew, *pOld;
3321 BOOL Changed = FALSE;
3322
3323 pNew = pAdapter->NewGw;
3324 pOld = pAdapter->OldGw;
3325 while (pNew && pOld)
3326 {
3327 if ((pNew->IpAddress != pOld->IpAddress) ||
3328 (pNew->u.Metric != pOld->u.Metric))
3329 {
3330 Changed = TRUE;
3331 break;
3332 }
3333
3334 pNew = pNew->Next;
3335 pOld = pOld->Next;
3336 }
3337
3338 if (Changed == FALSE)
3339 {
3340 if (((pNew == NULL) && (pOld != NULL)) ||
3341 ((pNew != NULL) && (pOld == NULL)))
3342 Changed = TRUE;
3343 }
3344
3345 return Changed;
3346}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by INetCfgComponentControl_fnApplyPnpChanges(), and INetCfgComponentControl_fnApplyRegistryChanges().

◆ GetAdapterByGuid()

static AdapterSettings * GetAdapterByGuid ( TcpipConfNotifyImpl This,
GUID pAdapterGuid 
)
static

Definition at line 199 of file tcpipconf_notify.c.

202{
203 AdapterSettings *pAdapter;
204
205 pAdapter = This->pAdapterListHead;
206 while (pAdapter)
207 {
208 if (IsEqualGUID(pAdapterGuid, &pAdapter->AdapterGuid))
209 return pAdapter;
210
211 pAdapter = pAdapter->pNext;
212 }
213
214 return NULL;
215}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

Referenced by ITcpipProperties_fnUnknown1().

◆ GetGWListEntry()

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

Definition at line 1205 of file tcpipconf_notify.c.

1206{
1207 LVITEMW li;
1208 WCHAR szBuffer[30];
1209 BOOL bRet;
1210
1211 ZeroMemory(&li, sizeof(LVITEMW));
1212 li.mask = LVIF_TEXT;
1213 li.cchTextMax = 16;
1214 li.pszText = pGwSettings->szIP;
1215 li.iItem = Index;
1216
1217 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1218 return FALSE;
1219 li.pszText = szBuffer;
1220 li.cchTextMax = 30;
1221 li.iSubItem = 1;
1222
1223 bRet = SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1224 if (bRet)
1225 {
1226 pGwSettings->Metric = _wtoi(szBuffer);
1227 }
1228
1229 return bRet;
1230}
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by TcpipAdvancedIpDlg().

◆ GetIpAddressFromStringA()

UINT GetIpAddressFromStringA ( char sBuffer)

Definition at line 1524 of file tcpipconf_notify.c.

1526{
1527 WCHAR szIp[16];
1528
1529 if (MultiByteToWideChar(CP_ACP, 0, sBuffer, -1, szIp, 16))
1530 {
1531 szIp[15] = L'\0';
1532 return GetIpAddressFromStringW(szIp);
1533 }
1534 return (UINT)-1;
1535}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
unsigned int UINT
Definition: ndis.h:50
UINT GetIpAddressFromStringW(WCHAR *szBuffer)

Referenced by CopyIpAddrString().

◆ GetIpAddressFromStringW()

UINT GetIpAddressFromStringW ( WCHAR szBuffer)

Definition at line 1499 of file tcpipconf_notify.c.

1501{
1502 DWORD dwIpAddr = 0;
1503 INT Val;
1504 UINT Index = 3;
1505 LPWSTR pLast = szBuffer;
1506 LPWSTR pNext = szBuffer;
1507
1508
1509 while((pNext = wcschr(pNext, L'.')))
1510 {
1511 pNext[0] = L'\0';
1512 Val = _wtoi(pLast);
1513 dwIpAddr |= (Val << Index * 8);
1514 Index--;
1515 pNext++;
1516 pLast = pNext;
1517 }
1518 dwIpAddr |= _wtoi(pLast);
1519
1520 return dwIpAddr;
1521}
#define wcschr
Definition: compat.h:17

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

◆ GetIPListEntry()

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

Definition at line 1457 of file tcpipconf_notify.c.

1458{
1459 LVITEMW li;
1460
1461 ZeroMemory(&li, sizeof(LVITEMW));
1462 li.mask = LVIF_TEXT;
1463 li.cchTextMax = 16;
1464 li.pszText = pIpSettings->szIP;
1465 li.iItem = Index;
1466
1467 if (!SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1468 return FALSE;
1469
1470 ZeroMemory(&li, sizeof(LVITEMW));
1471 li.mask = LVIF_TEXT;
1472 li.cchTextMax = 16;
1473 li.pszText = pIpSettings->szMask;
1474 li.iSubItem = 1;
1475 li.iItem = Index;
1476
1477 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1478}

Referenced by TcpipAdvancedIpDlg().

◆ GetListViewEntries()

LPWSTR GetListViewEntries ( HWND  hDlgCtrl)

Definition at line 2094 of file tcpipconf_notify.c.

2096{
2097 DWORD dwSize;
2098 INT iCount, iIndex;
2099 INT_PTR lResult;
2100 LPWSTR pszSearchList, pItem;
2101
2102 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
2103 if (!iCount || iCount == LB_ERR)
2104 return NULL; //BUGBUG
2105
2106 dwSize = 0;
2107
2108 for (iIndex = 0; iIndex < iCount; iIndex++)
2109 {
2110 lResult = SendMessageW(hDlgCtrl, LB_GETTEXTLEN, iIndex, 0);
2111 if (lResult == LB_ERR)
2112 return NULL;
2113
2114 dwSize += lResult + 1;
2115 }
2116
2117 pszSearchList = (LPWSTR)CoTaskMemAlloc((dwSize + 1) * sizeof(WCHAR));
2118 if (!pszSearchList)
2119 return NULL;
2120
2121 pItem = pszSearchList;
2122 for (iIndex = 0; iIndex < iCount; iIndex++)
2123 {
2124 lResult = SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)pItem);
2125 if (lResult == LB_ERR)
2126 {
2127 CoTaskMemFree(pszSearchList);
2128 return NULL;
2129 }
2130 dwSize -= lResult + 1;
2131 pItem += wcslen(pItem);
2132 if (iIndex != iCount -1)
2133 {
2134 pItem[0] = L',';
2135 pItem++;
2136 }
2137 }
2138 pItem[0] = L'\0';
2139 return pszSearchList;
2140}
int32_t INT_PTR
Definition: typedefs.h:64
#define LB_ERR
Definition: winuser.h:2468
#define LB_GETCOUNT
Definition: winuser.h:2067
#define LB_GETTEXT
Definition: winuser.h:2085
#define LB_GETTEXTLEN
Definition: winuser.h:2086

Referenced by TcpipAdvancedDnsDlg().

◆ GetListViewItem()

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

Definition at line 1555 of file tcpipconf_notify.c.

1556{
1557 LVITEMW li;
1558
1559 ZeroMemory(&li, sizeof(LVITEMW));
1560 li.mask = LVIF_TEXT;
1561 li.pszText = szBuffer;
1562 li.iItem = Index;
1563 li.iSubItem = SubIndex;
1564 li.cchTextMax = BufferSize;
1565 return SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li);
1566}
#define BufferSize
Definition: mmc.h:75

Referenced by StoreIPSettings().

◆ GetSelectedItem()

INT GetSelectedItem ( HWND  hDlgCtrl)

Definition at line 1431 of file tcpipconf_notify.c.

1432{
1433 LVITEMW li;
1434 UINT iItemCount, iIndex;
1435
1436 iItemCount = ListView_GetItemCount(hDlgCtrl);
1437 if (!iItemCount)
1438 return -1;
1439
1440 for (iIndex = 0; iIndex < iItemCount; iIndex++)
1441 {
1442 ZeroMemory(&li, sizeof(LVITEMW));
1443 li.mask = LVIF_STATE;
1444 li.stateMask = (UINT)-1;
1445 li.iItem = iIndex;
1446 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&li))
1447 {
1448 if (li.state & LVIS_SELECTED)
1449 return iIndex;
1450 }
1451 }
1452 return -1;
1453}
#define LVIF_STATE
Definition: commctrl.h:2317
#define LVIS_SELECTED
Definition: commctrl.h:2324

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

◆ impl_from_INetCfgComponentPropertyUi()

static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentPropertyUi ( INetCfgComponentPropertyUi *  iface)
static

◆ impl_from_INetCfgComponentSetup()

static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentSetup ( INetCfgComponentSetup *  iface)
static

Definition at line 161 of file tcpipconf_notify.c.

162{
163 return (TcpipConfNotifyImpl*)((char *)iface - FIELD_OFFSET(TcpipConfNotifyImpl, lpVtblCompSetup));
164}

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

◆ impl_from_ITcpipProperties()

static __inline LPTcpipConfNotifyImpl impl_from_ITcpipProperties ( ITcpipProperties *  iface)
static

◆ INetCfgComponentControl_fnAddRef()

ULONG WINAPI INetCfgComponentControl_fnAddRef ( INetCfgComponentControl *  iface)

Definition at line 3936 of file tcpipconf_notify.c.

3938{
3939 TRACE("INetCfgComponentControl_fnAddRef()\n");
3941 ULONG refCount = InterlockedIncrement(&This->ref);
3942
3943 return refCount;
3944}
#define InterlockedIncrement
Definition: armddk.h:53
uint32_t ULONG
Definition: typedefs.h:59

◆ INetCfgComponentControl_fnApplyPnpChanges()

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

Definition at line 4259 of file tcpipconf_notify.c.

4262{
4263 ULONG NTEInstance;
4264 DWORD DhcpApiVersion;
4265 DWORD dwSize;
4266 AdapterSettings *pAdapter;
4267
4268 TRACE("INetCfgComponentControl_fnApplyPnpChanges()\n");
4269
4271
4272 pAdapter = This->pAdapterListHead;
4273 while (pAdapter)
4274 {
4275 if (pAdapter->NewDhcpEnabled != pAdapter->OldDhcpEnabled)
4276 {
4277 if (pAdapter->NewDhcpEnabled)
4278 {
4279 /* Static IP --> DHCP */
4280
4281 /* Delete this adapter's current IP address */
4282 DeleteIPAddress(pAdapter->OldIp->NTEContext);
4283 }
4284 else
4285 {
4286 /* DHCP --> Static IP */
4287
4288 /* Open the DHCP API if DHCP is enabled */
4289 if (DhcpCApiInitialize(&DhcpApiVersion) == NO_ERROR)
4290 {
4291 /* We have to tell DHCP about this */
4293 htonl(pAdapter->NewIp->IpAddress),
4294 htonl(pAdapter->NewIp->u.SubnetMask));
4295
4296 /* Close the API */
4298 }
4299 }
4300 }
4301 else
4302 {
4303 if (IpAddressesChanged(pAdapter))
4304 {
4305 /* Static IP --> Static IP */
4306
4307 /* Delete this adapter's current static IP address */
4308 DeleteIPAddress(pAdapter->OldIp->NTEContext);
4309
4310 /* Add the static IP address via the standard IPHLPAPI function */
4311 AddIPAddress(htonl(pAdapter->NewIp->IpAddress),
4312 htonl(pAdapter->NewIp->u.SubnetMask),
4313 pAdapter->Index,
4314 &pAdapter->NewIp->NTEContext,
4315 &NTEInstance);
4316 }
4317 }
4318
4319 if ((pAdapter->NewDhcpEnabled != pAdapter->OldDhcpEnabled) ||
4320 IpAddressesChanged(pAdapter) ||
4321 GatewaysChanged(pAdapter))
4322 {
4323 /* Delete all default routes for this adapter */
4324 dwSize = 0;
4326 {
4327 DWORD Index;
4329 if (pIpForwardTable)
4330 {
4331 if (GetIpForwardTable(pIpForwardTable, &dwSize, FALSE) == NO_ERROR)
4332 {
4333 for (Index = 0; Index < pIpForwardTable->dwNumEntries; Index++)
4334 {
4335 if (pIpForwardTable->table[Index].dwForwardIfIndex == pAdapter->Index &&
4336 pIpForwardTable->table[Index].dwForwardDest == 0)
4337 {
4338 DeleteIpForwardEntry(&pIpForwardTable->table[Index]);
4339 }
4340 }
4341 }
4342 CoTaskMemFree(pIpForwardTable);
4343 }
4344 }
4345
4346 if (pAdapter->NewGw)
4347 {
4348 MIB_IPFORWARDROW RouterMib;
4349 ZeroMemory(&RouterMib, sizeof(MIB_IPFORWARDROW));
4350
4351 RouterMib.dwForwardMetric1 = 1;
4352 RouterMib.dwForwardIfIndex = pAdapter->Index;
4353 RouterMib.dwForwardNextHop = htonl(pAdapter->NewGw->IpAddress);
4354
4355 //TODO
4356 // add multiple gw addresses when required
4357 CreateIpForwardEntry(&RouterMib);
4358 }
4359 }
4360
4361#if 0
4362 /* Notify the DHCP client of the changed alternate configuration */
4363 if (!RtlEqualMemory(&pCurrentConfig->AltConfig, &pOldConfig->AltConfig, sizeof(AlternateConfiguration)))
4364 {
4365 HMODULE hDhcpModule = LoadLibraryW(L"dhcpcsvc.dll");
4366 if (hDhcpModule)
4367 {
4368 PDHCPFALLBACKREFRESHPARAMS pFunc = (PDHCPFALLBACKREFRESHPARAMS)GetProcAddress(hDhcpModule, "DhcpFallbackRefreshParams");
4369 (pFunc)(pAdapter->AdapterName);
4370
4371 FreeLibrary(hDhcpModule);
4372 }
4373 }
4374#endif
4375
4376 /* Notify the dnscache service if the name server list changed */
4377 if (NameServersChanged(pAdapter))
4378 {
4379 SC_HANDLE hManager, hService;
4381
4382 TRACE("Notify the dnscache service!\n");
4383
4385 if (hManager)
4386 {
4387 hService = OpenServiceW(hManager, L"Dnscache", SERVICE_PAUSE_CONTINUE);
4388 if (hService)
4389 {
4391 CloseServiceHandle(hService);
4392 }
4393
4394 CloseServiceHandle(hManager);
4395 }
4396 }
4397
4398 pAdapter = pAdapter->pNext;
4399 }
4400
4401 return S_OK;
4402}
static SERVICE_STATUS ServiceStatus
Definition: browser.c:23
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
DWORD APIENTRY DhcpCApiInitialize(_Out_ LPDWORD Version)
Definition: dhcpcsvc.c:213
DWORD APIENTRY DhcpStaticRefreshParams(DWORD AdapterIndex, DWORD Address, DWORD Netmask)
Definition: dhcpcsvc.c:626
VOID APIENTRY DhcpCApiCleanup(VOID)
Definition: dhcpcsvc.c:227
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
DWORD WINAPI AddIPAddress(IPAddr Address, IPMask Netmask, DWORD IfIndex, PULONG NteContext, PULONG NteInstance)
Definition: iphlpapi_main.c:67
DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder)
DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute)
DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute)
DWORD WINAPI DeleteIPAddress(ULONG NTEContext)
struct _MIB_IPFORWARDTABLE * PMIB_IPFORWARDTABLE
#define RtlEqualMemory(dst, src, len)
Definition: kdvm.h:18
#define SERVICE_CONTROL_PARAMCHANGE
Definition: winsvc.h:47
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define SERVICE_PAUSE_CONTINUE
Definition: winsvc.h:65
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2107
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:622
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2199
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
DWORD dwForwardNextHop
Definition: ipmib.h:74
DWORD dwForwardMetric1
Definition: ipmib.h:88
IF_INDEX dwForwardIfIndex
Definition: ipmib.h:75
DWORD dwForwardDest
Definition: ipmib.h:71
DWORD dwNumEntries
Definition: ipmib.h:97
MIB_IPFORWARDROW table[1]
Definition: ipmib.h:98
static BOOL NameServersChanged(AdapterSettings *pAdapter)
static BOOL IpAddressesChanged(AdapterSettings *pAdapter)
DWORD(WINAPI * PDHCPFALLBACKREFRESHPARAMS)(PWSTR pAdapterName)
static BOOL GatewaysChanged(AdapterSettings *pAdapter)

◆ INetCfgComponentControl_fnApplyRegistryChanges()

HRESULT WINAPI INetCfgComponentControl_fnApplyRegistryChanges ( INetCfgComponentControl *  iface)

Definition at line 4072 of file tcpipconf_notify.c.

4074{
4075 HKEY hKey;
4076 WCHAR szBuffer[200];
4077 LPOLESTR pStr;
4078 DWORD dwSize;
4079 AdapterSettings *pAdapter;
4080
4081 TRACE("INetCfgComponentControl_fnApplyRegistryChanges()\n");
4082
4084
4085 if (This->pTcpIpSettings)
4086 {
4087 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
4088 {
4089 RegSetValueExW(hKey, L"UseDomainNameDevolution", 0, REG_DWORD, (LPBYTE)&This->pTcpIpSettings->UseDomainNameDevolution, sizeof(DWORD));
4090 RegSetValueExW(hKey, L"SearchList", 0, REG_SZ, (LPBYTE)This->pTcpIpSettings->szSearchList,
4091 (wcslen(This->pTcpIpSettings->szSearchList) + 1) * sizeof(WCHAR));
4092 RegSetValueExW(hKey, L"EnableSecurityFilters", 0, REG_DWORD,
4093 (LPBYTE)&This->pTcpIpSettings->EnableSecurityFilters, sizeof(DWORD));
4094
4096 }
4097 }
4098
4099 pAdapter = This->pAdapterListHead;
4100 while (pAdapter)
4101 {
4102 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pAdapter->AdapterName);
4103
4105 {
4106 if (pAdapter->NewMetric != pAdapter->OldMetric)
4107 {
4108 if (pAdapter->NewMetric)
4109 RegSetValueExW(hKey, L"InterfaceMetric", 0, REG_DWORD, (LPBYTE)&pAdapter->NewMetric, sizeof(DWORD));
4110 else
4111 RegDeleteValueW(hKey, L"InterfaceMetric");
4112 }
4113
4114 if (pAdapter->NewRegisterAdapterName != pAdapter->OldRegisterAdapterName)
4115 RegSetValueExW(hKey, L"RegisterAdapterName", 0, REG_DWORD, (LPBYTE)&pAdapter->NewRegisterAdapterName, sizeof(DWORD));
4116
4117 if (pAdapter->NewRegistrationEnabled != pAdapter->OldRegistrationEnabled)
4118 RegSetValueExW(hKey, L"RegistrationEnabled", 0, REG_DWORD, (LPBYTE)&pAdapter->NewRegistrationEnabled, sizeof(DWORD));
4119
4120 RegSetValueExW(hKey, L"Domain", 0, REG_SZ, (LPBYTE)pAdapter->szDomain,
4121 (wcslen(pAdapter->szDomain) + 1) * sizeof(WCHAR));
4122
4123 if ((pAdapter->NewDhcpEnabled != pAdapter->OldDhcpEnabled) ||
4124 IpAddressesChanged(pAdapter))
4125 {
4126 RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (LPBYTE)&pAdapter->NewDhcpEnabled, sizeof(DWORD));
4127 if (pAdapter->NewDhcpEnabled)
4128 {
4129 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
4130 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)L"0.0.0.0\0", 9 * sizeof(WCHAR));
4131 }
4132 else
4133 {
4134 pStr = CreateMultiSzString(pAdapter->NewIp, IPADDR, &dwSize, FALSE);
4135 if (pStr)
4136 {
4137 RegSetValueExW(hKey, L"IPAddress", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
4138 CoTaskMemFree(pStr);
4139 }
4140
4141 pStr = CreateMultiSzString(pAdapter->NewIp, SUBMASK, &dwSize, FALSE);
4142 if (pStr)
4143 {
4144 RegSetValueExW(hKey, L"SubnetMask", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
4145 CoTaskMemFree(pStr);
4146 }
4147 }
4148 }
4149
4150 if (GatewaysChanged(pAdapter))
4151 {
4152 if (pAdapter->NewGw)
4153 {
4154 pStr = CreateMultiSzString(pAdapter->NewGw, IPADDR, &dwSize, FALSE);
4155 if (pStr)
4156 {
4157 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
4158 CoTaskMemFree(pStr);
4159 }
4160
4161 pStr = CreateMultiSzString(pAdapter->NewGw, METRIC, &dwSize, FALSE);
4162 if (pStr)
4163 {
4164 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
4165 CoTaskMemFree(pStr);
4166 }
4167 }
4168 else
4169 {
4170 RegSetValueExW(hKey, L"DefaultGateway", 0, REG_MULTI_SZ, (LPBYTE)L"", 1 * sizeof(WCHAR));
4171 RegSetValueExW(hKey, L"DefaultGatewayMetric", 0, REG_MULTI_SZ, (LPBYTE)L"\0", sizeof(WCHAR) * 2);
4172 }
4173 }
4174
4175 if (NameServersChanged(pAdapter))
4176 {
4177 if (!pAdapter->NewNs)
4178 {
4179 RegDeleteValueW(hKey, L"NameServer");
4180 }
4181 else
4182 {
4183 pStr = CreateMultiSzString(pAdapter->NewNs, IPADDR, &dwSize, TRUE);
4184 if (pStr)
4185 {
4186 RegSetValueExW(hKey, L"NameServer", 0, REG_SZ, (LPBYTE)pStr, dwSize);
4187 //RegDeleteValueW(hKey, L"DhcpNameServer");
4188 CoTaskMemFree(pStr);
4189 }
4190 }
4191 }
4192
4193#if 0
4194 if (pCurrentConfig->pFilter)
4195 {
4196 if (pCurrentConfig->pFilter->szTCPAllowedPorts)
4197 {
4198 RegSetValueExW(hKey, L"TCPAllowedPorts", 0, REG_MULTI_SZ,
4199 (LPBYTE)pCurrentConfig->pFilter->szTCPAllowedPorts,
4200 pCurrentConfig->pFilter->TCPSize);
4201 }
4202 if (pCurrentConfig->pFilter->szUDPAllowedPorts)
4203 {
4204 RegSetValueExW(hKey, L"UDPAllowedPorts", 0, REG_MULTI_SZ,
4205 (LPBYTE)pCurrentConfig->pFilter->szUDPAllowedPorts,
4206 pCurrentConfig->pFilter->UDPSize);
4207 }
4208 if (pCurrentConfig->pFilter->szRawIPAllowedProtocols)
4209 {
4210 RegSetValueExW(hKey, L"RawIPAllowedProtocols", 0, REG_MULTI_SZ,
4211 (LPBYTE)pCurrentConfig->pFilter->szRawIPAllowedProtocols,
4212 pCurrentConfig->pFilter->IPSize);
4213 }
4214 }
4215#endif
4216
4217#if 0
4218 if (!RtlEqualMemory(&pCurrentConfig->AltConfig, &pOldConfig->AltConfig, sizeof(AlternateConfiguration)))
4219 {
4220 if (pCurrentConfig->AltConfig.IpAddress == 0)
4221 {
4222 RegDeleteValueW(hKey, L"ActiveConfigurations");
4223 }
4224 else
4225 {
4226 HKEY hConfigKey;
4227
4228 dwSize = (wcslen(L"Alternate_") + wcslen(pAdapterName) + 2) * sizeof(WCHAR);
4229 pStr = CoTaskMemAlloc(dwSize);
4230 if (pStr)
4231 {
4232 ZeroMemory(pStr, dwSize);
4233 _swprintf(pStr, L"Alternate_%s", pAdapterName);
4234 RegSetValueExW(hKey, L"ActiveConfigurations", 0, REG_MULTI_SZ, (LPBYTE)pStr, dwSize);
4235 CoTaskMemFree(pStr);
4236 }
4237
4238 _swprintf(szBuffer, L"SYSTEM\\CurrentControlSet\\Services\\DHCP\\Configurations\\Alternate_%s", pAdapterName);
4239 if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szBuffer, 0, NULL, 0, KEY_WRITE, NULL, &hConfigKey, NULL) == ERROR_SUCCESS)
4240 {
4241 RegSetValueExW(hConfigKey, L"Options", 0, REG_BINARY, (LPBYTE)&pCurrentConfig->AltConfig, sizeof(AlternateConfiguration));
4242 RegCloseKey(hConfigKey);
4243 }
4244 }
4245 }
4246#endif
4247
4249 }
4250
4251 pAdapter = pAdapter->pNext;
4252 }
4253
4254 return S_OK;
4255}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
FxAutoRegKey hKey
#define REG_SZ
Definition: layer.c:22
static BSTR *static LPOLESTR
Definition: varformat.c:44
#define REG_BINARY
Definition: nt_native.h:1499
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define KEY_WRITE
Definition: nt_native.h:1034
#define REG_DWORD
Definition: sdbapi.c:615
static LPWSTR CreateMultiSzString(IP_ADDR *pAddr, COPY_TYPE Type, LPDWORD Size, BOOL bComma)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ INetCfgComponentControl_fnCancelChanges()

HRESULT WINAPI INetCfgComponentControl_fnCancelChanges ( INetCfgComponentControl *  iface)

Definition at line 4406 of file tcpipconf_notify.c.

4408{
4409 TRACE("INetCfgComponentControl_fnCancelChanges()\n");
4410 return S_OK;
4411}

◆ INetCfgComponentControl_fnInitialize()

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

Definition at line 3965 of file tcpipconf_notify.c.

3970{
3971 TRACE("INetCfgComponentControl_fnInitialize()\n");
3973 HRESULT hr;
3974
3975 This->pNCfg = pINetCfg;
3976 This->pNComp = pIComp;
3977
3978 hr = Initialize(This);
3979 if (FAILED(hr))
3980 {
3981 ERR("INetCfgComponentControl_fnInitialize failed\n");
3982 return hr;
3983 }
3984
3985 TRACE("INetCfgComponentControl_fnInitialize success\n");
3986
3987 return S_OK;
3988}
#define ERR(fmt,...)
Definition: precomp.h:57
#define FAILED(hr)
Definition: intsafe.h:51
static void Initialize()
Definition: xlate.c:212

◆ INetCfgComponentControl_fnQueryInterface()

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

Definition at line 3895 of file tcpipconf_notify.c.

3899{
3900 TRACE("INetCfgComponentControl_fnQueryInterface()\n");
3902
3903 *ppvObj = NULL;
3904
3905 if (IsEqualIID (iid, &IID_IUnknown) ||
3907 {
3908 *ppvObj = This;
3910 return S_OK;
3911 }
3913 {
3914 *ppvObj = (LPVOID*)&This->lpVtblCompPropertyUi;
3916 return S_OK;
3917 }
3918 else if (IsEqualIID(iid, &IID_INetCfgComponentSetup))
3919 {
3920 *ppvObj = (LPVOID*)&This->lpVtblCompSetup;
3922 return S_OK;
3923 }
3924 else if (IsEqualIID(iid, &IID_ITcpipProperties))
3925 {
3926 *ppvObj = (LPVOID*)&This->lpVtblTcpipProperties;
3928 return S_OK;
3929 }
3930
3931 return E_NOINTERFACE;
3932}
const GUID IID_IUnknown
EXTERN_C const IID IID_INetCfgComponentPropertyUi
Definition: netcfgn.h:88
EXTERN_C const IID IID_INetCfgComponentControl
Definition: netcfgn.h:57
EXTERN_C const IID IID_INetCfgComponentSetup
Definition: netcfgn.h:165
#define INetCfgComponentControl_AddRef(p)
Definition: netcfgn.h:49
EXTERN_C const IID IID_ITcpipProperties
Definition: netcfgn_undoc.h:24
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ INetCfgComponentControl_fnRelease()

ULONG WINAPI INetCfgComponentControl_fnRelease ( INetCfgComponentControl *  iface)

Definition at line 3948 of file tcpipconf_notify.c.

3950{
3951 TRACE("INetCfgComponentControl_fnRelease()\n");
3953 ULONG refCount = InterlockedDecrement(&This->ref);
3954
3955 if (!refCount)
3956 {
3959 }
3960 return refCount;
3961}
#define InterlockedDecrement
Definition: armddk.h:52
VOID FreeSettings(TcpipConfNotifyImpl *This)

◆ INetCfgComponentPropertyUi_fnAddRef()

ULONG WINAPI INetCfgComponentPropertyUi_fnAddRef ( INetCfgComponentPropertyUi *  iface)

Definition at line 3398 of file tcpipconf_notify.c.

3400{
3401 TRACE("INetCfgComponentPropertyUi_fnAddRef()\n");
3403 return INetCfgComponentControl_AddRef((INetCfgComponentControl*)This);
3404}
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentPropertyUi(INetCfgComponentPropertyUi *iface)

◆ INetCfgComponentPropertyUi_fnApplyProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnApplyProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3860 of file tcpipconf_notify.c.

3862{
3863 TRACE("INetCfgComponentPropertyUi_fnApplyProperties()\n");
3864 return S_OK;
3865}

◆ INetCfgComponentPropertyUi_fnCancelProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnCancelProperties ( INetCfgComponentPropertyUi *  iface)

Definition at line 3869 of file tcpipconf_notify.c.

3871{
3872 TRACE("INetCfgComponentPropertyUi_fnCancelProperties()\n");
3873 return S_OK;
3874}

◆ INetCfgComponentPropertyUi_fnMergePropPages()

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

Definition at line 3803 of file tcpipconf_notify.c.

3810{
3811 TRACE("INetCfgComponentPropertyUi_fnMergePropPages()\n");
3812 HPROPSHEETPAGE * hppages;
3813 UINT NumPages;
3815
3816 if (This->pCurrentAdapter->NewDhcpEnabled)
3817 NumPages = 2;
3818 else
3819 NumPages = 1;
3820
3821 hppages = (HPROPSHEETPAGE*) CoTaskMemAlloc(sizeof(HPROPSHEETPAGE) * NumPages);
3822 if (!hppages)
3823 return E_FAIL;
3824
3826 if (!hppages[0])
3827 {
3828 CoTaskMemFree(hppages);
3829 return E_FAIL;
3830 }
3831 if (NumPages == 2)
3832 {
3834 if (!hppages[1])
3835 {
3836 DestroyPropertySheetPage(hppages[0]);
3837 CoTaskMemFree(hppages);
3838 return E_FAIL;
3839 }
3840 }
3841
3842 *pahpspPrivate = (BYTE*)hppages;
3843 *pcPages = NumPages;
3844
3845 return S_OK;
3846}
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3155
#define IDD_TCPIP_BASIC_DLG
Definition: resource.h:8
INT_PTR CALLBACK TcpipBasicDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
unsigned char BYTE
Definition: xxhash.c:193

◆ INetCfgComponentPropertyUi_fnQueryInterface()

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

Definition at line 3386 of file tcpipconf_notify.c.

3390{
3391 TRACE("INetCfgComponentPropertyUi_fnQueryInterface()\n");
3393 return INetCfgComponentControl_QueryInterface((INetCfgComponentControl*)This, iid, ppvObj);
3394}
#define INetCfgComponentControl_QueryInterface(p, a, b)
Definition: netcfgn.h:48

◆ INetCfgComponentPropertyUi_fnQueryPropertyUi()

HRESULT WINAPI INetCfgComponentPropertyUi_fnQueryPropertyUi ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 3418 of file tcpipconf_notify.c.

3421{
3422 TRACE("INetCfgComponentPropertyUi_fnQueryPropertyUi()\n");
3423 return S_OK;
3424}

◆ INetCfgComponentPropertyUi_fnRelease()

ULONG WINAPI INetCfgComponentPropertyUi_fnRelease ( INetCfgComponentPropertyUi *  iface)

Definition at line 3408 of file tcpipconf_notify.c.

3410{
3411 TRACE("INetCfgComponentPropertyUi_fnRelease()\n");
3413 return INetCfgComponentControl_Release((INetCfgComponentControl*)This);
3414}
#define INetCfgComponentControl_Release(p)
Definition: netcfgn.h:50

◆ INetCfgComponentPropertyUi_fnSetContext()

HRESULT WINAPI INetCfgComponentPropertyUi_fnSetContext ( INetCfgComponentPropertyUi *  iface,
IUnknown pUnkReserved 
)

Definition at line 3428 of file tcpipconf_notify.c.

3431{
3432 TRACE("INetCfgComponentPropertyUi_fnSetContext()\n");
3433 INetLanConnectionUiInfo * pLanInfo;
3434 GUID Guid;
3435 LPOLESTR pAdapterName = NULL;
3436 AdapterSettings *pAdapter = NULL;
3437 HRESULT hr;
3439
3440 if (!iface || !pUnkReserved)
3441 return E_POINTER;
3442
3443 if (pUnkReserved)
3444 {
3445 hr = IUnknown_QueryInterface(pUnkReserved, &IID_INetLanConnectionUiInfo, (LPVOID*)&pLanInfo);
3446 if (FAILED(hr))
3447 return hr;
3448
3450
3451 IUnknown_Release(pUnkReserved);
3452
3453 StringFromCLSID(&Guid, &pAdapterName);
3454
3455 pAdapter = This->pAdapterListHead;
3456 while (pAdapter)
3457 {
3458 if (!_wcsicmp(pAdapter->AdapterName, pAdapterName))
3459 {
3460 This->pCurrentAdapter = pAdapter;
3461 break;
3462 }
3463 pAdapter = pAdapter->pNext;
3464 }
3465
3466 CoTaskMemFree(pAdapterName);
3467 }
3468 else
3469 {
3470 This->pCurrentAdapter = NULL;
3471 }
3472
3473 This->pUnknown = pUnkReserved;
3474
3475 return S_OK;
3476}
HRESULT WINAPI StringFromCLSID(REFCLSID clsid, LPOLESTR *str)
Definition: combase.c:1515
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
static IUnknown * pUnkReserved
Definition: asmenum.c:33
EXTERN_C const IID IID_INetLanConnectionUiInfo
Definition: netcfgn.h:234
#define INetLanConnectionUiInfo_GetDeviceGuid(p, a)
Definition: netcfgn.h:231
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
#define E_POINTER
Definition: winerror.h:3480

◆ INetCfgComponentPropertyUi_fnValidateProperties()

HRESULT WINAPI INetCfgComponentPropertyUi_fnValidateProperties ( INetCfgComponentPropertyUi *  iface,
HWND  hwndDlg 
)

Definition at line 3850 of file tcpipconf_notify.c.

3853{
3854 TRACE("INetCfgComponentPropertyUi_fnValidateProperties()\n");
3855 return S_OK;
3856}

◆ INetCfgComponentSetup_fnAddRef()

ULONG WINAPI INetCfgComponentSetup_fnAddRef ( INetCfgComponentSetup *  iface)

Definition at line 4443 of file tcpipconf_notify.c.

4445{
4446 TRACE("INetCfgComponentSetup_fnAddRef()\n");
4448 return INetCfgComponentControl_AddRef((INetCfgComponentControl*)This);
4449}
static __inline LPTcpipConfNotifyImpl impl_from_INetCfgComponentSetup(INetCfgComponentSetup *iface)

◆ INetCfgComponentSetup_fnInstall()

HRESULT WINAPI INetCfgComponentSetup_fnInstall ( INetCfgComponentSetup *  iface,
DWORD  dwSetupFlags 
)

Definition at line 4463 of file tcpipconf_notify.c.

4466{
4467 TRACE("INetCfgComponentSetup_fnInstall()\n");
4468 return S_OK;
4469}

◆ INetCfgComponentSetup_fnQueryInterface()

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

Definition at line 4431 of file tcpipconf_notify.c.

4435{
4436 TRACE("INetCfgComponentSetup_fnQueryInterface()\n");
4438 return INetCfgComponentControl_QueryInterface((INetCfgComponentControl*)This, iid, ppvObj);
4439}

◆ INetCfgComponentSetup_fnReadAnswerFile()

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

Definition at line 4484 of file tcpipconf_notify.c.

4488{
4489 TRACE("INetCfgComponentSetup_fnReadAnswerFile()\n");
4490 return S_OK;
4491}

◆ INetCfgComponentSetup_fnRelease()

ULONG WINAPI INetCfgComponentSetup_fnRelease ( INetCfgComponentSetup *  iface)

Definition at line 4453 of file tcpipconf_notify.c.

4455{
4456 TRACE("INetCfgComponentSetup_fnRelease()\n");
4458 return INetCfgComponentControl_Release((INetCfgComponentControl*)This);
4459}

◆ INetCfgComponentSetup_fnRemoving()

HRESULT WINAPI INetCfgComponentSetup_fnRemoving ( INetCfgComponentSetup *  iface)

Definition at line 4495 of file tcpipconf_notify.c.

4497{
4498 TRACE("INetCfgComponentSetup_fnRemoving()\n");
4499 return S_OK;
4500}

◆ INetCfgComponentSetup_fnUpgrade()

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

Definition at line 4473 of file tcpipconf_notify.c.

4477{
4478 TRACE("INetCfgComponentSetup_fnUpgrade()\n");
4479 return S_OK;
4480}

◆ InitFilterListBox()

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

Definition at line 590 of file tcpipconf_notify.c.

591{
592 LVITEMW li;
593 LPWSTR pCur;
594 INT iItem;
595
596 if (!pData || !_wtoi(pData))
597 {
598 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
600 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
601 return;
602 }
603
604 pCur = pData;
605 memset(&li, 0x0, sizeof(LVITEMW));
606 li.mask = LVIF_TEXT;
607 iItem = 0;
608
609 while(pCur[0])
610 {
611 li.pszText = pCur;
612 li.iItem = iItem;
613 SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
614 iItem++;
615 pCur += wcslen(pCur) + 1;
616 }
617
618 if (!iItem)
619 CheckDlgButton(hwndDlg, AllowButton, BST_CHECKED);
620 else
621 CheckDlgButton(hwndDlg, RestrictButton, BST_CHECKED);
622}
static void AddButton(HWND hwndToolBar, int nImage, int nCommand)
Definition: wordpad.c:155
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by TcpipFilterSettingsDlg().

◆ Initialize()

HRESULT Initialize ( TcpipConfNotifyImpl This)

Definition at line 3746 of file tcpipconf_notify.c.

3747{
3748 DWORD dwSize;
3749 WCHAR szBuffer[50];
3750 IP_ADAPTER_INFO *pCurrentAdapter;
3751 IP_ADAPTER_INFO *pInfo = NULL;
3752 HRESULT hr = S_OK;
3753
3754 if (This->pAdapterListHead)
3755 return S_OK;
3756
3757 dwSize = 0;
3759 return E_FAIL;
3760
3761 pInfo = CoTaskMemAlloc(dwSize);
3762 if (!pInfo)
3763 return E_FAIL;
3764
3765 if (GetAdaptersInfo(pInfo, &dwSize) != ERROR_SUCCESS)
3766 {
3767 CoTaskMemFree(pInfo);
3768 return E_FAIL;
3769 }
3770
3772
3773 pCurrentAdapter = pInfo;
3774 while (pCurrentAdapter)
3775 {
3776 szBuffer[0] = L'\0';
3777 if (MultiByteToWideChar(CP_ACP, 0, pCurrentAdapter->AdapterName, -1, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0])))
3778 {
3779 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
3780 }
3781
3782 TRACE("Adapter: %S\n", szBuffer);
3783
3785 szBuffer,
3786 pCurrentAdapter);
3787
3788 pCurrentAdapter = pCurrentAdapter->Next;
3789 }
3790
3791 CoTaskMemFree(pInfo);
3792
3793 if (FAILED(hr))
3794 {
3796 }
3797
3798 return hr;
3799}
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
struct _IP_ADAPTER_INFO * Next
Definition: iptypes.h:42
char AdapterName[MAX_ADAPTER_NAME_LENGTH+4]
Definition: iptypes.h:44
HRESULT LoadAdapterSettings(TcpipConfNotifyImpl *This, LPOLESTR pAdapterName, IP_ADAPTER_INFO *pAdapterInfo)
HRESULT LoadTcpipSettings(TcpipConfNotifyImpl *This)
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:307

◆ InitializePropertySheetPage()

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

Definition at line 867 of file tcpipconf_notify.c.

868{
869 PROPSHEETPAGEW ppage;
870
871 memset(&ppage, 0x0, sizeof(PROPSHEETPAGEW));
872 ppage.dwSize = sizeof(PROPSHEETPAGEW);
873 ppage.dwFlags = PSP_DEFAULT;
874 ppage.u.pszTemplate = resname;
875 ppage.pfnDlgProc = dlgproc;
876 ppage.lParam = lParam;
878 if (szTitle)
879 {
880 ppage.dwFlags |= PSP_USETITLE;
881 ppage.pszTitle = szTitle;
882 }
883 return CreatePropertySheetPageW(&ppage);
884}
LPARAM lParam
Definition: combotst.c:139
HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage)
Definition: propsheet.c:3086
#define PSP_USETITLE
Definition: prsht.h:26
#define PSP_DEFAULT
Definition: prsht.h:22
struct _PROPSHEETPAGEW PROPSHEETPAGEW
DLGPROC pfnDlgProc
Definition: prsht.h:226
DWORD dwSize
Definition: prsht.h:214
DWORD dwFlags
Definition: prsht.h:215
LPARAM lParam
Definition: prsht.h:227
LPCWSTR pszTemplate
Definition: prsht.h:218
LPCWSTR pszTitle
Definition: prsht.h:225
HINSTANCE hInstance
Definition: prsht.h:216

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

◆ InitializeTcpipAdvancedDNSDlg()

VOID InitializeTcpipAdvancedDNSDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 1948 of file tcpipconf_notify.c.

1951{
1952 WCHAR szBuffer[200];
1953 LPWSTR pFirst, pSep, pList;
1954 IP_ADDR * pAddr;
1955 DWORD dwIpAddr;
1956
1957 /* insert DNS addresses */
1958 pAddr = This->pCurrentAdapter->NewNs;
1959 while(pAddr)
1960 {
1961 dwIpAddr = pAddr->IpAddress;
1962 _swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1963 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1964
1965 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_ADDSTRING, 0, (LPARAM)szBuffer);
1966 pAddr = pAddr->Next;
1967 }
1969
1970 if (This->pCurrentAdapter->NewRegisterAdapterName)
1972 else
1974
1975 if (This->pCurrentAdapter->NewRegistrationEnabled)
1977
1978 if (This->pCurrentAdapter->szDomain[0])
1979 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)szBuffer);
1980
1981 if (This->pTcpIpSettings->UseDomainNameDevolution)
1983
1984 if (!This->pTcpIpSettings->szSearchList || (wcslen(This->pTcpIpSettings->szSearchList) == 0))
1985 {
1988
1989 return;
1990 }
1991
1992 pList = This->pTcpIpSettings->szSearchList;
1993 if (wcslen(pList))
1994 {
1995 pFirst = pList;
1996 do
1997 {
1998 pSep = wcschr(pFirst, L',');
1999 if (pSep)
2000 {
2001 pSep[0] = L'\0';
2003 pFirst = pSep + 1;
2004 pSep[0] = L',';
2005 }
2006 else
2007 {
2009 break;
2010 }
2011 }while(TRUE);
2012
2016 }
2017}
#define IDC_DNSSUFFIXLIST
Definition: resource.h:66
#define IDC_SUFFIX
Definition: resource.h:72
#define IDC_USESUFFIX
Definition: resource.h:74
#define IDC_REGSUFFIX
Definition: resource.h:73
#define IDC_PRIMSUFFIX
Definition: resource.h:63
#define IDC_SELSUFFIX
Definition: resource.h:65
#define IDC_DNSADDRLIST
Definition: resource.h:57
#define IDC_TOPPRIMSUFFIX
Definition: resource.h:64
#define IDC_DNSSUFFIXADD
Definition: resource.h:69
FxChildList * pList
#define LB_ADDSTRING
Definition: winuser.h:2060
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1645
#define LB_SETCURSEL
Definition: winuser.h:2099

Referenced by TcpipAdvancedDnsDlg().

◆ InitializeTcpipAdvancedIpDlg()

VOID InitializeTcpipAdvancedIpDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 1023 of file tcpipconf_notify.c.

1026{
1027 RECT rect;
1028 LVITEMW li;
1029 WCHAR szBuffer[100];
1030
1034
1035 if (This->pCurrentAdapter->NewDhcpEnabled)
1036 {
1037 if (LoadStringW(netcfgx_hInstance, IDS_DHCPACTIVE, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1038 {
1039 ZeroMemory(&li, sizeof(LVITEMW));
1040 li.mask = LVIF_TEXT;
1041 li.pszText = szBuffer;
1043 }
1045 }
1046 else
1047 {
1048 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_IPLIST), This->pCurrentAdapter->NewIp, TRUE);
1049 }
1050
1053
1057
1058 InsertIpAddressToListView(GetDlgItem(hwndDlg, IDC_GWLIST), This->pCurrentAdapter->NewGw, FALSE);
1059
1062
1064 if (This->pCurrentAdapter->NewMetric)
1065 {
1067 SetDlgItemInt(hwndDlg, IDC_IFMETRIC, This->pCurrentAdapter->NewMetric, FALSE);
1068 }
1069 else
1070 {
1073 }
1074}
RECT rect
Definition: combotst.c:67
#define IDS_METRIC
Definition: resource.h:77
#define IDC_IPDEL
Definition: resource.h:45
#define IDC_GWDEL
Definition: resource.h:49
#define IDS_SUBMASK
Definition: resource.h:113
#define IDC_IPLIST
Definition: resource.h:42
#define IDC_GWMOD
Definition: resource.h:48
#define IDS_DHCPACTIVE
Definition: resource.h:116
#define IDS_GATEWAY
Definition: resource.h:114
#define IDC_IPADD
Definition: resource.h:43
#define IDC_IPMOD
Definition: resource.h:44
#define IDS_IPADDR
Definition: resource.h:112
#define IDC_IFAUTOMETRIC
Definition: resource.h:50
#define IDC_GWLIST
Definition: resource.h:46
#define IDC_IFMETRIC
Definition: resource.h:51
LONG right
Definition: windef.h:108
LONG left
Definition: windef.h:106
VOID InsertIpAddressToListView(HWND hDlgCtrl, IP_ADDR *pAddr, BOOL bSubMask)
VOID InsertColumnToListView(HWND hDlgCtrl, UINT ResId, UINT SubItem, UINT Size)
#define EM_LIMITTEXT
Definition: winuser.h:2029
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)

Referenced by TcpipAdvancedIpDlg().

◆ InitializeTcpipAdvancedOptDlg()

VOID InitializeTcpipAdvancedOptDlg ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 892 of file tcpipconf_notify.c.

895{
896 WCHAR szText[500];
897 /* store context */
899
900 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTER, szText, sizeof(szText)/sizeof(WCHAR)))
901 {
902 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
903 if (SendDlgItemMessageW(hwndDlg, IDC_OPTLIST, LB_ADDSTRING, 0, (LPARAM)szText) != LB_ERR)
905 }
906
907 if (LoadStringW(netcfgx_hInstance, IDS_TCPFILTERDESC, szText, sizeof(szText)/sizeof(WCHAR)))
908 {
909 szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0';
910 SendDlgItemMessageW(hwndDlg, IDC_OPTDESC, WM_SETTEXT, 0, (LPARAM)szText);
911 }
912}
#define IDS_TCPFILTERDESC
Definition: resource.h:110
#define IDC_OPTLIST
Definition: resource.h:76
#define IDS_TCPFILTER
Definition: resource.h:111
#define IDC_OPTDESC
Definition: resource.h:78
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_USER
Definition: winuser.h:883

Referenced by TcpipAdvancedOptDlg().

◆ InitializeTcpipAltDlgCtrls()

HRESULT InitializeTcpipAltDlgCtrls ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2584 of file tcpipconf_notify.c.

2587{
2592
2597
2602
2607
2612
2613 if (This->pCurrentAdapter->AltConfig.IpAddress == 0)
2614 {
2621 }
2622 else
2623 {
2625
2626 /* Set ip address */
2627 if (This->pCurrentAdapter->AltConfig.IpAddress)
2628 SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->AltConfig.IpAddress);
2629
2630 /* Set subnet mask */
2631 if (This->pCurrentAdapter->AltConfig.SubnetMask)
2632 SendDlgItemMessageW(hwndDlg, IDC_ALTSUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->AltConfig.SubnetMask);
2633
2634 /* Set default gateway */
2635 if (This->pCurrentAdapter->AltConfig.DefaultGateway)
2636 SendDlgItemMessageW(hwndDlg, IDC_ALTDEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->AltConfig.DefaultGateway);
2637
2638 /* Set primary dns server */
2639 if (This->pCurrentAdapter->AltConfig.DnsServer1)
2640 SendDlgItemMessageW(hwndDlg, IDC_ALTDNS1, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->AltConfig.DnsServer1);
2641
2642 /* Set secondary dns server */
2643 if (This->pCurrentAdapter->AltConfig.DnsServer2)
2644 SendDlgItemMessageW(hwndDlg, IDC_ALTDNS2, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->AltConfig.DnsServer2);
2645 }
2646
2647 return S_OK;
2648}
#define IDC_ALTDNS2
Definition: resource.h:40
#define IDC_ALTSTATIC
Definition: resource.h:35
#define IDC_ALTIPADDR
Definition: resource.h:36
#define IDC_ALTDNS1
Definition: resource.h:39
#define IDC_ALTAPIPA
Definition: resource.h:34
#define IDC_ALTSUBNETMASK
Definition: resource.h:37
#define IDC_ALTDEFGATEWAY
Definition: resource.h:38
#define MAKEIPRANGE(low, high)
Definition: commctrl.h:4489
#define IPM_SETADDRESS
Definition: commctrl.h:4471
#define IPM_SETRANGE
Definition: commctrl.h:4473
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)

Referenced by TcpipAltConfDlg().

◆ InitializeTcpipBasicDlgCtrls()

HRESULT InitializeTcpipBasicDlgCtrls ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2931 of file tcpipconf_notify.c.

2934{
2939
2944
2949
2954
2959
2960 if (This->pCurrentAdapter == NULL)
2961 return E_FAIL;
2962
2963 if (This->pCurrentAdapter->NewDhcpEnabled)
2964 {
2970 }
2971 else
2972 {
2974
2975 if (This->pCurrentAdapter->NewIp)
2976 {
2977 /* set current ip address */
2978 SendDlgItemMessageA(hwndDlg, IDC_IPADDR, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->NewIp->IpAddress);
2979 /* set current hostmask */
2980 SendDlgItemMessageA(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->NewIp->u.SubnetMask);
2981 }
2982
2983 if (This->pCurrentAdapter->NewGw && This->pCurrentAdapter->NewGw->IpAddress)
2984 {
2985 /* set current gateway */
2986 SendDlgItemMessageA(hwndDlg, IDC_DEFGATEWAY, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->NewGw->IpAddress);
2987 }
2988 }
2989
2990 if (This->pCurrentAdapter->DnsDhcpEnabled)
2991 {
2995 }
2996 else
2997 {
3001 if (This->pCurrentAdapter->NewNs)
3002 {
3003 SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->NewNs->IpAddress);
3004 if (This->pCurrentAdapter->NewNs->Next)
3005 {
3006 SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_SETADDRESS, 0, (LPARAM)This->pCurrentAdapter->NewNs->Next->IpAddress);
3007 }
3008 else
3009 {
3011 }
3012 }
3013 else
3014 {
3017 }
3018 }
3019
3020 return S_OK;
3021}
#define IDC_NODHCP
Definition: resource.h:24
#define IDC_DNS1
Definition: resource.h:30
#define IDC_USEDHCP
Definition: resource.h:23
#define IDC_SUBNETMASK
Definition: resource.h:26
#define IDC_FIXEDDNS
Definition: resource.h:29
#define IDC_AUTODNS
Definition: resource.h:28
#define IDC_DNS2
Definition: resource.h:31
#define IDC_DEFGATEWAY
Definition: resource.h:27
#define IDC_IPADDR
Definition: resource.h:25
#define IPM_CLEARADDRESS
Definition: commctrl.h:4470
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ InsertColumnToListView()

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

Definition at line 950 of file tcpipconf_notify.c.

955{
956 WCHAR szBuffer[200];
957 LVCOLUMNW lc;
958
959 if (!LoadStringW(netcfgx_hInstance, ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
960 return;
961
962 memset(&lc, 0, sizeof(LV_COLUMN) );
964 lc.iSubItem = SubItem;
965 lc.fmt = LVCFMT_FIXED_WIDTH;
966 lc.cx = Size;
967 lc.cchTextMax = wcslen(szBuffer);
968 lc.pszText = szBuffer;
969
970 (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, SubItem, (LPARAM)&lc);
971}
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2637
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCF_SUBITEM
Definition: commctrl.h:2594
#define LVCF_TEXT
Definition: commctrl.h:2593
#define LV_COLUMN
Definition: commctrl.h:2552
int cchTextMax
Definition: commctrl.h:2573
LPWSTR pszText
Definition: commctrl.h:2572

Referenced by InitializeTcpipAdvancedIpDlg(), and TcpipFilterSettingsDlg().

◆ InsertIpAddressToListView()

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

Definition at line 974 of file tcpipconf_notify.c.

978{
979 WCHAR szBuffer[70];
980 DWORD dwIpAddr;
981 UINT itemCount = 0;
982 LVITEMW li;
983
984 while(pAddr)
985 {
986 ZeroMemory(&li, sizeof(li));
987 li.mask = LVIF_TEXT;
988 li.iItem = itemCount;
989 li.iSubItem = 0;
990 dwIpAddr = pAddr->IpAddress;
991 _swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
992 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
993
994 li.pszText = szBuffer;
995 li.iItem = SendMessageW(hDlgCtrl, LVM_INSERTITEMW, 0, (LPARAM)&li);
996 if (li.iItem != -1)
997 {
998 if (bSubMask)
999 {
1000 dwIpAddr = pAddr->u.SubnetMask;
1001 _swprintf(szBuffer, L"%lu.%lu.%lu.%lu",
1002 FIRST_IPADDRESS(dwIpAddr), SECOND_IPADDRESS(dwIpAddr), THIRD_IPADDRESS(dwIpAddr), FOURTH_IPADDRESS(dwIpAddr));
1003 }
1004 else
1005 {
1006 if (pAddr->u.Metric)
1007 _swprintf(szBuffer, L"%u", pAddr->u.Metric);
1008 else
1009 LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR));
1010 }
1011
1012 li.mask = LVIF_TEXT;
1013 li.iSubItem = 1;
1014 li.pszText = szBuffer;
1015 SendMessageW(hDlgCtrl, LVM_SETITEMW, 0, (LPARAM)&li);
1016 }
1017 itemCount++;
1018 pAddr = pAddr->Next;
1019 }
1020}
#define IDS_AUTOMATIC
Definition: resource.h:117
#define LVM_SETITEMW
Definition: commctrl.h:2402

Referenced by InitializeTcpipAdvancedIpDlg().

◆ IpAddressesChanged()

static BOOL IpAddressesChanged ( AdapterSettings pAdapter)
static

Definition at line 3284 of file tcpipconf_notify.c.

3286{
3287 IP_ADDR *pNew, *pOld;
3288 BOOL Changed = FALSE;
3289
3290 pNew = pAdapter->NewIp;
3291 pOld = pAdapter->OldIp;
3292 while (pNew && pOld)
3293 {
3294 if ((pNew->IpAddress != pOld->IpAddress) ||
3295 (pNew->u.SubnetMask != pOld->u.SubnetMask))
3296 {
3297 Changed = TRUE;
3298 break;
3299 }
3300
3301 pNew = pNew->Next;
3302 pOld = pOld->Next;
3303 }
3304
3305 if (Changed == FALSE)
3306 {
3307 if (((pNew == NULL) && (pOld != NULL)) ||
3308 ((pNew != NULL) && (pOld == NULL)))
3309 Changed = TRUE;
3310 }
3311
3312 return Changed;
3313}

Referenced by INetCfgComponentControl_fnApplyPnpChanges(), and INetCfgComponentControl_fnApplyRegistryChanges().

◆ ITcpipProperties_fnAddRef()

ULONG WINAPI ITcpipProperties_fnAddRef ( ITcpipProperties *  iface)

Definition at line 4532 of file tcpipconf_notify.c.

4534{
4535 TRACE("ITcpipProperties_fnAddRef()\n");
4537 return INetCfgComponentControl_AddRef((INetCfgComponentControl*)This);
4538}
static __inline LPTcpipConfNotifyImpl impl_from_ITcpipProperties(ITcpipProperties *iface)

◆ ITcpipProperties_fnQueryInterface()

HRESULT WINAPI ITcpipProperties_fnQueryInterface ( ITcpipProperties *  iface,
REFIID  iid,
LPVOID ppvObj 
)

Definition at line 4520 of file tcpipconf_notify.c.

4524{
4525 TRACE("ITcpipProperties_fnQueryInterface()\n");
4527 return INetCfgComponentControl_QueryInterface((INetCfgComponentControl*)This, iid, ppvObj);
4528}

◆ ITcpipProperties_fnRelease()

ULONG WINAPI ITcpipProperties_fnRelease ( ITcpipProperties *  iface)

Definition at line 4542 of file tcpipconf_notify.c.

4544{
4545 TRACE("ITcpipProperties_fnRelease()\n");
4547 return INetCfgComponentControl_Release((INetCfgComponentControl*)This);
4548}

◆ ITcpipProperties_fnUnknown1()

HRESULT WINAPI ITcpipProperties_fnUnknown1 ( ITcpipProperties *  iface,
GUID pAdapterName,
PTCPIP_PROPERTIES ppProperties 
)

Definition at line 4552 of file tcpipconf_notify.c.

4556{
4557 AdapterSettings *pAdapter;
4558 PTCPIP_PROPERTIES pProperties;
4559 PWSTR pszIpAddress = NULL;
4560 PWSTR pszSubnetMask = NULL;
4561 PWSTR pszParameters = NULL;
4562 PWSTR pPtr;
4563 DWORD dwSize;
4564 HRESULT hr = S_OK;
4565
4566 ERR("ITcpipProperties_fnUnknown1(%s %p)\n", wine_dbgstr_guid(pAdapterName), ppProperties);
4568
4569 pAdapter = GetAdapterByGuid(This, pAdapterName);
4570 if (pAdapter == NULL)
4571 return E_FAIL;
4572
4573 /* Build the IpAddress string */
4574 hr = BuildIpAddressString(pAdapter, &pszIpAddress);
4575 if (FAILED(hr))
4576 goto done;
4577
4578 TRACE("IpAddress string: %S\n", pszIpAddress);
4579
4580 /* Build the Parameters string */
4581 hr = BuildSubnetMaskString(pAdapter, &pszSubnetMask);
4582 if (FAILED(hr))
4583 goto done;
4584
4585 TRACE("SubnetMask string: %S\n", pszSubnetMask);
4586
4587 /* Build the Parameters string */
4588 hr = BuildParametersString(pAdapter, &pszParameters);
4589 if (FAILED(hr))
4590 goto done;
4591
4592 TRACE("Parameters string: %S\n", pszParameters);
4593
4594 dwSize = sizeof(TCPIP_PROPERTIES) +
4595 ((wcslen(pszIpAddress) + 1) * sizeof(WCHAR)) +
4596 ((wcslen(pszSubnetMask) + 1) * sizeof(WCHAR)) +
4597 ((wcslen(pszParameters) + 1) * sizeof(WCHAR));
4598
4599 pProperties = CoTaskMemAlloc(dwSize);
4600 if (pProperties == NULL)
4601 {
4602 hr = E_OUTOFMEMORY;
4603 goto done;
4604 }
4605
4606 ZeroMemory(pProperties, dwSize);
4607
4608 pProperties->dwDhcp = (pAdapter->NewDhcpEnabled) ? DWORD_MAX : 0;
4609
4610 pPtr = (PWSTR)(pProperties + 1);
4611
4612 pProperties->pszIpAddress = pPtr;
4613 wcscpy(pProperties->pszIpAddress, pszIpAddress);
4614 pPtr += (wcslen(pszIpAddress) + 1);
4615
4616 pProperties->pszSubnetMask = pPtr;
4617 wcscpy(pProperties->pszSubnetMask, pszSubnetMask);
4618 pPtr += (wcslen(pszSubnetMask) + 1);
4619
4620 pProperties->pszParameters = pPtr;
4621 wcscpy(pProperties->pszParameters, pszParameters);
4622
4623 *ppProperties = pProperties;
4624
4625done:
4626 if (pszIpAddress)
4627 CoTaskMemFree(pszIpAddress);
4628
4629 if (pszSubnetMask)
4630 CoTaskMemFree(pszSubnetMask);
4631
4632 if (pszParameters)
4633 CoTaskMemFree(pszParameters);
4634
4635 return hr;
4636}
#define DWORD_MAX
Definition: cfgmgr32.h:61
struct _TCPIP_PROPERTIES TCPIP_PROPERTIES
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:171
static HRESULT BuildIpAddressString(AdapterSettings *pAdapter, LPWSTR *ppszIpAddress)
static HRESULT BuildParametersString(AdapterSettings *pAdapter, LPWSTR *ppszParameters)
static HRESULT BuildSubnetMaskString(AdapterSettings *pAdapter, LPWSTR *ppszSubnetMask)
static AdapterSettings * GetAdapterByGuid(TcpipConfNotifyImpl *This, GUID *pAdapterGuid)

◆ LaunchAdvancedTcpipSettings()

VOID LaunchAdvancedTcpipSettings ( HWND  hwndDlg,
TcpipConfNotifyImpl This 
)

Definition at line 2478 of file tcpipconf_notify.c.

2481{
2482 PROPSHEETHEADERW pinfo;
2483 HPROPSHEETPAGE hppages[3];
2484 WCHAR szBuffer[100];
2485
2489
2490
2491 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
2492 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
2493 else
2494 szBuffer[0] = L'\0';
2495
2496 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
2497 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
2498 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
2500 pinfo.u3.phpage = hppages;
2501 pinfo.nPages = 3;
2502 pinfo.hwndParent = hwndDlg;
2504 pinfo.pszCaption = szBuffer;
2506 pinfo.pfnCallback = PropSheetProc;
2507
2509 if (PropertySheetW(&pinfo) > 0)
2510 {
2512 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2513 }
2514}
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
#define IDD_TCPIP_ADVOPT_DLG
Definition: resource.h:12
#define IDD_TCPIP_ADVIP_DLG
Definition: resource.h:10
#define IDD_TCPIP_ADVDNS_DLG
Definition: resource.h:11
#define IDI_NETWORK
Definition: resource.h:4
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSH_USEICONID
Definition: prsht.h:42
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
LPCWSTR pszIcon
Definition: prsht.h:299
HWND hwndParent
Definition: prsht.h:295
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
LPCWSTR pszCaption
Definition: prsht.h:301
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
INT_PTR CALLBACK TcpipAdvancedDnsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HRESULT InitializeTcpipBasicDlgCtrls(HWND hwndDlg, TcpipConfNotifyImpl *This)
INT_PTR CALLBACK TcpipAdvancedOptDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
INT_PTR StoreTcpipBasicSettings(HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)
INT_PTR CALLBACK TcpipAdvancedIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
HWND WINAPI GetParent(_In_ HWND)

Referenced by TcpipBasicDlg().

◆ LoadAdapterSettings()

HRESULT LoadAdapterSettings ( TcpipConfNotifyImpl This,
LPOLESTR  pAdapterName,
IP_ADAPTER_INFO pAdapterInfo 
)

Definition at line 3644 of file tcpipconf_notify.c.

3648{
3649 AdapterSettings *pAdapter;
3650 HKEY hAdapterKey = NULL, hConfigKey;
3651 WCHAR szKeyName[200];
3652 DWORD dwSize;
3653 HRESULT hr = S_OK;
3654
3655 pAdapter = (AdapterSettings*)CoTaskMemAlloc(sizeof(AdapterSettings));
3656 if (!pAdapter)
3657 return E_FAIL;
3658
3659 ZeroMemory(pAdapter, sizeof(AdapterSettings));
3660
3661 _swprintf(szKeyName, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces\\%s", pAdapterName);
3662 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_READ, &hAdapterKey) != ERROR_SUCCESS)
3663 {
3664 hr = E_FAIL;
3665 goto done;
3666 }
3667
3668 wcscpy(pAdapter->AdapterName, pAdapterName);
3669 CLSIDFromString(pAdapter->AdapterName, &pAdapter->AdapterGuid);
3670
3671 pAdapter->OldDhcpEnabled = pAdapterInfo->DhcpEnabled;
3672 pAdapter->NewDhcpEnabled = pAdapterInfo->DhcpEnabled;
3673 pAdapter->Index = pAdapterInfo->Index;
3674
3675 if (!pAdapterInfo->DhcpEnabled)
3676 {
3677 CopyIpAddrString(&pAdapterInfo->IpAddressList, &pAdapter->NewIp, SUBMASK, NULL);
3678 CopyIpAddrString(&pAdapterInfo->IpAddressList, &pAdapter->OldIp, SUBMASK, NULL);
3679 }
3680
3681 CopyIpAddrString(&pAdapterInfo->GatewayList, &pAdapter->NewGw, METRIC, NULL);
3682 CopyIpAddrString(&pAdapterInfo->GatewayList, &pAdapter->OldGw, METRIC, NULL);
3683
3684 ParseNameServer(hAdapterKey, pAdapter);
3685
3686 pAdapter->DnsDhcpEnabled = (pAdapter->NewDhcpEnabled && (pAdapter->NewNs == NULL));
3687
3688 /* InterfaceMetric */
3689 dwSize = sizeof(DWORD);
3690 if (RegQueryValueExW(hAdapterKey, L"InterfaceMetric", NULL, NULL, (LPBYTE)&pAdapter->NewMetric, &dwSize) != ERROR_SUCCESS)
3691 pAdapter->NewMetric = 0;
3692 pAdapter->OldMetric = pAdapter->NewMetric;
3693
3694 /* DNS */
3695 dwSize = sizeof(DWORD);
3696 RegQueryValueExW(hAdapterKey, L"RegisterAdapterName", NULL, NULL, (LPBYTE)&pAdapter->NewRegisterAdapterName, &dwSize);
3697 pAdapter->OldRegisterAdapterName = pAdapter->NewRegisterAdapterName;
3698
3699 dwSize = sizeof(DWORD);
3700 RegQueryValueExW(hAdapterKey, L"RegistrationEnabled", NULL, NULL, (LPBYTE)&pAdapter->NewRegistrationEnabled, &dwSize);
3701 pAdapter->OldRegistrationEnabled = pAdapter->NewRegistrationEnabled;
3702
3703 dwSize = sizeof(pAdapter->szDomain);
3704 RegQueryValueExW(hAdapterKey, L"Domain", NULL, NULL, (LPBYTE)pAdapter->szDomain, &dwSize);
3705
3706 /* Filter */
3707 pAdapter->szTCPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hAdapterKey, L"TCPAllowedPorts", &pAdapter->TCPSize);
3708 pAdapter->szUDPAllowedPorts = LoadTcpFilterSettingsFromRegistry(hAdapterKey, L"UDPAllowedPorts", &pAdapter->UDPSize);
3709 pAdapter->szRawIPAllowedProtocols = LoadTcpFilterSettingsFromRegistry(hAdapterKey, L"RawIPAllowedProtocols", &pAdapter->RawIPSize);
3710
3711 if (This->pAdapterListHead == NULL)
3712 {
3713 This->pAdapterListHead = pAdapter;
3714 This->pAdapterListTail = pAdapter;
3715 }
3716 else
3717 {
3718 This->pAdapterListTail->pNext = pAdapter;
3719 pAdapter->pPrev = This->pAdapterListTail;
3720 This->pAdapterListTail = pAdapter;
3721 }
3722
3723 /* Read the alternate configuration, if available */
3724 dwSize = 0;
3725 RegQueryValueExW(hAdapterKey, L"ActiveConfigurations", NULL, NULL, NULL, &dwSize);
3726 if (dwSize)
3727 {
3728 _swprintf(szKeyName, L"SYSTEM\\CurrentControlSet\\Services\\DHCP\\Configurations\\Alternate_%s", pAdapterName);
3729 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKeyName, 0, KEY_READ, &hConfigKey) == ERROR_SUCCESS)
3730 {
3732 RegQueryValueExW(hConfigKey, L"Options", NULL, NULL, (LPBYTE)&pAdapter->AltConfig, &dwSize);
3733 RegCloseKey(hConfigKey);
3734 }
3735 }
3736
3737done:
3738 if (hAdapterKey)
3739 RegCloseKey(hAdapterKey);
3740
3741 return hr;
3742}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
Definition: combase.c:1470
#define KEY_READ
Definition: nt_native.h:1026
#define DWORD
Definition: nt_native.h:44
AlternateConfiguration AltConfig
struct _AdapterSettings * pPrev
IP_ADDR_STRING IpAddressList
Definition: iptypes.h:52
IP_ADDR_STRING GatewayList
Definition: iptypes.h:53
UINT DhcpEnabled
Definition: iptypes.h:50
HRESULT ParseNameServer(HKEY hAdapterKey, AdapterSettings *pAdapter)
HRESULT CopyIpAddrString(IP_ADDR_STRING *pSrc, IP_ADDR **pTarget, COPY_TYPE Type, LPWSTR szMetric)
LPWSTR LoadTcpFilterSettingsFromRegistry(HKEY hKey, LPCWSTR szName, LPDWORD Size)

Referenced by Initialize().

◆ LoadTcpFilterSettingsFromRegistry()

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

Definition at line 3479 of file tcpipconf_notify.c.

3480{
3481 DWORD dwSize;
3482 LPWSTR pData;
3483
3485 return NULL;
3486
3488 if (!pData)
3489 return NULL;
3490
3492 {
3494 return NULL;
3495 }
3496 *Size = dwSize;
3497 return pData;
3498}
static const WCHAR szName[]
Definition: powrprof.c:45

Referenced by LoadAdapterSettings().

◆ LoadTcpipSettings()

HRESULT LoadTcpipSettings ( TcpipConfNotifyImpl This)

Definition at line 3501 of file tcpipconf_notify.c.

3503{
3504 TcpipSettings *pSettings;
3505 HKEY hKey = NULL;
3506 DWORD dwSize, dwVal;
3507 HRESULT hr = S_OK;
3508
3509 pSettings = (TcpipSettings*)CoTaskMemAlloc(sizeof(TcpipSettings));
3510 if (!pSettings)
3511 return E_FAIL;
3512
3513 ZeroMemory(pSettings, sizeof(TcpipSettings));
3514
3515 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_READ, &hKey) != ERROR_SUCCESS)
3516 {
3517 hr = E_FAIL;
3518 goto done;
3519 }
3520
3521 dwSize = sizeof(DWORD);
3522 RegQueryValueExW(hKey, L"UseDomainNameDevolution", NULL, NULL, (LPBYTE)&pSettings->UseDomainNameDevolution, &dwSize);
3523
3524 dwSize = 0;
3525 RegQueryValueExW(hKey, L"SearchList", NULL, NULL, NULL, &dwSize);
3526 if (dwSize)
3527 {
3529 if (pSettings->szSearchList)
3530 {
3531 if (RegQueryValueExW(hKey, L"SearchList", NULL, NULL, (LPBYTE)pSettings->szSearchList, &dwSize) != ERROR_SUCCESS)
3532 {
3533 CoTaskMemFree(pSettings->szSearchList);
3534 pSettings->szSearchList = NULL;
3535 }
3536 }
3537 }
3538
3539 dwSize = sizeof(DWORD);
3540 if (RegQueryValueExW(hKey, L"EnableSecurityFilters", NULL, NULL, (LPBYTE)&dwVal, &dwSize) == ERROR_SUCCESS)
3541 pSettings->EnableSecurityFilters = dwVal;
3542
3543done:
3544 if (hKey)
3546
3547 if (hr == S_OK)
3548 {
3549 This->pTcpIpSettings = pSettings;
3550 }
3551 else
3552 {
3553 CoTaskMemFree(pSettings);
3554 }
3555
3556 return hr;
3557}
if(dx< 0)
Definition: linetemp.h:194
DWORD UseDomainNameDevolution
DWORD EnableSecurityFilters

Referenced by Initialize().

◆ MoveItem()

VOID MoveItem ( HWND  hDlgCtrl,
INT  pos 
)

Definition at line 2054 of file tcpipconf_notify.c.

2057{
2058 WCHAR szBuffer[100];
2059 LRESULT lResult;
2060
2061 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
2062 if (lResult != LB_ERR)
2063 {
2064 if (SendMessageW(hDlgCtrl, LB_GETTEXTLEN, (WPARAM)lResult, 0) < sizeof(szBuffer)/sizeof(WCHAR) - 1)
2065 {
2066 if (SendMessageW(hDlgCtrl, LB_GETTEXT, (WPARAM)lResult, (LPARAM)szBuffer) != LB_ERR)
2067 {
2068 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
2069 SendMessageW(hDlgCtrl, LB_INSERTSTRING, (WPARAM)lResult + pos, (LPARAM)szBuffer);
2070 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult + pos, 0);
2071 }
2072 }
2073 }
2074}
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define LB_DELETESTRING
Definition: winuser.h:2061
#define LB_INSERTSTRING
Definition: winuser.h:2089
#define LB_GETCURSEL
Definition: winuser.h:2068

Referenced by TcpipAdvancedDnsDlg().

◆ NameServersChanged()

static BOOL NameServersChanged ( AdapterSettings pAdapter)
static

Definition at line 3350 of file tcpipconf_notify.c.

3352{
3353 IP_ADDR *pNew, *pOld;
3354 BOOL Changed = FALSE;
3355
3356 pNew = pAdapter->NewNs;
3357 pOld = pAdapter->OldNs;
3358 while (pNew && pOld)
3359 {
3360 if (pNew->IpAddress != pOld->IpAddress)
3361 {
3362 Changed = TRUE;
3363 break;
3364 }
3365
3366 pNew = pNew->Next;
3367 pOld = pOld->Next;
3368 }
3369
3370 if (Changed == FALSE)
3371 {
3372 if (((pNew == NULL) && (pOld != NULL)) ||
3373 ((pNew != NULL) && (pOld == NULL)))
3374 Changed = TRUE;
3375 }
3376
3377 return Changed;
3378}

Referenced by INetCfgComponentControl_fnApplyPnpChanges(), and INetCfgComponentControl_fnApplyRegistryChanges().

◆ ParseNameServer()

HRESULT ParseNameServer ( HKEY  hAdapterKey,
AdapterSettings pAdapter 
)

Definition at line 3560 of file tcpipconf_notify.c.

3563{
3564 PWSTR pszBuffer = NULL, pStart, pEnd;
3565 DWORD dwSize;
3567 IP_ADDR *pNewAddrEntry, *pOldAddrEntry, *pNewLast = NULL, *pOldLast = NULL;
3568 HRESULT hr = S_OK;
3570
3571 dwSize = 0;
3572 RegQueryValueExW(hAdapterKey, L"NameServer", NULL, NULL, NULL, &dwSize);
3573 if (dwSize == 0)
3574 return S_OK;
3575
3576 pszBuffer = CoTaskMemAlloc(dwSize);
3577 if (pszBuffer == NULL)
3578 {
3579 hr = E_OUTOFMEMORY;
3580 goto done;
3581 }
3582
3583 if (RegQueryValueExW(hAdapterKey, L"NameServer", NULL, NULL, (PBYTE)pszBuffer, &dwSize) != ERROR_SUCCESS)
3584 {
3585 hr = E_FAIL;
3586 goto done;
3587 }
3588
3589 pStart = pszBuffer;
3590 for (;;)
3591 {
3592 Status = RtlIpv4StringToAddressW(pStart, TRUE, (LPCWSTR *)&pEnd, &Address);
3593 TRACE("RtlIpv4StringToAddressW Status 0x%08lx\n", Status);
3594 if (Status != 0)
3595 {
3596 hr = E_FAIL;
3597 break;
3598 }
3599
3600 TRACE("Adress: %lx\n", Address.S_un.S_addr);
3601
3602 pNewAddrEntry = CoTaskMemAlloc(sizeof(IP_ADDR));
3603 if (pNewAddrEntry)
3604 {
3605 ZeroMemory(pNewAddrEntry, sizeof(IP_ADDR));
3606 pNewAddrEntry->IpAddress = ntohl(Address.S_un.S_addr);
3607
3608 if (!pNewLast)
3609 pAdapter->NewNs = pNewAddrEntry;
3610 else
3611 pNewLast->Next = pNewAddrEntry;
3612
3613 pNewLast = pNewAddrEntry;
3614 }
3615
3616 pOldAddrEntry = CoTaskMemAlloc(sizeof(IP_ADDR));
3617 if (pOldAddrEntry)
3618 {
3619 ZeroMemory(pOldAddrEntry, sizeof(IP_ADDR));
3620 pOldAddrEntry->IpAddress = ntohl(Address.S_un.S_addr);
3621
3622 if (!pOldLast)
3623 pAdapter->OldNs = pOldAddrEntry;
3624 else
3625 pOldLast->Next = pOldAddrEntry;
3626
3627 pOldLast = pOldAddrEntry;
3628 }
3629
3630 if (*pEnd == UNICODE_NULL)
3631 break;
3632
3633 pStart = pEnd + 1;
3634 }
3635
3636done:
3637 if (pszBuffer)
3638 CoTaskMemFree(pszBuffer);
3639
3640 return hr;
3641}
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:25
#define ntohl(x)
Definition: module.h:205
NTSYSAPI NTSTATUS NTAPI RtlIpv4StringToAddressW(_In_ PCWSTR String, _In_ BOOLEAN Strict, _Out_ PCWSTR *Terminator, _Out_ struct in_addr *Addr)
Definition: network.c:385
#define UNICODE_NULL
BYTE * PBYTE
Definition: pedump.c:66
const uint16_t * LPCWSTR
Definition: typedefs.h:57

Referenced by LoadAdapterSettings().

◆ PropSheetProc()

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

Definition at line 2461 of file tcpipconf_notify.c.

2462{
2463 // NOTE: This callback is needed to set large icon correctly.
2464 HICON hIcon;
2465 switch (uMsg)
2466 {
2467 case PSCB_INITIALIZED:
2468 {
2470 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
2471 break;
2472 }
2473 }
2474 return 0;
2475}
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define ICON_BIG
Definition: tnclass.cpp:51
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2444

Referenced by LaunchAdvancedTcpipSettings().

◆ RemoveItem()

VOID RemoveItem ( HWND  hDlgCtrl)

Definition at line 2076 of file tcpipconf_notify.c.

2078{
2079 LRESULT lResult, lCount;
2080
2081 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
2082 if (lResult != LB_ERR)
2083 {
2084 SendMessageW(hDlgCtrl, LB_DELETESTRING, (WPARAM)lResult, 0);
2085 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
2086 if (lResult + 1 < lCount)
2087 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lResult, 0);
2088 else
2089 SendMessageW(hDlgCtrl, LB_SETCURSEL, (WPARAM)lCount-1, 0);
2090 }
2091}

Referenced by TcpipAdvancedDnsDlg().

◆ StoreDNSSettings()

VOID StoreDNSSettings ( HWND  hDlgCtrl,
TcpipConfNotifyImpl This 
)

Definition at line 2143 of file tcpipconf_notify.c.

2146{
2147 INT iCount, iIndex;
2148 WCHAR Ip[16];
2149 IP_ADDR *pCur, *pLast;
2150
2151 FreeIPAddr(This->pCurrentAdapter->NewNs);
2152 This->pCurrentAdapter->NewNs = NULL;
2153
2154 iCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
2155 if (!iCount || iCount == LB_ERR)
2156 {
2157 return;
2158 }
2159
2160 pLast = NULL;
2161 for(iIndex = 0; iIndex < iCount; iIndex++)
2162 {
2163 if (SendMessageW(hDlgCtrl, LB_GETTEXT, iIndex, (LPARAM)Ip) == LB_ERR)
2164 break;
2165
2166 pCur = CoTaskMemAlloc(sizeof(IP_ADDR));
2167 if (!pCur)
2168 break;
2169 ZeroMemory(pCur, sizeof(IP_ADDR));
2170 pCur->IpAddress = GetIpAddressFromStringW(Ip);
2171
2172 if (!pLast)
2173 This->pCurrentAdapter->NewNs = pCur;
2174 else
2175 pLast->Next = pCur;
2176
2177 pLast = pCur;
2178 pCur = pCur->Next;
2179 }
2180}
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:641
VOID FreeIPAddr(IP_ADDR *pAddr)

Referenced by TcpipAdvancedDnsDlg().

◆ StoreIPSettings()

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

Definition at line 1569 of file tcpipconf_notify.c.

1573{
1574 WCHAR szBuffer[30];
1575
1576 INT iIndex, iCount;
1577 IP_ADDR *pCur, *pLast;
1578
1579 iCount = ListView_GetItemCount(hDlgCtrl);
1580 if (!iCount)
1581 {
1582 return;
1583 }
1584
1585 pLast = NULL;
1586 for(iIndex = 0; iIndex < iCount; iIndex++)
1587 {
1588 if (GetListViewItem(hDlgCtrl, iIndex, 0, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1589 {
1590 pCur = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
1591 if (!pCur)
1592 break;
1593 ZeroMemory(pCur, sizeof(IP_ADDR));
1594
1595 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1596 pCur->IpAddress = GetIpAddressFromStringW(szBuffer);
1597
1598 if (GetListViewItem(hDlgCtrl, iIndex, 1, szBuffer, sizeof(szBuffer)/sizeof(WCHAR) ))
1599 {
1600 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1601 if (bSubmask)
1602 pCur->u.SubnetMask = GetIpAddressFromStringW(szBuffer);
1603 else
1604 pCur->u.Metric = _wtoi(szBuffer);
1605 }
1606
1607 if (!pLast)
1608 {
1609 if (bSubmask)
1610 This->pCurrentAdapter->NewIp = pCur;
1611 else
1612 This->pCurrentAdapter->NewGw = pCur;
1613 }
1614 else
1615 {
1616 pLast->Next = pCur;
1617 }
1618
1619 pLast = pCur;
1620 }
1621 }
1622}
BOOL GetListViewItem(HWND hDlgCtrl, UINT Index, UINT SubIndex, WCHAR *szBuffer, UINT BufferSize)

Referenced by TcpipAdvancedIpDlg().

◆ StoreTcpipAlternateSettings()

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

Definition at line 2517 of file tcpipconf_notify.c.

2521{
2522 DWORD dwAddr;
2523
2525 {
2526 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) != 4)
2527 {
2528 if (bApply)
2529 {
2532 return E_FAIL;
2533 }
2534 }
2535
2536 if (SendDlgItemMessageW(hwndDlg, IDC_ALTSUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) != 4)
2537 {
2538 if (bApply)
2540 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2541 {
2542 if (dwAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2543 dwAddr = MAKEIPADDRESS(255, 0, 0, 0);
2544 else if (dwAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2545 dwAddr = MAKEIPADDRESS(255, 255, 0, 0);
2546 else if (dwAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2547 dwAddr = MAKEIPADDRESS(255, 255, 255, 0);
2548
2550 }
2551 if (bApply)
2552 {
2554 return E_FAIL;
2555 }
2556 }
2557
2558 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2559 This->pCurrentAdapter->AltConfig.IpAddress = dwAddr;
2560
2561 if (SendDlgItemMessageW(hwndDlg, IDC_ALTSUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2562 This->pCurrentAdapter->AltConfig.SubnetMask = dwAddr;
2563
2564 if (SendDlgItemMessageW(hwndDlg, IDC_ALTDEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2565 This->pCurrentAdapter->AltConfig.DefaultGateway = dwAddr;
2566
2567 if (SendDlgItemMessageW(hwndDlg, IDC_ALTDNS1, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2568 This->pCurrentAdapter->AltConfig.DnsServer1 = dwAddr;
2569
2570 if (SendDlgItemMessageW(hwndDlg, IDC_ALTDNS2, IPM_GETADDRESS, 0, (LPARAM)&dwAddr) == 4)
2571 This->pCurrentAdapter->AltConfig.DnsServer2 = dwAddr;
2572 }
2573 else
2574 {
2575 ZeroMemory(&This->pCurrentAdapter->AltConfig, sizeof(AlternateConfiguration));
2576 }
2577
2578 return S_OK;
2579}
#define IDS_NO_SUBMASK_SET
Definition: resource.h:109
#define IDS_NO_IPADDR_SET
Definition: resource.h:108
#define MAKEIPADDRESS(b1, b2, b3, b4)
Definition: commctrl.h:4491
#define IPM_GETADDRESS
Definition: commctrl.h:4472
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)

Referenced by TcpipAltConfDlg().

◆ StoreTcpipBasicSettings()

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

Definition at line 2757 of file tcpipconf_notify.c.

2761{
2762 DWORD dwIpAddr;
2763
2764 if (IsDlgButtonChecked(hwndDlg, IDC_NODHCP) == BST_CHECKED)
2765 {
2766 This->pCurrentAdapter->NewDhcpEnabled = FALSE;
2767
2768 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2769 {
2770 if (bApply)
2771 {
2773 SetFocus(GetDlgItem(hwndDlg, IDC_IPADDR));
2774 return E_FAIL;
2775 }
2776 }
2777 if (!This->pCurrentAdapter->NewIp)
2778 {
2779 This->pCurrentAdapter->NewIp = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2780 if (!This->pCurrentAdapter->NewIp)
2781 return E_OUTOFMEMORY;
2782 ZeroMemory(This->pCurrentAdapter->NewIp, sizeof(IP_ADDR));
2783 }
2784 This->pCurrentAdapter->NewIp->IpAddress = dwIpAddr;
2785
2786 if (SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) != 4)
2787 {
2788 if (bApply)
2790 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2791 {
2792 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2793 dwIpAddr = MAKEIPADDRESS(255, 0, 0, 0);
2794 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2795 dwIpAddr = MAKEIPADDRESS(255, 255, 0, 0);
2796 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2797 dwIpAddr = MAKEIPADDRESS(255, 255, 255, 0);
2798
2800 }
2801 if (bApply)
2802 {
2804 return E_FAIL;
2805 }
2806 }
2807 /* store subnetmask */
2808 This->pCurrentAdapter->NewIp->u.SubnetMask = dwIpAddr;
2809
2810 if (SendDlgItemMessageW(hwndDlg, IDC_DEFGATEWAY, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2811 {
2812 if (!This->pCurrentAdapter->NewGw)
2813 {
2814 This->pCurrentAdapter->NewGw = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2815 if (!This->pCurrentAdapter->NewGw)
2816 return E_OUTOFMEMORY;
2817 ZeroMemory(This->pCurrentAdapter->NewGw, sizeof(IP_ADDR));
2818 }
2819
2820 /* store default gateway */
2821 This->pCurrentAdapter->NewGw->IpAddress = dwIpAddr;
2822 }
2823 }
2824 else
2825 {
2826 This->pCurrentAdapter->NewDhcpEnabled = TRUE;
2827
2828 /* Delete all configured ip addresses */
2829 if (This->pCurrentAdapter->NewIp)
2830 {
2831 IP_ADDR * pNextIp = This->pCurrentAdapter->NewIp->Next;
2832 CoTaskMemFree(This->pCurrentAdapter->NewIp);
2833 This->pCurrentAdapter->NewIp = pNextIp;
2834 }
2835
2836 /* Delete all configured gateway addresses */
2837 if (This->pCurrentAdapter->NewGw)
2838 {
2839 IP_ADDR * pNextGw = This->pCurrentAdapter->NewGw->Next;
2840 CoTaskMemFree(This->pCurrentAdapter->NewGw);
2841 This->pCurrentAdapter->NewGw = pNextGw;
2842 }
2843 }
2844
2846 {
2847 This->pCurrentAdapter->DnsDhcpEnabled = FALSE;
2848
2849 BOOL bSkip = FALSE;
2850 if (SendDlgItemMessageW(hwndDlg, IDC_DNS1, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2851 {
2852 if (!This->pCurrentAdapter->NewNs)
2853 {
2854 This->pCurrentAdapter->NewNs = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2855 if (!This->pCurrentAdapter->NewNs)
2856 return E_OUTOFMEMORY;
2857 ZeroMemory(This->pCurrentAdapter->NewNs, sizeof(IP_ADDR));
2858 }
2859 This->pCurrentAdapter->NewNs->IpAddress = dwIpAddr;
2860 }
2861 else if (This->pCurrentAdapter->NewNs)
2862 {
2863 IP_ADDR *pTemp = This->pCurrentAdapter->NewNs->Next;
2864
2865 CoTaskMemFree(This->pCurrentAdapter->NewNs);
2866 This->pCurrentAdapter->NewNs = pTemp;
2867 bSkip = TRUE;
2868 }
2869
2870 if (SendDlgItemMessageW(hwndDlg, IDC_DNS2, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2871 {
2872 if (!This->pCurrentAdapter->NewNs || bSkip)
2873 {
2874 if (!This->pCurrentAdapter->NewNs)
2875 {
2876 This->pCurrentAdapter->NewNs = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2877 if (!This->pCurrentAdapter->NewNs)
2878 return E_OUTOFMEMORY;
2879 ZeroMemory(This->pCurrentAdapter->NewNs, sizeof(IP_ADDR));
2880 }
2881 This->pCurrentAdapter->NewNs->IpAddress = dwIpAddr;
2882 }
2883 else if (!This->pCurrentAdapter->NewNs->Next)
2884 {
2885 This->pCurrentAdapter->NewNs->Next = (IP_ADDR*)CoTaskMemAlloc(sizeof(IP_ADDR));
2886 if (!This->pCurrentAdapter->NewNs->Next)
2887 return E_OUTOFMEMORY;
2888 ZeroMemory(This->pCurrentAdapter->NewNs->Next, sizeof(IP_ADDR));
2889 This->pCurrentAdapter->NewNs->Next->IpAddress = dwIpAddr;
2890 }
2891 else
2892 {
2893 This->pCurrentAdapter->NewNs->Next->IpAddress = dwIpAddr;
2894 }
2895 }
2896 else
2897 {
2898 if (This->pCurrentAdapter->NewNs && This->pCurrentAdapter->NewNs->Next)
2899 {
2900 if (This->pCurrentAdapter->NewNs->Next->Next)
2901 {
2902 IP_ADDR *pTemp = This->pCurrentAdapter->NewNs->Next->Next;
2903 CoTaskMemFree(This->pCurrentAdapter->NewNs->Next);
2904 This->pCurrentAdapter->NewNs->Next = pTemp;
2905 }
2906 else
2907 {
2908 CoTaskMemFree(This->pCurrentAdapter->NewNs->Next);
2909 This->pCurrentAdapter->NewNs->Next = NULL;
2910 }
2911 }
2912 }
2913 }
2914 else
2915 {
2916 This->pCurrentAdapter->DnsDhcpEnabled = TRUE;
2917
2918 /* Delete all configured name server addresses */
2919 if (This->pCurrentAdapter->NewNs)
2920 {
2921 IP_ADDR * pNextNs = This->pCurrentAdapter->NewNs->Next;
2922 CoTaskMemFree(This->pCurrentAdapter->NewNs);
2923 This->pCurrentAdapter->NewNs = pNextNs;
2924 }
2925 }
2926
2927 return S_OK;
2928}

Referenced by LaunchAdvancedTcpipSettings(), and TcpipBasicDlg().

◆ TcpipAddDNSDlg()

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

Definition at line 1867 of file tcpipconf_notify.c.

1873{
1874 TcpipDnsSettings * pSettings;
1875 WCHAR szBuffer[100];
1876 DWORD dwIpAddr;
1877 LPNMIPADDRESS lpnmipa;
1878
1879 switch(uMsg)
1880 {
1881 case WM_INITDIALOG:
1882 pSettings = (TcpipDnsSettings*)lParam;
1884 if (!pSettings->bAdd)
1885 {
1886 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1887 {
1888 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1889 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1890 }
1891 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_SETTEXT, 0, (LPARAM)pSettings->szIP);
1892 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1893 }
1894 else
1895 {
1896 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1897 {
1898 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1899 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1900 }
1901 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1902 }
1903 return TRUE;
1904 case WM_COMMAND:
1905 if (LOWORD(wParam) == IDCANCEL)
1906 {
1907 EndDialog(hwndDlg, FALSE);
1908 break;
1909 }
1910 else if (LOWORD(wParam) == IDC_OK)
1911 {
1912 pSettings = (TcpipDnsSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1913 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pSettings->szIP);
1914 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->szIP) == LB_ERR)
1915 {
1916 if (pSettings->bAdd)
1917 SendMessageW(pSettings->hDlgCtrl, LB_ADDSTRING, 0, (LPARAM)pSettings->szIP);
1918 EndDialog(hwndDlg, TRUE);
1919 break;
1920 }
1921 if (!pSettings->bAdd)
1922 {
1923 EndDialog(hwndDlg, FALSE);
1924 break;
1925 }
1927 break;
1928 }
1929 break;
1930 case WM_NOTIFY:
1931 lpnmipa = (LPNMIPADDRESS) lParam;
1932 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1933 {
1934 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1935 {
1936 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1937 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1938 }
1939 }
1940 break;
1941 }
1942 return FALSE;
1943}
#define IDC_OK
Definition: resource.h:59
WPARAM wParam
Definition: combotst.c:138
#define IDS_ADD
Definition: resource.h:120
#define IDS_MOD
Definition: resource.h:121
#define IDS_DUP_SUFFIX
Definition: resource.h:132
#define LOWORD(l)
Definition: pedump.c:82
struct tagNMIPADDRESS * LPNMIPADDRESS
#define IPN_FIELDCHANGED
Definition: commctrl.h:4482
#define WM_NOTIFY
Definition: richedit.h:61
UINT_PTR idFrom
Definition: winuser.h:3266
UINT code
Definition: winuser.h:3267
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:842
#define WM_COMMAND
Definition: winuser.h:1768
#define WM_GETTEXT
Definition: winuser.h:1646
#define WM_INITDIALOG
Definition: winuser.h:1767
#define MB_ICONERROR
Definition: winuser.h:798
#define LB_FINDSTRING
Definition: winuser.h:2063
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAddIpDlg()

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

Definition at line 1234 of file tcpipconf_notify.c.

1240{
1241 LPNMIPADDRESS lpnmipa;
1242 DWORD dwIpAddr;
1243 TcpipIpSettings *pIpSettings;
1244 WCHAR szBuffer[50];
1246 LRESULT lResult;
1247
1248 switch(uMsg)
1249 {
1250 case WM_INITDIALOG:
1251 pIpSettings = (TcpipIpSettings*)lParam;
1253
1262
1263 if (pIpSettings->bAdd)
1264 {
1265 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1266 {
1267 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1268 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1269 }
1270 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1271 }
1272 else
1273 {
1274 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1275 {
1276 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1277 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1278 }
1279
1282 }
1283 return TRUE;
1284 case WM_NOTIFY:
1285 lpnmipa = (LPNMIPADDRESS) lParam;
1286 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1287 {
1288 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1289 {
1290 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1291 {
1292 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
1294 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
1296 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
1297 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
1298 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1299 }
1300 }
1301 }
1302 break;
1303 case WM_COMMAND:
1304 if (LOWORD(wParam) == IDC_OK)
1305 {
1306 pIpSettings = (TcpipIpSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1307 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pIpSettings->szIP);
1308 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, WM_GETTEXT, 16, (LPARAM)pIpSettings->szMask);
1309
1310 ZeroMemory(&find, sizeof(LVFINDINFOW));
1311 find.flags = LVFI_STRING;
1312 find.psz = pIpSettings->szIP;
1313 lResult = SendMessageW(pIpSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find);
1314
1315 if (lResult == -1)
1316 {
1317 EndDialog(hwndDlg, TRUE);
1318 break;
1319 }
1320 else if (!pIpSettings->bAdd)
1321 {
1322 EndDialog(hwndDlg, FALSE);
1323 break;
1324 }
1326 break;
1327 }
1328 else if (LOWORD(wParam) == IDCANCEL)
1329 {
1330 EndDialog(hwndDlg, FALSE);
1331 }
1332 break;
1333 }
1334 return FALSE;
1335}
static TAGID TAGID find
Definition: db.cpp:156
#define IDS_DUP_IPADDR
Definition: resource.h:133
#define LVFI_STRING
Definition: commctrl.h:2442
#define LVM_FINDITEMW
Definition: commctrl.h:2471

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAddSuffixDlg()

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

Definition at line 1353 of file tcpipconf_notify.c.

1359{
1360 WCHAR szBuffer[100];
1361 TcpipSuffixSettings * pSettings;
1362 LRESULT lLength;
1363
1364 switch(uMsg)
1365 {
1366 case WM_INITDIALOG:
1367 pSettings = (TcpipSuffixSettings*)lParam;
1368 if (!pSettings->bAdd)
1369 {
1370 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_SETTEXT, 0, (LPARAM)pSettings->Suffix);
1371 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1372 {
1373 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1374 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1375 }
1376 CoTaskMemFree(pSettings->Suffix);
1377 pSettings->Suffix = NULL;
1378 }
1379 else
1380 {
1381 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1382 {
1383 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1384 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1385 }
1386 }
1387 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pSettings);
1388 return TRUE;
1389 case WM_COMMAND:
1390 if (LOWORD(wParam) == IDCANCEL)
1391 {
1392 EndDialog(hwndDlg, FALSE);
1393 break;
1394 }
1395 else if (LOWORD(wParam) == IDC_OK)
1396 {
1397 lLength = SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXTLENGTH, 0, 0);
1398 if (lLength)
1399 {
1400 pSettings = (TcpipSuffixSettings*) GetWindowLongPtr(hwndDlg, DWLP_USER);
1401 pSettings->Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1)* sizeof(WCHAR));
1402 if (pSettings->Suffix)
1403 {
1404 SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, lLength + 1, (LPARAM)pSettings->Suffix);
1405 if (SendMessageW(pSettings->hDlgCtrl, LB_FINDSTRING, 0, (LPARAM)pSettings->Suffix) != LB_ERR)
1406 {
1408 CoTaskMemFree(pSettings->Suffix);
1409 pSettings->Suffix = NULL;
1410 break;
1411 }
1412
1413 if (!VerifyDNSSuffix(pSettings->Suffix))
1414 {
1416 CoTaskMemFree(pSettings->Suffix);
1417 pSettings->Suffix = NULL;
1418 break;
1419 }
1420 EndDialog(hwndDlg, TRUE);
1421 }
1422 }
1423 break;
1424 }
1425 }
1426 return FALSE;
1427}
#define IDS_DOMAIN_SUFFIX
Definition: resource.h:130
BOOL VerifyDNSSuffix(LPWSTR szName)
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647

Referenced by TcpipAdvancedDnsDlg().

◆ TcpipAdvancedDnsDlg()

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

Definition at line 2184 of file tcpipconf_notify.c.

2190{
2193 TcpipDnsSettings Dns;
2194 LRESULT lIndex, lLength;
2195 TcpipSuffixSettings Suffix;
2196 LPPSHNOTIFY lppsn;
2197 WCHAR szSuffix[100];
2198 WCHAR szFormat[200];
2199 WCHAR szBuffer[300];
2200
2201
2202 switch(uMsg)
2203 {
2204 case WM_INITDIALOG:
2206 This = (TcpipConfNotifyImpl*)page->lParam;
2211 return TRUE;
2212 case WM_NOTIFY:
2213 lppsn = (LPPSHNOTIFY) lParam;
2214 if (lppsn->hdr.code == PSN_KILLACTIVE)
2215 {
2216 if (IsDlgButtonChecked(hwndDlg, IDC_SELSUFFIX) == BST_CHECKED &&
2218 {
2221 return TRUE;
2222 }
2223 if (SendDlgItemMessageW(hwndDlg, IDC_SUFFIX, WM_GETTEXT, sizeof(szSuffix)/sizeof(WCHAR), (LPARAM)szSuffix))
2224 {
2225 szSuffix[(sizeof(szSuffix)/sizeof(WCHAR))-1] = L'\0';
2226 if (VerifyDNSSuffix(szSuffix) == FALSE)
2227 {
2228 if (LoadStringW(netcfgx_hInstance, IDS_DNS_SUFFIX, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
2229 {
2230 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
2231 _swprintf(szBuffer, szFormat, szSuffix);
2232 if (LoadStringW(netcfgx_hInstance, IDS_TCPIP, szFormat, sizeof(szFormat)/sizeof(WCHAR)))
2233 szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0';
2234 else
2235 szFormat[0] = L'\0';
2236
2237 MessageBoxW(hwndDlg, szBuffer, szFormat, MB_ICONWARNING);
2239 SetFocus(GetDlgItem(hwndDlg, IDC_SUFFIX));
2240 return TRUE;
2241 }
2242 }
2243 }
2244 }
2245 else if (lppsn->hdr.code == PSN_APPLY)
2246 {
2248
2251 {
2252 CoTaskMemFree(This->pTcpIpSettings->szSearchList);
2253 This->pTcpIpSettings->szSearchList = NULL;
2255 This->pTcpIpSettings->UseDomainNameDevolution = TRUE;
2256 else
2257 This->pTcpIpSettings->UseDomainNameDevolution = FALSE;
2258 }
2259 else
2260 {
2261 CoTaskMemFree(This->pTcpIpSettings->szSearchList);
2262 This->pTcpIpSettings->szSearchList = NULL;
2263 This->pTcpIpSettings->UseDomainNameDevolution = FALSE;
2264 This->pTcpIpSettings->szSearchList = GetListViewEntries(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST));
2265 }
2266
2268 {
2269 This->pCurrentAdapter->NewRegisterAdapterName = TRUE;
2271 This->pCurrentAdapter->NewRegistrationEnabled = TRUE;
2272 else
2273 This->pCurrentAdapter->NewRegistrationEnabled = FALSE;
2274 }
2275 else
2276 {
2277 This->pCurrentAdapter->NewRegisterAdapterName = FALSE;
2278 This->pCurrentAdapter->NewRegistrationEnabled = FALSE;
2279 }
2280 }
2281 break;
2282 case WM_COMMAND:
2284 {
2286 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2287 break;
2288 }
2290 {
2292 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2293 break;
2294 }
2295 else if (LOWORD(wParam) == IDC_PRIMSUFFIX && HIWORD(wParam) == BN_CLICKED)
2296 {
2298 {
2306 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2307 }
2308 }
2309 else if (LOWORD(wParam) == IDC_SELSUFFIX && HIWORD(wParam) == BN_CLICKED)
2310 {
2312 {
2316 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2317 }
2318 break;
2319 }
2320 else if (LOWORD(wParam) == IDC_REGSUFFIX && HIWORD(wParam) == BN_CLICKED)
2321 {
2324 else
2326 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2327 }
2328 else if (LOWORD(wParam) == IDC_DNSADDRUP && HIWORD(wParam) == BN_CLICKED)
2329 {
2330 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), -1);
2333 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2334 break;
2335 }
2337 {
2338 MoveItem(GetDlgItem(hwndDlg, IDC_DNSADDRLIST), 1);
2341 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2342 break;
2343 }
2345 {
2346 MoveItem(GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST), -1);
2349 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2350 break;
2351 }
2353 {
2357 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2358 break;
2359 }
2360 else if (LOWORD(wParam) == IDC_DNSADDRDEL && HIWORD(wParam) == BN_CLICKED)
2361 {
2365 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2366 break;
2367 }
2369 {
2373 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2374 break;
2375 }
2376 else if (LOWORD(wParam) == IDC_DNSADDRADD && HIWORD(wParam) == BN_CLICKED)
2377 {
2378 Dns.bAdd = TRUE;
2379 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2381 {
2383 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2384 }
2385 break;
2386 }
2387 else if (LOWORD(wParam) == IDC_DNSADDRMOD && HIWORD(wParam) == BN_CLICKED)
2388 {
2389 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSADDRLIST, LB_GETCURSEL, 0, 0);
2390 if (lIndex != LB_ERR)
2391 {
2392 Dns.bAdd = FALSE;
2393 Dns.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSADDRLIST);
2394 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_GETTEXT, (WPARAM)lIndex, (LPARAM)Dns.szIP);
2396 {
2398 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_INSERTSTRING, lIndex, (LPARAM)Dns.szIP);
2399 SendDlgItemMessageW(hwndDlg, IDC_DNSADDRLIST, LB_SETCURSEL, lIndex, 0);
2401 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2402 }
2403 }
2404 break;
2405 }
2407 {
2408 Suffix.bAdd = TRUE;
2409 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2410 Suffix.Suffix = NULL;
2412 {
2414 lIndex = SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_ADDSTRING, 0, (LPARAM)Suffix.Suffix);
2415 if (lIndex != LB_ERR)
2418 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2419 CoTaskMemFree(Suffix.Suffix);
2420 }
2421 break;
2422 }
2424 {
2425 lIndex = SendDlgItemMessage(hwndDlg, IDC_DNSSUFFIXLIST, LB_GETCURSEL, 0, 0);
2426 if (lIndex != LB_ERR)
2427 {
2428 Suffix.bAdd = FALSE;
2429 Suffix.hDlgCtrl = GetDlgItem(hwndDlg, IDC_DNSSUFFIXLIST);
2430 lLength = SendMessageW(Suffix.hDlgCtrl, LB_GETTEXTLEN, lIndex, 0);
2431 if (lLength != LB_ERR)
2432 {
2433 Suffix.Suffix = (LPWSTR)CoTaskMemAlloc((lLength + 1) * sizeof(WCHAR));
2434 if (Suffix.Suffix)
2435 {
2436 SendMessageW(Suffix.hDlgCtrl, LB_GETTEXT, lIndex, (LPARAM)Suffix.Suffix);
2437 Suffix.Suffix[lLength] = L'\0';
2439 {
2440 if (Suffix.Suffix)
2441 {
2443 SendDlgItemMessageW(hwndDlg, IDC_DNSSUFFIXLIST, LB_INSERTSTRING, lIndex, (LPARAM)Suffix.Suffix);
2446 CoTaskMemFree(Suffix.Suffix);
2447 }
2449 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2450 }
2451 }
2452 }
2453 }
2454 break;
2455 }
2456 }
2457 return FALSE;
2458}
#define IDC_DNSADDRMOD
Definition: resource.h:61
#define IDC_DNSSUFFIXUP
Definition: resource.h:67
#define IDC_DNSSUFFIXDEL
Definition: resource.h:71
#define IDC_DNSSUFFIXDOWN
Definition: resource.h:68
#define IDD_TCPIPDNS_DLG
Definition: resource.h:16
#define IDC_DNSADDRADD
Definition: resource.h:60
#define IDC_DNSADDRDEL
Definition: resource.h:62
#define IDC_DNSADDRUP
Definition: resource.h:58
#define IDS_NO_SUFFIX
Definition: resource.h:129
#define IDD_TCPIPSUFFIX_DLG
Definition: resource.h:17
#define IDC_DNSADDRDOWN
Definition: resource.h:59
#define IDS_DNS_SUFFIX
Definition: resource.h:131
#define IDC_DNSSUFFIXMOD
Definition: resource.h:70
#define PSN_KILLACTIVE
Definition: prsht.h:116
#define PSN_APPLY
Definition: prsht.h:117
#define LPPROPSHEETPAGE
Definition: prsht.h:390
struct _PSHNOTIFY * LPPSHNOTIFY
NMHDR hdr
Definition: prsht.h:330
Definition: module.h:576
VOID MoveItem(HWND hDlgCtrl, INT pos)
VOID RemoveItem(HWND hDlgCtrl)
INT_PTR CALLBACK TcpipAddSuffixDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitializeTcpipAdvancedDNSDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID StoreDNSSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This)
VOID ToggleUpDown(HWND hwndDlg, HWND hDlgCtrl, UINT UpButton, UINT DownButton, UINT ModButton, UINT DelButton)
INT_PTR CALLBACK TcpipAddDNSDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
LPWSTR GetListViewEntries(HWND hDlgCtrl)
#define HIWORD(l)
Definition: typedefs.h:247
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define LBN_SELCHANGE
Definition: winuser.h:2111
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define BN_CLICKED
Definition: winuser.h:1954
#define SendDlgItemMessage
Definition: winuser.h:6008
#define BM_GETCHECK
Definition: winuser.h:1947

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedIpDlg()

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

Definition at line 1627 of file tcpipconf_notify.c.

1633{
1636 INT_PTR res;
1637 WCHAR szBuffer[200];
1638 LPPSHNOTIFY lppsn;
1640 TcpipIpSettings Ip;
1641
1642 LVITEMW li;
1643
1644 switch(uMsg)
1645 {
1646 case WM_INITDIALOG:
1648 This = (TcpipConfNotifyImpl*)page->lParam;
1651 return TRUE;
1652 case WM_NOTIFY:
1653 lppsn = (LPPSHNOTIFY) lParam;
1654 if (lppsn->hdr.code == LVN_ITEMCHANGED)
1655 {
1657 BOOL bEnable;
1658
1659 if (lplv->hdr.idFrom == IDC_IPLIST)
1660 {
1662
1663 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0) &&
1664 (!This->pCurrentAdapter->NewDhcpEnabled);
1665
1668 }
1669 else if (lplv->hdr.idFrom == IDC_GWLIST)
1670 {
1671 bEnable = ((lplv->uNewState & LVIS_SELECTED) != 0);
1672
1675 }
1676 }
1677 else if (lppsn->hdr.code == PSN_KILLACTIVE)
1678 {
1680 if (!This->pCurrentAdapter->NewDhcpEnabled && ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST)) == 0)
1681 {
1684 return TRUE;
1685 }
1686
1688 {
1690 if ((val < 1) || (val > 9999))
1691 {
1694 return TRUE;
1695 }
1696 }
1697 }
1698 else if (lppsn->hdr.code == PSN_APPLY)
1699 {
1701 FreeIPAddr(This->pCurrentAdapter->NewGw);
1702 This->pCurrentAdapter->NewGw = NULL;
1703 FreeIPAddr(This->pCurrentAdapter->NewIp);
1704 This->pCurrentAdapter->NewIp = NULL;
1707
1709 This->pCurrentAdapter->NewMetric = 0;
1710 else
1711 This->pCurrentAdapter->NewMetric = GetDlgItemInt(hwndDlg, IDC_IFMETRIC, NULL, FALSE);
1712
1714 return TRUE;
1715 }
1716 break;
1717 case WM_COMMAND:
1719 {
1722 else
1724 }
1725 else if (LOWORD(wParam) == IDC_IPADD)
1726 {
1727 Ip.bAdd = TRUE;
1728 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1730 if (res)
1731 {
1732 memset(&li, 0x0, sizeof(LVITEMW));
1733 li.mask = LVIF_TEXT | LVIF_PARAM;
1734 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_IPLIST));
1735 li.pszText = Ip.szIP;
1736 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_IPLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1737 if (li.iItem != -1)
1738 {
1739 li.mask = LVIF_TEXT;
1740 li.iSubItem = 1;
1741 li.pszText = Ip.szMask;
1743 }
1744 }
1745 }
1746 else if (LOWORD(wParam) == IDC_IPMOD)
1747 {
1748 memset(&li, 0x0, sizeof(LVITEMW));
1749 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_IPLIST));
1750 if (li.iItem < 0)
1751 {
1752 /* no item selected */
1754 SetFocus(GetDlgItem(hwndDlg, IDC_IPLIST));
1755 break;
1756 }
1757 Ip.bAdd = FALSE;
1758 Ip.hDlgCtrl = GetDlgItem(hwndDlg, IDC_IPLIST);
1759 if (GetIPListEntry(GetDlgItem(hwndDlg, IDC_IPLIST), li.iItem, &Ip))
1760 {
1762 if (res)
1763 {
1764 li.mask = LVIF_TEXT;
1765 li.pszText = Ip.szIP;
1767 li.pszText = Ip.szMask;
1768 li.iSubItem = 1;
1770 }
1771 }
1772 }
1773 else if (LOWORD(wParam) == IDC_IPDEL)
1774 {
1776 break;
1777 }
1778 else if (LOWORD(wParam) == IDC_GWADD)
1779 {
1780 Gw.bAdd = TRUE;
1781 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1783 if (res)
1784 {
1785 memset(&li, 0x0, sizeof(LVITEMW));
1786 li.mask = LVIF_TEXT;
1787 li.iItem = ListView_GetItemCount(GetDlgItem(hwndDlg, IDC_GWLIST));
1788 li.pszText = Gw.szIP;
1789 li.iItem = SendDlgItemMessageW(hwndDlg, IDC_GWLIST, LVM_INSERTITEMW, 0, (LPARAM)&li);
1790 if (li.iItem >= 0)
1791 {
1792 if (Gw.Metric)
1793 {
1794 _swprintf(szBuffer, L"%u", Gw.Metric);
1795 li.iSubItem = 1;
1796 li.pszText = szBuffer;
1798 }
1799 else
1800 {
1801 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1802 {
1803 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1804 li.iSubItem = 1;
1805 li.pszText = szBuffer;
1807 }
1808 }
1809 }
1810 }
1811 break;
1812 }
1813 else if (LOWORD(wParam) == IDC_GWMOD)
1814 {
1815 memset(&li, 0x0, sizeof(LVITEMW));
1816 li.iItem = GetSelectedItem(GetDlgItem(hwndDlg, IDC_GWLIST));
1817 if (li.iItem < 0)
1818 {
1819 /* no item selected */
1821 SetFocus(GetDlgItem(hwndDlg, IDC_GWLIST));
1822 break;
1823 }
1824 if (GetGWListEntry(GetDlgItem(hwndDlg, IDC_GWLIST), li.iItem, &Gw))
1825 {
1826 Gw.bAdd = FALSE;
1827 Gw.hDlgCtrl = GetDlgItem(hwndDlg, IDC_GWLIST);
1829 if (res)
1830 {
1831 li.mask = LVIF_TEXT;
1832 li.pszText = Gw.szIP;
1834 if (Gw.Metric)
1835 {
1836 _swprintf(szBuffer, L"%u", Gw.Metric);
1837 li.iSubItem = 1;
1838 li.pszText = szBuffer;
1840 }
1841 else
1842 {
1843 if (LoadStringW(netcfgx_hInstance, IDS_AUTOMATIC, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1844 {
1845 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1846 li.iSubItem = 1;
1847 li.pszText = szBuffer;
1849 }
1850 }
1851 }
1852 }
1853 break;
1854 }
1855 else if (LOWORD(wParam) == IDC_GWDEL)
1856 {
1858 break;
1859 }
1860 break;
1861 }
1862 return FALSE;
1863}
#define IDC_GWADD
Definition: resource.h:47
#define IDD_TCPIPADDIP_DLG
Definition: resource.h:14
#define IDD_TCPIPGW_DLG
Definition: resource.h:15
#define IDS_METRIC_RANGE
Definition: resource.h:135
GLuint res
Definition: glext.h:9613
GLuint GLfloat * val
Definition: glext.h:7180
#define Gw
Definition: i386-dis.c:364
#define PSNRET_NOERROR
Definition: prsht.h:129
#define LVIF_PARAM
Definition: commctrl.h:2316
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVN_ITEMCHANGED
Definition: commctrl.h:3136
UINT uNewState
Definition: commctrl.h:3041
VOID InitializeTcpipAdvancedIpDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID StoreIPSettings(HWND hDlgCtrl, TcpipConfNotifyImpl *This, BOOL bSubmask)
VOID DeleteItemFromList(HWND hDlgCtrl)
BOOL GetGWListEntry(HWND hDlgCtrl, INT Index, TcpipGwSettings *pGwSettings)
INT_PTR CALLBACK TcpipAddIpDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
BOOL GetIPListEntry(HWND hDlgCtrl, INT Index, TcpipIpSettings *pIpSettings)
INT_PTR CALLBACK TcpipAdvGwDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
_In_ BOOL bEnable
Definition: winddi.h:3426
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvancedOptDlg()

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

Definition at line 918 of file tcpipconf_notify.c.

924{
927
928 switch(uMsg)
929 {
930 case WM_INITDIALOG:
932 This = (TcpipConfNotifyImpl*)page->lParam;
934 return TRUE;
935 case WM_COMMAND:
936 if (LOWORD(wParam) == IDC_OPTPROP)
937 {
940 GetParent(hwndDlg),
943 break;
944 }
945 }
946 return FALSE;
947}
#define IDD_TCPIP_FILTER_DLG
Definition: resource.h:13
#define IDC_OPTPROP
Definition: resource.h:77
INT_PTR CALLBACK TcpipFilterSettingsDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
VOID InitializeTcpipAdvancedOptDlg(HWND hwndDlg, TcpipConfNotifyImpl *This)

Referenced by LaunchAdvancedTcpipSettings().

◆ TcpipAdvGwDlg()

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

Definition at line 1078 of file tcpipconf_notify.c.

1084{
1085 WCHAR szBuffer[70];
1086 TcpipGwSettings *pGwSettings;
1087 DWORD dwIpAddr;
1088 LPNMIPADDRESS lpnmipa;
1090
1091 switch(uMsg)
1092 {
1093 case WM_INITDIALOG:
1094 pGwSettings = (TcpipGwSettings *)lParam;
1096
1101
1102 if (pGwSettings->bAdd)
1103 {
1104 if (LoadStringW(netcfgx_hInstance, IDS_ADD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1105 {
1106 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1107 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1108 }
1109 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), FALSE);
1111 }
1112 else
1113 {
1114 if (LoadStringW(netcfgx_hInstance, IDS_MOD, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
1115 {
1116 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
1117 SendDlgItemMessageW(hwndDlg, IDC_OK, WM_SETTEXT, 0, (LPARAM)szBuffer);
1118 }
1119
1121
1122 if (pGwSettings->Metric)
1123 {
1124 SetDlgItemInt(hwndDlg, IDC_GWMETRIC, pGwSettings->Metric, FALSE);
1127 }
1128 else
1129 {
1133 }
1134 }
1135 return TRUE;
1136 case WM_COMMAND:
1138 {
1140 {
1144 }
1145 else
1146 {
1149 }
1150 break;
1151 }
1152 else if (LOWORD(wParam) == IDCANCEL)
1153 {
1154 EndDialog(hwndDlg, FALSE);
1155 break;
1156 }
1157 else if (LOWORD(wParam) == IDC_OK)
1158 {
1159 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1160 {
1161 pGwSettings = (TcpipGwSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
1162 SendDlgItemMessageW(hwndDlg, IDC_IPADDR, WM_GETTEXT, 16, (LPARAM)pGwSettings->szIP);
1163
1164 ZeroMemory(&find, sizeof(LVFINDINFOW));
1165 find.flags = LVFI_STRING;
1166 find.psz = pGwSettings->szIP;
1167
1169 pGwSettings->Metric = GetDlgItemInt(hwndDlg, IDC_GWMETRIC, NULL, FALSE);
1170 else
1171 pGwSettings->Metric = 0;
1172
1173
1174 if (SendMessageW(pGwSettings->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
1175 {
1176 EndDialog(hwndDlg, TRUE);
1177 break;
1178 }
1179 if (!pGwSettings->bAdd)
1180 {
1181 EndDialog(hwndDlg, FALSE);
1182 break;
1183 }
1185 }
1186 break;
1187 }
1188 break;
1189 case WM_NOTIFY:
1190 lpnmipa = (LPNMIPADDRESS) lParam;
1191 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
1192 {
1193 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
1194 {
1195 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
1196 EnableWindow(GetDlgItem(hwndDlg, IDC_OK), TRUE);
1197 }
1198 }
1199 break;
1200 }
1201 return FALSE;
1202}
#define IDS_DUP_GW
Definition: resource.h:134
#define IDC_GWMETRICTXT
Definition: resource.h:53
#define IDC_GWMETRIC
Definition: resource.h:54
#define IDC_GWAUTOMETRIC
Definition: resource.h:52
#define BST_UNCHECKED
Definition: winuser.h:199

Referenced by TcpipAdvancedIpDlg().

◆ TcpipAltConfDlg()

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

Definition at line 2652 of file tcpipconf_notify.c.

2657{
2660 LPNMIPADDRESS lpnmipa;
2661 LPPSHNOTIFY lppsn;
2662
2663 switch (uMsg)
2664 {
2665 case WM_INITDIALOG:
2666 {
2668 This = (TcpipConfNotifyImpl*)page->lParam;
2671 return TRUE;
2672 }
2673 case WM_NOTIFY:
2674 lppsn = (LPPSHNOTIFY) lParam;
2675 lpnmipa = (LPNMIPADDRESS) lParam;
2676 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
2677 {
2678 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2679 if (lpnmipa->hdr.idFrom == IDC_ALTIPADDR)
2680 {
2681 DWORD dwIpAddr;
2682
2683 if (SendDlgItemMessageW(hwndDlg, IDC_ALTIPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
2684 {
2685 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
2687 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
2689 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
2691 }
2692 }
2693 }
2694 else if (lppsn->hdr.code == PSN_APPLY)
2695 {
2699 else
2701
2702 return TRUE;
2703 }
2704 break;
2705
2706 case WM_COMMAND:
2707 {
2708 switch (LOWORD(wParam))
2709 {
2710 case IDC_ALTAPIPA:
2711 case IDC_ALTSTATIC:
2712 {
2713 if (HIWORD(wParam) == BN_CLICKED)
2714 {
2715 BOOL bStatic = (IsDlgButtonChecked(hwndDlg, IDC_ALTSTATIC) == BST_CHECKED);
2716 if (bStatic)
2717 {
2723 }
2724
2725 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTIPADDR), bStatic);
2726 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTSUBNETMASK), bStatic);
2727 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTDEFGATEWAY), bStatic);
2728 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTDNS1), bStatic);
2729 EnableWindow(GetDlgItem(hwndDlg, IDC_ALTDNS2), bStatic);
2730
2731 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
2732 }
2733 break;
2734 }
2735 }
2736 break;
2737 }
2738 }
2739 return FALSE;
2740}
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define PSNRET_INVALID
Definition: prsht.h:130
HRESULT InitializeTcpipAltDlgCtrls(HWND hwndDlg, TcpipConfNotifyImpl *This)
INT_PTR StoreTcpipAlternateSettings(HWND hwndDlg, TcpipConfNotifyImpl *This, BOOL bApply)

Referenced by AddAlternativeDialog(), and INetCfgComponentPropertyUi_fnMergePropPages().

◆ TcpipBasicDlg()

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

Definition at line 3082 of file tcpipconf_notify.c.

3088{
3091 LPNMIPADDRESS lpnmipa;
3092 LPPSHNOTIFY lppsn;
3093 DWORD dwIpAddr;
3094
3095
3096 switch(uMsg)
3097 {
3098 case WM_INITDIALOG:
3100 This = (TcpipConfNotifyImpl*)page->lParam;
3101 if (This->pCurrentAdapter)
3104 return TRUE;
3105 case WM_NOTIFY:
3106 lppsn = (LPPSHNOTIFY) lParam;
3107 lpnmipa = (LPNMIPADDRESS) lParam;
3108 if (lpnmipa->hdr.code == IPN_FIELDCHANGED)
3109 {
3110 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
3111 if (lpnmipa->hdr.idFrom == IDC_IPADDR)
3112 {
3113 if (SendDlgItemMessageW(hwndDlg, IDC_IPADDR, IPM_GETADDRESS, 0, (LPARAM)&dwIpAddr) == 4)
3114 {
3115 if (dwIpAddr <= MAKEIPADDRESS(127, 255, 255, 255))
3117 else if (dwIpAddr <= MAKEIPADDRESS(191, 255, 255, 255))
3119 else if (dwIpAddr <= MAKEIPADDRESS(223, 255, 255, 255))
3120 SendDlgItemMessageW(hwndDlg, IDC_SUBNETMASK, IPM_SETADDRESS, 0, (LPARAM)MAKEIPADDRESS(255, 255, 255, 0));
3121 }
3122 }
3123 }
3124 else if (lppsn->hdr.code == PSN_APPLY)
3125 {
3129 else
3131
3132 return TRUE;
3133 }
3134 break;
3135 case WM_COMMAND:
3136 if (HIWORD(wParam) == BN_CLICKED)
3137 {
3138 switch (LOWORD(wParam))
3139 {
3140 case IDC_USEDHCP:
3141 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) == 0)
3142 {
3143 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
3152 }
3153 break;
3154 case IDC_NODHCP:
3155 if (SendMessageW(GetParent(hwndDlg), PSM_INDEXTOID, 1, 0) != 0)
3156 {
3157 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
3162 {
3164 }
3169 SendMessageW(GetParent(hwndDlg), PSM_REMOVEPAGE, 1, 0);
3170 }
3171 break;
3172 case IDC_AUTODNS:
3173 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
3178 break;
3179 case IDC_FIXEDDNS:
3180 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
3183 break;
3184 case IDC_ADVANCED:
3186 break;
3187 }
3188 break;
3189 }
3190 default:
3191 break;
3192
3193 }
3194 return FALSE;
3195}
#define IDC_ADVANCED
Definition: resource.h:11
#define PSM_REMOVEPAGE
Definition: prsht.h:166
VOID LaunchAdvancedTcpipSettings(HWND hwndDlg, TcpipConfNotifyImpl *This)
VOID AddAlternativeDialog(HWND hDlg, TcpipConfNotifyImpl *This)

Referenced by INetCfgComponentPropertyUi_fnMergePropPages().

◆ TcpipConfigNotify_Constructor()

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

Definition at line 4648 of file tcpipconf_notify.c.

4649{
4651
4652 if (!ppv)
4653 return E_POINTER;
4654
4656 if (!This)
4657 return E_OUTOFMEMORY;
4658
4659 This->ref = 1;
4660 This->lpVtbl = (const INetCfgComponentControl*)&vt_NetCfgComponentControl;
4661 This->lpVtblCompPropertyUi = (const INetCfgComponentPropertyUi*)&vt_NetCfgComponentPropertyUi;
4662 This->lpVtblCompSetup = (const INetCfgComponentSetup*)&vt_NetCfgComponentSetup;
4663 This->lpVtblTcpipProperties = (const ITcpipProperties*)&vt_TcpipProperties;
4664 This->pNCfg = NULL;
4665 This->pUnknown = NULL;
4666 This->pNComp = NULL;
4667 This->pTcpIpSettings = NULL;
4668 This->pAdapterListHead = NULL;
4669 This->pAdapterListTail = NULL;
4670 This->pCurrentAdapter = NULL;
4671
4672 if (!SUCCEEDED (INetCfgComponentControl_QueryInterface ((INetCfgComponentControl*)This, riid, ppv)))
4673 {
4674 INetCfgComponentControl_Release((INetCfgComponentControl*)This);
4675 return E_NOINTERFACE;
4676 }
4677
4678 INetCfgComponentControl_Release((INetCfgComponentControl*)This);
4679 return S_OK;
4680}
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
static const ITcpipPropertiesVtbl vt_TcpipProperties
static const INetCfgComponentSetupVtbl vt_NetCfgComponentSetup
static const INetCfgComponentControlVtbl vt_NetCfgComponentControl
static const INetCfgComponentPropertyUiVtbl vt_NetCfgComponentPropertyUi

◆ TcpipFilterPortDlg()

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

Definition at line 514 of file tcpipconf_notify.c.

520{
521 TcpipPortSettings * pPort;
522 UINT Num;
524 LVITEMW li;
525 WCHAR szBuffer[100];
526
527 switch(uMsg)
528 {
529 case WM_INITDIALOG:
530 pPort = (TcpipPortSettings*)lParam;
531 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pPort);
532 if (LoadStringW(netcfgx_hInstance, pPort->ResId, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
533 {
534 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
535 SendDlgItemMessageW(hwndDlg, IDC_PORT_DESC, WM_SETTEXT, 0, (LPARAM)szBuffer);
536 }
537
538 if (pPort->MaxNum == 65536)
540 else
542
543 return TRUE;
544 case WM_COMMAND:
545 if (LOWORD(wParam) == IDCANCEL)
546 {
547 EndDialog(hwndDlg, FALSE);
548 break;
549 }
550 else if (LOWORD(wParam) == IDC_OK)
551 {
552 pPort = (TcpipPortSettings*)GetWindowLongPtr(hwndDlg, DWLP_USER);
553 Num = GetDlgItemInt(hwndDlg, IDC_PORT_VAL, NULL, TRUE);
554 if (Num > pPort->MaxNum || Num == 0)
555 {
556 if (pPort->MaxNum == 65536)
558 else
560
562 break;
563 }
564 if (GetWindowTextW(GetDlgItem(hwndDlg, IDC_PORT_VAL), szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
565 {
566 szBuffer[(sizeof(szBuffer)/sizeof(WCHAR))-1] = L'\0';
567 ZeroMemory(&find, sizeof(LVFINDINFOW));
568 find.flags = LVFI_STRING;
569 find.psz = szBuffer;
570 if (SendMessageW(pPort->hDlgCtrl, LVM_FINDITEMW, (WPARAM)-1, (LPARAM)&find) == -1)
571 {
572 ZeroMemory(&li, sizeof(LVITEMW));
573 li.mask = LVIF_TEXT;
574 li.iItem = ListView_GetItemCount(pPort->hDlgCtrl);
575 li.pszText = szBuffer;
577 EndDialog(hwndDlg, TRUE);
578 break;
579 }
582 break;
583 }
584 }
585 }
586 return FALSE;
587}
#define IDS_PROT_RANGE
Definition: resource.h:126
#define IDC_PORT_VAL
Definition: resource.h:97
#define IDS_DUP_NUMBER
Definition: resource.h:127
#define IDS_PORT_RANGE
Definition: resource.h:125
#define IDC_PORT_DESC
Definition: resource.h:96
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382

Referenced by AddItem().

◆ TcpipFilterSettingsDlg()

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

Definition at line 707 of file tcpipconf_notify.c.

713{
714 TcpipConfNotifyImpl *pContext;
715
716 switch(uMsg)
717 {
718 case WM_INITDIALOG:
719 pContext = (TcpipConfNotifyImpl*)lParam;
723 if (pContext->pCurrentAdapter)
724 {
730 }
731 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pContext);
732 return TRUE;
733 case WM_COMMAND:
734 if (HIWORD(wParam) == BN_CLICKED)
735 {
736 switch (LOWORD(wParam))
737 {
740 {
745 }
746 break;
747 case IDC_TCP_RESTRICT:
749 {
754 }
755 break;
758 {
763 }
764 break;
765 case IDC_UDP_RESTRICT:
767 {
772 }
773 break;
774 case IDC_IP_ALLOW_ALL:
776 {
781 }
782 break;
783 case IDC_IP_RESTRICT:
785 {
790 }
791 break;
792 case IDC_USE_FILTER:
795
796 break;
797 }
798 }
799 switch(LOWORD(wParam))
800 {
801 case IDC_OK:
802 pContext = (TcpipConfNotifyImpl*)GetWindowLongPtr(hwndDlg, DWLP_USER);
804 {
809 }
810 else
811 {
813 if (pContext->pCurrentAdapter->szTCPAllowedPorts)
814 {
817 pContext->pCurrentAdapter->TCPSize = 0;
818 }
819 if (pContext->pCurrentAdapter->szUDPAllowedPorts)
820 {
823 pContext->pCurrentAdapter->UDPSize = 0;
824 }
826 {
829 pContext->pCurrentAdapter->RawIPSize = 0;
830 }
831 }
832 EndDialog(hwndDlg, (INT_PTR)TRUE);
833 break;
834 case IDCANCEL:
835 EndDialog(hwndDlg, FALSE);
836 break;
837 case IDC_TCP_ADD:
838 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_TCP_LIST), 65536, IDS_TCP_PORTS);
839 break;
840 case IDC_TCP_DEL:
842 break;
843 case IDC_UDP_ADD:
844 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_UDP_LIST), 65536, IDS_UDP_PORTS);
845 break;
846 case IDC_UDP_DEL:
848 break;
849 case IDC_IP_ADD:
850 AddItem(hwndDlg, GetDlgItem(hwndDlg, IDC_IP_LIST), 256, IDS_IP_PROTO);
851 break;
852 case IDC_IP_DEL:
853 DelItem(GetDlgItem(hwndDlg, IDC_IP_LIST));
854 break;
855 default:
856 break;
857 }
858 default:
859 break;
860 }
861
862 return FALSE;
863}
#define IDS_DISABLE_FILTER
Definition: resource.h:128
#define IDC_IP_RESTRICT
Definition: resource.h:91
#define IDS_TCP_PORTS
Definition: resource.h:122
#define IDC_IP_DEL
Definition: resource.h:94
#define IDC_IP_ALLOW_ALL
Definition: resource.h:90
#define IDC_USE_FILTER
Definition: resource.h:95
#define IDC_IP_LIST
Definition: resource.h:92
#define IDC_UDP_LIST
Definition: resource.h:87
#define IDS_IP_PROTO
Definition: resource.h:124
#define IDC_TCP_RESTRICT
Definition: resource.h:81
#define IDC_TCP_ADD
Definition: resource.h:83
#define IDC_UDP_DEL
Definition: resource.h:89
#define IDC_IP_ADD
Definition: resource.h:93
#define IDS_UDP_PORTS
Definition: resource.h:123
#define IDC_UDP_ALLOW_ALL
Definition: resource.h:85
#define IDC_TCP_ALLOW_ALL
Definition: resource.h:80
#define IDC_TCP_LIST
Definition: resource.h:82
#define IDC_UDP_ADD
Definition: resource.h:88
#define IDC_UDP_RESTRICT
Definition: resource.h:86
#define IDC_TCP_DEL
Definition: resource.h:84
TcpipSettings * pTcpIpSettings
AdapterSettings * pCurrentAdapter
LPWSTR CreateFilterList(HWND hDlgCtrl, LPDWORD Size)
static VOID DelItem(HWND hDlgCtrl)
VOID InitFilterListBox(LPWSTR pData, HWND hwndDlg, HWND hDlgCtrl, UINT AllowButton, UINT RestrictButton, UINT AddButton, UINT DelButton)
#define AddItem
Definition: userenv.h:209
#define MB_OK
Definition: winuser.h:801

Referenced by TcpipAdvancedOptDlg().

◆ ToggleUpDown()

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

Definition at line 2020 of file tcpipconf_notify.c.

2021{
2022 LRESULT lResult, lCount;
2023
2024 lResult = SendMessageW(hDlgCtrl, LB_GETCURSEL, 0, 0);
2025 lCount = SendMessageW(hDlgCtrl, LB_GETCOUNT, 0, 0);
2026 if (lResult != LB_ERR)
2027 {
2028 if (lResult == 0)
2029 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
2030 else
2031 EnableWindow(GetDlgItem(hwndDlg, UpButton), TRUE);
2032
2033 if (lResult < lCount -1)
2034 EnableWindow(GetDlgItem(hwndDlg, DownButton), TRUE);
2035 else
2036 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
2037 }
2038
2039 if (lCount)
2040 {
2041 EnableWindow(GetDlgItem(hwndDlg, ModButton), TRUE);
2042 EnableWindow(GetDlgItem(hwndDlg, DelButton), TRUE);
2043 }
2044 else
2045 {
2046 EnableWindow(GetDlgItem(hwndDlg, ModButton), FALSE);
2047 EnableWindow(GetDlgItem(hwndDlg, DelButton), FALSE);
2048 EnableWindow(GetDlgItem(hwndDlg, UpButton), FALSE);
2049 EnableWindow(GetDlgItem(hwndDlg, DownButton), FALSE);
2050 }
2051}

Referenced by TcpipAdvancedDnsDlg().

◆ VerifyDNSSuffix()

BOOL VerifyDNSSuffix ( LPWSTR  szName)

Definition at line 1338 of file tcpipconf_notify.c.

1340{
1341 UINT Index;
1343
1344 for(Index = 0; Index < Length; Index++)
1345 if (iswalnum(szName[Index]) == 0 && szName[Index] != '.' && szName[Index] != '-')
1346 return FALSE;
1347
1348 return TRUE;
1349}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define iswalnum(_c)
Definition: ctype.h:671

Referenced by TcpipAddSuffixDlg(), and TcpipAdvancedDnsDlg().

Variable Documentation

◆ vt_NetCfgComponentControl

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

Definition at line 4413 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().

◆ vt_NetCfgComponentPropertyUi

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

Definition at line 3876 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().

◆ vt_NetCfgComponentSetup

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

Definition at line 4502 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().

◆ vt_TcpipProperties

const ITcpipPropertiesVtbl vt_TcpipProperties
static
Initial value:
=
{
}
HRESULT WINAPI ITcpipProperties_fnQueryInterface(ITcpipProperties *iface, REFIID iid, LPVOID *ppvObj)
ULONG WINAPI ITcpipProperties_fnAddRef(ITcpipProperties *iface)
HRESULT WINAPI ITcpipProperties_fnUnknown1(ITcpipProperties *iface, GUID *pAdapterName, PTCPIP_PROPERTIES *ppProperties)
ULONG WINAPI ITcpipProperties_fnRelease(ITcpipProperties *iface)

Definition at line 4638 of file tcpipconf_notify.c.

Referenced by TcpipConfigNotify_Constructor().