2011-05-15 15:55:49 +00:00
|
|
|
/*
|
2011-09-08 22:43:43 +00:00
|
|
|
* Network Places (Neighbourhood) folder
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
2011-09-08 22:43:43 +00:00
|
|
|
* Copyright 1997 Marcus Meissner
|
|
|
|
* Copyright 1998, 1999, 2002 Juergen Schmied
|
|
|
|
* Copyright 2003 Mike McCormack for Codeweavers
|
|
|
|
* Copyright 2009 Andrew Hill
|
2011-05-15 15:55:49 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
|
|
|
|
2015-08-21 18:35:07 +00:00
|
|
|
#define HACKY_UNC_PATHS
|
|
|
|
|
[SHELL32]
Time to (re)act!
Step 2/2: continue Giannis' UNC hack in Shell32:
- Implement the ILCreateFromNetworkPlaceW() helper, which is just Giannis' code to allow creating a hacky PIDL for enumeration.
- Implement the CNetFolderEnum class, which allows enumerating network places. So far, it's pretty basic (no tree structure) but, it does its job. It would be to improve
- Implement the CNetFolder::EnumObjects() function.
This commit, in itself, more or less obsoletes hackssign application. Indeed, now, you just need to go to your network places, to be able to browse your network shares (like VMware or VBox shares) provided you installed the VMware/VBox additions in your VM.
However, hackssign will remains in rosapps for now: we don't have any other way to assign a drive letter to a network place so far, and VMware doesn't provide such feature.
Furthermore, this is a big hack. And until we have a correct implementation, we can keep another hack along ;-).
Feel free to decently enjoy your network shares in ReactOS :-).
CORE-10032
ROSAPPS-303
svn path=/trunk/; revision=70671
2016-02-01 22:07:55 +00:00
|
|
|
#ifdef HACKY_UNC_PATHS
|
|
|
|
LPITEMIDLIST ILCreateFromNetworkPlaceW(LPCWSTR lpNetworkPlace)
|
|
|
|
{
|
|
|
|
int cbData = sizeof(WORD) + sizeof(WCHAR) * (wcslen(lpNetworkPlace)+1);
|
|
|
|
LPITEMIDLIST pidl = (LPITEMIDLIST)SHAlloc(cbData + sizeof(WORD));
|
|
|
|
if (!pidl)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
pidl->mkid.cb = cbData;
|
|
|
|
wcscpy((WCHAR*)&pidl->mkid.abID[0], lpNetworkPlace);
|
|
|
|
*(WORD*)((char*)pidl + cbData) = 0;
|
|
|
|
|
|
|
|
return pidl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
/***********************************************************************
|
|
|
|
* IShellFolder implementation
|
|
|
|
*/
|
|
|
|
|
2016-04-30 15:30:59 +00:00
|
|
|
HRESULT CNetFolderExtractIcon_CreateInstance(LPCITEMIDLIST pidl, REFIID riid, LPVOID * ppvOut)
|
|
|
|
{
|
|
|
|
CComPtr<IDefaultExtractIconInit> initIcon;
|
|
|
|
HRESULT hr = SHCreateDefaultExtractIcon(IID_PPV_ARG(IDefaultExtractIconInit, &initIcon));
|
2016-11-17 14:35:19 +00:00
|
|
|
if (FAILED_UNEXPECTEDLY(hr))
|
|
|
|
return hr;
|
2016-04-30 15:30:59 +00:00
|
|
|
|
|
|
|
initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_NETWORK_FOLDER);
|
|
|
|
|
|
|
|
return initIcon->QueryInterface(riid, ppvOut);
|
|
|
|
}
|
|
|
|
|
2016-12-16 10:31:13 +00:00
|
|
|
HRESULT CALLBACK NetFolderMenuCallback(IShellFolder *psf,
|
|
|
|
HWND hwnd,
|
|
|
|
IDataObject *pdtobj,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case DFM_MERGECONTEXTMENU:
|
|
|
|
return S_OK;
|
|
|
|
case DFM_INVOKECOMMAND:
|
|
|
|
case DFM_INVOKECOMMANDEX:
|
|
|
|
case DFM_GETDEFSTATICID: // Required for Windows 7 to pick a default
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
[SHELL32]
Time to (re)act!
Step 2/2: continue Giannis' UNC hack in Shell32:
- Implement the ILCreateFromNetworkPlaceW() helper, which is just Giannis' code to allow creating a hacky PIDL for enumeration.
- Implement the CNetFolderEnum class, which allows enumerating network places. So far, it's pretty basic (no tree structure) but, it does its job. It would be to improve
- Implement the CNetFolder::EnumObjects() function.
This commit, in itself, more or less obsoletes hackssign application. Indeed, now, you just need to go to your network places, to be able to browse your network shares (like VMware or VBox shares) provided you installed the VMware/VBox additions in your VM.
However, hackssign will remains in rosapps for now: we don't have any other way to assign a drive letter to a network place so far, and VMware doesn't provide such feature.
Furthermore, this is a big hack. And until we have a correct implementation, we can keep another hack along ;-).
Feel free to decently enjoy your network shares in ReactOS :-).
CORE-10032
ROSAPPS-303
svn path=/trunk/; revision=70671
2016-02-01 22:07:55 +00:00
|
|
|
class CNetFolderEnum :
|
|
|
|
public CEnumIDListBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CNetFolderEnum();
|
|
|
|
~CNetFolderEnum();
|
|
|
|
HRESULT WINAPI Initialize(HWND hwndOwner, DWORD dwFlags);
|
|
|
|
BOOL CreateMyCompEnumList(DWORD dwFlags);
|
|
|
|
BOOL EnumerateRec(LPNETRESOURCE lpNet);
|
|
|
|
|
|
|
|
BEGIN_COM_MAP(CNetFolderEnum)
|
|
|
|
COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList)
|
|
|
|
END_COM_MAP()
|
|
|
|
};
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
static shvheader NetworkPlacesSFHeader[] = {
|
2017-06-12 10:01:28 +00:00
|
|
|
{IDS_SHV_COLUMN_NAME, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
|
|
|
|
{IDS_SHV_COLUMN_CATEGORY, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10},
|
2011-05-15 15:55:49 +00:00
|
|
|
{IDS_SHV_COLUMN_WORKGROUP, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15},
|
2017-06-12 10:01:28 +00:00
|
|
|
{IDS_SHV_COLUMN_NETLOCATION, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 15}
|
2011-05-15 15:55:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define COLUMN_NAME 0
|
|
|
|
#define COLUMN_CATEGORY 1
|
|
|
|
#define COLUMN_WORKGROUP 2
|
|
|
|
#define COLUMN_NETLOCATION 3
|
|
|
|
|
|
|
|
#define NETWORKPLACESSHELLVIEWCOLUMNS 4
|
|
|
|
|
[SHELL32]
Time to (re)act!
Step 2/2: continue Giannis' UNC hack in Shell32:
- Implement the ILCreateFromNetworkPlaceW() helper, which is just Giannis' code to allow creating a hacky PIDL for enumeration.
- Implement the CNetFolderEnum class, which allows enumerating network places. So far, it's pretty basic (no tree structure) but, it does its job. It would be to improve
- Implement the CNetFolder::EnumObjects() function.
This commit, in itself, more or less obsoletes hackssign application. Indeed, now, you just need to go to your network places, to be able to browse your network shares (like VMware or VBox shares) provided you installed the VMware/VBox additions in your VM.
However, hackssign will remains in rosapps for now: we don't have any other way to assign a drive letter to a network place so far, and VMware doesn't provide such feature.
Furthermore, this is a big hack. And until we have a correct implementation, we can keep another hack along ;-).
Feel free to decently enjoy your network shares in ReactOS :-).
CORE-10032
ROSAPPS-303
svn path=/trunk/; revision=70671
2016-02-01 22:07:55 +00:00
|
|
|
CNetFolderEnum::CNetFolderEnum()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CNetFolderEnum::~CNetFolderEnum()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetFolderEnum::Initialize(HWND hwndOwner, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
if (CreateMyCompEnumList(dwFlags) == FALSE)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* CDrivesFolderEnum::CreateMyCompEnumList()
|
|
|
|
*/
|
|
|
|
|
|
|
|
BOOL CNetFolderEnum::EnumerateRec(LPNETRESOURCE lpNet)
|
|
|
|
{
|
|
|
|
BOOL bRet = TRUE;
|
|
|
|
DWORD dRet;
|
|
|
|
HANDLE hEnum;
|
|
|
|
LPNETRESOURCE lpRes;
|
|
|
|
DWORD dSize = 0x1000;
|
|
|
|
DWORD dCount = -1;
|
|
|
|
LPNETRESOURCE lpCur;
|
|
|
|
|
|
|
|
dRet = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 0, lpNet, &hEnum);
|
|
|
|
if (dRet != WN_SUCCESS)
|
|
|
|
{
|
|
|
|
ERR("WNetOpenEnum() failed: %x\n", dRet);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lpRes = (LPNETRESOURCE)CoTaskMemAlloc(dSize);
|
|
|
|
if (!lpRes)
|
|
|
|
{
|
|
|
|
ERR("CoTaskMemAlloc() failed\n");
|
|
|
|
WNetCloseEnum(hEnum);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
dSize = 0x1000;
|
|
|
|
dCount = -1;
|
|
|
|
|
|
|
|
memset(lpRes, 0, dSize);
|
|
|
|
dRet = WNetEnumResource(hEnum, &dCount, lpRes, &dSize);
|
|
|
|
if (dRet == WN_SUCCESS || dRet == WN_MORE_DATA)
|
|
|
|
{
|
|
|
|
lpCur = lpRes;
|
|
|
|
for (; dCount; dCount--)
|
|
|
|
{
|
|
|
|
TRACE("lpRemoteName: %S\n", lpCur->lpRemoteName);
|
|
|
|
|
|
|
|
if ((lpCur->dwUsage & RESOURCEUSAGE_CONTAINER) == RESOURCEUSAGE_CONTAINER)
|
|
|
|
{
|
|
|
|
TRACE("Found provider: %S\n", lpCur->lpProvider);
|
|
|
|
EnumerateRec(lpCur);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LPITEMIDLIST pidl;
|
|
|
|
|
|
|
|
#ifdef HACKY_UNC_PATHS
|
|
|
|
pidl = ILCreateFromNetworkPlaceW(lpCur->lpRemoteName);
|
|
|
|
#endif
|
|
|
|
if (pidl != NULL)
|
|
|
|
bRet = AddToEnumList(pidl);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("ILCreateFromPathW() failed\n");
|
|
|
|
bRet = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lpCur++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (dRet != WN_NO_MORE_ENTRIES);
|
|
|
|
|
2016-02-20 09:52:35 +00:00
|
|
|
CoTaskMemFree(lpRes);
|
[SHELL32]
Time to (re)act!
Step 2/2: continue Giannis' UNC hack in Shell32:
- Implement the ILCreateFromNetworkPlaceW() helper, which is just Giannis' code to allow creating a hacky PIDL for enumeration.
- Implement the CNetFolderEnum class, which allows enumerating network places. So far, it's pretty basic (no tree structure) but, it does its job. It would be to improve
- Implement the CNetFolder::EnumObjects() function.
This commit, in itself, more or less obsoletes hackssign application. Indeed, now, you just need to go to your network places, to be able to browse your network shares (like VMware or VBox shares) provided you installed the VMware/VBox additions in your VM.
However, hackssign will remains in rosapps for now: we don't have any other way to assign a drive letter to a network place so far, and VMware doesn't provide such feature.
Furthermore, this is a big hack. And until we have a correct implementation, we can keep another hack along ;-).
Feel free to decently enjoy your network shares in ReactOS :-).
CORE-10032
ROSAPPS-303
svn path=/trunk/; revision=70671
2016-02-01 22:07:55 +00:00
|
|
|
WNetCloseEnum(hEnum);
|
|
|
|
|
|
|
|
TRACE("Done: %u\n", bRet);
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CNetFolderEnum::CreateMyCompEnumList(DWORD dwFlags)
|
|
|
|
{
|
|
|
|
BOOL bRet = TRUE;
|
|
|
|
|
|
|
|
TRACE("(%p)->(flags=0x%08x)\n", this, dwFlags);
|
|
|
|
|
|
|
|
/* enumerate the folders */
|
|
|
|
if (dwFlags & SHCONTF_FOLDERS)
|
|
|
|
{
|
|
|
|
bRet = EnumerateRec(NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2011-05-15 15:55:49 +00:00
|
|
|
CNetFolder::CNetFolder()
|
|
|
|
{
|
2011-09-07 01:33:31 +00:00
|
|
|
pidlRoot = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CNetFolder::~CNetFolder()
|
|
|
|
{
|
2016-08-09 18:05:50 +00:00
|
|
|
if (pidlRoot)
|
|
|
|
SHFree(pidlRoot);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::ParseDisplayName
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetFolder::ParseDisplayName(HWND hwndOwner, LPBC pbcReserved, LPOLESTR lpszDisplayName,
|
2014-08-15 10:38:11 +00:00
|
|
|
DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
HRESULT hr = E_UNEXPECTED;
|
2015-08-21 18:35:07 +00:00
|
|
|
#ifdef HACKY_UNC_PATHS
|
|
|
|
/* FIXME: the code below is an ugly hack */
|
|
|
|
|
|
|
|
/* Can we use a CFSFolder on that path? */
|
|
|
|
DWORD attrs = GetFileAttributes(lpszDisplayName);
|
|
|
|
if ((attrs & FILE_ATTRIBUTE_DIRECTORY))
|
|
|
|
{
|
[SHELL32]
Time to (re)act!
Step 2/2: continue Giannis' UNC hack in Shell32:
- Implement the ILCreateFromNetworkPlaceW() helper, which is just Giannis' code to allow creating a hacky PIDL for enumeration.
- Implement the CNetFolderEnum class, which allows enumerating network places. So far, it's pretty basic (no tree structure) but, it does its job. It would be to improve
- Implement the CNetFolder::EnumObjects() function.
This commit, in itself, more or less obsoletes hackssign application. Indeed, now, you just need to go to your network places, to be able to browse your network shares (like VMware or VBox shares) provided you installed the VMware/VBox additions in your VM.
However, hackssign will remains in rosapps for now: we don't have any other way to assign a drive letter to a network place so far, and VMware doesn't provide such feature.
Furthermore, this is a big hack. And until we have a correct implementation, we can keep another hack along ;-).
Feel free to decently enjoy your network shares in ReactOS :-).
CORE-10032
ROSAPPS-303
svn path=/trunk/; revision=70671
2016-02-01 22:07:55 +00:00
|
|
|
if (pchEaten)
|
|
|
|
*pchEaten = 0; /* strange but like the original */
|
|
|
|
|
2015-08-21 18:35:07 +00:00
|
|
|
/* YES WE CAN */
|
|
|
|
|
|
|
|
/* Create our hacky pidl */
|
[SHELL32]
Time to (re)act!
Step 2/2: continue Giannis' UNC hack in Shell32:
- Implement the ILCreateFromNetworkPlaceW() helper, which is just Giannis' code to allow creating a hacky PIDL for enumeration.
- Implement the CNetFolderEnum class, which allows enumerating network places. So far, it's pretty basic (no tree structure) but, it does its job. It would be to improve
- Implement the CNetFolder::EnumObjects() function.
This commit, in itself, more or less obsoletes hackssign application. Indeed, now, you just need to go to your network places, to be able to browse your network shares (like VMware or VBox shares) provided you installed the VMware/VBox additions in your VM.
However, hackssign will remains in rosapps for now: we don't have any other way to assign a drive letter to a network place so far, and VMware doesn't provide such feature.
Furthermore, this is a big hack. And until we have a correct implementation, we can keep another hack along ;-).
Feel free to decently enjoy your network shares in ReactOS :-).
CORE-10032
ROSAPPS-303
svn path=/trunk/; revision=70671
2016-02-01 22:07:55 +00:00
|
|
|
LPITEMIDLIST pidl = ILCreateFromNetworkPlaceW(lpszDisplayName);
|
2015-08-21 18:35:07 +00:00
|
|
|
|
|
|
|
*ppidl = pidl;
|
|
|
|
if (pdwAttributes)
|
|
|
|
*pdwAttributes = SFGAO_FILESYSTEM | SFGAO_CANLINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
#endif
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n", this,
|
|
|
|
hwndOwner, pbcReserved, lpszDisplayName, debugstr_w (lpszDisplayName),
|
|
|
|
pchEaten, ppidl, pdwAttributes);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
*ppidl = 0;
|
|
|
|
if (pchEaten)
|
2011-09-08 22:43:43 +00:00
|
|
|
*pchEaten = 0; /* strange but like the original */
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(-- ret=0x%08x)\n", this, hr);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::EnumObjects
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
|
|
|
|
{
|
2017-04-14 20:03:46 +00:00
|
|
|
return ShellObjectCreatorInit<CNetFolderEnum>(hwndOwner, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::BindToObject
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2015-08-21 18:35:07 +00:00
|
|
|
#ifdef HACKY_UNC_PATHS
|
2017-07-07 20:34:27 +00:00
|
|
|
/* Create the target folder info */
|
|
|
|
PERSIST_FOLDER_TARGET_INFO pfti = {0};
|
|
|
|
pfti.dwAttributes = -1;
|
|
|
|
pfti.csidl = -1;
|
|
|
|
StringCchCopyW(pfti.szTargetParsingName, MAX_PATH, (WCHAR*)pidl->mkid.abID);
|
2015-08-21 18:35:07 +00:00
|
|
|
|
2017-07-07 20:34:27 +00:00
|
|
|
return SHELL32_BindToSF(pidlRoot, &pfti, pidl, &CLSID_ShellFSFolder, riid, ppvOut);
|
2015-08-21 18:35:07 +00:00
|
|
|
#else
|
2015-04-01 20:34:52 +00:00
|
|
|
return E_NOTIMPL;
|
2015-08-21 18:35:07 +00:00
|
|
|
#endif
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::BindToStorage
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::BindToStorage(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this,
|
|
|
|
pidl, pbcReserved, shdebugstr_guid (&riid), ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
*ppvOut = NULL;
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::CompareIDs
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::CompareIDs(LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2015-04-01 20:34:52 +00:00
|
|
|
return E_NOTIMPL;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::CreateViewObject
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
|
|
|
|
{
|
2014-08-20 00:39:40 +00:00
|
|
|
CComPtr<IShellView> pShellView;
|
2011-05-15 15:55:49 +00:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(hwnd=%p,%s,%p)\n", this,
|
|
|
|
hwndOwner, shdebugstr_guid (&riid), ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
*ppvOut = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
if (IsEqualIID(riid, IID_IDropTarget))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
WARN("IDropTarget not implemented\n");
|
2011-09-08 22:43:43 +00:00
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
2011-12-18 21:54:04 +00:00
|
|
|
else if (IsEqualIID(riid, IID_IContextMenu))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
WARN("IContextMenu not implemented\n");
|
2011-09-08 22:43:43 +00:00
|
|
|
hr = E_NOTIMPL;
|
|
|
|
}
|
2011-12-18 21:54:04 +00:00
|
|
|
else if (IsEqualIID(riid, IID_IShellView))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2017-07-05 21:36:20 +00:00
|
|
|
SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
|
|
|
|
hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::GetAttributesOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
static const DWORD dwNethoodAttributes =
|
2011-12-17 22:53:44 +00:00
|
|
|
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
|
2011-05-15 15:55:49 +00:00
|
|
|
SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER | SFGAO_CANRENAME | SFGAO_CANDELETE;
|
|
|
|
HRESULT hr = S_OK;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this,
|
|
|
|
cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!rgfInOut)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
if (cidl && !apidl)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (*rgfInOut == 0)
|
|
|
|
*rgfInOut = ~0;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
if(cidl == 0)
|
2011-05-15 15:55:49 +00:00
|
|
|
*rgfInOut = dwNethoodAttributes;
|
|
|
|
else
|
|
|
|
{
|
2015-04-01 20:34:52 +00:00
|
|
|
/* FIXME: Implement when enumerating items is implemented */
|
2015-08-21 18:35:07 +00:00
|
|
|
#ifdef HACKY_UNC_PATHS
|
|
|
|
*rgfInOut = SFGAO_FILESYSTEM | SFGAO_CANLINK | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR;
|
|
|
|
#endif
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
|
|
|
|
*rgfInOut &= ~SFGAO_VALIDATE;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("-- result=0x%08x\n", *rgfInOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::GetUIObjectOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::GetUIObjectOf(HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid,
|
2011-12-17 22:53:44 +00:00
|
|
|
UINT * prgfInOut, LPVOID * ppvOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2016-04-30 15:30:59 +00:00
|
|
|
LPVOID pObj = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
HRESULT hr = E_INVALIDARG;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n", this,
|
|
|
|
hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!ppvOut)
|
|
|
|
return hr;
|
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
*ppvOut = NULL;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2016-10-02 13:22:01 +00:00
|
|
|
IContextMenu * pCm = NULL;
|
|
|
|
HKEY hkey;
|
|
|
|
UINT cKeys = 0;
|
|
|
|
AddClassKeyToArray(L"Folder", &hkey, &cKeys);
|
2016-12-16 10:31:13 +00:00
|
|
|
hr = CDefFolderMenu_Create2(pidlRoot, hwndOwner, cidl, apidl, this, NetFolderMenuCallback, cKeys, &hkey, &pCm);
|
2014-04-28 21:59:02 +00:00
|
|
|
pObj = pCm;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-12-18 21:54:04 +00:00
|
|
|
else if (IsEqualIID(riid, IID_IDataObject) && (cidl >= 1))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2014-04-28 21:59:02 +00:00
|
|
|
IDataObject * pDo = NULL;
|
2019-10-19 22:44:03 +00:00
|
|
|
hr = IDataObject_Constructor (hwndOwner, pidlRoot, apidl, cidl, TRUE, &pDo);
|
2014-04-28 21:59:02 +00:00
|
|
|
pObj = pDo;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2016-04-30 15:30:59 +00:00
|
|
|
else if ((IsEqualIID(riid, IID_IExtractIconA) || IsEqualIID(riid, IID_IExtractIconW)) && (cidl == 1))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2016-04-30 15:30:59 +00:00
|
|
|
hr = CNetFolderExtractIcon_CreateInstance(apidl[0], riid, &pObj);
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-12-18 21:54:04 +00:00
|
|
|
else if (IsEqualIID(riid, IID_IDropTarget) && (cidl >= 1))
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2014-04-28 21:59:02 +00:00
|
|
|
IDropTarget * pDt = NULL;
|
|
|
|
hr = this->QueryInterface(IID_PPV_ARG(IDropTarget, &pDt));
|
|
|
|
pObj = pDt;
|
2011-09-08 22:43:43 +00:00
|
|
|
}
|
2011-05-15 15:55:49 +00:00
|
|
|
else
|
2011-09-08 22:43:43 +00:00
|
|
|
hr = E_NOINTERFACE;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
if (SUCCEEDED(hr) && !pObj)
|
|
|
|
hr = E_OUTOFMEMORY;
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2011-09-08 22:43:43 +00:00
|
|
|
*ppvOut = pObj;
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->hr=0x%08x\n", this, hr);
|
2011-05-15 15:55:49 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::GetDisplayNameOf
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2016-11-05 19:55:29 +00:00
|
|
|
if (!strRet || !pidl || !pidl->mkid.cb)
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2015-08-21 18:35:07 +00:00
|
|
|
#ifdef HACKY_UNC_PATHS
|
2016-11-05 19:55:29 +00:00
|
|
|
return SHSetStrRet(strRet, (LPCWSTR)pidl->mkid.abID);
|
2015-08-21 18:35:07 +00:00
|
|
|
#endif
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::SetNameOf
|
2011-05-15 15:55:49 +00:00
|
|
|
* 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
|
|
|
|
*/
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::SetNameOf(HWND hwndOwner, PCUITEMID_CHILD pidl, /*simple pidl */
|
|
|
|
LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this,
|
|
|
|
hwndOwner, pidl, debugstr_w (lpName), dwFlags, pPidlOut);
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetFolder::GetDefaultSearchGUID(GUID *pguid)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetFolder::EnumSearches(IEnumExtraSearch ** ppenum)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetFolder::GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (pSort)
|
|
|
|
*pSort = 0;
|
|
|
|
if (pDisplay)
|
|
|
|
*pDisplay = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetFolder::GetDefaultColumnState(UINT iColumn, DWORD *pcsFlags)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!pcsFlags || iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
*pcsFlags = NetworkPlacesSFHeader[iColumn].pcsFlags;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::GetDetailsEx(PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2014-08-15 10:38:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::GetDetailsOf(PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
|
|
|
if (iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
psd->fmt = NetworkPlacesSFHeader[iColumn].fmt;
|
|
|
|
psd->cxChar = NetworkPlacesSFHeader[iColumn].cxChar;
|
|
|
|
if (pidl == NULL)
|
2016-04-30 14:05:10 +00:00
|
|
|
return SHSetStrRet(&psd->str, NetworkPlacesSFHeader[iColumn].colnameid);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (iColumn == COLUMN_NAME)
|
|
|
|
return GetDisplayNameOf(pidl, SHGDN_NORMAL, &psd->str);
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT WINAPI CNetFolder::MapColumnToSCID(UINT column, SHCOLUMNID *pscid)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
FIXME("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::GetClassID
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
|
|
|
HRESULT WINAPI CNetFolder::GetClassID(CLSID *lpClassId)
|
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)\n", this);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!lpClassId)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
*lpClassId = CLSID_NetworkPlaces;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::Initialize
|
2011-05-15 15:55:49 +00:00
|
|
|
*
|
|
|
|
* NOTES: it makes no sense to change the pidl
|
|
|
|
*/
|
2019-09-20 10:19:34 +00:00
|
|
|
HRESULT WINAPI CNetFolder::Initialize(PCIDLIST_ABSOLUTE pidl)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2016-08-09 18:05:50 +00:00
|
|
|
if (pidlRoot)
|
|
|
|
SHFree((LPVOID)pidlRoot);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
2016-08-09 18:05:50 +00:00
|
|
|
pidlRoot = ILClone(pidl);
|
2015-08-31 23:12:03 +00:00
|
|
|
return S_OK;
|
2011-05-15 15:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2011-12-18 21:54:04 +00:00
|
|
|
* CNetFolder::GetCurFolder
|
2011-05-15 15:55:49 +00:00
|
|
|
*/
|
2019-09-10 10:24:11 +00:00
|
|
|
HRESULT WINAPI CNetFolder::GetCurFolder(PIDLIST_ABSOLUTE *pidl)
|
2011-05-15 15:55:49 +00:00
|
|
|
{
|
2011-12-18 21:54:04 +00:00
|
|
|
TRACE("(%p)->(%p)\n", this, pidl);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
if (!pidl)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2011-12-18 21:54:04 +00:00
|
|
|
*pidl = ILClone(pidlRoot);
|
2011-05-15 15:55:49 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|