2018-11-16 11:24:03 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS Shell
|
|
|
|
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
|
|
|
* PURPOSE: CNetworkConnections Shell Folder
|
|
|
|
* COPYRIGHT: Copyright 2008 Johannes Anderwald (johannes.anderwald@reactos.org)
|
|
|
|
*/
|
|
|
|
|
2012-01-20 21:50:54 +00:00
|
|
|
/*
|
|
|
|
* Network Connections Shell Folder
|
|
|
|
*
|
2013-09-15 13:06:05 +00:00
|
|
|
* Copyright 2008 Johannes Anderwald <johannes.anderwald@reactos.org>
|
2012-01-20 21:50:54 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include "precomp.h"
|
2012-01-20 21:50:54 +00:00
|
|
|
|
|
|
|
#define MAX_PROPERTY_SHEET_PAGE (10)
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* IShellFolder implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const shvheader NetConnectSFHeader[] = {
|
|
|
|
{IDS_SHV_COLUMN_NAME, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 20},
|
|
|
|
{IDS_SHV_COLUMN_TYPE, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 8},
|
|
|
|
{IDS_SHV_COLUMN_STATE, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
|
|
|
{IDS_SHV_COLUMN_DEVNAME, SHCOLSTATE_TYPE_DATE | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 12},
|
|
|
|
{IDS_SHV_COLUMN_PHONE, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
|
|
|
{IDS_SHV_COLUMN_OWNER, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define NETCONNECTSHELLVIEWCOLUMNS 6
|
|
|
|
|
|
|
|
#define COLUMN_NAME 0
|
|
|
|
#define COLUMN_TYPE 1
|
|
|
|
#define COLUMN_STATUS 2
|
|
|
|
#define COLUMN_DEVNAME 3
|
|
|
|
#define COLUMN_PHONE 4
|
|
|
|
#define COLUMN_OWNER 5
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
HRESULT
|
|
|
|
ShowNetConnectionStatus(
|
|
|
|
IOleCommandTarget *lpOleCmd,
|
|
|
|
PCUITEMID_CHILD pidl,
|
|
|
|
HWND hwnd);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2015-04-19 20:56:42 +00:00
|
|
|
CNetworkConnections::CNetworkConnections() :
|
2018-11-12 20:52:57 +00:00
|
|
|
m_pidlRoot(NULL)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2015-04-19 21:07:35 +00:00
|
|
|
HRESULT hr;
|
2018-11-12 14:46:45 +00:00
|
|
|
hr = CoCreateInstance(CLSID_ConnectionTray, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IOleCommandTarget, &m_lpOleCmd));
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2015-04-19 21:07:35 +00:00
|
|
|
m_lpOleCmd = NULL;
|
2015-04-19 20:18:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CNetworkConnections::~CNetworkConnections()
|
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
if (m_pidlRoot)
|
|
|
|
SHFree(m_pidlRoot);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnParseDisplayName
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::ParseDisplayName (
|
|
|
|
HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
|
2015-04-19 20:56:42 +00:00
|
|
|
DWORD * pchEaten, PIDLIST_RELATIVE * ppidl, DWORD * pdwAttributes)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
HRESULT hr = E_UNEXPECTED;
|
|
|
|
|
|
|
|
*ppidl = 0;
|
|
|
|
if (pchEaten)
|
|
|
|
*pchEaten = 0; /* strange but like the original */
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnEnumObjects
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::EnumObjects(
|
|
|
|
HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
|
|
|
|
{
|
2018-11-12 11:23:38 +00:00
|
|
|
return CEnumIDList_CreateInstance(hwndOwner, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnBindToObject
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::BindToObject (
|
2015-04-19 20:56:42 +00:00
|
|
|
PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnBindToStorage
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::BindToStorage(
|
2015-04-19 20:56:42 +00:00
|
|
|
PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
*ppvOut = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnCompareIDs
|
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::CompareIDs(
|
2015-04-19 20:56:42 +00:00
|
|
|
LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnCreateViewObject
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::CreateViewObject(
|
|
|
|
HWND hwndOwner, REFIID riid, LPVOID * ppvOut)
|
|
|
|
{
|
|
|
|
HRESULT hr = E_NOINTERFACE;
|
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, IID_IShellView))
|
|
|
|
{
|
2018-11-12 14:46:45 +00:00
|
|
|
CSFV cvf = {sizeof(cvf), this};
|
|
|
|
CComPtr<IShellView> pShellView;
|
2012-01-20 21:50:54 +00:00
|
|
|
hr = SHCreateShellFolderViewEx(&cvf, &pShellView);
|
2018-11-12 14:46:45 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
return pShellView->QueryInterface(riid, ppvOut);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnGetAttributesOf
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetAttributesOf(
|
2015-02-22 18:26:58 +00:00
|
|
|
UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD * rgfInOut)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
//IGenericSFImpl *This = (IGenericSFImpl *)iface;
|
|
|
|
HRESULT hr = S_OK;
|
2013-07-20 09:56:58 +00:00
|
|
|
static const DWORD dwNetConnectAttributes = SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
|
2012-01-20 21:50:54 +00:00
|
|
|
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
|
|
|
|
|
2013-07-20 09:56:58 +00:00
|
|
|
static const DWORD dwNetConnectItemAttributes = SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
|
2012-01-20 21:50:54 +00:00
|
|
|
SFGAO_FILESYSANCESTOR | SFGAO_CANRENAME;
|
|
|
|
|
|
|
|
if (!rgfInOut)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (cidl && !apidl)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (*rgfInOut == 0)
|
|
|
|
*rgfInOut = ~0;
|
|
|
|
|
2015-04-19 20:18:25 +00:00
|
|
|
if (cidl == 0)
|
2018-11-11 10:40:45 +00:00
|
|
|
{
|
2012-01-20 21:50:54 +00:00
|
|
|
*rgfInOut = dwNetConnectAttributes;
|
2018-11-11 10:40:45 +00:00
|
|
|
}
|
2012-01-20 21:50:54 +00:00
|
|
|
else
|
2018-11-11 10:40:45 +00:00
|
|
|
{
|
2012-01-20 21:50:54 +00:00
|
|
|
*rgfInOut = dwNetConnectItemAttributes;
|
|
|
|
|
2018-11-11 10:40:45 +00:00
|
|
|
while (cidl > 0 && *apidl)
|
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
PNETCONIDSTRUCT pdata = ILGetConnData(*apidl);
|
|
|
|
if (!pdata)
|
2018-11-11 10:40:45 +00:00
|
|
|
continue;
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (!(pdata->dwCharacter & NCCF_ALLOW_RENAME))
|
2018-11-11 10:40:45 +00:00
|
|
|
*rgfInOut &= ~SFGAO_CANRENAME;
|
|
|
|
|
|
|
|
apidl++;
|
|
|
|
cidl--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-20 21:50:54 +00:00
|
|
|
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
|
|
|
|
*rgfInOut &= ~SFGAO_VALIDATE;
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnGetUIObjectOf
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* hwndOwner [in] Parent window for any output
|
|
|
|
* cidl [in] array size
|
|
|
|
* apidl [in] simple pidl array
|
|
|
|
* riid [in] Requested Interface
|
|
|
|
* prgfInOut [ ] reserved
|
|
|
|
* ppvObject [out] Resulting Interface
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetUIObjectOf(
|
2015-02-22 18:26:58 +00:00
|
|
|
HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid,
|
2012-01-20 21:50:54 +00:00
|
|
|
UINT * prgfInOut, LPVOID * ppvOut)
|
|
|
|
{
|
|
|
|
IUnknown *pObj = NULL;
|
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
|
2015-04-19 20:18:25 +00:00
|
|
|
if ((IsEqualIID(riid, IID_IContextMenu) || IsEqualIID (riid, IID_IContextMenu2) || IsEqualIID(riid, IID_IContextMenu3) ||
|
2012-01-20 21:50:54 +00:00
|
|
|
IsEqualIID(riid, IID_IQueryInfo) || IsEqualIID(riid, IID_IExtractIconW)) && cidl >= 1)
|
|
|
|
{
|
2018-11-12 11:23:38 +00:00
|
|
|
return ShellObjectCreatorInit<CNetConUiObject>(apidl[0], m_lpOleCmd, riid, ppvOut);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
hr = E_NOINTERFACE;
|
|
|
|
|
|
|
|
*ppvOut = pObj;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnGetDisplayNameOf
|
|
|
|
*
|
|
|
|
*/
|
2015-04-19 20:56:42 +00:00
|
|
|
HRESULT WINAPI CNetworkConnections::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
if (!strRet)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (!pidl)
|
|
|
|
return SHSetStrRet(strRet, netshell_hInstance, IDS_NETWORKCONNECTION);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
PWCHAR pwchName = ILGetConnName(pidl);
|
|
|
|
if (!pwchName)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
ERR("Got invalid pidl!\n");
|
|
|
|
return E_INVALIDARG;
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
return SHSetStrRet(strRet, pwchName);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_fnSetNameOf
|
|
|
|
* Changes the name of a file object or subfolder, possibly changing its item
|
|
|
|
* identifier in the process.
|
|
|
|
*
|
|
|
|
* PARAMETERS
|
|
|
|
* hwndOwner [in] Owner window for output
|
|
|
|
* pidl [in] simple pidl of item to change
|
|
|
|
* lpszName [in] the items new display name
|
|
|
|
* dwFlags [in] SHGNO formatting flags
|
|
|
|
* ppidlOut [out] simple pidl returned
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::SetNameOf (
|
2015-04-19 20:56:42 +00:00
|
|
|
HWND hwndOwner, PCUITEMID_CHILD pidl, /*simple pidl */
|
|
|
|
LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD * pPidlOut)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-11 10:29:20 +00:00
|
|
|
HRESULT hr;
|
2018-11-12 20:52:57 +00:00
|
|
|
CComPtr<INetConnection> pCon;
|
2014-07-13 07:38:49 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
hr = ILGetConnection(pidl, &pCon);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
2014-07-13 07:38:49 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
hr = pCon->Rename(lpName);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
2018-11-11 10:29:20 +00:00
|
|
|
return hr;
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
*pPidlOut = ILCreateNetConnectItem(pCon);
|
|
|
|
if (*pPidlOut == NULL)
|
|
|
|
return E_FAIL;
|
2018-11-11 10:29:20 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetDefaultSearchGUID(GUID * pguid)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::EnumSearches(IEnumExtraSearch ** ppenum)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetDefaultColumn(DWORD dwRes, ULONG * pSort, ULONG * pDisplay)
|
|
|
|
{
|
|
|
|
if (pSort)
|
|
|
|
*pSort = 0;
|
|
|
|
if (pDisplay)
|
|
|
|
*pDisplay = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetDefaultColumnState(UINT iColumn, DWORD * pcsFlags)
|
|
|
|
{
|
|
|
|
if (!pcsFlags || iColumn >= NETCONNECTSHELLVIEWCOLUMNS)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
*pcsFlags = NetConnectSFHeader[iColumn].pcsFlags;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetDetailsEx(
|
2015-04-19 20:56:42 +00:00
|
|
|
PCUITEMID_CHILD pidl, const SHCOLUMNID * pscid, VARIANT * pv)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetDetailsOf(
|
2015-04-19 20:56:42 +00:00
|
|
|
PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS * psd)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
if (iColumn >= NETCONNECTSHELLVIEWCOLUMNS)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
psd->fmt = NetConnectSFHeader[iColumn].fmt;
|
|
|
|
psd->cxChar = NetConnectSFHeader[iColumn].cxChar;
|
|
|
|
if (pidl == NULL)
|
2018-11-12 20:52:57 +00:00
|
|
|
return SHSetStrRet(&psd->str, netshell_hInstance, NetConnectSFHeader[iColumn].colnameid);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
PNETCONIDSTRUCT pdata = ILGetConnData(pidl);
|
|
|
|
if (!pdata)
|
2012-01-20 21:50:54 +00:00
|
|
|
return E_FAIL;
|
|
|
|
|
2015-04-19 20:18:25 +00:00
|
|
|
switch (iColumn)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
case COLUMN_NAME:
|
|
|
|
return SHSetStrRet(&psd->str, ILGetConnName(pidl));
|
2012-01-20 21:50:54 +00:00
|
|
|
case COLUMN_TYPE:
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->MediaType == NCM_LAN || pdata->MediaType == NCM_SHAREDACCESSHOST_RAS)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
return SHSetStrRet(&psd->str, netshell_hInstance, IDS_TYPE_ETHERNET);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
2018-11-12 20:52:57 +00:00
|
|
|
else
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
return SHSetStrRet(&psd->str, "");
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
break;
|
2018-11-12 20:52:57 +00:00
|
|
|
case COLUMN_STATUS:
|
|
|
|
switch(pdata->Status)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
case NCS_HARDWARE_DISABLED:
|
|
|
|
return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_NON_OPERATIONAL);
|
|
|
|
case NCS_DISCONNECTED:
|
|
|
|
return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_UNREACHABLE);
|
|
|
|
case NCS_MEDIA_DISCONNECTED:
|
|
|
|
return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_DISCONNECTED);
|
|
|
|
case NCS_CONNECTING:
|
|
|
|
return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_CONNECTING);
|
|
|
|
case NCS_CONNECTED:
|
|
|
|
return SHSetStrRet(&psd->str, netshell_hInstance, IDS_STATUS_CONNECTED);
|
|
|
|
default:
|
|
|
|
return SHSetStrRet(&psd->str, "");
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
break;
|
2018-11-12 20:52:57 +00:00
|
|
|
case COLUMN_DEVNAME:
|
|
|
|
return SHSetStrRet(&psd->str, ILGetDeviceName(pidl));
|
2012-01-20 21:50:54 +00:00
|
|
|
case COLUMN_PHONE:
|
|
|
|
case COLUMN_OWNER:
|
2018-11-12 20:52:57 +00:00
|
|
|
return SHSetStrRet(&psd->str, "");
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
return E_FAIL;
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//IObjectWithSite
|
|
|
|
//IInternetSecurityManager
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* IContextMenu2 Implementation
|
|
|
|
*/
|
|
|
|
|
2018-11-12 11:23:38 +00:00
|
|
|
CNetConUiObject::CNetConUiObject()
|
2018-11-12 14:46:45 +00:00
|
|
|
: m_pidl(NULL)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2015-04-19 21:07:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CNetConUiObject::~CNetConUiObject()
|
|
|
|
{
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
2018-11-12 11:23:38 +00:00
|
|
|
HRESULT WINAPI CNetConUiObject::Initialize(PCUITEMID_CHILD pidl, IOleCommandTarget *lpOleCmd)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 11:23:38 +00:00
|
|
|
m_pidl = pidl;
|
|
|
|
m_lpOleCmd = lpOleCmd;
|
|
|
|
return S_OK;
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WINAPI _InsertMenuItemW (
|
|
|
|
HMENU hmenu,
|
|
|
|
UINT indexMenu,
|
|
|
|
BOOL fByPosition,
|
|
|
|
UINT wID,
|
|
|
|
UINT fType,
|
|
|
|
LPCWSTR dwTypeData,
|
|
|
|
UINT fState)
|
|
|
|
{
|
|
|
|
MENUITEMINFOW mii;
|
|
|
|
WCHAR szText[100];
|
|
|
|
|
|
|
|
ZeroMemory(&mii, sizeof(mii));
|
|
|
|
mii.cbSize = sizeof(mii);
|
|
|
|
if (fType == MFT_SEPARATOR)
|
|
|
|
{
|
|
|
|
mii.fMask = MIIM_ID | MIIM_TYPE;
|
|
|
|
}
|
|
|
|
else if (fType == MFT_STRING)
|
|
|
|
{
|
|
|
|
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
|
|
|
|
if ((ULONG_PTR)HIWORD((ULONG_PTR)dwTypeData) == 0)
|
|
|
|
{
|
|
|
|
if (LoadStringW(netshell_hInstance, LOWORD((ULONG_PTR)dwTypeData), szText, sizeof(szText)/sizeof(WCHAR)))
|
|
|
|
{
|
|
|
|
szText[(sizeof(szText)/sizeof(WCHAR))-1] = 0;
|
|
|
|
mii.dwTypeData = szText;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mii.dwTypeData = (LPWSTR) dwTypeData;
|
|
|
|
}
|
|
|
|
mii.fState = fState;
|
|
|
|
}
|
|
|
|
|
|
|
|
mii.wID = wID;
|
|
|
|
mii.fType = fType;
|
|
|
|
InsertMenuItemW( hmenu, indexMenu, fByPosition, &mii);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_IContextMenu_QueryContextMenu()
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetConUiObject::QueryContextMenu(
|
|
|
|
HMENU hMenu,
|
|
|
|
UINT indexMenu,
|
|
|
|
UINT idCmdFirst,
|
|
|
|
UINT idCmdLast,
|
|
|
|
UINT uFlags)
|
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
PNETCONIDSTRUCT pdata = ILGetConnData(m_pidl);
|
|
|
|
if (!pdata)
|
|
|
|
{
|
|
|
|
ERR("Got invalid pidl!\n");
|
2012-01-20 21:50:54 +00:00
|
|
|
return E_FAIL;
|
2018-11-12 20:52:57 +00:00
|
|
|
}
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 22:09:46 +00:00
|
|
|
if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_ACTIVATE), MFS_DEFAULT);
|
2012-01-20 21:50:54 +00:00
|
|
|
else
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 1, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DEACTIVATE), MFS_ENABLED);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED || pdata->Status == NCS_DISCONNECTED)
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_GRAYED);
|
2018-11-12 20:52:57 +00:00
|
|
|
else if (pdata->Status == NCS_CONNECTED)
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_DEFAULT);
|
2012-01-20 21:50:54 +00:00
|
|
|
else
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 2, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_STATUS), MFS_ENABLED);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->Status == NCS_HARDWARE_DISABLED || pdata->Status == NCS_MEDIA_DISCONNECTED)
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_GRAYED);
|
2012-01-20 21:50:54 +00:00
|
|
|
else
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 3, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_REPAIR), MFS_ENABLED);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 4, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_CREATELINK), MFS_ENABLED);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->dwCharacter & NCCF_ALLOW_REMOVAL)
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_ENABLED);
|
2012-01-20 21:50:54 +00:00
|
|
|
else
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 5, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_DELETE), MFS_GRAYED);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->dwCharacter & NCCF_ALLOW_RENAME)
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_ENABLED);
|
2012-01-20 21:50:54 +00:00
|
|
|
else
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 6, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_RENAME), MFS_GRAYED);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, -1, MFT_SEPARATOR, NULL, MFS_ENABLED);
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->Status == NCS_CONNECTED)
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_ENABLED);
|
2018-11-06 21:23:08 +00:00
|
|
|
else
|
2018-11-11 18:09:53 +00:00
|
|
|
_InsertMenuItemW(hMenu, indexMenu++, TRUE, idCmdFirst + 7, MFT_STRING, MAKEINTRESOURCEW(IDS_NET_PROPERTIES), MFS_DEFAULT);
|
2018-11-12 20:52:57 +00:00
|
|
|
|
2012-01-20 21:50:54 +00:00
|
|
|
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 9);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL
|
|
|
|
CALLBACK
|
|
|
|
PropSheetExCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
|
|
|
|
{
|
|
|
|
PROPSHEETHEADERW *pinfo = (PROPSHEETHEADERW *)lParam;
|
|
|
|
|
|
|
|
if (pinfo->nPages < MAX_PROPERTY_SHEET_PAGE)
|
|
|
|
{
|
2012-01-22 00:39:44 +00:00
|
|
|
pinfo->phpage[pinfo->nPages++] = hPage;
|
2012-01-20 21:50:54 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT
|
|
|
|
ShowNetConnectionStatus(
|
|
|
|
IOleCommandTarget *lpOleCmd,
|
2018-11-12 20:52:57 +00:00
|
|
|
PCUITEMID_CHILD pidl,
|
2012-01-20 21:50:54 +00:00
|
|
|
HWND hwnd)
|
|
|
|
{
|
|
|
|
if (!lpOleCmd)
|
|
|
|
return E_FAIL;
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
PNETCONIDSTRUCT pdata = ILGetConnData(pidl);
|
|
|
|
if (!pdata)
|
|
|
|
{
|
|
|
|
ERR("Got invalid pidl!\n");
|
2012-01-20 21:50:54 +00:00
|
|
|
return E_FAIL;
|
2018-11-12 20:52:57 +00:00
|
|
|
}
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
return lpOleCmd->Exec(&pdata->guidId, OLECMDID_NEW, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
2018-12-19 11:07:17 +00:00
|
|
|
static int CALLBACK
|
|
|
|
PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
|
|
|
|
{
|
|
|
|
// NOTE: This callback is needed to set large icon correctly.
|
|
|
|
HICON hIcon;
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case PSCB_INITIALIZED:
|
|
|
|
{
|
|
|
|
hIcon = LoadIconW(netshell_hInstance, MAKEINTRESOURCEW(IDI_SHELL_NETWORK_FOLDER));
|
|
|
|
SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-01-20 21:50:54 +00:00
|
|
|
HRESULT
|
|
|
|
ShowNetConnectionProperties(
|
|
|
|
INetConnection *pNetConnect,
|
|
|
|
HWND hwnd)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
CLSID ClassID;
|
|
|
|
PROPSHEETHEADERW pinfo;
|
|
|
|
HPROPSHEETPAGE hppages[MAX_PROPERTY_SHEET_PAGE];
|
2018-11-12 14:46:45 +00:00
|
|
|
CComPtr<INetConnectionPropertyUi> pNCP;
|
2012-01-20 21:50:54 +00:00
|
|
|
NETCON_PROPERTIES * pProperties;
|
|
|
|
|
|
|
|
if (pNetConnect->GetProperties(&pProperties) != S_OK)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
hr = pNetConnect->GetUiObjectClassId(&ClassID);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
NcFreeNetconProperties(pProperties);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = CoCreateInstance(ClassID, NULL, CLSCTX_INPROC_SERVER, IID_INetConnectionPropertyUi, (LPVOID*)&pNCP);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
NcFreeNetconProperties(pProperties);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = pNCP->SetConnection(pNetConnect);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
ZeroMemory(&pinfo, sizeof(PROPSHEETHEADERW));
|
|
|
|
ZeroMemory(hppages, sizeof(hppages));
|
|
|
|
pinfo.dwSize = sizeof(PROPSHEETHEADERW);
|
2018-12-19 11:07:17 +00:00
|
|
|
pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE | PSH_NOAPPLYNOW |
|
|
|
|
PSH_USEICONID | PSH_USECALLBACK;
|
|
|
|
pinfo.hInstance = netshell_hInstance;
|
|
|
|
pinfo.pszIcon = MAKEINTRESOURCEW(IDI_SHELL_NETWORK_FOLDER);
|
2012-01-22 00:39:44 +00:00
|
|
|
pinfo.phpage = hppages;
|
2012-01-20 21:50:54 +00:00
|
|
|
pinfo.hwndParent = hwnd;
|
2018-12-19 11:07:17 +00:00
|
|
|
pinfo.pfnCallback = PropSheetProc;
|
2012-01-20 21:50:54 +00:00
|
|
|
|
|
|
|
pinfo.pszCaption = pProperties->pszwName;
|
|
|
|
hr = pNCP->AddPages(hwnd, PropSheetExCallback, (LPARAM)&pinfo);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2015-04-19 20:18:25 +00:00
|
|
|
if (PropertySheetW(&pinfo) < 0)
|
2012-01-20 21:50:54 +00:00
|
|
|
hr = E_FAIL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
NcFreeNetconProperties(pProperties);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_IContextMenu_InvokeCommand()
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetConUiObject::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
|
|
|
|
{
|
2018-11-11 13:37:44 +00:00
|
|
|
UINT CmdId;
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-11 13:46:58 +00:00
|
|
|
/* We should get this when F2 is pressed in explorer */
|
|
|
|
if (HIWORD(lpcmi->lpVerb) && !strcmp(lpcmi->lpVerb, "rename"))
|
|
|
|
lpcmi->lpVerb = MAKEINTRESOURCEA(IDS_NET_RENAME);
|
|
|
|
|
2018-11-11 18:09:53 +00:00
|
|
|
if (HIWORD(lpcmi->lpVerb) || LOWORD(lpcmi->lpVerb) > 7)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-11 18:09:53 +00:00
|
|
|
FIXME("Got invalid command\n");
|
2018-11-11 13:37:44 +00:00
|
|
|
return E_NOTIMPL;
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
2018-11-11 13:37:44 +00:00
|
|
|
|
2018-11-11 18:09:53 +00:00
|
|
|
CmdId = LOWORD(lpcmi->lpVerb) + IDS_NET_ACTIVATE;
|
2018-11-11 13:37:44 +00:00
|
|
|
|
|
|
|
switch(CmdId)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-11 13:46:58 +00:00
|
|
|
case IDS_NET_RENAME:
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
2018-11-12 14:46:45 +00:00
|
|
|
CComPtr<IShellView> psv;
|
|
|
|
hr = IUnknown_QueryService(m_pUnknown, SID_IFolderView, IID_PPV_ARG(IShellView, &psv));
|
2018-11-11 13:46:58 +00:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
SVSIF selFlags = SVSI_DESELECTOTHERS | SVSI_EDIT | SVSI_ENSUREVISIBLE | SVSI_FOCUSED | SVSI_SELECT;
|
|
|
|
psv->SelectItem(m_pidl, selFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2018-11-11 13:37:44 +00:00
|
|
|
case IDS_NET_STATUS:
|
2018-11-12 20:52:57 +00:00
|
|
|
{
|
|
|
|
return ShowNetConnectionStatus(m_lpOleCmd, m_pidl, lpcmi->hwnd);
|
|
|
|
}
|
2018-11-12 22:09:46 +00:00
|
|
|
case IDS_NET_REPAIR:
|
|
|
|
case IDS_NET_CREATELINK:
|
|
|
|
case IDS_NET_DELETE:
|
|
|
|
FIXME("Command %u is not implemented\n", CmdId);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
2018-11-12 20:52:57 +00:00
|
|
|
|
2018-11-12 22:09:46 +00:00
|
|
|
HRESULT hr;
|
|
|
|
CComPtr<INetConnection> pCon;
|
|
|
|
|
|
|
|
hr = ILGetConnection(m_pidl, &pCon);
|
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
2018-11-12 20:52:57 +00:00
|
|
|
|
2018-11-12 22:09:46 +00:00
|
|
|
switch(CmdId)
|
|
|
|
{
|
|
|
|
case IDS_NET_ACTIVATE:
|
|
|
|
return pCon->Connect();
|
|
|
|
case IDS_NET_DEACTIVATE:
|
|
|
|
return pCon->Disconnect();
|
|
|
|
case IDS_NET_PROPERTIES:
|
2018-11-12 20:52:57 +00:00
|
|
|
return ShowNetConnectionProperties(pCon, lpcmi->hwnd);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
2018-11-11 13:46:58 +00:00
|
|
|
return E_NOTIMPL;
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_IContextMenu_GetCommandString()
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetConUiObject::GetCommandString(
|
|
|
|
UINT_PTR idCommand,
|
|
|
|
UINT uFlags,
|
|
|
|
UINT* lpReserved,
|
|
|
|
LPSTR lpszName,
|
|
|
|
UINT uMaxNameLen)
|
|
|
|
{
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_IContextMenu_HandleMenuMsg()
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetConUiObject::HandleMenuMsg(
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetConUiObject::HandleMenuMsg2(
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam,
|
|
|
|
LRESULT *plResult)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetConUiObject::GetSite(REFIID riid, PVOID *ppvSite)
|
|
|
|
{
|
2015-04-19 20:18:25 +00:00
|
|
|
if (!m_pUnknown)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
*ppvSite = NULL;
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2018-11-12 14:46:45 +00:00
|
|
|
return m_pUnknown->QueryInterface(riid, ppvSite);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetConUiObject::SetSite(IUnknown *pUnkSite)
|
|
|
|
{
|
2018-11-12 14:46:45 +00:00
|
|
|
m_pUnknown = pUnkSite;
|
2012-01-20 21:50:54 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* ISF_NetConnect_IExtractIcon_GetIconLocation
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetConUiObject::GetIconLocation(
|
|
|
|
UINT uFlags,
|
|
|
|
LPWSTR szIconFile,
|
|
|
|
UINT cchMax,
|
|
|
|
int *piIndex,
|
|
|
|
UINT *pwFlags)
|
|
|
|
{
|
|
|
|
*pwFlags = 0;
|
|
|
|
if (!GetModuleFileNameW(netshell_hInstance, szIconFile, cchMax))
|
|
|
|
{
|
|
|
|
ERR("GetModuleFileNameW failed\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
PNETCONIDSTRUCT pdata = ILGetConnData(m_pidl);
|
|
|
|
if (!pdata)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
ERR("Got invalid pidl!\n");
|
2012-01-20 21:50:54 +00:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->Status == NCS_CONNECTED || pdata->Status == NCS_CONNECTING)
|
2012-01-20 21:50:54 +00:00
|
|
|
*piIndex = -IDI_NET_IDLE;
|
|
|
|
else
|
|
|
|
*piIndex = -IDI_NET_OFF;
|
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
return S_OK;
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* ISF_NetConnect_IExtractIcon_Extract
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetConUiObject::Extract(
|
|
|
|
LPCWSTR pszFile,
|
|
|
|
UINT nIconIndex,
|
|
|
|
HICON *phiconLarge,
|
|
|
|
HICON *phiconSmall,
|
|
|
|
UINT nIconSize)
|
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
return SHDefExtractIconW(pszFile, nIconIndex, 0, phiconLarge, phiconSmall, nIconSize);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* ISF_NetConnect_PersistFolder2_GetClassID
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::GetClassID(CLSID *lpClassId)
|
|
|
|
{
|
|
|
|
if (!lpClassId)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2015-04-19 21:14:49 +00:00
|
|
|
*lpClassId = CLSID_ConnectionFolder;
|
2012-01-20 21:50:54 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* ISF_NetConnect_PersistFolder2_Initialize
|
|
|
|
*
|
|
|
|
* NOTES: it makes no sense to change the pidl
|
|
|
|
*/
|
2015-04-19 20:56:42 +00:00
|
|
|
HRESULT WINAPI CNetworkConnections::Initialize(PCIDLIST_ABSOLUTE pidl)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
if (m_pidlRoot)
|
|
|
|
SHFree(m_pidlRoot);
|
2015-04-19 20:18:25 +00:00
|
|
|
m_pidlRoot = ILClone(pidl);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* ISF_NetConnect_PersistFolder2_GetCurFolder
|
|
|
|
*/
|
2015-04-19 20:56:42 +00:00
|
|
|
HRESULT WINAPI CNetworkConnections::GetCurFolder(PIDLIST_ABSOLUTE *pidl)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
|
|
|
if (!pidl)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2015-04-19 20:18:25 +00:00
|
|
|
*pidl = ILClone(m_pidlRoot);
|
2012-01-20 21:50:54 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* ISF_NetConnect_ShellExecuteHookW_Execute
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetworkConnections::Execute(LPSHELLEXECUTEINFOW pei)
|
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
PCUITEMID_CHILD pidl = ILFindLastID((ITEMIDLIST*)pei->lpIDList);
|
|
|
|
PNETCONIDSTRUCT pdata = ILGetConnData(pidl);
|
|
|
|
if (!pdata)
|
|
|
|
{
|
|
|
|
ERR("Got invalid pidl!\n");
|
2012-01-20 21:50:54 +00:00
|
|
|
return E_FAIL;
|
2018-11-12 20:52:57 +00:00
|
|
|
}
|
2012-01-20 21:50:54 +00:00
|
|
|
|
2018-11-12 20:52:57 +00:00
|
|
|
if (pdata->Status == NCS_CONNECTED)
|
2012-01-20 21:50:54 +00:00
|
|
|
{
|
2018-11-12 20:52:57 +00:00
|
|
|
return ShowNetConnectionStatus(m_lpOleCmd, pidl, pei->hwnd);
|
2012-01-20 21:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2018-11-06 21:23:08 +00:00
|
|
|
HRESULT WINAPI CNetworkConnections::Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID)
|
|
|
|
{
|
|
|
|
FIXME("CNetworkConnections::Initialize()\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
|
|
|
|
{
|
|
|
|
FIXME("CNetworkConnections::Exec()\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText)
|
|
|
|
{
|
|
|
|
FIXME("CNetworkConnections::QueryStatus()\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetworkConnections::MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
FIXME("CNetworkConnections::MessageSFVCB()\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2012-01-20 21:50:54 +00:00
|
|
|
HRESULT WINAPI CNetConUiObject::GetInfoFlags(DWORD *pdwFlags)
|
|
|
|
{
|
|
|
|
*pdwFlags = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* ISF_NetConnect_PersistFolder2_Initialize
|
|
|
|
*
|
|
|
|
* NOTES: it makes no sense to change the pidl
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetConUiObject::GetInfoTip(DWORD dwFlags, WCHAR **ppwszTip)
|
|
|
|
{
|
|
|
|
*ppwszTip = NULL;
|
|
|
|
return S_OK;
|
|
|
|
}
|