+#endif
+
+// ----------------------------------------------------------------------------
+// define the types and functions used for file searching
+// ----------------------------------------------------------------------------
+
+typedef FILEFINDBUF3 FIND_STRUCT;
+typedef HDIR FIND_DATA;
+typedef ULONG FIND_ATTR;
+
+static inline FIND_DATA InitFindData() { return ERROR_INVALID_HANDLE; }
+
+static inline bool IsFindDataOk(
+ FIND_DATA vFd
+)
+{
+ return vFd != ERROR_INVALID_HANDLE;
+}
+
+static inline void FreeFindData(
+ FIND_DATA vFd
+)
+{
+ if (!::DosFindClose(vFd))
+ {
+ wxLogLastError(_T("DosFindClose"));
+ }
+}
+
+static inline FIND_DATA FindFirst(
+ const wxString& rsSpec
+, FIND_STRUCT* pFinddata
+)
+{
+ ULONG ulFindCount = 1;
+ FIND_DATA hDir = HDIR_CREATE;
+ FIND_ATTR rc;
+
+ rc = ::DosFindFirst( (PSZ)rsSpec.c_str()
+ ,&hDir
+ ,0x37 // was: FILE_NORMAL
+ ,pFinddata
+ ,sizeof(FILEFINDBUF3)
+ ,&ulFindCount
+ ,FIL_STANDARD
+ );
+ if (rc != 0)
+ return InitFindData();
+ return hDir;
+}
+
+static inline bool FindNext(
+ FIND_DATA vFd
+, FIND_STRUCT* pFinddata
+)
+{
+ ULONG ulFindCount = 1;
+
+ return ::DosFindNext( vFd
+ ,pFinddata
+ ,sizeof(FILEFINDBUF3)
+ ,&ulFindCount
+ ) == 0;
+}
+
+static const wxChar* GetNameFromFindData(
+ FIND_STRUCT* pFinddata
+)
+{
+ return (wxChar*)pFinddata->achName;
+}
+
+static const FIND_ATTR GetAttrFromFindData(
+ FIND_STRUCT* pFinddata
+)
+{
+ return pFinddata->attrFile;
+}
+
+static inline bool IsDir(
+ FIND_ATTR vAttr
+)
+{
+ return (vAttr & FILE_DIRECTORY) != 0;
+}
+
+static inline bool IsHidden(
+ FIND_ATTR vAttr
+)
+{
+ return (vAttr & (FILE_HIDDEN | FILE_SYSTEM)) != 0;
+}
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+#ifndef MAX_PATH
+ #define MAX_PATH 260 // from PM++ headers