ReactOS 0.4.15-dev-7942-gd23573b
CNetConnectionPropertyUi Class Reference

#include <lanconnectui.h>

Inheritance diagram for CNetConnectionPropertyUi:
Collaboration diagram for CNetConnectionPropertyUi:

Public Member Functions

 CNetConnectionPropertyUi ()
 
 ~CNetConnectionPropertyUi ()
 
STDMETHOD() AddPages (HWND hwndParent, LPFNADDPROPSHEETPAGE pfnAddPage, LPARAM lParam) override
 
STDMETHOD() GetIcon (DWORD dwSize, HICON *phIcon) override
 
STDMETHOD() GetDeviceGuid (GUID *pGuid) override
 
STDMETHOD() SetConnection (INetConnection *pCon) override
 
STDMETHOD() Connect (HWND hwndParent, DWORD dwFlags) override
 
STDMETHOD() Disconnect (HWND hwndParent, DWORD dwFlags) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 

Private Member Functions

BOOL GetINetCfgComponent (INetCfg *pNCfg, INetCfgComponent **pOut)
 
VOID EnumComponents (HWND hDlgCtrl, INetCfg *pNCfg, const GUID *CompGuid, UINT Type, PSP_CLASSIMAGELIST_DATA pCILD)
 
VOID InitializeLANPropertiesUIDlg (HWND hwndDlg)
 
VOID ShowNetworkComponentProperties (HWND hwndDlg)
 
BOOL GetDeviceInstanceID (OUT LPOLESTR *DeviceInstanceID)
 

Static Private Member Functions

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

Private Attributes

CComPtr< INetConnectionm_pCon
 
CComPtr< INetCfgLock > m_NCfgLock
 
CComPtr< INetCfg > m_pNCfg
 
NETCON_PROPERTIESm_pProperties
 

Additional Inherited Members

- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 22 of file lanconnectui.h.

Constructor & Destructor Documentation

◆ CNetConnectionPropertyUi()

CNetConnectionPropertyUi::CNetConnectionPropertyUi ( )

Definition at line 10 of file lanconnectui.cpp.

10 :
12{
13}
NETCON_PROPERTIES * m_pProperties
Definition: lanconnectui.h:56
#define NULL
Definition: types.h:112

◆ ~CNetConnectionPropertyUi()

CNetConnectionPropertyUi::~CNetConnectionPropertyUi ( )

Definition at line 15 of file lanconnectui.cpp.

16{
17 if (m_pNCfg)
18 m_pNCfg->Uninitialize();
19
20 // Note: MSDN says we can only unlock after INetCfg::Uninitialize
21 if (m_NCfgLock)
22 m_NCfgLock->ReleaseWriteLock();
23
24 if (m_pProperties)
26}
CComPtr< INetCfgLock > m_NCfgLock
Definition: lanconnectui.h:54
CComPtr< INetCfg > m_pNCfg
Definition: lanconnectui.h:55
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119

Member Function Documentation

◆ AddPages()

HRESULT WINAPI CNetConnectionPropertyUi::AddPages ( HWND  hwndParent,
LPFNADDPROPSHEETPAGE  pfnAddPage,
LPARAM  lParam 
)
override

Definition at line 458 of file lanconnectui.cpp.

