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