Source code of Windows XP (NT5)
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.

532 lines
12 KiB

  1. /*++ BUILD Version: 0002 // Increment this if a change has global effects
  2. Copyright (c) 1991-1995 Microsoft Corporation
  3. Module Name:
  4. lmsvc.h
  5. Abstract:
  6. This file contains structures, function prototypes, and definitions
  7. for the NetService API.
  8. [Environment:]
  9. User Mode -Win32
  10. [Notes:]
  11. You must include NETCONS.H before this file, since this file depends
  12. on values defined in NETCONS.H.
  13. --*/
  14. #ifndef _LMSVC_
  15. #define _LMSVC_
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. //
  20. // Include the file which contains all the service name strings.
  21. //
  22. #include <lmsname.h>
  23. //
  24. // Data Structures
  25. //
  26. typedef struct _SERVICE_INFO_0 {
  27. LPTSTR svci0_name;
  28. } SERVICE_INFO_0, *PSERVICE_INFO_0, * LPSERVICE_INFO_0;
  29. typedef struct _SERVICE_INFO_1 {
  30. LPTSTR svci1_name;
  31. DWORD svci1_status;
  32. DWORD svci1_code;
  33. DWORD svci1_pid;
  34. } SERVICE_INFO_1, *PSERVICE_INFO_1, * LPSERVICE_INFO_1;
  35. typedef struct _SERVICE_INFO_2 {
  36. LPTSTR svci2_name;
  37. DWORD svci2_status;
  38. DWORD svci2_code;
  39. DWORD svci2_pid;
  40. LPTSTR svci2_text;
  41. DWORD svci2_specific_error;
  42. LPTSTR svci2_display_name;
  43. } SERVICE_INFO_2, *PSERVICE_INFO_2, * LPSERVICE_INFO_2;
  44. //
  45. // Function Prototypes
  46. //
  47. NET_API_STATUS NET_API_FUNCTION
  48. NetServiceControl (
  49. IN LPTSTR servername OPTIONAL,
  50. IN LPTSTR service,
  51. IN DWORD opcode,
  52. IN DWORD arg,
  53. OUT LPBYTE *bufptr
  54. );
  55. NET_API_STATUS NET_API_FUNCTION
  56. NetServiceEnum (
  57. IN LPTSTR servername OPTIONAL,
  58. IN DWORD level,
  59. OUT LPBYTE *bufptr,
  60. IN DWORD prefmaxlen,
  61. OUT LPDWORD entriesread,
  62. OUT LPDWORD totalentries,
  63. IN OUT LPDWORD resume_handle OPTIONAL
  64. );
  65. NET_API_STATUS NET_API_FUNCTION
  66. NetServiceGetInfo (
  67. IN LPTSTR servername OPTIONAL,
  68. IN LPTSTR service,
  69. IN DWORD level,
  70. OUT LPBYTE *bufptr
  71. );
  72. NET_API_STATUS NET_API_FUNCTION
  73. NetServiceInstall (
  74. IN LPTSTR servername OPTIONAL,
  75. IN LPTSTR service,
  76. IN DWORD argc,
  77. IN LPTSTR argv[],
  78. OUT LPBYTE *bufptr
  79. );
  80. //
  81. // Special Values and Constants
  82. //
  83. //
  84. // Bitmask and bit values for svci1_status, and svci2_status
  85. // fields. For each "subfield", there is a mask defined,
  86. // and a number of constants representing the value
  87. // obtained by doing (status & mask).
  88. //
  89. // Bits 0,1 -- general status
  90. #define SERVICE_INSTALL_STATE 0x03
  91. #define SERVICE_UNINSTALLED 0x00
  92. #define SERVICE_INSTALL_PENDING 0x01
  93. #define SERVICE_UNINSTALL_PENDING 0x02
  94. #define SERVICE_INSTALLED 0x03
  95. // Bits 2,3 -- paused/active status
  96. #define SERVICE_PAUSE_STATE 0x0C
  97. #define LM20_SERVICE_ACTIVE 0x00
  98. #define LM20_SERVICE_CONTINUE_PENDING 0x04
  99. #define LM20_SERVICE_PAUSE_PENDING 0x08
  100. #define LM20_SERVICE_PAUSED 0x0C
  101. // Bit 4 -- uninstallable indication
  102. #define SERVICE_NOT_UNINSTALLABLE 0x00
  103. #define SERVICE_UNINSTALLABLE 0x10
  104. // Bit 5 -- pausable indication
  105. #define SERVICE_NOT_PAUSABLE 0x00
  106. #define SERVICE_PAUSABLE 0x20
  107. // Workstation service only:
  108. // Bits 8,9,10 -- redirection paused/active
  109. #define SERVICE_REDIR_PAUSED 0x700
  110. #define SERVICE_REDIR_DISK_PAUSED 0x100
  111. #define SERVICE_REDIR_PRINT_PAUSED 0x200
  112. #define SERVICE_REDIR_COMM_PAUSED 0x400
  113. //
  114. // Additional standard LAN Manager for MS-DOS services
  115. //
  116. #define SERVICE_DOS_ENCRYPTION TEXT("ENCRYPT")
  117. //
  118. // NetServiceControl opcodes.
  119. //
  120. #define SERVICE_CTRL_INTERROGATE 0
  121. #define SERVICE_CTRL_PAUSE 1
  122. #define SERVICE_CTRL_CONTINUE 2
  123. #define SERVICE_CTRL_UNINSTALL 3
  124. //
  125. // Workstation service only: Bits used in the "arg" parameter
  126. // to NetServiceControl in conjunction with the opcode
  127. // SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
  128. // continue redirection.
  129. //
  130. #define SERVICE_CTRL_REDIR_DISK 0x1
  131. #define SERVICE_CTRL_REDIR_PRINT 0x2
  132. #define SERVICE_CTRL_REDIR_COMM 0x4
  133. //
  134. // Values for svci1_code, and svci2_code when status
  135. // of the service is SERVICE_INSTALL_PENDING or
  136. // SERVICE_UNINSTALL_PENDING.
  137. // A service can optionally provide a hint to the installer
  138. // that the install is proceeding and how long to wait
  139. // (in 0.1 second increments) before querying status again.
  140. //
  141. #define SERVICE_IP_NO_HINT 0x0
  142. #define SERVICE_CCP_NO_HINT 0x0
  143. #define SERVICE_IP_QUERY_HINT 0x10000
  144. #define SERVICE_CCP_QUERY_HINT 0x10000
  145. //
  146. // Mask for install proceeding checkpoint number
  147. //
  148. #define SERVICE_IP_CHKPT_NUM 0x0FF
  149. #define SERVICE_CCP_CHKPT_NUM 0x0FF
  150. //
  151. // Mask for wait time hint before querying again
  152. //
  153. #define SERVICE_IP_WAIT_TIME 0x0FF00
  154. #define SERVICE_CCP_WAIT_TIME 0x0FF00
  155. //
  156. // Shift count for building wait time _code values
  157. //
  158. #define SERVICE_IP_WAITTIME_SHIFT 8
  159. #define SERVICE_NTIP_WAITTIME_SHIFT 12
  160. //
  161. // Mask used for upper and lower portions of wait hint time.
  162. //
  163. #define UPPER_HINT_MASK 0x0000FF00
  164. #define LOWER_HINT_MASK 0x000000FF
  165. #define UPPER_GET_HINT_MASK 0x0FF00000
  166. #define LOWER_GET_HINT_MASK 0x0000FF00
  167. #define SERVICE_NT_MAXTIME 0x0000FFFF
  168. #define SERVICE_RESRV_MASK 0x0001FFFF
  169. #define SERVICE_MAXTIME 0x000000FF
  170. //
  171. // SERVICE_BASE is the base of service error codes,
  172. // chosen to avoid conflict with OS, redirector,
  173. // netapi, and errlog codes.
  174. //
  175. // Don't change the comments following the manifest constants without
  176. // understanding how mapmsg works.
  177. //
  178. #define SERVICE_BASE 3050
  179. #define SERVICE_UIC_NORMAL 0
  180. /*
  181. * Uninstall codes, to be used in high byte of 'code' on final NetStatus,
  182. * which sets the status to UNINSTALLED.
  183. */
  184. #define SERVICE_UIC_BADPARMVAL (SERVICE_BASE + 1)
  185. /*
  186. * The Registry or the information you just typed includes an illegal
  187. * value for "%1".
  188. */
  189. #define SERVICE_UIC_MISSPARM (SERVICE_BASE + 2)
  190. /*
  191. * The required parameter was not provided on the command
  192. * line or in the configuration file.
  193. */
  194. #define SERVICE_UIC_UNKPARM (SERVICE_BASE + 3)
  195. /*
  196. * LAN Manager does not recognize "%1" as a valid option.
  197. */
  198. #define SERVICE_UIC_RESOURCE (SERVICE_BASE + 4)
  199. /*
  200. * A request for resource could not be satisfied.
  201. */
  202. #define SERVICE_UIC_CONFIG (SERVICE_BASE + 5)
  203. /*
  204. * A problem exists with the system configuration.
  205. */
  206. #define SERVICE_UIC_SYSTEM (SERVICE_BASE + 6)
  207. /*
  208. * A system error has occurred.
  209. */
  210. #define SERVICE_UIC_INTERNAL (SERVICE_BASE + 7)
  211. /*
  212. * An internal consistency error has occurred.
  213. */
  214. #define SERVICE_UIC_AMBIGPARM (SERVICE_BASE + 8)
  215. /*
  216. * The configuration file or the command line has an ambiguous option.
  217. */
  218. #define SERVICE_UIC_DUPPARM (SERVICE_BASE + 9)
  219. /*
  220. * The configuration file or the command line has a duplicate parameter.
  221. */
  222. #define SERVICE_UIC_KILL (SERVICE_BASE + 10)
  223. /*
  224. * The service did not respond to control and was stopped with
  225. * the DosKillProc function.
  226. */
  227. #define SERVICE_UIC_EXEC (SERVICE_BASE + 11)
  228. /*
  229. * An error occurred when attempting to run the service program.
  230. */
  231. #define SERVICE_UIC_SUBSERV (SERVICE_BASE + 12)
  232. /*
  233. * The sub-service failed to start.
  234. */
  235. #define SERVICE_UIC_CONFLPARM (SERVICE_BASE + 13)
  236. /*
  237. * There is a conflict in the value or use of these options: %1.
  238. */
  239. #define SERVICE_UIC_FILE (SERVICE_BASE + 14)
  240. /*
  241. * There is a problem with the file.
  242. */
  243. //
  244. // The modifiers
  245. //
  246. //
  247. // General:
  248. //
  249. #define SERVICE_UIC_M_NULL 0
  250. //
  251. // RESOURCE:
  252. //
  253. #define SERVICE_UIC_M_MEMORY (SERVICE_BASE + 20) /* memory */
  254. #define SERVICE_UIC_M_DISK (SERVICE_BASE + 21) /* disk space */
  255. #define SERVICE_UIC_M_THREADS (SERVICE_BASE + 22) /* thread */
  256. #define SERVICE_UIC_M_PROCESSES (SERVICE_BASE + 23) /* process */
  257. //
  258. // CONFIG:
  259. //
  260. //
  261. // Security failure
  262. //
  263. #define SERVICE_UIC_M_SECURITY (SERVICE_BASE + 24)
  264. /* Security Failure. %0 */
  265. #define SERVICE_UIC_M_LANROOT (SERVICE_BASE + 25)
  266. /*
  267. * Bad or missing LAN Manager root directory.
  268. */
  269. #define SERVICE_UIC_M_REDIR (SERVICE_BASE + 26)
  270. /*
  271. * The network software is not installed.
  272. */
  273. #define SERVICE_UIC_M_SERVER (SERVICE_BASE + 27)
  274. /*
  275. * The server is not started.
  276. */
  277. #define SERVICE_UIC_M_SEC_FILE_ERR (SERVICE_BASE + 28)
  278. /*
  279. * The server cannot access the user accounts database (NET.ACC).
  280. */
  281. #define SERVICE_UIC_M_FILES (SERVICE_BASE + 29)
  282. /*
  283. * Incompatible files are installed in the LANMAN tree.
  284. */
  285. #define SERVICE_UIC_M_LOGS (SERVICE_BASE + 30)
  286. /*
  287. * The LANMAN\LOGS directory is invalid.
  288. */
  289. #define SERVICE_UIC_M_LANGROUP (SERVICE_BASE + 31)
  290. /*
  291. * The domain specified could not be used.
  292. */
  293. #define SERVICE_UIC_M_MSGNAME (SERVICE_BASE + 32)
  294. /*
  295. * The computer name is being used as a message alias on another computer.
  296. */
  297. #define SERVICE_UIC_M_ANNOUNCE (SERVICE_BASE + 33)
  298. /*
  299. * The announcement of the server name failed.
  300. */
  301. #define SERVICE_UIC_M_UAS (SERVICE_BASE + 34)
  302. /*
  303. * The user accounts database is not configured correctly.
  304. */
  305. #define SERVICE_UIC_M_SERVER_SEC_ERR (SERVICE_BASE + 35)
  306. /*
  307. * The server is not running with user-level security.
  308. */
  309. #define SERVICE_UIC_M_WKSTA (SERVICE_BASE + 37)
  310. /*
  311. * The workstation is not configured properly.
  312. */
  313. #define SERVICE_UIC_M_ERRLOG (SERVICE_BASE + 38)
  314. /*
  315. * View your error log for details.
  316. */
  317. #define SERVICE_UIC_M_FILE_UW (SERVICE_BASE + 39)
  318. /*
  319. * Unable to write to this file.
  320. */
  321. #define SERVICE_UIC_M_ADDPAK (SERVICE_BASE + 40)
  322. /*
  323. * ADDPAK file is corrupted. Delete LANMAN\NETPROG\ADDPAK.SER
  324. * and reapply all ADDPAKs.
  325. */
  326. #define SERVICE_UIC_M_LAZY (SERVICE_BASE + 41)
  327. /*
  328. * The LM386 server cannot be started because CACHE.EXE is not running.
  329. */
  330. #define SERVICE_UIC_M_UAS_MACHINE_ACCT (SERVICE_BASE + 42)
  331. /*
  332. * There is no account for this computer in the security database.
  333. */
  334. #define SERVICE_UIC_M_UAS_SERVERS_NMEMB (SERVICE_BASE + 43)
  335. /*
  336. * This computer is not a member of the group SERVERS.
  337. */
  338. #define SERVICE_UIC_M_UAS_SERVERS_NOGRP (SERVICE_BASE + 44)
  339. /*
  340. * The group SERVERS is not present in the local security database.
  341. */
  342. #define SERVICE_UIC_M_UAS_INVALID_ROLE (SERVICE_BASE + 45)
  343. /*
  344. * This Windows NT computer is configured as a member of a workgroup, not as
  345. * a member of a domain. The Netlogon service does not need to run in this
  346. * configuration.
  347. */
  348. #define SERVICE_UIC_M_NETLOGON_NO_DC (SERVICE_BASE + 46)
  349. /*
  350. * The Windows NT domain controller for this domain could not be located.
  351. */
  352. #define SERVICE_UIC_M_NETLOGON_DC_CFLCT (SERVICE_BASE + 47)
  353. /*
  354. * A primary domain controller is already running in this domain.
  355. */
  356. #define SERVICE_UIC_M_NETLOGON_AUTH (SERVICE_BASE + 48)
  357. /*
  358. * The service failed to authenticate with the primary domain controller.
  359. */
  360. #define SERVICE_UIC_M_UAS_PROLOG (SERVICE_BASE + 49)
  361. /*
  362. * There is a problem with the security database creation date or serial number.
  363. */
  364. #define SERVICE2_BASE 5600
  365. /* new SEVICE_UIC messages go here */
  366. #define SERVICE_UIC_M_NETLOGON_MPATH (SERVICE2_BASE + 0)
  367. /*
  368. * Could not share the User or Script path.
  369. */
  370. #define SERVICE_UIC_M_LSA_MACHINE_ACCT (SERVICE2_BASE + 1)
  371. /*
  372. * The password for this computer is not found in the local security
  373. * database.
  374. */
  375. #define SERVICE_UIC_M_DATABASE_ERROR (SERVICE2_BASE + 2)
  376. /*
  377. * An internal error occurred while accessing the computer's
  378. * local or network security database.
  379. */
  380. //
  381. // End modifiers
  382. //
  383. //
  384. // Commonly used Macros:
  385. //
  386. #define SERVICE_IP_CODE(tt,nn) \
  387. ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  388. #define SERVICE_CCP_CODE(tt,nn) \
  389. ((long)SERVICE_CCP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  390. #define SERVICE_UIC_CODE(cc,mm) \
  391. ((long)(((long)cc<<16)|(long)(unsigned short)mm))
  392. //
  393. // This macro takes a wait hint (tt) which can have a maximum value of
  394. // 0xFFFF and puts it into the service status code field.
  395. // 0x0FF1FFnn (where nn is the checkpoint information).
  396. //
  397. #define SERVICE_NT_CCP_CODE(tt,nn) \
  398. ( \
  399. ((long)SERVICE_CCP_QUERY_HINT) | \
  400. ((long)(nn)) | \
  401. (((tt)&LOWER_HINT_MASK) << SERVICE_IP_WAITTIME_SHIFT) | \
  402. (((tt)&UPPER_HINT_MASK) << SERVICE_NTIP_WAITTIME_SHIFT) \
  403. )
  404. //
  405. // This macro takes a status code field, and strips out the wait hint
  406. // from the upper and lower sections.
  407. // 0x0FF1FFnn results in 0x0000FFFF.
  408. //
  409. #define SERVICE_NT_WAIT_GET(code) \
  410. ( \
  411. (((code) & UPPER_GET_HINT_MASK) >> SERVICE_NTIP_WAITTIME_SHIFT) | \
  412. (((code) & LOWER_GET_HINT_MASK) >> SERVICE_IP_WAITTIME_SHIFT) \
  413. )
  414. #ifdef __cplusplus
  415. }
  416. #endif
  417. #endif // _LMSVC_