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