ReactOS  0.4.14-dev-552-g2fad488
CFolder.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: Folder 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));
24  return CShellDispatch_Constructor(IID_PPV_ARG(IShellDispatch, &m_Application));
25 }
26 
28 {
29  CComPtr<IShellFolder> psfDesktop;
30 
31  HRESULT hr = SHGetDesktopFolder(&psfDesktop);
33  return hr;
34 
35  return psfDesktop->BindToObject(m_idlist, NULL, IID_PPV_ARG(IShellFolder, &psfCurrent));
36 }
37 
38 // *** Folder methods ***
40 {
41  if (!pbs)
42  return E_POINTER;
43 
44  WCHAR path[MAX_PATH+2] = {0};
47  return hr;
48 
49  *pbs = SysAllocString(path);
50  return S_OK;
51 }
52 
54 {
55  TRACE("(%p, %p)\n", this, ppid);
56 
57  if (!ppid)
58  return E_INVALIDARG;
59 
60  *ppid = m_Application;
61  (*ppid)->AddRef();
62 
63  return S_OK;
64 }
65 
67 {
68  TRACE("(%p %p)\n", this, ppid);
69 
70  if (ppid)
71  *ppid = NULL;
72 
73  return E_NOTIMPL;
74 }
75 
77 {
78  TRACE("(%p, %p)\n", this);
79 
80  *ppsf = NULL;
81 
82  return E_NOTIMPL;
83 }
84 
86 {
87  /* FolderItems_Constructor */
88  return ShellObjectCreatorInit<CFolderItems>(static_cast<LPITEMIDLIST>(m_idlist), this, IID_PPV_ARG(FolderItems, ppid));
89 }
90 
92 {
93  TRACE("(%p, %s, %p)\n", this, wine_dbgstr_w(bName), ppid);
94  if (!ppid)
95  return E_POINTER;
96  *ppid = NULL;
97 
98  CComPtr<IShellFolder> psfCurrent;
99  HRESULT hr = GetShellFolder(psfCurrent);
100  if (FAILED_UNEXPECTEDLY(hr))
101  return hr;
102 
104  hr = psfCurrent->ParseDisplayName(NULL, NULL, bName, NULL, &relativePidl, NULL);
105  if (!SUCCEEDED(hr))
106  return S_FALSE;
107 
108  CComHeapPtr<ITEMIDLIST> combined;
109  combined.Attach(ILCombine(m_idlist, relativePidl));
110 
111  return ShellObjectCreatorInit<CFolderItem>(this, static_cast<LPITEMIDLIST>(combined), IID_PPV_ARG(FolderItem, ppid));
112 }
113 
115 {
116  TRACE("(%p, %s, %s)\n", this, wine_dbgstr_w(bName), wine_dbgstr_variant(&vOptions));
117  return E_NOTIMPL;
118 }
119 
121 {
122  TRACE("(%p, %s, %s)\n", this, wine_dbgstr_variant(&vItem), wine_dbgstr_variant(&vOptions));
123  return E_NOTIMPL;
124 }
125 
127 {
128  TRACE("(%p, %s, %s)\n", this, wine_dbgstr_variant(&vItem), wine_dbgstr_variant(&vOptions));
129  return E_NOTIMPL;
130 }
131 
133 {
134  TRACE("(%p, %s, %i, %p)\n", this, wine_dbgstr_variant(&vItem), iColumn, pbs);
135  return E_NOTIMPL;
136 }
137 
138 
139 // *** Folder2 methods ***
141 {
142  TRACE("(%p, %p)\n", this, ppfi);
143  if (!ppfi)
144  return E_POINTER;
145 
146  return ShellObjectCreatorInit<CFolderItem>(this, static_cast<LPITEMIDLIST>(m_idlist), IID_PPV_ARG(FolderItem, ppfi));
147 }
148 
150 {
151  TRACE("(%p, %p)\n", this, pul);
152  return E_NOTIMPL;
153 }
154 
156 {
157  TRACE("(%p)\n", this);
158  return E_NOTIMPL;
159 }
160 
162 {
163  TRACE("(%p, %p)\n", this, pbHaveToShowWebViewBarricade);
164  return E_NOTIMPL;
165 }
166 
168 {
169  TRACE("(%p)\n", this);
170  return E_NOTIMPL;
171 }
172 
173 
virtual HRESULT STDMETHODCALLTYPE NewFolder(BSTR bName, VARIANT vOptions)
Definition: CFolder.cpp:114
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
virtual HRESULT STDMETHODCALLTYPE Synchronize()
Definition: CFolder.cpp:155
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
HRESULT GetShellFolder(CComPtr< IShellFolder > &psfCurrent)
Definition: CFolder.cpp:27
HRESULT WINAPI CShellDispatch_Constructor(REFIID riid, LPVOID *ppvOut)
OLECHAR * BSTR
Definition: compat.h:1942
#define IID_PPV_ARG(Itype, ppType)
short VARIANT_BOOL
Definition: compat.h:1939
virtual HRESULT STDMETHODCALLTYPE get_HaveToShowWebViewBarricade(VARIANT_BOOL *pbHaveToShowWebViewBarricade)
Definition: CFolder.cpp:161
virtual HRESULT STDMETHODCALLTYPE ParseName(BSTR bName, FolderItem **ppid)
Definition: CFolder.cpp:91
virtual HRESULT STDMETHODCALLTYPE get_Parent(IDispatch **ppid)
Definition: CFolder.cpp:66
HRESULT Initialize(LPITEMIDLIST idlist)
Definition: CFolder.cpp:21
CComHeapPtr< ITEMIDLIST > m_idlist
Definition: CFolder.h:20
long LONG
Definition: pedump.c:60
virtual HRESULT STDMETHODCALLTYPE get_Application(IDispatch **ppid)
Definition: CFolder.cpp:53
#define S_FALSE
Definition: winerror.h:2357
virtual HRESULT STDMETHODCALLTYPE get_Self(FolderItem **ppfi)
Definition: CFolder.cpp:140
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type)
Definition: pidl.c:91
virtual HRESULT STDMETHODCALLTYPE get_OfflineStatus(LONG *pul)
Definition: CFolder.cpp:149
coclass Shell32::ShellFolderViewOC FolderItem
virtual HRESULT STDMETHODCALLTYPE GetDetailsOf(VARIANT vItem, int iColumn, BSTR *pbs)
Definition: CFolder.cpp:132
virtual HRESULT STDMETHODCALLTYPE get_Title(BSTR *pbs)
Definition: CFolder.cpp:39
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
__wchar_t WCHAR
Definition: xmlstorage.h:180
virtual HRESULT STDMETHODCALLTYPE get_ParentFolder(Folder **ppsf)
Definition: CFolder.cpp:76
LONG HRESULT
Definition: typedefs.h:77
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define MAX_PATH
Definition: compat.h:26
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
CComPtr< IShellDispatch > m_Application
Definition: CFolder.h:21
#define ILGDN_INFOLDER
Definition: undocshell.h:70
#define S_OK
Definition: intsafe.h:59
~CFolder()
Definition: CFolder.cpp:17
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define E_NOTIMPL
Definition: ddrawi.h:99
CFolder()
Definition: CFolder.cpp:13
WINE_DEFAULT_DEBUG_CHANNEL(shell)
virtual HRESULT STDMETHODCALLTYPE DismissedWebViewBarricade()
Definition: CFolder.cpp:167
virtual HRESULT STDMETHODCALLTYPE CopyHere(VARIANT vItem, VARIANT vOptions)
Definition: CFolder.cpp:126
virtual HRESULT STDMETHODCALLTYPE Items(FolderItems **ppid)
Definition: CFolder.cpp:85
#define E_POINTER
Definition: winerror.h:2365
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
virtual HRESULT STDMETHODCALLTYPE MoveHere(VARIANT vItem, VARIANT vOptions)
Definition: CFolder.cpp:120
#define SUCCEEDED(hr)
Definition: intsafe.h:57