ReactOS  0.4.15-dev-2964-ge2a8585
CFSFolder Class Reference

#include <CFSFolder.h>

Inheritance diagram for CFSFolder:
Collaboration diagram for CFSFolder:

Public Member Functions

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

Protected Member Functions

HRESULT WINAPI GetCustomViewInfo (ULONG unknown, SFVM_CUSTOMVIEWINFO_DATA *data)
 

Private Member Functions

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

Private Attributes

const CLSIDm_pclsid
 
LPWSTR m_sPathTarget
 
LPITEMIDLIST m_pidlRoot
 
DWORD m_bGroupPolicyActive
 

Additional Inherited Members

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

Detailed Description

Definition at line 14 of file CFSFolder.h.

Constructor & Destructor Documentation

◆ CFSFolder()

CFSFolder::CFSFolder ( )

Definition at line 518 of file CFSFolder.cpp.

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

◆ ~CFSFolder()

CFSFolder::~CFSFolder ( )

Definition at line 526 of file CFSFolder.cpp.

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

Member Function Documentation

◆ _CreateExtensionUIObject()

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

Definition at line 1686 of file CFSFolder.cpp.

1687 {
1688  static const WCHAR formatW[] = {'S','h','e','l','l','E','x','\\',
1689  '{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-',
1690  '%','0','2','x','%','0','2','x','-','%','0','2','x','%','0','2','x',
1691  '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0};
1692  WCHAR buf[MAX_PATH];
1693 
1694  sprintfW(buf, formatW, riid.Data1, riid.Data2, riid.Data3,
1695  riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3],
1696  riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7]);
1697 
1698  CLSID clsid;
1699  HRESULT hr;
1700 
1701  hr = GetCLSIDForFileType(pidl, buf, &clsid);
1702  if (hr != S_OK)
1703  return hr;
1704 
1705  hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1706  if (FAILED_UNEXPECTEDLY(hr))
1707  return hr;
1708 
1709  return S_OK;
1710 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1756
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
#define MAX_PATH
Definition: compat.h:34
REFCLSID clsid
Definition: msctf.c:82
#define S_OK
Definition: intsafe.h:52
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127
#define sprintfW
Definition: unicode.h:58

Referenced by GetUIObjectOf().

◆ _CreateShellExtInstance()

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

Definition at line 1756 of file CFSFolder.cpp.

