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