xref: /illumos-gate/usr/src/uts/common/smbsrv/ndl/srvsvc.ndl (revision b23a7923c0fe493ed4beebaf775ad634ea217080)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 */
25
26#ifndef _MLSVC_LANMAN_NDL_
27#define _MLSVC_LANMAN_NDL_
28
29/*
30 * LanMan RPC (WKSSVC and SRVSVC) interface definitions.
31 */
32
33#include "ndrtypes.ndl"
34
35/*
36 * WARNING: The cpp(1) macros in this file are not understood by
37 *          /usr/bin/cpp. Use /usr/libexec/cpp instead.
38 */
39
40/*
41 * TYPE CONSTRUCTOR MACROS FOR INFORMATION RESULTS
42 ****************************************************************
43 *
44 * This is an explanation of the macros that follow this comment.
45 *
46 * The LANMAN API's look something like this:
47 *
48 *	NetXXXGetInfo (
49 *		IN  char *  servername,
50 *		IN  char *  XXX_name,
51 *		IN  int     level,
52 *		OUT char ** bufptr);
53 *
54 * The bufptr is a pointer-to-pointer (**). The NetXXXGetInfo() function
55 * malloc()s memory, and sets *bufptr to the memory. The API's
56 * are undiscriminated about what bufptr really points to.
57 *
58 * However, for RPI (Remote Procedure Interface), this just won't fly.
59 * We have to know what the result data looks like in order to
60 * properly (un)marshall it.
61 *
62 * As best we can determine, the MSC developers use an RPI that looks
63 * like this (approximately in IDL):
64 *
65 *	RemoteNetXXXGetInfo (
66 *		IN  char *  servername,
67 *		IN  char *  XXX_name,
68 *		IN  int     level,
69 *		OUT union switch(level) {
70 * 			case(1): XXX_INFO_1 * info1;
71 *			case(2): XXX_INFO_2 * info2;
72 *		    }       bufptr);
73 *
74 * The level guides the (un)marshalling as it follows the pointer.
75 * DCE(MS) IDL will automatically form a structure for the union
76 * which looks about like this (much as Sun/RPC does):
77 *
78 *	struct {
79 *		int   _keyvalue_;
80 *		union {
81 *			XXX_INFO_1 *info1;
82 *			XXX_INFO_2 *info2;
83 *		}      _u_;
84 *	} bufptr;
85 *
86 * This struct is not made visible to the application. It is purely
87 * an internal (automagic) thing.  However, ndrgen does not do this.
88 * The ndrgen input MUST remain a valid C header file, and all
89 * struct and union declarations must be exact, and we (would) have
90 * to tediously code sequences like this (approximately NDL)):
91 *
92 *	union XXXGetInfo_result_u {
93 *	    [case(1)]
94 *		XXX_INFO_1 *	info1;
95 *	    [case(2)]
96 *		XXX_INFO_2 *	info2;
97 *	};
98 *
99 *	struct XXXGetInfo_result {
100 *		int	level;
101 *
102 *		union XXXGetInfo_result_u bufptr;
103 *	};
104 *
105 *	struct XXXGetInfo_param {	// still have to code this one
106 *	    [in]  char *	servername;
107 *	    [in]  ushort	level;
108 *	    [out] struct XXXGetInfo_result result;
109 *	};
110 *
111 * This is error prone and difficult to write, and more difficult
112 * and distracting to read. It is hard to pick through the
113 * necessary evils and see what's really going on. To mitigate
114 * the situation, we have a series of macros which generate
115 * the tedious code, and are easily recognized as supporting
116 * fluff rather than important structures:
117 *
118 *	INFO1RES_DEFINITION(XXXGetInfo,
119 *		INFO1RES_UNION_ENTRY(XXXGetInfo, 1)
120 *		INFO1RES_UNION_ENTRY(XXXGetInfo, 2))
121 *
122 *	structt XXXGetInfo_param {	// still have to code this one
123 *	    [in]  char *	servername;
124 *	    [in]  ushort	level;
125 *	    [out] struct XXXGetInfo_result result;
126 *	};
127 *
128 * The INFO1RES_DEFINITION macro defines two types:
129 *
130 *	union ...__ru {...}
131 *	struct ..._result { DWORD level; union ..._ru bufptr; }
132 *
133 * There is a similar macro, INFO1RESBUF_DEFINITION, which defines
134 * actual space rather than just pointers. It defines:
135 *
136 *	union ...._rb {...}
137 *	typedef union ..._rb ..._rb;
138 *
139 * Which is handy in functions because the initial coding sequence
140 * looks something like:
141 *
142 *	XXXGetInfoParam (struct XXXGetInfo_param *param) {
143 *		XXXGetInfo_rb	rb;
144 *
145 *		param->result.level = param->level;	// for marshalling
146 *		param->result.bufptr.nullptr = &rb;	// anything fits
147 *
148 * There are two flavors of Info results. The first is the
149 * single XXX_INFO_x result, which the foregoing example
150 * uses. The second flavor is when there are multiple entries
151 * possible. Again, for the sake of guiding the marshalling,
152 * the RPIs use something accommodating:
153 *
154 *	struct XXX_INFO_1_result {
155 *		unsigned	entriesread;
156 *	   [size_is(entriesread)]
157 *		XXX_INFO_1 *	table;
158 *	};
159 *
160 *	union { XXX_INFO_1_result *info1; ...}
161 *
162 * Notice this is using XXX_INFO_1_result rather than just XXX_INFO_1.
163 * The requirements from this point are much like before. Because of
164 * the variable-length value, there is no realistic way to do something
165 * like INFO1RESBUF_DEFINITION.
166 *
167 * There are two sets of macros here. INFO1RES_xxx are for the
168 * single result case, and INFONRES_xxx for the multiple entry case.
169 */
170
171/*
172 * INFO1RES_...
173 *	Type constructors for single-result case
174 */
175
176#define INFO1RES_DEFINITION(INFOPREF, ENTRIES) \
177	INFO1RES_UNION(INFOPREF, ENTRIES) \
178	INFO1RES_STRUCT(INFOPREF)
179
180#define INFO1RES_UNION(INFOPREF, ENTRIES) \
181	union INFOPREF##__ru { \
182		INFO1RES_UNION_NULLPTR \
183		ENTRIES \
184	};
185
186#define INFO1RES_UNION_NULLPTR \
187	DEFAULT char *			nullptr;
188
189#define INFO1RES_UNION_ENTRY(INFOPREF,NUM) \
190	CASE(NUM) struct INFOPREF##_##NUM * bufptr##NUM;
191
192#define INFO1RES_STRUCT(INFOPREF) \
193	struct INFOPREF##_result { \
194		DWORD	level; \
195	   SWITCH(level) \
196		union INFOPREF##__ru bufptr; \
197	};
198
199/*
200 * INFO1RESBUF_...
201 *	Type constructors for single-result buffering.
202 */
203
204
205#ifndef NDRGEN
206#define INFO1RESBUF_DEFINITION(INFOPREF, ENTRIES) \
207	typedef union INFOPREF##_rb { \
208		ENTRIES \
209	} INFOPREF##_rb;
210#define INFO1RESBUF_UNION_ENTRY(INFOPREF,NUM) \
211	CASE(NUM) struct INFOPREF##_##NUM   buf##NUM;
212#else
213#define INFO1RESBUF_DEFINITION(INFOPREF, ENTRIES)
214#define INFO1RESBUF_UNION_ENTRY(INFOPREF,NUM)
215#endif
216
217
218
219
220/*
221 * INFONRES_...
222 *	Type constructors for multiple-result case
223 */
224
225#define INFONRES_RESULT(INFOPREF,NUM) \
226	struct INFOPREF##_##NUM##_result { \
227		DWORD	entriesread; \
228	    SIZE_IS(entriesread) \
229		struct INFOPREF##_##NUM *entries; \
230	};
231
232#define INFONRES_DEFINITION(INFOPREF, ENTRIES) \
233	INFONRES_UNION(INFOPREF, ENTRIES) \
234	INFONRES_STRUCT(INFOPREF)
235
236#define INFONRES_UNION(INFOPREF, ENTRIES) \
237	union INFOPREF##__ru { \
238		INFONRES_UNION_NULLPTR \
239		INFONRES_UNION_INFONRES \
240		ENTRIES \
241	};
242
243#define INFONRES_UNION_NULLPTR \
244	DEFAULT char *			nullptr;
245
246#ifndef NDRGEN
247#define INFONRES_UNION_INFONRES \
248	struct mslm_infonres *		p;
249#else
250#define INFONRES_UNION_INFONRES
251#endif
252
253#define INFONRES_UNION_ENTRY(INFOPREF,NUM) \
254	CASE(NUM) struct INFOPREF##_##NUM##_result * bufptr##NUM;
255
256#define INFONRES_STRUCT(INFOPREF) \
257	struct INFOPREF##_result { \
258		DWORD	level; \
259	   SWITCH(level) \
260		union INFOPREF##__ru bufptr; \
261	};
262
263#ifndef NDRGEN
264/*
265 * This just makes things a little easier on the stub modules:
266 *
267 *	XXXGetInfoParam (struct XXXGetInfo_param *param) {
268 *		struct mslm_infonres	infonres;
269 *
270 *		infonres.entriesread = 0;
271 *		infonres.entries = 0;
272 *		param->result.level = param->level;	// for marshalling
273 *		param->result.bufptr.p = &infonres;
274 */
275struct mslm_infonres {
276	DWORD		entriesread;
277	void *		entries;
278};
279#endif
280
281
282/*
283 * SRVSVC - Server Service
284 */
285
286/* Windows NT */
287#define SRVSVC_OPNUM_NetCharDevEnum              0x00
288#define SRVSVC_OPNUM_NetCharDevGetInfo           0x01
289#define SRVSVC_OPNUM_NetCharDevControl           0x02
290#define SRVSVC_OPNUM_NetCharDevQEnum             0x03
291#define SRVSVC_OPNUM_NetCharDevQGetInfo          0x04
292#define SRVSVC_OPNUM_NetCharDevQSetInfo          0x05
293#define SRVSVC_OPNUM_NetCharDevQPurge            0x06
294#define SRVSVC_OPNUM_NetCharDevQPurgeSelf        0x07
295#define SRVSVC_OPNUM_NetConnectEnum              0x08
296#define SRVSVC_OPNUM_NetFileEnum                 0x09
297#define SRVSVC_OPNUM_NetFileGetInfo              0x0a
298#define SRVSVC_OPNUM_NetFileClose                0x0b
299#define SRVSVC_OPNUM_NetSessionEnum              0x0c
300#define SRVSVC_OPNUM_NetSessionDel               0x0d
301#define SRVSVC_OPNUM_NetShareAdd                 0x0e
302#define SRVSVC_OPNUM_NetShareEnum                0x0f
303#define SRVSVC_OPNUM_NetShareGetInfo             0x10
304#define SRVSVC_OPNUM_NetShareSetInfo             0x11
305#define SRVSVC_OPNUM_NetShareDel                 0x12
306#define SRVSVC_OPNUM_NetShareDelSticky           0x13
307#define SRVSVC_OPNUM_NetShareCheck               0x14
308#define SRVSVC_OPNUM_NetServerGetInfo            0x15
309#define SRVSVC_OPNUM_NetServerSetInfo            0x16
310#define SRVSVC_OPNUM_NetServerDiskEnum           0x17
311#define SRVSVC_OPNUM_NetServerStatisticsGet      0x18
312#define SRVSVC_OPNUM_NetServerTransportAdd       0x19
313#define SRVSVC_OPNUM_NetServerTransportEnum      0x1a
314#define SRVSVC_OPNUM_NetServerTransportDel       0x1b
315#define SRVSVC_OPNUM_NetRemoteTOD                0x1c
316#define SRVSVC_OPNUM_NetServerSetServiceBits     0x1d
317#define SRVSVC_OPNUM_NetPathType                 0x1e
318#define SRVSVC_OPNUM_NetPathCanonicalize         0x1f
319#define SRVSVC_OPNUM_NetPathCompare              0x20
320#define SRVSVC_OPNUM_NetNameValidate             0x21
321#define SRVSVC_OPNUM_NetNameCanonicalize         0x22
322#define SRVSVC_OPNUM_NetNameCompare              0x23
323#define SRVSVC_OPNUM_NetShareEnumSticky          0x24
324#define SRVSVC_OPNUM_NetShareDelStart            0x25
325#define SRVSVC_OPNUM_NetShareDelCommit           0x26
326#define SRVSVC_OPNUM_NetGetFileSecurity          0x27
327#define SRVSVC_OPNUM_NetSetFileSecurity          0x28
328#define SRVSVC_OPNUM_NetServerTransportAddEx     0x29
329#define SRVSVC_OPNUM_NetServerSetServiceBitsEx   0x2a
330#define SRVSVC_OPNUM_NetDfsGetVersion            0x2b
331
332/* Windows 2000 */
333#define SRVSVC_OPNUM_NetDfsCreateLocalPartition  0x2c
334#define SRVSVC_OPNUM_NetDfsDeleteLocalPartition  0x2d
335#define SRVSVC_OPNUM_NetDfsSetLocalVolumeState   0x2e
336#define SRVSVC_OPNUM_NetDfsSetServerInfo         0x2f
337#define SRVSVC_OPNUM_NetDfsCreateExitPoint       0x30
338#define SRVSVC_OPNUM_NetDfsDeleteExitPoint       0x31
339#define SRVSVC_OPNUM_NetDfsModifyPrefix          0x32
340#define SRVSVC_OPNUM_NetDfsFixLocalVolume        0x33
341#define SRVSVC_OPNUM_NetDfsManagerReportSiteInfo 0x34
342
343/* Windows XP and Windows Server 2003 */
344#define SRVSVC_OPNUM_NetServerTransportDelEx     0x35
345
346/* Windows Vista */
347#define SRVSVC_OPNUM_NetServerAliasAdd           0x36
348#define SRVSVC_OPNUM_NetServerAliasEnum          0x37
349#define SRVSVC_OPNUM_NetServerAliasDel           0x38
350#define SRVSVC_OPNUM_NetShareDelEx               0x39
351
352/*
353 ***********************************************************************
354 * NetConnectEnum
355 ***********************************************************************
356 */
357
358/*
359 * Level 0 connect information.
360 */
361struct mslm_NetConnectInfoBuf0 {
362        DWORD coni0_id;
363};
364typedef struct mslm_NetConnectInfoBuf0 srvsvc_NetConnectInfoBuf0_t;
365
366struct mslm_NetConnectInfo0 {
367	DWORD entries_read;
368  SIZE_IS(entries_read)
369        struct mslm_NetConnectInfoBuf0 *ci0;
370};
371typedef struct mslm_NetConnectInfo0 srvsvc_NetConnectInfo0_t;
372
373/*
374 * Level 1 connect information.
375 */
376struct mslm_NetConnectInfoBuf1 {
377	DWORD coni1_id;
378	DWORD coni1_type;
379	DWORD coni1_num_opens;
380	DWORD coni1_num_users;
381	DWORD coni1_time;
382	LPTSTR coni1_username;
383	LPTSTR coni1_netname; /* share name */
384};
385typedef struct mslm_NetConnectInfoBuf1 srvsvc_NetConnectInfoBuf1_t;
386
387struct mslm_NetConnectInfo1 {
388	DWORD entries_read;
389  SIZE_IS(entries_read)
390	struct mslm_NetConnectInfoBuf1 *ci1;
391};
392typedef struct mslm_NetConnectInfo1 srvsvc_NetConnectInfo1_t;
393
394union mslm_NetConnectInfoResUnion {
395	CASE(0) struct mslm_NetConnectInfo0 *info0;
396	CASE(1) struct mslm_NetConnectInfo1 *info1;
397	DEFAULT	char *nullptr;
398};
399
400struct mslm_NetConnectInfo {
401	DWORD level;
402	DWORD switch_value;
403  SWITCH(switch_value)
404	union mslm_NetConnectInfoResUnion ru;
405};
406typedef struct mslm_NetConnectInfo srvsvc_NetConnectInfo_t;
407
408OPERATION(SRVSVC_OPNUM_NetConnectEnum)
409struct mslm_NetConnectEnum {
410	IN	LPTSTR servername;
411	IN	LPTSTR qualifier; /* share name */
412	INOUT	struct mslm_NetConnectInfo info;
413	IN	DWORD pref_max_len;
414	OUT 	DWORD total_entries;
415	INOUT	DWORD *resume_handle;
416	OUT	DWORD status;
417};
418
419
420/*
421 ***********************************************************************
422 * NetFileEnum
423 ***********************************************************************
424 */
425struct mslm_NetFileInfoBuf2 {
426	DWORD fi2_id;
427};
428typedef struct mslm_NetFileInfoBuf2 srvsvc_NetFileInfoBuf2_t;
429
430struct mslm_NetFileInfo2 {
431	DWORD entries_read;
432  SIZE_IS(entries_read)
433	struct mslm_NetFileInfoBuf2 *fi2;
434};
435typedef struct mslm_NetFileInfo2 srvsvc_NetFileInfo2_t;
436
437struct mslm_NetFileInfoBuf3 {
438	DWORD fi3_id;
439	DWORD fi3_permissions;
440	DWORD fi3_num_locks;
441	LPTSTR fi3_pathname;
442	LPTSTR fi3_username;
443};
444typedef struct mslm_NetFileInfoBuf3 srvsvc_NetFileInfoBuf3_t;
445
446struct mslm_NetFileInfo3 {
447	DWORD entries_read;
448  SIZE_IS(entries_read)
449	struct mslm_NetFileInfoBuf3 *fi3;
450};
451typedef struct mslm_NetFileInfo3 srvsvc_NetFileInfo3_t;
452
453union mslm_NetFileInfoResUnion {
454	CASE(2)	struct mslm_NetFileInfo2 *info2;
455	CASE(3)	struct mslm_NetFileInfo3 *info3;
456	DEFAULT	char *nullptr;
457};
458
459struct mslm_NetFileInfo {
460	DWORD level;
461	DWORD switch_value;
462  SWITCH(switch_value)
463	union mslm_NetFileInfoResUnion ru;
464};
465
466OPERATION(SRVSVC_OPNUM_NetFileEnum)
467struct mslm_NetFileEnum {
468	IN	LPTSTR servername;
469	IN	DWORD basepath;
470	IN	DWORD username;
471	INOUT	struct mslm_NetFileInfo info;
472	IN	DWORD pref_max_len;
473	OUT	DWORD total_entries;
474	INOUT	DWORD *resume_handle;
475	OUT	DWORD status;
476};
477
478
479/*
480 ***********************************************************************
481 * NetFileClose
482 *
483 * Close files using a file id reported by NetFileEnum.
484 ***********************************************************************
485 */
486OPERATION(SRVSVC_OPNUM_NetFileClose)
487struct mslm_NetFileClose {
488	IN	LPTSTR servername;
489	IN	DWORD file_id;
490	OUT	DWORD status;
491};
492
493
494/*
495 ***********************************************************************
496 * NetShareGetInfo/NetShareSetInfo: netname is the name of a share.
497 *
498 * Levels:
499 *  0      The share name.
500 *  1      Information about the shared resource: name, type of resource
501 *         and a comment.
502 *  2      Information about the shared resource: name, type, permissions,
503 *         password and number of connections.
504 *  501    Information about the shared resource: name, type of resource
505 *         and a comment.
506 *  502    Information about the shared resource, including the name, type,
507 *         permissions, number of connections etc.
508 *  503    Contains information about the shared resource; identical to 502
509 *         except for the addition of a servername.
510 *  1004   A comment for the shared resource.
511 *  1005   A set of flags describing the shared resource.
512 *  1006   The maximum number of concurrent connections that the shared
513 *         resource can accommodate.
514 *  1501   Specifies the SECURITY_DESCRIPTOR for the share.
515 *
516 * Windows Me/98/95 supports level 50, which is similar to level 1.
517 *
518 * shi1005_flags: SHI1005_VALID_FLAGS_SET defines the set of flags that
519 * can be set with the NetShareSetInfo function. SHI1005_FLAGS_DFS and
520 * SHI1005_FLAGS_DFS_ROOT can only be returned, but not set.
521 *
522 * 0x01    SHI1005_FLAGS_DFS
523 *         The specified share is present in a Dfs tree structure.
524 *         This flag cannot be set with NetShareSetInfo.
525 *
526 * 0x02    SHI1005_FLAGS_DFS_ROOT
527 *         The specified share is the root volume in a Dfs tree.
528 *         This flag cannot be set with NetShareSetInfo.
529 *
530 * 0x30    CSC_MASK               Client-side caching (CSC) state:
531 *   0x00  CSC_CACHE_MANUAL_REINT Automatic file-by-file
532 *                                reintegration not allowed.
533 *   0x10  CSC_CACHE_AUTO_REINT   File-by-file reintegration allowed.
534 *   0x20  CSC_CACHE_VDO          File opens do not need to be flowed.
535 *   0x30  CSC_CACHE_NONE         CSC is disabled for this share.
536 *
537 * 0x0100  SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS
538 *         The specified share disallows exclusive file opens,
539 *         where reads to an open file are disallowed.
540 *
541 * 0x0200  SHI1005_FLAGS_FORCE_SHARED_DELETE
542 *         Shared files in the specified share can be forcibly deleted.
543 *
544 * 0x0400  SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING
545 *         Clients are allowed to cache the namespace of the share.
546 *
547 * 0x0800  SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM
548 *         The server will filter directory entries based on the access
549 *         permissions of the client.  The access-based enumeration (ABE)
550 *         flag may also appear as SHI1005_FLAGS_ENFORCE_NAMESPACE_ACCESS.
551 *
552 * Support for Access-based Enumeration (ABE) was added to Windows in
553 * Windows Server 2003 Service Pack 1. ABE filters directory contents
554 * (and other shared resources) returned via a share based on a user's
555 * access rights, i.e. a user would not see objects that are
556 * inaccessible to that user. ABE requests are made using info level
557 * 1005 with the value 0x0800 in the flags field.
558 ***********************************************************************
559 */
560
561#define	CSC_MASK		0x30
562#define	CSC_CACHE_MANUAL_REINT	0x00
563#define	CSC_CACHE_AUTO_REINT	0x10
564#define	CSC_CACHE_VDO		0x20
565#define	CSC_CACHE_NONE		0x30
566
567#define	MLSM_SID_AUTH_MAX	6
568/*
569 * Definition for a SID. The ndl compiler does not allow a typedef of
570 * a structure containing variable size members.
571 */
572struct mslm_sid {
573	BYTE		revision;
574	BYTE		sub_auth_count;
575	BYTE		authority[MLSM_SID_AUTH_MAX];
576  SIZE_IS(sub_auth_count)
577	DWORD		sub_authority[ANY_SIZE_ARRAY];
578};
579
580struct mslm_ace_hdr {
581	BYTE		type;
582	BYTE		flags;
583	WORD		size;
584};
585typedef struct mslm_ace_hdr mslm_ace_hdr_t;
586
587struct mslm_ace {
588	mslm_ace_hdr_t	header;
589	DWORD		mask;
590	struct mslm_sid	*sid;
591};
592typedef struct mslm_ace mslm_ace_t;
593
594struct mslm_acl {
595	BYTE		revision;
596	BYTE		sbz1;
597	WORD		size;
598	WORD		ace_count;
599	WORD		sbz2;
600    SIZE_IS(ace_count)
601	mslm_ace_t	ace[ANY_SIZE_ARRAY];
602};
603
604/*
605 * SRVSVC definition of a security_descriptor.
606 */
607struct mslm_security_descriptor {
608	BYTE revision;
609	BYTE sbz1;
610	WORD control;
611	DWORD offset_owner;
612	DWORD offset_group;
613	DWORD offset_sacl;
614	DWORD offset_dacl;
615	struct mslm_sid *owner;
616	struct mslm_sid *group;
617	struct mslm_acl *sacl;
618	struct mslm_acl *dacl;
619};
620typedef struct mslm_security_descriptor mslm_security_descriptor_t;
621
622struct mslm_NetShareInfo_0 {
623	LPTSTR shi0_netname;
624};
625
626struct mslm_NetShareInfo_1 {
627	LPTSTR shi1_netname;
628	DWORD shi1_type; /* type of resource such as IPC$ */
629	LPTSTR shi1_comment;
630};
631
632struct mslm_NetShareInfo_2 {
633	LPTSTR shi2_netname;
634	DWORD shi2_type;
635	LPTSTR shi2_comment;
636	DWORD shi2_permissions;
637	DWORD shi2_max_uses;
638	DWORD shi2_current_uses;
639	LPTSTR shi2_path;
640	LPTSTR shi2_passwd;
641};
642
643struct mslm_NetShareInfo_501 {
644	LPTSTR shi501_netname;
645	DWORD shi501_type;
646	LPTSTR shi501_comment;
647	DWORD shi501_flags;
648};
649
650struct mslm_NetShareInfo_502 {
651	LPTSTR shi502_netname;
652	DWORD shi502_type;
653	LPTSTR shi502_comment;
654	DWORD shi502_permissions;
655	DWORD shi502_max_uses;
656	DWORD shi502_current_uses;
657	LPTSTR shi502_path;
658	LPTSTR shi502_passwd;
659	DWORD shi502_reserved;
660    SIZE_IS(shi502_reserved)
661	LPBYTE shi502_security_descriptor;
662};
663
664struct mslm_NetShareInfo_503 {
665	LPTSTR shi503_netname;
666	DWORD shi503_type;
667	LPTSTR shi503_comment;
668	DWORD shi503_permissions;
669	DWORD shi503_max_uses;
670	DWORD shi503_current_uses;
671	LPTSTR shi503_path;
672	LPTSTR shi503_passwd;
673	LPTSTR shi503_servername;
674	DWORD shi503_reserved;
675    SIZE_IS(shi503_reserved)
676	LPBYTE shi503_security_descriptor;
677};
678
679struct mslm_NetShareInfo_1004 {
680	LPTSTR shi1004_comment;
681};
682
683struct mslm_NetShareInfo_1005 {
684	DWORD shi1005_flags;
685};
686
687struct mslm_NetShareInfo_1006 {
688	DWORD shi1006_max_uses;
689};
690
691struct mslm_NetShareInfo_1501 {
692	DWORD shi1501_reserved;
693    SIZE_IS(shi1501_reserved)
694	LPBYTE shi1501_security_descriptor;
695};
696
697union mlsm_NetShareInfoResUnion {
698	CASE(0)		struct mslm_NetShareInfo_0 *info0;
699	CASE(1)		struct mslm_NetShareInfo_1 *info1;
700	CASE(2)		struct mslm_NetShareInfo_2 *info2;
701	CASE(501)	struct mslm_NetShareInfo_501 *info501;
702	CASE(502)	struct mslm_NetShareInfo_502 *info502;
703	CASE(503)	struct mslm_NetShareInfo_503 *info503;
704	CASE(1004)	struct mslm_NetShareInfo_1004 *info1004;
705	CASE(1005)	struct mslm_NetShareInfo_1005 *info1005;
706	CASE(1006)	struct mslm_NetShareInfo_1006 *info1006;
707	CASE(1501)	struct mslm_NetShareInfo_1501 *info1501;
708	DEFAULT	char *nullptr;
709};
710
711
712struct mlsm_NetShareInfoRes {
713	DWORD switch_value;
714  SWITCH(switch_value)
715	union mlsm_NetShareInfoResUnion ru;
716};
717
718
719OPERATION(SRVSVC_OPNUM_NetShareGetInfo)
720struct mlsm_NetShareGetInfo {
721	IN	LPTSTR servername;
722	IN REFERENCE	LPTSTR netname;
723	IN	DWORD level;
724	OUT	struct mlsm_NetShareInfoRes result;
725	OUT	DWORD status;
726};
727
728
729OPERATION(SRVSVC_OPNUM_NetShareSetInfo)
730struct mlsm_NetShareSetInfo {
731	IN	LPTSTR servername;
732	IN REFERENCE	LPTSTR netname;
733	IN	DWORD level;
734	IN	struct mlsm_NetShareInfoRes result;
735	INOUT	DWORD *parm_err;
736	OUT	DWORD status;
737};
738
739
740/*
741 ***********************************************************************
742 * NetSessionEnum
743 *
744 * The NetSessionEnum function provides information about sessions
745 * established on a server.
746 *
747 * Only members of the Administrators or Account Operators local groups
748 * can successfully execute the NetSessionEnum function at level 1 or
749 * level 2. No special group membership is required for level 0 or level
750 * 10 calls.
751 *
752 * Windows NT/2000/XP: The parameter order is as follows.
753 *
754 * NET_API_STATUS NetSessionEnum(LPWSTR servername,
755 *                               LPWSTR UncClientName,
756 *                               LPWSTR username,
757 *                               DWORD level,
758 *                               LPBYTE *bufptr,
759 *                               DWORD prefmaxlen,
760 *                               LPDWORD entriesread,
761 *                               LPDWORD totalentries,
762 *                               LPDWORD resume_handle);
763 *
764 * Windows 95/98/Me: The calling application must use the cbBuffer parameter
765 * to specify the size, in bytes, of the information buffer pointed to by the
766 * pbBuffer parameter. (The cbBuffer parameter replaces the prefmaxlen
767 * parameter.) Neither a user name parameter nor a resume handle parameter is
768 * available on this platform. Therefore, the parameter list is as follows.
769 *
770 * API_FUNCTION NetSessionEnum(const char FAR *pszServer,
771 *                             short sLevel,
772 *                             char FAR *pbBuffer,
773 *                             unsigned short cbBuffer,
774 *                             unsigned short FAR *pcEntriesRead,
775 *                             unsigned short FAR *pcTotalAvail);
776 *
777 * Parameters
778 *
779 * servername
780 * [in] Pointer to a string that specifies the DNS or NetBIOS name of the
781 * remote server on which the function is to execute. If this parameter is
782 * NULL, the local computer is used.
783 * Windows NT 4.0 and earlier: This string must begin with \\.
784 *
785 * UncClientName
786 * [in] Pointer to a string that specifies the name of the computer session
787 * for which information is to be returned. If this parameter is NULL,
788 * NetSessionEnum returns information for all computer sessions on the server.
789 *
790 * username
791 * [in] Pointer to a string that specifies the name of the user for which
792 * information is to be returned. If this parameter is NULL, NetSessionEnum
793 * returns information for all users.
794 *
795 * level
796 * [in] Specifies the information level of the data. This parameter can be
797 * one of the following values.
798 * Windows NT/2000/XP: The following levels are valid.
799 * Value    Meaning
800 * 0        Return the name of the computer that established the session.
801 *          The bufptr parameter points to an array of SESSION_INFO_0
802 *          structures.
803 * 1        Return the name of the computer, name of the user, and open files,
804 *          pipes, and devices on the computer. The bufptr parameter points to
805 *          an array of SESSION_INFO_1 structures.
806 * 2        In addition to the information indicated for level 1, return the
807 *          type of client and how the user established the session. The bufptr
808 *          parameter points to an array of SESSION_INFO_2 structures.
809 * 10       Return the name of the computer, name of the user, and active and
810 *          idle times for the session. The bufptr parameter points to an array
811 *          of SESSION_INFO_10 structures.
812 * 502      Return the name of the computer; name of the user; open files,
813 *          pipes, and devices on the computer; and the name of the transport
814 *          the  client is using. The bufptr parameter points to an array of
815 *          SESSION_INFO_502 structures.
816 *
817 * Windows 95/98/Me: The following level is valid.
818 * Value    Meaning
819 * 50       Return the name of the computer, name of the user, open files on
820 *          the computer, and the name of the transport protocol the client is
821 *          using. The pbBuffer parameter points to an array of session_info_50
822 *          structures.
823 *
824 * bufptr
825 * [out] Pointer to the buffer that receives the data. The format of this
826 * data depends on the value of the level parameter.
827 * Windows NT/2000/XP: This buffer is allocated by the system and must be
828 * freed using the NetApiBufferFree function. Note that you must free the
829 * buffer even if the function fails with ERROR_MORE_DATA.
830 * Windows 95/98/Me: The caller must allocate and deallocate this buffer.
831 *
832 * prefmaxlen
833 * [in] Specifies the preferred maximum length of returned data, in bytes.
834 * If you specify MAX_PREFERRED_LENGTH, the function allocates the amount
835 * of memory required for the data. If you specify another value in this
836 * parameter, it can restrict the number of bytes that the function returns.
837 * If the buffer size is insufficient to hold all entries, the function
838 * returns ERROR_MORE_DATA. For more information, see Network Management
839 * Function Buffers and Network Management Function Buffer Lengths.
840 *
841 * entriesread
842 * [out] Pointer to a value that receives the count of elements actually
843 * enumerated.
844 *
845 * totalentries
846 * [out] Pointer to a value that receives the total number of entries that
847 * could have been enumerated from the current resume position.
848 *
849 * resume_handle
850 * [in/out] Pointer to a value that contains a resume handle which is used
851 * to continue an existing session search. The handle should be zero on the
852 * first call and left unchanged for subsequent calls. If resume_handle is
853 * NULL, no resume handle is stored.
854 *
855 *
856 * SESSION_INFO_1
857 * ==============
858 * The SESSION_INFO_1 structure contains information about the session,
859 * including name of the computer; name of the user; and open files, pipes,
860 * and devices on the computer.
861 *
862 * Members
863 *
864 * sesi1_cname
865 * Pointer to a Unicode string specifying the name of the computer that
866 * established the session.
867 *
868 * sesi1_username
869 * Pointer to a Unicode string specifying the name of the user who established
870 * the session.
871 *
872 * sesi1_num_opens
873 * Specifies a DWORD value that contains the number of files, devices,
874 * and pipes opened during the session.
875 *
876 * sesi1_time
877 * Specifies a DWORD value that contains the number of seconds the session
878 * has been active.
879 *
880 * sesi1_idle_time
881 * Specifies a DWORD value that contains the number of seconds the session
882 * has been idle.
883 *
884 * sesi1_user_flags
885 * Specifies a DWORD value that describes how the user established the
886 * session. This member can be one of the following values:
887 * SESS_GUEST           The user specified by the sesi1_username member
888 *                      established the session using a guest account.
889 * SESS_NOENCRYPTION    The user specified by the sesi1_username member
890 *                      established the session without using password
891 *                      encryption.
892 ***********************************************************************
893 */
894
895#define SESS_GUEST          0x00000001
896#define SESS_NOENCRYPTION   0x00000002
897
898struct mslm_SESSION_INFO_0 {
899	LPTSTR sesi0_cname;
900};
901INFONRES_RESULT(mslm_SESSION_INFO, 0)
902
903struct mslm_SESSION_INFO_1 {
904	LPTSTR sesi1_cname;
905	LPTSTR sesi1_uname;
906	DWORD  sesi1_nopens;
907	DWORD  sesi1_time;
908	DWORD  sesi1_itime;
909	DWORD  sesi1_uflags;
910};
911INFONRES_RESULT(mslm_SESSION_INFO, 1)
912
913struct mslm_SESSION_INFO_2 {
914	LPTSTR sesi2_cname;
915	LPTSTR sesi2_uname;
916	DWORD  sesi2_nopens;
917	DWORD  sesi2_time;
918	DWORD  sesi2_itime;
919	DWORD  sesi2_uflags;
920	LPTSTR sesi2_cltype_name;
921};
922INFONRES_RESULT(mslm_SESSION_INFO, 2)
923
924struct mslm_SESSION_INFO_10 {
925	LPTSTR sesi10_cname;
926	LPTSTR sesi10_uname;
927	DWORD  sesi10_time;
928	DWORD  sesi10_itime;
929};
930INFONRES_RESULT(mslm_SESSION_INFO, 10)
931
932struct mslm_SESSION_INFO_502 {
933	LPTSTR sesi502_cname;
934	LPTSTR sesi502_uname;
935	DWORD  sesi502_nopens;
936	DWORD  sesi502_time;
937	DWORD  sesi502_itime;
938	DWORD  sesi502_uflags;
939	LPTSTR sesi502_cltype_name;
940	LPTSTR sesi502_transport;
941};
942INFONRES_RESULT(mslm_SESSION_INFO, 502)
943
944INFONRES_DEFINITION(mslm_NetSessionEnum,
945	INFONRES_UNION_ENTRY(mslm_SESSION_INFO, 0)
946	INFONRES_UNION_ENTRY(mslm_SESSION_INFO, 1)
947	INFONRES_UNION_ENTRY(mslm_SESSION_INFO, 2)
948	INFONRES_UNION_ENTRY(mslm_SESSION_INFO, 10)
949	INFONRES_UNION_ENTRY(mslm_SESSION_INFO, 502))
950
951OPERATION(SRVSVC_OPNUM_NetSessionEnum)
952struct mslm_NetSessionEnum {
953	IN		LPTSTR servername;
954	IN		DWORD unc_clientname;
955	IN		DWORD username;
956	INOUT	DWORD level;
957	INOUT	struct mslm_NetSessionEnum_result result;
958	IN		DWORD pref_max_len;
959	OUT		DWORD total_entries;
960	INOUT	DWORD *resume_handle;
961	OUT		DWORD status;
962};
963
964
965/*
966 ***********************************************************************
967 * NetSessionDel (Platform SDK: Network Management)
968 *
969 * The NetSessionDel function ends a network session between a server
970 * and a workstation.
971 *
972 * Security Requirements
973 * Only members of the Administrators or Account Operators local group
974 * can successfully execute the NetSessionDel function.
975 *
976 * Windows NT/2000/XP: The parameter order is as follows.
977 *
978 * NET_API_STATUS NetSessionDel(LPWSTR servername,
979 *                              LPWSTR UncClientName,
980 *                              LPWSTR username);
981 *
982 * Windows 95/98/Me: The sReserved parameter replaces the username
983 * parameter. For more information, see the following Remarks section.
984 * The parameter list is as follows.
985 *
986 * API_FUNCTION NetSessionDel(const char FAR *pszServer,
987 *                            const char FAR *pszClientName,
988 *                            short  sReserved);
989 *
990 * Parameters
991 *
992 * servername
993 * [in] Pointer to a string that specifies the DNS or NetBIOS name
994 * of the server.  Servers should not validate this parameter.
995 * This parameter may be NULL and on Windows NT 4.0 and earlier it
996 * should begin with \\.
997 *
998 * UncClientName
999 * [in] Pointer to a string that specifies the name of the client
1000 * to disconnect. If UncClientName is NULL, all sessions associated
1001 * with the specified user will be disconnected.
1002 *
1003 * username
1004 * [in] Pointer to a string that specifies the name of the user whose
1005 * session is to be terminated. If username is NULL, all sessions
1006 * from the specified client will be disconnected.
1007 *
1008 * Remarks
1009 * Windows 95/98/Me: You must specify the session key in the sReserved
1010 * parameter when you call NetSessionDel. The session key is returned by
1011 * the NetSessionEnum function or the NetSessionGetInfo function in the
1012 * sesi50_key member of the session_info_50 structure.
1013 ***********************************************************************
1014 */
1015
1016OPERATION(SRVSVC_OPNUM_NetSessionDel)
1017struct mslm_NetSessionDel {
1018	IN	LPTSTR servername;
1019	IN	LPTSTR unc_clientname;
1020	IN	LPTSTR username;
1021	OUT	DWORD status;
1022};
1023
1024
1025/*
1026 * SRVSVC NetServerGetInfo (
1027 *	IN LPTSTR	servername,
1028 *	IN DWORD	level,
1029 *	OUT union switch(level) {
1030 *		case 100: _SERVER_INFO_100 *	p100;
1031 *		case 101: _SERVER_INFO_101 *	p101;
1032 *		case 102: _SERVER_INFO_102 *	p102;
1033 *	    }		bufptr,
1034 *	OUT DWORD	status
1035 *      )
1036 */
1037
1038/* for svX_platform */
1039#define	SV_PLATFORM_ID_DOS		300
1040#define	SV_PLATFORM_ID_OS2		400
1041#define	SV_PLATFORM_ID_NT		500
1042#define	SV_PLATFORM_ID_OSF		600
1043#define	SV_PLATFORM_ID_VMS		700
1044
1045/* Bit-mapped values for svX_type fields */
1046#define SV_TYPE_WORKSTATION         0x00000001
1047#define SV_TYPE_SERVER              0x00000002
1048#define SV_TYPE_SQLSERVER           0x00000004
1049#define SV_TYPE_DOMAIN_CTRL         0x00000008
1050#define SV_TYPE_DOMAIN_BAKCTRL      0x00000010
1051#define SV_TYPE_TIME_SOURCE         0x00000020
1052#define SV_TYPE_AFP                 0x00000040
1053#define SV_TYPE_NOVELL              0x00000080
1054#define SV_TYPE_DOMAIN_MEMBER       0x00000100
1055#define SV_TYPE_PRINTQ_SERVER       0x00000200
1056#define SV_TYPE_DIALIN_SERVER       0x00000400
1057#define SV_TYPE_XENIX_SERVER        0x00000800
1058#define SV_TYPE_SERVER_UNIX         SV_TYPE_XENIX_SERVER
1059#define SV_TYPE_NT                  0x00001000	/* NT Workstation */
1060#define SV_TYPE_WFW                 0x00002000	/* Windows for Workgroups */
1061
1062#define SV_TYPE_SERVER_MFPN         0x00004000
1063#define SV_TYPE_SERVER_NT           0x00008000	/* NT Server */
1064#define SV_TYPE_POTENTIAL_BROWSER   0x00010000
1065#define SV_TYPE_BACKUP_BROWSER      0x00020000
1066#define SV_TYPE_MASTER_BROWSER      0x00040000
1067#define SV_TYPE_DOMAIN_MASTER       0x00080000
1068#define SV_TYPE_SERVER_OSF          0x00100000
1069#define SV_TYPE_SERVER_VMS          0x00200000
1070#define SV_TYPE_WINDOWS             0x00400000  /* Windows95 and above */
1071#define SV_TYPE_ALTERNATE_XPORT     0x20000000  /* Return alt transport list */
1072#define SV_TYPE_LOCAL_LIST_ONLY     0x40000000  /* Return local list only */
1073#define SV_TYPE_DOMAIN_ENUM         0x80000000
1074#define SV_TYPE_ALL                 0xFFFFFFFF  /* handy for NetServerEnum2 */
1075
1076#define SV_TYPE_DEFAULT (SV_TYPE_WORKSTATION | SV_TYPE_SERVER | SV_TYPE_NT | \
1077    SV_TYPE_SERVER_NT)
1078
1079/* Special value for sv102_disc that specifies infinite disconnect time */
1080#define SV_NODISC           (-1L)  /* No autodisconnect timeout enforced */
1081
1082/* Values of svX_security field */
1083#define SV_USERSECURITY     1
1084#define SV_SHARESECURITY    0
1085
1086/* Values of svX_hidden field */
1087#define SV_HIDDEN       1
1088#define SV_VISIBLE      0
1089
1090
1091struct mslm_SERVER_INFO_100 {
1092	DWORD		sv100_platform_id;
1093	LPTSTR		sv100_name;
1094};
1095
1096struct mslm_SERVER_INFO_101 {
1097	DWORD		sv101_platform_id;
1098	LPTSTR		sv101_name;
1099	DWORD		sv101_version_major;
1100	DWORD		sv101_version_minor;
1101	DWORD		sv101_type;
1102	LPTSTR		sv101_comment;
1103};
1104
1105struct mslm_SERVER_INFO_102 {
1106	DWORD		sv102_platform_id;
1107	LPTSTR		sv102_name;
1108	DWORD		sv102_version_major;
1109	DWORD		sv102_version_minor;
1110	DWORD		sv102_type;
1111	LPTSTR		sv102_comment;
1112	DWORD		sv102_users;
1113	DWORD		sv102_disc;
1114	DWORD		sv102_hidden;		/* BOOL */
1115	DWORD		sv102_announce;
1116	DWORD		sv102_anndelta;
1117	DWORD		sv102_licenses;
1118	LPTSTR		sv102_userpath;
1119};
1120
1121struct mslm_SERVER_INFO_502 {
1122	DWORD sv502_sessopens;
1123	DWORD sv502_sessvcs;
1124	DWORD sv502_opensearch;
1125	DWORD sv502_sizreqbuf;
1126	DWORD sv502_initworkitems;
1127	DWORD sv502_maxworkitems;
1128	DWORD sv502_rawworkitems;
1129	DWORD sv502_irpstacksize;
1130	DWORD sv502_maxrawbuflen;
1131	DWORD sv502_sessusers;
1132	DWORD sv502_sessconns;
1133	DWORD sv502_maxpagedmemoryusage;
1134	DWORD sv502_maxnonpagedmemoryusage;
1135	DWORD sv502_enablesoftcompat;
1136	DWORD sv502_enableforcedlogoff;
1137	DWORD sv502_timesource;
1138	DWORD sv502_acceptdownlevelapis;
1139	DWORD sv502_lmannounce;
1140};
1141
1142struct mslm_SERVER_INFO_503 {
1143	DWORD sv503_sessopens;
1144	DWORD sv503_sessvcs;
1145	DWORD sv503_opensearch;
1146	DWORD sv503_sizreqbuf;
1147	DWORD sv503_initworkitems;
1148	DWORD sv503_maxworkitems;
1149	DWORD sv503_rawworkitems;
1150	DWORD sv503_irpstacksize;
1151	DWORD sv503_maxrawbuflen;
1152	DWORD sv503_sessusers;
1153	DWORD sv503_sessconns;
1154	DWORD sv503_maxpagedmemoryusage;
1155	DWORD sv503_maxnonpagedmemoryusage;
1156	DWORD sv503_enablesoftcompat;
1157	DWORD sv503_enableforcedlogoff;
1158	DWORD sv503_timesource;
1159	DWORD sv503_acceptdownlevelapis;
1160	DWORD sv503_lmannounce;
1161	LPTSTR sv503_domain;
1162	DWORD sv503_maxcopyreadlen;
1163	DWORD sv503_maxcopywritelen;
1164	DWORD sv503_minkeepsearch;
1165	DWORD sv503_maxkeepsearch;
1166	DWORD sv503_minkeepcomplsearch;
1167	DWORD sv503_maxkeepcomplsearch;
1168	DWORD sv503_threadcountadd;
1169	DWORD sv503_numblockthreads;
1170	DWORD sv503_scavtimeout;
1171	DWORD sv503_minrcvqueue;
1172	DWORD sv503_minfreeworkitems;
1173	DWORD sv503_xactmemsize;
1174	DWORD sv503_threadpriority;
1175	DWORD sv503_maxmpxct;
1176	DWORD sv503_oplockbreakwait;
1177	DWORD sv503_oplockbreakresponsewait;
1178	DWORD sv503_enableoplocks;
1179	DWORD sv503_enableoplockforceclose;
1180	DWORD sv503_enablefcbopens;
1181	DWORD sv503_enableraw;
1182	DWORD sv503_enablesharednetdrives;
1183	DWORD sv503_minfreeconnections;
1184	DWORD sv503_maxfreeconnections;
1185};
1186
1187union mslm_NetServerGetInfo_ru {
1188	CASE(100)	struct mslm_SERVER_INFO_100 *bufptr100;
1189	CASE(101)	struct mslm_SERVER_INFO_101 *bufptr101;
1190	CASE(102)	struct mslm_SERVER_INFO_102 *bufptr102;
1191	CASE(502)	struct mslm_SERVER_INFO_502 *bufptr502;
1192	CASE(503)	struct mslm_SERVER_INFO_503 *bufptr503;
1193	DEFAULT		char *nullptr;
1194};
1195
1196struct mslm_NetServerGetInfo_result {
1197	DWORD level;
1198  SWITCH(level)
1199	union mslm_NetServerGetInfo_ru bufptr;
1200};
1201
1202
1203OPERATION(SRVSVC_OPNUM_NetServerGetInfo)
1204struct mslm_NetServerGetInfo {
1205	IN  LPTSTR	servername;
1206	IN  DWORD	level;
1207	OUT struct mslm_NetServerGetInfo_result result;
1208	OUT DWORD	status;
1209};
1210
1211/*
1212 * SRVSVC NetRemoteTOD (
1213 *	IN LPTSTR	servername,
1214 *	OUT _TIME_OF_DAY_INFO *bufptr,
1215 *	OUT long	status
1216 *      )
1217 */
1218
1219struct mslm_TIME_OF_DAY_INFO {
1220	DWORD		tod_elapsedt;
1221	DWORD		tod_msecs;
1222	DWORD		tod_hours;
1223	DWORD		tod_mins;
1224	DWORD		tod_secs;
1225	DWORD		tod_hunds;
1226	DWORD		tod_timezone;
1227	DWORD		tod_tinterval;
1228	DWORD		tod_day;
1229	DWORD		tod_month;
1230	DWORD		tod_year;
1231	DWORD		tod_weekday;
1232};
1233
1234OPERATION(SRVSVC_OPNUM_NetRemoteTOD)
1235struct mslm_NetRemoteTOD {
1236	IN  LPTSTR	servername;
1237	OUT struct mslm_TIME_OF_DAY_INFO *bufptr;
1238	OUT DWORD	status;
1239};
1240
1241#define	NAMEFLAG_LM2		0x80000000
1242
1243#define	NAMETYPE_USER		1
1244#define	NAMETYPE_PASSWORD	2
1245#define	NAMETYPE_GROUP		3
1246#define	NAMETYPE_COMPUTER	4
1247#define	NAMETYPE_EVENT		5
1248#define	NAMETYPE_DOMAIN		6
1249#define	NAMETYPE_SERVICE	7
1250#define	NAMETYPE_NET		8
1251#define	NAMETYPE_SHARE		9
1252#define	NAMETYPE_MESSAGE	10
1253#define	NAMETYPE_MESSAGEDEST	11
1254#define	NAMETYPE_SHAREPASSWORD	12
1255#define	NAMETYPE_WORKGROUP	13
1256
1257OPERATION(SRVSVC_OPNUM_NetNameValidate)
1258struct mslm_NetNameValidate {
1259 	IN  LPTSTR		servername;
1260 	IN  REFERENCE LPTSTR 	pathname;
1261	IN  DWORD		type;
1262	IN  DWORD		flags;
1263	OUT DWORD		status;
1264};
1265
1266/*
1267 * SRVSVC NetShareEnum (
1268 *	IN  LPTSTR	servername,
1269 *	IN  DWORD	level;
1270 *	OUT union switch(level) {
1271 *		case 0: struct {
1272 *				DWORD entriesread;
1273 *			     [size_is(entriesread)]
1274 *				_SHARE_INFO_0 *entries;
1275 *			} *bufptr0;
1276 *		case 1: struct {
1277 *				DWORD entriesread;
1278 *			     [size_is(entriesread)]
1279 *				_SHARE_INFO_1 *entries;
1280 *			} *bufptr1;
1281 *		...
1282 *	    }		bufptr,
1283 *	IN  DWORD	prefmaxlen,
1284 *	OUT DWORD	totalentries,
1285 *	IN OUT DWORD ?*	resume_handle,
1286 *	OUT DWORD	status
1287 *      )
1288 */
1289
1290/*
1291 * Share types for shiX_type fields - duplicated from smb.h
1292 */
1293#ifndef _SHARE_TYPES_DEFINED_
1294#define _SHARE_TYPES_DEFINED_
1295#define STYPE_DISKTREE          0x00000000
1296#define STYPE_PRINTQ            0x00000001
1297#define STYPE_DEVICE            0x00000002
1298#define STYPE_IPC               0x00000003
1299#define STYPE_MASK              0x0000000F
1300#define STYPE_DFS               0x00000064
1301#define STYPE_HIDDEN            0x80000000
1302#define STYPE_SPECIAL           0x80000000
1303#endif /* _SHARE_TYPES_DEFINED_ */
1304
1305/* Maximum uses for shiX_max_uses fields */
1306#define SHI_USES_UNLIMITED      (DWORD)-1
1307
1308INFONRES_RESULT(mslm_NetShareInfo,0)
1309INFONRES_RESULT(mslm_NetShareInfo,1)
1310INFONRES_RESULT(mslm_NetShareInfo,2)
1311INFONRES_RESULT(mslm_NetShareInfo,501)
1312INFONRES_RESULT(mslm_NetShareInfo,502)
1313
1314union mslm_NetShareAddInfo_u {
1315	CASE(2)     struct mslm_NetShareInfo_2 *info2;
1316	CASE(502)   struct mslm_NetShareInfo_502 *info502;
1317	DEFAULT	char *nullptr;
1318};
1319
1320struct mslm_NetShareAddInfo {
1321	DWORD switch_value;
1322  SWITCH(switch_value)
1323	union mslm_NetShareAddInfo_u un;
1324};
1325
1326
1327OPERATION(SRVSVC_OPNUM_NetShareAdd)
1328struct mslm_NetShareAdd {
1329	IN	LPTSTR servername;
1330	IN	DWORD level;
1331	IN	struct mslm_NetShareAddInfo info;
1332	INOUT	DWORD *parm_err;
1333	OUT	DWORD status;
1334};
1335
1336
1337INFONRES_DEFINITION(mslm_NetShareEnum,
1338	INFONRES_UNION_ENTRY(mslm_NetShareInfo,0)
1339	INFONRES_UNION_ENTRY(mslm_NetShareInfo,1)
1340	INFONRES_UNION_ENTRY(mslm_NetShareInfo,2)
1341	INFONRES_UNION_ENTRY(mslm_NetShareInfo,501)
1342	INFONRES_UNION_ENTRY(mslm_NetShareInfo,502))
1343
1344/*
1345 * NetShareEnum: enumerate all shares (see also NetShareEnumSticky).
1346 * Note: the server should ignore the content of servername.
1347 */
1348OPERATION(SRVSVC_OPNUM_NetShareEnum)
1349struct mslm_NetShareEnum {
1350	IN  		LPTSTR	servername;
1351	INOUT  		DWORD	level;
1352	INOUT 		struct mslm_NetShareEnum_result result;
1353	IN  		DWORD	prefmaxlen;
1354	OUT 		DWORD	totalentries;
1355	INOUT 		DWORD	*resume_handle;
1356	OUT 		DWORD	status;
1357};
1358
1359/*
1360 * Delete a share. The reserved field appears in netmon
1361 * but I've left it out in case it's not always present.
1362 * This won't affect RPC processing.
1363 */
1364OPERATION(SRVSVC_OPNUM_NetShareDel)
1365struct mslm_NetShareDel {
1366	IN	LPTSTR servername;
1367	IN REFERENCE	LPTSTR netname;
1368	/* IN	DWORD reserved; */
1369	OUT	DWORD status;
1370};
1371
1372OPERATION(SRVSVC_OPNUM_NetShareCheck)
1373struct mslm_NetShareCheck {
1374	IN	LPTSTR servername;
1375	IN REFERENCE	LPTSTR path;
1376	OUT	DWORD stype;
1377	OUT	DWORD status;
1378};
1379
1380/*
1381 * NetShareEnumSticky is the same as NetShareEnum except that
1382 * STYPE_SPECIAL (hidden or special) shares are not returned.
1383 * Note: the server should ignore the content of servername.
1384 */
1385OPERATION(SRVSVC_OPNUM_NetShareEnumSticky)
1386struct mslm_NetShareEnumSticky {
1387	IN  		LPTSTR	servername;
1388	INOUT  		DWORD	level;
1389	INOUT 		struct mslm_NetShareEnum_result result;
1390	IN  		DWORD	prefmaxlen;
1391	OUT 		DWORD	totalentries;
1392	INOUT 		DWORD	*resume_handle;
1393	OUT 		DWORD	status;
1394};
1395
1396/*
1397 * When you install Windows NT Server Tools on a Win95 client,
1398 * a security tab will be added to properties dialog box of files/folders.
1399 * Within this security tab, when you try to get/set permissions on a
1400 * file/folder the next two RPC calls are used.
1401 */
1402OPERATION(SRVSVC_OPNUM_NetGetFileSecurity)
1403struct mslm_NetGetFileSecurity {
1404	IN  		LPTSTR	servername;
1405	IN			LPTSTR	sharename;
1406	IN REFERENCE LPTSTR	filename;
1407	IN			DWORD	securityinfo;
1408
1409	/*
1410	 * Right now, we can't send back SD of the requested object
1411	 * in RPC code, so we just reply with access denied error
1412	 * code. Thus, this output declaration is only valid in this
1413	 * case i.e., it's not complete.
1414	 * It looks like:
1415	 *
1416	 *   A Pointer
1417	 *   A Length
1418	 *
1419	 *   A Pointer
1420	 *   A Length (equal to the prev length)
1421	 *   A buffer
1422	 *
1423	 *   return value
1424	 */
1425	OUT			DWORD	length;
1426	OUT 		DWORD	status;
1427};
1428
1429/*
1430 * This is the request:
1431 *
1432 * R_SRVSVC: RPC Client call srvsvc:NetrpSetFileSecurity(..)
1433 *	 R_SRVSVC: SRVSVC_HANDLE ServerName = \\WK76-177
1434 *	 R_SRVSVC: LPWSTR ShareName = AFSHIN
1435 *	 R_SRVSVC: LPWSTR lpFileName = \salek.txt
1436 *	 R_SRVSVC: SECURITY_INFORMATION SecurityInformation = 4 (0x4)
1437 *  -R_SRVSVC: PADT_SECURITY_DESCRIPTOR SecurityDescriptor {..}
1438 *  R_SRVSVC: DWORD Length = 64 (0x40)
1439 *  R_SRVSVC: LPBYTE Buffer = 4496048 (0x449AB0)
1440 *  R_SRVSVC: LPBYTE Buffer [..] = 01 00 04 80 00 00 00 00 00 00 00 00 00 00 00
1441 *  ...
1442 *
1443 *  000000A0        00 83 46 00 0B 00 00 00 00 00 00 00 0B 00   ..F...........
1444 *  000000B0  00 00 5C 00 5C 00 57 00 4B 00 37 00 36 00 2D 00 ..\.\.W.K.7.6.-.
1445 *  000000C0  31 00 37 00 37 00 00 00 08 00 16 83 46 00 07 00 1.7.7.......F...
1446 *  000000D0  00 00 00 00 00 00 07 00 00 00 41 00 46 00 53 00 ..........A.F.S.
1447 *  000000E0  48 00 49 00 4E 00 00 00 00 00 0B 00 00 00 00 00 H.I.N...........
1448 *  000000F0  00 00 0B 00 00 00 5C 00 73 00 61 00 6C 00 65 00 ......\.s.a.l.e.
1449 *  00000100  6B 00 2E 00 74 00 78 00 74 00 00 00 00 00 04 00 k...t.x.t.......
1450 *  00000110  00 00 40 00 00 00 B0 9A 44 00 40 00 00 00 01 00 ..@.....D.@.....
1451 *  00000120  04 80 00 00 00 00 00 00 00 00 00 00 00 00 14 00 ................
1452 *  00000130  00 00 02 00 2C 00 01 00 00 00 00 00 24 00 00 00 ....,.......$...
1453 *  00000140  00 A0 01 05 00 00 00 00 00 05 15 00 00 00 1A 24 ...............$
1454 *  00000150  44 38 90 00 0F 02 65 3A BE 4C FF 03 00 00 00 00 D8....e:.L......
1455 *  00000160  00 00 00 00 00 00 00 00 00 00                   ..........
1456 */
1457OPERATION(SRVSVC_OPNUM_NetSetFileSecurity)
1458struct mslm_NetSetFileSecurity {
1459	IN  		LPTSTR	servername;
1460	IN			LPTSTR	sharename;
1461	IN REFERENCE LPTSTR	filename;
1462	IN			DWORD	securityinfo;
1463	/*
1464	 * IN Security Descriptor (looks like):
1465	 * Length1
1466	 * Pointer
1467	 * Length2 (== Length1)
1468	 * buffer itself
1469	 */
1470
1471	OUT 		DWORD	status;
1472};
1473
1474/*
1475 * The SRVSVC already
1476 */
1477INTERFACE(0)
1478union srvsvc_interface {
1479    CASE(SRVSVC_OPNUM_NetConnectEnum)
1480	struct mslm_NetConnectEnum	NetConnectEnum;
1481    CASE(SRVSVC_OPNUM_NetFileEnum)
1482	struct mslm_NetFileEnum		NetFileEnum;
1483    CASE(SRVSVC_OPNUM_NetFileClose)
1484	struct mslm_NetFileClose	NetFileClose;
1485    CASE(SRVSVC_OPNUM_NetShareGetInfo)
1486	struct mlsm_NetShareGetInfo	NetShareGetInfo;
1487    CASE(SRVSVC_OPNUM_NetShareSetInfo)
1488	struct mlsm_NetShareSetInfo	NetShareSetInfo;
1489    CASE(SRVSVC_OPNUM_NetSessionDel)
1490	struct mslm_NetSessionDel	NetSessionDel;
1491    CASE(SRVSVC_OPNUM_NetSessionEnum)
1492	struct mslm_NetSessionEnum	NetSessionEnum;
1493    CASE(SRVSVC_OPNUM_NetServerGetInfo)
1494	struct mslm_NetServerGetInfo	NetServerGetInfo;
1495    CASE(SRVSVC_OPNUM_NetRemoteTOD)
1496	struct mslm_NetRemoteTOD	NetRemoteTOD;
1497    CASE(SRVSVC_OPNUM_NetNameValidate)
1498	struct mslm_NetNameValidate	NetNameValidate;
1499    CASE(SRVSVC_OPNUM_NetShareAdd)
1500	struct mslm_NetShareAdd		NetShareAdd;
1501    CASE(SRVSVC_OPNUM_NetShareDel)
1502	struct mslm_NetShareDel		NetShareDel;
1503    CASE(SRVSVC_OPNUM_NetShareCheck)
1504	struct mslm_NetShareCheck	NetShareCheck;
1505    CASE(SRVSVC_OPNUM_NetShareEnum)
1506	struct mslm_NetShareEnum	NetShareEnum;
1507    CASE(SRVSVC_OPNUM_NetShareEnumSticky)
1508	struct mslm_NetShareEnumSticky	NetShareEnumSticky;
1509    CASE(SRVSVC_OPNUM_NetGetFileSecurity)
1510	struct mslm_NetGetFileSecurity	NetGetFileSecurity;
1511    CASE(SRVSVC_OPNUM_NetSetFileSecurity)
1512	struct mslm_NetSetFileSecurity	NetSetFileSecurity;
1513};
1514typedef union srvsvc_interface	srvsvc_interface_t;
1515EXTERNTYPEINFO(srvsvc_interface)
1516
1517
1518
1519/*
1520 * WKSSVC - Workstation Service
1521 */
1522
1523/* Windows NT */
1524#define WKSSVC_OPNUM_NetWkstaGetInfo		0x00
1525#define WKSSVC_OPNUM_NetWkstaSetInfo		0x01
1526#define WKSSVC_OPNUM_NetWkstaUserEnum		0x02
1527#define WKSSVC_OPNUM_NetWkstaUserGetInfo	0x03
1528#define WKSSVC_OPNUM_NetWkstaUserSetInfo	0x04
1529#define WKSSVC_OPNUM_NetWkstaTransportEnum	0x05
1530#define WKSSVC_OPNUM_NetWkstaTransportAdd	0x06
1531#define WKSSVC_OPNUM_NetWkstaTransportDel	0x07
1532#define WKSSVC_OPNUM_NetUseAdd			0x08
1533#define WKSSVC_OPNUM_NetUseGetInfo		0x09
1534#define WKSSVC_OPNUM_NetUseDel			0x0a
1535#define WKSSVC_OPNUM_NetUseEnum			0x0b
1536#define WKSSVC_OPNUM_NetMessageBufferSend	0x0c
1537#define WKSSVC_OPNUM_NetWkstaStatisticsGet	0x0d
1538#define WKSSVC_OPNUM_NetLogonDomainNameAdd	0x0e
1539
1540/* Windows 2000 */
1541#define WKSSVC_OPNUM_NetLogonDomainNameDel	0x0f
1542#define WKSSVC_OPNUM_NetJoinDomain		0x10
1543#define WKSSVC_OPNUM_NetUnjoinDomain		0x11
1544#define WKSSVC_OPNUM_NetValidateName		0x12
1545#define WKSSVC_OPNUM_NetRenameMachineInDomain	0x13
1546#define WKSSVC_OPNUM_NetGetJoinInformation	0x14
1547#define WKSSVC_OPNUM_NetGetJoinableOUs		0x15
1548#define WKSSVC_OPNUM_NetJoinDomain2		0x16
1549#define WKSSVC_OPNUM_NetUnjoinDomain2		0x17
1550#define WKSSVC_OPNUM_NetRenameMachineInDomain2	0x18
1551#define WKSSVC_OPNUM_NetValidateName2		0x19
1552#define WKSSVC_OPNUM_NetGetJoinableOUs2		0x1a
1553
1554/* Windows XP and Windows Server 2003 */
1555#define WKSSVC_OPNUM_NetAddAlternateComputerName	0x1b
1556#define WKSSVC_OPNUM_NetRemoveAlternateComputerName	0x1c
1557#define WKSSVC_OPNUM_NetSetPrimaryComputerName		0x1d
1558#define WKSSVC_OPNUM_NetEnumerateComputerNames		0x1e
1559#define WKSSVC_OPNUM_NetWorkstationResetDfsCache	0x1f
1560
1561
1562struct mslm_WKSTA_INFO_100 {
1563    DWORD   wki100_platform_id;
1564    LPTSTR  wki100_computername;
1565    LPTSTR  wki100_langroup;
1566    DWORD   wki100_ver_major;
1567    DWORD   wki100_ver_minor;
1568};
1569
1570/* NetWkstaGetInfo only.  System information - user access */
1571struct mslm_WKSTA_INFO_101 {
1572    DWORD   wki101_platform_id;
1573    LPTSTR  wki101_computername;
1574    LPTSTR  wki101_langroup;
1575    DWORD   wki101_ver_major;
1576    DWORD   wki101_ver_minor;
1577    LPTSTR  wki101_lanroot;
1578};
1579
1580/* NetWkstaGetInfo only.  System information - admin or operator access */
1581struct mslm_WKSTA_INFO_102 {
1582    DWORD   wki102_platform_id;
1583    LPTSTR  wki102_computername;
1584    LPTSTR  wki102_langroup;
1585    DWORD   wki102_ver_major;
1586    DWORD   wki102_ver_minor;
1587    LPTSTR  wki102_lanroot;
1588    DWORD   wki102_logged_on_users;
1589};
1590
1591struct mslm_WKSTA_INFO_502 {
1592	DWORD char_wait;
1593	DWORD collection_time;
1594	DWORD maximum_collection_count;
1595	DWORD keep_connection;
1596	DWORD max_commands;
1597	DWORD session_timeout;
1598	DWORD size_char_buf;
1599	DWORD max_threads;
1600	DWORD lock_quota;
1601	DWORD lock_increment;
1602	DWORD lock_maximum;
1603	DWORD pipe_increment;
1604	DWORD pipe_maximum;
1605	DWORD cache_file_timeout;
1606	DWORD dormant_file_limit;
1607	DWORD read_ahead_throughput;
1608	DWORD num_mailslot_buffers;
1609	DWORD num_srv_announce_buffers;
1610	DWORD max_illegal_dgram_events;
1611	DWORD dgram_event_reset_freq;
1612	DWORD log_election_packets;
1613	DWORD use_opportunistic_locking;
1614	DWORD use_unlock_behind;
1615	DWORD use_close_behind;
1616	DWORD buf_named_pipes;
1617	DWORD use_lock_read_unlock;
1618	DWORD utilize_nt_caching;
1619	DWORD use_raw_read;
1620	DWORD use_raw_write;
1621	DWORD use_write_raw_data;
1622	DWORD use_encryption;
1623	DWORD buf_files_deny_write;
1624	DWORD buf_read_only_files;
1625	DWORD force_core_create_mode;
1626	DWORD use_512_byte_max_transfer;
1627};
1628
1629INFO1RES_DEFINITION(mslm_NetWkstaGetInfo,
1630	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,100)
1631	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,101)
1632	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,102)
1633	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,502))
1634
1635INFO1RESBUF_DEFINITION(mslm_NetWkstaGetInfo,
1636	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,100)
1637	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,101)
1638	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,102)
1639	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,502))
1640
1641
1642OPERATION(WKSSVC_OPNUM_NetWkstaGetInfo)
1643struct mslm_NetWkstaGetInfo {
1644	IN  LPTSTR	servername;
1645	IN  DWORD	level;
1646	OUT struct mslm_NetWkstaGetInfo_result result;
1647	OUT DWORD	status;
1648};
1649
1650/*
1651 ***********************************************************************
1652 * NetWkstaTransportEnum
1653 ***********************************************************************
1654 */
1655
1656struct mslm_NetWkstaTransportInfo0 {
1657	DWORD quality_of_service;
1658	DWORD num_vcs;
1659	LPTSTR transport_name;
1660	LPTSTR transport_address;
1661	DWORD wan_ish;
1662};
1663
1664struct mslm_NetWkstaTransportCtr0 {
1665	DWORD count;
1666    SIZE_IS(count)
1667	struct mslm_NetWkstaTransportInfo0 *ti0;
1668};
1669
1670union mslm_NetWkstaTransportInfo_ru {
1671	CASE(0) struct mslm_NetWkstaTransportCtr0 *info0;
1672	DEFAULT char *nullptr;
1673};
1674
1675struct mslm_NetWkstaTransportInfo {
1676	DWORD address;
1677	DWORD level;
1678    SWITCH(level)
1679	union mslm_NetWkstaTransportInfo_ru ru;
1680};
1681
1682OPERATION(WKSSVC_OPNUM_NetWkstaTransportEnum)
1683struct mslm_NetWkstaTransportEnum {
1684	IN 	LPTSTR	servername;
1685	INOUT	struct mslm_NetWkstaTransportInfo info;
1686	IN	DWORD	pref_max_len;
1687	OUT 	DWORD	total_entries;
1688	INOUT	DWORD	*resume_handle;
1689	OUT	DWORD	status;
1690};
1691
1692/*
1693 * The WKSSVC already
1694 */
1695INTERFACE(0)
1696union wkssvc_interface {
1697    CASE(WKSSVC_OPNUM_NetWkstaGetInfo)
1698	struct mslm_NetWkstaGetInfo		NetWkstaGetInfo;
1699    CASE(WKSSVC_OPNUM_NetWkstaTransportEnum)
1700	struct mslm_NetWkstaTransportEnum	NetWkstaTransportEnum;
1701};
1702typedef union wkssvc_interface	wkssvc_interface_t;
1703EXTERNTYPEINFO(wkssvc_interface)
1704
1705
1706#endif /* _MLSVC_LANMAN_NDL_ */
1707