ReactOS  0.4.14-dev-815-ge410a12
CFileSysEnum Class Reference
Inheritance diagram for CFileSysEnum:
Collaboration diagram for CFileSysEnum:

Public Member Functions

 CFileSysEnum ()
 
 ~CFileSysEnum ()
 
HRESULT WINAPI Initialize (LPWSTR sPathTarget, DWORD dwFlags)
 
- Public Member Functions inherited from CEnumIDListBase
 CEnumIDListBase ()
 
virtual ~CEnumIDListBase ()
 
BOOL AddToEnumList (LPITEMIDLIST pidl)
 
BOOL DeleteList ()
 
BOOL HasItemWithCLSID (LPITEMIDLIST pidl)
 
HRESULT AppendItemsFromEnumerator (IEnumIDList *pEnum)
 
virtual HRESULT STDMETHODCALLTYPE Next (ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched)
 
virtual HRESULT STDMETHODCALLTYPE Skip (ULONG celt)
 
virtual HRESULT STDMETHODCALLTYPE Reset ()
 
virtual HRESULT STDMETHODCALLTYPE Clone (IEnumIDList **ppenum)
 
- 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 IEnumIDList
HRESULT Next ([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] PITEMID_CHILD *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 ()
 

Additional Inherited Members

- Public Types inherited from IEnumIDList
typedef IEnumIDListLPENUMIDLIST
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- 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 349 of file CFSFolder.cpp.

Constructor & Destructor Documentation

◆ CFileSysEnum()

CFileSysEnum::CFileSysEnum ( )

Definition at line 363 of file CFSFolder.cpp.

364 {
365 }

◆ ~CFileSysEnum()

CFileSysEnum::~CFileSysEnum ( )

Definition at line 367 of file CFSFolder.cpp.

368 {
369 }

Member Function Documentation

◆ Initialize()

HRESULT WINAPI CFileSysEnum::Initialize ( LPWSTR  sPathTarget,
DWORD  dwFlags 
)

Definition at line 371 of file CFSFolder.cpp.

372 {
373  WIN32_FIND_DATAW stffile;
374  HANDLE hFile;
376  BOOL succeeded = TRUE;
377  static const WCHAR stars[] = { '*','.','*',0 };
378  static const WCHAR dot[] = { '.',0 };
379  static const WCHAR dotdot[] = { '.','.',0 };
380 
381  TRACE("(%p)->(path=%s flags=0x%08x)\n", this, debugstr_w(lpszPath), dwFlags);
382 
383  if(!lpszPath || !lpszPath[0]) return FALSE;
384 
385  wcscpy(szPath, lpszPath);
388 
389  hFile = FindFirstFileW(szPath,&stffile);
390  if ( hFile != INVALID_HANDLE_VALUE )
391  {
392  BOOL findFinished = FALSE;
393 
394 #define HIDDEN FILE_ATTRIBUTE_HIDDEN
395 #define SUPER_HIDDEN (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)
396 
397  do
398  {
399  if ((stffile.dwFileAttributes & HIDDEN) == 0 ||
400  ((dwFlags & SHCONTF_INCLUDEHIDDEN) &&
401  (stffile.dwFileAttributes & SUPER_HIDDEN) == HIDDEN) ||
402  ((dwFlags & SHCONTF_INCLUDESUPERHIDDEN) &&
403  (stffile.dwFileAttributes & SUPER_HIDDEN) == SUPER_HIDDEN))
404  {
405  LPITEMIDLIST pidl = NULL;
406 
407  if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
408  dwFlags & SHCONTF_FOLDERS &&
409  strcmpW(stffile.cFileName, dot) && strcmpW(stffile.cFileName, dotdot))
410  {
411  pidl = _ILCreateFromFindDataW(&stffile);
412  succeeded = succeeded && AddToEnumList(pidl);
413  }
414  else if (!(stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
415  && dwFlags & SHCONTF_NONFOLDERS)
416  {
417  pidl = _ILCreateFromFindDataW(&stffile);
418  succeeded = succeeded && AddToEnumList(pidl);
419  }
420  }
421  if (succeeded)
422  {
423  if (!FindNextFileW(hFile, &stffile))
424  {
426  findFinished = TRUE;
427  else
428  succeeded = FALSE;
429  }
430  }
431  } while (succeeded && !findFinished);
432  FindClose(hFile);
433  }
434 
435  return succeeded;
436 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define TRUE
Definition: types.h:120
BOOL AddToEnumList(LPITEMIDLIST pidl)
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
STAR * stars
Definition: screensaver.c:45
LPWSTR WINAPI PathAddBackslashW(LPWSTR lpszPath)
Definition: path.c:289
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SUPER_HIDDEN
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define HIDDEN
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ HANDLE hFile
Definition: mswsock.h:90
LPCWSTR szPath
Definition: env.c:35
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
LPITEMIDLIST _ILCreateFromFindDataW(const WIN32_FIND_DATAW *wfd)
Definition: pidl.c:1727
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

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