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