dirent_win.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <util/system/defaults.h>
  3. #ifdef _win_
  4. #include <util/system/winint.h>
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. struct DIR {
  9. HANDLE sh;
  10. WIN32_FIND_DATAW wfd;
  11. WCHAR* fff_templ;
  12. int file_no;
  13. struct dirent* readdir_buf;
  14. };
  15. #define MAXNAMLEN (MAX_PATH - 1) * 2
  16. #define MAXPATHLEN MAX_PATH
  17. #define DT_DIR 4
  18. #define DT_REG 8
  19. #define DT_LNK 10
  20. #define DT_UNKNOWN 0
  21. struct dirent {
  22. ui32 d_fileno; /* file number of entry */
  23. ui16 d_reclen; /* length of this record */
  24. ui8 d_type; /* file type */
  25. ui8 d_namlen; /* length of string in d_name */
  26. char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */
  27. };
  28. struct DIR* opendir(const char* dirname);
  29. int closedir(struct DIR* dir);
  30. int readdir_r(struct DIR* dir, struct dirent* entry, struct dirent** result);
  31. struct dirent* readdir(struct DIR* dir);
  32. void rewinddir(struct DIR* dir);
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif //_win_