ReactOS  0.4.15-dev-1377-ga59cecd
CACListISF Class Reference

#include <aclistisf.h>

Inheritance diagram for CACListISF:
Collaboration diagram for CACListISF:

Public Member Functions

 CACListISF ()
 
 ~CACListISF ()
 
HRESULT NextLocation ()
 
HRESULT SetLocation (LPITEMIDLIST pidl)
 
HRESULT GetDisplayName (LPCITEMIDLIST pidlChild, CComHeapPtr< WCHAR > &pszChild)
 
HRESULT GetPathName (LPCITEMIDLIST pidlChild, CComHeapPtr< WCHAR > &pszPath)
 
STDMETHODIMP Next (ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched) override
 
STDMETHODIMP Skip (ULONG celt) override
 
STDMETHODIMP Reset () override
 
STDMETHODIMP Clone (IEnumString **ppenum) override
 
STDMETHODIMP Expand (LPCOLESTR pszExpand) override
 
STDMETHODIMP SetOptions (DWORD dwFlag) override
 
STDMETHODIMP GetOptions (DWORD *pdwFlag) override
 
virtual STDMETHODIMP SetOwner (IUnknown *punkOwner) override
 
virtual STDMETHODIMP GetClassID (CLSID *pClassID) override
 
virtual STDMETHODIMP Initialize (PCIDLIST_ABSOLUTE pidl) override
 
STDMETHODIMP GetDirectory (LPWSTR pwzPath, DWORD cchSize) override
 
STDMETHODIMP SetDirectory (LPCWSTR pwzPath) 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 ()
 
- Public Member Functions inherited from IEnumString
HRESULT RemoteNext ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] LPOLESTR *rgelt, [out] ULONG *pceltFetched)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Types

enum  LOCATION_TYPE {
  LT_DIRECTORY, LT_DESKTOP, LT_MYCOMPUTER, LT_FAVORITES,
  LT_MAX
}
 

Private Attributes

DWORD m_dwOptions
 
LOCATION_TYPE m_iNextLocation
 
BOOL m_fShowHidden
 
CStringW m_szExpand
 
CComHeapPtr< ITEMIDLISTm_pidlLocation
 
CComHeapPtr< ITEMIDLISTm_pidlCurDir
 
CComPtr< IEnumIDListm_pEnumIDList
 
CComPtr< IShellFolderm_pShellFolder
 
CComPtr< IBrowserServicem_pBrowserService
 

Additional Inherited Members

- Public Types inherited from IEnumString
typedef IEnumStringLPENUMSTRING
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- 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
 

Detailed Description

Definition at line 24 of file aclistisf.h.

Member Enumeration Documentation

◆ LOCATION_TYPE

Enumerator
LT_DIRECTORY 
LT_DESKTOP 
LT_MYCOMPUTER 
LT_FAVORITES 
LT_MAX 

Definition at line 34 of file aclistisf.h.

Constructor & Destructor Documentation

◆ CACListISF()

CACListISF::CACListISF ( )

Definition at line 24 of file aclistisf.cpp.

28 {
29 }
#define FALSE
Definition: types.h:117
#define ACLO_CURRENTDIR
Definition: shlobj.h:740
BOOL m_fShowHidden
Definition: aclistisf.h:45
LOCATION_TYPE m_iNextLocation
Definition: aclistisf.h:44
DWORD m_dwOptions
Definition: aclistisf.h:43
#define ACLO_MYCOMPUTER
Definition: shlobj.h:741

◆ ~CACListISF()

CACListISF::~CACListISF ( )

Definition at line 31 of file aclistisf.cpp.

32 {
33 }

Member Function Documentation

◆ Clone()

STDMETHODIMP CACListISF::Clone ( IEnumString **  ppenum)
override

Implements IEnumString.

Definition at line 318 of file aclistisf.cpp.

