ReactOS 0.4.15-dev-8231-g29a56f3
CShellItem Class Reference

#include <CShellItem.h>

Inheritance diagram for CShellItem:
Collaboration diagram for CShellItem:

Public Member Functions

 CShellItem ()
 
 ~CShellItem ()
 
HRESULT get_parent_pidl (LPITEMIDLIST *parent_pidl)
 
HRESULT get_parent_shellfolder (IShellFolder **ppsf)
 
HRESULT get_shellfolder (IBindCtx *pbc, REFIID riid, void **ppvOut)
 
STDMETHOD() BindToHandler (IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) override
 
STDMETHOD() GetParent (IShellItem **ppsi) override
 
STDMETHOD() GetDisplayName (SIGDN sigdnName, LPWSTR *ppszName) override
 
STDMETHOD() GetAttributes (SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs) override
 
STDMETHOD() Compare (IShellItem *oth, SICHINTF hint, int *piOrder) override
 
STDMETHOD() GetClassID (CLSID *pClassID) override
 
STDMETHOD() SetIDList (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHOD() GetIDList (PIDLIST_ABSOLUTE *ppidl) 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 BindToHandler ([in] IBindCtx *pbc, [in] REFGUID rbhid, [in] REFIID riid, [out, iid_is(riid)] void **ppvOut)
 
HRESULT GetParent ([out] IShellItem **ppsi)
 
HRESULT GetDisplayName ([in] SIGDN sigdnName, [out] LPWSTR *ppszName)
 
HRESULT GetAttributes ([in] SFGAOF sfgaoMask, [out] SFGAOF *psfgaoAttribs)
 
HRESULT Compare ([in] IShellItem *psi, [in] SICHINTF hint, [out] int *piOrder)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
HRESULT SetIDList ([in] PCIDLIST_ABSOLUTE pidl)
 
HRESULT GetIDList ([out] PIDLIST_ABSOLUTE *ppidl)
 
HRESULT GetClassID ([out] CLSID *pClassID)
 

Private Attributes

LPITEMIDLIST m_pidl
 

Additional Inherited Members

- Public Types inherited from IShellItem
enum  SIGDN {
  SIGDN_NORMALDISPLAY = 0 , SIGDN_PARENTRELATIVEPARSING = 0x80018001 , SIGDN_DESKTOPABSOLUTEPARSING = 0x80028000 , SIGDN_PARENTRELATIVEEDITING = 0x80031001 ,
  SIGDN_DESKTOPABSOLUTEEDITING = 0x8004c000 , SIGDN_FILESYSPATH = 0x80058000 , SIGDN_URL = 0x80068000 , SIGDN_PARENTRELATIVEFORADDRESSBAR = 0x8007c001 ,
  SIGDN_PARENTRELATIVE = 0x80080001
}
 
enum  _SICHINTF { SICHINT_DISPLAY = 0x00000000 , SICHINT_CANONICAL = 0x10000000 , SICHINT_TEST_FILESYSPATH_IF_NOT_EQUAL = 0x20000000 , SICHINT_ALLFIELDS = 0x80000000 }
 
typedef DWORD SICHINTF
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- 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
 

Detailed Description

Definition at line 25 of file CShellItem.h.

Constructor & Destructor Documentation

◆ CShellItem()

CShellItem::CShellItem ( )

Definition at line 30 of file CShellItem.cpp.

30 :
32{
33}
LPITEMIDLIST m_pidl
Definition: CShellItem.h:32
#define NULL
Definition: types.h:112

◆ ~CShellItem()

CShellItem::~CShellItem ( )

Definition at line 35 of file CShellItem.cpp.

36{
38}
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:940

Member Function Documentation

◆ BindToHandler()

HRESULT WINAPI CShellItem::BindToHandler ( IBindCtx pbc,
REFGUID  rbhid,
REFIID  riid,
void **  ppvOut 
)
override

Implements IShellItem.

Definition at line 101 of file CShellItem.cpp.

102{
103 HRESULT ret;
104 TRACE("(%p, %p,%s,%p,%p)\n", this, pbc, shdebugstr_guid(&rbhid), riid, ppvOut);
105
106 *ppvOut = NULL;
107 if (IsEqualGUID(rbhid, BHID_SFObject))
108 {
109 return get_shellfolder(pbc, riid, ppvOut);
110 }
111 else if (IsEqualGUID(rbhid, BHID_SFUIObject))
112 {
113 CComPtr<IShellFolder> psf_parent;
114 if (_ILIsDesktop(m_pidl))
115 ret = SHGetDesktopFolder(&psf_parent);
116 else
117 ret = get_parent_shellfolder(&psf_parent);
119 return ret;
120
122 return psf_parent->GetUIObjectOf(NULL, 1, &pidl, riid, NULL, ppvOut);
123 }
124 else if (IsEqualGUID(rbhid, BHID_DataObject))
125 {
126 return BindToHandler(pbc, BHID_SFUIObject, IID_IDataObject, ppvOut);
127 }
128 else if (IsEqualGUID(rbhid, BHID_SFViewObject))
129 {
133 return ret;
134
135 return psf->CreateViewObject(NULL, riid, ppvOut);
136 }
137
138 FIXME("Unsupported BHID %s.\n", debugstr_guid(&rbhid));
139
140 return MK_E_NOOBJECT;
141}
BOOL _ILIsDesktop(LPCITEMIDLIST pidl)
Definition: CBandSite.h:24
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define FIXME(fmt,...)
Definition: debug.h:114
STDMETHOD() BindToHandler(IBindCtx *pbc, REFGUID rbhid, REFIID riid, void **ppvOut) override
Definition: CShellItem.cpp:101
HRESULT get_parent_shellfolder(IShellFolder **ppsf)
Definition: CShellItem.cpp:61
HRESULT get_shellfolder(IBindCtx *pbc, REFIID riid, void **ppvOut)
Definition: CShellItem.cpp:79
const char * shdebugstr_guid(const struct _GUID *id)
Definition: debughlp.cpp:428
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IDataObject
LPITEMIDLIST WINAPI ILFindLastID(LPCITEMIDLIST pidl)
Definition: pidl.c:198
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define TRACE(s)
Definition: solgame.cpp:4
int ret
#define MK_E_NOOBJECT
Definition: winerror.h:2786
#define IID_PPV_ARG(Itype, ppType)

Referenced by BindToHandler().

◆ Compare()

HRESULT WINAPI CShellItem::Compare ( IShellItem oth,
SICHINTF  hint,
int piOrder 
)
override

Implements IShellItem.

Definition at line 191 of file CShellItem.cpp.

192{
193 HRESULT hr;
195 CComPtr<IShellFolder> psfDesktop;
196 LPITEMIDLIST pidl;
197
198 TRACE("(%p,%p,%x,%p)\n", this, oth, hint, piOrder);
199
200 if (piOrder == NULL || oth == NULL)
201 return E_POINTER;
202
203 hr = oth->QueryInterface(IID_PPV_ARG(IPersistIDList, &pIDList));
204 if (SUCCEEDED(hr))
205 {
206 hr = pIDList->GetIDList(&pidl);
207 if (SUCCEEDED(hr))
208 {
209 hr = SHGetDesktopFolder(&psfDesktop);
210 if (SUCCEEDED(hr))
211 {
212 hr = psfDesktop->CompareIDs(hint, m_pidl, pidl);
213 *piOrder = (int)(short)SCODE_CODE(hr);
214 }
215 ILFree(pidl);
216 }
217 }
218
219 if(FAILED(hr))
220 return hr;
221
222 if(*piOrder)
223 return S_FALSE;
224 else
225 return S_OK;
226}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
DWORD hint
Definition: vfdcmd.c:88
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365
#define SCODE_CODE(sc)
Definition: winerror.h:77

◆ get_parent_pidl()

HRESULT CShellItem::get_parent_pidl ( LPITEMIDLIST parent_pidl)

Definition at line 40 of file CShellItem.cpp.

41{
42 *parent_pidl = ILClone(m_pidl);
43 if (*parent_pidl)
44 {
45 if (ILRemoveLastID(*parent_pidl))
46 return S_OK;
47 else
48 {
49 ILFree(*parent_pidl);
50 *parent_pidl = NULL;
51 return E_INVALIDARG;
52 }
53 }
54 else
55 {
56 *parent_pidl = NULL;
57 return E_OUTOFMEMORY;
58 }
59}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
BOOL WINAPI ILRemoveLastID(LPITEMIDLIST pidl)
Definition: pidl.c:221

Referenced by get_parent_shellfolder(), and GetParent().

◆ get_parent_shellfolder()

HRESULT CShellItem::get_parent_shellfolder ( IShellFolder **  ppsf)

Definition at line 61 of file CShellItem.cpp.

62{
63 HRESULT hr;
64 LPITEMIDLIST parent_pidl;
66
67 hr = get_parent_pidl(&parent_pidl);
68 if (SUCCEEDED(hr))
69 {
70 hr = SHGetDesktopFolder(&desktop);
71 if (SUCCEEDED(hr))
72 hr = desktop->BindToObject(parent_pidl, NULL, IID_PPV_ARG(IShellFolder, ppsf));
73 ILFree(parent_pidl);
74 }
75
76 return hr;
77}
HRESULT get_parent_pidl(LPITEMIDLIST *parent_pidl)
Definition: CShellItem.cpp:40

Referenced by BindToHandler(), and GetAttributes().

◆ get_shellfolder()

HRESULT CShellItem::get_shellfolder ( IBindCtx pbc,
REFIID  riid,
void **  ppvOut 
)

Definition at line 79 of file CShellItem.cpp.

80{
82 CComPtr<IShellFolder> psfDesktop;
84
85 ret = SHGetDesktopFolder(&psfDesktop);
87 return ret;
88
90 psf = psfDesktop;
91 else
92 {
93 ret = psfDesktop->BindToObject(m_pidl, pbc, IID_PPV_ARG(IShellFolder, &psf));
95 return ret;
96 }
97
98 return psf->QueryInterface(riid, ppvOut);
99}

Referenced by BindToHandler().

◆ GetAttributes()

HRESULT WINAPI CShellItem::GetAttributes ( SFGAOF  sfgaoMask,
SFGAOF psfgaoAttribs 
)
override

Implements IShellItem.

Definition at line 165 of file CShellItem.cpp.

166{
167 CComPtr<IShellFolder> parent_folder;
168 LPCITEMIDLIST child_pidl;
169 HRESULT hr;
170
171 TRACE("(%p,%x,%p)\n", this, sfgaoMask, psfgaoAttribs);
172
173 if (_ILIsDesktop(m_pidl))
174 hr = SHGetDesktopFolder(&parent_folder);
175 else
176 hr = get_parent_shellfolder(&parent_folder);
178 return hr;
179
180 child_pidl = ILFindLastID(m_pidl);
181 *psfgaoAttribs = sfgaoMask;
182 hr = parent_folder->GetAttributesOf(1, &child_pidl, psfgaoAttribs);
183 *psfgaoAttribs &= sfgaoMask;
184
186 return hr;
187
188 return (sfgaoMask == *psfgaoAttribs) ? S_OK : S_FALSE;
189}

◆ GetClassID()

HRESULT WINAPI CShellItem::GetClassID ( CLSID pClassID)
override

Implements IPersist.

Definition at line 228 of file CShellItem.cpp.

229{
230 TRACE("(%p,%p)\n", this, pClassID);
231
232 *pClassID = CLSID_ShellItem;
233 return S_OK;
234}

◆ GetDisplayName()

HRESULT WINAPI CShellItem::GetDisplayName ( SIGDN  sigdnName,
LPWSTR ppszName 
)
override

Implements IShellItem.

Definition at line 160 of file CShellItem.cpp.

161{
163}
HRESULT WINAPI SHGetNameFromIDList(PCIDLIST_ABSOLUTE pidl, SIGDN sigdnName, PWSTR *ppszName)
Definition: pidl.c:1456
SIGDN PWSTR * ppszName
Definition: shobjidl.idl:605
SIGDN sigdnName
Definition: shobjidl.idl:605

◆ GetIDList()

HRESULT WINAPI CShellItem::GetIDList ( PIDLIST_ABSOLUTE ppidl)
override

Implements IPersistIDList.

Definition at line 253 of file CShellItem.cpp.

254{
255 TRACE("(%p,%p)\n", this, ppidl);
256
257 *ppidl = ILClone(m_pidl);
258 if (*ppidl)
259 return S_OK;
260 else
261 return E_OUTOFMEMORY;
262}

◆ GetParent()

HRESULT WINAPI CShellItem::GetParent ( IShellItem **  ppsi)
override

Implements IShellItem.

Definition at line 143 of file CShellItem.cpp.

144{
145 HRESULT hr;
146 LPITEMIDLIST parent_pidl;
147
148 TRACE("(%p,%p)\n", this, ppsi);
149
150 hr = get_parent_pidl(&parent_pidl);
151 if (SUCCEEDED(hr))
152 {
153 hr = SHCreateShellItem(NULL, NULL, parent_pidl, ppsi);
154 ILFree(parent_pidl);
155 }
156
157 return hr;
158}
EXTERN_C HRESULT WINAPI SHCreateShellItem(PCIDLIST_ABSOLUTE pidlParent, IShellFolder *psfParent, PCUITEMID_CHILD pidl, IShellItem **ppsi)
Definition: CShellItem.cpp:264

◆ SetIDList()

HRESULT WINAPI CShellItem::SetIDList ( PCIDLIST_ABSOLUTE  pidl)
override

Implements IPersistIDList.

Definition at line 236 of file CShellItem.cpp.

237{
238 LPITEMIDLIST new_pidl;
239
240 TRACE("(%p,%p)\n", this, pidlx);
241
242 new_pidl = ILClone(pidlx);
243 if (new_pidl)
244 {
245 ILFree(m_pidl);
246 m_pidl = new_pidl;
247 return S_OK;
248 }
249 else
250 return E_OUTOFMEMORY;
251}

Member Data Documentation

◆ m_pidl


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