xref: /illumos-gate/usr/src/uts/common/smbsrv/ndl/winreg.ndl (revision bea83d026ee1bd1b2a2419e1d0232f107a5d7d9b)
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
35#include "ndrtypes.ndl"
36
37#define WINREG_OPNUM_OpenHKCR		0x00
38#define WINREG_OPNUM_OpenHKCU		0x01
39#define WINREG_OPNUM_OpenHKLM		0x02
40#define WINREG_OPNUM_OpenHKPD		0x03
41#define WINREG_OPNUM_OpenHKUsers	0x04
42#define WINREG_OPNUM_Close		0x05
43#define WINREG_OPNUM_CreateKey		0x06
44#define WINREG_OPNUM_DeleteKey		0x07
45#define WINREG_OPNUM_DeleteValue	0x08
46#define WINREG_OPNUM_EnumKey		0x09
47#define WINREG_OPNUM_EnumValue		0x0a
48#define WINREG_OPNUM_FlushKey		0x0b
49#define WINREG_OPNUM_GetKeySec		0x0c
50#define WINREG_OPNUM_LoadKey		0x0d
51#define WINREG_OPNUM_NotifyChange	0x0e
52#define WINREG_OPNUM_OpenKey		0x0f
53#define WINREG_OPNUM_QueryKey		0x10
54#define WINREG_OPNUM_QueryValue		0x11
55#define WINREG_OPNUM_ReplaceKey		0x12
56#define WINREG_OPNUM_RestoreKey		0x13
57#define WINREG_OPNUM_SaveKey		0x14
58#define WINREG_OPNUM_SetKeySec		0x15
59#define WINREG_OPNUM_CreateValue	0x16
60#define WINREG_OPNUM_UnloadKey		0x17
61#define WINREG_OPNUM_Shutdown		0x18
62#define WINREG_OPNUM_AbortShutdown	0x19
63#define WINREG_OPNUM_GetVersion		0x1a
64
65struct winreg_handle {
66	DWORD hand1;
67	DWORD hand2;
68	WORD  hand3[2];
69	BYTE  hand4[8];
70};
71typedef struct winreg_handle winreg_handle_t;
72
73struct winreg_string_desc {
74	WORD	length;
75	WORD	allosize;
76	LPTSTR	str;
77};
78typedef struct winreg_string_desc winreg_string_t;
79
80/*
81 * Fake Varying/Conformant with a funny conformant.
82 */
83struct winreg_value {
84	DWORD	vc_first_is;	/* 0 */
85	DWORD	vc_length_is;
86  SIZE_IS(vc_length_is)
87	BYTE	value[ANY_SIZE_ARRAY];
88};
89
90struct file_time {
91	DWORD	low;
92	DWORD	high;
93};
94typedef struct file_time file_time_t;
95
96OPERATION(WINREG_OPNUM_OpenHKCR)
97struct winreg_OpenHKCR {
98	IN  DWORD		*server;
99	IN  DWORD		access_mask;
100	OUT winreg_handle_t	handle;
101	OUT DWORD		status;
102};
103
104OPERATION(WINREG_OPNUM_OpenHKCU)
105struct winreg_OpenHKCU {
106	IN  DWORD		*server;
107	IN  DWORD		access_mask;
108	OUT winreg_handle_t	handle;
109	OUT DWORD		status;
110};
111
112OPERATION(WINREG_OPNUM_OpenHKLM)
113struct winreg_OpenHKLM {
114	IN  DWORD		*server;
115	IN  DWORD		access_mask;
116	OUT winreg_handle_t	handle;
117	OUT DWORD		status;
118};
119
120OPERATION(WINREG_OPNUM_OpenHKPD)
121struct winreg_OpenHKPD {
122	IN  DWORD		*server;
123	IN  DWORD		access_mask;
124	OUT winreg_handle_t	handle;
125	OUT DWORD		status;
126};
127
128OPERATION(WINREG_OPNUM_OpenHKUsers)
129struct winreg_OpenHKUsers {
130	IN  DWORD		*server;
131	IN  DWORD		access_mask;
132	OUT winreg_handle_t	handle;
133	OUT DWORD		status;
134};
135
136
137OPERATION(WINREG_OPNUM_Close)
138struct winreg_Close {
139	IN  winreg_handle_t	handle;
140	OUT winreg_handle_t	result_handle;
141	OUT DWORD		status;
142};
143
144
145OPERATION(WINREG_OPNUM_CreateKey)
146struct winreg_CreateKey {
147	IN winreg_handle_t	handle;
148	IN winreg_string_t	subkey;
149	/* IN	ignore the remaining input data */
150
151	OUT DWORD		status;
152};
153
154
155OPERATION(WINREG_OPNUM_DeleteKey)
156struct winreg_DeleteKey {
157	IN winreg_handle_t	handle;
158	IN winreg_string_t	subkey;
159	/* IN	ignore the remaining input data */
160
161	OUT DWORD		status;
162};
163
164
165OPERATION(WINREG_OPNUM_DeleteValue)
166struct winreg_DeleteValue {
167	IN winreg_handle_t	handle;
168	IN winreg_string_t	name;
169	/* IN	ignore the remaining input data */
170
171	OUT DWORD		status;
172};
173
174
175/*
176 * Some of the OUT parameters are also supplied
177 * as IN parameters but we can ignore them.
178 */
179OPERATION(WINREG_OPNUM_EnumValue)
180struct winreg_EnumValue {
181	IN winreg_handle_t	handle;
182	IN DWORD		index;
183	/* IN	ignore the remaining input data */
184
185	OUT winreg_string_t	name;
186	OUT DWORD		*type;
187	OUT struct winreg_value *value;
188	OUT DWORD		*value_size;
189	OUT DWORD		*value_size_total;
190	OUT DWORD		status;
191};
192
193OPERATION(WINREG_OPNUM_FlushKey)
194struct winreg_FlushKey {
195	IN winreg_handle_t	handle;
196	OUT DWORD		status;
197};
198
199OPERATION(WINREG_OPNUM_GetKeySec)
200struct winreg_GetKeySec {
201	IN winreg_handle_t	handle;
202	IN DWORD		sec_info;
203	OUT DWORD		*sd;
204	OUT DWORD		status;
205};
206
207OPERATION(WINREG_OPNUM_NotifyChange)
208struct winreg_NotifyChange {
209	IN  winreg_handle_t	handle;
210	IN  DWORD		watch_subtree;
211	IN  DWORD		notify_filter;
212	OUT DWORD		status;
213};
214
215OPERATION(WINREG_OPNUM_OpenKey)
216struct winreg_OpenKey {
217	IN  winreg_handle_t	handle;
218	IN  winreg_string_t	name;
219	IN  DWORD		unknown;
220	IN  DWORD		access_mask;
221	OUT winreg_handle_t	result_handle;
222	OUT DWORD		status;
223};
224
225
226/*
227 * 000000A0                    00 00 00 00 C1 F9 C0 86 18 B1       ..........
228 * 000000B0  D5 11 99 C8 00 C0 F0 1F 42 26 00 00 10 04 CC ED ........B&......
229 * 000000C0  12 00 08 02 00 00 00 00 00 00 00 00 00 00       ..............
230	DWORD unknown_0x04100000;
231	DWORD unkown_ptr;
232	DWORD unknown_0x00000208;
233	DWORD unknown2;
234	DWORD unknown3;
235 */
236
237OPERATION(WINREG_OPNUM_QueryKey)
238struct winreg_QueryKey {
239	IN  winreg_handle_t	handle;
240	/*
241	 * Ignore the remaining input data
242	 * (2 * DWORD, possibly winreg_string_t).
243	 */
244
245	OUT winreg_string_t	name;
246	OUT DWORD		unknown;
247	OUT DWORD 		sub_keys;
248	OUT DWORD 		max_subkey_len;
249	OUT DWORD 		max_class_len;
250	OUT DWORD 		values;
251	OUT DWORD 		max_value_namelen;
252	OUT DWORD 		max_value_len;
253	OUT DWORD 		security_desc;
254	OUT file_time_t 	last_write_time;
255	OUT DWORD		status;
256};
257
258
259/*
260 * Some of the OUT parameters are also supplied
261 * as IN parameters but we can ignore them.
262 */
263OPERATION(WINREG_OPNUM_QueryValue)
264struct winreg_QueryValue {
265	IN  winreg_handle_t	handle;
266	IN  winreg_string_t	value_name;
267	/* IN	ignore the remaining input data */
268
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
276
277OPERATION(WINREG_OPNUM_SetKeySec)
278struct winreg_SetKeySec {
279	IN winreg_handle_t	handle;
280	IN DWORD		access_mask;
281	IN DWORD		sd;
282	OUT DWORD		status;
283};
284
285OPERATION(WINREG_OPNUM_CreateValue)
286struct winreg_CreateValue {
287	IN winreg_handle_t	handle;
288	IN winreg_string_t	name;
289	/* IN	ignore the remaining input data */
290
291	OUT DWORD		status;
292};
293
294
295/*
296 * The real structure of shutdown passes some strings, a timeout
297 * and reboot/shutdown flags but this allows us to accept the call,
298 * without anything appearing in the log, and return access denied.
299 */
300OPERATION(WINREG_OPNUM_Shutdown)
301struct winreg_Shutdown {
302	IN DWORD		ignored;
303	OUT DWORD		status;
304};
305
306
307OPERATION(WINREG_OPNUM_GetVersion)
308struct winreg_GetVersion {
309	IN winreg_handle_t	handle;
310	OUT DWORD		version;
311	OUT DWORD		status;
312};
313
314
315/*
316 * The WINREG interface.
317 */
318INTERFACE(0)
319union winreg_interface {
320	CASE(WINREG_OPNUM_OpenHKCR)
321		struct winreg_OpenHKCR		OpenHKCR;
322	CASE(WINREG_OPNUM_OpenHKCU)
323		struct winreg_OpenHKCU		OpenHKCU;
324	CASE(WINREG_OPNUM_OpenHKLM)
325		struct winreg_OpenHKLM		OpenHKLM;
326	CASE(WINREG_OPNUM_OpenHKPD)
327		struct winreg_OpenHKPD		OpenHKPD;
328	CASE(WINREG_OPNUM_OpenHKUsers)
329		struct winreg_OpenHKUsers	OpenHKUsers;
330	CASE(WINREG_OPNUM_Close)
331		struct winreg_Close		Close;
332	CASE(WINREG_OPNUM_CreateKey)
333		struct winreg_CreateKey		CreateKey;
334	CASE(WINREG_OPNUM_DeleteKey)
335		struct winreg_DeleteKey		DeleteKey;
336	CASE(WINREG_OPNUM_DeleteValue)
337		struct winreg_DeleteValue	DeleteValue;
338	CASE(WINREG_OPNUM_FlushKey)
339		struct winreg_FlushKey		FlushKey;
340	CASE(WINREG_OPNUM_GetKeySec)
341		struct winreg_GetKeySec		GetKeySec;
342	CASE(WINREG_OPNUM_NotifyChange)
343		struct winreg_NotifyChange	NotifyChange;
344	CASE(WINREG_OPNUM_OpenKey)
345		struct winreg_OpenKey		OpenKey;
346	CASE(WINREG_OPNUM_QueryKey)
347		struct winreg_QueryKey		QueryKey;
348	CASE(WINREG_OPNUM_QueryValue)
349		struct winreg_QueryValue	QueryValue;
350	CASE(WINREG_OPNUM_SetKeySec)
351		struct winreg_SetKeySec		SetKeySec;
352	CASE(WINREG_OPNUM_CreateValue)
353		struct winreg_CreateValue	CreateValue;
354	CASE(WINREG_OPNUM_Shutdown)
355		struct winreg_Shutdown		Shutdown;
356	CASE(WINREG_OPNUM_GetVersion)
357		struct winreg_GetVersion	GetVersion;
358};
359typedef union winreg_interface	winreg_interface_t;
360EXTERNTYPEINFO(winreg_interface)
361
362#endif /* _MLSVC_WINREG_NDL_ */
363