319 {
320  TRACE("(%p, %p)\n", this, ppOut);
321  *ppOut = NULL;
322  return E_NOTIMPL;
323 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112

◆ Expand()

STDMETHODIMP CACListISF::Expand ( LPCOLESTR  pszExpand)
override

Definition at line 326 of file aclistisf.cpp.

327 {
328  TRACE("(%p, %ls)\n", this, pszExpand);
329 
330  m_szExpand = pszExpand;
331 
335  if (SUCCEEDED(hr))
336  {
337  hr = SetLocation(pidl.Detach());
338  if (FAILED_UNEXPECTEDLY(hr))
339  m_szExpand = L"";
340  }
341  return hr;
342 }
HRESULT hr
Definition: shlfolder.c:183
if SUCCEEDED(hr)
LOCATION_TYPE m_iNextLocation
Definition: aclistisf.h:44
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
static const WCHAR L[]
Definition: oid.c:1250
HRESULT SetLocation(LPITEMIDLIST pidl)
Definition: aclistisf.cpp:109
HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc, LPITEMIDLIST *ppidl, SFGAOF sfgaoIn, SFGAOF *psfgaoOut)
Definition: pidl.c:1381
#define NULL
Definition: types.h:112
CStringW m_szExpand
Definition: aclistisf.h:46

◆ GetClassID()

STDMETHODIMP CACListISF::GetClassID ( CLSID pClassID)
overridevirtual

Implements IPersist.

Definition at line 373 of file aclistisf.cpp.

