jwalmcons.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. {******************************************************************************}
  2. { }
  3. { Lan Manager Constants API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: lmcons.h, released November 2001. The original Pascal }
  9. { code is: LmCons.pas, released Februari 2002. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. unit JwaLmCons;
  43. {$WEAKPACKAGEUNIT}
  44. {$HPPEMIT ''}
  45. {$HPPEMIT '#include "lm.h"'}
  46. {$HPPEMIT ''}
  47. {$I jediapilib.inc}
  48. interface
  49. uses
  50. JwaWinType, JwaLmErr;
  51. const
  52. NetApi32 = 'netapi32.dll';
  53. //
  54. // NOTE: Lengths of strings are given as the maximum lengths of the
  55. // string in characters (not bytes). This does not include space for the
  56. // terminating 0-characters. When allocating space for such an item,
  57. // use the form:
  58. //
  59. // TCHAR username[UNLEN+1];
  60. //
  61. // Definitions of the form LN20_* define those values in effect for
  62. // LanMan 2.0.
  63. //
  64. //
  65. // String Lengths for various LanMan names
  66. //
  67. const
  68. CNLEN = 15; // Computer name length
  69. {$EXTERNALSYM CNLEN}
  70. LM20_CNLEN = 15; // LM 2.0 Computer name length
  71. {$EXTERNALSYM LM20_CNLEN}
  72. DNLEN = CNLEN; // Maximum domain name length
  73. {$EXTERNALSYM DNLEN}
  74. LM20_DNLEN = LM20_CNLEN; // LM 2.0 Maximum domain name length
  75. {$EXTERNALSYM LM20_DNLEN}
  76. //#if (CNLEN != DNLEN)
  77. //#error CNLEN and DNLEN are not equal
  78. //#endif
  79. UNCLEN = CNLEN + 2; // UNC computer name length
  80. {$EXTERNALSYM UNCLEN}
  81. LM20_UNCLEN = LM20_CNLEN + 2; // LM 2.0 UNC computer name length
  82. {$EXTERNALSYM LM20_UNCLEN}
  83. NNLEN = 80; // Net name length (share name)
  84. {$EXTERNALSYM NNLEN}
  85. LM20_NNLEN = 12; // LM 2.0 Net name length
  86. {$EXTERNALSYM LM20_NNLEN}
  87. RMLEN = UNCLEN + 1 + NNLEN; // Max remote name length
  88. {$EXTERNALSYM RMLEN}
  89. LM20_RMLEN = LM20_UNCLEN + 1 + LM20_NNLEN; // LM 2.0 Max remote name length
  90. {$EXTERNALSYM LM20_RMLEN}
  91. SNLEN = 80; // Service name length
  92. {$EXTERNALSYM SNLEN}
  93. LM20_SNLEN = 15; // LM 2.0 Service name length
  94. {$EXTERNALSYM LM20_SNLEN}
  95. STXTLEN = 256; // Service text length
  96. {$EXTERNALSYM STXTLEN}
  97. LM20_STXTLEN = 63; // LM 2.0 Service text length
  98. {$EXTERNALSYM LM20_STXTLEN}
  99. PATHLEN = 256; // Max. path (not including drive name)
  100. {$EXTERNALSYM PATHLEN}
  101. LM20_PATHLEN = 256; // LM 2.0 Max. path
  102. {$EXTERNALSYM LM20_PATHLEN}
  103. DEVLEN = 80; // Device name length
  104. {$EXTERNALSYM DEVLEN}
  105. LM20_DEVLEN = 8; // LM 2.0 Device name length
  106. {$EXTERNALSYM LM20_DEVLEN}
  107. EVLEN = 16; // Event name length
  108. {$EXTERNALSYM EVLEN}
  109. //
  110. // User, Group and Password lengths
  111. //
  112. UNLEN = 256; // Maximum user name length
  113. {$EXTERNALSYM UNLEN}
  114. LM20_UNLEN = 20; // LM 2.0 Maximum user name length
  115. {$EXTERNALSYM LM20_UNLEN}
  116. GNLEN = UNLEN; // Group name
  117. {$EXTERNALSYM GNLEN}
  118. LM20_GNLEN = LM20_UNLEN; // LM 2.0 Group name
  119. {$EXTERNALSYM LM20_GNLEN}
  120. PWLEN = 256; // Maximum password length
  121. {$EXTERNALSYM PWLEN}
  122. LM20_PWLEN = 14; // LM 2.0 Maximum password length
  123. {$EXTERNALSYM LM20_PWLEN}
  124. SHPWLEN = 8; // Share password length (bytes)
  125. {$EXTERNALSYM SHPWLEN}
  126. CLTYPE_LEN = 12; // Length of client type string
  127. {$EXTERNALSYM CLTYPE_LEN}
  128. MAXCOMMENTSZ = 256; // Multipurpose comment length
  129. {$EXTERNALSYM MAXCOMMENTSZ}
  130. LM20_MAXCOMMENTSZ = 48; // LM 2.0 Multipurpose comment length
  131. {$EXTERNALSYM LM20_MAXCOMMENTSZ}
  132. QNLEN = NNLEN; // Queue name maximum length
  133. {$EXTERNALSYM QNLEN}
  134. LM20_QNLEN = LM20_NNLEN; // LM 2.0 Queue name maximum length
  135. {$EXTERNALSYM LM20_QNLEN}
  136. //#if (QNLEN != NNLEN)
  137. //# error QNLEN and NNLEN are not equal
  138. //#endif
  139. //
  140. // The ALERTSZ and MAXDEVENTRIES defines have not yet been NT'ized.
  141. // Whoever ports these components should change these values appropriately.
  142. //
  143. ALERTSZ = 128; // size of alert string in server
  144. {$EXTERNALSYM ALERTSZ}
  145. MAXDEVENTRIES = SizeOf(Integer)*8; // Max number of device entries
  146. {$EXTERNALSYM MAXDEVENTRIES}
  147. //
  148. // We use int bitmap to represent
  149. //
  150. NETBIOS_NAME_LEN = 16; // NetBIOS net name (bytes)
  151. {$EXTERNALSYM NETBIOS_NAME_LEN}
  152. //
  153. // Value to be used with APIs which have a "preferred maximum length"
  154. // parameter. This value indicates that the API should just allocate
  155. // "as much as it takes."
  156. //
  157. MAX_PREFERRED_LENGTH = DWORD(-1);
  158. {$EXTERNALSYM MAX_PREFERRED_LENGTH}
  159. //
  160. // Constants used with encryption
  161. //
  162. CRYPT_KEY_LEN = 7;
  163. {$EXTERNALSYM CRYPT_KEY_LEN}
  164. CRYPT_TXT_LEN = 8;
  165. {$EXTERNALSYM CRYPT_TXT_LEN}
  166. ENCRYPTED_PWLEN = 16;
  167. {$EXTERNALSYM ENCRYPTED_PWLEN}
  168. SESSION_PWLEN = 24;
  169. {$EXTERNALSYM SESSION_PWLEN}
  170. SESSION_CRYPT_KLEN = 21;
  171. {$EXTERNALSYM SESSION_CRYPT_KLEN}
  172. //
  173. // Value to be used with SetInfo calls to allow setting of all
  174. // settable parameters (parmnum zero option)
  175. //
  176. PARMNUM_ALL = 0;
  177. {$EXTERNALSYM PARMNUM_ALL}
  178. PARM_ERROR_UNKNOWN = DWORD(-1);
  179. {$EXTERNALSYM PARM_ERROR_UNKNOWN}
  180. PARM_ERROR_NONE = 0;
  181. {$EXTERNALSYM PARM_ERROR_NONE}
  182. PARMNUM_BASE_INFOLEVEL = 1000;
  183. {$EXTERNALSYM PARMNUM_BASE_INFOLEVEL}
  184. //
  185. // Only the UNICODE version of the LM APIs are available on NT.
  186. // Non-UNICODE version on other platforms
  187. //
  188. //#if defined( _WIN32_WINNT ) || defined( WINNT ) || defined( FORCE_UNICODE )
  189. {$IFDEF WINNT4_UP}
  190. {$DEFINE LM_USE_UNICODE}
  191. {$ENDIF WINNT4_UP}
  192. {$IFDEF LM_FORCE_UNICODE}
  193. {$DEFINE LM_USE_UNICODE}
  194. {$ENDIF LM_FORCE_UNICODE}
  195. {$IFDEF LM_USE_UNICODE}
  196. type
  197. LMSTR = LPWSTR;
  198. {$EXTERNALSYM LMSTR}
  199. LMCSTR = LPCWSTR;
  200. {$EXTERNALSYM LMCSTR}
  201. PLMSTR = ^LMSTR;
  202. {$NODEFINE PLMSTR}
  203. const
  204. MESSAGE_FILENAME = WideString('NETMSG');
  205. {$EXTERNALSYM MESSAGE_FILENAME}
  206. OS2MSG_FILENAME = WideString('BASE');
  207. {$EXTERNALSYM OS2MSG_FILENAME}
  208. HELP_MSG_FILENAME = WideString('NETH');
  209. {$EXTERNALSYM HELP_MSG_FILENAME}
  210. // ** INTERNAL_ONLY **
  211. // The backup message file named here is a duplicate of net.msg. It
  212. // is not shipped with the product, but is used at buildtime to
  213. // msgbind certain messages to netapi.dll and some of the services.
  214. // This allows for OEMs to modify the message text in net.msg and
  215. // have those changes show up. Only in case there is an error in
  216. // retrieving the messages from net.msg do we then get the bound
  217. // messages out of bak.msg (really out of the message segment).
  218. BACKUP_MSG_FILENAME = WideString('BAK.MSG');
  219. {$EXTERNALSYM BACKUP_MSG_FILENAME}
  220. // ** END_INTERNAL **
  221. {$ELSE}
  222. type
  223. LMSTR = LPSTR;
  224. {$EXTERNALSYM LMSTR}
  225. LMCSTR = LPCSTR;
  226. {$EXTERNALSYM LMCSTR}
  227. const
  228. MESSAGE_FILENAME = AnsiString('NETMSG');
  229. {$EXTERNALSYM MESSAGE_FILENAME}
  230. OS2MSG_FILENAME = AnsiString('BASE');
  231. {$EXTERNALSYM OS2MSG_FILENAME}
  232. HELP_MSG_FILENAME = AnsiString('NETH');
  233. {$EXTERNALSYM HELP_MSG_FILENAME}
  234. // ** INTERNAL_ONLY **
  235. // The backup message file named here is a duplicate of net.msg. It
  236. // is not shipped with the product, but is used at buildtime to
  237. // msgbind certain messages to netapi.dll and some of the services.
  238. // This allows for OEMs to modify the message text in net.msg and
  239. // have those changes show up. Only in case there is an error in
  240. // retrieving the messages from net.msg do we then get the bound
  241. // messages out of bak.msg (really out of the message segment).
  242. BACKUP_MSG_FILENAME = LMSTR('BAK.MSG');
  243. {$EXTERNALSYM BACKUP_MSG_FILENAME}
  244. // ** END_INTERNAL **
  245. {$ENDIF LM_USE_UNICODE}
  246. {$UNDEF LM_USE_UNICODE}
  247. //
  248. // Message File Names
  249. //
  250. //
  251. // Keywords used in Function Prototypes
  252. //
  253. type
  254. NET_API_STATUS = DWORD;
  255. {$EXTERNALSYM NET_API_STATUS}
  256. TNetApiStatus = NET_API_STATUS;
  257. //
  258. // The platform ID indicates the levels to use for platform-specific
  259. // information.
  260. //
  261. const
  262. PLATFORM_ID_DOS = 300;
  263. {$EXTERNALSYM PLATFORM_ID_DOS}
  264. PLATFORM_ID_OS2 = 400;
  265. {$EXTERNALSYM PLATFORM_ID_OS2}
  266. PLATFORM_ID_NT = 500;
  267. {$EXTERNALSYM PLATFORM_ID_NT}
  268. PLATFORM_ID_OSF = 600;
  269. {$EXTERNALSYM PLATFORM_ID_OSF}
  270. PLATFORM_ID_VMS = 700;
  271. {$EXTERNALSYM PLATFORM_ID_VMS}
  272. //
  273. // There message numbers assigned to different LANMAN components
  274. // are as defined below.
  275. //
  276. // lmerr.h: 2100 - 2999 NERR_BASE
  277. // alertmsg.h: 3000 - 3049 ALERT_BASE
  278. // lmsvc.h: 3050 - 3099 SERVICE_BASE
  279. // lmerrlog.h: 3100 - 3299 ERRLOG_BASE
  280. // msgtext.h: 3300 - 3499 MTXT_BASE
  281. // apperr.h: 3500 - 3999 APPERR_BASE
  282. // apperrfs.h: 4000 - 4299 APPERRFS_BASE
  283. // apperr2.h: 4300 - 5299 APPERR2_BASE
  284. // ncberr.h: 5300 - 5499 NRCERR_BASE
  285. // alertmsg.h: 5500 - 5599 ALERT2_BASE
  286. // lmsvc.h: 5600 - 5699 SERVICE2_BASE
  287. // lmerrlog.h 5700 - 5899 ERRLOG2_BASE
  288. //
  289. MIN_LANMAN_MESSAGE_ID = NERR_BASE;
  290. {$EXTERNALSYM MIN_LANMAN_MESSAGE_ID}
  291. MAX_LANMAN_MESSAGE_ID = 5899;
  292. {$EXTERNALSYM MAX_LANMAN_MESSAGE_ID}
  293. implementation
  294. end.