home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / 3COMM.ZIP / H.ZIP / SERVICE.H < prev    next >
C/C++ Source or Header  |  1989-05-17  |  10KB  |  305 lines

  1. /********************************************************************
  2.  **                   Microsoft OS/2 LAN Manager                   **
  3.  **            Copyright(c) Microsoft Corp., 1987, 1988            **
  4.  ********************************************************************/
  5.  
  6. /********************************************************************
  7.  *                                    *
  8.  *  About this file ...  SERVICE.H                     *
  9.  *                                    *
  10.  *  This file contains information about the NetService APIs.        *
  11.  *                                    *
  12.  *    Function prototypes.                        *
  13.  *                                    *
  14.  *    Data structure templates.                    *
  15.  *                                    *
  16.  *    Definition of special values.                    *
  17.  *                                    *
  18.  *                                    *
  19.  *  NOTE:  You must include NETCONS.H before this file, since this  *
  20.  *       file    depends on values defined in NETCONS.H.            *
  21.  *                                    *
  22.  ********************************************************************/
  23.  
  24.  
  25. /**************************************************************** 
  26.  *                                *
  27.  *          Function prototypes                 *
  28.  *                                *
  29.  ****************************************************************/
  30.  
  31.  
  32. extern API_FUNCTION
  33.   NetServiceEnum ( const char far *, short, char far *, unsigned short, 
  34.             unsigned short far *, unsigned short far * );
  35.  
  36. extern API_FUNCTION
  37.   NetServiceGetInfo ( const char far *, const char far *, short, char far *, 
  38.             unsigned short, unsigned short far * );
  39.  
  40. extern API_FUNCTION
  41.   NetServiceInstall ( const char far *, const char far *, const char far *, 
  42.             char far *, unsigned short );
  43.  
  44. extern API_FUNCTION
  45.   NetServiceControl ( const char far *, const char far *, unsigned char, 
  46.             unsigned char, char far *, unsigned short );
  47.  
  48. extern API_FUNCTION
  49.   NetServiceStatus( const char far *, unsigned short );
  50.  
  51.  
  52. /**************************************************************** 
  53.  *                                *
  54.  *          Data structure templates            *
  55.  *                                *
  56.  ****************************************************************/
  57.  
  58.  
  59. struct service_info_0 {
  60.     char         svci0_name[SNLEN+1];
  61. };    /* service_info_0 */
  62.  
  63. struct service_info_1 {
  64.     char         svci1_name[SNLEN+1];  /* service name             */
  65.     unsigned short  svci1_status;           /* See "status values" above     */
  66.     unsigned long   svci1_code;           /* install code of service    */
  67.     unsigned short  svci1_pid;           /* pid of service program    */
  68. };    /* service_info_1 */
  69.  
  70. struct service_info_2 {
  71.     char         svci2_name[SNLEN+1];  /* service name             */
  72.     unsigned short  svci2_status;           /* See "status values" above     */
  73.     unsigned long   svci2_code;           /* install code of service    */
  74.     unsigned short  svci2_pid;           /* pid of service program    */
  75.     char        svci2_text[STXTLEN+1];   /* text area for use by services */
  76. };    /* service_info_2 */
  77.  
  78. struct service_status {
  79.     unsigned short  svcs_status;           /* See "status values" above     */
  80.     unsigned long   svcs_code;           /* install code of service    */
  81.     unsigned short  svcs_pid;           /* pid of service program    */
  82.     char        svcs_text[STXTLEN+1];   /* text area for use by services */
  83. };    /* service_status */
  84.  
  85.  
  86.  
  87. /**************************************************************** 
  88.  *                                *
  89.  *          Special values and constants            *
  90.  *                                *
  91.  ****************************************************************/
  92.  
  93. /*
  94.  *    SERVICE_RCV_SIG_FLAG is the value passed to DosSetSigHandler when 
  95.  *    installing the handler within a service, to recieve control
  96.  *    signals.
  97.  */
  98.  
  99. #define SERVICE_RCV_SIG_FLAG 5
  100.  
  101. /* 
  102.  *    Bitmask and bit values for svci1_status, svci2_status, and
  103.  *    svcs_status fields.  For each "sub-field", there is a mask
  104.  *    defined, and a number of constants representing the value
  105.  *    obtained by doing (status & mask).
  106.  */
  107.  
  108. /* Bits 0,1 -- general status */
  109.  
  110. #define SERVICE_INSTALL_STATE          0x03
  111. #define    SERVICE_UNINSTALLED         0x00
  112. #define    SERVICE_INSTALL_PENDING        0x01
  113. #define    SERVICE_UNINSTALL_PENDING    0x02
  114. #define    SERVICE_INSTALLED        0x03
  115.  
  116. /* Bits 2,3 -- paused/active status */
  117.  
  118. #define SERVICE_PAUSE_STATE          0x0C
  119. #define SERVICE_ACTIVE            0x00
  120. #define    SERVICE_CONTINUE_PENDING    0x04
  121. #define SERVICE_PAUSE_PENDING        0x08
  122. #define SERVICE_PAUSED            0x0C
  123.  
  124. /* Bit 4 -- uninstallable indication */
  125.  
  126. #define SERVICE_NOT_UNINSTALLABLE    0x00
  127. #define SERVICE_UNINSTALLABLE        0x10
  128.  
  129. /* Bit 5 -- pausable indication */
  130.  
  131. #define SERVICE_NOT_PAUSABLE        0x00
  132. #define SERVICE_PAUSABLE        0x20
  133.  
  134. /* Workstation service only:  
  135.  * Bits 8,9,10 -- redirection paused/active */
  136.  
  137. #define SERVICE_REDIR_PAUSED        0x700
  138. #define SERVICE_REDIR_DISK_PAUSED    0x100
  139. #define SERVICE_REDIR_PRINT_PAUSED    0x200
  140. #define SERVICE_REDIR_COMM_PAUSED    0x400
  141.  
  142. /* 
  143.  *    Standard Lan Manager service names.
  144.  */
  145.  
  146. #define SERVICE_WORKSTATION    "WORKSTATION"
  147. #define SERVICE_SERVER        "SERVER"
  148. #define SERVICE_MESSENGER    "MESSENGER"
  149. #define SERVICE_NETRUN         "NETRUN"
  150. #define SERVICE_SPOOLER        "SPOOLER"
  151. #define SERVICE_ALERTER     "ALERTER"
  152. #define SERVICE_NETLOGON     "NETLOGON"
  153. #define SERVICE_NETPOPUP    "NETPOPUP"
  154. #define SERVICE_SQLSERVER    "SQLSERVER"
  155.  
  156. /*
  157.  *    NetServiceControl opcodes.
  158.  */
  159.  
  160. #define SERVICE_CTRL_INTERROGATE    0
  161. #define SERVICE_CTRL_PAUSE        1
  162. #define SERVICE_CTRL_CONTINUE        2
  163. #define SERVICE_CTRL_UNINSTALL        3
  164.  
  165. /*
  166.  *    Workstation service only:  Bits used in the "arg" parameter
  167.  *    to NetServiceControl in conjunction with the opcode
  168.  *    SERVICE_CTRL_PAUSE or SERVICE_CTRL_CONTINUE, to pause or
  169.  *    continue redirection.
  170.  */
  171.  
  172. #define SERVICE_CTRL_REDIR_DISK        0x1
  173. #define SERVICE_CTRL_REDIR_PRINT    0x2
  174. #define SERVICE_CTRL_REDIR_COMM        0x4
  175.  
  176.  
  177. /*
  178.  *    Values for svci1_code, svci2_code, and svcs_code when
  179.  *    status of the service is SERVICE_INSTALL_PENDING
  180.  *    A service can optionally provide a hint to the installer
  181.  *    that the install is proceeding and how long to wait
  182.  *    (in 0.1 second increments) before querying status again.
  183.  */
  184.  
  185. #define SERVICE_IP_NO_HINT        0x0
  186. #define SERVICE_IP_QUERY_HINT        0x10000
  187.  
  188.     /* Mask for install proceeding checkpoint number */
  189. #define SERVICE_IP_CHKPT_NUM        0x0FF
  190.  
  191.     /* Mask for wait time hint before querying again */
  192. #define SERVICE_IP_WAIT_TIME        0x0FF00
  193.  
  194.     /* Shift count for building wait time _code values */
  195. #define SERVICE_IP_WAITTIME_SHIFT    8
  196.  
  197.  
  198.  
  199. /*NOINC*/
  200. #define SERVICE_IP_CODE(tt,nn) \
  201.   ((long)SERVICE_IP_QUERY_HINT|(long)(nn|(tt<<SERVICE_IP_WAITTIME_SHIFT)))
  202.  
  203. #define SERVICE_UIC_CODE(cc,mm) \
  204.   ((long)(((long)cc<<16)|(long)(unsigned)mm))
  205. /*INC*/
  206.  
  207. /***    SERVICE_BASE is the base of service error codes,
  208.  *    chosen to avoid conflict with OS, redirector,
  209.  *    netapi, and errlog codes.  
  210.  */
  211.  
  212. #define SERVICE_BASE    3050
  213.  
  214.  
  215.  
  216.  
  217. /*  Uninstall codes, to be used in high byte of 'code' on final NetStatus,
  218.  *  which sets the status to UNINSTALLED 
  219.  */
  220.  
  221. /*NOINC*/
  222. #define SERVICE_UIC_NORMAL    0
  223. #define SERVICE_UIC_BADPARMVAL    (SERVICE_BASE + 1) \
  224.         /* LANMAN.INI or the command line has an illegal value for "%1". */
  225. #define SERVICE_UIC_MISSPARM    (SERVICE_BASE + 2) \
  226.         /* The required parameter "%1" was not provided on the command line or in LANMAN.INI. */
  227. #define SERVICE_UIC_UNKPARM    (SERVICE_BASE + 3) \
  228.         /* The unknown parameter "%1" was provided on the command line or in LANMAN.INI. */
  229. #define SERVICE_UIC_RESOURCE    (SERVICE_BASE + 4) /* A request for %1 resources could not be satisfied. */
  230. #define SERVICE_UIC_CONFIG    (SERVICE_BASE + 5) /* A problem exists with the system configuration:  %1. */
  231. #define SERVICE_UIC_SYSTEM    (SERVICE_BASE + 6) /* A system error has occured. */
  232. #define SERVICE_UIC_INTERNAL    (SERVICE_BASE + 7) /* An internal consistency error has occured. */
  233. #define SERVICE_UIC_AMBIGPARM    (SERVICE_BASE + 8) \
  234.         /* LANMAN.INI or the command line has an ambiguous parameter "%1". */
  235. #define SERVICE_UIC_DUPPARM    (SERVICE_BASE + 9) \
  236.         /* LANMAN.INI or the command line has a duplicate parameter "%1". */
  237. #define SERVICE_UIC_KILL    (SERVICE_BASE + 10) \
  238.         /* The service did not respond to control and was stopped with the DosKillProc function.*/
  239. #define SERVICE_UIC_EXEC    (SERVICE_BASE + 11) \
  240.     /* An error occurred when loading the service. */
  241. #define SERVICE_UIC_SUBSERV    (SERVICE_BASE + 12) \
  242.     /* The sub-service %1 failed to install. */
  243. #define SERVICE_UIC_BADCOMPNAME    (SERVICE_BASE + 13) \
  244.     /* "%1" is not a valid computername.  On an Entry Level Server, computername must be "SERVER".*/
  245. /*INC*/
  246.  
  247. /***
  248.  *    The modifiers
  249.  */
  250.  
  251. /*  General: */
  252. #define SERVICE_UIC_M_NULL    0
  253.  
  254. /*  BADPARMVAL:  A text string in service_info_2.text */
  255. /*  MISSPARM:  ditto */
  256. /*  UNKPARM:  ditto */
  257. /*  AMBIGPARM:  ditto */
  258. /*  DUPPARM:  ditto */
  259. /*  SUBSERV:  ditto */
  260.  
  261. /*NOINC*/
  262. /*  RESOURCE: */
  263. #define SERVICE_UIC_M_MEMORY    (SERVICE_BASE + 20) /* @I
  264.     *memory%0 */
  265. #define SERVICE_UIC_M_DISK    (SERVICE_BASE + 21) /* @I 
  266.     *disk space%0 */
  267. #define SERVICE_UIC_M_THREADS    (SERVICE_BASE + 22) /* @I 
  268.     *thread%0 */
  269. #define SERVICE_UIC_M_PROCESSES    (SERVICE_BASE + 23) /* @I 
  270.     *process%0 */
  271.  
  272. /*  CONFIG: */
  273. #define SERVICE_UIC_M_SECURITY    (SERVICE_BASE + 24) /* @I 
  274.     *Security Failure%0 */
  275. #define SERVICE_UIC_M_LANROOT    (SERVICE_BASE + 25) /* @I 
  276.     *Bad or Missing Lan Root%0 */
  277. #define SERVICE_UIC_M_REDIR    (SERVICE_BASE + 26) /* @I 
  278.     *The network software is not installed%0 */
  279. #define SERVICE_UIC_M_SERVER    (SERVICE_BASE + 27) /* @I 
  280.     *The Server is not started%0 */
  281. #define SERVICE_UIC_M_SEC_FILE_ERR (SERVICE_BASE + 28) /* @I
  282.         *The server could not access the user accounts database (net.acc)%0 */
  283. #define SERVICE_UIC_M_FILES    (SERVICE_BASE + 29) /* @I 
  284.     *There are incompatible files installed in the LANMAN tree%0 */
  285. #define SERVICE_UIC_M_LOGS    (SERVICE_BASE + 30) /* @I
  286.     *The LANMAN\LOGS directory is invalid%0 */
  287. #define SERVICE_UIC_M_LANGROUP    (SERVICE_BASE + 31) /* @I
  288.     *The LANGROUP specified could not be used%0 */
  289. #define SERVICE_UIC_M_MSGNAME    (SERVICE_BASE + 32) /* @I
  290.     *The computername is being used as a message alias on another computer%0 */
  291. #define SERVICE_UIC_M_ANNOUNCE    (SERVICE_BASE + 33) /* @I
  292.     *The announce of the server name by the workstation failed%0 */
  293. /*INC*/
  294.  
  295.  
  296. /* SYSTEM:  A DOS or NET error number */
  297. /* INTERNAL:  None */
  298. /* KILL:  None */
  299. /* EXEC:  None */
  300.  
  301. /***
  302.  *    End modifiers
  303.  */
  304.  
  305.