374 {
375  TRACE("(%p, %p)\n", this, pClassID);
376  if (pClassID == NULL)
377  return E_POINTER;
378  *pClassID = CLSID_ACListISF;
379  return S_OK;
380 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
#define E_POINTER
Definition: winerror.h:2365

◆ GetDirectory()

STDMETHODIMP CACListISF::GetDirectory ( LPWSTR  pwzPath,
DWORD  cchSize 
)
override

Definition at line 401 of file aclistisf.cpp.

402 {
403  TRACE("(%p, %p, %ld)\n", this, pwzPath, cchSize);
404  return E_NOTIMPL;
405 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetDisplayName()

HRESULT CACListISF::GetDisplayName ( LPCITEMIDLIST  pidlChild,
CComHeapPtr< WCHAR > &  pszChild 
)

Definition at line 153 of file aclistisf.cpp.

154 {
155  TRACE("(%p, %p)\n", this, pidlChild);
156  pszChild.Free();
157 
158  STRRET StrRet;
159  DWORD dwFlags = SHGDN_INFOLDER | SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
160  HRESULT hr = m_pShellFolder->GetDisplayNameOf(pidlChild, dwFlags, &StrRet);
161  if (FAILED(hr))
162  {
163  dwFlags = SHGDN_INFOLDER | SHGDN_FORPARSING;
164  hr = m_pShellFolder->GetDisplayNameOf(pidlChild, dwFlags, &StrRet);
165  if (FAILED_UNEXPECTEDLY(hr))
166  return hr;
167  }
168 
169  hr = StrRetToStrW(&StrRet, NULL, &pszChild);
170  if (FAILED_UNEXPECTEDLY(hr))
171  return hr;
172 
173  TRACE("pszChild: '%S'\n", static_cast<LPCWSTR>(pszChild));
174  return hr;
175 }
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IShellFolder > m_pShellFolder
Definition: aclistisf.h:50
#define StrRet
Definition: shellclasses.h:871
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define NULL
Definition: types.h:112
HRESULT WINAPI StrRetToStrW(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *ppszName)
Definition: string.c:1623

Referenced by GetPathName().

◆ GetOptions()

STDMETHODIMP CACListISF::GetOptions ( DWORD pdwFlag)
override

Definition at line 352 of file aclistisf.cpp.

353 {
354  TRACE("(%p, %p)\n", this, pdwFlag);
355  if (pdwFlag)
356  {
357  *pdwFlag = m_dwOptions;
358  return S_OK;
359  }
360  return E_INVALIDARG;
361 }
#define E_INVALIDARG
Definition: ddrawi.h:101
DWORD m_dwOptions
Definition: aclistisf.h:43
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ GetPathName()

HRESULT CACListISF::GetPathName ( LPCITEMIDLIST  pidlChild,
CComHeapPtr< WCHAR > &  pszPath 
)

Definition at line 177 of file aclistisf.cpp.

178 {
179  TRACE("(%p, %p)\n", this, pidlChild);
180 
181  CComHeapPtr<WCHAR> pszChild;
182  HRESULT hr = GetDisplayName(pidlChild, pszChild);
183  if (FAILED_UNEXPECTEDLY(hr))
184  return hr;
185 
188  {
189  INT cchExpand = m_szExpand.GetLength();
190  if (StrCmpNIW(pszChild, m_szExpand, cchExpand) != 0 ||
191  pszChild[0] != L'\\' || pszChild[1] != L'\\')
192  {
193  szPath = m_szExpand;
194  }
195  }
196  szPath += pszChild;
197 
198  INT cchMax = szPath.GetLength() + 1;
199  CComHeapPtr<WCHAR> pszFullPath;
200  if (!pszFullPath.Allocate(cchMax))
201  {
202  ERR("Out of memory\n");
203  return E_OUTOFMEMORY;
204  }
205 
206  StringCchCopyW(pszFullPath, cchMax, szPath);
207  pszPath.Attach(pszFullPath.Detach());
208  TRACE("pszPath: '%S'\n", static_cast<LPCWSTR>(pszPath));
209  return S_OK;
210 }
int GetLength() const
Definition: atlsimpstr.h:356
HRESULT hr
Definition: shlfolder.c:183
int32_t INT
Definition: typedefs.h:58
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
bool Allocate(_In_ size_t nElements=1)
Definition: atlalloc.h:143
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
HRESULT GetDisplayName(LPCITEMIDLIST pidlChild, CComHeapPtr< WCHAR > &pszChild)
Definition: aclistisf.cpp:153
LOCATION_TYPE m_iNextLocation
Definition: aclistisf.h:44
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
UINT cchMax
static const WCHAR L[]
Definition: oid.c:1250
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
LPCWSTR szPath
Definition: env.c:35
CStringW m_szExpand
Definition: aclistisf.h:46
INT WINAPI StrCmpNIW(LPCWSTR lpszStr, LPCWSTR lpszComp, INT iLen)
Definition: string.c:311

Referenced by Next().

◆ Initialize()

STDMETHODIMP CACListISF::Initialize ( PCIDLIST_ABSOLUTE  pidl)
overridevirtual

Implements IPersistFolder.

Definition at line 383 of file aclistisf.cpp.

384 {
385  TRACE("(%p, %p)\n", this, pidl);
386  m_pidlCurDir.Free();
387  if (!pidl)
388  return S_OK;
389 
390  LPITEMIDLIST pidlClone = ILClone(pidl);
391  if (!pidlClone)
392  {
393  ERR("Out of memory\n");
394  return E_OUTOFMEMORY;
395  }
396  m_pidlCurDir.Attach(pidlClone);
397  return S_OK;
398 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
CComHeapPtr< ITEMIDLIST > m_pidlCurDir
Definition: aclistisf.h:48
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

Referenced by Reset().

◆ Next()

STDMETHODIMP CACListISF::Next ( ULONG  celt,
LPOLESTR rgelt,
ULONG pceltFetched 
)
override

Implements IEnumString.

Definition at line 213 of file aclistisf.cpp.

214 {
215  TRACE("(%p, %d, %p, %p)\n", this, celt, rgelt, pceltFetched);
216 
217  if (celt == 0)
218  return S_OK;
219  if (!rgelt)
220  return S_FALSE;
221 
222  *rgelt = NULL;
223  if (pceltFetched)
224  *pceltFetched = 0;
225 
226  if (!m_pEnumIDList)
227  {
228  NextLocation();
229  if (!m_pEnumIDList)
230  return S_FALSE;
231  }
232 
233  HRESULT hr;
234  CComHeapPtr<ITEMIDLIST> pidlChild;
235  CComHeapPtr<WCHAR> pszPathName;
236 
237  do
238  {
239  for (;;)
240  {
241  pidlChild.Free();
242  hr = m_pEnumIDList->Next(1, &pidlChild, NULL);
243  if (hr != S_OK)
244  break;
245 
246  pszPathName.Free();
247  GetPathName(pidlChild, pszPathName);
248  if (!pszPathName)
249  continue;
250 
252  {
253  DWORD attrs = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
254  hr = m_pShellFolder->GetAttributesOf(1, const_cast<LPCITEMIDLIST *>(&pidlChild), &attrs);
255  if (SUCCEEDED(hr))
256  {
257  if (!(attrs & (SFGAO_FILESYSTEM | SFGAO_FILESYSANCESTOR)))
258  continue;
259  }
260  }
261 
262  if ((m_dwOptions & ACLO_FILESYSDIRS) && !PathIsDirectoryW(pszPathName))
263  continue;
264 
265  hr = S_OK;
266  break;
267  }
268  } while (hr == S_FALSE && NextLocation() == S_OK);
269 
270  if (hr == S_OK)
271  {
272  *rgelt = pszPathName.Detach();
273  if (pceltFetched)
274  *pceltFetched = 1;
275  }
276  else
277  {
278  hr = S_FALSE;
279  }
280 
281  TRACE("*rgelt: %S\n", *rgelt);
282  return hr;
283 }
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1702
#define ACLO_FILESYSONLY
Definition: shlobj.h:744
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IEnumIDList > m_pEnumIDList
Definition: aclistisf.h:49
#define ACLO_FILESYSDIRS
Definition: shlobj.h:745
HRESULT GetPathName(LPCITEMIDLIST pidlChild, CComHeapPtr< WCHAR > &pszPath)
Definition: aclistisf.cpp:177
CComPtr< IShellFolder > m_pShellFolder
Definition: aclistisf.h:50
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
DWORD m_dwOptions
Definition: aclistisf.h:43
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT NextLocation()
Definition: aclistisf.cpp:35
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112

◆ NextLocation()

HRESULT CACListISF::NextLocation ( )

Definition at line 35 of file aclistisf.cpp.

36 {
37  TRACE("(%p)\n", this);
38  HRESULT hr;
39  switch (m_iNextLocation)
40  {
41  case LT_DIRECTORY:
44  {
46  hr = SetLocation(pidl.Detach());
47  if (SUCCEEDED(hr))
48  {
49  TRACE("LT_DIRECTORY\n");
50  return hr;
51  }
52  }
53  // FALL THROUGH
54  case LT_DESKTOP:
57  {
61  return S_FALSE;
62  hr = SetLocation(pidl.Detach());
63  if (SUCCEEDED(hr))
64  {
65  TRACE("LT_DESKTOP\n");
66  return hr;
67  }
68  }
69  // FALL THROUGH
70  case LT_MYCOMPUTER:
73  {
77  return S_FALSE;
78  hr = SetLocation(pidl.Detach());
79  if (SUCCEEDED(hr))
80  {
81  TRACE("LT_MYCOMPUTER\n");
82  return hr;
83  }
84  }
85  // FALL THROUGH
86  case LT_FAVORITES:
89  {
93  return S_FALSE;
94  hr = SetLocation(pidl.Detach());
95  if (SUCCEEDED(hr))
96  {
97  TRACE("LT_FAVORITES\n");
98  return hr;
99  }
100  }
101  // FALL THROUGH
102  case LT_MAX:
103  default:
104  TRACE("LT_MAX\n");
105  return S_FALSE;
106  }
107 }
HRESULT hr
Definition: shlfolder.c:183
#define CSIDL_DESKTOP
Definition: shlobj.h:2012
static BOOL ILIsEmpty(_In_opt_ PCUIDLIST_RELATIVE pidl)
Definition: shlobj.h:2336
#define CSIDL_DRIVES
Definition: shlobj.h:2028
#define ACLO_CURRENTDIR
Definition: shlobj.h:740
#define CSIDL_FAVORITES
Definition: shlobj.h:2018
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
LOCATION_TYPE m_iNextLocation
Definition: aclistisf.h:44
DWORD m_dwOptions
Definition: aclistisf.h:43
#define ACLO_MYCOMPUTER
Definition: shlobj.h:741
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:2830
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define ACLO_DESKTOP
Definition: shlobj.h:742
CComHeapPtr< ITEMIDLIST > m_pidlCurDir
Definition: aclistisf.h:48
HRESULT SetLocation(LPITEMIDLIST pidl)
Definition: aclistisf.cpp:109
#define ACLO_FAVORITES
Definition: shlobj.h:743
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
#define NULL
Definition: types.h:112

Referenced by Next().

◆ Reset()

STDMETHODIMP CACListISF::Reset ( void  )
override

Implements IEnumString.

Definition at line 285 of file aclistisf.cpp.

286 {
287  TRACE("(%p)\n", this);
288 
290  m_szExpand = L"";
291 
292  SHELLSTATE ss = { 0 };
294  m_fShowHidden = ss.fShowAllObjects;
295 
297  {
299  if (m_pBrowserService)
300  {
301  m_pBrowserService->GetPidl(&pidl);
302  if (pidl)
303  Initialize(pidl);
304  }
305  HRESULT hr = SetLocation(pidl.Detach());
306  if (FAILED_UNEXPECTEDLY(hr))
307  return S_FALSE;
308  }
309  return S_OK;
310 }
HRESULT hr
Definition: shlfolder.c:183
virtual STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidl) override
Definition: aclistisf.cpp:383
#define FALSE
Definition: types.h:117
#define ACLO_CURRENTDIR
Definition: shlobj.h:740
#define S_FALSE
Definition: winerror.h:2357
BOOL m_fShowHidden
Definition: aclistisf.h:45
VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
Definition: shellord.c:201
#define SSF_SHOWALLOBJECTS
Definition: shlobj.h:1527
LOCATION_TYPE m_iNextLocation
Definition: aclistisf.h:44
DWORD m_dwOptions
Definition: aclistisf.h:43
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
static const WCHAR L[]
Definition: oid.c:1250
HRESULT SetLocation(LPITEMIDLIST pidl)
Definition: aclistisf.cpp:109
#define S_OK
Definition: intsafe.h:51
#define ss
Definition: i386-dis.c:434
CStringW m_szExpand
Definition: aclistisf.h:46
CComPtr< IBrowserService > m_pBrowserService
Definition: aclistisf.h:51

◆ SetDirectory()

STDMETHODIMP CACListISF::SetDirectory ( LPCWSTR  pwzPath)
override

Definition at line 407 of file aclistisf.cpp.

408 {
409  TRACE("(%p, %ls, %ld)\n", this, pwzPath);
410  LPITEMIDLIST pidl = ILCreateFromPathW(pwzPath);
411  if (!pidl)
412  {
413  ERR("Out of memory\n");
414  return E_OUTOFMEMORY;
415  }
416  m_pidlCurDir.Attach(pidl);
417  return S_OK;
418 }
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
CComHeapPtr< ITEMIDLIST > m_pidlCurDir
Definition: aclistisf.h:48
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
LPITEMIDLIST WINAPI ILCreateFromPathW(LPCWSTR path)
Definition: pidl.c:982
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41

◆ SetLocation()

HRESULT CACListISF::SetLocation ( LPITEMIDLIST  pidl)

Definition at line 109 of file aclistisf.cpp.

110 {
111  TRACE("(%p, %p)\n", this, pidl);
112 
113  m_pEnumIDList.Release();
115  m_pidlLocation.Free();
116 
117  if (!pidl)
118  return E_FAIL;
119 
120  m_pidlLocation.Attach(pidl);
121 
122  CComPtr<IShellFolder> pFolder;
123  HRESULT hr = SHGetDesktopFolder(&pFolder);
124  if (FAILED_UNEXPECTEDLY(hr))
125  return hr;
126 
127  if (!ILIsEmpty(pidl))
128  {
129  hr = pFolder->BindToObject(pidl, NULL, IID_PPV_ARG(IShellFolder, &m_pShellFolder));
130  if (FAILED_UNEXPECTEDLY(hr))
131  return hr;
132  }
133  else
134  {
135  m_pShellFolder.Attach(pFolder.Detach());
136  }
137 
138  SHCONTF Flags = SHCONTF_FOLDERS | SHCONTF_INIT_ON_FIRST_NEXT;
139  if (m_fShowHidden)
140  Flags |= SHCONTF_INCLUDEHIDDEN;
141  if (!(m_dwOptions & ACLO_FILESYSDIRS))
142  Flags |= SHCONTF_NONFOLDERS;
143 
144  hr = m_pShellFolder->EnumObjects(NULL, Flags, &m_pEnumIDList);
145  if (hr != S_OK)
146  {
147  ERR("EnumObjects failed: 0x%lX\n", hr);
148  hr = E_FAIL;
149  }
150  return hr;
151 }
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IEnumIDList > m_pEnumIDList
Definition: aclistisf.h:49
static BOOL ILIsEmpty(_In_opt_ PCUIDLIST_RELATIVE pidl)
Definition: shlobj.h:2336
#define ACLO_FILESYSDIRS
Definition: shlobj.h:745
CComHeapPtr< ITEMIDLIST > m_pidlLocation
Definition: aclistisf.h:47
CComPtr< IShellFolder > m_pShellFolder
Definition: aclistisf.h:50
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
BOOL m_fShowHidden
Definition: aclistisf.h:45
DWORD m_dwOptions
Definition: aclistisf.h:43
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LONG HRESULT
Definition: typedefs.h:79
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
void Release()
Definition: atlcomcli.h:140
#define NULL
Definition: types.h:112
T * Detach()
Definition: atlcomcli.h:156
static SHCONTF
Definition: ordinal.c:61
void Attach(T *lp)
Definition: atlcomcli.h:149

Referenced by Expand(), NextLocation(), and Reset().

◆ SetOptions()

STDMETHODIMP CACListISF::SetOptions ( DWORD  dwFlag)
override

Definition at line 345 of file aclistisf.cpp.

346 {
347  TRACE("(%p, %lu)\n", this, dwFlag);
348  m_dwOptions = dwFlag;
349  return S_OK;
350 }
DWORD m_dwOptions
Definition: aclistisf.h:43
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ SetOwner()

STDMETHODIMP CACListISF::SetOwner ( IUnknown punkOwner)
overridevirtual

Implements IShellService.

Definition at line 364 of file aclistisf.cpp.

365 {
366  TRACE("(%p, %p)\n", this, punkOwner);
367  m_pBrowserService.Release();
369  return S_OK;
370 }
#define IID_PPV_ARG(Itype, ppType)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
CComPtr< IBrowserService > m_pBrowserService
Definition: aclistisf.h:51

◆ Skip()

STDMETHODIMP CACListISF::Skip ( ULONG  celt)
override

Implements IEnumString.

Definition at line 312 of file aclistisf.cpp.

313 {
314  TRACE("(%p, %d)\n", this, celt);
315  return E_NOTIMPL;
316 }
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99

Member Data Documentation

◆ m_dwOptions

DWORD CACListISF::m_dwOptions
private

Definition at line 43 of file aclistisf.h.

Referenced by GetOptions(), Next(), NextLocation(), Reset(), SetLocation(), and SetOptions().

◆ m_fShowHidden

BOOL CACListISF::m_fShowHidden
private

Definition at line 45 of file aclistisf.h.

Referenced by Reset(), and SetLocation().

◆ m_iNextLocation

LOCATION_TYPE CACListISF::m_iNextLocation
private

Definition at line 44 of file aclistisf.h.

Referenced by Expand(), GetPathName(), NextLocation(), and Reset().

◆ m_pBrowserService

CComPtr<IBrowserService> CACListISF::m_pBrowserService
private

Definition at line 51 of file aclistisf.h.

Referenced by Reset(), and SetOwner().

◆ m_pEnumIDList

CComPtr<IEnumIDList> CACListISF::m_pEnumIDList
private

Definition at line 49 of file aclistisf.h.

Referenced by Next(), and SetLocation().

◆ m_pidlCurDir

CComHeapPtr<ITEMIDLIST> CACListISF::m_pidlCurDir
private

Definition at line 48 of file aclistisf.h.

Referenced by Initialize(), NextLocation(), and SetDirectory().

◆ m_pidlLocation

CComHeapPtr<ITEMIDLIST> CACListISF::m_pidlLocation
private

Definition at line 47 of file aclistisf.h.

Referenced by SetLocation().

◆ m_pShellFolder

CComPtr<IShellFolder> CACListISF::m_pShellFolder
private

Definition at line 50 of file aclistisf.h.

Referenced by GetDisplayName(), Next(), and SetLocation().

◆ m_szExpand

CStringW CACListISF::m_szExpand
private

Definition at line 46 of file aclistisf.h.

Referenced by Expand(), GetPathName(), and Reset().


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