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 2008 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#pragma ident	"%Z%%M%	%I%	%E% SMI"
30
31/*
32 * LanMan RPC (WKSSVC and SRVSVC) interface definitions.
33 */
34
35#include "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};
366
367struct mslm_NetConnectInfo0 {
368	DWORD entries_read;
369  SIZE_IS(entries_read)
370        struct mslm_NetConnectInfoBuf0 *ci0;
371};
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};
385
386struct mslm_NetConnectInfo1 {
387	DWORD entries_read;
388  SIZE_IS(entries_read)
389	struct mslm_NetConnectInfoBuf1 *ci1;
390};
391
392union mslm_NetConnectInfoResUnion {
393	CASE(0) struct mslm_NetConnectInfo0 *info0;
394	CASE(1) struct mslm_NetConnectInfo1 *info1;
395	DEFAULT	char *nullptr;
396};
397
398struct mslm_NetConnectInfo {
399	DWORD level;
400	DWORD switch_value;
401  SWITCH(switch_value)
402	union mslm_NetConnectInfoResUnion ru;
403};
404
405OPERATION(SRVSVC_OPNUM_NetConnectEnum)
406struct mslm_NetConnectEnum {
407	IN	LPTSTR servername;
408	IN	LPTSTR qualifier; /* share name */
409	INOUT	struct mslm_NetConnectInfo info;
410	IN	DWORD pref_max_len;
411	OUT 	DWORD total_entries;
412	INOUT	DWORD *resume_handle;
413	OUT	DWORD status;
414};
415
416
417/*
418 ***********************************************************************
419 * NetFileEnum
420 ***********************************************************************
421 */
422struct mslm_NetFileInfoBuf2 {
423	DWORD fi2_id;
424};
425
426struct mslm_NetFileInfo2 {
427	DWORD entries_read;
428  SIZE_IS(entries_read)
429	struct mslm_NetFileInfoBuf2 *fi2;
430};
431
432struct mslm_NetFileInfoBuf3 {
433	DWORD fi3_id;
434	DWORD fi3_permissions;
435	DWORD fi3_num_locks;
436	LPTSTR fi3_pathname;
437	LPTSTR fi3_username;
438};
439
440struct mslm_NetFileInfo3 {
441	DWORD entries_read;
442  SIZE_IS(entries_read)
443	struct mslm_NetFileInfoBuf3 *fi3;
444};
445
446union mslm_NetFileInfoResUnion {
447	CASE(2)	struct mslm_NetFileInfo2 *info2;
448	CASE(3)	struct mslm_NetFileInfo3 *info3;
449	DEFAULT	char *nullptr;
450};
451
452struct mslm_NetFileInfo {
453	DWORD level;
454	DWORD switch_value;
455  SWITCH(switch_value)
456	union mslm_NetFileInfoResUnion ru;
457};
458
459OPERATION(SRVSVC_OPNUM_NetFileEnum)
460struct mslm_NetFileEnum {
461	IN	LPTSTR servername;
462	IN	DWORD basepath;
463	IN	DWORD username;
464	INOUT	struct mslm_NetFileInfo info;
465	IN	DWORD pref_max_len;
466	OUT	DWORD total_entries;
467	INOUT	DWORD *resume_handle;
468	OUT	DWORD status;
469};
470
471
472/*
473 ***********************************************************************
474 * NetFileClose
475 *
476 * Close files using a file id reported by NetFileEnum.
477 ***********************************************************************
478 */
479OPERATION(SRVSVC_OPNUM_NetFileClose)
480struct mslm_NetFileClose {
481	IN	LPTSTR servername;
482	IN	DWORD file_id;
483	OUT	DWORD status;
484};
485
486
487/*
488 ***********************************************************************
489 * NetShareGetInfo: netname is the name of a share.
490 *
491 * Levels:
492 *  1      Sets information about the shared resource: name, type
493 *         of resource and a comment.
494 *  2      Sets information about the shared resource: name, type,
495 *         permissions, password and number of connections.
496 *  501    Sets information about the shared resource: name, type
497 *         of resource and a comment.
498 *  502    Sets information about the shared resource, including
499 *         the name, type, permissions, number of connections etc.
500 *  1004   Specifies a comment for the shared resource.
501 *  1005   Specifies a set of flags describing the shared resource.
502 *  1006   Specifies the maximum number of concurrent connections
503 *         that the shared resource can accommodate.
504 *  1501   Specifies the SECURITY_DESCRIPTOR for the share.
505 *
506 * Windows Me/98/95 supports level 50, which is similar to level 1.
507 *
508 * shi1005_flags: SHI1005_VALID_FLAGS_SET defines the set of flags that
509 * can be set with the NetShareSetInfo function. SHI1005_FLAGS_DFS and
510 * SHI1005_FLAGS_DFS_ROOT can only be returned, but not set.
511 *
512 * 0x01    SHI1005_FLAGS_DFS
513 *         The specified share is present in a Dfs tree structure.
514 *         This flag cannot be set with NetShareSetInfo.
515 *
516 * 0x02    SHI1005_FLAGS_DFS_ROOT
517 *         The specified share is the root volume in a Dfs tree.
518 *         This flag cannot be set with NetShareSetInfo.
519 *
520 * 0x30    CSC_MASK               Client-side caching (CSC) state:
521 *   0x00  CSC_CACHE_MANUAL_REINT Automatic file-by-file
522 *                                reintegration not allowed.
523 *   0x10  CSC_CACHE_AUTO_REINT   File-by-file reintegration allowed.
524 *   0x20  CSC_CACHE_VDO          File opens do not need to be flowed.
525 *   0x30  CSC_CACHE_NONE         CSC is disabled for this share.
526 *
527 * 0x0100  SHI1005_FLAGS_RESTRICT_EXCLUSIVE_OPENS
528 *         The specified share disallows exclusive file opens,
529 *         where reads to an open file are disallowed.
530 *
531 * 0x0200  SHI1005_FLAGS_FORCE_SHARED_DELETE
532 *         Shared files in the specified share can be forcibly deleted.
533 *
534 * 0x0400  SHI1005_FLAGS_ALLOW_NAMESPACE_CACHING
535 *         Clients are allowed to cache the namespace of the share.
536 *
537 * 0x0800  SHI1005_FLAGS_ACCESS_BASED_DIRECTORY_ENUM
538 *         The server will filter directory entries based on the access
539 *         permissions of the client. This flag is only supported on
540 *         servers running Windows Server 2003 SP1.
541 *         Note: The access-based enumeration (ABE) flag may also
542 *         appear as SHI1005_FLAGS_ENFORCE_NAMESPACE_ACCESS.
543 ***********************************************************************
544 */
545struct mslm_NetShareGetInfo0 {
546	LPTSTR shi0_netname;
547};
548
549
550struct mslm_NetShareGetInfo1 {
551	LPTSTR shi1_netname;
552	DWORD shi1_type; /* type of resource such as IPC$ */
553	LPTSTR shi1_comment;
554};
555
556
557struct mslm_NetShareGetInfo2 {
558	LPTSTR shi2_netname;
559	DWORD shi2_type;
560	LPTSTR shi2_comment;
561	DWORD shi2_permissions;
562	DWORD shi2_max_uses;
563	DWORD shi2_current_uses;
564	LPTSTR shi2_path;
565	LPTSTR shi2_passwd;
566};
567
568struct mslm_NetShareGetInfo501 {
569	LPTSTR shi501_netname;
570	DWORD shi501_type;
571	LPTSTR shi501_comment;
572	DWORD shi501_reserved;
573};
574
575struct mslm_NetShareGetInfo502 {
576	LPTSTR shi502_netname;
577	DWORD shi502_type;
578	LPTSTR shi502_comment;
579	DWORD shi502_permissions;
580	DWORD shi502_max_uses;
581	DWORD shi502_current_uses;
582	LPTSTR shi502_path;
583	LPTSTR shi502_passwd;
584	DWORD shi502_reserved;
585	DWORD shi502_security_descriptor;
586};
587
588struct mslm_NetShareGetInfo1005 {
589	DWORD shi1005_flags;
590};
591
592union mlsm_NetShareGetInfoResUnion {
593	CASE(0)		struct mslm_NetShareGetInfo0 *info0;
594	CASE(1)		struct mslm_NetShareGetInfo1 *info1;
595	CASE(2)		struct mslm_NetShareGetInfo2 *info2;
596	CASE(501)	struct mslm_NetShareGetInfo501 *info501;
597	CASE(502)	struct mslm_NetShareGetInfo502 *info502;
598	CASE(1005)	struct mslm_NetShareGetInfo1005 *info1005;
599	DEFAULT	char *nullptr;
600};
601
602
603struct mlsm_NetShareGetInfoRes {
604	DWORD switch_value;
605  SWITCH(switch_value)
606	union mlsm_NetShareGetInfoResUnion ru;
607};
608
609
610OPERATION(SRVSVC_OPNUM_NetShareGetInfo)
611struct mlsm_NetShareGetInfo {
612	IN	LPTSTR servername;
613	IN REFERENCE	LPTSTR netname;
614	IN	DWORD level;
615	OUT	struct mlsm_NetShareGetInfoRes result;
616	OUT	DWORD status;
617};
618
619
620/*
621 ***********************************************************************
622 * NetShareSetInfo: netname is the name of a share.
623 * The levels and shi1005_flags are as described for NetShareGetInfo.
624 *
625 * Support for Access-based Enumeration (ABE) was added to Windows in
626 * Windows Server 2003 Service Pack 1. ABE filters directory contents
627 * (and other shared resources) returned via a share based on a user's
628 * access rights, i.e. a user would not see objects that are
629 * inaccessible to that user. ABE requests are made using info level
630 * 1005 with the value 0x0800 in the flags field (see NetShareGetInfo).
631 ***********************************************************************
632 */
633OPERATION(SRVSVC_OPNUM_NetShareSetInfo)
634struct mlsm_NetShareSetInfo {
635	IN	LPTSTR servername;
636	IN REFERENCE	LPTSTR netname;
637	IN	DWORD level;
638/*
639 * This should accept all the same levels as NetShareGetInfo
640 * but we always return ACCESS_DENIED for now. So there's no
641 * point in unmarshalling the share information.
642 *
643 *	IN	struct mlsm_NetShareGetInfoRes result;
644 */
645	OUT	DWORD parm_err_ptr;
646	OUT	DWORD parm_err;
647	OUT	DWORD status;
648};
649
650
651/*
652 ***********************************************************************
653 * NetSessionEnum
654 *
655 * The NetSessionEnum function provides information about sessions
656 * established on a server.
657 *
658 * Only members of the Administrators or Account Operators local groups
659 * can successfully execute the NetSessionEnum function at level 1 or
660 * level 2. No special group membership is required for level 0 or level
661 * 10 calls.
662 *
663 * Windows NT/2000/XP: The parameter order is as follows.
664 *
665 * NET_API_STATUS NetSessionEnum(LPWSTR servername,
666 *                               LPWSTR UncClientName,
667 *                               LPWSTR username,
668 *                               DWORD level,
669 *                               LPBYTE *bufptr,
670 *                               DWORD prefmaxlen,
671 *                               LPDWORD entriesread,
672 *                               LPDWORD totalentries,
673 *                               LPDWORD resume_handle);
674 *
675 * Windows 95/98/Me: The calling application must use the cbBuffer parameter
676 * to specify the size, in bytes, of the information buffer pointed to by the
677 * pbBuffer parameter. (The cbBuffer parameter replaces the prefmaxlen
678 * parameter.) Neither a user name parameter nor a resume handle parameter is
679 * available on this platform. Therefore, the parameter list is as follows.
680 *
681 * API_FUNCTION NetSessionEnum(const char FAR *pszServer,
682 *                             short sLevel,
683 *                             char FAR *pbBuffer,
684 *                             unsigned short cbBuffer,
685 *                             unsigned short FAR *pcEntriesRead,
686 *                             unsigned short FAR *pcTotalAvail);
687 *
688 * Parameters
689 *
690 * servername
691 * [in] Pointer to a string that specifies the DNS or NetBIOS name of the
692 * remote server on which the function is to execute. If this parameter is
693 * NULL, the local computer is used.
694 * Windows NT 4.0 and earlier: This string must begin with \\.
695 *
696 * UncClientName
697 * [in] Pointer to a string that specifies the name of the computer session
698 * for which information is to be returned. If this parameter is NULL,
699 * NetSessionEnum returns information for all computer sessions on the server.
700 *
701 * username
702 * [in] Pointer to a string that specifies the name of the user for which
703 * information is to be returned. If this parameter is NULL, NetSessionEnum
704 * returns information for all users.
705 *
706 * level
707 * [in] Specifies the information level of the data. This parameter can be
708 * one of the following values.
709 * Windows NT/2000/XP: The following levels are valid.
710 * Value    Meaning
711 * 0        Return the name of the computer that established the session.
712 *          The bufptr parameter points to an array of SESSION_INFO_0
713 *          structures.
714 * 1        Return the name of the computer, name of the user, and open files,
715 *          pipes, and devices on the computer. The bufptr parameter points to
716 *          an array of SESSION_INFO_1 structures.
717 * 2        In addition to the information indicated for level 1, return the
718 *          type of client and how the user established the session. The bufptr
719 *          parameter points to an array of SESSION_INFO_2 structures.
720 * 10       Return the name of the computer, name of the user, and active and
721 *          idle times for the session. The bufptr parameter points to an array
722 *          of SESSION_INFO_10 structures.
723 * 502      Return the name of the computer; name of the user; open files,
724 *          pipes, and devices on the computer; and the name of the transport
725 *          the  client is using. The bufptr parameter points to an array of
726 *          SESSION_INFO_502 structures.
727 *
728 * Windows 95/98/Me: The following level is valid.
729 * Value    Meaning
730 * 50       Return the name of the computer, name of the user, open files on
731 *          the computer, and the name of the transport protocol the client is
732 *          using. The pbBuffer parameter points to an array of session_info_50
733 *          structures.
734 *
735 * bufptr
736 * [out] Pointer to the buffer that receives the data. The format of this
737 * data depends on the value of the level parameter.
738 * Windows NT/2000/XP: This buffer is allocated by the system and must be
739 * freed using the NetApiBufferFree function. Note that you must free the
740 * buffer even if the function fails with ERROR_MORE_DATA.
741 * Windows 95/98/Me: The caller must allocate and deallocate this buffer.
742 *
743 * prefmaxlen
744 * [in] Specifies the preferred maximum length of returned data, in bytes.
745 * If you specify MAX_PREFERRED_LENGTH, the function allocates the amount
746 * of memory required for the data. If you specify another value in this
747 * parameter, it can restrict the number of bytes that the function returns.
748 * If the buffer size is insufficient to hold all entries, the function
749 * returns ERROR_MORE_DATA. For more information, see Network Management
750 * Function Buffers and Network Management Function Buffer Lengths.
751 *
752 * entriesread
753 * [out] Pointer to a value that receives the count of elements actually
754 * enumerated.
755 *
756 * totalentries
757 * [out] Pointer to a value that receives the total number of entries that
758 * could have been enumerated from the current resume position.
759 *
760 * resume_handle
761 * [in/out] Pointer to a value that contains a resume handle which is used
762 * to continue an existing session search. The handle should be zero on the
763 * first call and left unchanged for subsequent calls. If resume_handle is
764 * NULL, no resume handle is stored.
765 *
766 *
767 * SESSION_INFO_1
768 * ==============
769 * The SESSION_INFO_1 structure contains information about the session,
770 * including name of the computer; name of the user; and open files, pipes,
771 * and devices on the computer.
772 *
773 * Members
774 *
775 * sesi1_cname
776 * Pointer to a Unicode string specifying the name of the computer that
777 * established the session.
778 *
779 * sesi1_username
780 * Pointer to a Unicode string specifying the name of the user who established
781 * the session.
782 *
783 * sesi1_num_opens
784 * Specifies a DWORD value that contains the number of files, devices,
785 * and pipes opened during the session.
786 *
787 * sesi1_time
788 * Specifies a DWORD value that contains the number of seconds the session
789 * has been active.
790 *
791 * sesi1_idle_time
792 * Specifies a DWORD value that contains the number of seconds the session
793 * has been idle.
794 *
795 * sesi1_user_flags
796 * Specifies a DWORD value that describes how the user established the
797 * session. This member can be one of the following values:
798 * SESS_GUEST           The user specified by the sesi1_username member
799 *                      established the session using a guest account.
800 * SESS_NOENCRYPTION    The user specified by the sesi1_username member
801 *                      established the session without using password
802 *                      encryption.
803 ***********************************************************************
804 */
805
806#define SESS_GUEST          0x00000001
807#define SESS_NOENCRYPTION   0x00000002
808
809struct mslm_SESSION_INFO_0 {
810	LPTSTR sesi0_cname;
811};
812INFONRES_RESULT(mslm_SESSION_INFO, 0)
813
814struct mslm_SESSION_INFO_1 {
815	LPTSTR sesi1_cname;
816	LPTSTR sesi1_uname;
817	DWORD  sesi1_nopens;
818	DWORD  sesi1_time;
819	DWORD  sesi1_itime;
820	DWORD  sesi1_uflags;
821};
822INFONRES_RESULT(mslm_SESSION_INFO, 1)
823
824INFONRES_DEFINITION(mslm_NetSessionEnum,
825	INFONRES_UNION_ENTRY(mslm_SESSION_INFO, 0)
826	INFONRES_UNION_ENTRY(mslm_SESSION_INFO, 1))
827
828OPERATION(SRVSVC_OPNUM_NetSessionEnum)
829struct mslm_NetSessionEnum {
830	IN		LPTSTR servername;
831	IN		DWORD unc_clientname;
832	IN		DWORD username;
833	INOUT	DWORD level;
834	INOUT	struct mslm_NetSessionEnum_result result;
835	IN		DWORD pref_max_len;
836	OUT		DWORD total_entries;
837	INOUT	DWORD *resume_handle;
838	OUT		DWORD status;
839};
840
841
842/*
843 ***********************************************************************
844 * NetSessionDel (Platform SDK: Network Management)
845 *
846 * The NetSessionDel function ends a network session between a server
847 * and a workstation.
848 *
849 * Security Requirements
850 * Only members of the Administrators or Account Operators local group
851 * can successfully execute the NetSessionDel function.
852 *
853 * Windows NT/2000/XP: The parameter order is as follows.
854 *
855 * NET_API_STATUS NetSessionDel(LPWSTR servername,
856 *                              LPWSTR UncClientName,
857 *                              LPWSTR username);
858 *
859 * Windows 95/98/Me: The sReserved parameter replaces the username
860 * parameter. For more information, see the following Remarks section.
861 * The parameter list is as follows.
862 *
863 * API_FUNCTION NetSessionDel(const char FAR *pszServer,
864 *                            const char FAR *pszClientName,
865 *                            short  sReserved);
866 *
867 * Parameters
868 *
869 * servername
870 * [in] Pointer to a string that specifies the DNS or NetBIOS name
871 * of the remote server on which the function is to execute. If this
872 * parameter is NULL, the local computer is used.
873 * Windows NT 4.0 and earlier: This string must begin with \\.
874 *
875 * UncClientName
876 * [in] Pointer to a string that specifies the computer name of the
877 * client to disconnect. If UncClientName is NULL, then all the sessions
878 * of the user identified by the username parameter will be deleted on
879 * the server specified by servername. For more information, see
880 * NetSessionEnum.
881 *
882 * username
883 * [in] Pointer to a string that specifies the name of the user whose
884 * session is to be terminated. If this parameter is NULL, all users'
885 * sessions from the client specified by the UncClientName parameter
886 * are to be terminated.
887 *
888 * Remarks
889 * Windows 95/98/Me: You must specify the session key in the sReserved
890 * parameter when you call NetSessionDel. The session key is returned by
891 * the NetSessionEnum function or the NetSessionGetInfo function in the
892 * sesi50_key member of the session_info_50 structure.
893 ***********************************************************************
894 */
895
896OPERATION(SRVSVC_OPNUM_NetSessionDel)
897struct mslm_NetSessionDel {
898	IN	LPTSTR servername;
899	IN	LPTSTR unc_clientname;
900	IN	LPTSTR username;
901	OUT	DWORD status;
902};
903
904
905/*
906 * SRVSVC NetServerGetInfo (
907 *	IN LPTSTR	servername,
908 *	IN DWORD	level,
909 *	OUT union switch(level) {
910 *		case 100: _SERVER_INFO_100 *	p100;
911 *		case 101: _SERVER_INFO_101 *	p101;
912 *		case 102: _SERVER_INFO_102 *	p102;
913 *	    }		bufptr,
914 *	OUT DWORD	status
915 *      )
916 */
917
918/* for svX_platform */
919#define SV_PLATFORM_ID_OS2 400
920#define SV_PLATFORM_ID_NT  500
921
922/* Bit-mapped values for svX_type fields */
923#define SV_TYPE_WORKSTATION         0x00000001
924#define SV_TYPE_SERVER              0x00000002
925#define SV_TYPE_SQLSERVER           0x00000004
926#define SV_TYPE_DOMAIN_CTRL         0x00000008
927#define SV_TYPE_DOMAIN_BAKCTRL      0x00000010
928#define SV_TYPE_TIME_SOURCE         0x00000020
929#define SV_TYPE_AFP                 0x00000040
930#define SV_TYPE_NOVELL              0x00000080
931#define SV_TYPE_DOMAIN_MEMBER       0x00000100
932#define SV_TYPE_PRINTQ_SERVER       0x00000200
933#define SV_TYPE_DIALIN_SERVER       0x00000400
934#define SV_TYPE_XENIX_SERVER        0x00000800
935#define SV_TYPE_SERVER_UNIX         SV_TYPE_XENIX_SERVER
936#define SV_TYPE_NT                  0x00001000
937#define SV_TYPE_WFW                 0x00002000
938
939#define SV_TYPE_SERVER_MFPN         0x00004000
940#define SV_TYPE_SERVER_NT           0x00008000
941#define SV_TYPE_POTENTIAL_BROWSER   0x00010000
942#define SV_TYPE_BACKUP_BROWSER      0x00020000
943#define SV_TYPE_MASTER_BROWSER      0x00040000
944#define SV_TYPE_DOMAIN_MASTER       0x00080000
945#define SV_TYPE_SERVER_OSF          0x00100000
946#define SV_TYPE_SERVER_VMS          0x00200000
947#define SV_TYPE_WINDOWS             0x00400000  /* Windows95 and above */
948#define SV_TYPE_ALTERNATE_XPORT     0x20000000  /* return list for
949						 * alternate transport */
950#define SV_TYPE_LOCAL_LIST_ONLY     0x40000000  /* Return local list only */
951#define SV_TYPE_DOMAIN_ENUM         0x80000000
952#define SV_TYPE_ALL                 0xFFFFFFFF  /* handy for NetServerEnum2 */
953
954/* NT-Server 4.0 sends 0x0006_120B */
955#define SV_TYPE_SENT_BY_NT_4_0_SERVER \
956	(  SV_TYPE_WORKSTATION \
957	 | SV_TYPE_SERVER \
958	 | SV_TYPE_DOMAIN_CTRL \
959	 | SV_TYPE_NT \
960	 | SV_TYPE_BACKUP_BROWSER \
961	 | SV_TYPE_MASTER_BROWSER)
962/* NT-workstation 4.0 send 0x0004_1013 */
963#define SV_TYPE_SENT_BY_NT_4_0_WORKSTATION \
964	(  SV_TYPE_WORKSTATION \
965	 | SV_TYPE_SERVER \
966	 | SV_TYPE_DOMAIN_BAKCTRL \
967	 | SV_TYPE_NT \
968	 | SV_TYPE_MASTER_BROWSER)
969
970/* Special value for sv102_disc that specifies infinite disconnect time */
971#define SV_NODISC           (-1L)  /* No autodisconnect timeout enforced */
972
973/* Values of svX_security field */
974#define SV_USERSECURITY     1
975#define SV_SHARESECURITY    0
976
977/* Values of svX_hidden field */
978#define SV_HIDDEN       1
979#define SV_VISIBLE      0
980
981
982/* Let's get some info already */
983struct mslm_SERVER_INFO_100 {
984	DWORD		sv100_platform_id;
985	LPTSTR		sv100_name;
986};
987
988struct mslm_SERVER_INFO_101 {
989	DWORD		sv101_platform_id;
990	LPTSTR		sv101_name;
991	DWORD		sv101_version_major;
992	DWORD		sv101_version_minor;
993	DWORD		sv101_type;
994	LPTSTR		sv101_comment;
995};
996
997struct mslm_SERVER_INFO_102 {
998	DWORD		sv102_platform_id;
999	LPTSTR		sv102_name;
1000	DWORD		sv102_version_major;
1001	DWORD		sv102_version_minor;
1002	DWORD		sv102_type;
1003	LPTSTR		sv102_comment;
1004	DWORD		sv102_users;
1005	DWORD		sv102_disc;
1006	DWORD		sv102_hidden;		/* BOOL */
1007	DWORD		sv102_announce;
1008	DWORD		sv102_anndelta;
1009	DWORD		sv102_licenses;
1010	LPTSTR		sv102_userpath;
1011};
1012
1013union mslm_NetServerGetInfo_ru {
1014	CASE(100)	struct mslm_SERVER_INFO_100 *bufptr100;
1015	CASE(101)	struct mslm_SERVER_INFO_101 *bufptr101;
1016	CASE(102)	struct mslm_SERVER_INFO_102 *bufptr102;
1017	DEFAULT		char *nullptr;
1018};
1019
1020struct mslm_NetServerGetInfo_result {
1021	DWORD level;
1022  SWITCH(level)
1023	union mslm_NetServerGetInfo_ru bufptr;
1024};
1025
1026
1027OPERATION(SRVSVC_OPNUM_NetServerGetInfo)
1028struct mslm_NetServerGetInfo {
1029	IN  LPTSTR	servername;
1030	IN  DWORD	level;
1031	OUT struct mslm_NetServerGetInfo_result result;
1032	OUT DWORD	status;
1033};
1034
1035/*
1036 * SRVSVC NetRemoteTOD (
1037 *	IN LPTSTR	servername,
1038 *	OUT _TIME_OF_DAY_INFO *bufptr,
1039 *	OUT long	status
1040 *      )
1041 */
1042
1043struct mslm_TIME_OF_DAY_INFO {
1044	DWORD		tod_elapsedt;
1045	DWORD		tod_msecs;
1046	DWORD		tod_hours;
1047	DWORD		tod_mins;
1048	DWORD		tod_secs;
1049	DWORD		tod_hunds;
1050	DWORD		tod_timezone;
1051	DWORD		tod_tinterval;
1052	DWORD		tod_day;
1053	DWORD		tod_month;
1054	DWORD		tod_year;
1055	DWORD		tod_weekday;
1056};
1057
1058OPERATION(SRVSVC_OPNUM_NetRemoteTOD)
1059struct mslm_NetRemoteTOD {
1060	IN  LPTSTR	servername;
1061	OUT struct mslm_TIME_OF_DAY_INFO *bufptr;
1062	OUT DWORD	status;
1063};
1064
1065#define	NAMETYPE_USER		1
1066#define	NAMETYPE_PASSWORD	2
1067#define	NAMETYPE_GROUP		3
1068#define	NAMETYPE_COMPUTER	4
1069#define	NAMETYPE_EVENT		5
1070#define	NAMETYPE_DOMAIN		6
1071#define	NAMETYPE_SERVICE	7
1072#define	NAMETYPE_NET		8
1073#define	NAMETYPE_SHARE		9
1074#define	NAMETYPE_MESSAGE	10
1075#define	NAMETYPE_MESSAGEDEST	11
1076#define	NAMETYPE_SHAREPASSWORD	12
1077#define	NAMETYPE_WORKGROUP	13
1078
1079OPERATION(SRVSVC_OPNUM_NetNameValidate)
1080struct mslm_NetNameValidate {
1081 	IN  LPTSTR		servername;
1082 	IN  REFERENCE LPTSTR 	pathname;
1083	IN  DWORD		type;
1084	IN  DWORD		flags;
1085	OUT DWORD		status;
1086};
1087
1088/*
1089 * SRVSVC NetShareEnum (
1090 *	IN  LPTSTR	servername,
1091 *	IN  DWORD	level;
1092 *	OUT union switch(level) {
1093 *		case 0: struct {
1094 *				DWORD entriesread;
1095 *			     [size_is(entriesread)]
1096 *				_SHARE_INFO_0 *entries;
1097 *			} *bufptr0;
1098 *		case 1: struct {
1099 *				DWORD entriesread;
1100 *			     [size_is(entriesread)]
1101 *				_SHARE_INFO_1 *entries;
1102 *			} *bufptr1;
1103 *		...
1104 *	    }		bufptr,
1105 *	IN  DWORD	prefmaxlen,
1106 *	OUT DWORD	totalentries,
1107 *	IN OUT DWORD ?*	resume_handle,
1108 *	OUT DWORD	status
1109 *      )
1110 */
1111
1112/*
1113 * Share types for shiX_type fields - duplicated from cifs.h
1114 */
1115#ifndef _SHARE_TYPES_DEFINED_
1116#define _SHARE_TYPES_DEFINED_
1117#define STYPE_DISKTREE          0x00000000
1118#define STYPE_PRINTQ            0x00000001
1119#define STYPE_DEVICE            0x00000002
1120#define STYPE_IPC               0x00000003
1121#define STYPE_MASK              0x0000000F
1122#define STYPE_DFS               0x00000064
1123#define STYPE_HIDDEN            0x80000000
1124#define STYPE_SPECIAL           0x80000000
1125#endif /* _SHARE_TYPES_DEFINED_ */
1126
1127/* Maximum uses for shiX_max_uses fields */
1128#define SHI_USES_UNLIMITED      (DWORD)-1
1129
1130
1131struct mslm_SHARE_INFO_0 {
1132	LPTSTR		shi0_netname;
1133};
1134INFONRES_RESULT(mslm_SHARE_INFO,0)
1135
1136struct mslm_SHARE_INFO_1 {
1137	LPTSTR		shi1_netname;
1138	DWORD		shi1_type;
1139	LPTSTR		shi1_remark;
1140};
1141INFONRES_RESULT(mslm_SHARE_INFO,1)
1142
1143struct mslm_SHARE_INFO_2 {
1144	LPTSTR		shi2_netname;
1145	DWORD		shi2_type;
1146	LPTSTR		shi2_remark;
1147	DWORD		shi2_permissions;
1148	DWORD		shi2_max_uses;
1149	DWORD		shi2_current_uses;
1150	LPTSTR		shi2_path;
1151	LPTSTR		shi2_passwd;
1152};
1153INFONRES_RESULT(mslm_SHARE_INFO,2)
1154
1155/*
1156 * shi501_flags must be zero.
1157 */
1158struct mslm_SHARE_INFO_501 {
1159	LPTSTR		shi501_netname;
1160	DWORD		shi501_type;
1161	LPTSTR		shi501_remark;
1162	DWORD		shi501_flags;
1163};
1164INFONRES_RESULT(mslm_SHARE_INFO,501)
1165
1166/*
1167 * Note: shi502_security_descriptor should be a pointer to a
1168 * security descriptor (W32SEC_SECURITY_DESCRIPTOR):
1169 *	PSECURITY_DESCRIPTOR shi502_security_descriptor;
1170 *
1171 * For now use a DWORD and set it to zero.
1172 */
1173struct mslm_SHARE_INFO_502 {
1174	LPTSTR		shi502_netname;
1175	DWORD		shi502_type;
1176	LPTSTR		shi502_remark;
1177	DWORD		shi502_permissions;
1178	DWORD		shi502_max_uses;
1179	DWORD		shi502_current_uses;
1180	LPTSTR		shi502_path;
1181	LPTSTR		shi502_passwd;
1182	DWORD		shi502_reserved;
1183	DWORD		shi502_security_descriptor;
1184};
1185INFONRES_RESULT(mslm_SHARE_INFO,502)
1186
1187union mslm_NetShareAddInfo_u {
1188	CASE(2)     struct mslm_SHARE_INFO_2 *info2;
1189	CASE(502)   struct mslm_SHARE_INFO_502 *info502;
1190};
1191
1192struct mslm_NetShareAddInfo {
1193	DWORD switch_value;
1194  SWITCH(switch_value)
1195	union mslm_NetShareAddInfo_u un;
1196};
1197
1198
1199OPERATION(SRVSVC_OPNUM_NetShareAdd)
1200struct mslm_NetShareAdd {
1201	IN	LPTSTR servername;
1202	IN	DWORD level;
1203	IN	struct mslm_NetShareAddInfo info;
1204	INOUT	DWORD *parm_err;
1205	OUT	DWORD status;
1206};
1207
1208
1209INFONRES_DEFINITION(mslm_NetShareEnum,
1210	INFONRES_UNION_ENTRY(mslm_SHARE_INFO,0)
1211	INFONRES_UNION_ENTRY(mslm_SHARE_INFO,1)
1212	INFONRES_UNION_ENTRY(mslm_SHARE_INFO,2)
1213	INFONRES_UNION_ENTRY(mslm_SHARE_INFO,501)
1214	INFONRES_UNION_ENTRY(mslm_SHARE_INFO,502))
1215
1216/*
1217 * NetShareEnum: enumerate all shares (see also NetShareEnumSticky).
1218 * Note: the server should ignore the content of servername.
1219 */
1220OPERATION(SRVSVC_OPNUM_NetShareEnum)
1221struct mslm_NetShareEnum {
1222	IN  		LPTSTR	servername;
1223	INOUT  		DWORD	level;
1224	INOUT 		struct mslm_NetShareEnum_result result;
1225	IN  		DWORD	prefmaxlen;
1226	OUT 		DWORD	totalentries;
1227	INOUT 		DWORD	*resume_handle;
1228	OUT 		DWORD	status;
1229};
1230
1231/*
1232 * Delete a share. The reserved field appears in netmon
1233 * but I've left it out in case it's not always present.
1234 * This won't affect RPC processing.
1235 */
1236OPERATION(SRVSVC_OPNUM_NetShareDel)
1237struct mslm_NetShareDel {
1238	IN	LPTSTR servername;
1239	IN REFERENCE	LPTSTR netname;
1240	/* IN	DWORD reserved; */
1241	OUT	DWORD status;
1242};
1243
1244/*
1245 * NetShareEnumSticky is the same as NetShareEnum except that
1246 * STYPE_SPECIAL (hidden or special) shares are not returned.
1247 * Note: the server should ignore the content of servername.
1248 */
1249OPERATION(SRVSVC_OPNUM_NetShareEnumSticky)
1250struct mslm_NetShareEnumSticky {
1251	IN  		LPTSTR	servername;
1252	INOUT  		DWORD	level;
1253	INOUT 		struct mslm_NetShareEnum_result result;
1254	IN  		DWORD	prefmaxlen;
1255	OUT 		DWORD	totalentries;
1256	INOUT 		DWORD	*resume_handle;
1257	OUT 		DWORD	status;
1258};
1259
1260/*
1261 * When you install Windows NT Server Tools on a Win95 client,
1262 * a security tab will be added to properties dialog box of files/folders.
1263 * Within this security tab, when you try to get/set permissions on a
1264 * file/folder the next two RPC calls are used.
1265 */
1266OPERATION(SRVSVC_OPNUM_NetGetFileSecurity)
1267struct mslm_NetGetFileSecurity {
1268	IN  		LPTSTR	servername;
1269	IN			LPTSTR	sharename;
1270	IN REFERENCE LPTSTR	filename;
1271	IN			DWORD	securityinfo;
1272
1273	/*
1274	 * Right now, we can't send back SD of the requested object
1275	 * in MLRPC code, so we just reply with access denied error
1276	 * code. Thus, this output declaration is only valid in this
1277	 * case i.e., it's not complete.
1278	 * It looks like:
1279	 *
1280	 *   A Pointer
1281	 *   A Length
1282	 *
1283	 *   A Pointer
1284	 *   A Length (equal to the prev length)
1285	 *   A buffer
1286	 *
1287	 *   return value
1288	 */
1289	OUT			DWORD	length;
1290	OUT 		DWORD	status;
1291};
1292
1293/*
1294 * This is the request:
1295 *
1296 * R_SRVSVC: RPC Client call srvsvc:NetrpSetFileSecurity(..)
1297 *	 R_SRVSVC: SRVSVC_HANDLE ServerName = \\WK76-177
1298 *	 R_SRVSVC: LPWSTR ShareName = AFSHIN
1299 *	 R_SRVSVC: LPWSTR lpFileName = \salek.txt
1300 *	 R_SRVSVC: SECURITY_INFORMATION SecurityInformation = 4 (0x4)
1301 *  -R_SRVSVC: PADT_SECURITY_DESCRIPTOR SecurityDescriptor {..}
1302 *  R_SRVSVC: DWORD Length = 64 (0x40)
1303 *  R_SRVSVC: LPBYTE Buffer = 4496048 (0x449AB0)
1304 *  R_SRVSVC: LPBYTE Buffer [..] = 01 00 04 80 00 00 00 00 00 00 00 00 00 00 00
1305 *  ...
1306 *
1307 *  000000A0        00 83 46 00 0B 00 00 00 00 00 00 00 0B 00   ..F...........
1308 *  000000B0  00 00 5C 00 5C 00 57 00 4B 00 37 00 36 00 2D 00 ..\.\.W.K.7.6.-.
1309 *  000000C0  31 00 37 00 37 00 00 00 08 00 16 83 46 00 07 00 1.7.7.......F...
1310 *  000000D0  00 00 00 00 00 00 07 00 00 00 41 00 46 00 53 00 ..........A.F.S.
1311 *  000000E0  48 00 49 00 4E 00 00 00 00 00 0B 00 00 00 00 00 H.I.N...........
1312 *  000000F0  00 00 0B 00 00 00 5C 00 73 00 61 00 6C 00 65 00 ......\.s.a.l.e.
1313 *  00000100  6B 00 2E 00 74 00 78 00 74 00 00 00 00 00 04 00 k...t.x.t.......
1314 *  00000110  00 00 40 00 00 00 B0 9A 44 00 40 00 00 00 01 00 ..@.....D.@.....
1315 *  00000120  04 80 00 00 00 00 00 00 00 00 00 00 00 00 14 00 ................
1316 *  00000130  00 00 02 00 2C 00 01 00 00 00 00 00 24 00 00 00 ....,.......$...
1317 *  00000140  00 A0 01 05 00 00 00 00 00 05 15 00 00 00 1A 24 ...............$
1318 *  00000150  44 38 90 00 0F 02 65 3A BE 4C FF 03 00 00 00 00 D8....e:.L......
1319 *  00000160  00 00 00 00 00 00 00 00 00 00                   ..........
1320 */
1321OPERATION(SRVSVC_OPNUM_NetSetFileSecurity)
1322struct mslm_NetSetFileSecurity {
1323	IN  		LPTSTR	servername;
1324	IN			LPTSTR	sharename;
1325	IN REFERENCE LPTSTR	filename;
1326	IN			DWORD	securityinfo;
1327	/*
1328	 * IN Security Descriptor (looks like):
1329	 * Length1
1330	 * Pointer
1331	 * Length2 (== Length1)
1332	 * buffer itself
1333	 */
1334
1335	OUT 		DWORD	status;
1336};
1337
1338/*
1339 * The SRVSVC already
1340 */
1341INTERFACE(0)
1342union srvsvc_interface {
1343    CASE(SRVSVC_OPNUM_NetConnectEnum)
1344	struct mslm_NetConnectEnum	NetConnectEnum;
1345    CASE(SRVSVC_OPNUM_NetFileEnum)
1346	struct mslm_NetFileEnum		NetFileEnum;
1347    CASE(SRVSVC_OPNUM_NetFileClose)
1348	struct mslm_NetFileClose	NetFileClose;
1349    CASE(SRVSVC_OPNUM_NetShareGetInfo)
1350	struct mlsm_NetShareGetInfo	NetShareGetInfo;
1351    CASE(SRVSVC_OPNUM_NetShareSetInfo)
1352	struct mlsm_NetShareGetInfo	NetShareSetInfo;
1353    CASE(SRVSVC_OPNUM_NetSessionDel)
1354	struct mslm_NetSessionDel	NetSessionDel;
1355    CASE(SRVSVC_OPNUM_NetSessionEnum)
1356	struct mslm_NetSessionEnum	NetSessionEnum;
1357    CASE(SRVSVC_OPNUM_NetServerGetInfo)
1358	struct mslm_NetServerGetInfo	NetServerGetInfo;
1359    CASE(SRVSVC_OPNUM_NetRemoteTOD)
1360	struct mslm_NetRemoteTOD	NetRemoteTOD;
1361    CASE(SRVSVC_OPNUM_NetNameValidate)
1362	struct mslm_NetNameValidate	NetNameValidate;
1363    CASE(SRVSVC_OPNUM_NetShareAdd)
1364	struct mslm_NetShareAdd		NetShareAdd;
1365    CASE(SRVSVC_OPNUM_NetShareDel)
1366	struct mslm_NetShareDel		NetShareDel;
1367    CASE(SRVSVC_OPNUM_NetShareEnum)
1368	struct mslm_NetShareEnum	NetShareEnum;
1369    CASE(SRVSVC_OPNUM_NetShareEnumSticky)
1370	struct mslm_NetShareEnumSticky	NetShareEnumSticky;
1371    CASE(SRVSVC_OPNUM_NetGetFileSecurity)
1372	struct mslm_NetGetFileSecurity	NetGetFileSecurity;
1373    CASE(SRVSVC_OPNUM_NetSetFileSecurity)
1374	struct mslm_NetSetFileSecurity	NetSetFileSecurity;
1375};
1376typedef union srvsvc_interface	srvsvc_interface_t;
1377EXTERNTYPEINFO(srvsvc_interface)
1378
1379
1380
1381/*
1382 * WKSSVC - Workstation Service
1383 */
1384
1385/* Windows NT */
1386#define WKSSVC_OPNUM_NetWkstaGetInfo		0x00
1387#define WKSSVC_OPNUM_NetWkstaSetInfo		0x01
1388#define WKSSVC_OPNUM_NetWkstaUserEnum		0x02
1389#define WKSSVC_OPNUM_NetWkstaUserGetInfo	0x03
1390#define WKSSVC_OPNUM_NetWkstaUserSetInfo	0x04
1391#define WKSSVC_OPNUM_NetWkstaTransportEnum	0x05
1392#define WKSSVC_OPNUM_NetWkstaTransportAdd	0x06
1393#define WKSSVC_OPNUM_NetWkstaTransportDel	0x07
1394#define WKSSVC_OPNUM_NetUseAdd			0x08
1395#define WKSSVC_OPNUM_NetUseGetInfo		0x09
1396#define WKSSVC_OPNUM_NetUseDel			0x0a
1397#define WKSSVC_OPNUM_NetUseEnum			0x0b
1398#define WKSSVC_OPNUM_NetMessageBufferSend	0x0c
1399#define WKSSVC_OPNUM_NetWkstaStatisticsGet	0x0d
1400#define WKSSVC_OPNUM_NetLogonDomainNameAdd	0x0e
1401
1402/* Windows 2000 */
1403#define WKSSVC_OPNUM_NetLogonDomainNameDel	0x0f
1404#define WKSSVC_OPNUM_NetJoinDomain		0x10
1405#define WKSSVC_OPNUM_NetUnjoinDomain		0x11
1406#define WKSSVC_OPNUM_NetValidateName		0x12
1407#define WKSSVC_OPNUM_NetRenameMachineInDomain	0x13
1408#define WKSSVC_OPNUM_NetGetJoinInformation	0x14
1409#define WKSSVC_OPNUM_NetGetJoinableOUs		0x15
1410#define WKSSVC_OPNUM_NetJoinDomain2		0x16
1411#define WKSSVC_OPNUM_NetUnjoinDomain2		0x17
1412#define WKSSVC_OPNUM_NetRenameMachineInDomain2	0x18
1413#define WKSSVC_OPNUM_NetValidateName2		0x19
1414#define WKSSVC_OPNUM_NetGetJoinableOUs2		0x1a
1415
1416/* Windows XP and Windows Server 2003 */
1417#define WKSSVC_OPNUM_NetAddAlternateComputerName	0x1b
1418#define WKSSVC_OPNUM_NetRemoveAlternateComputerName	0x1c
1419#define WKSSVC_OPNUM_NetSetPrimaryComputerName		0x1d
1420#define WKSSVC_OPNUM_NetEnumerateComputerNames		0x1e
1421#define WKSSVC_OPNUM_NetWorkstationResetDfsCache	0x1f
1422
1423
1424struct mslm_WKSTA_INFO_100 {
1425    DWORD   wki100_platform_id;
1426    LPTSTR  wki100_computername;
1427    LPTSTR  wki100_langroup;
1428    DWORD   wki100_ver_major;
1429    DWORD   wki100_ver_minor;
1430};
1431
1432/* NetWkstaGetInfo only.  System information - user access */
1433struct mslm_WKSTA_INFO_101 {
1434    DWORD   wki101_platform_id;
1435    LPTSTR  wki101_computername;
1436    LPTSTR  wki101_langroup;
1437    DWORD   wki101_ver_major;
1438    DWORD   wki101_ver_minor;
1439    LPTSTR  wki101_lanroot;
1440};
1441
1442/* NetWkstaGetInfo only.  System information - admin or operator access */
1443struct mslm_WKSTA_INFO_102 {
1444    DWORD   wki102_platform_id;
1445    LPTSTR  wki102_computername;
1446    LPTSTR  wki102_langroup;
1447    DWORD   wki102_ver_major;
1448    DWORD   wki102_ver_minor;
1449    LPTSTR  wki102_lanroot;
1450    DWORD   wki102_logged_on_users;
1451};
1452
1453struct mslm_WKSTA_INFO_502 {
1454	DWORD char_wait;
1455	DWORD collection_time;
1456	DWORD maximum_collection_count;
1457	DWORD keep_connection;
1458	DWORD max_commands;
1459	DWORD session_timeout;
1460	DWORD size_char_buf;
1461	DWORD max_threads;
1462	DWORD lock_quota;
1463	DWORD lock_increment;
1464	DWORD lock_maximum;
1465	DWORD pipe_increment;
1466	DWORD pipe_maximum;
1467	DWORD cache_file_timeout;
1468	DWORD dormant_file_limit;
1469	DWORD read_ahead_throughput;
1470	DWORD num_mailslot_buffers;
1471	DWORD num_srv_announce_buffers;
1472	DWORD max_illegal_dgram_events;
1473	DWORD dgram_event_reset_freq;
1474	DWORD log_election_packets;
1475	DWORD use_opportunistic_locking;
1476	DWORD use_unlock_behind;
1477	DWORD use_close_behind;
1478	DWORD buf_named_pipes;
1479	DWORD use_lock_read_unlock;
1480	DWORD utilize_nt_caching;
1481	DWORD use_raw_read;
1482	DWORD use_raw_write;
1483	DWORD use_write_raw_data;
1484	DWORD use_encryption;
1485	DWORD buf_files_deny_write;
1486	DWORD buf_read_only_files;
1487	DWORD force_core_create_mode;
1488	DWORD use_512_byte_max_transfer;
1489};
1490
1491INFO1RES_DEFINITION(mslm_NetWkstaGetInfo,
1492	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,100)
1493	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,101)
1494	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,102)
1495	INFO1RES_UNION_ENTRY(mslm_WKSTA_INFO,502))
1496
1497INFO1RESBUF_DEFINITION(mslm_NetWkstaGetInfo,
1498	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,100)
1499	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,101)
1500	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,102)
1501	INFO1RESBUF_UNION_ENTRY(mslm_WKSTA_INFO,502))
1502
1503
1504OPERATION(WKSSVC_OPNUM_NetWkstaGetInfo)
1505struct mslm_NetWkstaGetInfo {
1506	IN  LPTSTR	servername;
1507	IN  DWORD	level;
1508	OUT struct mslm_NetWkstaGetInfo_result result;
1509	OUT DWORD	status;
1510};
1511
1512/*
1513 ***********************************************************************
1514 * NetWkstaTransportEnum
1515 ***********************************************************************
1516 */
1517
1518struct mslm_NetWkstaTransportInfo0 {
1519	DWORD quality_of_service;
1520	DWORD num_vcs;
1521	LPTSTR transport_name;
1522	LPTSTR transport_address;
1523	DWORD wan_ish;
1524};
1525
1526struct mslm_NetWkstaTransportCtr0 {
1527	DWORD count;
1528    SIZE_IS(count)
1529	struct mslm_NetWkstaTransportInfo0 *ti0;
1530};
1531
1532union mslm_NetWkstaTransportInfo_ru {
1533	CASE(0) struct mslm_NetWkstaTransportCtr0 *info0;
1534	DEFAULT char *nullptr;
1535};
1536
1537struct mslm_NetWkstaTransportInfo {
1538	DWORD address;
1539	DWORD level;
1540    SWITCH(level)
1541	union mslm_NetWkstaTransportInfo_ru ru;
1542};
1543
1544OPERATION(WKSSVC_OPNUM_NetWkstaTransportEnum)
1545struct mslm_NetWkstaTransportEnum {
1546	IN 	LPTSTR	servername;
1547	INOUT	struct mslm_NetWkstaTransportInfo info;
1548	IN	DWORD	pref_max_len;
1549	OUT 	DWORD	total_entries;
1550	INOUT	DWORD	*resume_handle;
1551	OUT	DWORD	status;
1552};
1553
1554/*
1555 * The WKSSVC already
1556 */
1557INTERFACE(0)
1558union wkssvc_interface {
1559    CASE(WKSSVC_OPNUM_NetWkstaGetInfo)
1560	struct mslm_NetWkstaGetInfo		NetWkstaGetInfo;
1561    CASE(WKSSVC_OPNUM_NetWkstaTransportEnum)
1562	struct mslm_NetWkstaTransportEnum	NetWkstaTransportEnum;
1563};
1564typedef union wkssvc_interface	wkssvc_interface_t;
1565EXTERNTYPEINFO(wkssvc_interface)
1566
1567
1568#endif /* _MLSVC_LANMAN_NDL_ */
1569