ReactOS 0.4.15-dev-8408-g466a198
CFSFolder Class Reference

#include <CFSFolder.h>

Inheritance diagram for CFSFolder:
Collaboration diagram for CFSFolder:

Public Member Functions

 CFSFolder ()
 
 ~CFSFolder ()
 
STDMETHOD() ParseDisplayName (HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName, DWORD *pchEaten, PIDLIST_RELATIVE *ppidl, DWORD *pdwAttributes) override
 
STDMETHOD() EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *ppEnumIDList) override
 
STDMETHOD() BindToObject (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() BindToStorage (PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() CompareIDs (LPARAM lParam, PCUIDLIST_RELATIVE pidl1, PCUIDLIST_RELATIVE pidl2) override
 
STDMETHOD() CreateViewObject (HWND hwndOwner, REFIID riid, LPVOID *ppvOut) override
 
STDMETHOD() GetAttributesOf (UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
 
STDMETHOD() GetUIObjectOf (HWND hwndOwner, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, REFIID riid, UINT *prgfInOut, LPVOID *ppvOut) override
 
STDMETHOD() GetDisplayNameOf (PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
 
STDMETHOD() SetNameOf (HWND hwndOwner, PCUITEMID_CHILD pidl, LPCOLESTR lpName, DWORD dwFlags, PITEMID_CHILD *pPidlOut) override
 
STDMETHOD() GetDefaultSearchGUID (GUID *pguid) override
 
STDMETHOD() EnumSearches (IEnumExtraSearch **ppenum) override
 
STDMETHOD() GetDefaultColumn (DWORD dwRes, ULONG *pSort, ULONG *pDisplay) override
 
STDMETHOD() GetDefaultColumnState (UINT iColumn, DWORD *pcsFlags) override
 
STDMETHOD() GetDetailsEx (PCUITEMID_CHILD pidl, const SHCOLUMNID *pscid, VARIANT *pv) override
 
STDMETHOD() GetDetailsOf (PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *psd) override
 
STDMETHOD() MapColumnToSCID (UINT column, SHCOLUMNID *pscid) override
 
STDMETHOD() GetClassID (CLSID *lpClassId) override
 
STDMETHOD() Initialize (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHOD() GetCurFolder (PIDLIST_ABSOLUTE *pidl) override
 
STDMETHOD() InitializeEx (IBindCtx *pbc, LPCITEMIDLIST pidlRoot, const PERSIST_FOLDER_TARGET_INFO *ppfti) override
 
STDMETHOD() GetFolderTargetInfo (PERSIST_FOLDER_TARGET_INFO *ppfti) override
 
STDMETHOD() CallBack (IShellFolder *psf, HWND hwndOwner, IDataObject *pdtobj, UINT uMsg, WPARAM wParam, LPARAM lParam) override
 
STDMETHOD() MessageSFVCB (UINT uMsg, WPARAM wParam, LPARAM lParam) override
 
STDMETHODIMP GetMaxLength (LPCWSTR pszName, int *piMaxNameLen) override
 
STDMETHODIMP GetValidCharacters (LPWSTR *ppwszValidChars, LPWSTR *ppwszInvalidChars) override
 
- 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 ()
 
HRESULT GetDefaultSearchGUID ([out] GUID *lpguid)
 
HRESULT EnumSearches ([out] IEnumExtraSearch **ppenum)
 
HRESULT GetDefaultColumn ([in] DWORD dwReserved, [out] ULONG *pSort, [out] ULONG *pDisplay)
 
HRESULT GetDefaultColumnState ([in] UINT iColumn, [out] SHCOLSTATEF *pcsFlags)
 
HRESULT GetDetailsEx ([in] PCUITEMID_CHILD pidl, [in] const SHCOLUMNID *pscid, [out] VARIANT *pv)
 
HRESULT GetDetailsOf ([in] PCUITEMID_CHILD pidl, [in] UINT iColumn, [out] SHELLDETAILS *psd)
 
HRESULT MapColumnToSCID ([in] UINT iColumn, [in] SHCOLUMNID *pscid)
 
- 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 CompareIDs ([in] LPARAM lParam, [in] PCUIDLIST_RELATIVE pidl1, [in] PCUIDLIST_RELATIVE pidl2)
 
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)
 
HRESULT SetNameOf ([in] HWND hwnd, [in] PCUITEMID_CHILD pidl, [in, string] LPCOLESTR lpszName, [in] SHGDNF uFlags, [out] PITEMID_CHILD *ppidlOut)
 
- 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)
 
HRESULT GetFolderTargetInfo ([out] PERSIST_FOLDER_TARGET_INFO *ppfti)
 
HRESULT GetCurFolder ([out] PIDLIST_ABSOLUTE *ppidl)
 
HRESULT Initialize ([in] PCIDLIST_ABSOLUTE pidl)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 
HRESULT CallBack ([in] IShellFolder *psf, [in] HWND hwndOwner, [in] IDataObject *pdtobj, [in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 

Static Public Member Functions

static HRESULT GetFSColumnDetails (UINT iColumn, SHELLDETAILS &sd)
 
static HRESULT GetDefaultFSColumnState (UINT iColumn, SHCOLSTATEF &csFlags)
 
- 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)
 

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)
 
HRESULT _ParseSimple (_In_ LPOLESTR lpszDisplayName, _Inout_ WIN32_FIND_DATAW *pFind, _Out_ LPITEMIDLIST *ppidl)
 
BOOL _GetFindDataFromName (_In_ LPCWSTR pszName, _Out_ WIN32_FIND_DATAW *pFind)
 
HRESULT _CreateIDListFromName (LPCWSTR pszName, DWORD attrs, IBindCtx *pbc, LPITEMIDLIST *ppidl)
 

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
 
typedef ULONG SFGAOF
 
- 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
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Detailed Description

Definition at line 14 of file CFSFolder.h.

Constructor & Destructor Documentation

◆ CFSFolder()

CFSFolder::CFSFolder ( )

Definition at line 514 of file CFSFolder.cpp.

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

◆ ~CFSFolder()

CFSFolder::~CFSFolder ( )

Definition at line 522 of file CFSFolder.cpp.

523{
524 TRACE("-- destroying IShellFolder(%p)\n", this);
525
528}
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
#define TRACE(s)
Definition: solgame.cpp:4

Member Function Documentation

◆ _CreateExtensionUIObject()

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

Definition at line 1776 of file CFSFolder.cpp.

1777{
1779
1780 sprintfW(buf, L"ShellEx\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
1781 riid.Data1, riid.Data2, riid.Data3,
1782 riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3],
1783 riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7]);
1784
1785 CLSID clsid;
1786 HRESULT hr;
1787
1788 hr = GetCLSIDForFileType(pidl, buf, &clsid);
1789 if (hr != S_OK)
1790 return hr;
1791
1792 hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1794 return hr;
1795
1796 return S_OK;
1797}
HRESULT _CreateShellExtInstance(const CLSID *pclsid, LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1843
#define MAX_PATH
Definition: compat.h:34
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID *pclsid)
Definition: CFSFolder.cpp:127
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
REFCLSID clsid
Definition: msctf.c:82
#define L(x)
Definition: ntvdm.h:50
#define sprintfW
Definition: unicode.h:64
HRESULT hr
Definition: shlfolder.c:183
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by GetUIObjectOf().

◆ _CreateIDListFromName()

HRESULT CFSFolder::_CreateIDListFromName ( LPCWSTR  pszName,
DWORD  attrs,
IBindCtx pbc,
LPITEMIDLIST ppidl 
)
private

Definition at line 742 of file CFSFolder.cpp.

743{
744 *ppidl = NULL;
745
746 if (PathIsDosDevice(pszName))
748
749 WIN32_FIND_DATAW FindData = { 0 };
750
751 HRESULT hr = S_OK;
752 if (attrs == ULONG_MAX) // Invalid attributes
753 {
754 if (!_GetFindDataFromName(pszName, &FindData))
756 }
757 else // Pretend as an item of attrs
758 {
759 StringCchCopyW(FindData.cFileName, _countof(FindData.cFileName), pszName);
760 FindData.dwFileAttributes = attrs;
761 }
762
763 if (FAILED(hr))
764 return hr;
765
766 *ppidl = _ILCreateFromFindDataW(&FindData);
767 if (!*ppidl)
768 return E_OUTOFMEMORY;
769
770 return S_OK;
771}
BOOL _GetFindDataFromName(_In_ LPCWSTR pszName, _Out_ WIN32_FIND_DATAW *pFind)
Definition: CFSFolder.cpp:728
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
BOOL PathIsDosDevice(_In_ LPCWSTR pszName)
Definition: utils.cpp:52
#define ULONG_MAX
Definition: limits.h:44
#define FAILED(hr)
Definition: intsafe.h:51
LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *wfd)
Definition: pidl.c:1782
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_BAD_DEVICE
Definition: winerror.h:703

