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.

271 lines
8.4 KiB

  1. /*++
  2. Copyright (c) 1991-92 Microsoft Corporation
  3. Module Name:
  4. DlWksta.h
  5. Abstract:
  6. This is a private header file for the NT/LAN handling of old wksta info
  7. levels. This contains prototypes for the NetpConvertWkstaInfo etc APIs and
  8. old info level structures (in 32-bit format).
  9. Author:
  10. John Rogers (JohnRo) 08-Aug-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. Revision History:
  15. 08-Aug-1991 JohnRo
  16. Created, building from DanHi's port1632.h & mapsupp.h and my DlServer.h.
  17. 13-Sep-1991 JohnRo
  18. Correct UNICODE use.
  19. 01-Apr-1992 JohnRo
  20. Level 402 does not have other domains any more.
  21. --*/
  22. #ifndef _DLWKSTA_
  23. #define _DLWKSTA_
  24. // These must be included first:
  25. #include <windef.h> // IN, LPTSTR, LPVOID, TCHAR, etc.
  26. #include <lmcons.h> // NET_API_STATUS, various LEN equates.
  27. // These may be included in any order:
  28. #include <lmwksta.h> // PWKSTA_INFO_101.
  29. #include <netdebug.h> // NetpAssert().
  30. #include <stddef.h> // offsetof().
  31. #define MAX_OTH_DOMAINS 4
  32. /////////////////////////////////////
  33. // Structures for old info levels: //
  34. /////////////////////////////////////
  35. typedef struct _WKSTA_INFO_0 {
  36. DWORD wki0_reserved_1;
  37. DWORD wki0_reserved_2;
  38. LPTSTR wki0_root;
  39. LPTSTR wki0_computername;
  40. LPTSTR wki0_username;
  41. LPTSTR wki0_langroup;
  42. DWORD wki0_ver_major;
  43. DWORD wki0_ver_minor;
  44. DWORD wki0_reserved_3;
  45. DWORD wki0_charwait;
  46. DWORD wki0_chartime;
  47. DWORD wki0_charcount;
  48. DWORD wki0_reserved_4;
  49. DWORD wki0_reserved_5;
  50. DWORD wki0_keepconn;
  51. DWORD wki0_keepsearch;
  52. DWORD wki0_maxthreads;
  53. DWORD wki0_maxcmds;
  54. DWORD wki0_reserved_6;
  55. DWORD wki0_numworkbuf;
  56. DWORD wki0_sizworkbuf;
  57. DWORD wki0_maxwrkcache;
  58. DWORD wki0_sesstimeout;
  59. DWORD wki0_sizerror;
  60. DWORD wki0_numalerts;
  61. DWORD wki0_numservices;
  62. DWORD wki0_errlogsz;
  63. DWORD wki0_printbuftime;
  64. DWORD wki0_numcharbuf;
  65. DWORD wki0_sizcharbuf;
  66. LPTSTR wki0_logon_server;
  67. LPTSTR wki0_wrkheuristics;
  68. DWORD wki0_mailslots;
  69. } WKSTA_INFO_0, *PWKSTA_INFO_0, *LPWKSTA_INFO_0; /* wksta_info_0 */
  70. #define DL_REM_wksta_info_0 "DDzzzzDDDDDDDDDDDDDDDDDDDDDDDDzzD"
  71. typedef struct _WKSTA_INFO_1 {
  72. DWORD wki1_reserved_1;
  73. DWORD wki1_reserved_2;
  74. LPTSTR wki1_root;
  75. LPTSTR wki1_computername;
  76. LPTSTR wki1_username;
  77. LPTSTR wki1_langroup;
  78. DWORD wki1_ver_major;
  79. DWORD wki1_ver_minor;
  80. DWORD wki1_reserved_3;
  81. DWORD wki1_charwait;
  82. DWORD wki1_chartime;
  83. DWORD wki1_charcount;
  84. DWORD wki1_reserved_4;
  85. DWORD wki1_reserved_5;
  86. DWORD wki1_keepconn;
  87. DWORD wki1_keepsearch;
  88. DWORD wki1_maxthreads;
  89. DWORD wki1_maxcmds;
  90. DWORD wki1_reserved_6;
  91. DWORD wki1_numworkbuf;
  92. DWORD wki1_sizworkbuf;
  93. DWORD wki1_maxwrkcache;
  94. DWORD wki1_sesstimeout;
  95. DWORD wki1_sizerror;
  96. DWORD wki1_numalerts;
  97. DWORD wki1_numservices;
  98. DWORD wki1_errlogsz;
  99. DWORD wki1_printbuftime;
  100. DWORD wki1_numcharbuf;
  101. DWORD wki1_sizcharbuf;
  102. LPTSTR wki1_logon_server;
  103. LPTSTR wki1_wrkheuristics;
  104. DWORD wki1_mailslots;
  105. LPTSTR wki1_logon_domain;
  106. LPTSTR wki1_oth_domains;
  107. DWORD wki1_numdgrambuf;
  108. } WKSTA_INFO_1, *PWKSTA_INFO_1, *LPWKSTA_INFO_1; /* wksta_info_1 */
  109. // Take advantage of the fact that level 0 is subset of level 1.
  110. #define DL_REM_wksta_info_1 DL_REM_wksta_info_0 "zzD"
  111. typedef struct _WKSTA_INFO_10 {
  112. LPTSTR wki10_computername;
  113. LPTSTR wki10_username;
  114. LPTSTR wki10_langroup;
  115. DWORD wki10_ver_major;
  116. DWORD wki10_ver_minor;
  117. LPTSTR wki10_logon_domain;
  118. LPTSTR wki10_oth_domains;
  119. } WKSTA_INFO_10, *PWKSTA_INFO_10, *LPWKSTA_INFO_10; /* wksta_info_10 */
  120. #define DL_REM_wksta_info_10 "zzzDDzz"
  121. ////////////////////////////////////
  122. // Equates for various maximums: //
  123. // _LENGTH for character counts //
  124. // _SIZE for byte counts //
  125. ////////////////////////////////////
  126. // This number is from the LM 2.0 NetCons.h file, where it is called
  127. // WRKHEUR_COUNT:
  128. #define LM20_WRKHEUR_COUNT 54
  129. #define MAX_WKSTA_0_STRING_LENGTH \
  130. (LM20_PATHLEN+1 + MAX_PATH+1 + LM20_UNLEN+1 + LM20_DNLEN+1 \
  131. + MAX_PATH+1 + LM20_WRKHEUR_COUNT+1)
  132. #define MAX_WKSTA_0_STRING_SIZE \
  133. (MAX_WKSTA_0_STRING_LENGTH * sizeof(TCHAR))
  134. #define MAX_WKSTA_0_TOTAL_SIZE \
  135. (MAX_WKSTA_0_STRING_SIZE + sizeof(WKSTA_INFO_0))
  136. #define MAX_WKSTA_1_STRING_LENGTH \
  137. ( MAX_WKSTA_0_STRING_LENGTH + LM20_DNLEN+1 + LM20_DNLEN+1 )
  138. #define MAX_WKSTA_1_STRING_SIZE \
  139. (MAX_WKSTA_1_STRING_LENGTH * sizeof(TCHAR))
  140. #define MAX_WKSTA_1_TOTAL_SIZE \
  141. (MAX_WKSTA_1_STRING_SIZE + sizeof(WKSTA_INFO_1))
  142. #define MAX_WKSTA_10_STRING_LENGTH \
  143. (MAX_PATH+1 + LM20_UNLEN+1 + LM20_DNLEN+1 \
  144. + LM20_DNLEN+1 + LM20_DNLEN+1 )
  145. #define MAX_WKSTA_10_STRING_SIZE \
  146. (MAX_WKSTA_10_STRING_LENGTH * sizeof(TCHAR))
  147. #define MAX_WKSTA_10_TOTAL_SIZE \
  148. (MAX_WKSTA_10_STRING_SIZE + sizeof(WKSTA_INFO_10))
  149. #define MAX_WKSTA_100_STRING_LENGTH \
  150. (MAX_PATH+1 + LM20_DNLEN+1)
  151. #define MAX_WKSTA_100_STRING_SIZE \
  152. (MAX_WKSTA_100_STRING_LENGTH * sizeof(TCHAR))
  153. #define MAX_WKSTA_100_TOTAL_SIZE \
  154. (MAX_WKSTA_100_STRING_SIZE + sizeof(WKSTA_INFO_100))
  155. #define MAX_WKSTA_101_STRING_LENGTH \
  156. (MAX_WKSTA_100_STRING_LENGTH + LM20_PATHLEN+1)
  157. #define MAX_WKSTA_101_STRING_SIZE \
  158. (MAX_WKSTA_101_STRING_LENGTH * sizeof(TCHAR))
  159. #define MAX_WKSTA_101_TOTAL_SIZE \
  160. (MAX_WKSTA_101_STRING_SIZE + sizeof(WKSTA_INFO_101))
  161. #define MAX_WKSTA_102_STRING_LENGTH \
  162. (MAX_WKSTA_101_STRING_LENGTH)
  163. #define MAX_WKSTA_102_STRING_SIZE \
  164. (MAX_WKSTA_102_STRING_LENGTH * sizeof(TCHAR))
  165. #define MAX_WKSTA_102_TOTAL_SIZE \
  166. (MAX_WKSTA_102_STRING_SIZE + sizeof(WKSTA_INFO_102))
  167. #define MAX_WKSTA_302_STRING_LENGTH \
  168. (LM20_WRKHEUR_COUNT+1 + (MAX_OTH_DOMAINS * (LM20_DNLEN+1)))
  169. #define MAX_WKSTA_302_STRING_SIZE \
  170. (MAX_WKSTA_302_STRING_LENGTH * sizeof(TCHAR))
  171. #define MAX_WKSTA_302_TOTAL_SIZE \
  172. (MAX_WKSTA_302_STRING_SIZE + sizeof(WKSTA_INFO_302))
  173. #define MAX_WKSTA_402_STRING_LENGTH \
  174. (LM20_WRKHEUR_COUNT+1)
  175. #define MAX_WKSTA_402_STRING_SIZE \
  176. (MAX_WKSTA_402_STRING_LENGTH * sizeof(TCHAR))
  177. #define MAX_WKSTA_402_TOTAL_SIZE \
  178. (MAX_WKSTA_402_STRING_SIZE + sizeof(WKSTA_INFO_402))
  179. #define MAX_WKSTA_502_STRING_LENGTH 0
  180. #define MAX_WKSTA_502_STRING_SIZE 0
  181. #define MAX_WKSTA_502_TOTAL_SIZE (sizeof(WKSTA_INFO_502))
  182. /////////////////////////////////////
  183. // Info level conversion routines: //
  184. /////////////////////////////////////
  185. // Add prototypes for other routines here, in alphabetical order.
  186. NET_API_STATUS
  187. NetpConvertWkstaInfo (
  188. IN DWORD FromLevel,
  189. IN LPVOID FromInfo,
  190. IN BOOL FromNative,
  191. IN DWORD ToLevel,
  192. OUT LPVOID ToInfo,
  193. IN DWORD ToFixedLength,
  194. IN DWORD ToStringLength,
  195. IN BOOL ToNative,
  196. IN OUT LPTSTR * ToStringAreaPtr OPTIONAL
  197. );
  198. /////////////////////////////////////////////////////////////////////
  199. // Macro to make sure offsets of field in two structures are same: //
  200. /////////////////////////////////////////////////////////////////////
  201. #define CHECK_WKSTA_OFFSETS(one_level, other_level, fieldname) \
  202. NetpAssert( offsetof(WKSTA_INFO_ ## one_level, \
  203. sv## one_level ## _ ## fieldname) \
  204. == offsetof(WKSTA_INFO_ ## other_level, \
  205. sv## other_level ## _ ## fieldname) )
  206. /////////////////////////////////////////////////////////////////
  207. // Macros to check if an info level is "old" (LM 2.x) or "new" //
  208. // (32-bit, NT, and/or portable LanMan). //
  209. /////////////////////////////////////////////////////////////////
  210. #define NetpIsOldWkstaInfoLevel(L) \
  211. ( ((L)==0) || ((L)==1) || ((L)==10) )
  212. // Note that the new "setinfo levels" aren't included in this list.
  213. #define NetpIsNewWkstaInfoLevel(L) \
  214. ( ((L)==100) || ((L)==101) || ((L)==102) \
  215. || ((L)==302) || ((L)==402) || ((L)==502) )
  216. #endif // ndef _DLWKSTA_