ReactOS 0.4.16-dev-306-g647d351
shfldr_netconnect.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Shell
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: CNetworkConnections Shell Folder
5 * COPYRIGHT: Copyright 2008 Johannes Anderwald <johannes.anderwald@reactos.org>
6 */
7
8#include "precomp.h"
9#include <shellfolderutils.h>
10
11#define MAX_PROPERTY_SHEET_PAGE (10)
12
13/***********************************************************************
14* IShellFolder implementation
15*/
16
17static const shvheader NetConnectSFHeader[] = {
24};
25
26#define NETCONNECTSHELLVIEWCOLUMNS 6
27
28#define COLUMN_NAME 0
29#define COLUMN_TYPE 1
30#define COLUMN_STATUS 2
31#define COLUMN_DEVNAME 3
32#define COLUMN_PHONE 4
33#define COLUMN_OWNER 5
34
37 IOleCommandTarget *lpOleCmd,
38 PCUITEMID_CHILD pidl,
39 HWND hwnd);
40
42 m_pidlRoot(NULL)
43{
44 HRESULT hr;
45 hr = CoCreateInstance(CLSID_ConnectionTray, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IOleCommandTarget, &m_lpOleCmd));
48}
49
51{
52 if (m_pidlRoot)
54}
55
56/**************************************************************************
57* ISF_NetConnect_fnParseDisplayName
58*/
60 HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
61 DWORD * pchEaten, PIDLIST_RELATIVE * ppidl, DWORD * pdwAttributes)
62{
64
65 *ppidl = 0;
66 if (pchEaten)
67 *pchEaten = 0; /* strange but like the original */
68
69 return hr;
70}
71
72/**************************************************************************
73* ISF_NetConnect_fnEnumObjects
74*/
76 HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
77{
78 return CEnumIDList_CreateInstance(hwndOwner, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
79}
80
81/**************************************************************************
82* ISF_NetConnect_fnBindToObject
83*/
85 PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
86{
87 return E_NOTIMPL;
88}
89
90/**************************************************************************
91* ISF_NetConnect_fnBindToStorage
92*/
94 PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
95{
96 *ppvOut = NULL;
97 return E_NOTIMPL;
98}
99
100/**************************************************************************
101* ISF_NetConnect_fnCompareIDs
102*/
105{
106 const UINT colcount = NETCONNECTSHELLVIEWCOLUMNS;
107
108 if (ILGetNext(pidl1) || ILGetNext(pidl2))
109 return E_NOTIMPL; // FIXME: Can the connection folder have subfolders?
110
112 {
113 PNETCONIDSTRUCT p1 = ILGetConnData(pidl1);
114 PNETCONIDSTRUCT p2 = ILGetConnData(pidl2);
115 if (p1 && p2)
116 {
117 int res = memcmp(&p1->guidId, &p2->guidId, sizeof(GUID));
119 }
120 }
121 IShellFolder2 *psf = static_cast<IShellFolder2*>(this);
122 return ShellFolderImpl_CompareItemIDs<colcount, -1>(psf, lParam, (PCUITEMID_CHILD)pidl1, (PCUITEMID_CHILD)pidl2);
123}
124
125/**************************************************************************
126* ISF_NetConnect_fnCreateViewObject
127*/
129 HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
130{
132
133 if (!ppvOut)
134 return hr;
135
136 *ppvOut = NULL;
137
138 if (IsEqualIID(riid, IID_IShellView))
139 {
140 CSFV cvf = {sizeof(cvf), this};
141 CComPtr<IShellView> pShellView;
142 hr = SHCreateShellFolderViewEx(&cvf, &pShellView);
144 return hr;
145
146 return pShellView->QueryInterface(riid, ppvOut);
147 }
148
149 return hr;
150}
151
152/**************************************************************************
153* ISF_NetConnect_fnGetAttributesOf
154*/
156 UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD * rgfInOut)
157{
158 //IGenericSFImpl *This = (IGenericSFImpl *)iface;
159 // FIXME: Why are these reporting SFGAO_FILESYSTEM and SFGAO_FILESYSANCESTOR?
160 HRESULT hr = S_OK;
161 static const DWORD dwNetConnectAttributes = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
162 SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
163
164 static const DWORD dwNetConnectItemAttributes = SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
165 SFGAO_FILESYSANCESTOR | SFGAO_CANRENAME;
166
167 if (!rgfInOut)
168 return E_INVALIDARG;
169
170 if (cidl && !apidl)
171 return E_INVALIDARG;
172
173 if (*rgfInOut == 0)
174 *rgfInOut = ~0;
175
176 if (cidl > 1)
177 *rgfInOut &= ~SFGAO_HASPROPSHEET;
178
179 if (cidl == 0)
180 {
181 *rgfInOut = dwNetConnectAttributes;
182 }
183 else
184 {
185 *rgfInOut = dwNetConnectItemAttributes;
186
187 while (cidl > 0 && *apidl)
188 {
190 if (!pdata)
191 continue;
192
193 if (!(pdata->dwCharacter & NCCF_ALLOW_RENAME))
194 *rgfInOut &= ~SFGAO_CANRENAME;
195
196 apidl++;
197 cidl--;
198 }
199 }
200
201 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
202 *rgfInOut &= ~SFGAO_VALIDATE;
203
204 return hr;
205}
206
207/**************************************************************************
208* ISF_NetConnect_fnGetUIObjectOf
209*
210* PARAMETERS
211* hwndOwner [in] Parent window for any output
212* cidl [in] array size
213* apidl [in] simple pidl array
214* riid [in] Requested Interface
215* prgfInOut [ ] reserved
216* ppvObject [out] Resulting Interface
217*
218*/
219
221 HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid,
222 UINT * prgfInOut, LPVOID * ppvOut)
223{
224 IUnknown *pObj = NULL;
226
227 if (!ppvOut)
228 return hr;
229
230 *ppvOut = NULL;
231
232 if ((IsEqualIID(riid, IID_IContextMenu) || IsEqualIID (riid, IID_IContextMenu2) || IsEqualIID(riid, IID_IContextMenu3) ||
233 IsEqualIID(riid, IID_IQueryInfo) || IsEqualIID(riid, IID_IExtractIconW)) && cidl >= 1)
234 {
235 return ShellObjectCreatorInit<CNetConUiObject>(apidl[0], m_lpOleCmd, riid, ppvOut);
236 }
237 else
239
240 *ppvOut = pObj;
241 return hr;
242}
243
244/**************************************************************************
245* ISF_NetConnect_fnGetDisplayNameOf
246*
247*/
249{
250 if (!strRet)
251 return E_INVALIDARG;
252
253 if (!pidl)
254 return SHSetStrRet(strRet, netshell_hInstance, IDS_NETWORKCONNECTION);
255
256 PWCHAR pwchName = ILGetConnName(pidl);
257 if (!pwchName)
258 {
259 ERR("Got invalid pidl\n");
260 return E_INVALIDARG;
261 }
262
263 return SHSetStrRet(strRet, pwchName);
264}
265
266/**************************************************************************
267* ISF_NetConnect_fnSetNameOf
268* Changes the name of a file object or subfolder, possibly changing its item
269* identifier in the process.
270*
271* PARAMETERS
272* hwndOwner [in] Owner window for output
273* pidl [in] simple pidl of item to change
274* lpszName [in] the items new display name
275* dwFlags [in] SHGNO formatting flags
276* ppidlOut [out] simple pidl returned
277*/
279 HWND hwndOwner, PCUITEMID_CHILD pidl, /*simple pidl */
280 LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD * pPidlOut)
281{
282 HRESULT hr;
284
285 hr = ILGetConnection(pidl, &pCon);
287 return hr;
288
289 hr = pCon->Rename(lpName);
291 return hr;
292
293 if (pPidlOut)
294 {
295 *pPidlOut = ILCreateNetConnectItem(pCon);
296 if (*pPidlOut == NULL)
297 return E_FAIL;
298 }
299
300 return S_OK;
301}
302
304{
305 return E_NOTIMPL;
306}
307
309{
310 return E_NOTIMPL;
311}
312
314{
315 if (pSort)
316 *pSort = 0;
317 if (pDisplay)
318 *pDisplay = 0;
319
320 return S_OK;
321}
322
324{
325 if (!pcsFlags || iColumn >= NETCONNECTSHELLVIEWCOLUMNS)
326 return E_INVALIDARG;
327 *pcsFlags = NetConnectSFHeader[iColumn].pcsFlags;
328 return S_OK;
329}
330
332 PCUITEMID_CHILD pidl, const SHCOLUMNID * pscid, VARIANT * pv)
333{
334 return E_NOTIMPL;
335}
336
338 PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS * psd)
339{
340 if (iColumn >= NETCONNECTSHELLVIEWCOLUMNS)
341 return E_FAIL;
342
343 psd->fmt = NetConnectSFHeader[iColumn].fmt;
344 psd->cxChar = NetConnectSFHeader[iColumn].cxChar;
345 if (pidl == NULL)
346 return SHSetStrRet(&psd->str, netshell_hInstance, NetConnectSFHeader[iColumn].colnameid);
347
349 if (!pdata)
350 return E_FAIL;
351
352 switch (iColumn)
353 {
354 case COLUMN_NAME:
355 return SHSetStrRet(&psd->str, ILGetConnName(pidl));
356 case COLUMN_TYPE:
357 if (pdata->MediaType == NCM_LAN || pdata->MediaType == NCM_SHAREDACCESSHOST_RAS)
358 {
359 return SHSetStrRet(&psd->str, netshell_hInstance, IDS_TYPE_ETHERNET);
360 }
361 else
362 {
363 return SHSetStrRet(&psd->str, "");
364 }
365 break;
366 case COLUMN_STATUS:
367 switch(pdata->Status)
368 {
370 return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_NON_OPERATIONAL);
371 case NCS_DISCONNECTED:
372 return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_UNREACHABLE);
374 return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_DISCONNECTED);
375 case NCS_CONNECTING:
376 return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_CONNECTING);
377 case NCS_CONNECTED:
378 return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_CONNECTED);
379 default:
380 return SHSetStrRet(&psd->str, "");
381 }
382 break;
383 case COLUMN_DEVNAME:
384 return SHSetStrRet(&psd->str, ILGetDeviceName(pidl));
385 case COLUMN_PHONE:
386 case COLUMN_OWNER:
387 return SHSetStrRet(&psd->str, "");
388 }
389
390 return E_FAIL;
391}
392
394{
395 return E_NOTIMPL;
396}
397
398//IObjectWithSite
399//IInternetSecurityManager
400
401/**************************************************************************
402* IContextMenu2 Implementation
403*/
404
406 : m_pidl(NULL)
407{
408}
409
411{
412}
413
415{
416 m_pidl = pidl;
417 m_lpOleCmd = lpOleCmd;
418 return S_OK;
419}
420
422 HMENU hmenu,
423 UINT indexMenu,
424 BOOL fByPosition,
425 UINT wID,
426 UINT fType,
427 LPCWSTR dwTypeData,
428 UINT fState)
429{
430 MENUITEMINFOW mii;
431 WCHAR szText[100];
432
433 ZeroMemory(&mii, sizeof(mii));
434 mii.cbSize = sizeof(mii);
435 if (fType == MFT_SEPARATOR)
436 {
437 mii.fMask = MIIM_ID | MIIM_TYPE;
438 }
439 else if (fType == MFT_STRING)
440 {
442 if ((ULONG_PTR)HIWORD((ULONG_PTR)dwTypeData) == 0)
443 {
444 if (LoadStringW(netshell_hInstance, LOWORD((ULONG_PTR)dwTypeData), szText, sizeof(szText)/sizeof(WCHAR)))
445 {
446 szText[(sizeof(szText)/sizeof(WCHAR))-1] = 0;
447 mii.dwTypeData = szText;
448 }
449 else
450 {
451 return;
452 }
453 }
454 else
455 {
456 mii.dwTypeData = (LPWSTR) dwTypeData;
457 }
458 mii.fState = fState;
459 }
460
461 mii.wID = wID;
462 mii.fType = fType;
463 InsertMenuItemW( hmenu, indexMenu, fByPosition, &mii);
464}
465
466/**************************************************************************
467* ISF_NetConnect_IContextMenu_QueryContextMenu()
468*/
470 HMENU hMenu,
471 UINT indexMenu,
472 UINT idCmdFirst,
473 UINT idCmdLast,
474 UINT uFlags)
475{
477 if (!pdata)
478 {
479 ERR("Got invalid pidl\n");
480 return E_FAIL;
481 }
482
483 if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
485 else
486 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 1, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DEACTIVATE), MFS_ENABLED);
487
488 if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
489 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_GRAYED);
490 else if (pdata->Status == NCS_CONNECTED)
491 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_DEFAULT);
492 else
493 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_ENABLED);
494
495 if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED)
496 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_GRAYED);
497 else
498 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_ENABLED);
499
500 _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
501 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 4, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_CREATELINK), MFS_ENABLED);
502
503 if (pdata->dwCharacter & NCCF_ALLOW_REMOVAL)
504 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_ENABLED);
505 else
506 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_GRAYED);
507
508 if (pdata->dwCharacter & NCCF_ALLOW_RENAME)
509 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_ENABLED);
510 else
511 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_GRAYED);
512
513 _InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
514 if (pdata->Status == NCS_CONNECTED)
515 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_ENABLED);
516 else
517 _InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_DEFAULT);
518
519 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 9);
520}
521
522BOOL
525{
527
528 if (pinfo->nPages < MAX_PROPERTY_SHEET_PAGE)
529 {
530 pinfo->phpage[pinfo->nPages++] = hPage;
531 return TRUE;
532 }
533 return FALSE;
534}
535
538 IOleCommandTarget *lpOleCmd,
539 PCUITEMID_CHILD pidl,
540 HWND hwnd)
541{
542 if (!lpOleCmd)
543 return E_FAIL;
544
546 if (!pdata)
547 {
548 ERR("Got invalid pidl\n");
549 return E_FAIL;
550 }
551
552 return lpOleCmd->Exec(&pdata->guidId, OLECMDID_NEW, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
553}
554
555static int CALLBACK
557{
558 // NOTE: This callback is needed to set large icon correctly.
559 HICON hIcon;
560 switch (uMsg)
561 {
562 case PSCB_INITIALIZED:
563 {
565 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
566 break;
567 }
568 }
569 return 0;
570}
571
574 INetConnection *pNetConnect,
575 HWND hwnd)
576{
577 HRESULT hr;
578 CLSID ClassID;
579 PROPSHEETHEADERW pinfo;
582 NETCON_PROPERTIES * pProperties;
583
584 if (pNetConnect->GetProperties(&pProperties) != S_OK)
585 return E_FAIL;
586
587 hr = pNetConnect->GetUiObjectClassId(&ClassID);
588 if (FAILED(hr))
589 {
590 NcFreeNetconProperties(pProperties);
591 return hr;
592 }
593
594 hr = CoCreateInstance(ClassID, NULL, CLSCTX_INPROC_SERVER, IID_INetConnectionPropertyUi, (LPVOID*)&pNCP);
595 if (FAILED(hr))
596 {
597 NcFreeNetconProperties(pProperties);
598 return hr;
599 }
600
601 hr = pNCP->SetConnection(pNetConnect);
602 if (SUCCEEDED(hr))
603 {
604 ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
605 ZeroMemory(hppages, sizeof(hppages));
606 pinfo.dwSize = sizeof(PROPSHEETHEADERW);
607 pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
611 pinfo.phpage = hppages;
612 pinfo.hwndParent = hwnd;
614
615 pinfo.pszCaption = pProperties->pszwName;
616 hr = pNCP->AddPages(hwnd, PropSheetExCallback, (LPARAM)&pinfo);
617 if (SUCCEEDED(hr))
618 {
619 if (PropertySheetW(&pinfo) < 0)
620 hr = E_FAIL;
621 }
622 }
623 NcFreeNetconProperties(pProperties);
624 return hr;
625}
626
627
628/**************************************************************************
629* ISF_NetConnect_IContextMenu_InvokeCommand()
630*/
632{
633 UINT CmdId = LOWORD(lpcmi->lpVerb) + IDS_NET_ACTIVATE;
634
635 /* We should get this when F2 is pressed in explorer */
636 if (!IS_INTRESOURCE(lpcmi->lpVerb) && !strcmp(lpcmi->lpVerb, "rename"))
637 {
638 CmdId = IDS_NET_RENAME;
639 }
640 else if (!IS_INTRESOURCE(lpcmi->lpVerb) && !strcmp(lpcmi->lpVerb, "properties"))
641 {
642 CmdId = IDS_NET_PROPERTIES;
643 }
644 else if (!IS_INTRESOURCE(lpcmi->lpVerb) || LOWORD(lpcmi->lpVerb) > 7)
645 {
646 FIXME("Got invalid command\n");
647 return E_NOTIMPL;
648 }
649
650 switch(CmdId)
651 {
652 case IDS_NET_RENAME:
653 {
654 HRESULT hr;
657 if (SUCCEEDED(hr))
658 {
659 SVSIF selFlags = SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT;
660 psv->SelectItem(m_pidl, selFlags);
661 }
662
663 return S_OK;
664 }
665 case IDS_NET_STATUS:
666 {
668 }
669 case IDS_NET_REPAIR:
671 case IDS_NET_DELETE:
672 FIXME("Command %u is not implemented\n", CmdId);
673 return E_NOTIMPL;
674 }
675
676 HRESULT hr;
678
679 hr = ILGetConnection(m_pidl, &pCon);
681 return hr;
682
683 switch(CmdId)
684 {
685 case IDS_NET_ACTIVATE:
686 return pCon->Connect();
688 return pCon->Disconnect();
690 return ShowNetConnectionProperties(pCon, lpcmi->hwnd);
691 }
692
693 return E_NOTIMPL;
694}
695
696/**************************************************************************
697 * ISF_NetConnect_IContextMenu_GetCommandString()
698 *
699 */
701 UINT_PTR idCommand,
702 UINT uFlags,
703 UINT* lpReserved,
704 LPSTR lpszName,
705 UINT uMaxNameLen)
706{
707 return E_FAIL;
708}
709
710/**************************************************************************
711* ISF_NetConnect_IContextMenu_HandleMenuMsg()
712*/
714 UINT uMsg,
717{
718 return E_NOTIMPL;
719}
720
722 UINT uMsg,
725 LRESULT *plResult)
726{
727 return E_NOTIMPL;
728}
729
731{
732 if (!m_pUnknown)
733 {
734 *ppvSite = NULL;
735 return E_FAIL;
736 }
737
738 return m_pUnknown->QueryInterface(riid, ppvSite);
739}
740
742{
743 m_pUnknown = pUnkSite;
744 return S_OK;
745}
746
747/************************************************************************
748 * ISF_NetConnect_IExtractIcon_GetIconLocation
749 */
751 UINT uFlags,
752 LPWSTR szIconFile,
753 UINT cchMax,
754 int *piIndex,
755 UINT *pwFlags)
756{
757 *pwFlags = 0;
759 {
760 ERR("GetModuleFileNameW failed\n");
761 return E_FAIL;
762 }
763
765 if (!pdata)
766 {
767 ERR("Got invalid pidl\n");
768 return E_FAIL;
769 }
770
771 if (pdata->Status == NCS_CONNECTED || pdata->Status == NCS_CONNECTING)
772 *piIndex = -IDI_NET_IDLE;
773 else
774 *piIndex = -IDI_NET_OFF;
775
776 return S_OK;
777}
778
779/************************************************************************
780 * ISF_NetConnect_IExtractIcon_Extract
781 */
783 LPCWSTR pszFile,
784 UINT nIconIndex,
785 HICON *phiconLarge,
786 HICON *phiconSmall,
787 UINT nIconSize)
788{
789 return SHDefExtractIconW(pszFile, nIconIndex, 0, phiconLarge, phiconSmall, nIconSize);
790}
791
792/************************************************************************
793 * ISF_NetConnect_PersistFolder2_GetClassID
794 */
796{
797 if (!lpClassId)
798 return E_POINTER;
799
800 *lpClassId = CLSID_ConnectionFolder;
801
802 return S_OK;
803}
804
805/************************************************************************
806 * ISF_NetConnect_PersistFolder2_Initialize
807 *
808 * NOTES: it makes no sense to change the pidl
809 */
811{
812 if (m_pidlRoot)
814 m_pidlRoot = ILClone(pidl);
815
816 return S_OK;
817}
818
819/**************************************************************************
820 * ISF_NetConnect_PersistFolder2_GetCurFolder
821 */
823{
824 if (!pidl)
825 return E_POINTER;
826
827 *pidl = ILClone(m_pidlRoot);
828
829 return S_OK;
830}
831
832/************************************************************************
833 * ISF_NetConnect_ShellExecuteHookW_Execute
834 */
836{
839 if (!pdata)
840 {
841 ERR("Got invalid pidl\n");
842 return E_FAIL;
843 }
844
845 if (pdata->Status == NCS_CONNECTED)
846 {
847 return ShowNetConnectionStatus(m_lpOleCmd, pidl, pei->hwnd);
848 }
849
850 return S_OK;
851}
852
854{
855 FIXME("CNetworkConnections::Initialize()\n");
856 return E_NOTIMPL;
857}
858
859HRESULT WINAPI CNetworkConnections::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
860{
861 FIXME("CNetworkConnections::Exec()\n");
862 return E_NOTIMPL;
863}
864
865HRESULT WINAPI CNetworkConnections::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
866{
867 FIXME("CNetworkConnections::QueryStatus()\n");
868 return E_NOTIMPL;
869}
870
872{
873 FIXME("CNetworkConnections::MessageSFVCB()\n");
874 return E_NOTIMPL;
875}
876
878{
879 *pdwFlags = 0;
880
881 return S_OK;
882}
883
884/************************************************************************
885 * ISF_NetConnect_PersistFolder2_Initialize
886 *
887 * NOTES: it makes no sense to change the pidl
888 */
890{
891 *ppwszTip = NULL;
892 return S_OK;
893}
EXTERN_C HRESULT WINAPI SHCreateShellFolderViewEx(_In_ LPCSFV pcsfv, _Out_ IShellView **ppsv)
UINT cchMax
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
STDMETHOD() HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override
STDMETHOD() GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) override
STDMETHOD() GetIconLocation(UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags) override
STDMETHOD() Extract(LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize) override
STDMETHOD() SetSite(IUnknown *punk) override
PCUITEMID_CHILD m_pidl
STDMETHOD() GetSite(REFIID iid, void **ppvSite) override
STDMETHOD() QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
HRESULT WINAPI Initialize(PCUITEMID_CHILD pidl, IOleCommandTarget *lpOleCmd)
STDMETHOD() InvokeCommand(LPCMINVOKECOMMANDINFO lpici) override
CComPtr< IOleCommandTarget > m_lpOleCmd
CComPtr< IUnknown > m_pUnknown
STDMETHOD() HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override
STDMETHOD() GetInfoFlags(DWORD *pdwFlags) override
STDMETHOD() GetInfoTip(DWORD dwFlags, WCHAR **ppwszTip) override
STDMETHOD() BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) override
STDMETHOD() CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
STDMETHOD() GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
STDMETHOD() QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText) override
STDMETHOD() GetDefaultColumn(DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
STDMETHOD() GetCurFolder(PIDLIST_ABSOLUTE *pidl) override
STDMETHOD() GetDefaultSearchGUID(GUID *pguid) override
STDMETHOD() GetClassID(CLSID *lpClassId) override
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
PIDLIST_ABSOLUTE m_pidlRoot
STDMETHOD() ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override
STDMETHOD() CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
STDMETHOD() Initialize(PCIDLIST_ABSOLUTE pidl) override
CComPtr< IOleCommandTarget > m_lpOleCmd
STDMETHOD() GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
STDMETHOD() SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
STDMETHOD() EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
STDMETHOD() GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags) override
STDMETHOD() Execute(LPSHELLEXECUTEINFOW pei) override
STDMETHOD() MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam) override
STDMETHOD() MapColumnToSCID(UINT column, SHCOLUMNID *pscid) override
STDMETHOD() EnumSearches(IEnumExtraSearch **ppenum) override
STDMETHOD() GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define IDS_NET_DELETE
Definition: resource.h:93
#define IDI_SHELL_NETWORK_FOLDER
Definition: resource.h:5
#define IDS_NET_STATUS
Definition: resource.h:90
#define IDS_NET_PROPERTIES
Definition: resource.h:95
#define IDS_SHV_COLUMN_STATE
Definition: resource.h:76
#define IDS_STATUS_NON_OPERATIONAL
Definition: resource.h:81
#define IDS_SHV_COLUMN_DEVNAME
Definition: resource.h:77
#define IDS_NET_DEACTIVATE
Definition: resource.h:89
#define IDS_STATUS_CONNECTED
Definition: resource.h:85
#define IDS_SHV_COLUMN_TYPE
Definition: resource.h:75
#define IDS_SHV_COLUMN_PHONE
Definition: resource.h:78
#define IDS_NET_RENAME
Definition: resource.h:94
#define IDI_NET_OFF
Definition: resource.h:11
#define IDS_NET_REPAIR
Definition: resource.h:91
#define IDS_SHV_COLUMN_NAME
Definition: resource.h:74
#define IDS_NET_ACTIVATE
Definition: resource.h:88
#define IDS_STATUS_DISCONNECTED
Definition: resource.h:83
#define IDI_NET_IDLE
Definition: resource.h:10
#define IDS_SHV_COLUMN_OWNER
Definition: resource.h:79
#define IDS_TYPE_ETHERNET
Definition: resource.h:80
#define IDS_NET_CREATELINK
Definition: resource.h:92
#define IDS_NETWORKCONNECTION
Definition: resource.h:73
#define IDS_STATUS_UNREACHABLE
Definition: resource.h:82
#define IDS_STATUS_CONNECTING
Definition: resource.h:84
#define SHCIDS_CANONICALONLY
Definition: precomp.h:50
UINT uFlags
Definition: api.c:59
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
#define CALLBACK
Definition: compat.h:35
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1501
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:30
PITEMID_CHILD ILCreateNetConnectItem(INetConnection *pItem)
Definition: enumlist.cpp:37
HRESULT CEnumIDList_CreateInstance(HWND hwndOwner, DWORD dwFlags, REFIID riid, LPVOID *ppv)
Definition: enumlist.cpp:345
PWCHAR ILGetDeviceName(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:29
HRESULT ILGetConnection(PCITEMID_CHILD pidl, INetConnection **pItem)
Definition: enumlist.cpp:85
PNETCONIDSTRUCT ILGetConnData(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:10
PWCHAR ILGetConnName(PCITEMID_CHILD pidl)
Definition: enumlist.cpp:21
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint res
Definition: glext.h:9613
HRESULT WINAPI SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
Definition: iconcache.cpp:1009
REFIID riid
Definition: atlbase.h:39
HRESULT GetProperties([out] NETCON_PROPERTIES **ppProps)
HRESULT GetUiObjectClassId([out, ref] CLSID *pclsid)
HRESULT Exec([in, unique] const GUID *pguidCmdGroup, [in] DWORD nCmdID, [in] DWORD nCmdexecopt, [in, unique] VARIANT *pvaIn, [in, out, unique] VARIANT *pvaOut)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static HICON
Definition: imagelist.c:80
static LPOLESTR
Definition: stg_prop.c:27
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
static PROTOCOLDATA * pdata
Definition: protocol.c:158
HICON hIcon
Definition: msconfig.c:44
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
unsigned int UINT
Definition: ndis.h:50
@ NCCF_ALLOW_REMOVAL
Definition: netcon.h:18
@ NCCF_ALLOW_RENAME
Definition: netcon.h:19
@ NCS_CONNECTING
Definition: netcon.h:40
@ NCS_MEDIA_DISCONNECTED
Definition: netcon.h:46
@ NCS_CONNECTED
Definition: netcon.h:41
@ NCS_DISCONNECTED
Definition: netcon.h:39
@ NCS_HARDWARE_DISABLED
Definition: netcon.h:44
@ NCM_LAN
Definition: netcon.h:71
@ NCM_SHAREDACCESSHOST_RAS
Definition: netcon.h:77
EXTERN_C const IID IID_INetConnectionPropertyUi
Definition: netcon.h:227
HINSTANCE netshell_hInstance
Definition: netshell.cpp:12
VOID WINAPI NcFreeNetconProperties(NETCON_PROPERTIES *pProps)
Definition: netshell.cpp:119
interface IBindCtx * LPBC
Definition: objfwd.h:18
#define LOWORD(l)
Definition: pedump.c:82
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
LPITEMIDLIST WINAPI ILGetNext(LPCITEMIDLIST pidl)
Definition: pidl.c:968
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSH_USEICONID
Definition: prsht.h:42
#define PSCB_INITIALIZED
Definition: prsht.h:75
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define LVCFMT_RIGHT
Definition: commctrl.h:2604
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:619
#define COLUMN_OWNER
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
#define COLUMN_NAME
#define NETCONNECTSHELLVIEWCOLUMNS
BOOL CALLBACK PropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
#define MAX_PROPERTY_SHEET_PAGE
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
static const shvheader NetConnectSFHeader[]
#define COLUMN_DEVNAME
#define COLUMN_TYPE
#define COLUMN_STATUS
HRESULT ShowNetConnectionStatus(IOleCommandTarget *lpOleCmd, PCUITEMID_CHILD pidl, HWND hwnd)
#define COLUMN_PHONE
HRESULT ShowNetConnectionProperties(INetConnection *pNetConnect, HWND hwnd)
HRESULT ShowNetConnectionProperties(INetConnection *pNetConnect, HWND hwnd)
HRESULT hr
Definition: shlfolder.c:183
#define CLSID_ConnectionFolder
#define SID_IFolderView
const PCUITEMID_CHILD * PCUITEMID_CHILD_ARRAY
Definition: shtypes.idl:71
const ITEMID_CHILD UNALIGNED * PCUITEMID_CHILD
Definition: shtypes.idl:70
@ SHCOLSTATE_TYPE_DATE
Definition: shtypes.idl:123
@ SHCOLSTATE_TYPE_STR
Definition: shtypes.idl:121
@ SHCOLSTATE_ONBYDEFAULT
Definition: shtypes.idl:125
const ITEMIDLIST_RELATIVE UNALIGNED * PCUIDLIST_RELATIVE
Definition: shtypes.idl:57
STRRET str
Definition: shtypes.idl:108
Definition: shlobj.h:1275
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
LPWSTR dwTypeData
Definition: winuser.h:3272
#define ICON_BIG
Definition: tnclass.cpp:51
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
static HMENU hmenu
Definition: win.c:66
#define ZeroMemory
Definition: winbase.h:1737
_In_ LPCSTR lpName
Definition: winbase.h:2814
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364
#define SEVERITY_SUCCESS
Definition: winerror.h:64
#define E_UNEXPECTED
Definition: winerror.h:2456
#define E_POINTER
Definition: winerror.h:2365
#define MIIM_ID
Definition: winuser.h:725
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define MFT_SEPARATOR
Definition: winuser.h:747
#define MIIM_STATE
Definition: winuser.h:724
#define MFS_DEFAULT
Definition: winuser.h:751
#define MFS_GRAYED
Definition: winuser.h:754
#define MFS_ENABLED
Definition: winuser.h:753
#define MFT_STRING
Definition: winuser.h:749
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2127
#define MIIM_TYPE
Definition: winuser.h:728
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
#define IID_PPV_ARG(Itype, ppType)
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185