Referenced by ParseDisplayName().

◆ _CreateShellExtInstance()

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

Definition at line 1843 of file CFSFolder.cpp.

1844{
1845 HRESULT hr;
1846 WCHAR wszPath[MAX_PATH];
1847
1848 FileStructW* pDataW = _ILGetFileStructW(pidl);
1849 if (!pDataW)
1850 {
1851 ERR("Got garbage pidl\n");
1852 pdump_always(pidl);
1853 return E_INVALIDARG;
1854 }
1855
1856 PathCombineW(wszPath, m_sPathTarget, pDataW->wszName);
1857
1858 CComPtr<IPersistFile> pp;
1861 return hr;
1862
1863 pp->Load(wszPath, 0);
1864
1865 hr = pp->QueryInterface(riid, ppvOut);
1866 if (hr != S_OK)
1867 {
1868 ERR("Failed to query for interface IID_IShellExtInit hr %x pclsid %s\n", hr, wine_dbgstr_guid(pclsid));
1869 return hr;
1870 }
1871 return hr;
1872}
#define ERR(fmt,...)
Definition: precomp.h:57
#define E_INVALIDARG
Definition: ddrawi.h:101
void pdump_always(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:319
HRESULT WINAPI SHCoCreateInstance(LPCWSTR aclsid, const CLSID *clsid, LPUNKNOWN pUnkOuter, REFIID refiid, LPVOID *ppv)
Definition: shellole.c:105
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define PathCombineW
Definition: pathcch.h:317
FileStructW * _ILGetFileStructW(LPCITEMIDLIST pidl)
Definition: pidl.c:2328
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
WCHAR wszName[1]
Definition: shlfolder.c:1555
#define IID_PPV_ARG(Itype, ppType)

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

◆ _GetDropTarget()

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

Definition at line 1799 of file CFSFolder.cpp.

1800{
1801 HRESULT hr;
1802
1803 TRACE("CFSFolder::_GetDropTarget entered\n");
1804
1805 if (_ILIsFolder (pidl))
1806 {
1807 CComPtr<IShellFolder> psfChild;
1808 hr = this->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &psfChild));
1810 return hr;
1811
1812 return psfChild->CreateViewObject(NULL, IID_IDropTarget, ppvOut);
1813 }
1814
1815 CLSID clsid;
1816 hr = GetCLSIDForFileType(pidl, L"shellex\\DropHandler", &clsid);
1817 if (hr != S_OK)
1818 return hr;
1819
1820 hr = _CreateShellExtInstance(&clsid, pidl, IID_IDropTarget, ppvOut);
1822 return S_FALSE;
1823
1824 return S_OK;
1825}
STDMETHOD() BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbcReserved, REFIID riid, LPVOID *ppvOut) override
Definition: CFSFolder.cpp:918
BOOL _ILIsFolder(LPCITEMIDLIST pidl)
Definition: pidl.c:2015
#define S_FALSE
Definition: winerror.h:2357

Referenced by GetUIObjectOf().

◆ _GetFindDataFromName()

BOOL CFSFolder::_GetFindDataFromName ( _In_ LPCWSTR  pszName,
_Out_ WIN32_FIND_DATAW pFind 
)
private

Definition at line 728 of file CFSFolder.cpp.

729{
732 PathAppendW(szPath, pszName);
733
734 HANDLE hFind = ::FindFirstFileW(szPath, pFind);
735 if (hFind == INVALID_HANDLE_VALUE)
736 return FALSE;
737
738 ::FindClose(hFind);
739 return TRUE;
740}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define lstrcpynW
Definition: compat.h:738
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
LPCWSTR szPath
Definition: env.c:37
#define PathAppendW
Definition: pathcch.h:309

Referenced by _CreateIDListFromName(), and ParseDisplayName().

◆ _GetIconHandler()

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

Definition at line 1827 of file CFSFolder.cpp.

1828{
1829 CLSID clsid;
1830 HRESULT hr;
1831
1832 hr = GetCLSIDForFileType(pidl, L"shellex\\IconHandler", &clsid);
1833 if (hr != S_OK)
1834 return hr;
1835
1836 hr = _CreateShellExtInstance(&clsid, pidl, riid, ppvOut);
1838 return S_FALSE;
1839
1840 return S_OK;
1841}

Referenced by GetUIObjectOf().

◆ _ParseSimple()

HRESULT CFSFolder::_ParseSimple ( _In_ LPOLESTR  lpszDisplayName,
_Inout_ WIN32_FIND_DATAW pFind,
_Out_ LPITEMIDLIST ppidl 
)
private

Definition at line 687 of file CFSFolder.cpp.

691{
692 HRESULT hr;
693 LPWSTR pchNext = lpszDisplayName;
694
695 *ppidl = NULL;
696
697 const DWORD finalattr = pFind->dwFileAttributes;
698 const DWORD finalsizelo = pFind->nFileSizeLow;
699 LPITEMIDLIST pidl;
700 for (hr = S_OK; SUCCEEDED(hr); hr = SHILAppend(pidl, ppidl))
701 {
702 hr = Shell_NextElement(&pchNext, pFind->cFileName, _countof(pFind->cFileName), FALSE);
703 if (hr != S_OK)
704 break;
705
706 pFind->dwFileAttributes = pchNext ? FILE_ATTRIBUTE_DIRECTORY : finalattr;
707 pFind->nFileSizeLow = pchNext ? 0 : finalsizelo;
708 pidl = _ILCreateFromFindDataW(pFind);
709 if (!pidl)
710 {
712 break;
713 }
714 }
715
716 if (SUCCEEDED(hr))
717 return S_OK;
718
719 if (*ppidl)
720 {
721 ILFree(*ppidl);
722 *ppidl = NULL;
723 }
724
725 return hr;
726}
HRESULT SHILAppend(_Inout_ LPITEMIDLIST pidl, _Inout_ LPITEMIDLIST *ppidl)
Definition: utils.cpp:73
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940
HRESULT Shell_NextElement(_Inout_ LPWSTR *ppch, _Out_ LPWSTR pszOut, _In_ INT cchOut, _In_ BOOL bValidate)
Definition: shlfolder.cpp:30
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ParseDisplayName().

◆ BindToObject()

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

Definition at line 918 of file CFSFolder.cpp.

