ReactOS  0.4.15-dev-3287-gfec35dc
CFSFolder Class Reference

#include <CFSFolder.h>

Inheritance diagram for CFSFolder:
Collaboration diagram for CFSFolder:

Public Member Functions

 CFSFolder ()
 
 ~CFSFolder ()
 
virtual HRESULT WINAPI ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes)
 
virtual HRESULT WINAPI EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList)
 
virtual HRESULT WINAPI BindToObject (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI BindToStorage (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI CompareIDs (LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2)
 
virtual HRESULT WINAPI CreateViewObject (HWND hwndOwner, REFIID riid, LPVOID *ppvOut)
 
virtual HRESULT WINAPI GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut)
 
virtual HRESULT WINAPI GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut)
 
virtual HRESULT WINAPI GetDisplayNameOf (PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
 
virtual HRESULT WINAPI SetNameOf (HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut)
 
virtual HRESULT WINAPI GetDefaultSearchGUID (GUID *pguid)
 
virtual HRESULT WINAPI EnumSearches (IEnumExtraSearch **ppenum)
 
virtual HRESULT WINAPI GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay)
 
virtual HRESULT WINAPI GetDefaultColumnState (UINT iColumn, DWORD *pcsFlags)
 
virtual HRESULT WINAPI GetDetailsEx (PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv)
 
virtual HRESULT WINAPI GetDetailsOf (PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd)
 
virtual HRESULT WINAPI MapColumnToSCID (UINT column, SHCOLUMNID *pscid)
 
virtual HRESULT WINAPI GetClassID (CLSID *lpClassId)
 
virtual HRESULT WINAPI Initialize (PCIDLIST_ABSOLUTE pidl)
 
virtual HRESULT WINAPI GetCurFolder (PIDLIST_ABSOLUTE *pidl)
 
virtual HRESULT WINAPI InitializeEx (IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti)
 
virtual HRESULT WINAPI GetFolderTargetInfo (PERSIST_FOLDER_TARGET_INFO *ppfti)
 
