trans2.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*
  2. Unix SMB/Netbios implementation.
  3. Version 1.9.
  4. SMB transaction2 handling
  5. Copyright (C) Jeremy Allison 1994-1998
  6. Extensively modified by Andrew Tridgell, 1995
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef _TRANS2_H_
  20. #define _TRANS2_H_
  21. /* Define the structures needed for the trans2 calls. */
  22. /*******************************************************
  23. For DosFindFirst/DosFindNext - level 1
  24. MAXFILENAMELEN = 255;
  25. FDATE == uint16
  26. FTIME == uint16
  27. ULONG == uint32
  28. USHORT == uint16
  29. typedef struct _FILEFINDBUF {
  30. Byte offset Type name description
  31. -------------+-------+-------------------+--------------
  32. 0 FDATE fdateCreation;
  33. 2 FTIME ftimeCreation;
  34. 4 FDATE fdateLastAccess;
  35. 6 FTIME ftimeLastAccess;
  36. 8 FDATE fdateLastWrite;
  37. 10 FTIME ftimeLastWrite;
  38. 12 ULONG cbFile file length in bytes
  39. 16 ULONG cbFileAlloc size of file allocation unit
  40. 20 USHORT attrFile
  41. 22 UCHAR cchName length of name to follow (not including zero)
  42. 23 UCHAR achName[MAXFILENAMELEN]; Null terminated name
  43. } FILEFINDBUF;
  44. *********************************************************/
  45. #define l1_fdateCreation 0
  46. #define l1_fdateLastAccess 4
  47. #define l1_fdateLastWrite 8
  48. #define l1_cbFile 12
  49. #define l1_cbFileAlloc 16
  50. #define l1_attrFile 20
  51. #define l1_cchName 22
  52. #define l1_achName 23
  53. /**********************************************************
  54. For DosFindFirst/DosFindNext - level 2
  55. typedef struct _FILEFINDBUF2 {
  56. Byte offset Type name description
  57. -------------+-------+-------------------+--------------
  58. 0 FDATE fdateCreation;
  59. 2 FTIME ftimeCreation;
  60. 4 FDATE fdateLastAccess;
  61. 6 FTIME ftimeLastAccess;
  62. 8 FDATE fdateLastWrite;
  63. 10 FTIME ftimeLastWrite;
  64. 12 ULONG cbFile file length in bytes
  65. 16 ULONG cbFileAlloc size of file allocation unit
  66. 20 USHORT attrFile
  67. 22 ULONG cbList Extended attribute list (always 0)
  68. 26 UCHAR cchName length of name to follow (not including zero)
  69. 27 UCHAR achName[MAXFILENAMELEN]; Null terminated name
  70. } FILEFINDBUF2;
  71. *************************************************************/
  72. #define l2_fdateCreation 0
  73. #define l2_fdateLastAccess 4
  74. #define l2_fdateLastWrite 8
  75. #define l2_cbFile 12
  76. #define l2_cbFileAlloc 16
  77. #define l2_attrFile 20
  78. #define l2_cbList 22
  79. #define l2_cchName 26
  80. #define l2_achName 27
  81. /**********************************************************
  82. For DosFindFirst/DosFindNext - level 260
  83. typedef struct _FILEFINDBUF260 {
  84. Byte offset Type name description
  85. -------------+-------+-------------------+--------------
  86. 0 ULONG NextEntryOffset;
  87. 4 ULONG FileIndex;
  88. 8 LARGE_INTEGER CreationTime;
  89. 16 LARGE_INTEGER LastAccessTime;
  90. 24 LARGE_INTEGER LastWriteTime;
  91. 32 LARGE_INTEGER ChangeTime;
  92. 40 LARGE_INTEGER EndOfFile;
  93. 48 LARGE_INTEGER AllocationSize;
  94. 56 ULONG FileAttributes;
  95. 60 ULONG FileNameLength;
  96. 64 ULONG EaSize;
  97. 68 CHAR ShortNameLength;
  98. 70 UNICODE ShortName[12];
  99. 94 UNICODE FileName[];
  100. *************************************************************/
  101. #define l260_achName 94
  102. /**********************************************************
  103. For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
  104. DosSetFileInfo - level 1
  105. typedef struct _FILESTATUS {
  106. Byte offset Type name description
  107. -------------+-------+-------------------+--------------
  108. 0 FDATE fdateCreation;
  109. 2 FTIME ftimeCreation;
  110. 4 FDATE fdateLastAccess;
  111. 6 FTIME ftimeLastAccess;
  112. 8 FDATE fdateLastWrite;
  113. 10 FTIME ftimeLastWrite;
  114. 12 ULONG cbFile file length in bytes
  115. 16 ULONG cbFileAlloc size of file allocation unit
  116. 20 USHORT attrFile
  117. } FILESTATUS;
  118. *************************************************************/
  119. /* Use the l1_ defines from DosFindFirst */
  120. /**********************************************************
  121. For DosQueryPathInfo/DosQueryFileInfo/DosSetPathInfo/
  122. DosSetFileInfo - level 2
  123. typedef struct _FILESTATUS2 {
  124. Byte offset Type name description
  125. -------------+-------+-------------------+--------------
  126. 0 FDATE fdateCreation;
  127. 2 FTIME ftimeCreation;
  128. 4 FDATE fdateLastAccess;
  129. 6 FTIME ftimeLastAccess;
  130. 8 FDATE fdateLastWrite;
  131. 10 FTIME ftimeLastWrite;
  132. 12 ULONG cbFile file length in bytes
  133. 16 ULONG cbFileAlloc size of file allocation unit
  134. 20 USHORT attrFile
  135. 22 ULONG cbList Length of EA's (0)
  136. } FILESTATUS2;
  137. *************************************************************/
  138. /* Use the l2_ #defines from DosFindFirst */
  139. /**********************************************************
  140. For DosQFSInfo/DosSetFSInfo - level 1
  141. typedef struct _FSALLOCATE {
  142. Byte offset Type name description
  143. -------------+-------+-------------------+--------------
  144. 0 ULONG idFileSystem id of file system
  145. 4 ULONG cSectorUnit number of sectors per allocation unit
  146. 8 ULONG cUnit number of allocation units
  147. 12 ULONG cUnitAvail Available allocation units
  148. 16 USHORT cbSector bytes per sector
  149. } FSALLOCATE;
  150. *************************************************************/
  151. #define l1_idFileSystem 0
  152. #define l1_cSectorUnit 4
  153. #define l1_cUnit 8
  154. #define l1_cUnitAvail 12
  155. #define l1_cbSector 16
  156. /**********************************************************
  157. For DosQFSInfo/DosSetFSInfo - level 2
  158. typedef struct _FSINFO {
  159. Byte offset Type name description
  160. -------------+-------+-------------------+--------------
  161. 0 FDATE vol_fdateCreation
  162. 2 FTIME vol_ftimeCreation
  163. 4 UCHAR vol_cch length of volume name (excluding NULL)
  164. 5 UCHAR vol_szVolLabel[12] volume name
  165. } FSINFO;
  166. *************************************************************/
  167. #define SMB_INFO_STANDARD 1
  168. #define SMB_INFO_QUERY_EA_SIZE 2
  169. #define SMB_INFO_QUERY_EAS_FROM_LIST 3
  170. #define SMB_INFO_QUERY_ALL_EAS 4
  171. #define SMB_INFO_IS_NAME_VALID 6
  172. #define SMB_QUERY_FS_LABEL_INFO 0x101
  173. #define SMB_QUERY_FS_VOLUME_INFO 0x102
  174. #define SMB_QUERY_FS_SIZE_INFO 0x103
  175. #define SMB_QUERY_FS_DEVICE_INFO 0x104
  176. #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
  177. #define l2_vol_fdateCreation 0
  178. #define l2_vol_cch 4
  179. #define l2_vol_szVolLabel 5
  180. #define SMB_QUERY_FILE_BASIC_INFO 0x101
  181. #define SMB_QUERY_FILE_STANDARD_INFO 0x102
  182. #define SMB_QUERY_FILE_EA_INFO 0x103
  183. #define SMB_QUERY_FILE_NAME_INFO 0x104
  184. #define SMB_QUERY_FILE_ALLOCATION_INFO 0x105
  185. #define SMB_QUERY_FILE_END_OF_FILEINFO 0x106
  186. #define SMB_QUERY_FILE_ALL_INFO 0x107
  187. #define SMB_QUERY_FILE_ALT_NAME_INFO 0x108
  188. #define SMB_QUERY_FILE_STREAM_INFO 0x109
  189. #define SMB_FIND_FILE_DIRECTORY_INFO 0x101
  190. #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
  191. #define SMB_FIND_FILE_NAMES_INFO 0x103
  192. #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
  193. #define SMB_SET_FILE_BASIC_INFO 0x101
  194. #define SMB_SET_FILE_DISPOSITION_INFO 0x102
  195. #define SMB_SET_FILE_ALLOCATION_INFO 0x103
  196. #define SMB_SET_FILE_END_OF_FILE_INFO 0x104
  197. /*
  198. * Thursby MAC extensions....
  199. */
  200. #define SMB_MAC_QUERY_FS_INFO 0x301
  201. #define DIRLEN_GUESS (45+MAX(l1_achName,l2_achName))
  202. /*
  203. * DeviceType and Characteristics returned in a
  204. * SMB_QUERY_FS_DEVICE_INFO call.
  205. */
  206. #define DEVICETYPE_CD_ROM 0x2
  207. #define DEVICETYPE_CD_ROM_FILE_SYSTEM 0x3
  208. #define DEVICETYPE_DISK 0x7
  209. #define DEVICETYPE_DISK_FILE_SYSTEM 0x8
  210. #define DEVICETYPE_FILE_SYSTEM 0x9
  211. /* Characteristics. */
  212. #define TYPE_REMOVABLE_MEDIA 0x1
  213. #define TYPE_READ_ONLY_DEVICE 0x2
  214. #define TYPE_FLOPPY 0x4
  215. #define TYPE_WORM 0x8
  216. #define TYPE_REMOTE 0x10
  217. #define TYPE_MOUNTED 0x20
  218. #define TYPE_VIRTUAL 0x40
  219. #endif