ReactOS 0.4.15-dev-8222-g9164419
EnumDirsImpl.h File Reference
#include "EnumDirs.h"
#include <stdio.h>
Include dependency graph for EnumDirsImpl.h:

Go to the source code of this file.

Functions

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

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 );
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}
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
#define assert(x)
Definition: debug.h:53
#define _tcscmp
Definition: tchar.h:1424
#define _tcscat
Definition: tchar.h:622
#define _tcscpy
Definition: tchar.h:623
#define _MAX_PATH
Definition: utility.h:77
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define _T(x)
Definition: vfdio.h:22
#define FindNextFile
Definition: winbase.h:3788
#define FindFirstFile
Definition: winbase.h:3782
char TCHAR
Definition: xmlstorage.h:189
#define _sntprintf
Definition: xmlstorage.h:201
#define _tcslen
Definition: xmlstorage.h:198