1757 {
1758  HRESULT hr;
1759  WCHAR wszPath[MAX_PATH];
1760 
1761  FileStructW* pDataW = _ILGetFileStructW(pidl);
1762  if (!pDataW)
1763  {
1764  ERR("Got garbage pidl\n");
1765  return E_INVALIDARG;
1766  }
1767 
1768  PathCombineW(wszPath, m_sPathTarget, pDataW->wszName);
1769 
1770  CComPtr<IPersistFile> pp;
1772  if (FAILED_UNEXPECTEDLY(hr))
1773  return hr;
1774 
1775  pp->Load(wszPath, 0);
1776 
1777  hr = pp->QueryInterface(riid, ppvOut);
1778  if (hr != S_OK)
1779  {
1780  ERR("Failed to query for interface IID_IShellExtInit hr %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid));
1781  return hr;
1782  }
1783  return hr;
1784 }
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 1712 of file CFSFolder.cpp.

1713 {
1714  HRESULT hr;
1715 
1716  TRACE("CFSFolder::_GetDropTarget entered\n");
1717 
1718  if (_ILIsFolder (pidl))
1719  {
1720  CComPtr<IShellFolder> psfChild;
1721  hr = this->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
1722  if (FAILED_UNEXPECTEDLY(hr))
1723  return hr;
1724 
1725  return psfChild->CreateViewObject(NULL, IID_IDropTarget, ppvOut);
1726  }
1727 
1728  CLSID clsid;
1729  hr = GetCLSIDForFileType(pidl, L"shellex\\DropHandler", &clsid);
1730  if (hr != S_OK)
1731  return hr;
1732 
1733  hr = _CreateShellExtInstance(&clsid, pidl, IID_IDropTarget, ppvOut);
1734  if (FAILED_UNEXPECTEDLY(hr))
1735  return S_FALSE;
1736 
1737  return S_OK;
1738 }
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1756
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
#define S_FALSE
Definition: winerror.h:2357
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:1965
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
virtual HRESULT WINAPI BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:846
REFCLSID clsid
Definition: msctf.c:82
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:52
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127
#define NULL
Definition: types.h:112

Referenced by GetUIObjectOf().

◆ _GetIconHandler()

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

Definition at line 1740 of file CFSFolder.cpp.

1741 {
1742  CLSID clsid;
1743  HRESULT hr;
1744 
1745  hr = GetCLSIDForFileType(pidl, L"shellex\\IconHandler", &clsid);
1746  if (hr != S_OK)
1747  return hr;
1748 
1749  hr = _CreateShellExtInstance(&clsid, pidl, riid, 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:1756
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define S_FALSE
Definition: winerror.h:2357
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:82
REFCLSID clsid
Definition: msctf.c:82
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:52
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127

Referenced by GetUIObjectOf().

◆ BindToObject()

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

Definition at line 846 of file CFSFolder.cpp.

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

Referenced by _GetDropTarget().

◆ BindToStorage()

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

Definition at line 918 of file CFSFolder.cpp.

923 {
924  FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this, pidl, pbcReserved,
925  shdebugstr_guid (&riid), ppvOut);
926 
927  *ppvOut = NULL;
928  return E_NOTIMPL;
929 }
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 1786 of file CFSFolder.cpp.

1787 {
1788  if (uMsg != DFM_MERGECONTEXTMENU && uMsg != DFM_INVOKECOMMAND)
1789  return S_OK;
1790 
1791  /* no data object means no selection */
1792  if (!pdtobj)
1793  {
1794  if (uMsg == DFM_INVOKECOMMAND && wParam == 0)
1795  {
1797  LPITEMIDLIST pidlParent = ILClone(m_pidlRoot);
1798  ILRemoveLastID(pidlParent);
1799  HRESULT hr = SH_ShowPropertiesDialog(m_sPathTarget, pidlParent, &pidlChild);
1800  if (FAILED(hr))
1801  ERR("SH_ShowPropertiesDialog failed\n");
1802  ILFree(pidlChild);
1803  ILFree(pidlParent);
1804  }
1805  else if (uMsg == DFM_MERGECONTEXTMENU)
1806  {
1807  QCMINFO *pqcminfo = (QCMINFO *)lParam;
1808  HMENU hpopup = CreatePopupMenu();
1810  Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu++, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1811  DestroyMenu(hpopup);
1812  }
1813 
1814  return S_OK;
1815  }
1816 
1817  if (uMsg != DFM_INVOKECOMMAND || wParam != DFM_CMD_PROPERTIES)
1818  return S_OK;
1819 
1820  return Shell_DefaultContextMenuCallBack(this, pdtobj);
1821 }
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
UINT idCmdLast
Definition: shlobj.h:1318
#define MFT_STRING
Definition: winuser.h:741
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
ITEMID_CHILD UNALIGNED * PUITEMID_CHILD
Definition: shtypes.idl:68
HRESULT WINAPI Shell_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdtobj)
Definition: shlfolder.cpp:450
HMENU hmenu
Definition: shlobj.h:1315
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:212
#define IDS_PROPERTIES
Definition: resource.h:101
WPARAM wParam
Definition: combotst.c:138
#define MFS_ENABLED
Definition: winuser.h:745
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:189
UINT indexMenu
Definition: shlobj.h:1316
#define MM_ADDSEPARATOR
Definition: shlobj.h:2345
LONG HRESULT
Definition: typedefs.h:79
UINT idCmdFirst
Definition: shlobj.h:1317
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_CMD_PROPERTIES
Definition: shlobj.h:2429
BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, LPCITEMIDLIST pidlFolder, PCUITEMID_CHILD_ARRAY apidl)
Definition: fprop.cpp:83
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139

◆ CompareIDs()

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

Implements IShellFolder.

Definition at line 935 of file CFSFolder.cpp.

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

◆ CreateViewObject()

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

Definition at line 996 of file CFSFolder.cpp.

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

