xref: /titanic_52/usr/src/uts/common/smbsrv/ndl/winreg.ndl (revision 5679c89fcd2facbb4334df8870d3d7a4d2b11673)
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_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_vcs {
134	DWORD	vc_first_is;	/* 0 */
135	DWORD	vc_length_is;
136    SIZE_IS(vc_length_is)
137	WORD	value[ANY_SIZE_ARRAY];
138};
139
140struct winreg_vcbuf {
141	WORD wclen;
142	WORD wcsize;
143	struct winreg_vcs *buf;
144};
145typedef struct winreg_vcbuf winreg_vcbuf_t;
146
147struct file_time {
148	DWORD	low;
149	DWORD	high;
150};
151typedef struct file_time file_time_t;
152
153struct winreg_secdesc {
154	DWORD	sd_length_is;
155  SIZE_IS(sd_length_is)
156	BYTE	value[ANY_SIZE_ARRAY];
157};
158
159OPERATION(WINREG_OPNUM_OpenHKCR)
160struct winreg_OpenHKCR {
161	IN  DWORD		*server;
162	IN  DWORD		access_mask;
163	OUT winreg_handle_t	handle;
164	OUT DWORD		status;
165};
166
167OPERATION(WINREG_OPNUM_OpenHKCU)
168struct winreg_OpenHKCU {
169	IN  DWORD		*server;
170	IN  DWORD		access_mask;
171	OUT winreg_handle_t	handle;
172	OUT DWORD		status;
173};
174
175OPERATION(WINREG_OPNUM_OpenHKLM)
176struct winreg_OpenHKLM {
177	IN  DWORD		*server;
178	IN  DWORD		access_mask;
179	OUT winreg_handle_t	handle;
180	OUT DWORD		status;
181};
182
183OPERATION(WINREG_OPNUM_OpenHKPD)
184struct winreg_OpenHKPD {
185	IN  DWORD		*server;
186	IN  DWORD		access_mask;
187	OUT winreg_handle_t	handle;
188	OUT DWORD		status;
189};
190
191OPERATION(WINREG_OPNUM_OpenHKUsers)
192struct winreg_OpenHKUsers {
193	IN  DWORD		*server;
194	IN  DWORD		access_mask;
195	OUT winreg_handle_t	handle;
196	OUT DWORD		status;
197};
198
199
200OPERATION(WINREG_OPNUM_Close)
201struct winreg_Close {
202	IN  winreg_handle_t	handle;
203	OUT winreg_handle_t	result_handle;
204	OUT DWORD		status;
205};
206
207#define	WINREG_ACTION_NONE		0
208#define	WINREG_ACTION_NEW_KEY		1
209#define	WINREG_ACTION_EXISTING_KEY	2
210
211OPERATION(WINREG_OPNUM_CreateKey)
212struct winreg_CreateKey {
213	IN winreg_handle_t	handle;
214	IN winreg_string_t	subkey;
215	IN winreg_string_t	keyclass;
216	IN DWORD		options;
217	IN DWORD		access_mask;
218	IN DWORD		*sd;
219	OUT winreg_handle_t	result_handle;
220	OUT DWORD		*action;
221	OUT DWORD		status;
222};
223
224
225OPERATION(WINREG_OPNUM_DeleteKey)
226struct winreg_DeleteKey {
227	IN winreg_handle_t	handle;
228	IN winreg_string_t	subkey;
229	OUT DWORD		status;
230};
231
232
233OPERATION(WINREG_OPNUM_DeleteValue)
234struct winreg_DeleteValue {
235	IN winreg_handle_t	handle;
236	IN winreg_string_t	name;
237	OUT DWORD		status;
238};
239
240/*
241 * Some of the OUT parameters are also supplied
242 * as IN parameters but we can ignore them.
243 */
244OPERATION(WINREG_OPNUM_EnumKey)
245struct winreg_EnumKey {
246	IN	winreg_handle_t	handle;
247	IN	DWORD	index;
248	IN	winreg_string_t	name_in;
249	IN	winreg_string_t	class_in;
250	OUT	winreg_string_t	name_out;
251	OUT	winreg_string_t	*class_out;
252	INOUT	file_time_t	*change_time;
253	OUT	DWORD		status;
254};
255
256/*
257 * Some of the OUT parameters are also supplied
258 * as IN parameters but we can ignore them.
259 */
260OPERATION(WINREG_OPNUM_EnumValue)
261struct winreg_EnumValue {
262	IN winreg_handle_t	handle;
263	IN DWORD		index;
264	/* IN	ignore the remaining input data */
265
266	OUT winreg_vcbuf_t	name;
267	OUT DWORD		*type;
268	OUT struct winreg_value *value;
269	OUT DWORD		*value_size;
270	OUT DWORD		*value_size_total;
271	OUT DWORD		status;
272};
273
274OPERATION(WINREG_OPNUM_FlushKey)
275struct winreg_FlushKey {
276	IN winreg_handle_t	handle;
277	OUT DWORD		status;
278};
279
280OPERATION(WINREG_OPNUM_GetKeySec)
281struct winreg_GetKeySec {
282	IN winreg_handle_t	handle;
283	IN DWORD		sec_info;
284/*
285	OUT struct winreg_secdesc	sd;
286*/
287	OUT DWORD		sd_length_is;
288	OUT DWORD		sd_size_is;
289	OUT DWORD		sd_array;
290	OUT DWORD		status;
291};
292
293OPERATION(WINREG_OPNUM_NotifyChange)
294struct winreg_NotifyChange {
295	IN  winreg_handle_t	handle;
296	IN  DWORD		watch_subtree;
297	IN  DWORD		notify_filter;
298	OUT DWORD		status;
299};
300
301OPERATION(WINREG_OPNUM_OpenKey)
302struct winreg_OpenKey {
303	IN  winreg_handle_t	handle;
304	IN  winreg_string_t	name;
305	IN  DWORD		options;
306	IN  DWORD		access_mask;
307	OUT winreg_handle_t	result_handle;
308	OUT DWORD		status;
309};
310
311
312OPERATION(WINREG_OPNUM_QueryKey)
313struct winreg_QueryKey {
314	IN  winreg_handle_t	handle;
315	INOUT winreg_string_t	name;
316	OUT DWORD 		num_subkeys;
317	OUT DWORD 		max_subkey_len;
318	OUT DWORD 		max_class_len;
319	OUT DWORD 		num_values;
320	OUT DWORD 		max_value_namelen;
321	OUT DWORD 		max_value_len;
322	OUT DWORD 		secdesc_size;
323	OUT file_time_t 	last_write_time;
324	OUT DWORD		status;
325};
326
327
328/*
329 * Some of the OUT parameters are also supplied
330 * as IN parameters but we can ignore them.
331 */
332OPERATION(WINREG_OPNUM_QueryValue)
333struct winreg_QueryValue {
334	IN  winreg_handle_t	handle;
335	IN  winreg_string_t	value_name;
336	/* IN	ignore the remaining input data */
337
338	OUT DWORD		*type;
339	OUT struct winreg_value	*value;
340	OUT DWORD		*value_size;
341	OUT DWORD		*value_size_total;
342	OUT DWORD		status;
343};
344
345
346OPERATION(WINREG_OPNUM_SetKeySec)
347struct winreg_SetKeySec {
348	IN winreg_handle_t	handle;
349	IN DWORD		access_mask;
350	IN DWORD		sd;
351	OUT DWORD		status;
352};
353
354OPERATION(WINREG_OPNUM_CreateValue)
355struct winreg_CreateValue {
356	IN winreg_handle_t	handle;
357	IN winreg_string_t	name;
358	IN winreg_string_t	class;
359	IN DWORD		options;
360	/* IN	ignore the remaining input data */
361
362	OUT DWORD		status;
363};
364
365
366/*
367 * The real structure of shutdown passes some strings, a timeout
368 * and reboot/shutdown flags but this allows us to accept the call,
369 * without anything appearing in the log, and return access denied.
370 */
371OPERATION(WINREG_OPNUM_Shutdown)
372struct winreg_Shutdown {
373	IN DWORD		ignored;
374	OUT DWORD		status;
375};
376
377OPERATION(WINREG_OPNUM_AbortShutdown)
378struct winreg_AbortShutdown {
379	IN DWORD		ignored;
380	OUT DWORD		status;
381};
382
383OPERATION(WINREG_OPNUM_GetVersion)
384struct winreg_GetVersion {
385	IN winreg_handle_t	handle;
386	OUT DWORD		version;
387	OUT DWORD		status;
388};
389
390OPERATION(WINREG_OPNUM_OpenHKCC)
391struct winreg_OpenHKCC {
392	IN  DWORD		*server;
393	IN  DWORD		access_mask;
394	OUT winreg_handle_t	handle;
395	OUT DWORD		status;
396};
397
398OPERATION(WINREG_OPNUM_OpenHKDD)
399struct winreg_OpenHKDD {
400	IN  DWORD		*server;
401	IN  DWORD		access_mask;
402	OUT winreg_handle_t	handle;
403	OUT DWORD		status;
404};
405
406OPERATION(WINREG_OPNUM_OpenHKPT)
407struct winreg_OpenHKPT {
408	IN  DWORD		*server;
409	IN  DWORD		access_mask;
410	OUT winreg_handle_t	handle;
411	OUT DWORD		status;
412};
413
414OPERATION(WINREG_OPNUM_OpenHKPN)
415struct winreg_OpenHKPN {
416	IN  DWORD		*server;
417	IN  DWORD		access_mask;
418	OUT winreg_handle_t	handle;
419	OUT DWORD		status;
420};
421
422/*
423 * The WINREG interface.
424 */
425INTERFACE(0)
426union winreg_interface {
427	CASE(WINREG_OPNUM_OpenHKCR)
428		struct winreg_OpenHKCR		OpenHKCR;
429	CASE(WINREG_OPNUM_OpenHKCU)
430		struct winreg_OpenHKCU		OpenHKCU;
431	CASE(WINREG_OPNUM_OpenHKLM)
432		struct winreg_OpenHKLM		OpenHKLM;
433	CASE(WINREG_OPNUM_OpenHKPD)
434		struct winreg_OpenHKPD		OpenHKPD;
435	CASE(WINREG_OPNUM_OpenHKUsers)
436		struct winreg_OpenHKUsers	OpenHKUsers;
437	CASE(WINREG_OPNUM_Close)
438		struct winreg_Close		Close;
439	CASE(WINREG_OPNUM_CreateKey)
440		struct winreg_CreateKey		CreateKey;
441	CASE(WINREG_OPNUM_DeleteKey)
442		struct winreg_DeleteKey		DeleteKey;
443	CASE(WINREG_OPNUM_DeleteValue)
444		struct winreg_DeleteValue	DeleteValue;
445	CASE(WINREG_OPNUM_EnumKey)
446		struct winreg_EnumKey		EnumKey;
447	CASE(WINREG_OPNUM_EnumValue)
448		struct winreg_EnumValue		EnumValue;
449	CASE(WINREG_OPNUM_FlushKey)
450		struct winreg_FlushKey		FlushKey;
451	CASE(WINREG_OPNUM_GetKeySec)
452		struct winreg_GetKeySec		GetKeySec;
453	CASE(WINREG_OPNUM_NotifyChange)
454		struct winreg_NotifyChange	NotifyChange;
455	CASE(WINREG_OPNUM_OpenKey)
456		struct winreg_OpenKey		OpenKey;
457	CASE(WINREG_OPNUM_QueryKey)
458		struct winreg_QueryKey		QueryKey;
459	CASE(WINREG_OPNUM_QueryValue)
460		struct winreg_QueryValue	QueryValue;
461	CASE(WINREG_OPNUM_SetKeySec)
462		struct winreg_SetKeySec		SetKeySec;
463	CASE(WINREG_OPNUM_CreateValue)
464		struct winreg_CreateValue	CreateValue;
465	CASE(WINREG_OPNUM_Shutdown)
466		struct winreg_Shutdown		Shutdown;
467	CASE(WINREG_OPNUM_AbortShutdown)
468		struct winreg_AbortShutdown	AbortShutdown;
469	CASE(WINREG_OPNUM_GetVersion)
470		struct winreg_GetVersion	GetVersion;
471	CASE(WINREG_OPNUM_OpenHKCC)
472		struct winreg_OpenHKCC		OpenHKCC;
473	CASE(WINREG_OPNUM_OpenHKDD)
474		struct winreg_OpenHKDD		OpenHKDD;
475	CASE(WINREG_OPNUM_OpenHKPT)
476		struct winreg_OpenHKPT		OpenHKPT;
477	CASE(WINREG_OPNUM_OpenHKPN)
478		struct winreg_OpenHKPN		OpenHKPN;
479};
480typedef union winreg_interface	winreg_interface_t;
481EXTERNTYPEINFO(winreg_interface)
482
483#endif /* _MLSVC_WINREG_NDL_ */
484