462{
463 HPROPSHEETPAGE hProp;
464 BOOL ret;
465 HRESULT hr = E_FAIL;
467
468 initEx.dwSize = sizeof(initEx);
470 if (!InitCommonControlsEx(&initEx))
471 return E_FAIL;
472
473 hr = m_pCon->GetProperties(&m_pProperties);
475 return hr;
476
478 if (hProp)
479 {
480 ret = (*pfnAddPage)(hProp, lParam);
481 if (ret)
482 {
483 hr = NOERROR;
484 }
485 else
486 {
488 }
489 }
490 return hr;
491}
static INT_PTR CALLBACK LANPropertiesUIDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
CComPtr< INetConnection > m_pCon
Definition: lanconnectui.h:53
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
#define E_FAIL
Definition: ddrawi.h:102
#define IDD_NETPROPERTIES
Definition: resource.h:20
BOOL WINAPI DestroyPropertySheetPage(HPROPSHEETPAGE hPropPage)
Definition: propsheet.c:3152
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
unsigned int BOOL
Definition: ntddk_ex.h:94
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
HPROPSHEETPAGE InitializePropertySheetPage(LPWSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
Definition: netshell.cpp:29
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
HRESULT hr
Definition: shlfolder.c:183
int ret
LONG_PTR LPARAM
Definition: windef.h:208
#define NOERROR
Definition: winerror.h:2354
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ Connect()

HRESULT WINAPI CNetConnectionPropertyUi::Connect ( HWND  hwndParent,
DWORD  dwFlags 
)
override

Definition at line 523 of file lanconnectui.cpp.

526{
527 if (!m_pCon)
528 return E_POINTER; //FIXME
529
530 if (dwFlags & NCUC_NO_UI)
531 return m_pCon->Connect();
532
533 return E_FAIL;
534}
@ NCUC_NO_UI
Definition: netcon.h:178
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define E_POINTER
Definition: winerror.h:2365

◆ Disconnect()

HRESULT WINAPI CNetConnectionPropertyUi::Disconnect ( HWND  hwndParent,
DWORD  dwFlags 
)
override

Definition at line 538 of file lanconnectui.cpp.

541{
542 WCHAR szBuffer[100];
543 swprintf(szBuffer, L"INetConnectionConnectUi_fnDisconnect flags %x\n", dwFlags);
544 MessageBoxW(NULL, szBuffer, NULL, MB_OK);
545
546 return S_OK;
547}
#define swprintf
Definition: precomp.h:40
#define S_OK
Definition: intsafe.h:52
#define L(x)
Definition: ntvdm.h:50
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:790
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ EnumComponents()

VOID CNetConnectionPropertyUi::EnumComponents ( HWND  hDlgCtrl,
INetCfg *  pNCfg,
const GUID CompGuid,
UINT  Type,
PSP_CLASSIMAGELIST_DATA  pCILD 
)
private

Definition at line 77 of file lanconnectui.cpp.

78{
79 HRESULT hr;
81 ULONG Num;
82 DWORD dwCharacteristics;
83 LPOLESTR pDisplayName, pHelpText;
84 PNET_ITEM pItem;
85 BOOL bChecked;
86
87 hr = pNCfg->EnumComponents(CompGuid, &pENetCfg);
89 return;
90
91 while (TRUE)
92 {
95 CComPtr<INetCfgComponent> pAdapterCfgComp;
96
97 hr = pENetCfg->Next(1, &pNCfgComp, &Num);
98 if (hr != S_OK)
99 break;
100
101 hr = pNCfgComp->GetCharacteristics(&dwCharacteristics);
102 if (SUCCEEDED(hr) && (dwCharacteristics & NCF_HIDDEN))
103 continue;
104
105 pDisplayName = NULL;
106 pHelpText = NULL;
107 hr = pNCfgComp->GetDisplayName(&pDisplayName);
108 hr = pNCfgComp->GetHelpText(&pHelpText);
109 bChecked = FALSE;
110 hr = pNCfgComp->QueryInterface(IID_PPV_ARG(INetCfgComponentBindings, &pCompBind));
111 if (SUCCEEDED(hr))
112 {
113 if (GetINetCfgComponent(pNCfg, &pAdapterCfgComp))
114 {
115 hr = pCompBind->IsBoundTo(pAdapterCfgComp);
116 if (hr == S_OK)
117 bChecked = TRUE;
118 }
119 }
120
121 pItem = static_cast<NET_ITEM*>(CoTaskMemAlloc(sizeof(NET_ITEM)));
122 if (!pItem)
123 continue;
124
125 pItem->dwCharacteristics = dwCharacteristics;
126 pItem->szHelp = pHelpText;
127 pItem->Type = (NET_TYPE)Type;
128 pItem->pNCfgComp = pNCfgComp.Detach();
129 pItem->NumPropDialogOpen = 0;
130
131 INT image;
132 if (!pCILD->ImageList || !SetupDiGetClassImageIndex(pCILD, CompGuid, &image))
134 AddItemToListView(hDlgCtrl, pItem, pDisplayName, bChecked, image);
135 CoTaskMemFree(pDisplayName);
136 }
137}
Type
Definition: Type.h:7
T * Detach()
Definition: atlcomcli.h:186
BOOL GetINetCfgComponent(INetCfg *pNCfg, INetCfgComponent **pOut)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NCF_HIDDEN
Definition: precomp.h:44
BOOL WINAPI SetupDiGetClassImageIndex(IN PSP_CLASSIMAGELIST_DATA ClassImageListData, IN CONST GUID *ClassGuid, OUT PINT ImageIndex)
Definition: devclass.c:277
unsigned long DWORD
Definition: ntddk_ex.h:95
GLeglImageOES image
Definition: gl.h:2204
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define SUCCEEDED(hr)
Definition: intsafe.h:50
VOID AddItemToListView(HWND hDlgCtrl, PNET_ITEM pItem, LPWSTR szName, BOOL bChecked, UINT Image)
NET_TYPE
Definition: lanconnectui.h:7
static LPOLESTR
Definition: stg_prop.c:27
#define I_IMAGENONE
Definition: commctrl.h:2386
INetCfgComponent * pNCfgComp
Definition: lanconnectui.h:18
NET_TYPE Type
Definition: lanconnectui.h:15
UINT NumPropDialogOpen
Definition: lanconnectui.h:19
LPWSTR szHelp
Definition: lanconnectui.h:17
DWORD dwCharacteristics
Definition: lanconnectui.h:16
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define IID_PPV_ARG(Itype, ppType)

Referenced by InitializeLANPropertiesUIDlg().

◆ GetDeviceGuid()

HRESULT WINAPI CNetConnectionPropertyUi::GetDeviceGuid ( GUID pGuid)
override

Definition at line 504 of file lanconnectui.cpp.

505{
506 CopyMemory(pGuid, &m_pProperties->guidId, sizeof(GUID));
507 return S_OK;
508}
#define CopyMemory
Definition: winbase.h:1710

◆ GetDeviceInstanceID()

BOOL CNetConnectionPropertyUi::GetDeviceInstanceID ( OUT LPOLESTR DeviceInstanceID)
private

Definition at line 415 of file lanconnectui.cpp.

417{
418 LPOLESTR pStr, pResult;
419 HKEY hKey;
420 DWORD dwInstanceID;
421 WCHAR szKeyName[2*MAX_PATH];
422 WCHAR szInstanceID[2*MAX_PATH];
423
425 {
426 // failed to convert guid to string
427 return FALSE;
428 }
429
430 StringCbPrintfW(szKeyName, sizeof(szKeyName), L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pStr);
431 CoTaskMemFree(pStr);
432
434 {
435 // failed to open key
436 return FALSE;
437 }
438
439 dwInstanceID = sizeof(szInstanceID);
440 if (RegGetValueW(hKey, NULL, L"PnpInstanceId", RRF_RT_REG_SZ, NULL, (PVOID)szInstanceID, &dwInstanceID) == ERROR_SUCCESS)
441 {
442 szInstanceID[MAX_PATH-1] = L'\0';
443 pResult = static_cast<LPOLESTR>(CoTaskMemAlloc((wcslen(szInstanceID) + 1) * sizeof(WCHAR)));
444 if (pResult != 0)
445 {
446 wcscpy(pResult, szInstanceID);
447 *DeviceInstanceID = pResult;
449 return TRUE;
450 }
451 }
453 return FALSE;
454}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
#define MAX_PATH
Definition: compat.h:34
HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
Definition: compobj.c:2412
#define RRF_RT_REG_SZ
Definition: driver.c:575
FxAutoRegKey hKey
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define KEY_READ
Definition: nt_native.h:1023
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

◆ GetIcon()

HRESULT WINAPI CNetConnectionPropertyUi::GetIcon ( DWORD  dwSize,
HICON phIcon 
)
override

Definition at line 495 of file lanconnectui.cpp.

498{
499 return E_NOTIMPL;
500}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetINetCfgComponent()

BOOL CNetConnectionPropertyUi::GetINetCfgComponent ( INetCfg *  pNCfg,
INetCfgComponent **  pOut 
)
private

Definition at line 44 of file lanconnectui.cpp.

45{
47 HRESULT hr;
48 ULONG Fetched;
50
51 hr = pNCfg->EnumComponents(&GUID_DEVCLASS_NET, &pEnumCfg);
53 return FALSE;
54
55 while (TRUE)
56 {
58 hr = pEnumCfg->Next(1, &pNCg, &Fetched);
59 if (hr != S_OK)
60 break;
61
62 hr = pNCg->GetDisplayName(&pName);
63 if (SUCCEEDED(hr))
64 {
66 {
67 *pOut = pNCg.Detach();
68 return TRUE;
69 }
71 }
72 }
73 return FALSE;
74}
static LPSTR pName
Definition: security.c:75
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
LPWSTR pszwDeviceName
Definition: netcon.h:85
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by EnumComponents().

◆ InitializeLANPropertiesUIDlg()

VOID CNetConnectionPropertyUi::InitializeLANPropertiesUIDlg ( HWND  hwndDlg)
private

Definition at line 140 of file lanconnectui.cpp.

141{
142 HRESULT hr;
143 CComPtr<INetCfg> pNCfg;
144 CComPtr<INetCfgLock> pNCfgLock;
145 HWND hDlgCtrl = GetDlgItem(hwndDlg, IDC_COMPONENTSLIST);
146 LVCOLUMNW lc;
147 RECT rc;
148 DWORD dwStyle;
149 LPWSTR pDisplayName;
150
153 {
154 /* check show item on taskbar*/
156 }
158 {
159 /* check notify item */
161 }
162
163 memset(&lc, 0, sizeof(LV_COLUMN));
165 lc.fmt = LVCFMT_FIXED_WIDTH;
166 if (GetClientRect(hDlgCtrl, &rc))
167 {
168 lc.mask |= LVCF_WIDTH;
169 lc.cx = rc.right - rc.left;
170 }
171 lc.pszText = (LPWSTR)L"";
172 (void)SendMessageW(hDlgCtrl, LVM_INSERTCOLUMNW, 0, (LPARAM)&lc);
173 dwStyle = (DWORD) SendMessage(hDlgCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
174 dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;
175 SendMessage(hDlgCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
176
177 hr = CoCreateInstance(CLSID_CNetCfg, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(INetCfg, &pNCfg));
178 if (FAILED(hr))
179 return;
180
181 hr = pNCfg->QueryInterface(IID_PPV_ARG(INetCfgLock, &pNCfgLock));
182 hr = pNCfgLock->AcquireWriteLock(100, L"", &pDisplayName);
183 if (hr == S_FALSE)
184 {
185 CoTaskMemFree(pDisplayName);
186 return;
187 }
188
189 hr = pNCfg->Initialize(NULL);
191 {
192 pNCfgLock->ReleaseWriteLock();
193 return;
194 }
195
196 m_pNCfg = pNCfg;
197 m_NCfgLock = pNCfgLock;
198
200 spcid.cbSize = sizeof(spcid);
201 if (SetupDiGetClassImageList(&spcid))
202 {
204 ListView_SetImageList(hDlgCtrl, hIL, LVSIL_SMALL);
205 }
206 else
207 {
208 spcid.ImageList = NULL;
209 }
210
211 EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETCLIENT, NET_TYPE_CLIENT, &spcid);
212 EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETSERVICE, NET_TYPE_SERVICE, &spcid);
213 EnumComponents(hDlgCtrl, pNCfg, &GUID_DEVCLASS_NETTRANS, NET_TYPE_PROTOCOL, &spcid);
214
215 if (spcid.ImageList)
217
219}
VOID EnumComponents(HWND hDlgCtrl, INetCfg *pNCfg, const GUID *CompGuid, UINT Type, PSP_CLASSIMAGELIST_DATA pCILD)
#define NCCF_NOTIFY_DISCONNECTED
Definition: precomp.h:76
#define IDC_NETCARDNAME
Definition: resource.h:27
#define IDC_SHOWTASKBAR
Definition: resource.h:34
#define IDC_NOTIFYNOCONNECTION
Definition: resource.h:35
#define IDC_COMPONENTSLIST
Definition: resource.h:29
HIMAGELIST WINAPI ImageList_Duplicate(HIMAGELIST himlSrc)
Definition: imagelist.c:1801
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
BOOL WINAPI SetupDiDestroyClassImageList(IN PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:85
BOOL WINAPI SetupDiGetClassImageList(OUT PSP_CLASSIMAGELIST_DATA ClassImageListData)
Definition: devclass.c:322
#define FAILED(hr)
Definition: intsafe.h:51
@ NET_TYPE_PROTOCOL
Definition: lanconnectui.h:10
@ NET_TYPE_SERVICE
Definition: lanconnectui.h:9
@ NET_TYPE_CLIENT
Definition: lanconnectui.h:8
EXTERN_C const GUID CLSID_CNetCfg
Definition: netcfgx.h:299
@ NCCF_SHOW_ICON
Definition: netcon.h:20
#define DWORD
Definition: nt_native.h:44
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define ListView_SetImageList(hwnd, himl, iImageList)
Definition: commctrl.h:2304
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2632
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2727
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2724
#define LV_COLUMN
Definition: commctrl.h:2547
#define memset(x, y, z)
Definition: compat.h:39
LPWSTR pszText
Definition: commctrl.h:2567
LONG right
Definition: windef.h:308
LONG left
Definition: windef.h:306
#define S_FALSE
Definition: winerror.h:2357
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1921
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1617
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SendMessage
Definition: winuser.h:5843
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197

◆ LANPropertiesUIDlg()

INT_PTR CALLBACK CNetConnectionPropertyUi::LANPropertiesUIDlg ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
staticprivate

Definition at line 265 of file lanconnectui.cpp.

270{
272 LPNMLISTVIEW lppl;
273 LVITEMW li;
274 PNET_ITEM pItem;
276 LPPSHNOTIFY lppsn;
277 DWORD dwShowIcon, dwNotifyDisconnect;
278 HRESULT hr;
279 WCHAR szKey[200];
280 LPOLESTR pStr;
281 HKEY hKey;
282
283 switch (uMsg)
284 {
285 case WM_INITDIALOG:
288 This->InitializeLANPropertiesUIDlg(hwndDlg);
290 return TRUE;
291 case WM_NOTIFY:
292 lppl = (LPNMLISTVIEW) lParam;
293 lppsn = (LPPSHNOTIFY) lParam;
294 if (lppsn->hdr.code == PSN_APPLY)
295 {
297 if (This->m_pNCfg)
298 {
299 hr = This->m_pNCfg->Apply();
300 if (FAILED(hr))
301 return PSNRET_INVALID;
302 }
303
305 dwShowIcon = 1;
306 else
307 dwShowIcon = 0;
308
310 dwNotifyDisconnect = 1;
311 else
312 dwNotifyDisconnect = 0;
313
314 //NOTE: Windows write these setting with the undocumented INetLanConnection::SetInfo
315 if (StringFromCLSID((CLSID)This->m_pProperties->guidId, &pStr) == ERROR_SUCCESS)
316 {
317 swprintf(szKey, L"SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\Connection", pStr);
318 CoTaskMemFree(pStr);
320 {
321 RegSetValueExW(hKey, L"ShowIcon", 0, REG_DWORD, (LPBYTE)&dwShowIcon, sizeof(DWORD));
322 RegSetValueExW(hKey, L"IpCheckingEnabled", 0, REG_DWORD, (LPBYTE)&dwNotifyDisconnect, sizeof(DWORD));
324 }
325 }
326
327 return PSNRET_NOERROR;
328 }
329#if 0
330 else if (lppsn->hdr.code == PSN_CANCEL)
331 {
333 if (This->m_pNCfg)
334 {
335 hr = This->m_pNCfg->Cancel();
336 if (SUCCEEDED(hr))
337 return PSNRET_NOERROR;
338 else
339 return PSNRET_INVALID;
340 }
341 return PSNRET_NOERROR;
342 }
343#endif
344 if (lppl->hdr.code == NM_DBLCLK)
345 {
347 This->ShowNetworkComponentProperties(hwndDlg);
348 return FALSE;
349 }
350
351 if (lppl->hdr.code == LVN_ITEMCHANGING)
352 {
353 ZeroMemory(&li, sizeof(li));
354 li.mask = LVIF_PARAM;
355 li.iItem = lppl->iItem;
356 if (!SendMessageW(lppl->hdr.hwndFrom, LVM_GETITEMW, 0, (LPARAM)&li))
357 return TRUE;
358
359 pItem = (PNET_ITEM)li.lParam;
360 if (!pItem)
361 return TRUE;
362
363 if (!(lppl->uOldState & LVIS_FOCUSED) && (lppl->uNewState & LVIS_FOCUSED))
364 {
365 /* new focused item */
368 else
370
371 if (pItem->dwCharacteristics & NCF_HAS_UI)
373 else
375
377 }
378 }
379 break;
380 case WM_COMMAND:
382 {
384 This->ShowNetworkComponentProperties(hwndDlg);
385 return FALSE;
386 }
387 else if (LOWORD(wParam) == IDC_CONFIGURE)
388 {
389 LPOLESTR DeviceInstanceID;
391
392 if (This->GetDeviceInstanceID(&DeviceInstanceID))
393 {
394 WCHAR wszCmd[2*MAX_PATH];
395 StringCbPrintfW(wszCmd, sizeof(wszCmd), L"rundll32.exe devmgr.dll,DeviceProperties_RunDLL /DeviceID %s", DeviceInstanceID);
396 CoTaskMemFree(DeviceInstanceID);
397
398 STARTUPINFOW si;
400 ZeroMemory(&si, sizeof(si));
401 si.cb = sizeof(si);
402 if (!CreateProcessW(NULL, wszCmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
403 break;
404
405 CloseHandle(pi.hProcess);
406 CloseHandle(pi.hThread);
407 }
408 }
409 break;
410 }
411 return FALSE;
412}
#define IDC_DESCRIPTION
Definition: resource.h:129
WPARAM wParam
Definition: combotst.c:138
#define NCF_HAS_UI
Definition: precomp.h:48
#define NCF_NOT_USER_REMOVABLE
Definition: precomp.h:46
#define IDC_UNINSTALL
Definition: resource.h:31
#define IDC_CONFIGURE
Definition: resource.h:28
#define IDC_PROPERTIES
Definition: resource.h:32
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
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4592
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
struct NET_ITEM * PNET_ITEM
if(dx< 0)
Definition: linetemp.h:194
static refpint_t pi[]
Definition: server.c:96
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define KEY_WRITE
Definition: nt_native.h:1031
#define LOWORD(l)
Definition: pedump.c:82
#define PSNRET_INVALID
Definition: prsht.h:130
#define PSN_APPLY
Definition: prsht.h:117
#define PSNRET_NOERROR
Definition: prsht.h:129
struct _PSHNOTIFY * LPPSHNOTIFY
#define PROPSHEETPAGE
Definition: prsht.h:389
#define NM_DBLCLK
Definition: commctrl.h:131
#define LVN_ITEMCHANGING
Definition: commctrl.h:3130
#define LVIF_PARAM
Definition: commctrl.h:2311
struct tagNMLISTVIEW * LPNMLISTVIEW
#define LVM_GETITEMW
Definition: commctrl.h:2390
#define WM_NOTIFY
Definition: richedit.h:61
#define REG_DWORD
Definition: sdbapi.c:596
NMHDR hdr
Definition: prsht.h:330
DWORD cb
Definition: winbase.h:852
Definition: module.h:576
UINT code
Definition: winuser.h:3159
HWND hwndFrom
Definition: winuser.h:3157
UINT uNewState
Definition: commctrl.h:3036
UINT uOldState
Definition: commctrl.h:3037
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ZeroMemory
Definition: winbase.h:1712
#define DWLP_USER
Definition: winuser.h:872
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_INITDIALOG
Definition: winuser.h:1739
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BM_GETCHECK
Definition: winuser.h:1918

Referenced by AddPages().

◆ SetConnection()

HRESULT WINAPI CNetConnectionPropertyUi::SetConnection ( INetConnection pCon)
override

Definition at line 512 of file lanconnectui.cpp.

513{
514 if (!pCon)
515 return E_POINTER;
516
517 m_pCon = pCon;
518 return S_OK;
519}

◆ ShowNetworkComponentProperties()

VOID CNetConnectionPropertyUi::ShowNetworkComponentProperties ( HWND  hwndDlg)
private

Definition at line 222 of file lanconnectui.cpp.

223{
224 LVITEMW lvItem;
225 HWND hDlgCtrl;
227 HRESULT hr;
228 INetCfgComponent *pNCfgComp;
229 PNET_ITEM pItem;
230
231 hDlgCtrl = GetDlgItem(hwndDlg, IDC_COMPONENTSLIST);
232 Count = ListView_GetItemCount(hDlgCtrl);
233 if (!Count)
234 return;
235
236 ZeroMemory(&lvItem, sizeof(LVITEMW));
237 lvItem.mask = LVIF_PARAM | LVIF_STATE;
238 lvItem.stateMask = (UINT)-1;
239 for (Index = 0; Index < Count; Index++)
240 {
241 lvItem.iItem = Index;
242 if (SendMessageW(hDlgCtrl, LVM_GETITEMW, 0, (LPARAM)&lvItem))
243 {
244 if (lvItem.state & LVIS_SELECTED)
245 break;
246 }
247 }
248
249 if (!(lvItem.state & LVIS_SELECTED))
250 {
251 return;
252 }
253
254 pItem = (PNET_ITEM)lvItem.lParam;
255 pNCfgComp = (INetCfgComponent*)pItem->pNCfgComp;
256 hr = pNCfgComp->RaisePropertyUi(GetParent(hwndDlg), NCRP_QUERY_PROPERTY_UI, (INetConnectionConnectUi*)this);
257 if (SUCCEEDED(hr))
258 {
259 hr = pNCfgComp->RaisePropertyUi(GetParent(hwndDlg), NCRP_SHOW_PROPERTY_UI, (INetConnectionConnectUi*)this);
260 }
261}
unsigned int UINT
Definition: ndis.h:50
@ NCRP_QUERY_PROPERTY_UI
Definition: netcfgx.h:31
@ NCRP_SHOW_PROPERTY_UI
Definition: netcfgx.h:32
int Count
Definition: noreturn.cpp:7
#define LVIF_STATE
Definition: commctrl.h:2312
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
UINT mask
Definition: commctrl.h:2360
UINT stateMask
Definition: commctrl.h:2364
_In_ WDFCOLLECTION _In_ ULONG Index
HWND WINAPI GetParent(_In_ HWND)

Member Data Documentation

◆ m_NCfgLock

CComPtr<INetCfgLock> CNetConnectionPropertyUi::m_NCfgLock
private

Definition at line 54 of file lanconnectui.h.

Referenced by InitializeLANPropertiesUIDlg(), and ~CNetConnectionPropertyUi().

◆ m_pCon

CComPtr<INetConnection> CNetConnectionPropertyUi::m_pCon
private

Definition at line 53 of file lanconnectui.h.

Referenced by AddPages(), Connect(), and SetConnection().

◆ m_pNCfg

CComPtr<INetCfg> CNetConnectionPropertyUi::m_pNCfg
private

Definition at line 55 of file lanconnectui.h.

Referenced by InitializeLANPropertiesUIDlg(), and ~CNetConnectionPropertyUi().

◆ m_pProperties

NETCON_PROPERTIES* CNetConnectionPropertyUi::m_pProperties
private

The documentation for this class was generated from the following files: