home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / LMSVC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  13.1 KB  |  535 lines

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