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.

332 lines
10 KiB

  1. /*++
  2. Copyright (c) 1991-1992 Microsoft Corporation
  3. Module Name:
  4. DlServer.h
  5. Abstract:
  6. This is a private header file for the NT/LAN handling of old server info
  7. levels. This contains prototypes for the NetpMergeServerOs2 etc APIs and
  8. old info level structures (in 32-bit format).
  9. Author:
  10. John Rogers (JohnRo) 18-Apr-1991
  11. Environment:
  12. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  13. Requires ANSI C extensions: slash-slash comments, long external names.
  14. Notes:
  15. This code assumes that the info levels are subsets of each other.
  16. Revision History:
  17. 18-Apr-1991 JohnRo
  18. Created.
  19. 19-Apr-1991 JohnRo
  20. Moved SV_MAX_SRV_HEUR_LEN to <lmserver.h>.
  21. 23-Apr-1991 JohnRo
  22. Deleted FromLength parm from NetpConvertServerInfo.
  23. 23-Apr-1991 JohnRo
  24. <remdef.h> is not needed by this file.
  25. 25-Apr-1991 JohnRo
  26. Added DL_REM_ descriptors.
  27. 02-Mar-1991 JohnRo
  28. Added CHECK_SERVER_OFFSETS() macro. NetpConvertServerInfo must not
  29. alloc space, as it makes enum arrays impossible. Changed to CliffV's
  30. size means bytes (vs. length meaning characters) naming convention.
  31. 06-May-1991 JohnRo
  32. Added NetpIsOldServerInfoLevel() and NetpIsNewServerInfoLevel().
  33. 09-May-1991 JohnRo
  34. Added pad info for SERVER_INFO_2.
  35. 19-May-1991 JohnRo
  36. Clean up LPBYTE vs. LPTSTR handling, as suggested by PC-LINT.
  37. 23-May-1991 JohnRo
  38. Added sv403_autopath support.
  39. 19-Jun-1991 JohnRo
  40. Changed svX_disc to be signed (for info levels 2 and 3).
  41. Added svX_licenses (also levels 2 and 3).
  42. 07-Aug-1991 JohnRo
  43. Implement downlevel NetWksta APIs.
  44. 13-Sep-1991 JohnRo
  45. Made changes toward UNICODE. (Use LPTSTR in structures.)
  46. 17-Aug-1992 JohnRo
  47. RAID 2920: Support UTC timezone in net code.
  48. 26-Aug-1992 JohnRo
  49. RAID 4463: NetServerGetInfo(level 3) to downlevel: assert in convert.c.
  50. --*/
  51. #ifndef _DLSERVER_
  52. #define _DLSERVER_
  53. // These must be included first:
  54. #include <windef.h> // IN, LPTSTR, LPVOID, TCHAR, etc.
  55. #include <lmcons.h> // NET_API_STATUS, various LEN equates.
  56. // These may be included in any order:
  57. #include <lmserver.h> // SV_MAX_SRV_HEUR_LEN, SERVER_INFO_100.
  58. #include <netdebug.h> // NetpAssert().
  59. #include <stddef.h> // offsetof().
  60. /////////////////////////////////////
  61. // Structures for old info levels: //
  62. /////////////////////////////////////
  63. typedef struct _SERVER_INFO_0 {
  64. LPTSTR sv0_name;
  65. } SERVER_INFO_0, *PSERVER_INFO_0, *LPSERVER_INFO_0;
  66. #define DL_REM16_server_info_0 "B16"
  67. #define DL_REM32_server_info_0 "z"
  68. typedef struct _SERVER_INFO_1 {
  69. LPTSTR sv1_name;
  70. DWORD sv1_version_major;
  71. DWORD sv1_version_minor;
  72. DWORD sv1_type;
  73. LPTSTR sv1_comment;
  74. } SERVER_INFO_1, *PSERVER_INFO_1, *LPSERVER_INFO_1;
  75. #define DL_REM16_server_info_1 DL_REM16_server_info_0 "BBDz"
  76. #define DL_REM32_server_info_1 DL_REM32_server_info_0 "DDDz"
  77. typedef struct _SERVER_INFO_2 {
  78. LPTSTR sv2_name;
  79. DWORD sv2_version_major;
  80. DWORD sv2_version_minor;
  81. DWORD sv2_type;
  82. LPTSTR sv2_comment;
  83. DWORD sv2_ulist_mtime;
  84. DWORD sv2_glist_mtime;
  85. DWORD sv2_alist_mtime;
  86. DWORD sv2_users;
  87. LONG sv2_disc;
  88. LPTSTR sv2_alerts;
  89. DWORD sv2_security;
  90. DWORD sv2_auditing;
  91. DWORD sv2_numadmin;
  92. DWORD sv2_lanmask;
  93. DWORD sv2_hidden;
  94. DWORD sv2_announce;
  95. DWORD sv2_anndelta;
  96. LPTSTR sv2_guestacct;
  97. DWORD sv2_licenses;
  98. LPTSTR sv2_userpath;
  99. DWORD sv2_chdevs;
  100. DWORD sv2_chdevq;
  101. DWORD sv2_chdevjobs;
  102. DWORD sv2_connections;
  103. DWORD sv2_shares;
  104. DWORD sv2_openfiles;
  105. DWORD sv2_sessopens;
  106. DWORD sv2_sessvcs;
  107. DWORD sv2_sessreqs;
  108. DWORD sv2_opensearch;
  109. DWORD sv2_activelocks;
  110. DWORD sv2_numreqbuf;
  111. DWORD sv2_sizreqbuf;
  112. DWORD sv2_numbigbuf;
  113. DWORD sv2_numfiletasks;
  114. DWORD sv2_alertsched;
  115. DWORD sv2_erroralert;
  116. DWORD sv2_logonalert;
  117. DWORD sv2_accessalert;
  118. DWORD sv2_diskalert;
  119. DWORD sv2_netioalert;
  120. DWORD sv2_maxauditsz;
  121. LPTSTR sv2_srvheuristics;
  122. } SERVER_INFO_2, *PSERVER_INFO_2, *LPSERVER_INFO_2;
  123. #define DL_REM16_server_info_2 DL_REM16_server_info_1 "JJJWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz"
  124. #define DL_REM32_server_info_2 DL_REM32_server_info_1 "GGGDXzDDDDDDDzDzDDDDDDDDDDDDDDDDDDDDDDz"
  125. typedef struct _SERVER_INFO_3 {
  126. LPTSTR sv3_name;
  127. DWORD sv3_version_major;
  128. DWORD sv3_version_minor;
  129. DWORD sv3_type;
  130. LPTSTR sv3_comment;
  131. DWORD sv3_ulist_mtime;
  132. DWORD sv3_glist_mtime;
  133. DWORD sv3_alist_mtime;
  134. DWORD sv3_users;
  135. LONG sv3_disc;
  136. LPTSTR sv3_alerts;
  137. DWORD sv3_security;
  138. DWORD sv3_auditing;
  139. DWORD sv3_numadmin;
  140. DWORD sv3_lanmask;
  141. DWORD sv3_hidden;
  142. DWORD sv3_announce;
  143. DWORD sv3_anndelta;
  144. LPTSTR sv3_guestacct;
  145. DWORD sv3_licenses;
  146. LPTSTR sv3_userpath;
  147. DWORD sv3_chdevs;
  148. DWORD sv3_chdevq;
  149. DWORD sv3_chdevjobs;
  150. DWORD sv3_connections;
  151. DWORD sv3_shares;
  152. DWORD sv3_openfiles;
  153. DWORD sv3_sessopens;
  154. DWORD sv3_sessvcs;
  155. DWORD sv3_sessreqs;
  156. DWORD sv3_opensearch;
  157. DWORD sv3_activelocks;
  158. DWORD sv3_numreqbuf;
  159. DWORD sv3_sizreqbuf;
  160. DWORD sv3_numbigbuf;
  161. DWORD sv3_numfiletasks;
  162. DWORD sv3_alertsched;
  163. DWORD sv3_erroralert;
  164. DWORD sv3_logonalert;
  165. DWORD sv3_accessalert;
  166. DWORD sv3_diskalert;
  167. DWORD sv3_netioalert;
  168. DWORD sv3_maxauditsz;
  169. LPTSTR sv3_srvheuristics;
  170. DWORD sv3_auditedevents;
  171. DWORD sv3_autoprofile;
  172. LPTSTR sv3_autopath;
  173. } SERVER_INFO_3, *PSERVER_INFO_3, *LPSERVER_INFO_3;
  174. #define DL_REM16_server_info_3 DL_REM16_server_info_2 "DWz"
  175. #define DL_REM32_server_info_3 DL_REM32_server_info_2 "DDz"
  176. #define sv2_pad1 sv2_licenses
  177. #define sv3_pad1 sv3_licenses
  178. ////////////////////////////////////
  179. // Equates for various maximums: //
  180. // _LENGTH for character counts //
  181. // _SIZE for byte counts //
  182. ////////////////////////////////////
  183. #define MAX_LEVEL_0_STRING_LENGTH (LM20_CNLEN+1)
  184. #define MAX_LEVEL_0_STRING_SIZE \
  185. (MAX_LEVEL_0_STRING_LENGTH * sizeof(TCHAR))
  186. #define MAX_LEVEL_0_TOTAL_SIZE \
  187. (MAX_LEVEL_0_STRING_SIZE + sizeof(SERVER_INFO_0))
  188. #define MAX_LEVEL_1_STRING_LENGTH (LM20_CNLEN+1 + LM20_MAXCOMMENTSZ+1)
  189. #define MAX_LEVEL_1_STRING_SIZE \
  190. (MAX_LEVEL_1_STRING_LENGTH * sizeof(TCHAR))
  191. #define MAX_LEVEL_1_TOTAL_SIZE \
  192. (MAX_LEVEL_1_STRING_SIZE + sizeof(SERVER_INFO_1))
  193. #define MAX_LEVEL_2_STRING_LENGTH \
  194. (LM20_CNLEN+1 + LM20_MAXCOMMENTSZ+1 + ALERTSZ+1 + LM20_UNLEN+1 + PATHLEN+1 \
  195. + SV_MAX_SRV_HEUR_LEN+1)
  196. #define MAX_LEVEL_2_STRING_SIZE \
  197. (MAX_LEVEL_2_STRING_LENGTH * sizeof(TCHAR))
  198. #define MAX_LEVEL_2_TOTAL_SIZE \
  199. (MAX_LEVEL_2_STRING_SIZE + sizeof(SERVER_INFO_2))
  200. #define MAX_LEVEL_3_STRING_LENGTH \
  201. (MAX_LEVEL_2_STRING_SIZE + PATHLEN+1)
  202. #define MAX_LEVEL_3_STRING_SIZE \
  203. (MAX_LEVEL_3_STRING_LENGTH * sizeof(TCHAR))
  204. #define MAX_LEVEL_3_TOTAL_SIZE \
  205. (MAX_LEVEL_3_STRING_SIZE + sizeof(SERVER_INFO_3))
  206. #define MAX_LEVEL_100_STRING_LENGTH \
  207. (CNLEN+1)
  208. #define MAX_LEVEL_100_STRING_SIZE \
  209. (MAX_LEVEL_100_STRING_LENGTH * sizeof(TCHAR))
  210. #define MAX_LEVEL_100_TOTAL_SIZE \
  211. (MAX_LEVEL_100_STRING_SIZE + sizeof(SERVER_INFO_100))
  212. #define MAX_LEVEL_101_STRING_LENGTH \
  213. (MAX_LEVEL_100_STRING_LENGTH + MAXCOMMENTSZ+1)
  214. #define MAX_LEVEL_101_STRING_SIZE \
  215. (MAX_LEVEL_101_STRING_LENGTH * sizeof(TCHAR))
  216. #define MAX_LEVEL_101_TOTAL_SIZE \
  217. (MAX_LEVEL_101_STRING_SIZE + sizeof(SERVER_INFO_101))
  218. #define MAX_LEVEL_102_STRING_LENGTH \
  219. (MAX_LEVEL_101_STRING_LENGTH + PATHLEN+1)
  220. #define MAX_LEVEL_102_STRING_SIZE \
  221. (MAX_LEVEL_102_STRING_LENGTH * sizeof(TCHAR))
  222. #define MAX_LEVEL_102_TOTAL_SIZE \
  223. (MAX_LEVEL_102_STRING_SIZE + sizeof(SERVER_INFO_102))
  224. #define MAX_LEVEL_402_STRING_LENGTH \
  225. (ALERTSZ+1 + LM20_UNLEN+1 + SV_MAX_SRV_HEUR_LEN+1)
  226. #define MAX_LEVEL_402_STRING_SIZE \
  227. (MAX_LEVEL_402_STRING_LENGTH * sizeof(TCHAR))
  228. #define MAX_LEVEL_402_TOTAL_SIZE \
  229. (MAX_LEVEL_402_STRING_SIZE + sizeof(SERVER_INFO_402))
  230. #define MAX_LEVEL_403_STRING_LENGTH \
  231. (MAX_LEVEL_402_STRING_LENGTH + PATHLEN+1)
  232. #define MAX_LEVEL_403_STRING_SIZE \
  233. (MAX_LEVEL_403_STRING_LENGTH * sizeof(TCHAR))
  234. #define MAX_LEVEL_403_TOTAL_SIZE \
  235. (MAX_LEVEL_403_STRING_SIZE + sizeof(SERVER_INFO_403))
  236. #define MAX_LEVEL_502_STRING_LENGTH 0
  237. #define MAX_LEVEL_502_STRING_SIZE \
  238. (MAX_LEVEL_502_STRING_LENGTH * sizeof(TCHAR))
  239. #define MAX_LEVEL_502_TOTAL_SIZE \
  240. (MAX_LEVEL_502_STRING_SIZE + sizeof(SERVER_INFO_502))
  241. /////////////////////////////////////
  242. // Info level conversion routines: //
  243. /////////////////////////////////////
  244. // Add prototypes for other routines here, in alphabetical order.
  245. NET_API_STATUS
  246. NetpConvertServerInfo (
  247. IN DWORD FromLevel,
  248. IN LPVOID FromInfo,
  249. IN BOOL FromNative,
  250. IN DWORD ToLevel,
  251. OUT LPVOID ToInfo,
  252. IN DWORD ToFixedLength,
  253. IN DWORD ToStringLength,
  254. IN BOOL ToNative,
  255. IN OUT LPTSTR * ToStringAreaPtr OPTIONAL
  256. );
  257. /////////////////////////////////////////////////////////////////////
  258. // Macro to make sure offsets of field in two structures are same: //
  259. /////////////////////////////////////////////////////////////////////
  260. #define CHECK_SERVER_OFFSETS(one_level, other_level, fieldname) \
  261. NetpAssert( offsetof(SERVER_INFO_ ## one_level, \
  262. sv## one_level ## _ ## fieldname) \
  263. == offsetof(SERVER_INFO_ ## other_level, \
  264. sv## other_level ## _ ## fieldname) )
  265. /////////////////////////////////////////////////////////////////
  266. // Macros to check if an info level is "old" (LM 2.x) or "new" //
  267. // (32-bit, NT, and/or portable LanMan). //
  268. /////////////////////////////////////////////////////////////////
  269. #define NetpIsOldServerInfoLevel(L) \
  270. ( ((L)==0) || ((L)==1) || ((L)==2) || ((L)==3) )
  271. #define NetpIsNewServerInfoLevel(L) \
  272. ( ((L)==100) || ((L)==101) || ((L)==102) \
  273. || ((L)==402) || ((L)==403) \
  274. || ((L)==502) || ((L)==503) || ((L)==599) )
  275. #endif // ndef _DLSERVER_