ReactOS  0.4.15-dev-499-g1f31905
EnumDirs.h File Reference
#include <windows.h>
Include dependency graph for EnumDirs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WIN32_LEAN_AND_MEAN
 

Typedefs

typedef BOOL(* MYENUMDIRSPROC) (PWIN32_FIND_DATA, long)
 

Functions

BOOL EnumDirs (const TCHAR *szDirectory, const TCHAR *szFileSpec, MYENUMDIRSPROC pProc, long lParam)
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 9 of file EnumDirs.h.

Typedef Documentation

◆ MYENUMDIRSPROC

typedef BOOL(* MYENUMDIRSPROC) (PWIN32_FIND_DATA, long)

Definition at line 12 of file EnumDirs.h.

Function Documentation

◆ EnumDirs()

BOOL EnumDirs ( const TCHAR szDirectory,
const TCHAR szFileSpec,
MYENUMDIRSPROC  pProc,
long  lParam 
)

Definition at line 12 of file EnumDirsImpl.h.

13 {
14  assert ( szDirectory_ && szFileSpec && pProc );
15  TCHAR szDirectory[MAX_PATH+1];
16  TCHAR szSearchPath[MAX_PATH+1];
17  TCHAR szTemp[MAX_PATH+1];
18  _tcscpy ( szDirectory, szDirectory_ );
19  if ( szDirectory[_tcslen(szDirectory)-1] != '\\' )
20  _tcscat ( szDirectory, _T("\\") );
21  _sntprintf ( szSearchPath, _MAX_PATH, _T("%s%s"), szDirectory, szFileSpec );
22  WIN32_FIND_DATA wfd;
23  HANDLE hfind = FindFirstFile ( szSearchPath, &wfd );
24  if ( hfind == INVALID_HANDLE_VALUE )
25  return TRUE;
26  do
27  {
28  if ( !_tcscmp ( wfd.cFileName, _T(".") ) || !_tcscmp ( wfd.cFileName, _T("..") ) )
29  continue;
30  _sntprintf ( szTemp, _MAX_PATH, _T("%s%s"), szDirectory, wfd.cFileName );
31  if ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
32  {
33  if ( !pProc ( &wfd, lParam ) )
34  {
35  FindClose ( hfind );
36  return FALSE;
37  }
38  }
39  } while ( FindNextFile ( hfind, &wfd ) );
40  FindClose ( hfind );
41  return TRUE;
42 }
#define TRUE
Definition: types.h:120
int _tcscmp(const _TCHAR *s1, const _TCHAR *s2)
Definition: tcscmp.h:8
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
#define assert(x)
Definition: debug.h:53
#define _MAX_PATH
Definition: utility.h:77
size_t __cdecl _tcslen(const _TCHAR *str)
Definition: tcslen.h:9
#define FindFirstFile
Definition: winbase.h:3622
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
char TCHAR
Definition: xmlstorage.h:189
#define _T(x)
Definition: vfdio.h:22
#define FindNextFile
Definition: winbase.h:3628
#define MAX_PATH
Definition: compat.h:26
#define _sntprintf
Definition: xmlstorage.h:201
_TCHAR * _tcscat(_TCHAR *s, const _TCHAR *append)
Definition: tcscat.h:8
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502