home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / WIN_NT / LMAPI.ZIP / H / LMSVC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-07  |  11.6 KB  |  485 lines

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