// ************************************************************************** // * This file is part of the FreeFileSync project. It is distributed under * // * GNU General Public License: http://www.gnu.org/licenses/gpl.html * // * Copyright (C) 2008-2011 ZenJu (zhnmju123 AT gmx.de) * // ************************************************************************** #ifndef FIND_FIRST_FILE_PLUS_HEADER_087483434 #define FIND_FIRST_FILE_PLUS_HEADER_087483434 #ifdef FIND_FILE_PLUS_DLL_EXPORTS #define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllexport) #else #define DLL_FUNCTION_DECLARATION extern "C" __declspec(dllimport) #endif #ifdef FIND_FILE_PLUS_DLL_EXPORTS #include //driver level headers must be included *before* windows api headers! #endif #include // #undef min #undef max #include namespace findplus { /*-------------- |declarations| --------------*/ struct FileInformation { FILETIME creationTime; FILETIME lastWriteTime; ULARGE_INTEGER fileSize; ULARGE_INTEGER fileId; DWORD fileAttributes; DWORD shortNameLength; WCHAR shortName[MAX_PATH + 1]; //shortName is 0-terminated }; //no need for #pragma pack -> all members already starting at 4 byte boundary! class FileSearcher; typedef FileSearcher* FindHandle; DLL_FUNCTION_DECLARATION FindHandle openDir(const wchar_t* dirname); //returns NULL on error, call ::GetLastError() //note: do NOT place an asterisk at end, e.g. C:\SomeDir\*, as one would do for ::FindFirstFile() DLL_FUNCTION_DECLARATION bool readDir(FindHandle hnd, FileInformation& output); //returns false on error or if there are no more files; ::GetLastError() returns ERROR_NO_MORE_FILES in this case DLL_FUNCTION_DECLARATION void closeDir(FindHandle hnd); /*---------- |typedefs| ----------*/ typedef FindHandle (*OpenDirFunc )(const wchar_t* dirname); typedef bool (*ReadDirFunc )(FindHandle hnd, FileInformation& dirInfo); typedef void (*CloseDirFunc)(FindHandle hnd); /*-------------- |symbol names| --------------*/ //const pointers ensure internal linkage const char openDirFuncName [] = "openDir"; const char readDirFuncName [] = "readDir"; const char closeDirFuncName[] = "closeDir"; /*--------------- |library names| ---------------*/ inline const wchar_t* getDllName() { return zen::is64BitBuild ? L"FindFilePlus_x64.dll" : L"FindFilePlus_Win32.dll"; } } #endif //FIND_FIRST_FILE_PLUS_HEADER_087483434