xref: /titanic_51/usr/src/uts/common/smbsrv/ndl/winreg.ndl (revision 53a7b6b6763f5865522a76e5e887390a8f4777d7)
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_WINREG_NDL_
27#define _MLSVC_WINREG_NDL_
28
29/*
30 * Windows Registry (WINREG) RPC interface definition.
31 *
32 * The Windows registry is split into a number of hives, which are divided
33 * by function.  The hive names are abbreviated and prefixed by HKEY or HK.
34 *
35 * HKEY_CLASSES_ROOT     (HKCR)	Information about registered applications
36 * HKEY_CURRENT_USER     (HKCU)	Settings for the current logged in user.
37 * HKEY_LOCAL_MACHINE    (HKLM)	Settings for all users on the computer.
38 * HKEY_USERS            (HKU)	HKEY_CURRENT_USER subkeys for user accounts.
39 * HKEY_CURRENT_CONFIG   (HKCC)	Runtime configuration information.
40 * HKEY_PERFORMANCE_DATA (HKPD)	Runtime performance data.
41 * HKEY_DYN_DATA         (HKDD)	Runtime data for Windows 9x applications.
42 * HKEY_PERFORMANCE_TEXT (HKPT)	Runtime performance information.
43 * HKEY_PERFORMANCE_NLS  (HKPN)	Runtime performance information.
44 */
45
46#include "ndrtypes.ndl"
47
48/* Windows NT */
49#define WINREG_OPNUM_OpenHKCR		0x00
50#define WINREG_OPNUM_OpenHKCU		0x01
51#define WINREG_OPNUM_OpenHKLM		0x02
52#define WINREG_OPNUM_OpenHKPD		0x03
53#define WINREG_OPNUM_OpenHKUsers	0x04
54#define WINREG_OPNUM_Close		0x05
55#define WINREG_OPNUM_CreateKey		0x06
56#define WINREG_OPNUM_DeleteKey		0x07
57#define WINREG_OPNUM_DeleteValue	0x08
58#define WINREG_OPNUM_EnumKey		0x09
59#define WINREG_OPNUM_EnumValue		0x0a
60#define WINREG_OPNUM_FlushKey		0x0b
61#define WINREG_OPNUM_GetKeySec		0x0c
62#define WINREG_OPNUM_LoadKey		0x0d
63#define WINREG_OPNUM_NotifyChange	0x0e
64#define WINREG_OPNUM_OpenKey		0x0f
65#define WINREG_OPNUM_QueryKey		0x10
66#define WINREG_OPNUM_QueryValue		0x11
67#define WINREG_OPNUM_ReplaceKey		0x12
68#define WINREG_OPNUM_RestoreKey		0x13
69#define WINREG_OPNUM_SaveKey		0x14
70#define WINREG_OPNUM_SetKeySec		0x15
71
72/* Windows 2000 */
73#define WINREG_OPNUM_CreateValue	0x16
74#define WINREG_OPNUM_UnloadKey		0x17
75#define WINREG_OPNUM_Shutdown		0x18
76#define WINREG_OPNUM_AbortShutdown	0x19
77#define WINREG_OPNUM_GetVersion		0x1a
78#define WINREG_OPNUM_OpenHKCC		0x1b
79#define WINREG_OPNUM_OpenHKDD		0x1c
80#define WINREG_OPNUM_QueryMultiValues	0x1d
81#define WINREG_OPNUM_ShutdownEx		0x1e
82
83/* Windows XP and Windows Server 2003 */
84#define WINREG_OPNUM_SavekeyEx		0x1f
85#define WINREG_OPNUM_OpenHKPT		0x20
86#define WINREG_OPNUM_OpenHKPN		0x21
87
88/* Windows 2003 SP1 */
89#define WINREG_OPNUM_QueryMultiValues2	0x22
90#define WINREG_OPNUM_DeleteKeyEx	0x23
91
92#define	WINREG_TYPE_NONE		0
93#define WINREG_SZ			1
94#define WINREG_EXPAND_SZ		2
95#define WINREG_BINARY			3
96#define WINREG_DWORD			4
97#define WINREG_DWORD_BIG_ENDIAN		5
98#define WINREG_LINK			6
99#define WINREG_MULTI_SZ			7
100#define WINREG_RESOURCE_LIST		8
101#define WINREG_RESOURCE_DESC		9
102#define WINREG_RESOURCE_REQ_LIST	10
103#define WINREG_QWORD			11
104
105#define	WINREG_ACCESS_QUERY_VALUE	0x00000001
106#define WINREG_ACCESS_SET_VALUE		0x00000002
107#define WINREG_ACCESS_CREATE_KEY	0x00000004
108#define WINREG_ACCESS_ENUMERATE		0x00000008
109#define WINREG_ACCESS_NOTIFY		0x00000010
110#define WINREG_ACCESS_CREATE_LINK	0x00000020
111#define WINREG_ACCESS_KEY64		0x00000100
112#define WINREG_ACCESS_KEY32		0x00000200
113
114CONTEXT_HANDLE(winreg_handle) winreg_handle_t;
115
116struct winreg_string_desc {
117	WORD	length;
118	WORD	allosize;
119	LPTSTR	str;
120};
121typedef struct winreg_string_desc winreg_string_t;
122
123/*
124 * Fake Varying/Conformant with a funny conformant.
125 */
126struct winreg_value {
127	DWORD	vc_first_is;	/* 0 */
128	DWORD	vc_length_is;
129  SIZE_IS(vc_length_is)
130	BYTE	value[ANY_SIZE_ARRAY];
131};
132
133struct winreg_vcbuf {
134	WORD wclen;
135	WORD wcsize;
136	struct winreg_value *buf;
137};
138typedef struct winreg_vcbuf winreg_vcbuf_t;
139
140struct file_time {
141	DWORD	low;
142	DWORD	high;
143};
144typedef struct file_time file_time_t;
145
146struct winreg_secdesc {
147	DWORD	sd_length_is;
148  SIZE_IS(sd_length_is)
149	BYTE	value[ANY_SIZE_ARRAY];
150};
151
152OPERATION(WINREG_OPNUM_OpenHKCR)
153struct winreg_OpenHKCR {
154	IN  DWORD		*server;
155	IN  DWORD		access_mask;
156	OUT winreg_handle_t	handle;
157	OUT DWORD		status;
158};
159
160OPERATION(WINREG_OPNUM_OpenHKCU)
161struct winreg_OpenHKCU {
162	IN  DWORD		*server;
163	IN  DWORD		access_mask;
164	OUT winreg_handle_t	handle;
165	OUT DWORD		status;
166};
167
168OPERATION(WINREG_OPNUM_OpenHKLM)
169struct winreg_OpenHKLM {
170	IN  DWORD		*server;
171	IN  DWORD		access_mask;
172	OUT winreg_handle_t	handle;
173	OUT DWORD		status;
174};
175
176OPERATION(WINREG_OPNUM_OpenHKPD)
177struct winreg_OpenHKPD {
178	IN  DWORD		*server;
179	IN  DWORD		access_mask;
180	OUT winreg_handle_t	handle;
181	OUT DWORD		status;
182};
183
184OPERATION(WINREG_OPNUM_OpenHKUsers)
185struct winreg_OpenHKUsers {
186	IN  DWORD		*server;
187	IN  DWORD		access_mask;
188	OUT winreg_handle_t	handle;
189	OUT DWORD		status;
190};
191
192
193OPERATION(WINREG_OPNUM_Close)
194struct winreg_Close {
195	IN  winreg_handle_t	handle;
196	OUT winreg_handle_t	result_handle;
197	OUT DWORD		status;
198};
199
200#define	WINREG_ACTION_NONE		0
201#define	WINREG_ACTION_NEW_KEY		1
202#define	WINREG_ACTION_EXISTING_KEY	2
203
204OPERATION(WINREG_OPNUM_CreateKey)
205struct winreg_CreateKey {
206	IN winreg_handle_t	handle;
207	IN winreg_string_t	subkey;
208	IN winreg_string_t	keyclass;
209	IN DWORD		options;
210	IN DWORD		access_mask;
211	IN DWORD		*sd;
212	OUT winreg_handle_t	result_handle;
213	OUT DWORD		*action;
214	OUT DWORD		status;
215};
216
217
218OPERATION(WINREG_OPNUM_DeleteKey)
219struct winreg_DeleteKey {
220	IN winreg_handle_t	handle;
221	IN winreg_string_t	subkey;
222	OUT DWORD		status;
223};
224
225
226OPERATION(WINREG_OPNUM_DeleteValue)
227struct winreg_DeleteValue {
228	IN winreg_handle_t	handle;
229	IN winreg_string_t	name;
230	OUT DWORD		status;
231};
232
233/*
234 * Some of the OUT parameters are also supplied
235 * as IN parameters but we can ignore them.
236 */
237OPERATION(WINREG_OPNUM_EnumKey)
238struct winreg_EnumKey {
239	IN	winreg_handle_t	handle;
240	IN	DWORD		index;
241	/* IN	ignore the remaining input data */
242/*
243	INOUT	winreg_vcbuf_t	name;
244	INOUT	winreg_vcbuf_t	*class;
245	INOUT	file_time_t	*change_time;
246*/
247	OUT	winreg_vcbuf_t	name;
248	OUT	winreg_vcbuf_t	*class;
249	OUT	file_time_t	*change_time;
250	OUT	DWORD		status;
251};
252
253/*
254 * Some of the OUT parameters are also supplied
255 * as IN parameters but we can ignore them.
256 */
257OPERATION(WINREG_OPNUM_EnumValue)
258struct winreg_EnumValue {
259	IN winreg_handle_t	handle;
260	IN DWORD		index;
261	/* IN	ignore the remaining input data */
262
263	OUT winreg_vcbuf_t	name;
264	OUT DWORD		*type;
265	OUT struct winreg_value *value;
266	OUT DWORD		*value_size;
267	OUT DWORD		*value_size_total;
268	OUT DWORD		status;
269};
270
271OPERATION(WINREG_OPNUM_FlushKey)
272struct winreg_FlushKey {
273	IN winreg_handle_t	handle;
274	OUT DWORD		status;
275};
276
277OPERATION(WINREG_OPNUM_GetKeySec)
278struct winreg_GetKeySec {
279	IN winreg_handle_t	handle;
280	IN DWORD		sec_info;
281/*
282	OUT struct winreg_secdesc	sd;
283*/
284	OUT DWORD		sd_length_is;
285	OUT DWORD		sd_size_is;
286	OUT DWORD		sd_array;
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