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