jwalmsvc.pas 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. {******************************************************************************}
  2. { }
  3. { Lan Manager Service 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: lmsvc.h, released November 2001. The original Pascal }
  9. { code is: LmSvc.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. // $Id: JwaLmSvc.pas,v 1.10 2005/09/07 09:54:54 marquardt Exp $
  43. {$IFNDEF JWA_INCLUDEMODE}
  44. unit JwaLmSvc;
  45. {$WEAKPACKAGEUNIT}
  46. {$I jediapilib.inc}
  47. interface
  48. uses
  49. JwaWindows, JwaLmCons;
  50. {$ENDIF !JWA_INCLUDEMODE}
  51. {$IFDEF JWA_INTERFACESECTION}
  52. {$HPPEMIT ''}
  53. {$HPPEMIT '#include "lmsvc.h"'}
  54. {$HPPEMIT ''}
  55. //
  56. // Data Structures
  57. //
  58. type
  59. LPSERVICE_INFO_0 = ^SERVICE_INFO_0;
  60. {$EXTERNALSYM LPSERVICE_INFO_0}
  61. PSERVICE_INFO_0 = ^SERVICE_INFO_0;
  62. {$EXTERNALSYM PSERVICE_INFO_0}
  63. _SERVICE_INFO_0 = record
  64. svci0_name: LPWSTR;
  65. end;
  66. {$EXTERNALSYM _SERVICE_INFO_0}
  67. SERVICE_INFO_0 = _SERVICE_INFO_0;
  68. {$EXTERNALSYM SERVICE_INFO_0}
  69. TServiceInfo0 = SERVICE_INFO_0;
  70. PServiceInfo0 = PSERVICE_INFO_0;
  71. LPSERVICE_INFO_1 = ^SERVICE_INFO_1;
  72. {$EXTERNALSYM LPSERVICE_INFO_1}
  73. PSERVICE_INFO_1 = ^SERVICE_INFO_1;
  74. {$EXTERNALSYM PSERVICE_INFO_1}
  75. _SERVICE_INFO_1 = record
  76. svci1_name: LPWSTR;
  77. svci1_status: DWORD;
  78. svci1_code: DWORD;
  79. svci1_pid: DWORD;
  80. end;
  81. {$EXTERNALSYM _SERVICE_INFO_1}
  82. SERVICE_INFO_1 = _SERVICE_INFO_1;
  83. {$EXTERNALSYM SERVICE_INFO_1}
  84. TServiceInfo1 = SERVICE_INFO_1;
  85. PServiceInfo1 = PSERVICE_INFO_1;
  86. LPSERVICE_INFO_2 = ^SERVICE_INFO_2;
  87. {$EXTERNALSYM LPSERVICE_INFO_2}
  88. PSERVICE_INFO_2 = ^SERVICE_INFO_2;
  89. {$EXTERNALSYM PSERVICE_INFO_2}
  90. _SERVICE_INFO_2 = record
  91. svci2_name: LPWSTR;
  92. svci2_status: DWORD;
  93. svci2_code: DWORD;
  94. svci2_pid: DWORD;
  95. svci2_text: LPWSTR;
  96. svci2_specific_error: DWORD;
  97. svci2_display_name: LPWSTR;
  98. end;
  99. {$EXTERNALSYM _SERVICE_INFO_2}
  100. SERVICE_INFO_2 = _SERVICE_INFO_2;
  101. {$EXTERNALSYM SERVICE_INFO_2}
  102. TServiceInfo2 = SERVICE_INFO_2;
  103. PServiceInfo2 = PSERVICE_INFO_2;
  104. //
  105. // Function Prototypes
  106. //
  107. function NetServiceControl(servername, service: LPCWSTR; opcode: DWORD; arg: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
  108. {$EXTERNALSYM NetServiceControl}
  109. function NetServiceEnum(servername: LPCWSTR; level: DWORD; var bufptr: LPBYTE; prefmaxlen: DWORD; entriesread, totalentries, resume_handle: LPDWORD): NET_API_STATUS; stdcall;
  110. {$EXTERNALSYM NetServiceEnum}
  111. function NetServiceGetInfo(servername, service: LPCWSTR; level: DWORD; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
  112. {$EXTERNALSYM NetServiceGetInfo}
  113. function NetServiceInstall(servername, service: LPCWSTR; argc: DWORD; argv: LPCWSTR; var bufptr: LPBYTE): NET_API_STATUS; stdcall;
  114. {$EXTERNALSYM NetServiceInstall}
  115. //
  116. // Special Values and Constants
  117. //
  118. //
  119. // Bitmask and bit values for svci1_status, and svci2_status
  120. // fields. For each "subfield", there is a mask defined,
  121. // and a number of constants representing the value
  122. // obtained by doing (status & mask).
  123. //
  124. // Bits 0,1 -- general status
  125. const
  126. SERVICE_INSTALL_STATE = $03;
  127. {$EXTERNALSYM SERVICE_INSTALL_STATE}
  128. SERVICE_UNINSTALLED = $00;
  129. {$EXTERNALSYM SERVICE_UNINSTALLED}
  130. SERVICE_INSTALL_PENDING = $01;
  131. {$EXTERNALSYM SERVICE_INSTALL_PENDING}
  132. SERVICE_UNINSTALL_PENDING = $02;
  133. {$EXTERNALSYM SERVICE_UNINSTALL_PENDING}
  134. SERVICE_INSTALLED = $03;
  135. {$EXTERNALSYM SERVICE_INSTALLED}
  136. // Bits 2,3 -- paused/active status
  137. SERVICE_PAUSE_STATE = $0C;
  138. {$EXTERNALSYM SERVICE_PAUSE_STATE}
  139. LM20_SERVICE_ACTIVE = $00;
  140. {$EXTERNALSYM LM20_SERVICE_ACTIVE}
  141. LM20_SERVICE_CONTINUE_PENDING = $04;
  142. {$EXTERNALSYM LM20_SERVICE_CONTINUE_PENDING}
  143. LM20_SERVICE_PAUSE_PENDING = $08;
  144. {$EXTERNALSYM LM20_SERVICE_PAUSE_PENDING}
  145. LM20_SERVICE_PAUSED = $0C;
  146. {$EXTERNALSYM LM20_SERVICE_PAUSED}
  147. // Bit 4 -- uninstallable indication
  148. SERVICE_NOT_UNINSTALLABLE = $00;
  149. {$EXTERNALSYM SERVICE_NOT_UNINSTALLABLE}
  150. SERVICE_UNINSTALLABLE = $10;
  151. {$EXTERNALSYM SERVICE_UNINSTALLABLE}
  152. // Bit 5 -- pausable indication
  153. SERVICE_NOT_PAUSABLE = $00;
  154. {$EXTERNALSYM SERVICE_NOT_PAUSABLE}
  155. SERVICE_PAUSABLE = $20;
  156. {$EXTERNALSYM SERVICE_PAUSABLE}
  157. // Workstation service only:
  158. // Bits 8,9,10 -- redirection paused/active
  159. SERVICE_REDIR_PAUSED = $700;
  160. {$EXTERNALSYM SERVICE_REDIR_PAUSED}
  161. SERVICE_REDIR_DISK_PAUSED = $100;
  162. {$EXTERNALSYM SERVICE_REDIR_DISK_PAUSED}
  163. SERVICE_REDIR_PRINT_PAUSED = $200;
  164. {$EXTERNALSYM SERVICE_REDIR_PRINT_PAUSED}
  165. SERVICE_REDIR_COMM_PAUSED = $400;
  166. {$EXTERNALSYM SERVICE_REDIR_COMM_PAUSED}
  167. //
  168. // Additional standard LAN Manager for MS-DOS services
  169. //
  170. SERVICE_DOS_ENCRYPTION = WideString('ENCRYPT');
  171. {$EXTERNALSYM SERVICE_DOS_ENCRYPTION}
  172. //
  173. // NetServiceControl opcodes.
  174. //
  175. SERVICE_CTRL_INTERROGATE = 0;
  176. {$EXTERNALSYM SERVICE_CTRL_INTERROGATE}
  177. SERVICE_CTRL_PAUSE = 1;
  178. {$EXTERNALSYM SERVICE_CTRL_PAUSE}
  179. SERVICE_CTRL_CONTINUE = 2;
  180. {$EXTERNALSYM SERVICE_CTRL_CONTINUE}
  181. SERVICE_CTRL_UNINSTALL = 3;
  182. {$EXTERNALSYM SERVICE_CTRL_UNINSTALL}
  183. //
  184. // Workstation service only: Bits used in the "arg" parameter
  185. // to NetServiceControl in conjunction with the opcode
  186. // SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
  187. // continue redirection.
  188. //
  189. SERVICE_CTRL_REDIR_DISK = $1;
  190. {$EXTERNALSYM SERVICE_CTRL_REDIR_DISK}
  191. SERVICE_CTRL_REDIR_PRINT = $2;
  192. {$EXTERNALSYM SERVICE_CTRL_REDIR_PRINT}
  193. SERVICE_CTRL_REDIR_COMM = $4;
  194. {$EXTERNALSYM SERVICE_CTRL_REDIR_COMM}
  195. //
  196. // Values for svci1_code, and svci2_code when status
  197. // of the service is SERVICE_INSTALL_PENDING or
  198. // SERVICE_UNINSTALL_PENDING.
  199. // A service can optionally provide a hint to the installer
  200. // that the install is proceeding and how long to wait
  201. // (in 0.1 second increments) before querying status again.
  202. //
  203. SERVICE_IP_NO_HINT = $0;
  204. {$EXTERNALSYM SERVICE_IP_NO_HINT}
  205. SERVICE_CCP_NO_HINT = $0;
  206. {$EXTERNALSYM SERVICE_CCP_NO_HINT}
  207. SERVICE_IP_QUERY_HINT = $10000;
  208. {$EXTERNALSYM SERVICE_IP_QUERY_HINT}
  209. SERVICE_CCP_QUERY_HINT = $10000;
  210. {$EXTERNALSYM SERVICE_CCP_QUERY_HINT}
  211. //
  212. // Mask for install proceeding checkpoint number
  213. //
  214. SERVICE_IP_CHKPT_NUM = $0FF;
  215. {$EXTERNALSYM SERVICE_IP_CHKPT_NUM}
  216. SERVICE_CCP_CHKPT_NUM = $0FF;
  217. {$EXTERNALSYM SERVICE_CCP_CHKPT_NUM}
  218. //
  219. // Mask for wait time hint before querying again
  220. //
  221. SERVICE_IP_WAIT_TIME = $0FF00;
  222. {$EXTERNALSYM SERVICE_IP_WAIT_TIME}
  223. SERVICE_CCP_WAIT_TIME = $0FF00;
  224. {$EXTERNALSYM SERVICE_CCP_WAIT_TIME}
  225. //
  226. // Shift count for building wait time _code values
  227. //
  228. SERVICE_IP_WAITTIME_SHIFT = 8;
  229. {$EXTERNALSYM SERVICE_IP_WAITTIME_SHIFT}
  230. SERVICE_NTIP_WAITTIME_SHIFT = 12;
  231. {$EXTERNALSYM SERVICE_NTIP_WAITTIME_SHIFT}
  232. //
  233. // Mask used for upper and lower portions of wait hint time.
  234. //
  235. UPPER_HINT_MASK = $0000FF00;
  236. {$EXTERNALSYM UPPER_HINT_MASK}
  237. LOWER_HINT_MASK = $000000FF;
  238. {$EXTERNALSYM LOWER_HINT_MASK}
  239. UPPER_GET_HINT_MASK = $0FF00000;
  240. {$EXTERNALSYM UPPER_GET_HINT_MASK}
  241. LOWER_GET_HINT_MASK = $0000FF00;
  242. {$EXTERNALSYM LOWER_GET_HINT_MASK}
  243. SERVICE_NT_MAXTIME = $0000FFFF;
  244. {$EXTERNALSYM SERVICE_NT_MAXTIME}
  245. SERVICE_RESRV_MASK = $0001FFFF;
  246. {$EXTERNALSYM SERVICE_RESRV_MASK}
  247. SERVICE_MAXTIME = $000000FF;
  248. {$EXTERNALSYM SERVICE_MAXTIME}
  249. //
  250. // SERVICE_BASE is the base of service error codes,
  251. // chosen to avoid conflict with OS, redirector,
  252. // netapi, and errlog codes.
  253. //
  254. // Don't change the comments following the manifest constants without
  255. // understanding how mapmsg works.
  256. //
  257. SERVICE_BASE = 3050;
  258. {$EXTERNALSYM SERVICE_BASE}
  259. SERVICE_UIC_NORMAL = 0;
  260. {$EXTERNALSYM SERVICE_UIC_NORMAL}
  261. {*
  262. * Uninstall codes, to be used in high byte of 'code' on final NetStatus,
  263. * which sets the status to UNINSTALLED.
  264. *}
  265. SERVICE_UIC_BADPARMVAL = SERVICE_BASE + 1;
  266. {$EXTERNALSYM SERVICE_UIC_BADPARMVAL}
  267. {*
  268. * The Registry or the information you just typed includes an illegal
  269. * value for "%1".
  270. *}
  271. SERVICE_UIC_MISSPARM = SERVICE_BASE + 2;
  272. {$EXTERNALSYM SERVICE_UIC_MISSPARM}
  273. {*
  274. * The required parameter was not provided on the command
  275. * line or in the configuration file.
  276. *}
  277. SERVICE_UIC_UNKPARM = SERVICE_BASE + 3;
  278. {$EXTERNALSYM SERVICE_UIC_UNKPARM}
  279. {*
  280. * LAN Manager does not recognize "%1" as a valid option.
  281. *}
  282. SERVICE_UIC_RESOURCE = SERVICE_BASE + 4;
  283. {$EXTERNALSYM SERVICE_UIC_RESOURCE}
  284. {*
  285. * A request for resource could not be satisfied.
  286. *}
  287. SERVICE_UIC_CONFIG = SERVICE_BASE + 5;
  288. {$EXTERNALSYM SERVICE_UIC_CONFIG}
  289. {*
  290. * A problem exists with the system configuration.
  291. *}
  292. SERVICE_UIC_SYSTEM = SERVICE_BASE + 6;
  293. {$EXTERNALSYM SERVICE_UIC_SYSTEM}
  294. {*
  295. * A system error has occurred.
  296. *}
  297. SERVICE_UIC_INTERNAL = SERVICE_BASE + 7;
  298. {$EXTERNALSYM SERVICE_UIC_INTERNAL}
  299. {*
  300. * An internal consistency error has occurred.
  301. *}
  302. SERVICE_UIC_AMBIGPARM = SERVICE_BASE + 8;
  303. {$EXTERNALSYM SERVICE_UIC_AMBIGPARM}
  304. {*
  305. * The configuration file or the command line has an ambiguous option.
  306. *}
  307. SERVICE_UIC_DUPPARM = SERVICE_BASE + 9;
  308. {$EXTERNALSYM SERVICE_UIC_DUPPARM}
  309. {*
  310. * The configuration file or the command line has a duplicate parameter.
  311. *}
  312. SERVICE_UIC_KILL = SERVICE_BASE + 10;
  313. {$EXTERNALSYM SERVICE_UIC_KILL}
  314. {*
  315. * The service did not respond to control and was stopped with
  316. * the DosKillProc function.
  317. *}
  318. SERVICE_UIC_EXEC = SERVICE_BASE + 11;
  319. {$EXTERNALSYM SERVICE_UIC_EXEC}
  320. {*
  321. * An error occurred when attempting to run the service program.
  322. *}
  323. SERVICE_UIC_SUBSERV = SERVICE_BASE + 12;
  324. {$EXTERNALSYM SERVICE_UIC_SUBSERV}
  325. {*
  326. * The sub-service failed to start.
  327. *}
  328. SERVICE_UIC_CONFLPARM = SERVICE_BASE + 13;
  329. {$EXTERNALSYM SERVICE_UIC_CONFLPARM}
  330. {*
  331. * There is a conflict in the value or use of these options: %1.
  332. *}
  333. SERVICE_UIC_FILE = SERVICE_BASE + 14;
  334. {$EXTERNALSYM SERVICE_UIC_FILE}
  335. {*
  336. * There is a problem with the file.
  337. *}
  338. //
  339. // The modifiers
  340. //
  341. //
  342. // General:
  343. //
  344. SERVICE_UIC_M_NULL = 0;
  345. {$EXTERNALSYM SERVICE_UIC_M_NULL}
  346. //
  347. // RESOURCE:
  348. //
  349. SERVICE_UIC_M_MEMORY = SERVICE_BASE + 20; // memory
  350. {$EXTERNALSYM SERVICE_UIC_M_MEMORY}
  351. SERVICE_UIC_M_DISK = SERVICE_BASE + 21; // disk space
  352. {$EXTERNALSYM SERVICE_UIC_M_DISK}
  353. SERVICE_UIC_M_THREADS = SERVICE_BASE + 22; // thread
  354. {$EXTERNALSYM SERVICE_UIC_M_THREADS}
  355. SERVICE_UIC_M_PROCESSES = SERVICE_BASE + 23; // process
  356. {$EXTERNALSYM SERVICE_UIC_M_PROCESSES}
  357. //
  358. // CONFIG:
  359. //
  360. //
  361. // Security failure
  362. //
  363. SERVICE_UIC_M_SECURITY = SERVICE_BASE + 24;
  364. {$EXTERNALSYM SERVICE_UIC_M_SECURITY}
  365. {* Security Failure. %0 *}
  366. SERVICE_UIC_M_LANROOT = SERVICE_BASE + 25;
  367. {$EXTERNALSYM SERVICE_UIC_M_LANROOT}
  368. {*
  369. * Bad or missing LAN Manager root directory.
  370. *}
  371. SERVICE_UIC_M_REDIR = SERVICE_BASE + 26;
  372. {$EXTERNALSYM SERVICE_UIC_M_REDIR}
  373. {*
  374. * The network software is not installed.
  375. *}
  376. SERVICE_UIC_M_SERVER = SERVICE_BASE + 27;
  377. {$EXTERNALSYM SERVICE_UIC_M_SERVER}
  378. {*
  379. * The server is not started.
  380. *}
  381. SERVICE_UIC_M_SEC_FILE_ERR = SERVICE_BASE + 28;
  382. {$EXTERNALSYM SERVICE_UIC_M_SEC_FILE_ERR}
  383. {*
  384. * The server cannot access the user accounts database (NET.ACC).
  385. *}
  386. SERVICE_UIC_M_FILES = SERVICE_BASE + 29;
  387. {$EXTERNALSYM SERVICE_UIC_M_FILES}
  388. {*
  389. * Incompatible files are installed in the LANMAN tree.
  390. *}
  391. SERVICE_UIC_M_LOGS = SERVICE_BASE + 30;
  392. {$EXTERNALSYM SERVICE_UIC_M_LOGS}
  393. {*
  394. * The LANMAN\LOGS directory is invalid.
  395. *}
  396. SERVICE_UIC_M_LANGROUP = SERVICE_BASE + 31;
  397. {$EXTERNALSYM SERVICE_UIC_M_LANGROUP}
  398. {*
  399. * The domain specified could not be used.
  400. *}
  401. SERVICE_UIC_M_MSGNAME = SERVICE_BASE + 32;
  402. {$EXTERNALSYM SERVICE_UIC_M_MSGNAME}
  403. {*
  404. * The computer name is being used as a message alias on another computer.
  405. *}
  406. SERVICE_UIC_M_ANNOUNCE = SERVICE_BASE + 33;
  407. {$EXTERNALSYM SERVICE_UIC_M_ANNOUNCE}
  408. {*
  409. * The announcement of the server name failed.
  410. *}
  411. SERVICE_UIC_M_UAS = SERVICE_BASE + 34;
  412. {$EXTERNALSYM SERVICE_UIC_M_UAS}
  413. {*
  414. * The user accounts database is not configured correctly.
  415. *}
  416. SERVICE_UIC_M_SERVER_SEC_ERR = SERVICE_BASE + 35;
  417. {$EXTERNALSYM SERVICE_UIC_M_SERVER_SEC_ERR}
  418. {*
  419. * The server is not running with user-level security.
  420. *}
  421. SERVICE_UIC_M_WKSTA = SERVICE_BASE + 37;
  422. {$EXTERNALSYM SERVICE_UIC_M_WKSTA}
  423. {*
  424. * The workstation is not configured properly.
  425. *}
  426. SERVICE_UIC_M_ERRLOG = SERVICE_BASE + 38;
  427. {$EXTERNALSYM SERVICE_UIC_M_ERRLOG}
  428. {*
  429. * View your error log for details.
  430. *}
  431. SERVICE_UIC_M_FILE_UW = SERVICE_BASE + 39;
  432. {$EXTERNALSYM SERVICE_UIC_M_FILE_UW}
  433. {*
  434. * Unable to write to this file.
  435. *}
  436. SERVICE_UIC_M_ADDPAK = SERVICE_BASE + 40;
  437. {$EXTERNALSYM SERVICE_UIC_M_ADDPAK}
  438. {*
  439. * ADDPAK file is corrupted. Delete LANMAN\NETPROG\ADDPAK.SER
  440. * and reapply all ADDPAKs.
  441. *}
  442. SERVICE_UIC_M_LAZY = SERVICE_BASE + 41;
  443. {$EXTERNALSYM SERVICE_UIC_M_LAZY}
  444. {*
  445. * The LM386 server cannot be started because CACHE.EXE is not running.
  446. *}
  447. SERVICE_UIC_M_UAS_MACHINE_ACCT = SERVICE_BASE + 42;
  448. {$EXTERNALSYM SERVICE_UIC_M_UAS_MACHINE_ACCT}
  449. {*
  450. * There is no account for this computer in the security database.
  451. *}
  452. SERVICE_UIC_M_UAS_SERVERS_NMEMB = SERVICE_BASE + 43;
  453. {$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NMEMB}
  454. {*
  455. * This computer is not a member of the group SERVERS.
  456. *}
  457. SERVICE_UIC_M_UAS_SERVERS_NOGRP = SERVICE_BASE + 44;
  458. {$EXTERNALSYM SERVICE_UIC_M_UAS_SERVERS_NOGRP}
  459. {*
  460. * The group SERVERS is not present in the local security database.
  461. *}
  462. SERVICE_UIC_M_UAS_INVALID_ROLE = SERVICE_BASE + 45;
  463. {$EXTERNALSYM SERVICE_UIC_M_UAS_INVALID_ROLE}
  464. {*
  465. * This computer is configured as a member of a workgroup, not as
  466. * a member of a domain. The Netlogon service does not need to run in this
  467. * configuration.
  468. *}
  469. SERVICE_UIC_M_NETLOGON_NO_DC = SERVICE_BASE + 46;
  470. {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_NO_DC}
  471. {*
  472. * The primary Domain Controller for this domain could not be located.
  473. *}
  474. SERVICE_UIC_M_NETLOGON_DC_CFLCT = SERVICE_BASE + 47;
  475. {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_DC_CFLCT}
  476. {*
  477. * This computer is configured to be the primary domain controller of its domain.
  478. * However, the computer %1 is currently claiming to be the primary domain controller
  479. * of the domain.
  480. *}
  481. SERVICE_UIC_M_NETLOGON_AUTH = SERVICE_BASE + 48;
  482. {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_AUTH}
  483. {*
  484. * The service failed to authenticate with the primary domain controller.
  485. *}
  486. SERVICE_UIC_M_UAS_PROLOG = SERVICE_BASE + 49;
  487. {$EXTERNALSYM SERVICE_UIC_M_UAS_PROLOG}
  488. {*
  489. * There is a problem with the security database creation date or serial number.
  490. *}
  491. SERVICE2_BASE = 5600;
  492. {$EXTERNALSYM SERVICE2_BASE}
  493. {* new SEVICE_UIC messages go here *}
  494. SERVICE_UIC_M_NETLOGON_MPATH = SERVICE2_BASE + 0;
  495. {$EXTERNALSYM SERVICE_UIC_M_NETLOGON_MPATH}
  496. {*
  497. * Could not share the User or Script path.
  498. *}
  499. SERVICE_UIC_M_LSA_MACHINE_ACCT = SERVICE2_BASE + 1;
  500. {$EXTERNALSYM SERVICE_UIC_M_LSA_MACHINE_ACCT}
  501. {*
  502. * The password for this computer is not found in the local security
  503. * database.
  504. *}
  505. SERVICE_UIC_M_DATABASE_ERROR = SERVICE2_BASE + 2;
  506. {$EXTERNALSYM SERVICE_UIC_M_DATABASE_ERROR}
  507. {*
  508. * An internal error occurred while accessing the computer's
  509. * local or network security database.
  510. *}
  511. //
  512. // End modifiers
  513. //
  514. //
  515. // Commonly used Macros:
  516. //
  517. function SERVICE_IP_CODE(tt, nn: LONG): LONG;
  518. {$EXTERNALSYM SERVICE_IP_CODE}
  519. function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
  520. {$EXTERNALSYM SERVICE_CCP_CODE}
  521. function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
  522. {$EXTERNALSYM SERVICE_UIC_CODE}
  523. //
  524. // This macro takes a wait hint (tt) which can have a maximum value of
  525. // 0xFFFF and puts it into the service status code field.
  526. // 0x0FF1FFnn (where nn is the checkpoint information).
  527. //
  528. function SERVICE_NT_CCP_CODE(tt, nn: LONG): LONG;
  529. {$EXTERNALSYM SERVICE_NT_CCP_CODE}
  530. //
  531. // This macro takes a status code field, and strips out the wait hint
  532. // from the upper and lower sections.
  533. // 0x0FF1FFnn results in 0x0000FFFF.
  534. //
  535. function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
  536. {$EXTERNALSYM SERVICE_NT_WAIT_GET}
  537. {$ENDIF JWA_INTERFACESECTION}
  538. {$IFNDEF JWA_INCLUDEMODE}
  539. implementation
  540. uses
  541. JwaWinDLLNames;
  542. {$ENDIF !JWA_INCLUDEMODE}
  543. {$IFDEF JWA_IMPLEMENTATIONSECTION}
  544. // #define SERVICE_IP_CODE(tt,nn) ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  545. function SERVICE_IP_CODE(tt, nn: LONG): LONG;
  546. begin
  547. Result := SERVICE_IP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
  548. end;
  549. // #define SERVICE_CCP_CODE(tt,nn) ((long)SERVICE_CCP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  550. function SERVICE_CCP_CODE(tt, nn: LONG): LONG;
  551. begin
  552. Result := SERVICE_CCP_QUERY_HINT or (nn or (tt shl SERVICE_IP_WAITTIME_SHIFT));
  553. end;
  554. // #define SERVICE_UIC_CODE(cc,mm) ((long)(((long)cc<<16)|(long)(unsigned short)mm))
  555. function SERVICE_UIC_CODE(cc, mm: LONG): LONG;
  556. begin
  557. Result := (cc shl 16) or WORD(mm);
  558. end;
  559. // #define SERVICE_NT_CCP_CODE(tt,nn) \
  560. // ( \
  561. // ((long)SERVICE_CCP_QUERY_HINT) | \
  562. // ((long)(nn)) | \
  563. // (((tt)&LOWER_HINT_MASK) << SERVICE_IP_WAITTIME_SHIFT) | \
  564. // (((tt)&UPPER_HINT_MASK) << SERVICE_NTIP_WAITTIME_SHIFT) \
  565. // )
  566. function SERVICE_NT_CCP_CODE(tt, nn: Longint): Longint;
  567. begin
  568. Result := SERVICE_CCP_QUERY_HINT or nn or ((tt and LOWER_HINT_MASK) shl SERVICE_IP_WAITTIME_SHIFT) or ((tt and UPPER_HINT_MASK) shl SERVICE_NTIP_WAITTIME_SHIFT);
  569. end;
  570. // #define SERVICE_NT_WAIT_GET(code) \
  571. // ( \
  572. // (((code) & UPPER_GET_HINT_MASK) >> SERVICE_NTIP_WAITTIME_SHIFT) | \
  573. // (((code) & LOWER_GET_HINT_MASK) >> SERVICE_IP_WAITTIME_SHIFT) \
  574. // )
  575. function SERVICE_NT_WAIT_GET(code: DWORD): DWORD;
  576. begin
  577. Result := ((code and UPPER_GET_HINT_MASK) shr SERVICE_NTIP_WAITTIME_SHIFT) or ((code and LOWER_GET_HINT_MASK) shr SERVICE_IP_WAITTIME_SHIFT);
  578. end;
  579. {$IFDEF DYNAMIC_LINK}
  580. var
  581. _NetServiceControl: Pointer;
  582. function NetServiceControl;
  583. begin
  584. GetProcedureAddress(_NetServiceControl, netapi32, 'NetServiceControl');
  585. asm
  586. MOV ESP, EBP
  587. POP EBP
  588. JMP [_NetServiceControl]
  589. end;
  590. end;
  591. var
  592. _NetServiceEnum: Pointer;
  593. function NetServiceEnum;
  594. begin
  595. GetProcedureAddress(_NetServiceEnum, netapi32, 'NetServiceEnum');
  596. asm
  597. MOV ESP, EBP
  598. POP EBP
  599. JMP [_NetServiceEnum]
  600. end;
  601. end;
  602. var
  603. _NetServiceGetInfo: Pointer;
  604. function NetServiceGetInfo;
  605. begin
  606. GetProcedureAddress(_NetServiceGetInfo, netapi32, 'NetServiceGetInfo');
  607. asm
  608. MOV ESP, EBP
  609. POP EBP
  610. JMP [_NetServiceGetInfo]
  611. end;
  612. end;
  613. var
  614. _NetServiceInstall: Pointer;
  615. function NetServiceInstall;
  616. begin
  617. GetProcedureAddress(_NetServiceInstall, netapi32, 'NetServiceInstall');
  618. asm
  619. MOV ESP, EBP
  620. POP EBP
  621. JMP [_NetServiceInstall]
  622. end;
  623. end;
  624. {$ELSE}
  625. function NetServiceControl; external netapi32 name 'NetServiceControl';
  626. function NetServiceEnum; external netapi32 name 'NetServiceEnum';
  627. function NetServiceGetInfo; external netapi32 name 'NetServiceGetInfo';
  628. function NetServiceInstall; external netapi32 name 'NetServiceInstall';
  629. {$ENDIF DYNAMIC_LINK}
  630. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  631. {$IFNDEF JWA_INCLUDEMODE}
  632. end.
  633. {$ENDIF !JWA_INCLUDEMODE}