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.

256 lines
6.5 KiB

  1. /*
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. afpinfo.h
  5. Abstract:
  6. This module contains the AfpInfo stream definitions.
  7. Author:
  8. Jameel Hyder (microsoft!jameelh)
  9. Revision History:
  10. 25 Apr 1992 Initial Version
  11. Notes: Tab stop: 4
  12. --*/
  13. #ifndef _AFPINFO_
  14. #define _AFPINFO_
  15. typedef struct _AfpInfo
  16. {
  17. DWORD afpi_Signature; // Signature
  18. LONG afpi_Version; // Version
  19. DWORD afpi_Id; // AFP File or directory Id
  20. DWORD afpi_BackupTime; // Backup time for the file/dir
  21. // (Volume backup time is stored
  22. // in the AFP_IdIndex stream)
  23. FINDERINFO afpi_FinderInfo; // Finder Info (32 bytes)
  24. PRODOSINFO afpi_ProDosInfo; // ProDos Info (6 bytes)
  25. USHORT afpi_Attributes; // Attributes mask (maps ReadOnly)
  26. BYTE afpi_AccessOwner; // Access mask (SFI vs. SFO)
  27. BYTE afpi_AccessGroup; // Directories only
  28. BYTE afpi_AccessWorld;
  29. } AFPINFO, *PAFPINFO;
  30. //
  31. // Initialize a AFPINFO structure with default values
  32. //
  33. // VOID
  34. // AfpInitAfpInfo(
  35. // IN PAFPINFO pAfpInfo,
  36. // IN DWORD AfpId OPTIONAL, // 0 if we don't yet know the AFP Id
  37. // IN BOOLEAN IsDir
  38. // )
  39. //
  40. #define AfpInitAfpInfo(_pAfpInfo, _AfpId, _IsDir, _BackupTime) \
  41. { \
  42. RtlZeroMemory(&(_pAfpInfo)->afpi_FinderInfo, \
  43. sizeof(FINDERINFO)+sizeof(PRODOSINFO)+sizeof(USHORT)); \
  44. (_pAfpInfo)->afpi_Signature = AFP_SERVER_SIGNATURE; \
  45. (_pAfpInfo)->afpi_Version = AFP_SERVER_VERSION; \
  46. (_pAfpInfo)->afpi_BackupTime = (_BackupTime); \
  47. (_pAfpInfo)->afpi_Id = (_AfpId); \
  48. if (_IsDir) \
  49. { \
  50. (_pAfpInfo)->afpi_AccessOwner = \
  51. (_pAfpInfo)->afpi_AccessGroup = \
  52. (_pAfpInfo)->afpi_AccessWorld = DIR_ACCESS_READ | DIR_ACCESS_SEARCH; \
  53. (_pAfpInfo)->afpi_ProDosInfo.pd_FileType[0] = PRODOS_TYPE_DIR;\
  54. (_pAfpInfo)->afpi_ProDosInfo.pd_AuxType[1] = PRODOS_AUX_DIR;\
  55. } \
  56. else \
  57. { \
  58. (_pAfpInfo)->afpi_ProDosInfo.pd_FileType[0] = PRODOS_TYPE_FILE; \
  59. } \
  60. }
  61. //
  62. // Open or Create the AFP_AfpInfo stream on a file or directory using a
  63. // relative handle to the DataStream of the file/dir.
  64. // If the stream does not yet exist, create an empty one, else open the
  65. // existing one.
  66. //
  67. // NTSTATUS
  68. // AfpCreateAfpInfo(
  69. // IN PFILESYSHANDLE phDataStream, // handle to data stream of file/dir
  70. // OUT PFILESYSHANDLE phAfpInfo, // handle to AFP_AfpInfo stream
  71. // OUT PDWORD pInformation OPTIONAL // stream was opened/created
  72. // );
  73. //
  74. #define AfpCreateAfpInfo(phDataStream, phAfpInfo,pInformation) \
  75. AfpIoCreate(phDataStream, \
  76. AFP_STREAM_INFO, \
  77. &UNullString, \
  78. FILEIO_ACCESS_READWRITE, \
  79. FILEIO_DENY_NONE, \
  80. FILEIO_OPEN_FILE, \
  81. FILEIO_CREATE_INTERNAL, \
  82. FILE_ATTRIBUTE_NORMAL, \
  83. False, \
  84. NULL, \
  85. phAfpInfo, \
  86. pInformation, \
  87. NULL, \
  88. NULL, \
  89. NULL)
  90. //
  91. // Open or Create the AFP_AfpInfo stream on a file or directory using a
  92. // relative handle to the parent directory, and the name of the file/dir.
  93. // If the stream does not yet exist, create an empty one, else open the
  94. // existing one.
  95. //
  96. // NTSTATUS
  97. // AfpCreateAfpInfoWithNodeName(
  98. // IN PFILESYSHANDLE phRelative, // handle to parent of file/dir
  99. // IN PUNICODE_STRING pUEntityName, // file/dir name of entity
  100. // IN PVOLDESC pVolDesc, // Volume in question
  101. // OUT PFILESYSHANDLE phAfpInfo, // handle to AFP_AfpInfo stream
  102. // OUT PDWORD pInformation OPTIONAL // stream was opened/created
  103. // );
  104. //
  105. #define AfpCreateAfpInfoWithNodeName(phDataStream, pUEntityName, pNotifyPath, pVolDesc, phAfpInfo, pInformation) \
  106. AfpIoCreate(phDataStream, \
  107. AFP_STREAM_INFO, \
  108. pUEntityName, \
  109. FILEIO_ACCESS_READWRITE,\
  110. FILEIO_DENY_NONE, \
  111. FILEIO_OPEN_FILE, \
  112. FILEIO_CREATE_INTERNAL, \
  113. FILE_ATTRIBUTE_NORMAL, \
  114. False, \
  115. NULL, \
  116. phAfpInfo, \
  117. pInformation, \
  118. pVolDesc, \
  119. pNotifyPath, \
  120. NULL)
  121. //
  122. // If we temporarily removed the ReadOnly attribute from a file or directory
  123. // in order to write to the AFP_AfpInfo stream, set the attribute back on.
  124. // (see AfpExamineAndClearROAttr)
  125. //
  126. // VOID
  127. // AfpPutBackROAttr(
  128. // IN PFILESYSHANDLE pfshData, // Handle to data stream of file/dir
  129. // IN BOOLEAN WriteBack // Did we clear the RO bit to begin with?
  130. // );
  131. //
  132. #define AfpPutBackROAttr(pfshData, WriteBack) \
  133. if (WriteBack == True) \
  134. { \
  135. AfpIoSetTimesnAttr(pfshData, NULL, NULL, FILE_ATTRIBUTE_READONLY, 0, NULL, NULL); \
  136. }
  137. extern
  138. NTSTATUS FASTCALL
  139. AfpReadAfpInfo(
  140. IN PFILESYSHANDLE pfshAfpInfo,
  141. OUT PAFPINFO pAfpInfo
  142. );
  143. //
  144. //extern
  145. //NTSTATUS
  146. //AfpWriteAfpInfo(
  147. // IN PFILESYSHANDLE pfshAfpInfo,
  148. // IN PAFPINFO pAfpInfo
  149. //);
  150. //
  151. #define AfpWriteAfpInfo(pfshAfpInfo,pAfpInfo) \
  152. AfpIoWrite(pfshAfpInfo, &LIZero, sizeof(AFPINFO), (PBYTE)pAfpInfo)
  153. extern
  154. VOID FASTCALL
  155. AfpSetFinderInfoByExtension(
  156. IN PUNICODE_STRING pFileName,
  157. OUT PFINDERINFO pFinderInfo
  158. );
  159. extern
  160. VOID FASTCALL
  161. AfpProDosInfoFromFinderInfo(
  162. IN PFINDERINFO pFinderInfo,
  163. OUT PPRODOSINFO pProDosInfo
  164. );
  165. extern
  166. VOID FASTCALL
  167. AfpFinderInfoFromProDosInfo(
  168. IN PPRODOSINFO pProDosInfo,
  169. OUT PFINDERINFO pFinderInfo
  170. );
  171. extern
  172. NTSTATUS
  173. AfpSlapOnAfpInfoStream(
  174. IN struct _VolDesc * pVolDesc OPTIONAL,
  175. IN PUNICODE_STRING pNotifyPath OPTIONAL,
  176. IN PFILESYSHANDLE phDataStream,
  177. IN PFILESYSHANDLE pfshAfpInfoStream OPTIONAL,
  178. IN DWORD AfpId,
  179. IN BOOLEAN IsDirectory,
  180. IN PUNICODE_STRING pName OPTIONAL, // only needed for files
  181. OUT PAFPINFO pAfpInfo
  182. );
  183. extern
  184. NTSTATUS
  185. AfpCreateAfpInfoStream(
  186. IN struct _VolDesc * pVolDesc OPTIONAL,
  187. IN PFILESYSHANDLE pfshData,
  188. IN DWORD AfpId,
  189. IN BOOLEAN IsDirectory,
  190. IN PUNICODE_STRING pName OPTIONAL, // only needed for files
  191. IN PUNICODE_STRING pNotifyPath,
  192. OUT PAFPINFO pAfpInfo,
  193. OUT PFILESYSHANDLE pfshAfpInfo
  194. );
  195. extern
  196. NTSTATUS FASTCALL
  197. AfpExamineAndClearROAttr(
  198. IN PFILESYSHANDLE pfshData,
  199. OUT PBOOLEAN pWriteBackROAttr,
  200. IN struct _VolDesc * pVolDesc OPTIONAL,
  201. IN PUNICODE_STRING pPath OPTIONAL
  202. );
  203. extern
  204. AFPSTATUS
  205. AfpSetAfpInfo(
  206. IN PFILESYSHANDLE pfshData, // handle to data stream of object
  207. IN DWORD Bitmap,
  208. IN struct _FileDirParms * pFDParm,
  209. IN struct _VolDesc * pVolDesc OPTIONAL,
  210. IN struct _DirFileEntry ** ppDFE OPTIONAL
  211. );
  212. extern
  213. AFPSTATUS FASTCALL
  214. AfpQueryProDos(
  215. IN PFILESYSHANDLE pfshData,
  216. OUT PPRODOSINFO pProDosInfo
  217. );
  218. extern
  219. AFPSTATUS FASTCALL
  220. AfpUpdateIdInAfpInfo(
  221. IN struct _VolDesc * pVolDesc,
  222. IN struct _DirFileEntry * pDfEntry
  223. );
  224. #endif // _AFPINFO_
  225.