ReactOS 0.4.15-dev-8131-g4988de4
CFolderItems.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: shell32
3 * LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4 * PURPOSE: FolderItem(s) implementation
5 * COPYRIGHT: Copyright 2015-2018 Mark Jansen (mark.jansen@reactos.org)
6 */
7
8#include "precomp.h"
9
11
12
14{
15}
16
18{
19}
20
22{
23 m_idlist.Attach(ILClone(idlist));
25 return S_OK;
26}
27
28// *** FolderItem methods ***
30{
31 TRACE("(%p, %p)\n", this, ppid);
32 return m_Folder->get_Application(ppid);
33}
34
36{
37 TRACE("(%p, %p)\n", this, ppid);
38 if (ppid)
39 {
40 *ppid = m_Folder;
41 (*ppid)->AddRef();
42 }
43 return E_NOTIMPL;
44}
45
47{
48 TRACE("(%p, %p)\n", this, pbs);
49
50 *pbs = NULL;
51
53 LPCITEMIDLIST last_part;
56 return hr;
57
58 STRRET strret;
59 hr = Parent->GetDisplayNameOf(last_part, SHGDN_INFOLDER, &strret);
61 hr = StrRetToBSTR(&strret, last_part, pbs);
62
63 return hr;
64}
65
67{
68 TRACE("(%p, %s)\n", this, wine_dbgstr_w(bs));
69 return E_NOTIMPL;
70}
71
73{
74 CComPtr<IShellFolder> psfDesktop;
75
76 HRESULT hr = SHGetDesktopFolder(&psfDesktop);
77 if (!SUCCEEDED(hr))
78 return hr;
79
80 STRRET strret;
81 hr = psfDesktop->GetDisplayNameOf(m_idlist, SHGDN_FORPARSING, &strret);
83 return hr;
84
85 return StrRetToBSTR(&strret, NULL, pbs);
86}
87
89{
90 TRACE("(%p, %p)\n", this, ppid);
91 return E_NOTIMPL;
92}
93
95{
96 TRACE("(%p, %p)\n", this, ppid);
97 return E_NOTIMPL;
98}
99
101{
102 TRACE("(%p, %p)\n", this, pb);
103 return E_NOTIMPL;
104}
105
107{
108 TRACE("(%p, %p)\n", this, pb);
109 return E_NOTIMPL;
110}
111
113{
114 TRACE("(%p, %p)\n", this, pb);
115 return E_NOTIMPL;
116}
117
119{
120 TRACE("(%p, %p)\n", this, pb);
121 return E_NOTIMPL;
122}
123
125{
126 TRACE("(%p, %p)\n", this, pdt);
127 return E_NOTIMPL;
128}
129
131{
132 TRACE("(%p, %f)\n", this, dt);
133 return E_NOTIMPL;
134}
135
137{
138 TRACE("(%p, %p)\n", this, pul);
139 return E_NOTIMPL;
140}
141
143{
144 TRACE("(%p, %p)\n", this, pbs);
145 return E_NOTIMPL;
146}
147
149{
150 if (!ppfic)
151 return E_POINTER;
153 HRESULT hr = verbs->Init(m_idlist);
155 {
156 delete verbs;
157 return hr;
158 }
159 verbs->AddRef();
160 *ppfic = verbs;
161 return S_OK;
162}
163
165{
166 TRACE("(%p, %s)\n", this, wine_dbgstr_variant(&vVerb));
167 return E_NOTIMPL;
168}
169
170
171
173 :m_Count(-1)
174{
175}
176
178{
179}
180
182{
183 CComPtr<IShellFolder> psfDesktop, psfTarget;
184
185 m_idlist.Attach(ILClone(idlist));
186
187 HRESULT hr = SHGetDesktopFolder(&psfDesktop);
189 return hr;
190
191 hr = psfDesktop->BindToObject(m_idlist, NULL, IID_PPV_ARG(IShellFolder, &psfTarget));
193 return hr;
194
195 hr = psfTarget->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &m_EnumIDList);
196
198 return hr;
199
201 return S_OK;
202}
203
204// *** FolderItems methods ***
206{
207 if (!m_EnumIDList)
208 return E_FAIL;
209
210 if (!plCount)
211 return E_POINTER;
212
213 if (m_Count == -1)
214 {
215 long count = 0;
216
217 HRESULT hr = m_EnumIDList->Reset();
219 return hr;
220
222 while ((hr = m_EnumIDList->Next(1, &Pidl, 0)) != S_FALSE)
223 {
224 count++;
225 Pidl.Free();
226 }
227 m_Count = count;
228 }
229 *plCount = m_Count;
230
231 return S_OK;
232}
233
235{
236 TRACE("(%p, %p)\n", this, ppid);
237 return m_Folder->get_Application(ppid);
238}
239
241{
242 TRACE("(%p, %p)\n", this, ppid);
243
244 if (ppid)
245 *ppid = NULL;
246
247 return E_NOTIMPL;
248}
249
251{
253 HRESULT hr;
254
255 if (!m_EnumIDList)
256 return E_FAIL;
257
259 if (FAILED(hr))
260 return hr;
261
262 if (V_VT(&index) == VT_I2)
264
265 if (V_VT(&index) == VT_I4)
266 {
268
269 hr = m_EnumIDList->Reset();
271 return hr;
272
273 hr = m_EnumIDList->Skip(count);
274
276 return hr;
277
279 hr = m_EnumIDList->Next(1, &spPidl, 0);
281 return hr;
282 hr = ShellObjectCreatorInit<CFolderItem>(m_Folder, static_cast<LPITEMIDLIST>(spPidl), IID_PPV_ARG(FolderItem, ppid));
284 return hr;
285 return hr;
286 }
287 else if (V_VT(&index) == VT_BSTR)
288 {
289 if (!V_BSTR(&index))
290 return S_FALSE;
291
292 hr = m_Folder->ParseName(V_BSTR(&index), ppid);
294 return hr;
295 return hr;
296 }
297
298 FIXME("Index type %d not handled.\n", V_VT(&index));
299 return E_NOTIMPL;
300}
301
303{
304 return ShellObjectCreatorInit<CFolderItems>(static_cast<LPITEMIDLIST>(m_idlist), m_Folder, IID_FolderItems, reinterpret_cast<void**>(ppunk));
305}
306
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
#define FIXME(fmt,...)
Definition: debug.h:114
HRESULT Init(LPITEMIDLIST idlist)
CComHeapPtr< ITEMIDLIST > m_idlist
Definition: CFolderItems.h:18
STDMETHOD() get_Type(BSTR *pbs) override
STDMETHOD() get_Path(BSTR *pbs) override
STDMETHOD() get_IsLink(VARIANT_BOOL *pb) override
STDMETHOD() get_Size(LONG *pul) override
STDMETHOD() get_IsFileSystem(VARIANT_BOOL *pb) override
STDMETHOD() get_IsBrowsable(VARIANT_BOOL *pb) override
STDMETHOD() get_ModifyDate(DATE *pdt) override
STDMETHOD() get_Parent(IDispatch **ppid) override
STDMETHOD() get_IsFolder(VARIANT_BOOL *pb) override
STDMETHOD() Verbs(FolderItemVerbs **ppfic) override
STDMETHOD() put_Name(BSTR bs) override
STDMETHOD() get_Name(BSTR *pbs) override
STDMETHOD() put_ModifyDate(DATE dt) override
STDMETHOD() get_GetFolder(IDispatch **ppid) override
STDMETHOD() get_Application(IDispatch **ppid) override
STDMETHOD() InvokeVerb(VARIANT vVerb) override
CComPtr< Folder > m_Folder
Definition: CFolderItems.h:19
STDMETHOD() get_GetLink(IDispatch **ppid) override
HRESULT Initialize(Folder *folder, LPITEMIDLIST idlist)
STDMETHOD() Item(VARIANT index, FolderItem **ppid) override
STDMETHOD() get_Application(IDispatch **ppid) override
HRESULT Initialize(LPITEMIDLIST idlist, Folder *parent)
CComPtr< IEnumIDList > m_EnumIDList
Definition: CFolderItems.h:63
STDMETHOD() get_Count(long *plCount) override
CComHeapPtr< ITEMIDLIST > m_idlist
Definition: CFolderItems.h:62
CComPtr< Folder > m_Folder
Definition: CFolderItems.h:64
STDMETHOD() get_Parent(IDispatch **ppid) override
STDMETHOD() _NewEnum(IUnknown **ppunk) override
void Free()
Definition: atlalloc.h:153
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
double DATE
Definition: compat.h:2253
OLECHAR * BSTR
Definition: compat.h:2293
short VARIANT_BOOL
Definition: compat.h:2290
@ VT_BSTR
Definition: compat.h:2303
@ VT_I4
Definition: compat.h:2298
@ VT_I2
Definition: compat.h:2297
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
HRESULT WINAPI StrRetToBSTR(STRRET *lpStrRet, LPCITEMIDLIST pidl, BSTR *pBstrOut)
Definition: string.c:1694
r parent
Definition: btrfs.c:3010
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint index
Definition: glext.h:6031
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define wine_dbgstr_w
Definition: kernel32.h:34
static struct msdos_boot_sector bs
Definition: mkdosfs.c:539
const char * var
Definition: shader.c:5666
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_UI4(A)
Definition: oleauto.h:270
long LONG
Definition: pedump.c:60
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
HRESULT WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1350
HRESULT hr
Definition: shlfolder.c:183
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define TRACE(s)
Definition: solgame.cpp:4
Definition: fci.c:116
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
HRESULT WINAPI VariantCopyInd(VARIANT *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:847
#define S_FALSE
Definition: winerror.h:2357
#define E_POINTER
Definition: winerror.h:2365
#define IID_PPV_ARG(Itype, ppType)