Leaked source code of windows server 2003
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.

441 lines
14 KiB

  1. /*
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. afpconst.h
  5. Abstract:
  6. This module contains the Afp API function codes and error codes.
  7. Author:
  8. Jameel Hyder (microsoft!jameelh)
  9. Revision History:
  10. 25 Apr 1992 Initial Version
  11. Notes: Tab stop: 4
  12. --*/
  13. #ifndef _AFPCONST_
  14. #define _AFPCONST_
  15. /* The real AFP Function codes */
  16. #define AFP_BYTE_RANGE_LOCK 0x01
  17. #define AFP_CLOSE_VOL 0x02
  18. #define AFP_CLOSE_DIR 0x03
  19. #define AFP_CLOSE_FORK 0x04
  20. #define AFP_COPY_FILE 0x05
  21. #define AFP_CREATE_DIR 0x06
  22. #define AFP_CREATE_FILE 0x07
  23. #define AFP_DELETE 0x08
  24. #define AFP_ENUMERATE 0x09
  25. #define AFP_FLUSH 0x0A
  26. #define AFP_FLUSH_FORK 0x0B
  27. /************* 0C-0D ARE UNDEFINED *************/
  28. #define AFP_GET_FORK_PARMS 0x0E
  29. #define AFP_GET_SRVR_INFO 0x0F
  30. #define AFP_GET_SRVR_PARMS 0x10
  31. #define AFP_GET_VOL_PARMS 0x11
  32. #define AFP_LOGIN 0x12
  33. #define AFP_LOGIN_CONT 0x13
  34. #define AFP_LOGOUT 0x14
  35. #define AFP_MAP_ID 0x15
  36. #define AFP_MAP_NAME 0x16
  37. #define AFP_MOVE_AND_RENAME 0x17
  38. #define AFP_OPEN_VOL 0x18
  39. #define AFP_OPEN_DIR 0x19
  40. #define AFP_OPEN_FORK 0x1A
  41. #define AFP_READ 0x1B
  42. #define AFP_RENAME 0x1C
  43. #define AFP_SET_DIR_PARMS 0x1D
  44. #define AFP_SET_FILE_PARMS 0x1E
  45. #define AFP_SET_FORK_PARMS 0x1F
  46. #define AFP_SET_VOL_PARMS 0x20
  47. #define AFP_WRITE 0x21
  48. #define AFP_GET_FILE_DIR_PARMS 0x22
  49. #define AFP_SET_FILE_DIR_PARMS 0x23
  50. #define AFP_CHANGE_PASSWORD 0x24
  51. #define AFP_GET_USER_INFO 0x25
  52. #define AFP_GET_SRVR_MSG 0x26
  53. #define AFP_CREATE_ID 0x27
  54. #define AFP_DELETE_ID 0x28
  55. #define AFP_RESOLVE_ID 0x29
  56. #define AFP_EXCHANGE_FILES 0x2A
  57. #define AFP_CAT_SEARCH 0x2B
  58. /************* 2C-2F ARE UNDEFINED *************/
  59. #define AFP_OPEN_DT 0x30
  60. #define AFP_CLOSE_DT 0x31
  61. /************* 32 IS UNDEFINED *************/
  62. #define AFP_GET_ICON 0x33
  63. #define AFP_GET_ICON_INFO 0x34
  64. #define AFP_ADD_APPL 0x35
  65. #define AFP_REMOVE_APPL 0x36
  66. #define AFP_GET_APPL 0x37
  67. #define AFP_ADD_COMMENT 0x38
  68. #define AFP_REMOVE_COMMENT 0x39
  69. #define AFP_GET_COMMENT 0x3A
  70. /************* 3B-BF ARE UNDEFINED *************/
  71. #define AFP_ADD_ICON 0xC0
  72. /************* C1-FE ARE UNDEFINED *************/
  73. #define AFF_GET_DOMAIN_LIST 0xFF
  74. /* AFP Error codes */
  75. #define AFP_ERR_NONE 0
  76. #define AFP_ERR_BASE (-5000)
  77. #define AFP_ERR_ACCESS_DENIED (AFP_ERR_BASE-0)
  78. #define AFP_ERR_AUTH_CONTINUE (AFP_ERR_BASE-1)
  79. #define AFP_ERR_BAD_UAM (AFP_ERR_BASE-2)
  80. #define AFP_ERR_BAD_VERSION (AFP_ERR_BASE-3)
  81. #define AFP_ERR_BITMAP (AFP_ERR_BASE-4)
  82. #define AFP_ERR_CANT_MOVE (AFP_ERR_BASE-5)
  83. #define AFP_ERR_DENY_CONFLICT (AFP_ERR_BASE-6)
  84. #define AFP_ERR_DIR_NOT_EMPTY (AFP_ERR_BASE-7)
  85. #define AFP_ERR_DISK_FULL (AFP_ERR_BASE-8)
  86. #define AFP_ERR_EOF (AFP_ERR_BASE-9)
  87. #define AFP_ERR_FILE_BUSY (AFP_ERR_BASE-10)
  88. #define AFP_ERR_FLAT_VOL (AFP_ERR_BASE-11)
  89. #define AFP_ERR_ITEM_NOT_FOUND (AFP_ERR_BASE-12)
  90. #define AFP_ERR_LOCK (AFP_ERR_BASE-13)
  91. #define AFP_ERR_MISC (AFP_ERR_BASE-14)
  92. #define AFP_ERR_NO_MORE_LOCKS (AFP_ERR_BASE-15)
  93. #define AFP_ERR_NO_SERVER (AFP_ERR_BASE-16)
  94. #define AFP_ERR_OBJECT_EXISTS (AFP_ERR_BASE-17)
  95. #define AFP_ERR_OBJECT_NOT_FOUND (AFP_ERR_BASE-18)
  96. #define AFP_ERR_PARAM (AFP_ERR_BASE-19)
  97. #define AFP_ERR_RANGE_NOT_LOCKED (AFP_ERR_BASE-20)
  98. #define AFP_ERR_RANGE_OVERLAP (AFP_ERR_BASE-21)
  99. #define AFP_ERR_SESS_CLOSED (AFP_ERR_BASE-22)
  100. #define AFP_ERR_USER_NOT_AUTH (AFP_ERR_BASE-23)
  101. #define AFP_ERR_CALL_NOT_SUPPORTED (AFP_ERR_BASE-24)
  102. #define AFP_ERR_OBJECT_TYPE (AFP_ERR_BASE-25)
  103. #define AFP_ERR_TOO_MANY_FILES_OPEN (AFP_ERR_BASE-26)
  104. #define AFP_ERR_SERVER_GOING_DOWN (AFP_ERR_BASE-27)
  105. #define AFP_ERR_CANT_RENAME (AFP_ERR_BASE-28)
  106. #define AFP_ERR_DIR_NOT_FOUND (AFP_ERR_BASE-29)
  107. #define AFP_ERR_ICON_TYPE (AFP_ERR_BASE-30)
  108. #define AFP_ERR_VOLUME_LOCKED (AFP_ERR_BASE-31)
  109. #define AFP_ERR_OBJECT_LOCKED (AFP_ERR_BASE-32)
  110. /************* -5033 IS Undefined *************/
  111. #define AFP_ERR_ID_NOT_FOUND (AFP_ERR_BASE-34)
  112. #define AFP_ERR_ID_EXISTS (AFP_ERR_BASE-35)
  113. #define AFP_ERR_DIFF_VOL (AFP_ERR_BASE-36) // AfpExchangeFiles
  114. #define AFP_ERR_CATALOG_CHANGED (AFP_ERR_BASE-37) // AfpCatSearch
  115. #define AFP_ERR_SAME_OBJECT (AFP_ERR_BASE-38) // AfpExchangeFiles
  116. #define AFP_ERR_BAD_ID (AFP_ERR_BASE-39)
  117. #define AFP_ERR_PWD_SAME (AFP_ERR_BASE-40)
  118. #define AFP_ERR_PWD_TOO_SHORT (AFP_ERR_BASE-41)
  119. #define AFP_ERR_PWD_EXPIRED (AFP_ERR_BASE-42)
  120. #define AFP_ERR_INSIDE_SHARE (AFP_ERR_BASE-43) // Specific to AppleShare
  121. #define AFP_ERR_INSIDE_TRASH (AFP_ERR_BASE-44) // Specific to AppleShare
  122. #define AFP_ERR_PWD_NEEDS_CHANGE (AFP_ERR_BASE-45) // Specific to AppleShare
  123. // The following error codes are used internally and never returned to the
  124. // client.
  125. #define AFP_ERR_QUEUE -7000
  126. #define AFP_ERR_DEFER -7001
  127. #define AFP_ERR_WRITE_LOCK_REQUIRED -7002
  128. #define AFP_ERR_EXTENDED -7003
  129. #define AFP_ERR_REQUEUE -7004
  130. // The following codes are used with the custom UAM to indicate exact
  131. // reasons for logon failures and change password failures
  132. #define AFP_ERR_EXTENDED_ERRORS -13000
  133. #define AFP_ERR_ACCOUNT_DISABLED -13002
  134. #define AFP_ERR_INVALID_WORKSTATION -13003
  135. #define AFP_ERR_INVALID_LOGON_HOURS -13004
  136. #define AFP_ERR_PASSWORD_EXPIRED -13005
  137. #define AFP_ERR_PASSWORD_CANT_CHANGE -13006
  138. #define AFP_ERR_PASSWORD_HIST_CONFLICT -13007
  139. #define AFP_ERR_PASSWORD_TOO_SHORT -13008
  140. #define AFP_ERR_PASSWORD_TOO_RECENT -13009
  141. #define AFP_ERR_PASSWORD_RESTRICTED -13010
  142. #define AFP_ERR_ACCOUNT_RESTRICTED -13011
  143. // The following error is returned from a logon when the LsaLogonUser
  144. // call returns STATUS_LICENSE_QUOTA_EXCEEDED. The mac will map this
  145. // to the correct dialog no matter what UAM is used.
  146. #define ASP_SERVER_BUSY -1071
  147. // This is GROSS but we need to do it. Else we get TONS of warnings
  148. #define True (BOOLEAN)TRUE
  149. #define False (BOOLEAN)FALSE
  150. typedef LONG AFPSTATUS;
  151. typedef LONG AFPTIME, *PAFPTIME;
  152. typedef LARGE_INTEGER FORKOFFST, *PFORKOFFST;
  153. typedef LARGE_INTEGER FORKSIZE, *PFORKSIZE;
  154. #ifndef DWORD
  155. typedef ULONG DWORD;
  156. typedef DWORD *PDWORD;
  157. typedef DWORD *LPDWORD;
  158. #endif
  159. #ifndef BYTE
  160. typedef UCHAR BYTE;
  161. typedef BYTE *PBYTE;
  162. typedef BYTE *LPBYTE;
  163. #endif
  164. /*
  165. * The following macros deal with on-the-wire integer and long values
  166. *
  167. * On the wire format is big-endian i.e. a long value of 0x01020304 is
  168. * represented as 01 02 03 04. Similarly an int value of 0x0102 is
  169. * represented as 01 02.
  170. *
  171. * The host format is not assumed since it will vary from processor to
  172. * processor.
  173. */
  174. // Get a byte from on-the-wire format to a short in the host format
  175. #define GETBYTE2SHORT(DstPtr, SrcPtr) \
  176. *(PUSHORT)(DstPtr) = (USHORT) (*(PBYTE)(SrcPtr))
  177. // Get a byte from on-the-wire format to a short in the host format
  178. #define GETBYTE2DWORD(DstPtr, SrcPtr) \
  179. *(PDWORD)(DstPtr) = (DWORD) (*(PBYTE)(SrcPtr))
  180. // Get a short from on-the-wire format to a dword in the host format
  181. #define GETSHORT2DWORD(DstPtr, SrcPtr) \
  182. *(PDWORD)(DstPtr) = ((*((PBYTE)(SrcPtr)+0) << 8) + \
  183. (*((PBYTE)(SrcPtr)+1) ))
  184. // Get a short from on-the-wire format to a dword in the host format
  185. #define GETSHORT2SHORT(DstPtr, SrcPtr) \
  186. *(PUSHORT)(DstPtr) = ((*((PBYTE)(SrcPtr)+0) << 8) + \
  187. (*((PBYTE)(SrcPtr)+1) ))
  188. // Get a dword from on-the-wire format to a dword in the host format
  189. #define GETDWORD2DWORD(DstPtr, SrcPtr) \
  190. *(PDWORD)(DstPtr) = ((*((PBYTE)(SrcPtr)+0) << 24) + \
  191. (*((PBYTE)(SrcPtr)+1) << 16) + \
  192. (*((PBYTE)(SrcPtr)+2) << 8) + \
  193. (*((PBYTE)(SrcPtr)+3) ))
  194. // Get a dword from on-the-wire format to a dword in the same format but
  195. // also watch out for alignment
  196. #define GETDWORD2DWORD_NOCONV(DstPtr, SrcPtr) \
  197. *((PBYTE)(DstPtr)+0) = *((PBYTE)(SrcPtr)+0); \
  198. *((PBYTE)(DstPtr)+1) = *((PBYTE)(SrcPtr)+1); \
  199. *((PBYTE)(DstPtr)+2) = *((PBYTE)(SrcPtr)+2); \
  200. *((PBYTE)(DstPtr)+3) = *((PBYTE)(SrcPtr)+3);
  201. // Put a dword from the host format to a short to on-the-wire format
  202. #define PUTBYTE2BYTE(DstPtr, Src) \
  203. *((PBYTE)(DstPtr)) = (BYTE)(Src)
  204. // Put a dword from the host format to a short to on-the-wire format
  205. #define PUTSHORT2BYTE(DstPtr, Src) \
  206. *((PBYTE)(DstPtr)) = ((USHORT)(Src) % 256)
  207. // Put a dword from the host format to a short to on-the-wire format
  208. #define PUTSHORT2SHORT(DstPtr, Src) \
  209. *((PBYTE)(DstPtr)+0) = (BYTE) ((USHORT)(Src) >> 8), \
  210. *((PBYTE)(DstPtr)+1) = (BYTE)(Src)
  211. // Put a dword from the host format to a byte to on-the-wire format
  212. #define PUTDWORD2BYTE(DstPtr, Src) \
  213. *(PBYTE)(DstPtr) = (BYTE)(Src)
  214. // Put a dword from the host format to a short to on-the-wire format
  215. #define PUTDWORD2SHORT(DstPtr, Src) \
  216. *((PBYTE)(DstPtr)+0) = (BYTE) ((DWORD)(Src) >> 8), \
  217. *((PBYTE)(DstPtr)+1) = (BYTE) (Src)
  218. // Put a dword from the host format to a dword to on-the-wire format
  219. #define PUTDWORD2DWORD(DstPtr, Src) \
  220. *((PBYTE)(DstPtr)+0) = (BYTE) ((DWORD)(Src) >> 24), \
  221. *((PBYTE)(DstPtr)+1) = (BYTE) ((DWORD)(Src) >> 16), \
  222. *((PBYTE)(DstPtr)+2) = (BYTE) ((DWORD)(Src) >> 8), \
  223. *((PBYTE)(DstPtr)+3) = (BYTE) (Src)
  224. // Put a BYTE[4] array into another BYTE4 array.
  225. #define PUTBYTE42BYTE4(DstPtr, SrcPtr) \
  226. *((PBYTE)(DstPtr)+0) = *((PBYTE)(SrcPtr)+0), \
  227. *((PBYTE)(DstPtr)+1) = *((PBYTE)(SrcPtr)+1), \
  228. *((PBYTE)(DstPtr)+2) = *((PBYTE)(SrcPtr)+2), \
  229. *((PBYTE)(DstPtr)+3) = *((PBYTE)(SrcPtr)+3)
  230. /* AFP Miscellaneous values */
  231. #define AFP_SHORTNAME 1
  232. #define AFP_LONGNAME 2
  233. #define VALIDPATHTYPE(PathType) \
  234. (PathType == AFP_LONGNAME || PathType == AFP_SHORTNAME)
  235. #define AFP_HARDCREATE_FLAG 0x80
  236. #define AFP_VOLUMES_MAX 255 // Count of volumes that fit in a byte
  237. #define AFP_FILENAME_LEN 31 // Maximum file name length
  238. #define AFP_SHORTNAME_LEN 12 // 8.3
  239. #define AFP_LONGNAME_LEN 31
  240. #define AFP_MAXCOMMENTSIZE 199
  241. #define AFP_MAXPWDSIZE 8 // Cleartext password length
  242. #define BEGINNING_OF_TIME 0x80000000
  243. #define DAYS_FROM_1980_2000 7305L // (20*365 + 5)
  244. #define SECONDS_PER_DAY 86400L // 24*60*60
  245. #define SECONDS_FROM_1980_2000 SECONDS_PER_DAY * DAYS_FROM_1980_2000
  246. #define NUM_100ns_PER_SECOND 10000000L
  247. #define ASP_MAX_STATUS_BUF 512
  248. #define ASP_QUANTUM 4624
  249. #define AFP_SERVER_SIGNATURE *(PDWORD)"AFP"
  250. #define AFP_SERVER_SIGNATURE_INITIDDB *(PDWORD)"INI"
  251. #define AFP_SERVER_SIGNATURE_MANUALSTOP *(PDWORD)"MAN"
  252. #define AFP_SERVER_VERSION 0x00010000
  253. #define AFP_SERVER_VERSION2 0x00020000
  254. // AFP Version strings and values
  255. #define AFP_NUM_VERSIONS 3
  256. #define AFP_VER_20 0
  257. #define AFP_VER_20_NAME "AFPVersion 2.0"
  258. #define AFP_VER_21 1
  259. #define AFP_VER_21_NAME "AFPVersion 2.1"
  260. #define AFP_VER_22 2
  261. #define AFP_VER_22_NAME "AFP2.2"
  262. // Name to use for the Logon Process
  263. #define AFP_LOGON_PROCESS_NAME "MSAfpSrv"
  264. #define AFP_MACHINE_TYPE_STR "Windows NT"
  265. #define AFP_MACHINE_TYPE_LEN sizeof(AFP_MACHINE_TYPE_STR) - 1
  266. #define AFP_DEFAULT_WORKSTATION L"Macintosh"
  267. #define AFP_DEFAULT_WORKSTATION_A "Macintosh"
  268. #define AFPSERVER_VOLUME_ICON_FILE_ANSI {'I','C','O','N', 0x0D}
  269. #define AFP_ID_PARENT_OF_ROOT 1
  270. #define AFP_ID_ROOT 2
  271. #define AFP_ID_NETWORK_TRASH 3
  272. #define AFP_FIRST_DIRID 4
  273. #define AFP_MAX_DIRID MAXULONG
  274. // NTFS Stream names
  275. #define AFP_IDDB_STREAM L":AFP_IdIndex"
  276. #define AFP_DT_STREAM L":AFP_DeskTop"
  277. #define AFP_RESC_STREAM L":AFP_Resource"
  278. #define AFP_INFO_STREAM L":AFP_AfpInfo"
  279. #define AFP_COMM_STREAM L":Comments"
  280. #define AFP_DATA_STREAM L""
  281. #define AFP_MAX_STREAMNAME sizeof(AFP_RESC_STREAM)/sizeof(WCHAR)
  282. #define BIG_PATH_LEN (4*(AFP_FILENAME_LEN + 1))
  283. #define FULL_DATA_STREAM_NAME L"::$DATA"
  284. #define FULL_COMMENT_STREAM_NAME L":Comments:$DATA"
  285. #define FULL_RESOURCE_STREAM_NAME L":AFP_Resource:$DATA"
  286. #define FULL_INFO_STREAM_NAME L":AFP_AfpInfo:$DATA"
  287. // Supported file system names
  288. #define AFP_NTFS L"NTFS"
  289. #define AFP_CDFS L"CDFS"
  290. #define AFP_AHFS L"AHFS"
  291. // Length of unicode string Buffer to send when querying the FS name
  292. #define AFP_FSNAME_BUFLEN 30
  293. #if DBG
  294. #define POOL_OVERHEAD (12+8) // 12 for AfpAllocMemory() & 8 for ExAllocatePool()
  295. #else
  296. #define POOL_OVERHEAD (8+8) // 8 for AfpAllocMemory() & 8 for ExAllocatePool()
  297. #endif
  298. // Length of buffer to use for enumeration of directories
  299. #define AFP_ENUMBUF_SIZE (16*1024)
  300. // Prepended to full path of volume root in order to open the volume root dir
  301. #define AFP_DOSDEVICES L"\\DOSDEVICES\\"
  302. // Name of the Macintosh System 7.x network trash directory
  303. #define AFP_NWTRASH_NAME L"Network Trash Folder"
  304. #define AFP_NWTRASH_NAME_U L"Network Trash Folder"
  305. #define AFP_NWTRASH_NAME_A "Network Trash Folder"
  306. // Default Type/Creator and Extensions
  307. #define AFP_DEFAULT_ETC_EXT "* "
  308. #define AFP_DEFAULT_ETC_CREATOR "LMAN"
  309. #define AFP_DEFAULT_ETC_TYPE "TEXT"
  310. #define AFP_MAX_ETCMAP_ENTRIES MAXLONG
  311. #define AFP_MAX_FREE_ETCMAP_ENTRIES 16
  312. #define AFP_SERVER_TYPE "AFPServer"
  313. #define AFP_SERVER_ZONE "*"
  314. typedef struct _PascalString
  315. {
  316. BYTE ps_Length;
  317. BYTE ps_String[1];
  318. } *PASCALSTR;
  319. #define SIZE_PASCALSTR(Len) ((Len) + sizeof(struct _PascalString) - 1)
  320. typedef struct _AfpPathString
  321. {
  322. BYTE aps_PathType;
  323. BYTE aps_Length;
  324. BYTE aps_Path[1];
  325. } *AFPPATHSTR;
  326. // Mac Finder Information layout
  327. // see pg. 9-37 of Inside Macintosh vol. 6
  328. #define FINDER_FLAG_INVISIBLE 0x40 // fd_Attr1
  329. #define FINDER_FLAG_SET 0x01 // fd_Attr1
  330. #define FINDER_FLAG_HAS_CUSTOM_ICON 0x04 // fd_Attr1
  331. #define FINDER_INFO_SIZE 32
  332. typedef struct _FinderInfo
  333. {
  334. // Force DWORD alignment
  335. union
  336. {
  337. BYTE fd_Type[4];
  338. DWORD fd_TypeD;
  339. };
  340. union
  341. {
  342. BYTE fd_Creator[4];
  343. DWORD fd_CreatorD;
  344. };
  345. BYTE fd_Attr1; // Bits 8-15
  346. BYTE fd_Attr2; // Bits 0-7
  347. BYTE fd_Location[4];
  348. BYTE fd_FDWindow[2];
  349. BYTE fd_OtherStuff[16];
  350. } FINDERINFO, *PFINDERINFO;
  351. // Apple-II (ProDOS) information.
  352. // default values for newly discovered items
  353. #define PRODOS_TYPE_FILE 0x04 // corresponds to finder fdType 'TEXT'
  354. #define PRODOS_TYPE_DIR 0x0F
  355. #define PRODOS_AUX_DIR 0x02 // actually 0x0200
  356. // some other finder fdType to prodos FileType mapping values
  357. #define PRODOS_FILETYPE_PSYS 0xFF
  358. #define PRODOS_FILETYPE_PS16 0xB3
  359. #define PRODOS_INFO_SIZE 6
  360. typedef struct
  361. {
  362. BYTE pd_FileType[2];
  363. BYTE pd_AuxType[4];
  364. } PRODOSINFO, *PPRODOSINFO;
  365. #endif // _AFPCONST_
  366.