virtual HRESULT WINAPI CallBack (IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
virtual HRESULT WINAPI MessageSFVCB (UINT uMsg, WPARAM wParam, LPARAM lParam)
 
STDMETHODIMP GetMaxLength (LPCWSTR pszName, int *piMaxNameLen)
 
STDMETHODIMP GetValidCharacters (LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars)
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
- Public Member Functions inherited from IShellFolder
HRESULT ParseDisplayName ([in] HWND hwndOwner, [in] LPBC pbcReserved, [in, string] LPOLESTR lpszDisplayName, [out] ULONG *pchEaten, [out] PIDLIST_RELATIVE *ppidl, [in, out, unique] ULONG *pdwAttributes)
 
HRESULT EnumObjects ([in] HWND hwndOwner, [in] SHCONTF grfFlags, [out] IEnumIDList **ppenumIDList)
 
HRESULT BindToObject ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT BindToStorage ([in] PCUIDLIST_RELATIVE pidl, [in] LPBC pbcReserved, [in] REFIID riid, [out, iid_is(riid)] void **ppvObj)
 
HRESULT CreateViewObject ([in] HWND hwndOwner, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetAttributesOf ([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
 
HRESULT GetUIObjectOf ([in] HWND hwndOwner, [in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in] REFIID riid, [in, out, unique] UINT *prgfInOut, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetDisplayNameOf ([in] PCUITEMID_CHILD pidl, [in] SHGDNF uFlags, [out] STRRET *lpName)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from IPersistFolder3
HRESULT InitializeEx ([in] IBindCtx *pbc, [in] PCIDLIST_ABSOLUTE pidlRoot, [in] const PERSIST_FOLDER_TARGET_INFO *ppfti)
 

Protected Member Functions

HRESULT WINAPI GetCustomViewInfo (ULONG unknown, SFVM_CUSTOMVIEWINFO_DATA *data)
 

Private Member Functions

HRESULT _CreateShellExtInstance (const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
 
HRESULT _CreateExtensionUIObject (LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
 
HRESULT _GetDropTarget (LPCITEMIDLIST pidl, LPVOID *ppvOut)
 
HRESULT _GetIconHandler (LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
 

Private Attributes

const CLSIDm_pclsid
 
LPWSTR m_sPathTarget
 
LPITEMIDLIST m_pidlRoot
 
DWORD m_bGroupPolicyActive
 

Additional Inherited Members

- Public Types inherited from IShellFolder2
typedef struct IShellFolder2::SHCOLUMNIDLPSHCOLUMNID
 
typedef const SHCOLUMNIDLPCSHCOLUMNID
 
- Public Types inherited from IShellFolder
enum  tagSHGDN {
  SHGDN_NORMAL = 0, SHGDN_INFOLDER = 1, SHGDN_FOREDITING = 0x1000, SHGDN_INCLUDE_NONFILESYS = 0x2000,
  SHGDN_FORADDRESSBAR = 0x4000, SHGDN_FORPARSING = 0x8000
}
 
enum  tagSHCONTF {
  SHCONTF_FOLDERS = 32, SHCONTF_NONFOLDERS = 64, SHCONTF_INCLUDEHIDDEN = 128, SHCONTF_INIT_ON_FIRST_NEXT = 256,
  SHCONTF_NETPRINTERSRCH = 512, SHCONTF_SHAREABLE = 1024, SHCONTF_STORAGE = 2048, SHCONTF_NAVIGATION_ENUM = 0x01000,
  SHCONTF_FASTITEMS = 0x02000, SHCONTF_FLATLIST = 0x04000, SHCONTF_ENABLE_ASYNC = 0x08000, SHCONTF_INCLUDESUPERHIDDEN = 0x10000
}
 
typedef IShellFolderLPSHELLFOLDER
 
typedef enum IShellFolder::tagSHGDN SHGNO
 
typedef DWORD SHGDNF
 
typedef DWORD SHCONTF
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IPersistFolder2
typedef IPersistFolder2LPPERSISTFOLDER2
 
- Public Types inherited from IPersistFolder
typedef IPersistFolderLPPERSISTFOLDER
 
- Public Types inherited from IPersist
typedef IPersistLPPERSIST
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Public Attributes inherited from IShellFolder
SFGAO_STORAGEANCESTOR typedef ULONG SFGAOF
 

Detailed Description

Definition at line 14 of file CFSFolder.h.

Constructor & Destructor Documentation

◆ CFSFolder()

CFSFolder::CFSFolder ( )

Definition at line 518 of file CFSFolder.cpp.

519 {
520  m_pclsid = &CLSID_ShellFSFolder;
522  m_pidlRoot = NULL;
524 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
const CLSID * m_pclsid
Definition: CFSFolder.h:24
DWORD m_bGroupPolicyActive
Definition: CFSFolder.h:31
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
#define NULL
Definition: types.h:112

◆ ~CFSFolder()

CFSFolder::~CFSFolder ( )

Definition at line 526 of file CFSFolder.cpp.

527 {
528  TRACE("-- destroying IShellFolder(%p)\n", this);
529 
532 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
#define TRACE(s)
Definition: solgame.cpp:4
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331

Member Function Documentation

◆ _CreateExtensionUIObject()

HRESULT CFSFolder::_CreateExtensionUIObject ( LPCITEMIDLIST  pidl,
REFIID  riid,
LPVOID ppvOut 
)
private

Definition at line 1714 of file CFSFolder.cpp.

1715 {
1716  static const WCHAR formatW[] = {'S','h','e','l','l','E','x','\\',
1717  '{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-',
1718  '%','0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x',
1719  '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0};
1720  WCHAR buf[MAX_PATH];
1721 
1722  sprintfW(buf, formatW, riid.Data1, riid.Data2, riid.Data3,
1723  riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3],
1724  riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7]);
1725 
1726  CLSID clsid;
1727  HRESULT hr;
1728 
1729  hr = GetCLSIDForFileType(pidl, buf, &clsid);
1730  if (hr != S_OK)
1731  return hr;
1732 
1733  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1734  if (FAILED_UNEXPECTEDLY(hr))
1735  return hr;
1736 
1737  return S_OK;
1738 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1784
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
REFCLSID clsid
Definition: msctf.c:82
#define S_OK
Definition: intsafe.h:52
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127
#define sprintfW
Definition: unicode.h:58

Referenced by GetUIObjectOf().

◆ _CreateShellExtInstance()

HRESULT CFSFolder::_CreateShellExtInstance ( const CLSID pclsid,
LPCITEMIDLIST  pidl,
REFIID  riid,
LPVOID ppvOut 
)
private

Definition at line 1784 of file CFSFolder.cpp.

1785 {
1786  HRESULT hr;
1787  WCHAR wszPath[MAX_PATH];
1788 
1789  FileStructW* pDataW = _ILGetFileStructW(pidl);
1790  if (!pDataW)
1791  {
1792  ERR("Got garbage pidl\n");
1793  return E_INVALIDARG;
1794  }
1795 
1796  PathCombineW(wszPath, m_sPathTarget, pDataW->wszName);
1797 
1798  CComPtr<IPersistFile> pp;
1800  if (FAILED_UNEXPECTEDLY(hr))
1801  return hr;
1802 
1803  pp->Load(wszPath, 0);
1804 
1805  hr = pp->QueryInterface(riid, ppvOut);
1806  if (hr != S_OK)
1807  {
1808  ERR("Failed to query for interface IID_IShellExtInit hr %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid));
1809  return hr;
1810  }
1811  return hr;
1812 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
WCHAR wszName[1]
Definition: shlfolder.c:1555
const char * wine_dbgstr_guid(const GUID *guid)
#define IID_PPV_ARG(Itype, ppType)
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2350
#define NULL
Definition: types.h:112
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by _CreateExtensionUIObject(), _GetDropTarget(), and _GetIconHandler().

◆ _GetDropTarget()

HRESULT CFSFolder::_GetDropTarget ( LPCITEMIDLIST  pidl,
LPVOID ppvOut 
)
private

Definition at line 1740 of file CFSFolder.cpp.

1741 {
1742  HRESULT hr;
1743 
1744  TRACE("CFSFolder::_GetDropTarget entered\n");
1745 
1746  if (_ILIsFolder (pidl))
1747  {
1748  CComPtr<IShellFolder> psfChild;
1749  hr = this->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
1750  if (FAILED_UNEXPECTEDLY(hr))
1751  return hr;
1752 
1753  return psfChild->CreateViewObject(NULL, IID_IDropTarget, ppvOut);
1754  }
1755 
1756  CLSID clsid;
1757  hr = GetCLSIDForFileType(pidl, L"shellex\\DropHandler", &clsid);
1758  if (hr != S_OK)
1759  return hr;
1760 
1761  hr = _CreateShellExtInstance(&clsid, pidl, IID_IDropTarget, ppvOut);
1762  if (FAILED_UNEXPECTEDLY(hr))
1763  return S_FALSE;
1764 
1765  return S_OK;
1766 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1784
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
#define S_FALSE
Definition: winerror.h:2357
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:846
REFCLSID clsid
Definition: msctf.c:82
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:52
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127
#define NULL
Definition: types.h:112

Referenced by GetUIObjectOf().

◆ _GetIconHandler()

HRESULT CFSFolder::_GetIconHandler ( LPCITEMIDLIST  pidl,
REFIID  riid,
LPVOID ppvOut 
)
private

Definition at line 1768 of file CFSFolder.cpp.

1769 {
1770  CLSID clsid;
1771  HRESULT hr;
1772 
1773  hr = GetCLSIDForFileType(pidl, L"shellex\\IconHandler", &clsid);
1774  if (hr != S_OK)
1775  return hr;
1776 
1777  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1778  if (FAILED_UNEXPECTEDLY(hr))
1779  return S_FALSE;
1780 
1781  return S_OK;
1782 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1784
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define S_FALSE
Definition: winerror.h:2357
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
REFCLSID clsid
Definition: msctf.c:82
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:52
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127

Referenced by GetUIObjectOf().

◆ BindToObject()

HRESULT WINAPI CFSFolder::BindToObject ( PCUIDLIST_RELATIVE  pidl,
LPBC  pbcReserved,
REFIID  riid,
LPVOID ppvOut 
)
virtual

Definition at line 846 of file CFSFolder.cpp.

851 {
852  TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this, pidl, pbc,
853  shdebugstr_guid(&riid), ppvOut);
854 
855  CComPtr<IShellFolder> pSF;
856  HRESULT hr;
857 
858  if (!m_pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb)
859  {
860  ERR("CFSFolder::BindToObject: Invalid parameters\n");
861  return E_INVALIDARG;
862  }
863 
864  /* Get the pidl data */
865  FileStruct* pData = &_ILGetDataPointer(pidl)->u.file;
866  FileStructW* pDataW = _ILGetFileStructW(pidl);
867 
868  if (!pDataW)
869  {
870  ERR("CFSFolder::BindToObject: Invalid pidl!\n");
871  return E_INVALIDARG;
872  }
873 
874  *ppvOut = NULL;
875 
876  /* Create the target folder info */
877  PERSIST_FOLDER_TARGET_INFO pfti = {0};
878  pfti.dwAttributes = -1;
879  pfti.csidl = -1;
880  PathCombineW(pfti.szTargetParsingName, m_sPathTarget, pDataW->wszName);
881 
882  /* Get the CLSID to bind to */
883  CLSID clsidFolder;
884  if (_ILIsFolder(pidl))
885  {
886  if ((pData->uFileAttribs & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
887  {
888  hr = SHELL32_GetCLSIDForDirectory(pfti.szTargetParsingName, L"CLSID", &clsidFolder);
889 
890  if (SUCCEEDED(hr))
891  {
892  /* We got a GUID from a desktop.ini, let's try it */
893  hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
894  if (SUCCEEDED(hr))
895  {
896  TRACE("-- returning (%p) %08x, (%s)\n", *ppvOut, hr, wine_dbgstr_guid(&clsidFolder));
897  return hr;
898  }
899 
900  /* Something went wrong, re-try it with a normal ShellFSFolder */
901  ERR("CFSFolder::BindToObject: %s failed to bind, using fallback (0x%08x)\n", wine_dbgstr_guid(&clsidFolder), hr);
902  }
903  }
904  /* No system folder or the custom class failed */
905  clsidFolder = CLSID_ShellFSFolder;
906  }
907  else
908  {
909  hr = GetCLSIDForFileType(pidl, L"CLSID", &clsidFolder);
910  if (hr == S_FALSE)
912  if (hr != S_OK)
913  return hr;
914  }
915 
916  hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
917  if (FAILED_UNEXPECTEDLY(hr))
918  return hr;
919 
920  TRACE ("-- returning (%p) %08x\n", *ppvOut, hr);
921 
922  return S_OK;
923 
924 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
REFIID riid
Definition: precomp.h:44
WCHAR wszName[1]
Definition: shlfolder.c:1555
static HRESULT SHELL32_GetCLSIDForDirectory(LPCWSTR pwszDir, LPCWSTR KeyName, CLSID *pclsidFolder)
Definition: CFSFolder.cpp:586
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
const char * wine_dbgstr_guid(const GUID *guid)
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:159
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2350
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
#define NULL
Definition: types.h:112
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Referenced by _GetDropTarget().

◆ BindToStorage()

HRESULT WINAPI CFSFolder::BindToStorage ( PCUIDLIST_RELATIVE  pidl,
LPBC  pbcReserved,
REFIID  riid,
LPVOID ppvOut 
)
virtual

Definition at line 934 of file CFSFolder.cpp.

939 {
940  FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this, pidl, pbcReserved,
941  shdebugstr_guid (&riid), ppvOut);
942 
943  *ppvOut = NULL;
944  return E_NOTIMPL;
945 }
REFIID riid
Definition: precomp.h:44
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112

◆ CallBack()

HRESULT WINAPI CFSFolder::CallBack ( IShellFolder psf,
HWND  hwndOwner,
IDataObject pdtobj,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

Implements IContextMenuCB.

Definition at line 1814 of file CFSFolder.cpp.

1815 {
1816  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1817  return S_OK;
1818 
1819  /* no data object means no selection */
1820  if (!pdtobj)
1821  {
1822  if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
1823  {
1825  LPITEMIDLIST pidlParent = ILClone(m_pidlRoot);
1826  ILRemoveLastID(pidlParent);
1827  HRESULT hr = SH_ShowPropertiesDialog(m_sPathTarget, pidlParent, &pidlChild);
1828  if (FAILED(hr))
1829  ERR("SH_ShowPropertiesDialog failed\n");
1830  ILFree(pidlChild);
1831  ILFree(pidlParent);
1832  }
1833  else if (uMsg == DFM_MERGECONTEXTMENU)
1834  {
1835  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1836  HMENU hpopup = CreatePopupMenu();
1838  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1839  DestroyMenu(hpopup);
1840  }
1841 
1842  return S_OK;
1843  }
1844 
1845  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1846  return S_OK;
1847 
1848  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1849 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
UINT idCmdLast
Definition: shlobj.h:1318
#define MFT_STRING
Definition: winuser.h:741
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
ITEMID_CHILD UNALIGNED * PUITEMID_CHILD
Definition: shtypes.idl:68
HRESULT WINAPI Shell_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdtobj)
Definition: shlfolder.cpp:450
HMENU hmenu
Definition: shlobj.h:1315
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
#define IDS_PROPERTIES
Definition: resource.h:101
WPARAM wParam
Definition: combotst.c:138
#define MFS_ENABLED
Definition: winuser.h:745
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
UINT indexMenu
Definition: shlobj.h:1316
#define MM_ADDSEPARATOR
Definition: shlobj.h:2345
LONG HRESULT
Definition: typedefs.h:79
UINT idCmdFirst
Definition: shlobj.h:1317
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2429
BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl)
Definition: fprop.cpp:83
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139

◆ CompareIDs()

HRESULT WINAPI CFSFolder::CompareIDs ( LPARAM  lParam,
PCUIDLIST_RELATIVE  pidl1,
PCUIDLIST_RELATIVE  pidl2 
)
virtual

Implements IShellFolder.

Definition at line 951 of file CFSFolder.cpp.

954 {
955  LPPIDLDATA pData1 = _ILGetDataPointer(pidl1);
956  LPPIDLDATA pData2 = _ILGetDataPointer(pidl2);
957  FileStructW* pDataW1 = _ILGetFileStructW(pidl1);
958  FileStructW* pDataW2 = _ILGetFileStructW(pidl2);
959  BOOL bIsFolder1 = _ILIsFolder(pidl1);
960  BOOL bIsFolder2 = _ILIsFolder(pidl2);
961  LPWSTR pExtension1, pExtension2;
962 
963  if (!pDataW1 || !pDataW2 || LOWORD(lParam) >= GENERICSHELLVIEWCOLUMNS)
964  return E_INVALIDARG;
965 
966  /* When sorting between a File and a Folder, the Folder gets sorted first */
967  if (bIsFolder1 != bIsFolder2)
968  {
969  return MAKE_COMPARE_HRESULT(bIsFolder1 ? -1 : 1);
970  }
971 
972  int result;
973  switch (LOWORD(lParam))
974  {
975  case 0: /* Name */
976  result = wcsicmp(pDataW1->wszName, pDataW2->wszName);
977  break;
978  case 1: /* Comments */
979  result = 0;
980  break;
981  case 2: /* Type */
982  pExtension1 = PathFindExtensionW(pDataW1->wszName);
983  pExtension2 = PathFindExtensionW(pDataW2->wszName);
984  result = wcsicmp(pExtension1, pExtension2);
985  break;
986  case 3: /* Size */
987  if (pData1->u.file.dwFileSize > pData2->u.file.dwFileSize)
988  result = 1;
989  else if (pData1->u.file.dwFileSize < pData2->u.file.dwFileSize)
990  result = -1;
991  else
992  result = 0;
993  break;
994  case 4: /* Modified */
995  result = pData1->u.file.uFileDate - pData2->u.file.uFileDate;
996  if (result == 0)
997  result = pData1->u.file.uFileTime - pData2->u.file.uFileTime;
998  break;
999  case 5: /* Attributes */
1000  return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
1001  }
1002 
1003  if (result == 0)
1004  return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
1005 
1006  return MAKE_COMPARE_HRESULT(result);
1007 }
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2176
GLuint64EXT * result
Definition: glext.h:11304
WCHAR wszName[1]
Definition: shlfolder.c:1555
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:546
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:215
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:238
#define wcsicmp
Definition: compat.h:15
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2350
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:544
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

◆ CreateViewObject()

HRESULT WINAPI CFSFolder::CreateViewObject ( HWND  hwndOwner,
REFIID  riid,
LPVOID ppvOut 
)
virtual

Definition at line 1012 of file CFSFolder.cpp.

1014 {
1015  CComPtr<IShellView> pShellView;
1017 
1018  TRACE ("(%p)->(hwnd=%p,%s,%p)\n", this, hwndOwner, shdebugstr_guid (&riid),
1019  ppvOut);
1020 
1021  if (ppvOut)
1022  {
1023  *ppvOut = NULL;
1024 
1025  BOOL bIsDropTarget = IsEqualIID (riid, IID_IDropTarget);
1026  BOOL bIsShellView = !bIsDropTarget && IsEqualIID (riid, IID_IShellView);
1027 
1028  if (bIsDropTarget || bIsShellView)
1029  {
1030  DWORD dwDirAttributes = _ILGetFileAttributes(ILFindLastID(m_pidlRoot), NULL, 0);
1031 
1032  if ((dwDirAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
1033  {
1034  CLSID clsidFolder;
1035  hr = SHELL32_GetCLSIDForDirectory(m_sPathTarget, L"UICLSID", &clsidFolder);
1036  if (SUCCEEDED(hr))
1037  {
1038  CComPtr<IPersistFolder> spFolder;
1039  hr = SHCoCreateInstance(NULL, &clsidFolder, NULL, IID_PPV_ARG(IPersistFolder, &spFolder));
1040  if (!FAILED_UNEXPECTEDLY(hr))
1041  {
1042  hr = spFolder->Initialize(m_pidlRoot);
1043 
1044  if (!FAILED_UNEXPECTEDLY(hr))
1045  {
1046  hr = spFolder->QueryInterface(riid, ppvOut);
1047  }
1048  }
1049  }
1050  else
1051  {
1052  // No desktop.ini, or no UICLSID present, continue as if nothing happened
1053  hr = E_INVALIDARG;
1054  }
1055  }
1056  }
1057 
1058  if (!SUCCEEDED(hr))
1059  {
1060  // No UICLSID handler found, continue to the default handlers
1061  if (bIsDropTarget)
1062  {
1064  }
1065  else if (IsEqualIID (riid, IID_IContextMenu))
1066  {
1067  HKEY hKeys[16];
1068  UINT cKeys = 0;
1069  AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
1070 
1071  DEFCONTEXTMENU dcm;
1072  dcm.hwnd = hwndOwner;
1073  dcm.pcmcb = this;
1074  dcm.pidlFolder = m_pidlRoot;
1075  dcm.psf = this;
1076  dcm.cidl = 0;
1077  dcm.apidl = NULL;
1078  dcm.cKeys = cKeys;
1079  dcm.aKeys = hKeys;
1080  dcm.punkAssociationInfo = NULL;
1081  hr = SHCreateDefaultContextMenu (&dcm, riid, ppvOut);
1082  }
1083  else if (bIsShellView)
1084  {
1085  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this, NULL, this};
1086  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
1087  }
1088  else
1089  {
1090  hr = E_INVALIDARG;
1091  }
1092  }
1093  }
1094  TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
1095  return hr;
1096 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
HRESULT CFSDropTarget_CreateInstance(LPWSTR sPathTarget, REFIID riid, LPVOID *ppvOut)
DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2595
HRESULT hr
Definition: shlfolder.c:183
const HKEY * aKeys
Definition: shlobj.h:2374
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
void AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:267
IContextMenuCB * pcmcb
Definition: shlobj.h:2367
static HRESULT SHELL32_GetCLSIDForDirectory(LPCWSTR pwszDir, LPCWSTR KeyName, CLSID *pclsidFolder)
Definition: CFSFolder.cpp:586
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3795
#define IID_PPV_ARG(Itype, ppType)
IShellFolder * psf
Definition: shlobj.h:2369
unsigned int BOOL
Definition: ntddk_ex.h:94
if SUCCEEDED(hr)
#define E_INVALIDARG
Definition: ddrawi.h:101
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
struct _SFV_CREATE SFV_CREATE
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
IUnknown * punkAssociationInfo
Definition: shlobj.h:2372
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2371
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2368
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EnumObjects()

HRESULT WINAPI CFSFolder::EnumObjects ( HWND  hwndOwner,
DWORD  dwFlags,
LPENUMIDLIST *  ppEnumIDList 
)
virtual

Definition at line 830 of file CFSFolder.cpp.

834 {
835  return ShellObjectCreatorInit<CFileSysEnum>(m_sPathTarget, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
836 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
#define IID_PPV_ARG(Itype, ppType)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ EnumSearches()

HRESULT WINAPI CFSFolder::EnumSearches ( IEnumExtraSearch **  ppenum)
virtual

Implements IShellFolder2.

Definition at line 1476 of file CFSFolder.cpp.

1477 {
1478  FIXME ("(%p)\n", this);
1479  return E_NOTIMPL;
1480 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetAttributesOf()

HRESULT WINAPI CFSFolder::GetAttributesOf ( UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
DWORD rgfInOut 
)
virtual

Definition at line 1107 of file CFSFolder.cpp.

1109 {
1110  HRESULT hr = S_OK;
1111 
1112  if (!rgfInOut)
1113  return E_INVALIDARG;
1114  if (cidl && !apidl)
1115  return E_INVALIDARG;
1116 
1117  if (*rgfInOut == 0)
1118  *rgfInOut = ~0;
1119 
1120  if(cidl == 0)
1121  {
1123 
1124  if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
1125  {
1126  SHELL32_GetFSItemAttributes(this, rpidl, rgfInOut);
1127  }
1128  else if (_ILIsDrive(rpidl))
1129  {
1130  IShellFolder *psfParent = NULL;
1132  if(SUCCEEDED(hr))
1133  {
1134  hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut);
1135  psfParent->Release();
1136  }
1137  }
1138  else
1139  {
1140  ERR("Got and unknown pidl!\n");
1141  }
1142  }
1143  else
1144  {
1145  while (cidl > 0 && *apidl)
1146  {
1147  pdump(*apidl);
1148  if(_ILIsFolder(*apidl) || _ILIsValue(*apidl))
1149  SHELL32_GetFSItemAttributes(this, *apidl, rgfInOut);
1150  else
1151  ERR("Got an unknown type of pidl!!!\n");
1152  apidl++;
1153  cidl--;
1154  }
1155  }
1156  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
1157  *rgfInOut &= ~SFGAO_VALIDATE;
1158 
1159  TRACE("-- result=0x%08x\n", *rgfInOut);
1160 
1161  return hr;
1162 }
HRESULT hr
Definition: shlfolder.c:183
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define IID_PPV_ARG(Itype, ppType)
if SUCCEEDED(hr)
ULONG Release()
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1953
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1974
SFGAO_STORAGEANCESTOR typedef ULONG SFGAOF
Definition: shobjidl.idl:218
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1337
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
#define NULL
Definition: types.h:112
HRESULT SHELL32_GetFSItemAttributes(IShellFolder *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CFSFolder.cpp:605

◆ GetClassID()

HRESULT WINAPI CFSFolder::GetClassID ( CLSID lpClassId)
virtual

Implements IPersist.

Definition at line 1574 of file CFSFolder.cpp.

1575 {
1576  TRACE ("(%p)\n", this);
1577 
1578  if (!lpClassId)
1579  return E_POINTER;
1580 
1581  *lpClassId = *m_pclsid;
1582 
1583  return S_OK;
1584 }
const CLSID * m_pclsid
Definition: CFSFolder.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFolder()

HRESULT WINAPI CFSFolder::GetCurFolder ( PIDLIST_ABSOLUTE pidl)
virtual

Implements IPersistFolder2.

Definition at line 1621 of file CFSFolder.cpp.

1622 {
1623  TRACE ("(%p)->(%p)\n", this, pidl);
1624 
1625  if (!pidl)
1626  return E_POINTER;
1627 
1628  *pidl = ILClone(m_pidlRoot);
1629  return S_OK;
1630 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define E_POINTER
Definition: winerror.h:2365

◆ GetCustomViewInfo()

HRESULT WINAPI CFSFolder::GetCustomViewInfo ( ULONG  unknown,
SFVM_CUSTOMVIEWINFO_DATA data 
)
protected

Definition at line 1878 of file CFSFolder.cpp.

1879 {
1880  if (data == NULL)
1881  {
1882  return E_POINTER;
1883  }
1884  if (data->cbSize != sizeof(*data))
1885  {
1886  // NOTE: You have to set the cbData member before SFVM_GET_CUSTOMVIEWINFO call.
1887  return E_INVALIDARG;
1888  }
1889 
1890  data->hbmBack = NULL;
1891  data->clrText = CLR_INVALID;
1892  data->clrTextBack = CLR_INVALID;
1893 
1895 
1896  // does the folder exists?
1898  {
1899  return E_INVALIDARG;
1900  }
1901 
1902  // don't use custom view in network path for security
1904  {
1905  return E_ACCESSDENIED;
1906  }
1907 
1908  // build the ini file path
1910  PathAppend(szIniFile, L"desktop.ini");
1911 
1912  static LPCWSTR TheGUID = L"{BE098140-A513-11D0-A3A4-00C04FD706EC}";
1913  static LPCWSTR Space = L" \t\n\r\f\v";
1914 
1915  // get info from ini file
1916  WCHAR szImage[MAX_PATH], szText[64];
1917 
1918  // load the image
1919  szImage[0] = UNICODE_NULL;
1920  GetPrivateProfileStringW(TheGUID, L"IconArea_Image", L"", szImage, _countof(szImage), szIniFile);
1921  if (szImage[0])
1922  {
1923  StrTrimW(szImage, Space);
1924  if (PathIsRelativeW(szImage))
1925  {
1926  PathAppendW(szPath, szImage);
1927  StringCchCopyW(szImage, _countof(szImage), szPath);
1928  }
1929  data->hbmBack = DoLoadPicture(szImage);
1930  }
1931 
1932  // load the text color
1933  szText[0] = UNICODE_NULL;
1934  GetPrivateProfileStringW(TheGUID, L"IconArea_Text", L"", szText, _countof(szText), szIniFile);
1935  if (szText[0])
1936  {
1937  StrTrimW(szText, Space);
1938 
1939  LPWSTR pchEnd = NULL;
1940  COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
1941 
1942  if (pchEnd && !*pchEnd)
1943  data->clrText = cr;
1944  }
1945 
1946  // load the text background color
1947  szText[0] = UNICODE_NULL;
1948  GetPrivateProfileStringW(TheGUID, L"IconArea_TextBackground", L"", szText, _countof(szText), szIniFile);
1949  if (szText[0])
1950  {
1951  StrTrimW(szText, Space);
1952 
1953  LPWSTR pchEnd = NULL;
1954  COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
1955 
1956  if (pchEnd && !*pchEnd)
1957  data->clrTextBack = cr;
1958  }
1959 
1960  if (data->hbmBack != NULL || data->clrText != CLR_INVALID || data->clrTextBack != CLR_INVALID)
1961  return S_OK;
1962 
1963  return E_FAIL;
1964 }
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1722
#define E_ACCESSDENIED
Definition: winerror.h:2849
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1578
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define CLR_INVALID
Definition: wingdi.h:883
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define PathIsNetworkPath
Definition: shlwapi.h:1101
#define PathAppend
Definition: shlwapi.h:801
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
TCHAR szIniFile[]
Definition: scrnsave.c:28
#define UNICODE_NULL
static const WCHAR szText[]
Definition: dialog.c:139
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static HBITMAP DoLoadPicture(LPCWSTR pszFileName)
Definition: CFSFolder.cpp:1851
#define E_INVALIDARG
Definition: ddrawi.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD COLORREF
Definition: windef.h:300
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define E_POINTER
Definition: winerror.h:2365

Referenced by MessageSFVCB().

◆ GetDefaultColumn()

HRESULT WINAPI CFSFolder::GetDefaultColumn ( DWORD  dwRes,
ULONG pSort,
ULONG pDisplay 
)
virtual

Implements IShellFolder2.

Definition at line 1482 of file CFSFolder.cpp.

1484 {
1485  TRACE ("(%p)\n", this);
1486 
1487  if (pSort)
1488  *pSort = 0;
1489  if (pDisplay)
1490  *pDisplay = 0;
1491 
1492  return S_OK;
1493 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52

◆ GetDefaultColumnState()

HRESULT WINAPI CFSFolder::GetDefaultColumnState ( UINT  iColumn,
DWORD pcsFlags 
)
virtual

Implements IShellFolder2.

Definition at line 1495 of file CFSFolder.cpp.

1497 {
1498  TRACE ("(%p)\n", this);
1499 
1500  if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
1501  return E_INVALIDARG;
1502 
1503  *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
1504 
1505  return S_OK;
1506 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
static const shvheader GenericSFHeader[]
Definition: CFSFolder.cpp:535
#define S_OK
Definition: intsafe.h:52
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:544

◆ GetDefaultSearchGUID()

HRESULT WINAPI CFSFolder::GetDefaultSearchGUID ( GUID pguid)
virtual

Implements IShellFolder2.

Definition at line 1470 of file CFSFolder.cpp.

1471 {
1472  FIXME ("(%p)\n", this);
1473  return E_NOTIMPL;
1474 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsEx()

HRESULT WINAPI CFSFolder::GetDetailsEx ( PCUITEMID_CHILD  pidl,
const SHCOLUMNID pscid,
VARIANT pv 
)
virtual

Implements IShellFolder2.

Definition at line 1508 of file CFSFolder.cpp.

1510 {
1511  FIXME ("(%p)\n", this);
1512 
1513  return E_NOTIMPL;
1514 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDetailsOf()

HRESULT WINAPI CFSFolder::GetDetailsOf ( PCUITEMID_CHILD  pidl,
UINT  iColumn,
SHELLDETAILS psd 
)
virtual

Implements IShellFolder2.

Definition at line 1516 of file CFSFolder.cpp.

1518 {
1519  HRESULT hr = E_FAIL;
1520 
1521  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1522 
1523  if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
1524  return E_INVALIDARG;
1525 
1526  if (!pidl)
1527  {
1528  /* the header titles */
1529  psd->fmt = GenericSFHeader[iColumn].fmt;
1530  psd->cxChar = GenericSFHeader[iColumn].cxChar;
1531  return SHSetStrRet(&psd->str, GenericSFHeader[iColumn].colnameid);
1532  }
1533  else
1534  {
1535  hr = S_OK;
1536  psd->str.uType = STRRET_CSTR;
1537  /* the data from the pidl */
1538  switch (iColumn)
1539  {
1540  case 0: /* name */
1541  hr = GetDisplayNameOf (pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
1542  break;
1543  case 1: /* FIXME: comments */
1544  psd->str.cStr[0] = 0;
1545  break;
1546  case 2: /* type */
1547  _ILGetFileType(pidl, psd->str.cStr, MAX_PATH);
1548  break;
1549  case 3: /* size */
1550  _ILGetFileSize(pidl, psd->str.cStr, MAX_PATH);
1551  break;
1552  case 4: /* date */
1553  _ILGetFileDate(pidl, psd->str.cStr, MAX_PATH);
1554  break;
1555  case 5: /* attributes */
1556  _ILGetFileAttributes(pidl, psd->str.cStr, MAX_PATH);
1557  break;
1558  }
1559  }
1560 
1561  return hr;
1562 }
DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2595
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
STRRET str
Definition: shtypes.idl:108
char cStr[MAX_PATH]
Definition: shtypes.idl:98
#define E_INVALIDARG
Definition: ddrawi.h:101
DWORD _ILGetFileSize(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2455
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
static const shvheader GenericSFHeader[]
Definition: CFSFolder.cpp:535
#define S_OK
Definition: intsafe.h:52
BOOL _ILGetFileDate(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2411
virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CFSFolder.cpp:1348
void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2522
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:544
UINT uType
Definition: shtypes.idl:93

◆ GetDisplayNameOf()

HRESULT WINAPI CFSFolder::GetDisplayNameOf ( PCUITEMID_CHILD  pidl,
DWORD  dwFlags,
LPSTRRET  strRet 
)
virtual

Definition at line 1348 of file CFSFolder.cpp.

1350 {
1351  if (!strRet)
1352  return E_INVALIDARG;
1353 
1354  /* If it is a complex pidl, let the child handle it */
1355  if (!_ILIsPidlSimple (pidl)) /* complex pidl */
1356  {
1357  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
1358  }
1359  else if (pidl && !pidl->mkid.cb) /* empty pidl */
1360  {
1361  /* If it is an empty pidl return only the path of the folder */
1364  m_sPathTarget)
1365  {
1366  return SHSetStrRet(strRet, m_sPathTarget);
1367  }
1368  return E_INVALIDARG;
1369  }
1370 
1371  int len = 0;
1372  LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
1373  if (!pszPath)
1374  return E_OUTOFMEMORY;
1375 
1378  m_sPathTarget)
1379  {
1380  lstrcpynW(pszPath, m_sPathTarget, MAX_PATH);
1381  PathAddBackslashW(pszPath);
1382  len = wcslen(pszPath);
1383  }
1384  _ILSimpleGetTextW(pidl, pszPath + len, MAX_PATH + 1 - len);
1385  if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
1386 
1387  strRet->uType = STRRET_WSTR;
1388  strRet->pOleStr = pszPath;
1389 
1390  TRACE ("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1391  return S_OK;
1392 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
LPWSTR pOleStr
Definition: shtypes.idl:96
#define lstrcpynW
Definition: compat.h:597
char cStr[MAX_PATH]
Definition: shtypes.idl:98
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:52
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:197
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2096
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLenum GLsizei len
Definition: glext.h:6722
void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags)
Definition: CFSFolder.cpp:1325
#define S_OK
Definition: intsafe.h:52
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
UINT uType
Definition: shtypes.idl:93
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

Referenced by GetDetailsOf().

◆ GetFolderTargetInfo()

HRESULT WINAPI CFSFolder::GetFolderTargetInfo ( PERSIST_FOLDER_TARGET_INFO ppfti)
virtual

Implements IPersistFolder3.

Definition at line 1707 of file CFSFolder.cpp.

1708 {
1709  FIXME("(%p)->(%p)\n", this, ppfti);
1710  ZeroMemory(ppfti, sizeof (*ppfti));
1711  return E_NOTIMPL;
1712 }
#define ZeroMemory
Definition: winbase.h:1664
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetMaxLength()

STDMETHODIMP CFSFolder::GetMaxLength ( LPCWSTR  pszName,
int piMaxNameLen 
)
inline

Definition at line 83 of file CFSFolder.h.

84  {
85  return E_NOTIMPL;
86  }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetUIObjectOf()

HRESULT WINAPI CFSFolder::GetUIObjectOf ( HWND  hwndOwner,
UINT  cidl,
PCUITEMID_CHILD_ARRAY  apidl,
REFIID  riid,
UINT prgfInOut,
LPVOID ppvOut 
)
virtual

Definition at line 1187 of file CFSFolder.cpp.

1191 {
1192  LPVOID pObj = NULL;
1194 
1195  TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
1196  this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
1197 
1198  if (ppvOut)
1199  {
1200  *ppvOut = NULL;
1201 
1202  if (cidl == 1 && _ILIsValue(apidl[0]))
1203  {
1204  hr = _CreateExtensionUIObject(apidl[0], riid, ppvOut);
1205  if(hr != S_FALSE)
1206  return hr;
1207  }
1208 
1209  if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1))
1210  {
1211  HKEY hKeys[16];
1212  UINT cKeys = 0;
1213  AddFSClassKeysToArray(apidl[0], hKeys, &cKeys);
1214 
1215  DEFCONTEXTMENU dcm;
1216  dcm.hwnd = hwndOwner;
1217  dcm.pcmcb = this;
1218  dcm.pidlFolder = m_pidlRoot;
1219  dcm.psf = this;
1220  dcm.cidl = cidl;
1221  dcm.apidl = apidl;
1222  dcm.cKeys = cKeys;
1223  dcm.aKeys = hKeys;
1224  dcm.punkAssociationInfo = NULL;
1225  hr = SHCreateDefaultContextMenu (&dcm, riid, &pObj);
1226  }
1227  else if (IsEqualIID (riid, IID_IDataObject))
1228  {
1229  if (cidl >= 1)
1230  {
1231  hr = IDataObject_Constructor (hwndOwner, m_pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
1232  }
1233  else
1234  {
1235  hr = E_INVALIDARG;
1236  }
1237  }
1238  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
1239  {
1240  if (_ILIsValue(apidl[0]))
1241  hr = _GetIconHandler(apidl[0], riid, (LPVOID*)&pObj);
1242  if (hr != S_OK)
1243  hr = CFSExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
1244  }
1245  else if (IsEqualIID (riid, IID_IDropTarget))
1246  {
1247  /* only interested in attempting to bind to shell folders, not files (except exe), so if we fail, rebind to root */
1248  if (cidl != 1 || FAILED(hr = this->_GetDropTarget(apidl[0], (LPVOID*) &pObj)))
1249  {
1251  }
1252  }
1253  else
1254  hr = E_NOINTERFACE;
1255 
1256  if (SUCCEEDED(hr) && !pObj)
1257  hr = E_OUTOFMEMORY;
1258 
1259  *ppvOut = pObj;
1260  }
1261  TRACE("(%p)->hr=0x%08x\n", this, hr);
1262  return hr;
1263 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT CFSDropTarget_CreateInstance(LPWSTR sPathTarget, REFIID riid, LPVOID *ppvOut)
HRESULT hr
Definition: shlfolder.c:183
const HKEY * aKeys
Definition: shlobj.h:2374
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
HRESULT _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1740
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
IContextMenuCB * pcmcb
Definition: shlobj.h:2367
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
const GUID IID_IDataObject
IShellFolder * psf
Definition: shlobj.h:2369
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT CFSExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID iid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:250
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT IDataObject_Constructor(HWND hwndOwner, PCIDLIST_ABSOLUTE pMyPidl, PCUIDLIST_RELATIVE_ARRAY apidl, UINT cidl, BOOL bExtendedObject, IDataObject **dataObject)
HRESULT _GetIconHandler(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1768
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1974
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
void AddFSClassKeysToArray(PCUITEMID_CHILD pidl, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:281
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
IUnknown * punkAssociationInfo
Definition: shlobj.h:2372
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2371
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2368
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
HRESULT _CreateExtensionUIObject(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1714

◆ GetValidCharacters()

STDMETHODIMP CFSFolder::GetValidCharacters ( LPWSTR ppwszValidChars,
LPWSTR ppwszInvalidChars 
)
inline

Definition at line 89 of file CFSFolder.h.

90  {
91  if (ppwszValidChars)
92  {
93  *ppwszValidChars = NULL;
94  }
95  if (ppwszInvalidChars)
96  {
97  SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars);
98  }
99  return S_OK;
100  }
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2004
#define INVALID_FILETITLE_CHARACTERSW
Definition: undocshell.h:729
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112

◆ Initialize()

HRESULT WINAPI CFSFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
virtual

Implements IPersistFolder.

Definition at line 1592 of file CFSFolder.cpp.

1593 {
1594  WCHAR wszTemp[MAX_PATH];
1595 
1596  TRACE ("(%p)->(%p)\n", this, pidl);
1597 
1598  SHFree(m_pidlRoot); /* free the old pidl */
1599  m_pidlRoot = ILClone (pidl); /* set my pidl */
1600 
1602  m_sPathTarget = NULL;
1603 
1604  /* set my path */
1605  if (SHGetPathFromIDListW (pidl, wszTemp))
1606  {
1607  int len = wcslen(wszTemp);
1608  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1609  if (!m_sPathTarget)
1610  return E_OUTOFMEMORY;
1611  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1612  }
1613 
1614  TRACE ("--(%p)->(%s)\n", this, debugstr_w(m_sPathTarget));
1615  return S_OK;
1616 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

◆ InitializeEx()

HRESULT WINAPI CFSFolder::InitializeEx ( IBindCtx pbc,
LPCITEMIDLIST  pidlRoot,
const PERSIST_FOLDER_TARGET_INFO ppfti 
)
virtual

Definition at line 1637 of file CFSFolder.cpp.

1639 {
1640  WCHAR wszTemp[MAX_PATH];
1641 
1642  TRACE("(%p)->(%p,%p,%p)\n", this, pbc, pidlRootx, ppfti);
1643  if (ppfti)
1644  TRACE("--%p %s %s 0x%08x 0x%08x\n",
1645  ppfti->pidlTargetFolder, debugstr_w (ppfti->szTargetParsingName),
1646  debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes,
1647  ppfti->csidl);
1648 
1649  pdump (pidlRootx);
1650  if (ppfti && ppfti->pidlTargetFolder)
1651  pdump(ppfti->pidlTargetFolder);
1652 
1653  if (m_pidlRoot)
1654  __SHFreeAndNil(&m_pidlRoot); /* free the old */
1655  if (m_sPathTarget)
1657 
1658  /*
1659  * Root path and pidl
1660  */
1661  m_pidlRoot = ILClone(pidlRootx);
1662 
1663  /*
1664  * the target folder is spezified in csidl OR pidlTargetFolder OR
1665  * szTargetParsingName
1666  */
1667  if (ppfti)
1668  {
1669  if (ppfti->csidl != -1)
1670  {
1671  if (SHGetSpecialFolderPathW(0, wszTemp, ppfti->csidl,
1672  ppfti->csidl & CSIDL_FLAG_CREATE)) {
1673  int len = wcslen(wszTemp);
1674  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1675  if (!m_sPathTarget)
1676  return E_OUTOFMEMORY;
1677  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1678  }
1679  }
1680  else if (ppfti->szTargetParsingName[0])
1681  {
1682  int len = wcslen(ppfti->szTargetParsingName);
1683  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1684  if (!m_sPathTarget)
1685  return E_OUTOFMEMORY;
1686  memcpy(m_sPathTarget, ppfti->szTargetParsingName,
1687  (len + 1) * sizeof(WCHAR));
1688  }
1689  else if (ppfti->pidlTargetFolder)
1690  {
1691  if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp))
1692  {
1693  int len = wcslen(wszTemp);
1694  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1695  if (!m_sPathTarget)
1696  return E_OUTOFMEMORY;
1697  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1698  }
1699  }
1700  }
1701 
1702  TRACE("--(%p)->(target=%s)\n", this, debugstr_w(m_sPathTarget));
1703  pdump(m_pidlRoot);
1704  return (m_sPathTarget) ? S_OK : E_FAIL;
1705 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define E_FAIL
Definition: ddrawi.h:102
#define __SHFreeAndNil(ptr)
Definition: shell32_main.h:136
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2948
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
#define CSIDL_FLAG_CREATE
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

◆ MapColumnToSCID()

HRESULT WINAPI CFSFolder::MapColumnToSCID ( UINT  column,
SHCOLUMNID pscid 
)
virtual

Implements IShellFolder2.

Definition at line 1564 of file CFSFolder.cpp.

1566 {
1567  FIXME ("(%p)\n", this);
1568  return E_NOTIMPL;
1569 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MessageSFVCB()

HRESULT WINAPI CFSFolder::MessageSFVCB ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
virtual

Definition at line 1966 of file CFSFolder.cpp.

1967 {
1968  HRESULT hr = E_NOTIMPL;
1969  switch (uMsg)
1970  {
1973  break;
1974  }
1975  return hr;
1976 }
HRESULT hr
Definition: shlfolder.c:183
WPARAM wParam
Definition: combotst.c:138
#define SFVM_GET_CUSTOMVIEWINFO
LONG HRESULT
Definition: typedefs.h:79
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int ULONG
Definition: retypes.h:1
LPARAM lParam
Definition: combotst.c:139
HRESULT WINAPI GetCustomViewInfo(ULONG unknown, SFVM_CUSTOMVIEWINFO_DATA *data)
Definition: CFSFolder.cpp:1878

◆ ParseDisplayName()

HRESULT WINAPI CFSFolder::ParseDisplayName ( HWND  hwndOwner,
LPBC  pbc,
LPOLESTR  lpszDisplayName,
DWORD pchEaten,
PIDLIST_RELATIVE ppidl,
DWORD pdwAttributes 
)
virtual

Definition at line 736 of file CFSFolder.cpp.

741 {
743  LPCWSTR szNext = NULL;
746  LPITEMIDLIST pidlTemp = NULL;
747  DWORD len;
748 
749  TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
750  this, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
751  pchEaten, ppidl, pdwAttributes);
752 
753  if (!ppidl)
754  return E_INVALIDARG;
755 
756  if (!lpszDisplayName)
757  {
758  *ppidl = NULL;
759  return E_INVALIDARG;
760  }
761 
762  *ppidl = NULL;
763 
764  if (pchEaten)
765  *pchEaten = 0; /* strange but like the original */
766 
767  if (*lpszDisplayName)
768  {
769  /* get the next element */
770  szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
771 
772  pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, szElement);
773  if (pidlTemp != NULL)
774  {
775  /* We are creating an id list without ensuring that the items exist.
776  If we have a remaining path, this must be a folder.
777  We have to do it now because it is set as a file by default */
778  if (szNext)
779  {
780  pidlTemp->mkid.abID[0] = PT_FOLDER;
781  }
782  hr = S_OK;
783  }
784  else
785  {
786  /* build the full pathname to the element */
789  len = wcslen(szPath);
791 
792  /* get the pidl */
793  hr = _ILCreateFromPathW(szPath, &pidlTemp);
794  }
795 
796  if (SUCCEEDED(hr))
797  {
798  if (szNext && *szNext)
799  {
800  /* try to analyse the next element */
801  hr = SHELL32_ParseNextElement(this, hwndOwner, pbc,
802  &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
803  }
804  else
805  {
806  /* it's the last element */
807  if (pdwAttributes && *pdwAttributes)
808  hr = SHELL32_GetFSItemAttributes(this, pidlTemp, pdwAttributes);
809  }
810  }
811  }
812 
813  if (SUCCEEDED(hr))
814  *ppidl = pidlTemp;
815  else
816  *ppidl = NULL;
817 
818  TRACE("(%p)->(-- pidl=%p ret=0x%08x)\n", this, ppidl ? *ppidl : 0, hr);
819 
820  return hr;
821 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
HRESULT hr
Definition: shlfolder.c:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static LPOLESTR
Definition: stg_prop.c:27
#define lstrcpynW
Definition: compat.h:597
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:294
HRESULT _ILCreateFromPathW(LPCWSTR szPath, LPITEMIDLIST *ppidl)
Definition: pidl.c:1789
if SUCCEEDED(hr)
#define debugstr_w
Definition: kernel32.h:32
#define E_INVALIDARG
Definition: ddrawi.h:101
static WCHAR szElement[]
Definition: domdoc.c:1171
HRESULT SHELL32_ParseNextElement(IShellFolder2 *psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST *pidlInOut, LPOLESTR szNext, DWORD *pEaten, DWORD *pdwAttributes)
Definition: shlfolder.cpp:70
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path)
Definition: CFSFolder.cpp:553
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
LPCWSTR GetNextElementW(LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut)
Definition: shlfolder.cpp:43
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define PT_FOLDER
Definition: pidl.h:94
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
HRESULT SHELL32_GetFSItemAttributes(IShellFolder *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CFSFolder.cpp:605

◆ SetNameOf()

HRESULT WINAPI CFSFolder::SetNameOf ( HWND  hwndOwner,
PCUITEMID_CHILD  pidl,
LPCOLESTR  lpName,
DWORD  dwFlags,
PITEMID_CHILD pPidlOut 
)
virtual

Implements IShellFolder.

Definition at line 1406 of file CFSFolder.cpp.

1412 {
1413  WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1];
1414  BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
1415 
1416  TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this, hwndOwner, pidl,
1417  debugstr_w (lpName), dwFlags, pPidlOut);
1418 
1419  FileStructW* pDataW = _ILGetFileStructW(pidl);
1420  if (!pDataW)
1421  {
1422  ERR("Got garbage pidl\n");
1423  return E_INVALIDARG;
1424  }
1425 
1426  /* build source path */
1427  PathCombineW(szSrc, m_sPathTarget, pDataW->wszName);
1428 
1429  /* build destination path */
1431  PathCombineW(szDest, m_sPathTarget, lpName);
1432  else
1433  lstrcpynW(szDest, lpName, MAX_PATH);
1434 
1435  if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
1436  WCHAR *ext = PathFindExtensionW(szSrc);
1437  if(*ext != '\0') {
1438  INT len = wcslen(szDest);
1439  lstrcpynW(szDest + len, ext, MAX_PATH - len);
1440  }
1441  }
1442 
1443  TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
1444  if (!wcscmp(szSrc, szDest))
1445  {
1446  /* src and destination is the same */
1447  HRESULT hr = S_OK;
1448  if (pPidlOut)
1449  hr = _ILCreateFromPathW(szDest, pPidlOut);
1450 
1451  return hr;
1452  }
1453 
1454  if (MoveFileW (szSrc, szDest))
1455  {
1456  HRESULT hr = S_OK;
1457 
1458  if (pPidlOut)
1459  hr = _ILCreateFromPathW(szDest, pPidlOut);
1460 
1462  SHCNF_PATHW, szSrc, szDest);
1463 
1464  return hr;
1465  }
1466 
1467  return E_FAIL;
1468 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
HRESULT hr
Definition: shlfolder.c:183
WCHAR wszName[1]
Definition: shlfolder.c:1555
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1746
_In_ LPCSTR lpName
Definition: winbase.h:2768
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1729
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:58
#define lstrcpynW
Definition: compat.h:597
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT _ILCreateFromPathW(LPCWSTR szPath, LPITEMIDLIST *ppidl)
Definition: pidl.c:1789
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1044
BOOL SHELL_FS_HideExtension(LPCWSTR szPath)
Definition: CFSFolder.cpp:1282
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
char ext[3]
Definition: mkdosfs.c:358
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
GLenum GLsizei len
Definition: glext.h:6722
#define SHCNF_PATHW
Definition: shlobj.h:1764
#define ERR(fmt,...)
Definition: debug.h:110
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define S_OK
Definition: intsafe.h:52
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2350
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
Definition: path.c:194

Member Data Documentation

◆ m_bGroupPolicyActive

DWORD CFSFolder::m_bGroupPolicyActive
private

Definition at line 31 of file CFSFolder.h.

Referenced by CFSFolder().

◆ m_pclsid

const CLSID* CFSFolder::m_pclsid
private

Definition at line 24 of file CFSFolder.h.

Referenced by CFSFolder(), and GetClassID().

◆ m_pidlRoot

◆ m_sPathTarget


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