923{
924 TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this, pidl, pbc,
925 shdebugstr_guid(&riid), ppvOut);
926
927 CComPtr<IShellFolder> pSF;
928 HRESULT hr;
929
930 if (!m_pidlRoot || !ppvOut || !pidl || !pidl->mkid.cb)
931 {
932 ERR("CFSFolder::BindToObject: Invalid parameters\n");
933 return E_INVALIDARG;
934 }
935
936 /* Get the pidl data */
937 FileStruct* pData = &_ILGetDataPointer(pidl)->u.file;
938 FileStructW* pDataW = _ILGetFileStructW(pidl);
939
940 if (!pDataW)
941 {
942 ERR("CFSFolder::BindToObject: Invalid pidl!\n");
943 return E_INVALIDARG;
944 }
945
946 *ppvOut = NULL;
947
948 /* Create the target folder info */
949 PERSIST_FOLDER_TARGET_INFO pfti = {0};
950 pfti.dwAttributes = -1;
951 pfti.csidl = -1;
952 PathCombineW(pfti.szTargetParsingName, m_sPathTarget, pDataW->wszName);
953
954 /* Get the CLSID to bind to */
955 CLSID clsidFolder;
956 if (_ILIsFolder(pidl))
957 {
958 if ((pData->uFileAttribs & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
959 {
960 hr = SHELL32_GetCLSIDForDirectory(pfti.szTargetParsingName, L"CLSID", &clsidFolder);
961
962 if (SUCCEEDED(hr))
963 {
964 /* We got a GUID from a desktop.ini, let's try it */
965 hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
966 if (SUCCEEDED(hr))
967 {
968 TRACE("-- returning (%p) %08x, (%s)\n", *ppvOut, hr, wine_dbgstr_guid(&clsidFolder));
969 return hr;
970 }
971
972 /* Something went wrong, re-try it with a normal ShellFSFolder */
973 ERR("CFSFolder::BindToObject: %s failed to bind, using fallback (0x%08x)\n", wine_dbgstr_guid(&clsidFolder), hr);
974 }
975 }
976 /* No system folder or the custom class failed */
977 clsidFolder = CLSID_ShellFSFolder;
978 }
979 else
980 {
981 hr = GetCLSIDForFileType(pidl, L"CLSID", &clsidFolder);
982 if (hr == S_FALSE)
984 if (hr != S_OK)
985 return hr;
986 }
987
988 hr = SHELL32_BindToSF(m_pidlRoot, &pfti, pidl, &clsidFolder, riid, ppvOut);
990 return hr;
991
992 TRACE ("-- returning (%p) %08x\n", *ppvOut, hr);
993
994 return S_OK;
995
996}
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:428
static HRESULT SHELL32_GetCLSIDForDirectory(LPCWSTR pwszDir, LPCWSTR KeyName, CLSID *pclsidFolder)
Definition: CFSFolder.cpp:560
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
LPPIDLDATA _ILGetDataPointer(LPCITEMIDLIST pidl)
Definition: pidl.c:2154
HRESULT SHELL32_BindToSF(LPCITEMIDLIST pidlRoot, PERSIST_FOLDER_TARGET_INFO *ppfti, LPCITEMIDLIST pidl, const GUID *clsid, REFIID riid, LPVOID *ppvOut)
Definition: shlfolder.cpp:168
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830

Referenced by _GetDropTarget(), and ParseDisplayName().

◆ BindToStorage()

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

Definition at line 1006 of file CFSFolder.cpp.

1011{
1012 FIXME("(%p)->(pidl=%p,%p,%s,%p) stub\n", this, pidl, pbcReserved,
1013 shdebugstr_guid (&riid), ppvOut);
1014
1015 *ppvOut = NULL;
1016 return E_NOTIMPL;
1017}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ CallBack()

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

Implements IContextMenuCB.

Definition at line 1874 of file CFSFolder.cpp.

1875{
1876 enum { IDC_PROPERTIES };
1877 /* no data object means no selection */
1878 if (!pdtobj)
1879 {
1880 if (uMsg == DFM_INVOKECOMMAND && wParam == IDC_PROPERTIES)
1881 {
1882 // Create an data object
1883 CComHeapPtr<ITEMID_CHILD> pidlChild(ILClone(ILFindLastID(m_pidlRoot)));
1884 CComHeapPtr<ITEMIDLIST> pidlParent(ILClone(m_pidlRoot));
1885 ILRemoveLastID(pidlParent);
1886
1887 CComPtr<IDataObject> pDataObj;
1888 HRESULT hr = SHCreateDataObject(pidlParent, 1, &pidlChild.m_pData, NULL, IID_PPV_ARG(IDataObject, &pDataObj));
1889 if (!FAILED_UNEXPECTEDLY(hr))
1890 {
1891 // Ask for a title to display
1892 CComHeapPtr<WCHAR> wszName;
1893 if (!FAILED_UNEXPECTEDLY(SHGetNameFromIDList(m_pidlRoot, SIGDN_PARENTRELATIVEPARSING, &wszName)))
1894 {
1895 BOOL bSuccess = SH_ShowPropertiesDialog(wszName, pDataObj);
1896 if (!bSuccess)
1897 ERR("SH_ShowPropertiesDialog failed\n");
1898 }
1899 }
1900 return hr;
1901 }
1902 else if (uMsg == DFM_MERGECONTEXTMENU)
1903 {
1904 QCMINFO *pqcminfo = (QCMINFO *)lParam;
1905 HMENU hpopup = CreatePopupMenu();
1907 pqcminfo->idCmdFirst = Shell_MergeMenus(pqcminfo->hmenu, hpopup, pqcminfo->indexMenu, pqcminfo->idCmdFirst, pqcminfo->idCmdLast, MM_ADDSEPARATOR);
1908 DestroyMenu(hpopup);
1909 return S_OK;
1910 }
1911 }
1912 return SHELL32_DefaultContextMenuCallBack(psf, pdtobj, uMsg);
1913}
HRESULT WINAPI SHCreateDataObject(PCIDLIST_ABSOLUTE pidlFolder, UINT cidl, PCUITEMID_CHILD_ARRAY apidl, IDataObject *pdtInner, REFIID riid, void **ppv)
#define IDS_PROPERTIES
Definition: resource.h:102
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define IDC_PROPERTIES
Definition: resource.h:32
#define DFM_MERGECONTEXTMENU
Definition: precomp.h:44
#define DFM_INVOKECOMMAND
Definition: precomp.h:45
HRESULT SHELL32_DefaultContextMenuCallBack(IShellFolder *psf, IDataObject *pdo, UINT msg)
Definition: shlfolder.cpp:522
static BOOLEAN bSuccess
Definition: drive.cpp:477
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL SH_ShowPropertiesDialog(LPCWSTR pwszPath, IDataObject *pDataObj)
Definition: fprop.cpp:83
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
HRESULT WINAPI SHGetNameFromIDList(PCIDLIST_ABSOLUTE pidl, SIGDN sigdnName, PWSTR *ppszName)
Definition: pidl.c:1456
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:221
void WINAPI _InsertMenuItemW(HMENU hmenu, UINT indexMenu, BOOL fByPosition, UINT wID, UINT fType, LPCWSTR dwTypeData, UINT fState)
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define MM_ADDSEPARATOR
Definition: shlobj.h:2527
HMENU hmenu
Definition: shlobj.h:1389
UINT idCmdLast
Definition: shlobj.h:1392
UINT idCmdFirst
Definition: shlobj.h:1391
UINT indexMenu
Definition: shlobj.h:1390
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MFS_ENABLED
Definition: winuser.h:750
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define MFT_STRING
Definition: winuser.h:746
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ CompareIDs()

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

Implements IShellFolder.

Definition at line 1023 of file CFSFolder.cpp.

1026{
1027 LPPIDLDATA pData1 = _ILGetDataPointer(pidl1);
1028 LPPIDLDATA pData2 = _ILGetDataPointer(pidl2);
1029 FileStructW* pDataW1 = _ILGetFileStructW(pidl1);
1030 FileStructW* pDataW2 = _ILGetFileStructW(pidl2);
1031 BOOL bIsFolder1 = _ILIsFolder(pidl1);
1032 BOOL bIsFolder2 = _ILIsFolder(pidl2);
1033 LPWSTR pExtension1, pExtension2;
1034
1035 if (!pDataW1 || !pDataW2 || LOWORD(lParam) >= GENERICSHELLVIEWCOLUMNS)
1036 return E_INVALIDARG;
1037
1038 /* When sorting between a File and a Folder, the Folder gets sorted first */
1039 if (bIsFolder1 != bIsFolder2)
1040 {
1041 return MAKE_COMPARE_HRESULT(bIsFolder1 ? -1 : 1);
1042 }
1043
1044 int result = 0;
1045 switch (LOWORD(lParam))
1046 {
1047 case SHFSF_COL_NAME:
1048 result = wcsicmp(pDataW1->wszName, pDataW2->wszName);
1049 break;
1050 case SHFSF_COL_SIZE:
1051 if (pData1->u.file.dwFileSize > pData2->u.file.dwFileSize)
1052 result = 1;
1053 else if (pData1->u.file.dwFileSize < pData2->u.file.dwFileSize)
1054 result = -1;
1055 else
1056 result = 0;
1057 break;
1058 case SHFSF_COL_TYPE:
1059 pExtension1 = PathFindExtensionW(pDataW1->wszName);
1060 pExtension2 = PathFindExtensionW(pDataW2->wszName);
1061 result = wcsicmp(pExtension1, pExtension2);
1062 break;
1063 case SHFSF_COL_MDATE:
1064 result = pData1->u.file.uFileDate - pData2->u.file.uFileDate;
1065 if (result == 0)
1066 result = pData1->u.file.uFileTime - pData2->u.file.uFileTime;
1067 break;
1068 case SHFSF_COL_FATTS:
1069 return SHELL32_CompareDetails(this, lParam, pidl1, pidl2);
1070 case SHFSF_COL_COMMENT:
1071 result = 0;
1072 break;
1073 default:
1074 if (_ILIsPidlSimple(pidl1) || _ILIsPidlSimple(pidl2))
1075 ERR("Unknown column %u, can't compare\n", LOWORD(lParam));
1076 else
1077 TRACE("Unknown column %u, deferring to the subfolder\n", LOWORD(lParam));
1078 }
1079
1080 if (result == 0)
1081 return SHELL32_CompareChildren(this, lParam, pidl1, pidl2);
1082
1084}
BOOL WINAPI _ILIsPidlSimple(LPCITEMIDLIST pidl)
#define wcsicmp
Definition: compat.h:15
#define GENERICSHELLVIEWCOLUMNS
Definition: CFSFolder.cpp:539
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
GLuint64EXT * result
Definition: glext.h:11304
#define LOWORD(l)
Definition: pedump.c:82
#define MAKE_COMPARE_HRESULT(x)
Definition: shellutils.h:607
#define SHFSF_COL_COMMENT
Definition: shfldr.h:48
#define SHFSF_COL_SIZE
Definition: shfldr.h:44
#define SHFSF_COL_NAME
Definition: shfldr.h:43
HRESULT SHELL32_CompareChildren(IShellFolder2 *psf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:224
#define SHFSF_COL_TYPE
Definition: shfldr.h:45
HRESULT SHELL32_CompareDetails(IShellFolder2 *isf, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: shlfolder.cpp:247
#define SHFSF_COL_FATTS
Definition: shfldr.h:47
#define SHFSF_COL_MDATE
Definition: shfldr.h:46

◆ CreateViewObject()

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

Definition at line 1089 of file CFSFolder.cpp.

1091{
1092 CComPtr<IShellView> pShellView;
1094
1095 TRACE ("(%p)->(hwnd=%p,%s,%p)\n", this, hwndOwner, shdebugstr_guid (&riid),
1096 ppvOut);
1097
1098 if (ppvOut)
1099 {
1100 *ppvOut = NULL;
1101
1102 BOOL bIsDropTarget = IsEqualIID (riid, IID_IDropTarget);
1103 BOOL bIsShellView = !bIsDropTarget && IsEqualIID (riid, IID_IShellView);
1104
1105 if (bIsDropTarget || bIsShellView)
1106 {
1107 DWORD dwDirAttributes = _ILGetFileAttributes(ILFindLastID(m_pidlRoot), NULL, 0);
1108
1109 if ((dwDirAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_READONLY)) != 0)
1110 {
1111 CLSID clsidFolder;
1112 hr = SHELL32_GetCLSIDForDirectory(m_sPathTarget, L"UICLSID", &clsidFolder);
1113 if (SUCCEEDED(hr))
1114 {
1115 CComPtr<IPersistFolder> spFolder;
1116 hr = SHCoCreateInstance(NULL, &clsidFolder, NULL, IID_PPV_ARG(IPersistFolder, &spFolder));
1117 if (!FAILED_UNEXPECTEDLY(hr))
1118 {
1119 hr = spFolder->Initialize(m_pidlRoot);
1120
1121 if (!FAILED_UNEXPECTEDLY(hr))
1122 {
1123 hr = spFolder->QueryInterface(riid, ppvOut);
1124 }
1125 }
1126 }
1127 else
1128 {
1129 // No desktop.ini, or no UICLSID present, continue as if nothing happened
1130 hr = E_INVALIDARG;
1131 }
1132 }
1133 }
1134
1135 if (!SUCCEEDED(hr))
1136 {
1137 // No UICLSID handler found, continue to the default handlers
1138 if (bIsDropTarget)
1139 {
1141 }
1142 else if (IsEqualIID (riid, IID_IContextMenu))
1143 {
1144 HKEY hKeys[16];
1145 UINT cKeys = 0;
1146 AddClassKeyToArray(L"Directory\\Background", hKeys, &cKeys);
1147
1148 DEFCONTEXTMENU dcm;
1149 dcm.hwnd = hwndOwner;
1150 dcm.pcmcb = this;
1151 dcm.pidlFolder = m_pidlRoot;
1152 dcm.psf = this;
1153 dcm.cidl = 0;
1154 dcm.apidl = NULL;
1155 dcm.cKeys = cKeys;
1156 dcm.aKeys = hKeys;
1158 hr = SHCreateDefaultContextMenu (&dcm, riid, ppvOut);
1159 }
1160 else if (bIsShellView)
1161 {
1162 SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this, NULL, this};
1163 hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
1164 }
1165 else
1166 {
1167 hr = E_INVALIDARG;
1168 }
1169 }
1170 }
1171 TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
1172 return hr;
1173}
HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv, IShellView **ppsv)
Definition: CDefView.cpp:4380
HRESULT WINAPI SHCreateDefaultContextMenu(const DEFCONTEXTMENU *pdcm, REFIID riid, void **ppv)
HRESULT CFSDropTarget_CreateInstance(LPWSTR sPathTarget, REFIID riid, LPVOID *ppvOut)
unsigned int UINT
Definition: ndis.h:50
DWORD _ILGetFileAttributes(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2554
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
LSTATUS AddClassKeyToArray(const WCHAR *szClass, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:277
struct _SFV_CREATE SFV_CREATE
IContextMenuCB * pcmcb
Definition: shlobj.h:2549
IShellFolder * psf
Definition: shlobj.h:2551
IUnknown * punkAssociationInfo
Definition: shlobj.h:2554
PCUITEMID_CHILD_ARRAY apidl
Definition: shlobj.h:2553
const HKEY * aKeys
Definition: shlobj.h:2556
PCIDLIST_ABSOLUTE pidlFolder
Definition: shlobj.h:2550

◆ EnumObjects()

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

Definition at line 902 of file CFSFolder.cpp.

906{
907 return ShellObjectCreatorInit<CFileSysEnum>(m_sPathTarget, dwFlags, IID_PPV_ARG(IEnumIDList, ppEnumIDList));
908}
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

◆ EnumSearches()

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

Implements IShellFolder2.

Definition at line 1535 of file CFSFolder.cpp.

1536{
1537 FIXME ("(%p)\n", this);
1538 return E_NOTIMPL;
1539}

◆ GetAttributesOf()

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

Definition at line 1184 of file CFSFolder.cpp.

1186{
1187 HRESULT hr = S_OK;
1188
1189 if (!rgfInOut)
1190 return E_INVALIDARG;
1191 if (cidl && !apidl)
1192 return E_INVALIDARG;
1193
1194 if (*rgfInOut == 0)
1195 *rgfInOut = ~0;
1196
1197 if(cidl == 0)
1198 {
1200
1201 if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
1202 {
1203 SHELL32_GetFSItemAttributes(this, rpidl, rgfInOut);
1204 }
1205 else if (_ILIsDrive(rpidl))
1206 {
1207 IShellFolder *psfParent = NULL;
1209 if(SUCCEEDED(hr))
1210 {
1211 hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut);
1212 psfParent->Release();
1213 }
1214 }
1215 else
1216 {
1217 ERR("Got and unknown pidl!\n");
1218 }
1219 }
1220 else
1221 {
1222 while (cidl > 0 && *apidl)
1223 {
1224 pdump(*apidl);
1225 if(_ILIsFolder(*apidl) || _ILIsValue(*apidl))
1226 SHELL32_GetFSItemAttributes(this, *apidl, rgfInOut);
1227 else
1228 ERR("Got an unknown type of pidl!!!\n");
1229 apidl++;
1230 cidl--;
1231 }
1232 }
1233 /* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
1234 *rgfInOut &= ~SFGAO_VALIDATE;
1235
1236 TRACE("-- result=0x%08x\n", *rgfInOut);
1237
1238 return hr;
1239}
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:311
HRESULT SHELL32_GetFSItemAttributes(IShellFolder *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
Definition: CFSFolder.cpp:580
ULONG SFGAOF
Definition: shobjidl.idl:221
HRESULT GetAttributesOf([in] UINT cidl, [in, size_is(cidl)] PCUITEMID_CHILD_ARRAY apidl, [in, out] SFGAOF *rgfInOut)
ULONG Release()
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1350
BOOL _ILIsValue(LPCITEMIDLIST pidl)
Definition: pidl.c:2024
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:2003
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42

Referenced by ParseDisplayName().

◆ GetClassID()

HRESULT WINAPI CFSFolder::GetClassID ( CLSID lpClassId)
override

Implements IPersist.

Definition at line 1636 of file CFSFolder.cpp.

1637{
1638 TRACE ("(%p)\n", this);
1639
1640 if (!lpClassId)
1641 return E_POINTER;
1642
1643 *lpClassId = *m_pclsid;
1644
1645 return S_OK;
1646}
#define E_POINTER
Definition: winerror.h:2365

◆ GetCurFolder()

HRESULT WINAPI CFSFolder::GetCurFolder ( PIDLIST_ABSOLUTE pidl)
override

Implements IPersistFolder2.

Definition at line 1683 of file CFSFolder.cpp.

1684{
1685 TRACE ("(%p)->(%p)\n", this, pidl);
1686
1687 if (!pidl)
1688 return E_POINTER;
1689
1690 *pidl = ILClone(m_pidlRoot);
1691 return S_OK;
1692}

◆ GetCustomViewInfo()

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

Definition at line 1942 of file CFSFolder.cpp.

1943{
1944 if (data == NULL)
1945 {
1946 return E_POINTER;
1947 }
1948 if (data->cbSize != sizeof(*data))
1949 {
1950 // NOTE: You have to set the cbData member before SFVM_GET_CUSTOMVIEWINFO call.
1951 return E_INVALIDARG;
1952 }
1953
1954 data->hbmBack = NULL;
1955 data->clrText = CLR_INVALID;
1956 data->clrTextBack = CLR_INVALID;
1957
1959
1960 // does the folder exists?
1962 {
1963 return E_INVALIDARG;
1964 }
1965
1966 // don't use custom view in network path for security
1968 {
1969 return E_ACCESSDENIED;
1970 }
1971
1972 // build the ini file path
1974 PathAppend(szIniFile, L"desktop.ini");
1975
1976 static LPCWSTR TheGUID = L"{BE098140-A513-11D0-A3A4-00C04FD706EC}";
1977 static LPCWSTR Space = L" \t\n\r\f\v";
1978
1979 // get info from ini file
1980 WCHAR szImage[MAX_PATH], szText[64];
1981
1982 // load the image
1983 szImage[0] = UNICODE_NULL;
1984 GetPrivateProfileStringW(TheGUID, L"IconArea_Image", L"", szImage, _countof(szImage), szIniFile);
1985 if (szImage[0])
1986 {
1987 StrTrimW(szImage, Space);
1988 if (PathIsRelativeW(szImage))
1989 {
1990 PathAppendW(szPath, szImage);
1991 StringCchCopyW(szImage, _countof(szImage), szPath);
1992 }
1993 data->hbmBack = DoLoadPicture(szImage);
1994 }
1995
1996 // load the text color
1997 szText[0] = UNICODE_NULL;
1998 GetPrivateProfileStringW(TheGUID, L"IconArea_Text", L"", szText, _countof(szText), szIniFile);
1999 if (szText[0])
2000 {
2001 StrTrimW(szText, Space);
2002
2003 LPWSTR pchEnd = NULL;
2004 COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
2005
2006 if (pchEnd && !*pchEnd)
2007 data->clrText = cr;
2008 }
2009
2010 // load the text background color
2011 szText[0] = UNICODE_NULL;
2012 GetPrivateProfileStringW(TheGUID, L"IconArea_TextBackground", L"", szText, _countof(szText), szIniFile);
2013 if (szText[0])
2014 {
2015 StrTrimW(szText, Space);
2016
2017 LPWSTR pchEnd = NULL;
2018 COLORREF cr = (wcstol(szText, &pchEnd, 0) & 0xFFFFFF);
2019
2020 if (pchEnd && !*pchEnd)
2021 data->clrTextBack = cr;
2022 }
2023
2024 if (data->hbmBack != NULL || data->clrText != CLR_INVALID || data->clrTextBack != CLR_INVALID)
2025 return S_OK;
2026
2027 return E_FAIL;
2028}
#define E_FAIL
Definition: ddrawi.h:102
INT WINAPI GetPrivateProfileStringW(LPCWSTR section, LPCWSTR entry, LPCWSTR def_val, LPWSTR buffer, UINT len, LPCWSTR filename)
Definition: profile.c:1142
static HBITMAP DoLoadPicture(LPCWSTR pszFileName)
Definition: CFSFolder.cpp:1915
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1723
BOOL WINAPI PathIsRelativeW(LPCWSTR lpszPath)
Definition: path.c:1579
BOOL WINAPI StrTrimW(LPWSTR lpszStr, LPCWSTR lpszTrim)
Definition: string.c:1877
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define UNICODE_NULL
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1342
TCHAR szIniFile[]
Definition: scrnsave.c:29
#define PathIsNetworkPath
Definition: shlwapi.h:1101
#define PathAppend
Definition: shlwapi.h:801
DWORD COLORREF
Definition: windef.h:300
#define E_ACCESSDENIED
Definition: winerror.h:2849
#define CLR_INVALID
Definition: wingdi.h:883
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by MessageSFVCB().

◆ GetDefaultColumn()

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

Implements IShellFolder2.

Definition at line 1541 of file CFSFolder.cpp.

1543{
1544 TRACE ("(%p)\n", this);
1545
1546 if (pSort)
1547 *pSort = 0;
1548 if (pDisplay)
1549 *pDisplay = 0;
1550
1551 return S_OK;
1552}

◆ GetDefaultColumnState()

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

Implements IShellFolder2.

Definition at line 1554 of file CFSFolder.cpp.

1556{
1557 TRACE ("(%p)\n", this);
1558
1559 if (!pcsFlags)
1560 return E_INVALIDARG;
1561 else
1562 return GetDefaultFSColumnState(iColumn, *pcsFlags);
1563}
static HRESULT GetDefaultFSColumnState(UINT iColumn, SHCOLSTATEF &csFlags)
Definition: CFSFolder.cpp:551

◆ GetDefaultFSColumnState()

HRESULT CFSFolder::GetDefaultFSColumnState ( UINT  iColumn,
SHCOLSTATEF csFlags 
)
static

Definition at line 551 of file CFSFolder.cpp.

552{
553 if (iColumn >= _countof(GenericSFHeader))
554 return E_INVALIDARG;
555
556 csFlags = GenericSFHeader[iColumn].colstate;
557 return S_OK;
558}
static const shvheader GenericSFHeader[]
Definition: CFSFolder.cpp:530
WORD colstate
Definition: shfldr.h:31

Referenced by CDesktopFolder::GetDefaultColumnState(), and GetDefaultColumnState().

◆ GetDefaultSearchGUID()

HRESULT WINAPI CFSFolder::GetDefaultSearchGUID ( GUID pguid)
override

Implements IShellFolder2.

Definition at line 1529 of file CFSFolder.cpp.

1530{
1531 FIXME ("(%p)\n", this);
1532 return E_NOTIMPL;
1533}

◆ GetDetailsEx()

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

Implements IShellFolder2.

Definition at line 1565 of file CFSFolder.cpp.

1567{
1568 FIXME ("(%p)\n", this);
1569
1570 return E_NOTIMPL;
1571}

◆ GetDetailsOf()

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

Implements IShellFolder2.

Definition at line 1573 of file CFSFolder.cpp.

1575{
1576 HRESULT hr = E_FAIL;
1577
1578 TRACE ("(%p)->(%p %i %p)\n", this, pidl, iColumn, psd);
1579
1580 if (!psd || iColumn >= GENERICSHELLVIEWCOLUMNS)
1581 return E_INVALIDARG;
1582
1583 if (!pidl)
1584 {
1585 /* the header titles */
1586 return GetFSColumnDetails(iColumn, *psd);
1587 }
1588 else
1589 {
1590 hr = S_OK;
1591 psd->str.uType = STRRET_WSTR;
1592 psd->str.pOleStr = (LPWSTR)CoTaskMemAlloc(MAX_PATH * sizeof(WCHAR));
1593 /* the data from the pidl */
1594 switch (iColumn)
1595 {
1596 case SHFSF_COL_NAME:
1598 break;
1599 case SHFSF_COL_SIZE:
1600 _ILGetFileSize(pidl, psd->str.pOleStr, MAX_PATH);
1601 break;
1602 case SHFSF_COL_TYPE:
1603 _ILGetFileType(pidl, psd->str.pOleStr, MAX_PATH);
1604 break;
1605 case SHFSF_COL_MDATE:
1606 _ILGetFileDate(pidl, psd->str.pOleStr, MAX_PATH);
1607 break;
1608 case SHFSF_COL_FATTS:
1610 break;
1611 case SHFSF_COL_COMMENT:
1612 psd->str.pOleStr[0] = UNICODE_NULL; // TODO: Extract comment from .lnk files? desktop.ini?
1613 break;
1614#if DBG
1615 default:
1616 ERR("Missing case for column %d\n", iColumn);
1617#else
1619#endif
1620 }
1621 }
1622
1623 return hr;
1624}
STDMETHOD() GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags, LPSTRRET strRet) override
Definition: CFSFolder.cpp:1412
static HRESULT GetFSColumnDetails(UINT iColumn, SHELLDETAILS &sd)
Definition: CFSFolder.cpp:541
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define DEFAULT_UNREACHABLE
void _ILGetFileType(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2500
BOOL _ILGetFileDate(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2389
DWORD _ILGetFileSize(LPCITEMIDLIST pidl, LPWSTR pOut, UINT uOutSize)
Definition: pidl.c:2433
@ STRRET_WSTR
Definition: shtypes.idl:85
STRRET str
Definition: shtypes.idl:108
UINT uType
Definition: shtypes.idl:93
LPWSTR pOleStr
Definition: shtypes.idl:96

◆ GetDisplayNameOf()

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

Definition at line 1412 of file CFSFolder.cpp.

1414{
1415 if (!strRet)
1416 return E_INVALIDARG;
1417
1418 /* If it is a complex pidl, let the child handle it */
1419 if (!_ILIsPidlSimple (pidl)) /* complex pidl */
1420 {
1421 return SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, strRet);
1422 }
1423 else if (pidl && !pidl->mkid.cb) /* empty pidl */
1424 {
1425 /* If it is an empty pidl return only the path of the folder */
1429 {
1430 return SHSetStrRet(strRet, m_sPathTarget);
1431 }
1432 return E_INVALIDARG;
1433 }
1434
1435 int len = 0;
1436 LPWSTR pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
1437 if (!pszPath)
1438 return E_OUTOFMEMORY;
1439
1443 {
1444 lstrcpynW(pszPath, m_sPathTarget, MAX_PATH);
1445 PathAddBackslashW(pszPath);
1446 len = wcslen(pszPath);
1447 }
1448 _ILSimpleGetTextW(pidl, pszPath + len, MAX_PATH + 1 - len);
1450
1451 strRet->uType = STRRET_WSTR;
1452 strRet->pOleStr = pszPath;
1453
1454 TRACE ("-- (%p)->(%s)\n", this, strRet->uType == STRRET_CSTR ? strRet->cStr : debugstr_w(strRet->pOleStr));
1455 return S_OK;
1456}
#define GET_SHGDN_RELATION(dwFlags)
Definition: precomp.h:53
#define GET_SHGDN_FOR(dwFlags)
Definition: precomp.h:52
void SHELL_FS_ProcessDisplayFilename(LPWSTR szPath, DWORD dwFlags)
Definition: CFSFolder.cpp:1389
GLenum GLsizei len
Definition: glext.h:6722
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define debugstr_w
Definition: kernel32.h:32
#define PathAddBackslashW
Definition: pathcch.h:301
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2074
HRESULT SHELL32_GetDisplayNameOfChild(IShellFolder2 *psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPSTRRET strRet)
Definition: shlfolder.cpp:206
@ STRRET_CSTR
Definition: shtypes.idl:87
char cStr[MAX_PATH]
Definition: shtypes.idl:98

Referenced by GetDetailsOf().

◆ GetFolderTargetInfo()

HRESULT WINAPI CFSFolder::GetFolderTargetInfo ( PERSIST_FOLDER_TARGET_INFO ppfti)
override

Implements IPersistFolder3.

Definition at line 1769 of file CFSFolder.cpp.

1770{
1771 FIXME("(%p)->(%p)\n", this, ppfti);
1772 ZeroMemory(ppfti, sizeof (*ppfti));
1773 return E_NOTIMPL;
1774}
#define ZeroMemory
Definition: winbase.h:1712

◆ GetFSColumnDetails()

HRESULT CFSFolder::GetFSColumnDetails ( UINT  iColumn,
SHELLDETAILS sd 
)
static

Definition at line 541 of file CFSFolder.cpp.

542{
543 if (iColumn >= _countof(GenericSFHeader))
544 return E_INVALIDARG;
545
546 sd.fmt = GenericSFHeader[iColumn].fmt;
547 sd.cxChar = GenericSFHeader[iColumn].cxChar;
548 return SHSetStrRet(&sd.str, GenericSFHeader[iColumn].colnameid);
549}
static const WCHAR sd[]
Definition: suminfo.c:286

Referenced by CDesktopFolder::GetColumnDetails(), and GetDetailsOf().

◆ GetMaxLength()

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

Definition at line 91 of file CFSFolder.h.

92 {
93 return E_NOTIMPL;
94 }

◆ GetUIObjectOf()

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

Definition at line 1264 of file CFSFolder.cpp.

1268{
1269 LPVOID pObj = NULL;
1271
1272 TRACE ("(%p)->(%p,%u,apidl=%p,%s,%p,%p)\n",
1273 this, hwndOwner, cidl, apidl, shdebugstr_guid (&riid), prgfInOut, ppvOut);
1274
1275 if (ppvOut)
1276 {
1277 *ppvOut = NULL;
1278
1279 if (cidl == 1 && _ILIsValue(apidl[0]))
1280 {
1281 hr = _CreateExtensionUIObject(apidl[0], riid, ppvOut);
1282 if(hr != S_FALSE)
1283 return hr;
1284 }
1285
1286 if (IsEqualIID(riid, IID_IContextMenu) && (cidl >= 1))
1287 {
1288 HKEY hKeys[16];
1289 UINT cKeys = 0;
1290 AddFSClassKeysToArray(cidl, apidl, hKeys, &cKeys);
1291
1292 DEFCONTEXTMENU dcm;
1293 dcm.hwnd = hwndOwner;
1294 dcm.pcmcb = this;
1295 dcm.pidlFolder = m_pidlRoot;
1296 dcm.psf = this;
1297 dcm.cidl = cidl;
1298 dcm.apidl = apidl;
1299 dcm.cKeys = cKeys;
1300 dcm.aKeys = hKeys;
1302 hr = SHCreateDefaultContextMenu (&dcm, riid, &pObj);
1303 }
1304 else if (IsEqualIID (riid, IID_IDataObject))
1305 {
1306 if (cidl >= 1)
1307 {
1308 hr = IDataObject_Constructor (hwndOwner, m_pidlRoot, apidl, cidl, TRUE, (IDataObject **)&pObj);
1309 }
1310 else
1311 {
1312 hr = E_INVALIDARG;
1313 }
1314 }
1315 else if ((IsEqualIID (riid, IID_IExtractIconA) || IsEqualIID (riid, IID_IExtractIconW)) && (cidl == 1))
1316 {
1317 if (_ILIsValue(apidl[0]))
1318 hr = _GetIconHandler(apidl[0], riid, (LPVOID*)&pObj);
1319 if (hr != S_OK)
1320 hr = CFSExtractIcon_CreateInstance(this, apidl[0], riid, &pObj);
1321 }
1322 else if (IsEqualIID (riid, IID_IDropTarget))
1323 {
1324 /* only interested in attempting to bind to shell folders, not files (except exe), so if we fail, rebind to root */
1325 if (cidl != 1 || FAILED(hr = this->_GetDropTarget(apidl[0], (LPVOID*) &pObj)))
1326 {
1328 }
1329 }
1330 else
1331 hr = E_NOINTERFACE;
1332
1333 if (SUCCEEDED(hr) && !pObj)
1334 hr = E_OUTOFMEMORY;
1335
1336 *ppvOut = pObj;
1337 }
1338 TRACE("(%p)->hr=0x%08x\n", this, hr);
1339 return hr;
1340}
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:1827
HRESULT _GetDropTarget(LPCITEMIDLIST pidl, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1799
HRESULT _CreateExtensionUIObject(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:1776
HRESULT CFSExtractIcon_CreateInstance(IShellFolder *psf, LPCITEMIDLIST pidl, REFIID iid, LPVOID *ppvOut)
Definition: CFSFolder.cpp:243
const GUID IID_IDataObject
void AddFSClassKeysToArray(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, HKEY *array, UINT *cKeys)
Definition: shlfolder.cpp:299
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ GetValidCharacters()

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

Definition at line 97 of file CFSFolder.h.

98 {
99 if (ppwszValidChars)
100 {
101 *ppwszValidChars = NULL;
102 }
103 if (ppwszInvalidChars)
104 {
105 SHStrDupW(INVALID_FILETITLE_CHARACTERSW, ppwszInvalidChars);
106 }
107 return S_OK;
108 }
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
Definition: string.c:2012
#define INVALID_FILETITLE_CHARACTERSW
Definition: undocshell.h:911

◆ Initialize()

HRESULT WINAPI CFSFolder::Initialize ( PCIDLIST_ABSOLUTE  pidl)
override

Implements IPersistFolder.

Definition at line 1654 of file CFSFolder.cpp.

1655{
1656 WCHAR wszTemp[MAX_PATH];
1657
1658 TRACE ("(%p)->(%p)\n", this, pidl);
1659
1660 SHFree(m_pidlRoot); /* free the old pidl */
1661 m_pidlRoot = ILClone (pidl); /* set my pidl */
1662
1665
1666 /* set my path */
1667 if (SHGetPathFromIDListW (pidl, wszTemp))
1668 {
1669 int len = wcslen(wszTemp);
1670 m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1671 if (!m_sPathTarget)
1672 return E_OUTOFMEMORY;
1673 memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1674 }
1675
1676 TRACE ("--(%p)->(%s)\n", this, debugstr_w(m_sPathTarget));
1677 return S_OK;
1678}
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ InitializeEx()

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

Definition at line 1699 of file CFSFolder.cpp.

1701{
1702 WCHAR wszTemp[MAX_PATH];
1703
1704 TRACE("(%p)->(%p,%p,%p)\n", this, pbc, pidlRootx, ppfti);
1705 if (ppfti)
1706 TRACE("--%p %s %s 0x%08x 0x%08x\n",
1707 ppfti->pidlTargetFolder, debugstr_w (ppfti->szTargetParsingName),
1708 debugstr_w (ppfti->szNetworkProvider), ppfti->dwAttributes,
1709 ppfti->csidl);
1710
1711 pdump (pidlRootx);
1712 if (ppfti && ppfti->pidlTargetFolder)
1713 pdump(ppfti->pidlTargetFolder);
1714
1715 if (m_pidlRoot)
1716 __SHFreeAndNil(&m_pidlRoot); /* free the old */
1717 if (m_sPathTarget)
1719
1720 /*
1721 * Root path and pidl
1722 */
1723 m_pidlRoot = ILClone(pidlRootx);
1724
1725 /*
1726 * the target folder is spezified in csidl OR pidlTargetFolder OR
1727 * szTargetParsingName
1728 */
1729 if (ppfti)
1730 {
1731 if (ppfti->csidl != -1)
1732 {
1733 if (SHGetSpecialFolderPathW(0, wszTemp, ppfti->csidl,
1734 ppfti->csidl & CSIDL_FLAG_CREATE)) {
1735 int len = wcslen(wszTemp);
1736 m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1737 if (!m_sPathTarget)
1738 return E_OUTOFMEMORY;
1739 memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1740 }
1741 }
1742 else if (ppfti->szTargetParsingName[0])
1743 {
1744 int len = wcslen(ppfti->szTargetParsingName);
1745 m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1746 if (!m_sPathTarget)
1747 return E_OUTOFMEMORY;
1748 memcpy(m_sPathTarget, ppfti->szTargetParsingName,
1749 (len + 1) * sizeof(WCHAR));
1750 }
1751 else if (ppfti->pidlTargetFolder)
1752 {
1753 if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp))
1754 {
1755 int len = wcslen(wszTemp);
1756 m_sPathTarget = (WCHAR *)SHAlloc((len + 1) * sizeof(WCHAR));
1757 if (!m_sPathTarget)
1758 return E_OUTOFMEMORY;
1759 memcpy(m_sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
1760 }
1761 }
1762 }
1763
1764 TRACE("--(%p)->(target=%s)\n", this, debugstr_w(m_sPathTarget));
1766 return (m_sPathTarget) ? S_OK : E_FAIL;
1767}
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:3092
#define __SHFreeAndNil(ptr)
Definition: shell32_main.h:146
#define CSIDL_FLAG_CREATE

◆ MapColumnToSCID()

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

Implements IShellFolder2.

Definition at line 1626 of file CFSFolder.cpp.

1628{
1629 FIXME ("(%p)\n", this);
1630 return E_NOTIMPL;
1631}

◆ MessageSFVCB()

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

Definition at line 2030 of file CFSFolder.cpp.

2031{
2033 switch (uMsg)
2034 {
2037 break;
2038 }
2039 return hr;
2040}
#define SFVM_GET_CUSTOMVIEWINFO
HRESULT WINAPI GetCustomViewInfo(ULONG unknown, SFVM_CUSTOMVIEWINFO_DATA *data)
Definition: CFSFolder.cpp:1942
uint32_t ULONG
Definition: typedefs.h:59

◆ ParseDisplayName()

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

Definition at line 798 of file CFSFolder.cpp.

803{
804 TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
805 this, hwndOwner, pbc, lpszDisplayName, debugstr_w (lpszDisplayName),
806 pchEaten, ppidl, pdwAttributes);
807
808 if (!ppidl)
809 return E_INVALIDARG;
810
811 *ppidl = NULL;
812
813 if (!lpszDisplayName)
814 return E_INVALIDARG;
815
816 HRESULT hr;
817 WIN32_FIND_DATAW FindData;
818 if (SHIsFileSysBindCtx(pbc, &FindData) == S_OK)
819 {
820 CComHeapPtr<ITEMIDLIST> pidlTemp;
821 hr = _ParseSimple(lpszDisplayName, &FindData, &pidlTemp);
822 if (SUCCEEDED(hr) && pdwAttributes && *pdwAttributes)
823 {
824 LPCITEMIDLIST pidlLast = ILFindLastID(pidlTemp);
825 GetAttributesOf(1, &pidlLast, pdwAttributes);
826 }
827
828 if (SUCCEEDED(hr))
829 *ppidl = pidlTemp.Detach();
830 }
831 else
832 {
833 INT cchElement = lstrlenW(lpszDisplayName) + 1;
834 LPWSTR pszElement = (LPWSTR)alloca(cchElement * sizeof(WCHAR));
835 LPWSTR pchNext = lpszDisplayName;
836 hr = Shell_NextElement(&pchNext, pszElement, cchElement, TRUE);
837 if (FAILED(hr))
838 return hr;
839
840 hr = _CreateIDListFromName(pszElement, ULONG_MAX, pbc, ppidl);
841 if (FAILED(hr))
842 {
843 if (pchNext) // Is there the next element?
844 {
845 // pszElement seems like a directory
846 if (_GetFindDataFromName(pszElement, &FindData) &&
847 (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
848 {
849 hr = _CreateIDListFromName(pszElement, FILE_ATTRIBUTE_DIRECTORY, pbc, ppidl);
850 }
851 }
852 else
853 {
854 // pszElement seems like a non-directory
857 (BindCtx_GetMode(pbc, 0) & STGM_CREATE))
858 {
859 // Pretend like a normal file
860 hr = _CreateIDListFromName(pszElement, FILE_ATTRIBUTE_NORMAL, pbc, ppidl);
861 }
862 }
863 }
864
865 if (SUCCEEDED(hr))
866 {
867 if (pchNext) // Is there next?
868 {
869 CComPtr<IShellFolder> psfChild;
870 hr = BindToObject(*ppidl, pbc, IID_PPV_ARG(IShellFolder, &psfChild));
871 if (FAILED(hr))
872 return hr;
873
874 DWORD chEaten;
875 CComHeapPtr<ITEMIDLIST> pidlChild;
876 hr = psfChild->ParseDisplayName(hwndOwner, pbc, pchNext, &chEaten, &pidlChild,
877 pdwAttributes);
878
879 // Append pidlChild to ppidl
880 if (SUCCEEDED(hr))
881 hr = SHILAppend(pidlChild.Detach(), ppidl);
882 }
883 else if (pdwAttributes && *pdwAttributes)
884 {
885 GetAttributesOf(1, (LPCITEMIDLIST*)ppidl, pdwAttributes);
886 }
887 }
888 }
889
890 TRACE("(%p)->(-- pidl=%p ret=0x%08x)\n", this, ppidl ? *ppidl : 0, hr);
891
892 return hr;
893}
STDMETHOD() GetAttributesOf(UINT cidl, PCUITEMID_CHILD_ARRAY apidl, DWORD *rgfInOut) override
Definition: CFSFolder.cpp:1184
HRESULT _ParseSimple(_In_ LPOLESTR lpszDisplayName, _Inout_ WIN32_FIND_DATAW *pFind, _Out_ LPITEMIDLIST *ppidl)
Definition: CFSFolder.cpp:687
HRESULT _CreateIDListFromName(LPCWSTR pszName, DWORD attrs, IBindCtx *pbc, LPITEMIDLIST *ppidl)
Definition: CFSFolder.cpp:742
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrlenW
Definition: compat.h:750
DWORD BindCtx_GetMode(_In_ IBindCtx *pbc, _In_ DWORD dwDefault)
Definition: utils.cpp:128
HRESULT SHIsFileSysBindCtx(_In_ IBindCtx *pBindCtx, _Out_opt_ WIN32_FIND_DATAW *pFindData)
Definition: utils.cpp:153
#define alloca
Definition: malloc.h:357
#define STGM_CREATE
Definition: objbase.h:926
int32_t INT
Definition: typedefs.h:58
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106

◆ SetNameOf()

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

Implements IShellFolder.

Definition at line 1470 of file CFSFolder.cpp.

1476{
1477 WCHAR szSrc[MAX_PATH + 1], szDest[MAX_PATH + 1];
1478 BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
1479
1480 TRACE ("(%p)->(%p,pidl=%p,%s,%u,%p)\n", this, hwndOwner, pidl,
1481 debugstr_w (lpName), dwFlags, pPidlOut);
1482
1483 FileStructW* pDataW = _ILGetFileStructW(pidl);
1484 if (!pDataW)
1485 {
1486 ERR("Got garbage pidl:\n");
1487 pdump_always(pidl);
1488 return E_INVALIDARG;
1489 }
1490
1491 /* build source path */
1492 PathCombineW(szSrc, m_sPathTarget, pDataW->wszName); // FIXME: PIDLs without wide string
1493
1494 /* build destination path */
1497 else
1498 lstrcpynW(szDest, lpName, MAX_PATH);
1499
1500 if (!(dwFlags & SHGDN_FORPARSING) && !bIsFolder && SHELL_FS_HideExtension(szSrc))
1501 {
1503 if (*ext)
1504 PathAddExtensionW(szDest, ext);
1505 }
1506
1507 HRESULT hr = S_OK;
1508 TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
1509 if (!wcscmp(szSrc, szDest))
1510 {
1511 /* src and destination is the same */
1512 if (pPidlOut)
1513 hr = SHILClone(pidl, pPidlOut);
1514 }
1515 else if (MoveFileW(szSrc, szDest))
1516 {
1517 if (pPidlOut)
1518 hr = ParseDisplayName(hwndOwner, NULL, PathFindFileNameW(szDest), NULL, pPidlOut, NULL);
1519
1520 SHChangeNotify(bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM, SHCNF_PATHW, szSrc, szDest);
1521 }
1522 else
1523 {
1525 }
1526 return hr;
1527}
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
static const WCHAR *const ext[]
Definition: module.c:53
BOOL WINAPI MoveFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName)
Definition: move.c:1104
BOOL SHELL_FS_HideExtension(LPCWSTR szPath)
Definition: CFSFolder.cpp:1355
HRESULT SHILClone(_In_opt_ LPCITEMIDLIST pidl, _Outptr_ LPITEMIDLIST *ppidl)
Definition: utils.cpp:13
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
static IParseDisplayName ParseDisplayName
Definition: moniker.c:816
#define PathAddExtensionW
Definition: pathcch.h:305
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HRESULT HResultFromWin32(DWORD hr)
Definition: shellutils.h:70
#define SHCNE_RENAMEITEM
Definition: shlobj.h:1889
#define SHCNE_RENAMEFOLDER
Definition: shlobj.h:1906
#define SHCNF_PATHW
Definition: shlobj.h:1924
_In_ LPCSTR lpName
Definition: winbase.h:2789

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: