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.

130 lines
4.1 KiB

  1. /*+-------------------------------------------------------------------------+
  2. | Copyright 1993-1994 (C) Microsoft Corporation - All rights reserved. |
  3. +-------------------------------------------------------------------------+*/
  4. #ifndef _HFILESEL_
  5. #define _HFILESEL_
  6. #ifdef __cplusplus
  7. extern "C"{
  8. #endif
  9. // Forward references as the structures are recursively linked
  10. struct _DIR_BUFFER;
  11. struct _DIR_LIST;
  12. struct _FILE_BUFFER;
  13. struct _FILE_LIST;
  14. struct SHARE_BUFFER;
  15. /*+-------------------------------------------------------------------------+
  16. |
  17. | The dir/file lists contain all the information used when working with
  18. | a file tree. The naming convention is that a buffer (I.E.
  19. | DIR_BUFFER) contains the information for one entry (one directory
  20. | or one file). A List is an array of buffers of the appropriate
  21. | type (DIR_LIST contains an array of DIR_BUFFERS).
  22. |
  23. | The whole mess starts with a root DIR_BUFFER, the DIR_BUFFER then
  24. | points to a cascading chain of DIR and FILE LISTS.
  25. |
  26. | Almost all of the structures are a doubly linked list with a pointer back
  27. | to their parent. A buffer parent pointer, points to it's parent list
  28. | structure. The List structure then has a back pointer to the parent
  29. | DIR_BUFFER. This facilitates recursing up and down the chain when
  30. | an item is checked/un-checked and it's parent and/or children are affected.
  31. |
  32. | +--------+ +----------+
  33. | | Dir |<--->| Dir List |
  34. | | Buffer |<-+ +----------+
  35. | +--------+ | | Dir |-->Dir List...
  36. | | | Buffer |-->File List...
  37. | | + - - - - -+
  38. | | | |
  39. | | + - - - - -+
  40. | | | |
  41. | |
  42. | |
  43. | | +-----------+
  44. | +->| File List |
  45. | +-----------+
  46. | | File |
  47. | | Buffer |
  48. | + - - - - - +
  49. | | |
  50. | + - - - - - +
  51. | | |
  52. |
  53. +-------------------------------------------------------------------------+*/
  54. #define CONVERT_NONE 0
  55. #define CONVERT_ALL 1
  56. #define CONVERT_PARTIAL 2
  57. // A dir buffer holds a directory or sub-directory entry, with pointers to the
  58. // files and other dirs within it.
  59. typedef struct _DIR_BUFFER {
  60. TCHAR Name[MAX_PATH];
  61. struct _DIR_LIST *parent;
  62. BOOL Last; // Flag is last dir-buffer in list
  63. DWORD Attributes;
  64. BYTE Convert; // None, All or Partial
  65. BOOL Special;
  66. struct _DIR_LIST *DirList; // Directory List structure
  67. struct _FILE_LIST *FileList; // File List structure
  68. } DIR_BUFFER;
  69. // A dir list contains the sub-directories in a directory - basically a count
  70. // and then array of sub-dirs.
  71. typedef struct _DIR_LIST {
  72. ULONG Count;
  73. DIR_BUFFER *parent;
  74. UINT Level; // how deeply nested in file tree (nesting level)
  75. DIR_BUFFER DirBuffer[];
  76. } DIR_LIST;
  77. // Structures to hold information on individual files selected/de-selected for
  78. // conversion
  79. typedef struct _FILE_BUFFER {
  80. TCHAR Name[MAX_PATH];
  81. struct _FILE_LIST *parent;
  82. BOOL Convert;
  83. DWORD Attributes;
  84. ULONG Size;
  85. } FILE_BUFFER;
  86. typedef struct _FILE_LIST {
  87. ULONG Count;
  88. DIR_BUFFER *parent;
  89. FILE_BUFFER FileBuffer[];
  90. } FILE_LIST;
  91. typedef struct _FILE_PATH_BUFFER {
  92. LPTSTR Server;
  93. LPTSTR Share;
  94. LPTSTR Path;
  95. TCHAR FullPath[MAX_PATH + 1];
  96. } FILE_PATH_BUFFER;
  97. /*+-------------------------------------------------------------------------+
  98. | Function Prototypes |
  99. +-------------------------------------------------------------------------+*/
  100. void TreeDelete(DIR_BUFFER *Dir);
  101. void TreePrune(DIR_BUFFER *Dir);
  102. ULONG TreeCount(DIR_BUFFER *Dir);
  103. DIR_BUFFER *TreeCopy(DIR_BUFFER *Dir);
  104. FILE_PATH_BUFFER *FilePathInit();
  105. void FilePathServerSet(FILE_PATH_BUFFER *fpBuf, LPTSTR Server);
  106. void FilePathShareSet(FILE_PATH_BUFFER *fpBuf, LPTSTR Share);
  107. void FilePathPathSet(FILE_PATH_BUFFER *fpBuf, LPTSTR Path);
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111. #endif