Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.9 KiB

  1. /**************************************************************************************************
  2. FILENAME: FastFat2.h
  3. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  4. DESCRIPTION:
  5. Fat file sytem prototypes.
  6. **************************************************************************************************/
  7. // Define some special character codes used in FAT directory entries
  8. #define Deleted 0xe5 //The code placed in the first byte of the filename on a deleted fat entry.
  9. #define DirPointer 0x2e //The code placed in the first byte of the filename on a Directory Pointer fat entry.
  10. //The attribute field of a FAT entry can be set to any of the following (which identifies what kind of entry it is):
  11. #define EndOfDirectory 0x0
  12. #define LabelAttribute 0x8
  13. #define DirAttribute 0x10
  14. #define UnicodeAttribute 0x0F
  15. #define MaxDirs 128 //We cannnot have a directory tree more than 128 directories deep.
  16. //Flags for which types of FAT entries are kept by StripDir (see StripDir() below).
  17. #define KEEP_DIRECTORIES 0x01
  18. #define KEEP_FILES 0x02
  19. #define KEEP_DELDIRECTORIES 0x04
  20. #define KEEP_DELFILES 0x08
  21. typedef struct {
  22. HANDLE FatTreeHandles[MaxDirs]; //Handles to each FAT directory in our chain
  23. DIRSTRUC* pCurrentFatDir; //Pointer to the beginning of the current FAT directory
  24. DIRSTRUC* pCurrentFatDirEnd; //Pointer to the end of the current FAT directory
  25. DIRSTRUC* pCurrentEntry; //Pointer to the current entry in the current FAT directory
  26. DWORD dwCurrentEntryNum; //Number of the current entry in the current FAT directory
  27. DWORD CurrentEntryPos[MaxDirs]; //Number of the current entry in each level of the FAT chain
  28. TCHAR DirName[MaxDirs][MAX_PATH]; //Name of each directory at each level of our FAT chain
  29. DWORD dwCurrentLevel; //Which level we're at - 0 is root.
  30. BOOL bMovedUp; //If we moved up a directory, files have already been processed at this level.
  31. BOOL bProcessingFiles; //Whether or not we are processing files at this level (as compared to directories).
  32. LONGLONG llCurrentFatDirLcn[MaxDirs]; //LCN of the current FAT Directory
  33. } TREE_DATA;
  34. //extern TREE_DATA TreeData;
  35. //
  36. // Routine Declarations
  37. //
  38. //Gets data from the boot sector of a FAT drive. Initializes NextFatFile.
  39. BOOLEAN
  40. GetFatBootSector(
  41. );
  42. //Gets one at a time files on a FAT drive by directly traversing a directory tree.
  43. BOOL
  44. NextFatFile(
  45. );
  46. //Strips a directory of unused/unwanted entries. Called by NextFatFile.
  47. BOOL
  48. StripDir(
  49. TREE_DATA* pTreeData,
  50. DWORD dwFlags
  51. );
  52. //Reads a new directory from the disk. Called by NextFatFile.
  53. BOOL
  54. LoadDir(
  55. TREE_DATA* pTreeData
  56. );
  57. //Gets the unicode name for a file from its directory. Called by NextFatFile.
  58. BOOL
  59. GetUnicodeName(
  60. TREE_DATA* pTreeData,
  61. VString &unicodeName
  62. );
  63. //Gets the full unicode path for a file by traversing up it's directory tree. Called by NextFatFile.
  64. BOOL
  65. GetUnicodePath(
  66. IN TREE_DATA* pTreeData,
  67. OUT VString &unicodePath
  68. );