ReactOS  0.4.15-dev-3698-gce6da82
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 511 of file CFSFolder.cpp.

512 {
513  m_pclsid = &CLSID_ShellFSFolder;
515  m_pidlRoot = NULL;
517 }
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 519 of file CFSFolder.cpp.

520 {
521  TRACE("-- destroying IShellFolder(%p)\n", this);
522 
525 }
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:326

Member Function Documentation

◆ _CreateExtensionUIObject()

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

Definition at line 1705 of file CFSFolder.cpp.

1706 {
1707  WCHAR buf[MAX_PATH];
1708 
1709  sprintfW(buf, L"ShellEx\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
1710  riid.Data1, riid.Data2, riid.Data3,
1711  riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3],
1712  riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7]);
1713 
1714  CLSID clsid;
1715  HRESULT hr;
1716 
1717  hr = GetCLSIDForFileType(pidl, buf, &clsid);
1718  if (hr != S_OK)
1719  return hr;
1720 
1721  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1722  if (FAILED_UNEXPECTEDLY(hr))
1723  return hr;
1724 
1725  return S_OK;
1726 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1772
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define L(x)
Definition: ntvdm.h:50
__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 1772 of file CFSFolder.cpp.

1773 {
1774  HRESULT hr;
1775  WCHAR wszPath[MAX_PATH];
1776 
1777  FileStructW* pDataW = _ILGetFileStructW(pidl);
1778  if (!pDataW)
1779  {
1780  ERR("Got garbage pidl\n");
1781  return E_INVALIDARG;
1782  }
1783 
1784  PathCombineW(wszPath, m_sPathTarget, pDataW->wszName);
1785 
1786  CComPtr<IPersistFile> pp;
1788  if (FAILED_UNEXPECTEDLY(hr))
1789  return hr;
1790 
1791  pp->Load(wszPath, 0);
1792 
1793  hr = pp->QueryInterface(riid, ppvOut);
1794  if (hr != S_OK)
1795  {
1796  ERR("Failed to query for interface IID_IShellExtInit hr %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid));
1797  return hr;
1798  }
1799  return hr;
1800 }
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 1728 of file CFSFolder.cpp.

1729 {
1730  HRESULT hr;
1731 
1732  TRACE("CFSFolder::_GetDropTarget entered\n");
1733 
1734  if (_ILIsFolder (pidl))
1735  {
1736  CComPtr<IShellFolder> psfChild;
1737  hr = this->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
1738  if (FAILED_UNEXPECTEDLY(hr))
1739  return hr;
1740 
1741  return psfChild->CreateViewObject(NULL, IID_IDropTarget, ppvOut);
1742  }
1743 
1744  CLSID clsid;
1745  hr = GetCLSIDForFileType(pidl, L"shellex\\DropHandler", &clsid);
1746  if (hr != S_OK)
1747  return hr;
1748 
1749  hr = _CreateShellExtInstance(&clsid, pidl, IID_IDropTarget, ppvOut);
1750  if (FAILED_UNEXPECTEDLY(hr))
1751  return S_FALSE;
1752 
1753  return S_OK;
1754 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1772
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
#define L(x)
Definition: ntvdm.h:50
#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:840
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 NULL
Definition: types.h:112

Referenced by GetUIObjectOf().

◆ _GetIconHandler()

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

Definition at line 1756 of file CFSFolder.cpp.

1757 {
1758  CLSID clsid;
1759  HRESULT hr;
1760 
1761  hr = GetCLSIDForFileType(pidl, L"shellex\\IconHandler", &clsid);
1762  if (hr != S_OK)
1763  return hr;
1764 
1765  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1766  if (FAILED_UNEXPECTEDLY(hr))
1767  return S_FALSE;
1768 
1769  return S_OK;
1770 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1772
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define L(x)
Definition: ntvdm.h:50
#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
#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 840 of file CFSFolder.cpp.

845 {
846  TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this, pidl, pbc,
847  shdebugstr_guid(&riid), ppvOut);
848 
849  CComPtr<IShellFolder> pSF;
850  HRESULT hr;
851 
852  if (!m_pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb)
853  {
854  ERR("CFSFolder::BindToObject: Invalid parameters\n");
855  return E_INVALIDARG;
856  }
857 
858  /* Get the pidl data */
859  FileStruct* pData = &_ILGetDataPointer(pidl)->u.file;
860  FileStructW* pDataW = _ILGetFileStructW(pidl);
861 
862  if (!pDataW)
863  {
864  ERR("CFSFolder::BindToObject: Invalid pidl!\n");
865  return E_INVALIDARG;
866  }
867 
868  *ppvOut = NULL;
869 
870  /* Create the target folder info */
871  PERSIST_FOLDER_TARGET_INFO pfti = {0};
872  pfti.dwAttributes = -1;
873  pfti.csidl = -1;
874  PathCombineW(pfti.szTargetParsingName, m_sPathTarget, pDataW->wszName);
875 
876  /* Get the CLSID to bind to */
877  CLSID clsidFolder;
878  if (_ILIsFolder(pidl))
879  {
880  if ((pData->uFileAttribs & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
881  {
882  hr = SHELL32_GetCLSIDForDirectory(pfti.szTargetParsingName, L"CLSID", &clsidFolder);
883 
884  if (SUCCEEDED(hr))
885  {
886  /* We got a GUID from a desktop.ini, let's try it */
887  hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
888  if (SUCCEEDED(hr))
889  {
890  TRACE("-- returning (%p) %08x, (%s)\n", *ppvOut, hr, wine_dbgstr_guid(&clsidFolder));
891  return hr;
892  }
893 
894  /* Something went wrong, re-try it with a normal ShellFSFolder */
895  ERR("CFSFolder::BindToObject: %s failed to bind, using fallback (0x%08x)\n", wine_dbgstr_guid(&clsidFolder), hr);
896  }
897  }
898  /* No system folder or the custom class failed */
899  clsidFolder = CLSID_ShellFSFolder;
900  }
901  else
902  {
903  hr = GetCLSIDForFileType(pidl, L"CLSID", &clsidFolder);
904  if (hr == S_FALSE)
906  if (hr != S_OK)
907  return hr;
908  }
909 
910  hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
911  if (FAILED_UNEXPECTEDLY(hr))
912  return hr;
913 
914  TRACE ("-- returning (%p) %08x\n", *ppvOut, hr);
915 
916  return S_OK;
917 
918 }
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:579
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
#define L(x)
Definition: ntvdm.h:50
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
#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 928 of file CFSFolder.cpp.

933 {
934  FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this, pidl, pbcReserved,
935  shdebugstr_guid (&riid), ppvOut);
936 
937  *ppvOut = NULL;
938  return E_NOTIMPL;
939 }
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 1802 of file CFSFolder.cpp.

1803 {
1804  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1805  return S_OK;
1806 
1807  /* no data object means no selection */
1808  if (!pdtobj)
1809  {
1810  if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
1811  {
1813  LPITEMIDLIST pidlParent = ILClone(m_pidlRoot);
1814  ILRemoveLastID(pidlParent);
1815  HRESULT hr = SH_ShowPropertiesDialog(m_sPathTarget, pidlParent, &pidlChild);
1816  if (FAILED(hr))
1817  ERR("SH_ShowPropertiesDialog failed\n");
1818  ILFree(pidlChild);
1819  ILFree(pidlParent);
1820  }
1821  else if (uMsg == DFM_MERGECONTEXTMENU)
1822  {
1823  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1824  HMENU hpopup = CreatePopupMenu();
1826  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1827  DestroyMenu(hpopup);
1828  }
1829 
1830  return S_OK;
1831  }
1832 
1833  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1834  return S_OK;
1835 
1836  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1837 }
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:856
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:429
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:2367
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:2451
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 945 of file CFSFolder.cpp.

948 {
949  LPPIDLDATA pData1 = _ILGetDataPointer(pidl1);
950  LPPIDLDATA pData2 = _ILGetDataPointer(pidl2);
951  FileStructW* pDataW1 = _ILGetFileStructW(pidl1);
952  FileStructW* pDataW2 = _ILGetFileStructW(pidl2);
953  BOOL bIsFolder1 = _ILIsFolder(pidl1);
954  BOOL bIsFolder2 = _ILIsFolder(pidl2);
955  LPWSTR pExtension1, pExtension2;
956 
957  if (!pDataW1 || !pDataW2 || LOWORD(lParam) >= GENERICSHELLVIEWCOLUMNS)
958  return E_INVALIDARG;
959 
960  /* When sorting between a File and a Folder, the Folder gets sorted first */
961  if (bIsFolder1 != bIsFolder2)
962  {
963  return MAKE_COMPARE_HRESULT(bIsFolder1 ? -1 : 1);
964  }
965 
966  int result;
967  switch (LOWORD(lParam))
968  {
969  case 0: /* Name */
970  result = wcsicmp(pDataW1->wszName, pDataW2->wszName);
971  break;
972  case 1: /* Comments */
973  result = 0;
974  break;
975  case 2: /* Type */
976  pExtension1 = PathFindExtensionW(pDataW1->wszName);
977  pExtension2 = PathFindExtensionW(pDataW2->wszName);
978  result = wcsicmp(pExtension1, pExtension2);
979  break;
980  case 3: /* Size */
981  if (pData1->u.file.dwFileSize > pData2->u.file.dwFileSize)
982  result = 1;
983  else if (pData1->u.file.dwFileSize < pData2->u.file.dwFileSize)
984  result = -1;
985  else
986  result = 0;
987  break;
988  case 4: /* Modified */
989  result = pData1->u.file.uFileDate - pData2->u.file.uFileDate;
990  if (result == 0)
991  result = pData1->u.file.uFileTime - pData2->u.file.uFileTime;
992  break;
993  case 5: /* Attributes */
994  return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
995  }
996 
997  if (result == 0)
998  return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
999 
1000  return MAKE_COMPARE_HRESULT(result);
1001 }
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:537
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 1006 of file CFSFolder.cpp.

1008 {
1009  CComPtr<IShellView> pShellView;
1011 
1012  TRACE ("(%p)->(hwnd=%p,%s,%p)\n", this, hwndOwner, shdebugstr_guid (&riid),
1013  ppvOut);
1014 
1015  if (ppvOut)
1016  {
1017  *ppvOut = NULL;
1018 
1019  BOOL bIsDropTarget = IsEqualIID (riid, IID_IDropTarget);
1020  BOOL bIsShellView = !bIsDropTarget && IsEqualIID (riid, IID_IShellView);
1021 
1022  if (bIsDropTarget || bIsShellView)
1023  {
1024  DWORD dwDirAttributes = _ILGetFileAttributes(ILFindLastID(m_pidlRoot), NULL, 0);
1025 
1026  if ((dwDirAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
1027  {
1028  CLSID clsidFolder;
1029  hr = SHELL32_GetCLSIDForDirectory(m_sPathTarget, L"UICLSID", &clsidFolder);
1030  if (SUCCEEDED(hr))
1031  {
1032  CComPtr<IPersistFolder> spFolder;
1033  hr = SHCoCreateInstance(NULL, &clsidFolder, NULL, IID_PPV_ARG(IPersistFolder, &spFolder));
1034  if (!FAILED_UNEXPECTEDLY(hr))
1035  {
1036  hr = spFolder->Initialize(m_pidlRoot);
1037 
1038  if (!FAILED_UNEXPECTEDLY(hr))
1039  {
1040  hr = spFolder->QueryInterface(riid, ppvOut);
1041  }
1042  }
1043  }
1044  else
1045  {
1046  // No desktop.ini, or no UICLSID present, continue as if nothing happened
1047  hr = E_INVALIDARG;
1048  }
1049  }
1050  }
1051 
1052  if (!SUCCEEDED(hr))
1053  {
1054  // No UICLSID handler found, continue to the default handlers
1055  if (bIsDropTarget)
1056  {
1058  }
1059  else if (IsEqualIID (riid, IID_IContextMenu))
1060  {
1061  HKEY hKeys[16];
1062  UINT cKeys = 0;
1063  AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
1064 
1065  DEFCONTEXTMENU dcm;
1066  dcm.hwnd = hwndOwner;
1067  dcm.pcmcb = this;
1068  dcm.pidlFolder = m_pidlRoot;
1069  dcm.psf = this;
1070  dcm.cidl = 0;
1071  dcm.apidl = NULL;
1072  dcm.cKeys = cKeys;
1073  dcm.aKeys = hKeys;
1074  dcm.punkAssociationInfo = NULL;
1075  hr = SHCreateDefaultContextMenu (&dcm, riid, ppvOut);
1076  }
1077  else if (bIsShellView)
1078  {
1079  SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this, NULL, this};
1080  hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
1081  }
1082  else
1083  {
1084  hr = E_INVALIDARG;
1085  }
1086  }
1087  }
1088  TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
1089  return hr;
1090 }
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:2396
#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:2389
static HRESULT SHELL32_GetCLSIDForDirectory(LPCWSTR pwszDir, LPCWSTR KeyName, CLSID *pclsidFolder)
Definition: CFSFolder.cpp:579
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3791
#define IID_PPV_ARG(Itype, ppType)
#define L(x)
Definition: ntvdm.h:50
IShellFolder * psf
Definition: shlobj.h:2391
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
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:2394
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2393
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2390
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EnumObjects()

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

Definition at line 824 of file CFSFolder.cpp.

828 {
829  return ShellObjectCreatorInit<CFileSysEnum>(m_sPathTarget, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
830 }
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 1467 of file CFSFolder.cpp.

1468 {
1469  FIXME ("(%p)\n", this);
1470  return E_NOTIMPL;
1471 }
#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 1101 of file CFSFolder.cpp.

1103 {
1104  HRESULT hr = S_OK;
1105 
1106  if (!rgfInOut)
1107  return E_INVALIDARG;
1108  if (cidl && !apidl)
1109  return E_INVALIDARG;
1110 
1111  if (*rgfInOut == 0)
1112  *rgfInOut = ~0;
1113 
1114  if(cidl == 0)
1115  {
1117 
1118  if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
1119  {
1120  SHELL32_GetFSItemAttributes(this, rpidl, rgfInOut);
1121  }
1122  else if (_ILIsDrive(rpidl))
1123  {
1124  IShellFolder *psfParent = NULL;
1126  if(SUCCEEDED(hr))
1127  {
1128  hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut);
1129  psfParent->Release();
1130  }
1131  }
1132  else
1133  {
1134  ERR("Got and unknown pidl!\n");
1135  }
1136  }
1137  else
1138  {
1139  while (cidl > 0 && *apidl)
1140  {
1141  pdump(*apidl);
1142  if(_ILIsFolder(*apidl) || _ILIsValue(*apidl))
1143  SHELL32_GetFSItemAttributes(this, *apidl, rgfInOut);
1144  else
1145  ERR("Got an unknown type of pidl!!!\n");
1146  apidl++;
1147  cidl--;
1148  }
1149  }
1150  /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
1151  *rgfInOut &= ~SFGAO_VALIDATE;
1152 
1153  TRACE("-- result=0x%08x\n", *rgfInOut);
1154 
1155  return hr;
1156 }
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:599

◆ GetClassID()

HRESULT WINAPI CFSFolder::GetClassID ( CLSID lpClassId)
virtual

Implements IPersist.

Definition at line 1565 of file CFSFolder.cpp.

1566 {
1567  TRACE ("(%p)\n", this);
1568 
1569  if (!lpClassId)
1570  return E_POINTER;
1571 
1572  *lpClassId = *m_pclsid;
1573 
1574  return S_OK;
1575 }
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 1612 of file CFSFolder.cpp.

1613 {
1614  TRACE ("(%p)->(%p)\n", this, pidl);
1615 
1616  if (!pidl)
1617  return E_POINTER;
1618 
1619  *pidl = ILClone(m_pidlRoot);
1620  return S_OK;
1621 }
#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 1866 of file CFSFolder.cpp.

1867 {
1868  if (data == NULL)
1869  {
1870  return E_POINTER;
1871  }
1872  if (data->cbSize != sizeof(*data))
1873  {
1874  // NOTE: You have to set the cbData member before SFVM_GET_CUSTOMVIEWINFO call.
1875  return E_INVALIDARG;
1876  }
1877 
1878  data->hbmBack = NULL;
1879  data->clrText = CLR_INVALID;
1880  data->clrTextBack = CLR_INVALID;
1881 
1883 
1884  // does the folder exists?
1886  {
1887  return E_INVALIDARG;
1888  }
1889 
1890  // don't use custom view in network path for security
1892  {
1893  return E_ACCESSDENIED;
1894  }
1895 
1896  // build the ini file path
1898  PathAppend(szIniFile, L"desktop.ini");
1899 
1900  static LPCWSTR TheGUID = L"{BE098140-A513-11D0-A3A4-00C04FD706EC}";
1901  static LPCWSTR Space = L" \t\n\r\f\v";
1902 
1903  // get info from ini file
1904  WCHAR szImage[MAX_PATH], szText[64];
1905 
1906  // load the image
1907  szImage[0] = UNICODE_NULL;
1908  GetPrivateProfileStringW(TheGUID, L"IconArea_Image", L"", szImage, _countof(szImage), szIniFile);
1909  if (szImage[0])
1910  {
1911  StrTrimW(szImage, Space);
1912  if (PathIsRelativeW(szImage))
1913  {
1914  PathAppendW(szPath, szImage);
1915  StringCchCopyW(szImage, _countof(szImage), szPath);
1916  }
1917  data->hbmBack = DoLoadPicture(szImage);
1918  }
1919 
1920  // load the text color
1921  szText[0] = UNICODE_NULL;
1922  GetPrivateProfileStringW(TheGUID, L"IconArea_Text", L"", szText, _countof(szText), szIniFile);
1923  if (szText[0])
1924  {
1925  StrTrimW(szText, Space);
1926 
1927  LPWSTR pchEnd = NULL;
1928  COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
1929 
1930  if (pchEnd && !*pchEnd)
1931  data->clrText = cr;
1932  }
1933 
1934  // load the text background color
1935  szText[0] = UNICODE_NULL;
1936  GetPrivateProfileStringW(TheGUID, L"IconArea_TextBackground", L"", szText, _countof(szText), szIniFile);
1937  if (szText[0])
1938  {
1939  StrTrimW(szText, Space);
1940 
1941  LPWSTR pchEnd = NULL;
1942  COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
1943 
1944  if (pchEnd && !*pchEnd)
1945  data->clrTextBack = cr;
1946  }
1947 
1948  if (data->hbmBack != NULL || data->clrText != CLR_INVALID || data->clrTextBack != CLR_INVALID)
1949  return S_OK;
1950 
1951  return E_FAIL;
1952 }
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
#define L(x)
Definition: ntvdm.h:50
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:1839
#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
#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 1473 of file CFSFolder.cpp.

1475 {
1476  TRACE ("(%p)\n", this);
1477 
1478  if (pSort)
1479  *pSort = 0;
1480  if (pDisplay)
1481  *pDisplay = 0;
1482 
1483  return S_OK;
1484 }
#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 1486 of file CFSFolder.cpp.

1488 {
1489  TRACE ("(%p)\n", this);
1490 
1491  if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
1492  return E_INVALIDARG;
1493 
1494  *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
1495 
1496  return S_OK;
1497 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
static const shvheader GenericSFHeader[]
Definition: CFSFolder.cpp:528
#define S_OK
Definition: intsafe.h:52
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:537

◆ GetDefaultSearchGUID()

HRESULT WINAPI CFSFolder::GetDefaultSearchGUID ( GUID pguid)
virtual

Implements IShellFolder2.

Definition at line 1461 of file CFSFolder.cpp.

1462 {
1463  FIXME ("(%p)\n", this);
1464  return E_NOTIMPL;
1465 }
#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 1499 of file CFSFolder.cpp.

1501 {
1502  FIXME ("(%p)\n", this);
1503 
1504  return E_NOTIMPL;
1505 }
#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 1507 of file CFSFolder.cpp.

1509 {
1510  HRESULT hr = E_FAIL;
1511 
1512  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1513 
1514  if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
1515  return E_INVALIDARG;
1516 
1517  if (!pidl)
1518  {
1519  /* the header titles */
1520  psd->fmt = GenericSFHeader[iColumn].fmt;
1521  psd->cxChar = GenericSFHeader[iColumn].cxChar;
1522  return SHSetStrRet(&psd->str, GenericSFHeader[iColumn].colnameid);
1523  }
1524  else
1525  {
1526  hr = S_OK;
1527  psd->str.uType = STRRET_CSTR;
1528  /* the data from the pidl */
1529  switch (iColumn)
1530  {
1531  case 0: /* name */
1532  hr = GetDisplayNameOf (pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
1533  break;
1534  case 1: /* FIXME: comments */
1535  psd->str.cStr[0] = 0;
1536  break;
1537  case 2: /* type */
1538  _ILGetFileType(pidl, psd->str.cStr, MAX_PATH);
1539  break;
1540  case 3: /* size */
1541  _ILGetFileSize(pidl, psd->str.cStr, MAX_PATH);
1542  break;
1543  case 4: /* date */
1544  _ILGetFileDate(pidl, psd->str.cStr, MAX_PATH);
1545  break;
1546  case 5: /* attributes */
1547  _ILGetFileAttributes(pidl, psd->str.cStr, MAX_PATH);
1548  break;
1549  }
1550  }
1551 
1552  return hr;
1553 }
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:528
#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:1339
void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2522
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:537
UINT uType
Definition: shtypes.idl:93

◆ GetDisplayNameOf()

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

Definition at line 1339 of file CFSFolder.cpp.

1341 {
1342  if (!strRet)
1343  return E_INVALIDARG;
1344 
1345  /* If it is a complex pidl, let the child handle it */
1346  if (!_ILIsPidlSimple (pidl)) /* complex pidl */
1347  {
1348  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
1349  }
1350  else if (pidl && !pidl->mkid.cb) /* empty pidl */
1351  {
1352  /* If it is an empty pidl return only the path of the folder */
1355  m_sPathTarget)
1356  {
1357  return SHSetStrRet(strRet, m_sPathTarget);
1358  }
1359  return E_INVALIDARG;
1360  }
1361 
1362  int len = 0;
1363  LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
1364  if (!pszPath)
1365  return E_OUTOFMEMORY;
1366 
1369  m_sPathTarget)
1370  {
1371  lstrcpynW(pszPath, m_sPathTarget, MAX_PATH);
1372  PathAddBackslashW(pszPath);
1373  len = wcslen(pszPath);
1374  }
1375  _ILSimpleGetTextW(pidl, pszPath + len, MAX_PATH + 1 - len);
1376  if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
1377 
1378  strRet->uType = STRRET_WSTR;
1379  strRet->pOleStr = pszPath;
1380 
1381  TRACE ("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1382  return S_OK;
1383 }
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:1316
#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 1698 of file CFSFolder.cpp.

1699 {
1700  FIXME("(%p)->(%p)\n", this, ppfti);
1701  ZeroMemory(ppfti, sizeof (*ppfti));
1702  return E_NOTIMPL;
1703 }
#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 1181 of file CFSFolder.cpp.

1185 {
1186  LPVOID pObj = NULL;
1188 
1189  TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
1190  this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
1191 
1192  if (ppvOut)
1193  {
1194  *ppvOut = NULL;
1195 
1196  if (cidl == 1 && _ILIsValue(apidl[0]))
1197  {
1198  hr = _CreateExtensionUIObject(apidl[0], riid, ppvOut);
1199  if(hr != S_FALSE)
1200  return hr;
1201  }
1202 
1203  if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1))
1204  {
1205  HKEY hKeys[16];
1206  UINT cKeys = 0;
1207  AddFSClassKeysToArray(apidl[0], hKeys, &cKeys);
1208 
1209  DEFCONTEXTMENU dcm;
1210  dcm.hwnd = hwndOwner;
1211  dcm.pcmcb = this;
1212  dcm.pidlFolder = m_pidlRoot;
1213  dcm.psf = this;
1214  dcm.cidl = cidl;
1215  dcm.apidl = apidl;
1216  dcm.cKeys = cKeys;
1217  dcm.aKeys = hKeys;
1218  dcm.punkAssociationInfo = NULL;
1219  hr = SHCreateDefaultContextMenu (&dcm, riid, &pObj);
1220  }
1221  else if (IsEqualIID (riid, IID_IDataObject))
1222  {
1223  if (cidl >= 1)
1224  {
1225  hr = IDataObject_Constructor (hwndOwner, m_pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
1226  }
1227  else
1228  {
1229  hr = E_INVALIDARG;
1230  }
1231  }
1232  else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
1233  {
1234  if (_ILIsValue(apidl[0]))
1235  hr = _GetIconHandler(apidl[0], riid, (LPVOID*)&pObj);
1236  if (hr != S_OK)
1237  hr = CFSExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
1238  }
1239  else if (IsEqualIID (riid, IID_IDropTarget))
1240  {
1241  /* only interested in attempting to bind to shell folders, not files (except exe), so if we fail, rebind to root */
1242  if (cidl != 1 || FAILED(hr = this->_GetDropTarget(apidl[0], (LPVOID*) &pObj)))
1243  {
1245  }
1246  }
1247  else
1248  hr = E_NOINTERFACE;
1249 
1250  if (SUCCEEDED(hr) && !pObj)
1251  hr = E_OUTOFMEMORY;
1252 
1253  *ppvOut = pObj;
1254  }
1255  TRACE("(%p)->hr=0x%08x\n", this, hr);
1256  return hr;
1257 }
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:2396
#define TRUE
Definition: types.h:120
REFIID riid
Definition: precomp.h:44
HRESULT _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1728
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
IContextMenuCB * pcmcb
Definition: shlobj.h:2389
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:414
const GUID IID_IDataObject
IShellFolder * psf
Definition: shlobj.h:2391
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT CFSExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID iid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:240
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:1756
#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:2394
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2393
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2390
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
HRESULT _CreateExtensionUIObject(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1705

◆ 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 1583 of file CFSFolder.cpp.

1584 {
1585  WCHAR wszTemp[MAX_PATH];
1586 
1587  TRACE ("(%p)->(%p)\n", this, pidl);
1588 
1589  SHFree(m_pidlRoot); /* free the old pidl */
1590  m_pidlRoot = ILClone (pidl); /* set my pidl */
1591 
1593  m_sPathTarget = NULL;
1594 
1595  /* set my path */
1596  if (SHGetPathFromIDListW (pidl, wszTemp))
1597  {
1598  int len = wcslen(wszTemp);
1599  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1600  if (!m_sPathTarget)
1601  return E_OUTOFMEMORY;
1602  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1603  }
1604 
1605  TRACE ("--(%p)->(%s)\n", this, debugstr_w(m_sPathTarget));
1606  return S_OK;
1607 }
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:326
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304

◆ InitializeEx()

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

Definition at line 1628 of file CFSFolder.cpp.

1630 {
1631  WCHAR wszTemp[MAX_PATH];
1632 
1633  TRACE("(%p)->(%p,%p,%p)\n", this, pbc, pidlRootx, ppfti);
1634  if (ppfti)
1635  TRACE("--%p %s %s 0x%08x 0x%08x\n",
1636  ppfti->pidlTargetFolder, debugstr_w (ppfti->szTargetParsingName),
1637  debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes,
1638  ppfti->csidl);
1639 
1640  pdump (pidlRootx);
1641  if (ppfti && ppfti->pidlTargetFolder)
1642  pdump(ppfti->pidlTargetFolder);
1643 
1644  if (m_pidlRoot)
1645  __SHFreeAndNil(&m_pidlRoot); /* free the old */
1646  if (m_sPathTarget)
1648 
1649  /*
1650  * Root path and pidl
1651  */
1652  m_pidlRoot = ILClone(pidlRootx);
1653 
1654  /*
1655  * the target folder is spezified in csidl OR pidlTargetFolder OR
1656  * szTargetParsingName
1657  */
1658  if (ppfti)
1659  {
1660  if (ppfti->csidl != -1)
1661  {
1662  if (SHGetSpecialFolderPathW(0, wszTemp, ppfti->csidl,
1663  ppfti->csidl & CSIDL_FLAG_CREATE)) {
1664  int len = wcslen(wszTemp);
1665  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1666  if (!m_sPathTarget)
1667  return E_OUTOFMEMORY;
1668  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1669  }
1670  }
1671  else if (ppfti->szTargetParsingName[0])
1672  {
1673  int len = wcslen(ppfti->szTargetParsingName);
1674  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1675  if (!m_sPathTarget)
1676  return E_OUTOFMEMORY;
1677  memcpy(m_sPathTarget, ppfti->szTargetParsingName,
1678  (len + 1) * sizeof(WCHAR));
1679  }
1680  else if (ppfti->pidlTargetFolder)
1681  {
1682  if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp))
1683  {
1684  int len = wcslen(wszTemp);
1685  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1686  if (!m_sPathTarget)
1687  return E_OUTOFMEMORY;
1688  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1689  }
1690  }
1691  }
1692 
1693  TRACE("--(%p)->(target=%s)\n", this, debugstr_w(m_sPathTarget));
1694  pdump(m_pidlRoot);
1695  return (m_sPathTarget) ? S_OK : E_FAIL;
1696 }
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:2851
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:304

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1555 of file CFSFolder.cpp.

1557 {
1558  FIXME ("(%p)\n", this);
1559  return E_NOTIMPL;
1560 }
#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 1954 of file CFSFolder.cpp.

1955 {
1956  HRESULT hr = E_NOTIMPL;
1957  switch (uMsg)
1958  {
1961  break;
1962  }
1963  return hr;
1964 }
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:1866

◆ ParseDisplayName()

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

Definition at line 730 of file CFSFolder.cpp.

735 {
737  LPCWSTR szNext = NULL;
740  LPITEMIDLIST pidlTemp = NULL;
741  DWORD len;
742 
743  TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
744  this, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
745  pchEaten, ppidl, pdwAttributes);
746 
747  if (!ppidl)
748  return E_INVALIDARG;
749 
750  if (!lpszDisplayName)
751  {
752  *ppidl = NULL;
753  return E_INVALIDARG;
754  }
755 
756  *ppidl = NULL;
757 
758  if (pchEaten)
759  *pchEaten = 0; /* strange but like the original */
760 
761  if (*lpszDisplayName)
762  {
763  /* get the next element */
764  szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
765 
766  pidlTemp = SHELL32_CreatePidlFromBindCtx(pbc, szElement);
767  if (pidlTemp != NULL)
768  {
769  /* We are creating an id list without ensuring that the items exist.
770  If we have a remaining path, this must be a folder.
771  We have to do it now because it is set as a file by default */
772  if (szNext)
773  {
774  pidlTemp->mkid.abID[0] = PT_FOLDER;
775  }
776  hr = S_OK;
777  }
778  else
779  {
780  /* build the full pathname to the element */
783  len = wcslen(szPath);
785 
786  /* get the pidl */
787  hr = _ILCreateFromPathW(szPath, &pidlTemp);
788  }
789 
790  if (SUCCEEDED(hr))
791  {
792  if (szNext && *szNext)
793  {
794  /* try to analyse the next element */
795  hr = SHELL32_ParseNextElement(this, hwndOwner, pbc,
796  &pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
797  }
798  else
799  {
800  /* it's the last element */
801  if (pdwAttributes && *pdwAttributes)
802  hr = SHELL32_GetFSItemAttributes(this, pidlTemp, pdwAttributes);
803  }
804  }
805  }
806 
807  if (SUCCEEDED(hr))
808  *ppidl = pidlTemp;
809  else
810  *ppidl = NULL;
811 
812  TRACE("(%p)->(-- pidl=%p ret=0x%08x)\n", this, ppidl ? *ppidl : 0, hr);
813 
814  return hr;
815 }
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:546
#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:599

◆ SetNameOf()

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

Implements IShellFolder.

Definition at line 1397 of file CFSFolder.cpp.

1403 {
1404  WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1];
1405  BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
1406 
1407  TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this, hwndOwner, pidl,
1408  debugstr_w (lpName), dwFlags, pPidlOut);
1409 
1410  FileStructW* pDataW = _ILGetFileStructW(pidl);
1411  if (!pDataW)
1412  {
1413  ERR("Got garbage pidl\n");
1414  return E_INVALIDARG;
1415  }
1416 
1417  /* build source path */
1418  PathCombineW(szSrc, m_sPathTarget, pDataW->wszName);
1419 
1420  /* build destination path */
1422  PathCombineW(szDest, m_sPathTarget, lpName);
1423  else
1424  lstrcpynW(szDest, lpName, MAX_PATH);
1425 
1426  if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
1427  WCHAR *ext = PathFindExtensionW(szSrc);
1428  if(*ext != '\0') {
1429  INT len = wcslen(szDest);
1430  lstrcpynW(szDest + len, ext, MAX_PATH - len);
1431  }
1432  }
1433 
1434  TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
1435  if (!wcscmp(szSrc, szDest))
1436  {
1437  /* src and destination is the same */
1438  HRESULT hr = S_OK;
1439  if (pPidlOut)
1440  hr = _ILCreateFromPathW(szDest, pPidlOut);
1441 
1442  return hr;
1443  }
1444 
1445  if (MoveFileW (szSrc, szDest))
1446  {
1447  HRESULT hr = S_OK;
1448 
1449  if (pPidlOut)
1450  hr = _ILCreateFromPathW(szDest, pPidlOut);
1451 
1453  SHCNF_PATHW, szSrc, szDest);
1454 
1455  return hr;
1456  }
1457 
1458  return E_FAIL;
1459 }
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:2770
#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:1272
#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: