ReactOS  0.4.15-dev-4927-gfe8f806
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_PKEYSFGAOMASK 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 1706 of file CFSFolder.cpp.

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

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

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

1758 {
1759  CLSID clsid;
1760  HRESULT hr;
1761 
1762  hr = GetCLSIDForFileType(pidl, L"shellex\\IconHandler", &clsid);
1763  if (hr != S_OK)
1764  return hr;
1765 
1766  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1767  if (FAILED_UNEXPECTEDLY(hr))
1768  return S_FALSE;
1769 
1770  return S_OK;
1771 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1773
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:2187
#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:427
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:177
#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:1976
#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:2361
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:427
#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 1804 of file CFSFolder.cpp.

1805 {
1806  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1807  return S_OK;
1808 
1809  /* no data object means no selection */
1810  if (!pdtobj)
1811  {
1812  if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
1813  {
1815  LPITEMIDLIST pidlParent = ILClone(m_pidlRoot);
1816  ILRemoveLastID(pidlParent);
1817  BOOL bSuccess = SH_ShowPropertiesDialog(m_sPathTarget, pidlParent, &pidlChild);
1818  if (!bSuccess)
1819  ERR("SH_ShowPropertiesDialog failed\n");
1820  ILFree(pidlChild);
1821  ILFree(pidlParent);
1822  }
1823  else if (uMsg == DFM_MERGECONTEXTMENU)
1824  {
1825  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1826  HMENU hpopup = CreatePopupMenu();
1828  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1829  DestroyMenu(hpopup);
1830  }
1831 
1832  return S_OK;
1833  }
1834 
1835  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1836  return S_OK;
1837 
1838  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1839 }
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
#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:490
HMENU hmenu
Definition: shlobj.h:1315
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
#define IDS_PROPERTIES
Definition: resource.h:101
static BOOLEAN bSuccess
Definition: drive.cpp:430
WPARAM wParam
Definition: combotst.c:138
#define MFS_ENABLED
Definition: winuser.h:745
unsigned int BOOL
Definition: ntddk_ex.h:94
#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
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: /* Type */
973  pExtension1 = PathFindExtensionW(pDataW1->wszName);
974  pExtension2 = PathFindExtensionW(pDataW2->wszName);
975  result = wcsicmp(pExtension1, pExtension2);
976  break;
977  case 2: /* Size */
978  if (pData1->u.file.dwFileSize > pData2->u.file.dwFileSize)
979  result = 1;
980  else if (pData1->u.file.dwFileSize < pData2->u.file.dwFileSize)
981  result = -1;
982  else
983  result = 0;
984  break;
985  case 3: /* Modified */
986  result = pData1->u.file.uFileDate - pData2->u.file.uFileDate;
987  if (result == 0)
988  result = pData1->u.file.uFileTime - pData2->u.file.uFileTime;
989  break;
990  case 4: /* Comments */
991  result = 0;
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:2187
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:233
#define E_INVALIDARG
Definition: ddrawi.h:101
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1976
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:256
#define wcsicmp
Definition: compat.h:15
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2361
#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:2606
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:285
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:427
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:3900
#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 1468 of file CFSFolder.cpp.

1469 {
1470  FIXME ("(%p)\n", this);
1471  return E_NOTIMPL;
1472 }
#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:1976
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
SFGAO_PKEYSFGAOMASK typedef ULONG SFGAOF
Definition: shobjidl.idl:220
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:1964
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1985
#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:311
#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 1566 of file CFSFolder.cpp.

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

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

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

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

1489 {
1490  TRACE ("(%p)\n", this);
1491 
1492  if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
1493  return E_INVALIDARG;
1494 
1495  *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
1496 
1497  return S_OK;
1498 }
#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 1462 of file CFSFolder.cpp.

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

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

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

1700 {
1701  FIXME("(%p)->(%p)\n", this, ppfti);
1702  ZeroMemory(ppfti, sizeof (*ppfti));
1703  return E_NOTIMPL;
1704 }
#define ZeroMemory
Definition: winbase.h:1667
#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:1729
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:427
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:1757
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:1985
#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:299
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:1706

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

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

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

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

1957 {
1958  HRESULT hr = E_NOTIMPL;
1959  switch (uMsg)
1960  {
1963  break;
1964  }
1965  return hr;
1966 }
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:1868

◆ 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:88
#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:61
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  pdump_always(pidl);
1415  return E_INVALIDARG;
1416  }
1417 
1418  /* build source path */
1419  PathCombineW(szSrc, m_sPathTarget, pDataW->wszName);
1420 
1421  /* build destination path */
1423  PathCombineW(szDest, m_sPathTarget, lpName);
1424  else
1425  lstrcpynW(szDest, lpName, MAX_PATH);
1426 
1427  if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
1428  WCHAR *ext = PathFindExtensionW(szSrc);
1429  if(*ext != '\0') {
1430  INT len = wcslen(szDest);
1431  lstrcpynW(szDest + len, ext, MAX_PATH - len);
1432  }
1433  }
1434 
1435  TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
1436  if (!wcscmp(szSrc, szDest))
1437  {
1438  /* src and destination is the same */
1439  HRESULT hr = S_OK;
1440  if (pPidlOut)
1441  hr = _ILCreateFromPathW(szDest, pPidlOut);
1442 
1443  return hr;
1444  }
1445 
1446  if (MoveFileW (szSrc, szDest))
1447  {
1448  HRESULT hr = S_OK;
1449 
1450  if (pPidlOut)
1451  hr = _ILCreateFromPathW(szDest, pPidlOut);
1452 
1454  SHCNF_PATHW, szSrc, szDest);
1455 
1456  return hr;
1457  }
1458 
1459  return E_FAIL;
1460 }
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:2773
#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
void pdump_always(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:319
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:1976
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:2361
_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: