xref: /titanic_44/usr/src/uts/common/smbsrv/ndl/winreg.ndl (revision feef89cf5f5fee792c1a396bb0e48070935cf65a)
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
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	struct winreg_value	*sd_buf;
155	DWORD			sd_len;
156	DWORD			sd_size;
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	OUT REFERENCE	struct winreg_secdesc	*sd;
285	OUT		DWORD			status;
286};
287
288OPERATION(WINREG_OPNUM_NotifyChange)
289struct winreg_NotifyChange {
290	IN  winreg_handle_t	handle;
291	IN  DWORD		watch_subtree;
292	IN  DWORD		notify_filter;
293	OUT DWORD		status;
294};
295
296OPERATION(WINREG_OPNUM_OpenKey)
297struct winreg_OpenKey {
298	IN  winreg_handle_t	handle;
299	IN  winreg_string_t	name;
300	IN  DWORD		options;
301	IN  DWORD		access_mask;
302	OUT winreg_handle_t	result_handle;
303	OUT DWORD		status;
304};
305
306
307OPERATION(WINREG_OPNUM_QueryKey)
308struct winreg_QueryKey {
309	IN  winreg_handle_t	handle;
310	INOUT winreg_string_t	name;
311	OUT DWORD 		num_subkeys;
312	OUT DWORD 		max_subkey_len;
313	OUT DWORD 		max_class_len;
314	OUT DWORD 		num_values;
315	OUT DWORD 		max_value_namelen;
316	OUT DWORD 		max_value_len;
317	OUT DWORD 		secdesc_size;
318	OUT file_time_t 	last_write_time;
319	OUT DWORD		status;
320};
321
322
323/*
324 * Some of the OUT parameters are also supplied
325 * as IN parameters but we can ignore them.
326 */
327OPERATION(WINREG_OPNUM_QueryValue)
328struct winreg_QueryValue {
329	IN  winreg_handle_t	handle;
330	IN  winreg_string_t	value_name;
331	/* IN	ignore the remaining input data */
332
333	OUT DWORD		*type;
334	OUT struct winreg_value	*value;
335	OUT DWORD		*value_size;
336	OUT DWORD		*value_size_total;
337	OUT DWORD		status;
338};
339
340
341OPERATION(WINREG_OPNUM_SetKeySec)
342struct winreg_SetKeySec {
343	IN winreg_handle_t	handle;
344	IN DWORD		access_mask;
345	IN DWORD		sd;
346	OUT DWORD		status;
347};
348
349OPERATION(WINREG_OPNUM_CreateValue)
350struct winreg_CreateValue {
351	IN winreg_handle_t	handle;
352	IN winreg_string_t	name;
353	IN winreg_string_t	class;
354	IN DWORD		options;
355	/* IN	ignore the remaining input data */
356
357	OUT DWORD		status;
358};
359
360
361/*
362 * The real structure of shutdown passes some strings, a timeout
363 * and reboot/shutdown flags but this allows us to accept the call,
364 * without anything appearing in the log, and return access denied.
365 */
366OPERATION(WINREG_OPNUM_Shutdown)
367struct winreg_Shutdown {
368	IN DWORD		ignored;
369	OUT DWORD		status;
370};
371
372OPERATION(WINREG_OPNUM_AbortShutdown)
373struct winreg_AbortShutdown {
374	IN DWORD		ignored;
375	OUT DWORD		status;
376};
377
378OPERATION(WINREG_OPNUM_GetVersion)
379struct winreg_GetVersion {
380	IN winreg_handle_t	handle;
381	OUT DWORD		version;
382	OUT DWORD		status;
383};
384
385OPERATION(WINREG_OPNUM_OpenHKCC)
386struct winreg_OpenHKCC {
387	IN  DWORD		*server;
388	IN  DWORD		access_mask;
389	OUT winreg_handle_t	handle;
390	OUT DWORD		status;
391};
392
393OPERATION(WINREG_OPNUM_OpenHKDD)
394struct winreg_OpenHKDD {
395	IN  DWORD		*server;
396	IN  DWORD		access_mask;
397	OUT winreg_handle_t	handle;
398	OUT DWORD		status;
399};
400
401OPERATION(WINREG_OPNUM_OpenHKPT)
402struct winreg_OpenHKPT {
403	IN  DWORD		*server;
404	IN  DWORD		access_mask;
405	OUT winreg_handle_t	handle;
406	OUT DWORD		status;
407};
408
409OPERATION(WINREG_OPNUM_OpenHKPN)
410struct winreg_OpenHKPN {
411	IN  DWORD		*server;
412	IN  DWORD		access_mask;
413	OUT winreg_handle_t	handle;
414	OUT DWORD		status;
415};
416
417/*
418 * The WINREG interface.
419 */
420INTERFACE(0)
421union winreg_interface {
422	CASE(WINREG_OPNUM_OpenHKCR)
423		struct winreg_OpenHKCR		OpenHKCR;
424	CASE(WINREG_OPNUM_OpenHKCU)
425		struct winreg_OpenHKCU		OpenHKCU;
426	CASE(WINREG_OPNUM_OpenHKLM)
427		struct winreg_OpenHKLM		OpenHKLM;
428	CASE(WINREG_OPNUM_OpenHKPD)
429		struct winreg_OpenHKPD		OpenHKPD;
430	CASE(WINREG_OPNUM_OpenHKUsers)
431		struct winreg_OpenHKUsers	OpenHKUsers;
432	CASE(WINREG_OPNUM_Close)
433		struct winreg_Close		Close;
434	CASE(WINREG_OPNUM_CreateKey)
435		struct winreg_CreateKey		CreateKey;
436	CASE(WINREG_OPNUM_DeleteKey)
437		struct winreg_DeleteKey		DeleteKey;
438	CASE(WINREG_OPNUM_DeleteValue)
439		struct winreg_DeleteValue	DeleteValue;
440	CASE(WINREG_OPNUM_EnumKey)
441		struct winreg_EnumKey		EnumKey;
442	CASE(WINREG_OPNUM_EnumValue)
443		struct winreg_EnumValue		EnumValue;
444	CASE(WINREG_OPNUM_FlushKey)
445		struct winreg_FlushKey		FlushKey;
446	CASE(WINREG_OPNUM_GetKeySec)
447		struct winreg_GetKeySec		GetKeySec;
448	CASE(WINREG_OPNUM_NotifyChange)
449		struct winreg_NotifyChange	NotifyChange;
450	CASE(WINREG_OPNUM_OpenKey)
451		struct winreg_OpenKey		OpenKey;
452	CASE(WINREG_OPNUM_QueryKey)
453		struct winreg_QueryKey		QueryKey;
454	CASE(WINREG_OPNUM_QueryValue)
455		struct winreg_QueryValue	QueryValue;
456	CASE(WINREG_OPNUM_SetKeySec)
457		struct winreg_SetKeySec		SetKeySec;
458	CASE(WINREG_OPNUM_CreateValue)
459		struct winreg_CreateValue	CreateValue;
460	CASE(WINREG_OPNUM_Shutdown)
461		struct winreg_Shutdown		Shutdown;
462	CASE(WINREG_OPNUM_AbortShutdown)
463		struct winreg_AbortShutdown	AbortShutdown;
464	CASE(WINREG_OPNUM_GetVersion)
465		struct winreg_GetVersion	GetVersion;
466	CASE(WINREG_OPNUM_OpenHKCC)
467		struct winreg_OpenHKCC		OpenHKCC;
468	CASE(WINREG_OPNUM_OpenHKDD)
469		struct winreg_OpenHKDD		OpenHKDD;
470	CASE(WINREG_OPNUM_OpenHKPT)
471		struct winreg_OpenHKPT		OpenHKPT;
472	CASE(WINREG_OPNUM_OpenHKPN)
473		struct winreg_OpenHKPN		OpenHKPN;
474};
475typedef union winreg_interface	winreg_interface_t;
476EXTERNTYPEINFO(winreg_interface)
477
478#endif /* _MLSVC_WINREG_NDL_ */
479