◆ EnumObjects()

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

Definition at line 830 of file CFSFolder.cpp.

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

◆ EnumSearches()

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

Implements IShellFolder2.

Definition at line 1448 of file CFSFolder.cpp.

1449 {
1450  FIXME ("(%p)\n", this);
1451  return E_NOTIMPL;
1452 }
#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 1091 of file CFSFolder.cpp.

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

◆ GetClassID()

HRESULT WINAPI CFSFolder::GetClassID ( CLSID lpClassId)
virtual

Implements IPersist.

Definition at line 1546 of file CFSFolder.cpp.

1547 {
1548  TRACE ("(%p)\n", this);
1549 
1550  if (!lpClassId)
1551  return E_POINTER;
1552 
1553  *lpClassId = *m_pclsid;
1554 
1555  return S_OK;
1556 }
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 1593 of file CFSFolder.cpp.

1594 {
1595  TRACE ("(%p)->(%p)\n", this, pidl);
1596 
1597  if (!pidl)
1598  return E_POINTER;
1599 
1600  *pidl = ILClone(m_pidlRoot);
1601  return S_OK;
1602 }
#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 1850 of file CFSFolder.cpp.

1851 {
1852  if (data == NULL)
1853  {
1854  return E_POINTER;
1855  }
1856  if (data->cbSize != sizeof(*data))
1857  {
1858  // NOTE: You have to set the cbData member before SFVM_GET_CUSTOMVIEWINFO call.
1859  return E_INVALIDARG;
1860  }
1861 
1862  data->hbmBack = NULL;
1863  data->clrText = CLR_INVALID;
1864  data->clrTextBack = CLR_INVALID;
1865 
1867 
1868  // does the folder exists?
1870  {
1871  return E_INVALIDARG;
1872  }
1873 
1874  // don't use custom view in network path for security
1876  {
1877  return E_ACCESSDENIED;
1878  }
1879 
1880  // build the ini file path
1882  PathAppend(szIniFile, L"desktop.ini");
1883 
1884  static LPCWSTR TheGUID = L"{BE098140-A513-11D0-A3A4-00C04FD706EC}";
1885  static LPCWSTR Space = L" \t\n\r\f\v";
1886 
1887  // get info from ini file
1888  WCHAR szImage[MAX_PATH], szText[64];
1889 
1890  // load the image
1891  szImage[0] = UNICODE_NULL;
1892  GetPrivateProfileStringW(TheGUID, L"IconArea_Image", L"", szImage, _countof(szImage), szIniFile);
1893  if (szImage[0])
1894  {
1895  StrTrimW(szImage, Space);
1896  if (PathIsRelativeW(szImage))
1897  {
1898  PathAppendW(szPath, szImage);
1899  StringCchCopyW(szImage, _countof(szImage), szPath);
1900  }
1901  data->hbmBack = DoLoadPicture(szImage);
1902  }
1903 
1904  // load the text color
1905  szText[0] = UNICODE_NULL;
1906  GetPrivateProfileStringW(TheGUID, L"IconArea_Text", L"", szText, _countof(szText), szIniFile);
1907  if (szText[0])
1908  {
1909  StrTrimW(szText, Space);
1910 
1911  LPWSTR pchEnd = NULL;
1912  COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
1913 
1914  if (pchEnd && !*pchEnd)
1915  data->clrText = cr;
1916  }
1917 
1918  // load the text background color
1919  szText[0] = UNICODE_NULL;
1920  GetPrivateProfileStringW(TheGUID, L"IconArea_TextBackground", L"", szText, _countof(szText), szIniFile);
1921  if (szText[0])
1922  {
1923  StrTrimW(szText, Space);
1924 
1925  LPWSTR pchEnd = NULL;
1926  COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
1927 
1928  if (pchEnd && !*pchEnd)
1929  data->clrTextBack = cr;
1930  }
1931 
1932  if (data->hbmBack != NULL || data->clrText != CLR_INVALID || data->clrTextBack != CLR_INVALID)
1933  return S_OK;
1934 
1935  return E_FAIL;
1936 }
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:882
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define PathIsNetworkPath
Definition: shlwapi.h:1101
#define PathAppend
Definition: shlwapi.h:801
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI PathAppendW(LPWSTR lpszPath, LPCWSTR lpszAppend)
Definition: path.c:126
TCHAR szIniFile[]
Definition: scrnsave.c:28
#define UNICODE_NULL
static const WCHAR szText[]
Definition: dialog.c:139
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
static HBITMAP DoLoadPicture(LPCWSTR pszFileName)
Definition: CFSFolder.cpp:1823
#define E_INVALIDARG
Definition: ddrawi.h:101
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD COLORREF
Definition: windef.h:300
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static const WCHAR L[]
Definition: oid.c:1250
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1869
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define E_POINTER
Definition: winerror.h:2365

