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.

418 lines
12 KiB

  1. /*++
  2. Copyright (c) 1989-1993 Microsoft Corporation
  3. Module Name:
  4. icanon.h
  5. Abstract:
  6. Function prototypes and definitions for the internal APIs which
  7. canonicalize, validate, and compare pathnames, LANMAN object
  8. names, and lists.
  9. Author:
  10. Danny Glasser (dannygl) 15 June 1989
  11. Notes:
  12. The references to the old set of canonicalization routines,
  13. which live in NETLIB, are being kept around for now. When
  14. these routines are expunged the references in here should also
  15. be removed.
  16. Revision History:
  17. 06-May-1991 rfirth
  18. 32-bit version
  19. 11-Jun-1991 rfirth
  20. Added WI_Net prototypes
  21. 22-Jan-1992 rfirth
  22. Changed names to be in line with NT naming convention (I_Net => Netp)
  23. Removed WI_Net prototypes
  24. Added mapping for old names. Names should be changed in all sources
  25. 24-Feb-1992 rfirth
  26. Added LM2X_COMPATIBLE support
  27. 10-May-1993 JohnRo
  28. RAID 6987: allow spaces in computer names (use comma for API lists).
  29. Also corrected copyright dates and re-ordered this history.
  30. Allow multiple includes of this file to be harmless.
  31. --*/
  32. #ifndef _ICANON_
  33. #define _ICANON_
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. //
  38. // keep old names for now
  39. //
  40. #define NetpPathType I_NetPathType
  41. #define NetpPathCanonicalize I_NetPathCanonicalize
  42. #define NetpPathCompare I_NetPathCompare
  43. #define NetpNameValidate I_NetNameValidate
  44. #define NetpNameCanonicalize I_NetNameCanonicalize
  45. #define NetpNameCompare I_NetNameCompare
  46. #define NetpListCanonicalize I_NetListCanonicalize
  47. #define NetpListTraverse I_NetListTraverse
  48. //
  49. // canonicalization routine prototypes
  50. //
  51. NET_API_STATUS
  52. NetpIsRemote(
  53. IN LPWSTR ComputerName OPTIONAL,
  54. OUT LPDWORD LocalOrRemote,
  55. OUT LPWSTR CanonicalizedName OPTIONAL,
  56. IN DWORD cchCanonName,
  57. IN DWORD Flags
  58. );
  59. NET_API_STATUS
  60. NET_API_FUNCTION
  61. NetpPathType(
  62. IN LPWSTR ServerName OPTIONAL,
  63. IN LPWSTR PathName,
  64. OUT LPDWORD PathType,
  65. IN DWORD Flags
  66. );
  67. NET_API_STATUS
  68. NET_API_FUNCTION
  69. NetpPathCanonicalize(
  70. IN LPWSTR ServerName OPTIONAL,
  71. IN LPWSTR PathName,
  72. IN LPWSTR Outbuf,
  73. IN DWORD OutbufLen,
  74. IN LPWSTR Prefix OPTIONAL,
  75. IN OUT LPDWORD PathType,
  76. IN DWORD Flags
  77. );
  78. LONG
  79. NET_API_FUNCTION
  80. NetpPathCompare(
  81. IN LPWSTR ServerName OPTIONAL,
  82. IN LPWSTR PathName1,
  83. IN LPWSTR PathName2,
  84. IN DWORD PathType,
  85. IN DWORD Flags
  86. );
  87. NET_API_STATUS
  88. NET_API_FUNCTION
  89. NetpNameValidate(
  90. IN LPWSTR ServerName OPTIONAL,
  91. IN LPWSTR Name,
  92. IN DWORD NameType,
  93. IN DWORD Flags
  94. );
  95. NET_API_STATUS
  96. NET_API_FUNCTION
  97. NetpNameCanonicalize(
  98. IN LPWSTR ServerName OPTIONAL,
  99. IN LPWSTR Name,
  100. OUT LPWSTR Outbuf,
  101. IN DWORD OutbufLen,
  102. IN DWORD NameType,
  103. IN DWORD Flags
  104. );
  105. LONG
  106. NET_API_FUNCTION
  107. NetpNameCompare(
  108. IN LPWSTR ServerName OPTIONAL,
  109. IN LPWSTR Name1,
  110. IN LPWSTR Name2,
  111. IN DWORD NameType,
  112. IN DWORD Flags
  113. );
  114. NET_API_STATUS
  115. NET_API_FUNCTION
  116. NetpListCanonicalize(
  117. IN LPWSTR ServerName OPTIONAL,
  118. IN LPWSTR List,
  119. IN LPWSTR Delimiters OPTIONAL,
  120. OUT LPWSTR Outbuf,
  121. IN DWORD OutbufLen,
  122. OUT LPDWORD OutCount,
  123. OUT LPDWORD PathTypes,
  124. IN DWORD PathTypesLen,
  125. IN DWORD Flags
  126. );
  127. LPWSTR
  128. NET_API_FUNCTION
  129. NetpListTraverse(
  130. IN LPWSTR Reserved OPTIONAL,
  131. IN LPWSTR* pList,
  132. IN DWORD Flags
  133. );
  134. //
  135. // ** Manifest constants for use with the above functions **
  136. //
  137. //
  138. // Global flags (across all canonicalization functions)
  139. //
  140. #define LM2X_COMPATIBLE 0x80000000L
  141. #define GLOBAL_CANON_FLAGS (LM2X_COMPATIBLE)
  142. //
  143. // These are the values which can be returned from NetpIsRemote in LocalOrRemote
  144. //
  145. #define ISREMOTE (-1)
  146. #define ISLOCAL 0
  147. //
  148. // Flags for NetpIsRemote
  149. //
  150. #define NIRFLAG_MAPLOCAL 0x00000001L
  151. #define NIRFLAG_RESERVED (~(GLOBAL_CANON_FLAGS|NIRFLAG_MAP_LOCAL))
  152. //
  153. // Flags for I_NetPathType
  154. //
  155. #define INPT_FLAGS_OLDPATHS 0x00000001
  156. #define INPT_FLAGS_RESERVED (~(GLOBAL_CANON_FLAGS|INPT_FLAGS_OLDPATHS))
  157. //
  158. // Flags for I_NetPathCanonicalize
  159. //
  160. #define INPCA_FLAGS_OLDPATHS 0x00000001
  161. #define INPCA_FLAGS_RESERVED (~(GLOBAL_CANON_FLAGS|INPCA_FLAGS_OLDPATHS))
  162. //
  163. // Flags for I_NetPathCompare
  164. //
  165. #define INPC_FLAGS_PATHS_CANONICALIZED 0x00000001
  166. #define INPC_FLAGS_RESERVED (~(GLOBAL_CANON_FLAGS|INPC_FLAGS_PATHS_CANONICALIZED))
  167. //
  168. // Flags for I_NetNameCanonicalize
  169. //
  170. #define INNCA_FLAGS_FULL_BUFLEN 0x00000001
  171. #define INNCA_FLAGS_RESERVED (~(GLOBAL_CANON_FLAGS|INNCA_FLAGS_FULL_BUFLEN))
  172. //
  173. // Flags for I_NetNameCompare
  174. //
  175. #define INNC_FLAGS_NAMES_CANONICALIZED 0x00000001
  176. #define INNC_FLAGS_RESERVED (~(GLOBAL_CANON_FLAGS|INNC_FLAGS_NAMES_CANONICALIZED))
  177. //
  178. // Flags for I_NetNameValidate
  179. //
  180. #define INNV_FLAGS_RESERVED (~GLOBAL_CANON_FLAGS)
  181. //
  182. // Name types for I_NetName* and I_NetListCanonicalize
  183. //
  184. #define NAMETYPE_USER 1
  185. #define NAMETYPE_PASSWORD 2
  186. #define NAMETYPE_GROUP 3
  187. #define NAMETYPE_COMPUTER 4
  188. #define NAMETYPE_EVENT 5
  189. #define NAMETYPE_DOMAIN 6
  190. #define NAMETYPE_SERVICE 7
  191. #define NAMETYPE_NET 8
  192. #define NAMETYPE_SHARE 9
  193. #define NAMETYPE_MESSAGE 10
  194. #define NAMETYPE_MESSAGEDEST 11
  195. #define NAMETYPE_SHAREPASSWORD 12
  196. #define NAMETYPE_WORKGROUP 13
  197. //
  198. // Special name types for I_NetListCanonicalize
  199. //
  200. #define NAMETYPE_COPYONLY 0
  201. #define NAMETYPE_PATH INLC_FLAGS_MASK_NAMETYPE
  202. //
  203. // Flags for I_NetListCanonicalize
  204. //
  205. #define INLC_FLAGS_MASK_NAMETYPE 0x000000FF
  206. #define INLC_FLAGS_MASK_OUTLIST_TYPE 0x00000300
  207. #define OUTLIST_TYPE_NULL_NULL 0x00000100
  208. #define OUTLIST_TYPE_API 0x00000200
  209. #define OUTLIST_TYPE_SEARCHPATH 0x00000300
  210. #define INLC_FLAGS_CANONICALIZE 0x00000400
  211. #define INLC_FLAGS_MULTIPLE_DELIMITERS 0x00000800
  212. #define INLC_FLAGS_MASK_RESERVED (~(GLOBAL_CANON_FLAGS| \
  213. INLC_FLAGS_MASK_NAMETYPE | \
  214. INLC_FLAGS_MASK_OUTLIST_TYPE | \
  215. INLC_FLAGS_CANONICALIZE | \
  216. INLC_FLAGS_MULTIPLE_DELIMITERS))
  217. //
  218. // Delimiter strings for the three types of input lists accepted by
  219. // I_NetListCanonicalize.
  220. //
  221. #define LIST_DELIMITER_STR_UI TEXT(" \t;,")
  222. #define LIST_DELIMITER_STR_API TEXT(",")
  223. #define LIST_DELIMITER_STR_NULL_NULL TEXT("")
  224. //
  225. // The API list delimiter character
  226. //
  227. #define LIST_DELIMITER_CHAR_API TEXT(',')
  228. //
  229. // The Search-path list delimiter character
  230. //
  231. #define LIST_DELIMITER_CHAR_SEARCHPATH ';'
  232. //
  233. // The list quote character
  234. //
  235. #define LIST_QUOTE_CHAR '\"'
  236. /*NOINC*/
  237. /*
  238. * MAX_API_LIST_SIZE(maxelts, maxsize)
  239. * MAX_SEARCHPATH_LIST_SIZE(maxelts, maxsize)
  240. * MAX_NULL_NULL_LIST_SIZE(maxelts, maxsize)
  241. *
  242. * These macros specify the maximum size (in bytes) of API, search-path,
  243. * and null-null lists, respectively, given the maximum number of elements
  244. * and the maximum size (in bytes, not including the terminating null) of
  245. * an element. They are intended to be used in allocating arrays large
  246. * enough to hold the output of I_NetListCanonicalize.
  247. *
  248. * The size of an API or search-path list entry is three more than the size
  249. * of the element. This includes two bytes for leading and trailing quote
  250. * characters and one byte for a trailing delimiter (or null, for the last
  251. * element).
  252. *
  253. * The size of a null-null list is one more than the size the elements
  254. * concantenated (allowing for a terminating null after each element). The
  255. * extra byte is for the second null which follows the last element.
  256. */
  257. #define MAX_API_LIST_SIZE(maxelts, maxsize) \
  258. ((maxelts) * ((maxsize) + 3))
  259. #define MAX_SEARCHPATH_LIST_SIZE(maxelts, maxsize) \
  260. ((maxelts) * ((maxsize) + 3))
  261. #define MAX_NULL_NULL_LIST_SIZE(maxelts, maxsize) \
  262. ((maxelts) * ((maxsize) + 1) + 1)
  263. /*INC*/
  264. /***
  265. * Constants for type return value.
  266. * --> THESE ARE ONLY BUILDING BLOCKS, THEY ARE NOT RETURNED <---
  267. */
  268. #define ITYPE_WILD 0x1
  269. #define ITYPE_NOWILD 0
  270. #define ITYPE_ABSOLUTE 0x2
  271. #define ITYPE_RELATIVE 0
  272. #define ITYPE_DPATH 0x4
  273. #define ITYPE_NDPATH 0
  274. #define ITYPE_DISK 0
  275. #define ITYPE_LPT 0x10
  276. #define ITYPE_COM 0x20
  277. #define ITYPE_COMPNAME 0x30
  278. #define ITYPE_CON 0x40
  279. #define ITYPE_NUL 0x50
  280. /*
  281. * Meta-system names are used in the permission database. A meta
  282. * system name applies to a whole class of objects. For example,
  283. * \MAILSLOT applies to all mailslots. These are NOT valid
  284. * system object names themselves.
  285. */
  286. #define ITYPE_SYS 0x00000800
  287. #define ITYPE_META 0x00008000 /* See above */
  288. #define ITYPE_SYS_MSLOT (ITYPE_SYS|0)
  289. #define ITYPE_SYS_SEM (ITYPE_SYS|0x100)
  290. #define ITYPE_SYS_SHMEM (ITYPE_SYS|0x200)
  291. #define ITYPE_SYS_PIPE (ITYPE_SYS|0x300)
  292. #define ITYPE_SYS_COMM (ITYPE_SYS|0x400)
  293. #define ITYPE_SYS_PRINT (ITYPE_SYS|0x500)
  294. #define ITYPE_SYS_QUEUE (ITYPE_SYS|0x600)
  295. #define ITYPE_UNC 0x1000 /* unc paths */
  296. #define ITYPE_PATH 0x2000 /* 'local' non-unc paths */
  297. #define ITYPE_DEVICE 0x4000
  298. #define ITYPE_PATH_SYS (ITYPE_PATH_ABSND|ITYPE_SYS)
  299. #define ITYPE_UNC_SYS (ITYPE_UNC|ITYPE_SYS)
  300. /* End of building blocks. */
  301. /***
  302. * The real things...
  303. * WHAT GETS RETURNED
  304. */
  305. /* ITYPE_UNC: \\foo\bar and \\foo\bar\x\y */
  306. #define ITYPE_UNC_COMPNAME (ITYPE_UNC|ITYPE_COMPNAME)
  307. #define ITYPE_UNC_WC (ITYPE_UNC|ITYPE_COMPNAME|ITYPE_WILD)
  308. #define ITYPE_UNC_SYS_SEM (ITYPE_UNC_SYS|ITYPE_SYS_SEM)
  309. #define ITYPE_UNC_SYS_SHMEM (ITYPE_UNC_SYS|ITYPE_SYS_SHMEM)
  310. #define ITYPE_UNC_SYS_MSLOT (ITYPE_UNC_SYS|ITYPE_SYS_MSLOT)
  311. #define ITYPE_UNC_SYS_PIPE (ITYPE_UNC_SYS|ITYPE_SYS_PIPE)
  312. #define ITYPE_UNC_SYS_QUEUE (ITYPE_UNC_SYS|ITYPE_SYS_QUEUE)
  313. #define ITYPE_PATH_ABSND (ITYPE_PATH|ITYPE_ABSOLUTE|ITYPE_NDPATH)
  314. #define ITYPE_PATH_ABSD (ITYPE_PATH|ITYPE_ABSOLUTE|ITYPE_DPATH)
  315. #define ITYPE_PATH_RELND (ITYPE_PATH|ITYPE_RELATIVE|ITYPE_NDPATH)
  316. #define ITYPE_PATH_RELD (ITYPE_PATH|ITYPE_RELATIVE|ITYPE_DPATH)
  317. #define ITYPE_PATH_ABSND_WC (ITYPE_PATH_ABSND|ITYPE_WILD)
  318. #define ITYPE_PATH_ABSD_WC (ITYPE_PATH_ABSD|ITYPE_WILD)
  319. #define ITYPE_PATH_RELND_WC (ITYPE_PATH_RELND|ITYPE_WILD)
  320. #define ITYPE_PATH_RELD_WC (ITYPE_PATH_RELD|ITYPE_WILD)
  321. #define ITYPE_PATH_SYS_SEM (ITYPE_PATH_SYS|ITYPE_SYS_SEM)
  322. #define ITYPE_PATH_SYS_SHMEM (ITYPE_PATH_SYS|ITYPE_SYS_SHMEM)
  323. #define ITYPE_PATH_SYS_MSLOT (ITYPE_PATH_SYS|ITYPE_SYS_MSLOT)
  324. #define ITYPE_PATH_SYS_PIPE (ITYPE_PATH_SYS|ITYPE_SYS_PIPE)
  325. #define ITYPE_PATH_SYS_COMM (ITYPE_PATH_SYS|ITYPE_SYS_COMM)
  326. #define ITYPE_PATH_SYS_PRINT (ITYPE_PATH_SYS|ITYPE_SYS_PRINT)
  327. #define ITYPE_PATH_SYS_QUEUE (ITYPE_PATH_SYS|ITYPE_SYS_QUEUE)
  328. #define ITYPE_PATH_SYS_SEM_M (ITYPE_PATH_SYS|ITYPE_SYS_SEM|ITYPE_META)
  329. #define ITYPE_PATH_SYS_SHMEM_M (ITYPE_PATH_SYS|ITYPE_SYS_SHMEM|ITYPE_META)
  330. #define ITYPE_PATH_SYS_MSLOT_M (ITYPE_PATH_SYS|ITYPE_SYS_MSLOT|ITYPE_META)
  331. #define ITYPE_PATH_SYS_PIPE_M (ITYPE_PATH_SYS|ITYPE_SYS_PIPE|ITYPE_META)
  332. #define ITYPE_PATH_SYS_COMM_M (ITYPE_PATH_SYS|ITYPE_SYS_COMM|ITYPE_META)
  333. #define ITYPE_PATH_SYS_PRINT_M (ITYPE_PATH_SYS|ITYPE_SYS_PRINT|ITYPE_META)
  334. #define ITYPE_PATH_SYS_QUEUE_M (ITYPE_PATH_SYS|ITYPE_SYS_QUEUE|ITYPE_META)
  335. #define ITYPE_DEVICE_DISK (ITYPE_DEVICE|ITYPE_DISK)
  336. #define ITYPE_DEVICE_LPT (ITYPE_DEVICE|ITYPE_LPT)
  337. #define ITYPE_DEVICE_COM (ITYPE_DEVICE|ITYPE_COM)
  338. #define ITYPE_DEVICE_CON (ITYPE_DEVICE|ITYPE_CON)
  339. #define ITYPE_DEVICE_NUL (ITYPE_DEVICE|ITYPE_NUL)
  340. #ifdef __cplusplus
  341. }
  342. #endif
  343. #endif // ndef _ICANON_