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