Referenced by MessageSFVCB().

◆ GetDefaultColumn()

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

Implements IShellFolder2.

Definition at line 1454 of file CFSFolder.cpp.

1456 {
1457  TRACE ("(%p)\n", this);
1458 
1459  if (pSort)
1460  *pSort = 0;
1461  if (pDisplay)
1462  *pDisplay = 0;
1463 
1464  return S_OK;
1465 }
#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 1467 of file CFSFolder.cpp.

1469 {
1470  TRACE ("(%p)\n", this);
1471 
1472  if (!pcsFlags || iColumn >= GENERICSHELLVIEWCOLUMNS)
1473  return E_INVALIDARG;
1474 
1475  *pcsFlags = GenericSFHeader[iColumn].pcsFlags;
1476 
1477  return S_OK;
1478 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
static const shvheader GenericSFHeader[]
Definition: CFSFolder.cpp:535
#define S_OK
Definition: intsafe.h:52
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:544

◆ GetDefaultSearchGUID()

HRESULT WINAPI CFSFolder::GetDefaultSearchGUID ( GUID pguid)
virtual

Implements IShellFolder2.

Definition at line 1442 of file CFSFolder.cpp.

1443 {
1444  FIXME ("(%p)\n", this);
1445  return E_NOTIMPL;
1446 }
#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 1480 of file CFSFolder.cpp.

1482 {
1483  FIXME ("(%p)\n", this);
1484 
1485  return E_NOTIMPL;
1486 }
#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 1488 of file CFSFolder.cpp.

1490 {
1491  HRESULT hr = E_FAIL;
1492 
1493  TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1494 
1495  if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
1496  return E_INVALIDARG;
1497 
1498  if (!pidl)
1499  {
1500  /* the header titles */
1501  psd->fmt = GenericSFHeader[iColumn].fmt;
1502  psd->cxChar = GenericSFHeader[iColumn].cxChar;
1503  return SHSetStrRet(&psd->str, GenericSFHeader[iColumn].colnameid);
1504  }
1505  else
1506  {
1507  hr = S_OK;
1508  psd->str.uType = STRRET_CSTR;
1509  /* the data from the pidl */
1510  switch (iColumn)
1511  {
1512  case 0: /* name */
1513  hr = GetDisplayNameOf (pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
1514  break;
1515  case 1: /* FIXME: comments */
1516  psd->str.cStr[0] = 0;
1517  break;
1518  case 2: /* type */
1519  _ILGetFileType(pidl, psd->str.cStr, MAX_PATH);
1520  break;
1521  case 3: /* size */
1522  _ILGetFileSize(pidl, psd->str.cStr, MAX_PATH);
1523  break;
1524  case 4: /* date */
1525  _ILGetFileDate(pidl, psd->str.cStr, MAX_PATH);
1526  break;
1527  case 5: /* attributes */
1528  _ILGetFileAttributes(pidl, psd->str.cStr, MAX_PATH);
1529  break;
1530  }
1531  }
1532 
1533  return hr;
1534 }
DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2595
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
STRRET str
Definition: shtypes.idl:108
char cStr[MAX_PATH]
Definition: shtypes.idl:98
#define E_INVALIDARG
Definition: ddrawi.h:101
DWORD _ILGetFileSize(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2455
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define MAX_PATH
Definition: compat.h:34
static const shvheader GenericSFHeader[]
Definition: CFSFolder.cpp:535
#define S_OK
Definition: intsafe.h:52
BOOL _ILGetFileDate(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2411
virtual HRESULT WINAPI GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: CFSFolder.cpp:1320
void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
Definition: pidl.c:2522
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:544
UINT uType
Definition: shtypes.idl:93

◆ GetDisplayNameOf()

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

Definition at line 1320 of file CFSFolder.cpp.

1322 {
1323  if (!strRet)
1324  return E_INVALIDARG;
1325 
1326  /* If it is a complex pidl, let the child handle it */
1327  if (!_ILIsPidlSimple (pidl)) /* complex pidl */
1328  {
1329  return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
1330  }
1331  else if (pidl && !pidl->mkid.cb) /* empty pidl */
1332  {
1333  /* If it is an empty pidl return only the path of the folder */
1336  m_sPathTarget)
1337  {
1338  return SHSetStrRet(strRet, m_sPathTarget);
1339  }
1340  return E_INVALIDARG;
1341  }
1342 
1343  int len = 0;
1344  LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
1345  if (!pszPath)
1346  return E_OUTOFMEMORY;
1347 
1350  m_sPathTarget)
1351  {
1352  lstrcpynW(pszPath, m_sPathTarget, MAX_PATH);
1353  PathAddBackslashW(pszPath);
1354  len = wcslen(pszPath);
1355  }
1356  _ILSimpleGetTextW(pidl, pszPath + len, MAX_PATH + 1 - len);
1357  if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
1358 
1359  strRet->uType = STRRET_WSTR;
1360  strRet->pOleStr = pszPath;
1361 
1362  TRACE ("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1363  return S_OK;
1364 }
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:1297
#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 1679 of file CFSFolder.cpp.

1680 {
1681  FIXME("(%p)->(%p)\n", this, ppfti);
1682  ZeroMemory(ppfti, sizeof (*ppfti));
1683  return E_NOTIMPL;
1684 }
#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 1171 of file CFSFolder.cpp.

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

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

1565 {
1566  WCHAR wszTemp[MAX_PATH];
1567 
1568  TRACE ("(%p)->(%p)\n", this, pidl);
1569 
1570  SHFree(m_pidlRoot); /* free the old pidl */
1571  m_pidlRoot = ILClone (pidl); /* set my pidl */
1572 
1574  m_sPathTarget = NULL;
1575 
1576  /* set my path */
1577  if (SHGetPathFromIDListW (pidl, wszTemp))
1578  {
1579  int len = wcslen(wszTemp);
1580  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1581  if (!m_sPathTarget)
1582  return E_OUTOFMEMORY;
1583  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1584  }
1585 
1586  TRACE ("--(%p)->(%s)\n", this, debugstr_w(m_sPathTarget));
1587  return S_OK;
1588 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

◆ InitializeEx()

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

Definition at line 1609 of file CFSFolder.cpp.

1611 {
1612  WCHAR wszTemp[MAX_PATH];
1613 
1614  TRACE("(%p)->(%p,%p,%p)\n", this, pbc, pidlRootx, ppfti);
1615  if (ppfti)
1616  TRACE("--%p %s %s 0x%08x 0x%08x\n",
1617  ppfti->pidlTargetFolder, debugstr_w (ppfti->szTargetParsingName),
1618  debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes,
1619  ppfti->csidl);
1620 
1621  pdump (pidlRootx);
1622  if (ppfti && ppfti->pidlTargetFolder)
1623  pdump(ppfti->pidlTargetFolder);
1624 
1625  if (m_pidlRoot)
1626  __SHFreeAndNil(&m_pidlRoot); /* free the old */
1627  if (m_sPathTarget)
1629 
1630  /*
1631  * Root path and pidl
1632  */
1633  m_pidlRoot = ILClone(pidlRootx);
1634 
1635  /*
1636  * the target folder is spezified in csidl OR pidlTargetFolder OR
1637  * szTargetParsingName
1638  */
1639  if (ppfti)
1640  {
1641  if (ppfti->csidl != -1)
1642  {
1643  if (SHGetSpecialFolderPathW(0, wszTemp, ppfti->csidl,
1644  ppfti->csidl & CSIDL_FLAG_CREATE)) {
1645  int len = wcslen(wszTemp);
1646  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1647  if (!m_sPathTarget)
1648  return E_OUTOFMEMORY;
1649  memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1650  }
1651  }
1652  else if (ppfti->szTargetParsingName[0])
1653  {
1654  int len = wcslen(ppfti->szTargetParsingName);
1655  m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1656  if (!m_sPathTarget)
1657  return E_OUTOFMEMORY;
1658  memcpy(m_sPathTarget, ppfti->szTargetParsingName,
1659  (len + 1) * sizeof(WCHAR));
1660  }
1661  else if (ppfti->pidlTargetFolder)
1662  {
1663  if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp))
1664  {
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  }
1673 
1674  TRACE("--(%p)->(target=%s)\n", this, debugstr_w(m_sPathTarget));
1675  pdump(m_pidlRoot);
1676  return (m_sPathTarget) ? S_OK : E_FAIL;
1677 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1294
#define E_FAIL
Definition: ddrawi.h:102
#define __SHFreeAndNil(ptr)
Definition: shell32_main.h:136
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2948
LPITEMIDLIST m_pidlRoot
Definition: CFSFolder.h:29
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248
#define CSIDL_FLAG_CREATE
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1536 of file CFSFolder.cpp.

1538 {
1539  FIXME ("(%p)\n", this);
1540  return E_NOTIMPL;
1541 }
#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 1938 of file CFSFolder.cpp.

1939 {
1940  HRESULT hr = E_NOTIMPL;
1941  switch (uMsg)
1942  {
1945  break;
1946  }
1947  return hr;
1948 }
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:1850

◆ ParseDisplayName()

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

Definition at line 736 of file CFSFolder.cpp.

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

◆ SetNameOf()

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

Implements IShellFolder.

Definition at line 1378 of file CFSFolder.cpp.

1384 {
1385  WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1];
1386  BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
1387 
1388  TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this, hwndOwner, pidl,
1389  debugstr_w (lpName), dwFlags, pPidlOut);
1390 
1391  FileStructW* pDataW = _ILGetFileStructW(pidl);
1392  if (!pDataW)
1393  {
1394  ERR("Got garbage pidl\n");
1395  return E_INVALIDARG;
1396  }
1397 
1398  /* build source path */
1399  PathCombineW(szSrc, m_sPathTarget, pDataW->wszName);
1400 
1401  /* build destination path */
1403  PathCombineW(szDest, m_sPathTarget, lpName);
1404  else
1405  lstrcpynW(szDest, lpName, MAX_PATH);
1406 
1407  if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
1408  WCHAR *ext = PathFindExtensionW(szSrc);
1409  if(*ext != '\0') {
1410  INT len = wcslen(szDest);
1411  lstrcpynW(szDest + len, ext, MAX_PATH - len);
1412  }
1413  }
1414 
1415  TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
1416  if (!wcscmp(szSrc, szDest))
1417  {
1418  /* src and destination is the same */
1419  HRESULT hr = S_OK;
1420  if (pPidlOut)
1421  hr = _ILCreateFromPathW(szDest, pPidlOut);
1422 
1423  return hr;
1424  }
1425 
1426  if (MoveFileW (szSrc, szDest))
1427  {
1428  HRESULT hr = S_OK;
1429 
1430  if (pPidlOut)
1431  hr = _ILCreateFromPathW(szDest, pPidlOut);
1432 
1434  SHCNF_PATHW, szSrc, szDest);
1435 
1436  return hr;
1437  }
1438 
1439  return E_FAIL;
1440 }
LPWSTR m_sPathTarget
Definition: CFSFolder.h:27
HRESULT hr
Definition: shlfolder.c:183
WCHAR wszName[1]
Definition: shlfolder.c:1555
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1746
_In_ LPCSTR lpName
Definition: winbase.h:2768
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1729
#define E_FAIL
Definition: ddrawi.h:102
int32_t INT
Definition: typedefs.h:58
#define lstrcpynW
Definition: compat.h:597
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL SHELL_FS_HideExtension(LPWSTR szPath)
Definition: CFSFolder.cpp:1266
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
#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: