xref: /illumos-gate/usr/src/uts/common/smbsrv/ndl/winreg.ndl (revision 5328fc53d11d7151861fa272e4fb0248b8f0e145)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21/*
22 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
26 */
27
28#ifndef _MLSVC_WINREG_NDL_
29#define _MLSVC_WINREG_NDL_
30
31/*
32 * Windows Registry (WINREG) RPC interface definition.
33 *
34 * The Windows registry is split into a number of hives, which are divided
35 * by function.  The hive names are abbreviated and prefixed by HKEY or HK.
36 *
37 * HKEY_CLASSES_ROOT     (HKCR)	Information about registered applications
38 * HKEY_CURRENT_USER     (HKCU)	Settings for the current logged in user.
39 * HKEY_LOCAL_MACHINE    (HKLM)	Settings for all users on the computer.
40 * HKEY_USERS            (HKU)	HKEY_CURRENT_USER subkeys for user accounts.
41 * HKEY_CURRENT_CONFIG   (HKCC)	Runtime configuration information.
42 * HKEY_PERFORMANCE_DATA (HKPD)	Runtime performance data.
43 * HKEY_DYN_DATA         (HKDD)	Runtime data for Windows 9x applications.
44 * HKEY_PERFORMANCE_TEXT (HKPT)	Runtime performance information.
45 * HKEY_PERFORMANCE_NLS  (HKPN)	Runtime performance information.
46 */
47
48#include <libmlrpc/ndrtypes.ndl>
49
50/* Windows NT */
51#define WINREG_OPNUM_OpenHKCR		0x00
52#define WINREG_OPNUM_OpenHKCU		0x01
53#define WINREG_OPNUM_OpenHKLM		0x02
54#define WINREG_OPNUM_OpenHKPD		0x03
55#define WINREG_OPNUM_OpenHKUsers	0x04
56#define WINREG_OPNUM_Close		0x05
57#define WINREG_OPNUM_CreateKey		0x06
58#define WINREG_OPNUM_DeleteKey		0x07
59#define WINREG_OPNUM_DeleteValue	0x08
60#define WINREG_OPNUM_EnumKey		0x09
61#define WINREG_OPNUM_EnumValue		0x0a
62#define WINREG_OPNUM_FlushKey		0x0b
63#define WINREG_OPNUM_GetKeySec		0x0c
64#define WINREG_OPNUM_LoadKey		0x0d
65#define WINREG_OPNUM_NotifyChange	0x0e
66#define WINREG_OPNUM_OpenKey		0x0f
67#define WINREG_OPNUM_QueryKey		0x10
68#define WINREG_OPNUM_QueryValue		0x11
69#define WINREG_OPNUM_ReplaceKey		0x12
70#define WINREG_OPNUM_RestoreKey		0x13
71#define WINREG_OPNUM_SaveKey		0x14
72#define WINREG_OPNUM_SetKeySec		0x15
73
74/* Windows 2000 */
75#define WINREG_OPNUM_CreateValue	0x16
76#define WINREG_OPNUM_UnloadKey		0x17
77#define WINREG_OPNUM_Shutdown		0x18
78#define WINREG_OPNUM_AbortShutdown	0x19
79#define WINREG_OPNUM_GetVersion		0x1a
80#define WINREG_OPNUM_OpenHKCC		0x1b
81#define WINREG_OPNUM_OpenHKDD		0x1c
82#define WINREG_OPNUM_QueryMultiValues	0x1d
83#define WINREG_OPNUM_ShutdownEx		0x1e
84
85/* Windows XP and Windows Server 2003 */
86#define WINREG_OPNUM_SavekeyEx		0x1f
87#define WINREG_OPNUM_OpenHKPT		0x20
88#define WINREG_OPNUM_OpenHKPN		0x21
89
90/* Windows 2003 SP1 */
91#define WINREG_OPNUM_QueryMultiValues2	0x22
92#define WINREG_OPNUM_DeleteKeyEx	0x23
93
94#define	WINREG_TYPE_NONE		0
95#define WINREG_SZ			1
96#define WINREG_EXPAND_SZ		2
97#define WINREG_BINARY			3
98#define WINREG_DWORD			4
99#define WINREG_DWORD_BIG_ENDIAN		5
100#define WINREG_LINK			6
101#define WINREG_MULTI_SZ			7
102#define WINREG_RESOURCE_LIST		8
103#define WINREG_RESOURCE_DESC		9
104#define WINREG_RESOURCE_REQ_LIST	10
105#define WINREG_QWORD			11
106
107#define	WINREG_ACCESS_QUERY_VALUE	0x00000001
108#define WINREG_ACCESS_SET_VALUE		0x00000002
109#define WINREG_ACCESS_CREATE_KEY	0x00000004
110#define WINREG_ACCESS_ENUMERATE		0x00000008
111#define WINREG_ACCESS_NOTIFY		0x00000010
112#define WINREG_ACCESS_CREATE_LINK	0x00000020
113#define WINREG_ACCESS_KEY64		0x00000100
114#define WINREG_ACCESS_KEY32		0x00000200
115
116CONTEXT_HANDLE(winreg_handle) winreg_handle_t;
117
118struct winreg_string_desc {
119	WORD	length;
120	WORD	allosize;
121	LPTSTR	str;
122};
123typedef struct winreg_string_desc winreg_string_t;
124
125/*
126 * Fake Varying/Conformant with a funny conformant.
127 */
128struct winreg_value {
129	DWORD	vc_first_is;	/* 0 */
130	DWORD	vc_length_is;
131    SIZE_IS(vc_length_is)
132	BYTE	value[ANY_SIZE_ARRAY];
133};
134
135struct winreg_vcs {
136	DWORD	vc_first_is;	/* 0 */
137	DWORD	vc_length_is;
138    SIZE_IS(vc_length_is)
139	WORD	value[ANY_SIZE_ARRAY];
140};
141
142struct winreg_vcbuf {
143	WORD wclen;
144	WORD wcsize;
145	struct winreg_vcs *buf;
146};
147typedef struct winreg_vcbuf winreg_vcbuf_t;
148
149struct file_time {
150	DWORD	low;
151	DWORD	high;
152};
153typedef struct file_time file_time_t;
154
155struct winreg_secdesc {
156	struct winreg_value	*sd_buf;
157	DWORD			sd_len;
158	DWORD			sd_size;
159};
160
161OPERATION(WINREG_OPNUM_OpenHKCR)
162struct winreg_OpenHKCR {
163	IN  DWORD		*server;
164	IN  DWORD		access_mask;
165	OUT winreg_handle_t	handle;
166	OUT DWORD		status;
167};
168
169OPERATION(WINREG_OPNUM_OpenHKCU)
170struct winreg_OpenHKCU {
171	IN  DWORD		*server;
172	IN  DWORD		access_mask;
173	OUT winreg_handle_t	handle;
174	OUT DWORD		status;
175};
176
177OPERATION(WINREG_OPNUM_OpenHKLM)
178struct winreg_OpenHKLM {
179	IN  DWORD		*server;
180	IN  DWORD		access_mask;
181	OUT winreg_handle_t	handle;
182	OUT DWORD		status;
183};
184
185OPERATION(WINREG_OPNUM_OpenHKPD)
186struct winreg_OpenHKPD {
187	IN  DWORD		*server;
188	IN  DWORD		access_mask;
189	OUT winreg_handle_t	handle;
190	OUT DWORD		status;
191};
192
193OPERATION(WINREG_OPNUM_OpenHKUsers)
194struct winreg_OpenHKUsers {
195	IN  DWORD		*server;
196	IN  DWORD		access_mask;
197	OUT winreg_handle_t	handle;
198	OUT DWORD		status;
199};
200
201
202OPERATION(WINREG_OPNUM_Close)
203struct winreg_Close {
204	IN  winreg_handle_t	handle;
205	OUT winreg_handle_t	result_handle;
206	OUT DWORD		status;
207};
208
209#define	WINREG_ACTION_NONE		0
210#define	WINREG_ACTION_NEW_KEY		1
211#define	WINREG_ACTION_EXISTING_KEY	2
212
213OPERATION(WINREG_OPNUM_CreateKey)
214struct winreg_CreateKey {
215	IN winreg_handle_t	handle;
216	IN winreg_string_t	subkey;
217	IN winreg_string_t	keyclass;
218	IN DWORD		options;
219	IN DWORD		access_mask;
220	IN DWORD		*sd;
221	OUT winreg_handle_t	result_handle;
222	OUT DWORD		*action;
223	OUT DWORD		status;
224};
225
226
227OPERATION(WINREG_OPNUM_DeleteKey)
228struct winreg_DeleteKey {
229	IN winreg_handle_t	handle;
230	IN winreg_string_t	subkey;
231	OUT DWORD		status;
232};
233
234
235OPERATION(WINREG_OPNUM_DeleteValue)
236struct winreg_DeleteValue {
237	IN winreg_handle_t	handle;
238	IN winreg_string_t	name;
239	OUT DWORD		status;
240};
241
242/*
243 * Some of the OUT parameters are also supplied
244 * as IN parameters but we can ignore them.
245 */
246OPERATION(WINREG_OPNUM_EnumKey)
247struct winreg_EnumKey {
248	IN	winreg_handle_t	handle;
249	IN	DWORD	index;
250	IN	winreg_string_t	name_in;
251	IN	winreg_string_t	*class_in;
252	OUT	winreg_string_t	name_out;
253	OUT	winreg_string_t	*class_out;
254	INOUT	file_time_t	*change_time;
255	OUT	DWORD		status;
256};
257
258/*
259 * Some of the OUT parameters are also supplied
260 * as IN parameters but we can ignore them.
261 */
262OPERATION(WINREG_OPNUM_EnumValue)
263struct winreg_EnumValue {
264	IN winreg_handle_t	handle;
265	IN DWORD		index;
266	/* IN	ignore the remaining input data */
267
268	OUT winreg_vcbuf_t	name;
269	OUT DWORD		*type;
270	OUT struct winreg_value *value;
271	OUT DWORD		*value_size;
272	OUT DWORD		*value_size_total;
273	OUT DWORD		status;
274};
275
276OPERATION(WINREG_OPNUM_FlushKey)
277struct winreg_FlushKey {
278	IN winreg_handle_t	handle;
279	OUT DWORD		status;
280};
281
282OPERATION(WINREG_OPNUM_GetKeySec)
283struct winreg_GetKeySec {
284	IN		winreg_handle_t		handle;
285	IN		DWORD			sec_info;
286	OUT REFERENCE	struct winreg_secdesc	*sd;
287	OUT		DWORD			status;
288};
289
290OPERATION(WINREG_OPNUM_NotifyChange)
291struct winreg_NotifyChange {
292	IN  winreg_handle_t	handle;
293	IN  DWORD		watch_subtree;
294	IN  DWORD		notify_filter;
295	OUT DWORD		status;
296};
297
298OPERATION(WINREG_OPNUM_OpenKey)
299struct winreg_OpenKey {
300	IN  winreg_handle_t	handle;
301	IN  winreg_string_t	name;
302	IN  DWORD		options;
303	IN  DWORD		access_mask;
304	OUT winreg_handle_t	result_handle;
305	OUT DWORD		status;
306};
307
308
309OPERATION(WINREG_OPNUM_QueryKey)
310struct winreg_QueryKey {
311	IN  winreg_handle_t	handle;
312	INOUT winreg_string_t	name;
313	OUT DWORD 		num_subkeys;
314	OUT DWORD 		max_subkey_len;
315	OUT DWORD 		max_class_len;
316	OUT DWORD 		num_values;
317	OUT DWORD 		max_value_namelen;
318	OUT DWORD 		max_value_len;
319	OUT DWORD 		secdesc_size;
320	OUT file_time_t 	last_write_time;
321	OUT DWORD		status;
322};
323
324
325/*
326 * Some of the OUT parameters are also supplied
327 * as IN parameters but we can ignore them.
328 */
329OPERATION(WINREG_OPNUM_QueryValue)
330struct winreg_QueryValue {
331	IN  winreg_handle_t	handle;
332	IN  winreg_string_t	value_name;
333	/* IN	ignore the remaining input data */
334
335	OUT DWORD		*type;
336	OUT struct winreg_value	*value;
337	OUT DWORD		*value_size;
338	OUT DWORD		*value_size_total;
339	OUT DWORD		status;
340};
341
342
343OPERATION(WINREG_OPNUM_SetKeySec)
344struct winreg_SetKeySec {
345	IN winreg_handle_t	handle;
346	IN DWORD		access_mask;
347	IN DWORD		sd;
348	OUT DWORD		status;
349};
350
351OPERATION(WINREG_OPNUM_CreateValue)
352struct winreg_CreateValue {
353	IN winreg_handle_t	handle;
354	IN winreg_string_t	name;
355	IN winreg_string_t	class;
356	IN DWORD		options;
357	/* IN	ignore the remaining input data */
358
359	OUT DWORD		status;
360};
361
362
363/*
364 * The real structure of shutdown passes some strings, a timeout
365 * and reboot/shutdown flags but this allows us to accept the call,
366 * without anything appearing in the log, and return access denied.
367 */
368OPERATION(WINREG_OPNUM_Shutdown)
369struct winreg_Shutdown {
370	IN DWORD		ignored;
371	OUT DWORD		status;
372};
373
374OPERATION(WINREG_OPNUM_AbortShutdown)
375struct winreg_AbortShutdown {
376	IN DWORD		ignored;
377	OUT DWORD		status;
378};
379
380OPERATION(WINREG_OPNUM_GetVersion)
381struct winreg_GetVersion {
382	IN winreg_handle_t	handle;
383	OUT DWORD		version;
384	OUT DWORD		status;
385};
386
387OPERATION(WINREG_OPNUM_OpenHKCC)
388struct winreg_OpenHKCC {
389	IN  DWORD		*server;
390	IN  DWORD		access_mask;
391	OUT winreg_handle_t	handle;
392	OUT DWORD		status;
393};
394
395OPERATION(WINREG_OPNUM_OpenHKDD)
396struct winreg_OpenHKDD {
397	IN  DWORD		*server;
398	IN  DWORD		access_mask;
399	OUT winreg_handle_t	handle;
400	OUT DWORD		status;
401};
402
403OPERATION(WINREG_OPNUM_OpenHKPT)
404struct winreg_OpenHKPT {
405	IN  DWORD		*server;
406	IN  DWORD		access_mask;
407	OUT winreg_handle_t	handle;
408	OUT DWORD		status;
409};
410
411OPERATION(WINREG_OPNUM_OpenHKPN)
412struct winreg_OpenHKPN {
413	IN  DWORD		*server;
414	IN  DWORD		access_mask;
415	OUT winreg_handle_t	handle;
416	OUT DWORD		status;
417};
418
419/*
420 * The WINREG interface.
421 */
422INTERFACE(0)
423union winreg_interface {
424	CASE(WINREG_OPNUM_OpenHKCR)
425		struct winreg_OpenHKCR		OpenHKCR;
426	CASE(WINREG_OPNUM_OpenHKCU)
427		struct winreg_OpenHKCU		OpenHKCU;
428	CASE(WINREG_OPNUM_OpenHKLM)
429		struct winreg_OpenHKLM		OpenHKLM;
430	CASE(WINREG_OPNUM_OpenHKPD)
431		struct winreg_OpenHKPD		OpenHKPD;
432	CASE(WINREG_OPNUM_OpenHKUsers)
433		struct winreg_OpenHKUsers	OpenHKUsers;
434	CASE(WINREG_OPNUM_Close)
435		struct winreg_Close		Close;
436	CASE(WINREG_OPNUM_CreateKey)
437		struct winreg_CreateKey		CreateKey;
438	CASE(WINREG_OPNUM_DeleteKey)
439		struct winreg_DeleteKey		DeleteKey;
440	CASE(WINREG_OPNUM_DeleteValue)
441		struct winreg_DeleteValue	DeleteValue;
442	CASE(WINREG_OPNUM_EnumKey)
443		struct winreg_EnumKey		EnumKey;
444	CASE(WINREG_OPNUM_EnumValue)
445		struct winreg_EnumValue		EnumValue;
446	CASE(WINREG_OPNUM_FlushKey)
447		struct winreg_FlushKey		FlushKey;
448	CASE(WINREG_OPNUM_GetKeySec)
449		struct winreg_GetKeySec		GetKeySec;
450	CASE(WINREG_OPNUM_NotifyChange)
451		struct winreg_NotifyChange	NotifyChange;
452	CASE(WINREG_OPNUM_OpenKey)
453		struct winreg_OpenKey		OpenKey;
454	CASE(WINREG_OPNUM_QueryKey)
455		struct winreg_QueryKey		QueryKey;
456	CASE(WINREG_OPNUM_QueryValue)
457		struct winreg_QueryValue	QueryValue;
458	CASE(WINREG_OPNUM_SetKeySec)
459		struct winreg_SetKeySec		SetKeySec;
460	CASE(WINREG_OPNUM_CreateValue)
461		struct winreg_CreateValue	CreateValue;
462	CASE(WINREG_OPNUM_Shutdown)
463		struct winreg_Shutdown		Shutdown;
464	CASE(WINREG_OPNUM_AbortShutdown)
465		struct winreg_AbortShutdown	AbortShutdown;
466	CASE(WINREG_OPNUM_GetVersion)
467		struct winreg_GetVersion	GetVersion;
468	CASE(WINREG_OPNUM_OpenHKCC)
469		struct winreg_OpenHKCC		OpenHKCC;
470	CASE(WINREG_OPNUM_OpenHKDD)
471		struct winreg_OpenHKDD		OpenHKDD;
472	CASE(WINREG_OPNUM_OpenHKPT)
473		struct winreg_OpenHKPT		OpenHKPT;
474	CASE(WINREG_OPNUM_OpenHKPN)
475		struct winreg_OpenHKPN		OpenHKPN;
476};
477typedef union winreg_interface	winreg_interface_t;
478EXTERNTYPEINFO(winreg_interface)
479
480#endif /* _MLSVC_WINREG_NDL_ */
481