1/*
2  winreg interface definition
3*/
4
5/*import "lsa.idl", "security.idl",*/
6import "misc/misc.idl";
7
8[
9  uuid("338cd001-2244-31f1-aaaa-900038001003"),
10  version(1.0),
11  endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"),
12  pointer_default(unique),
13  helpstring("Remote Registry Service")
14] interface winreg
15{
16	typedef bitmap security_secinfo security_secinfo;
17
18	/*
19	 * Access Bits for registry ACLS
20	 */
21
22	typedef [bitmap32bit] bitmap {
23		KEY_QUERY_VALUE 		= 0x00001,
24		KEY_SET_VALUE 			= 0x00002,
25		KEY_CREATE_SUB_KEY 		= 0x00004,
26		KEY_ENUMERATE_SUB_KEYS		= 0x00008,
27		KEY_NOTIFY			= 0x00010,
28		KEY_CREATE_LINK 		= 0x00020,
29		KEY_WOW64_64KEY 		= 0x00100,
30		KEY_WOW64_32KEY 		= 0x00200
31	} winreg_AccessMask;
32
33	const int REG_KEY_READ = (	STANDARD_RIGHTS_READ_ACCESS	|
34					KEY_QUERY_VALUE			|
35					KEY_ENUMERATE_SUB_KEYS 		|
36					KEY_NOTIFY);
37
38	const int REG_KEY_EXECUTE = REG_KEY_READ;
39
40	const int REG_KEY_WRITE = (	STANDARD_RIGHTS_WRITE_ACCESS	|
41					KEY_SET_VALUE	 		|
42					KEY_CREATE_SUB_KEY);
43
44	const int REG_KEY_ALL = (	STANDARD_RIGHTS_REQUIRED_ACCESS |
45					REG_KEY_READ 			|
46					REG_KEY_WRITE 			|
47					KEY_CREATE_LINK);
48
49	typedef [public] struct {
50		[value(strlen_m_term(name)*2)] uint16 name_len;
51		[value(strlen_m_term(name)*2)] uint16 name_size;
52		[string,charset(UTF16)] uint16 *name;
53	} winreg_String;
54
55	/******************/
56	/* Function: 0x00 */
57	WERROR winreg_OpenHKCR(
58		[in,unique] uint16 *system_name,
59		[in]      winreg_AccessMask access_mask,
60		[out,ref] policy_handle *handle
61	);
62
63	/******************/
64	/* Function: 0x01 */
65	WERROR winreg_OpenHKCU(
66	        [in,unique] uint16 *system_name,
67		[in]      winreg_AccessMask access_mask,
68		[out,ref] policy_handle *handle
69	);
70
71	/******************/
72	/* Function: 0x02 */
73	[public] WERROR winreg_OpenHKLM(
74		[in,unique] uint16 *system_name,
75		[in]      winreg_AccessMask access_mask,
76		[out,ref] policy_handle *handle
77	);
78
79	/******************/
80	/* Function: 0x03 */
81	WERROR winreg_OpenHKPD(
82		[in,unique] uint16 *system_name,
83		[in]      winreg_AccessMask access_mask,
84		[out,ref] policy_handle *handle
85	);
86
87	/******************/
88	/* Function: 0x04 */
89	WERROR winreg_OpenHKU(
90		[in,unique] uint16 *system_name,
91		[in]      winreg_AccessMask access_mask,
92		[out,ref] policy_handle *handle
93	);
94
95	/******************/
96	/* Function: 0x05 */
97	[public] WERROR winreg_CloseKey(
98		[in,out,ref] policy_handle *handle
99	);
100
101	/******************/
102	/* Function: 0x06 */
103
104	typedef struct {
105		[size_is(size),length_is(len)] uint8 *data;
106		uint32 size;
107		uint32 len;
108	} KeySecurityData;
109
110	typedef struct {
111		uint32 length;
112		KeySecurityData sd;
113		boolean8  inherit;
114	} winreg_SecBuf;
115
116	const int REG_OPTION_NON_VOLATILE = 0x00000000;
117
118	typedef [bitmap32bit] bitmap {
119		REG_OPTION_VOLATILE		= 0x00000001,
120		REG_OPTION_CREATE_LINK		= 0x00000002,
121		REG_OPTION_BACKUP_RESTORE	= 0x00000004,
122		REG_OPTION_OPEN_LINK		= 0x00000008
123	} winreg_KeyOptions;
124
125	typedef [v1_enum] enum {
126		REG_ACTION_NONE         = 0, /* used by caller */
127		REG_CREATED_NEW_KEY     = 1,
128		REG_OPENED_EXISTING_KEY = 2
129	} winreg_CreateAction;
130
131	[public] WERROR winreg_CreateKey(
132		[in,ref] policy_handle *handle,
133		[in] winreg_String name,
134		[in] winreg_String keyclass,
135		[in] winreg_KeyOptions options,
136		[in] winreg_AccessMask access_mask,
137		[in,unique] winreg_SecBuf *secdesc,
138		[out,ref] policy_handle *new_handle,
139		[in,out,unique] winreg_CreateAction *action_taken
140	);
141
142	/******************/
143	/* Function: 0x07 */
144	[public] WERROR winreg_DeleteKey(
145		[in,ref] policy_handle *handle,
146		[in]	 winreg_String key
147	);
148
149	/******************/
150	/* Function: 0x08 */
151	WERROR winreg_DeleteValue(
152		[in,ref] policy_handle *handle,
153		[in]	 winreg_String value
154	);
155
156	typedef struct {
157		[value(strlen_m_term_null(name)*2)] uint16 length;
158		/* size cannot be auto-set by value() as it is the
159		   amount of space the server is allowed to use for this
160		   string in the reply, not its current size */
161		uint16 size;
162		[size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name;
163	} winreg_StringBuf;
164
165	/******************/
166	/* Function: 0x09 */
167	[public] WERROR winreg_EnumKey(
168		[in,ref]        policy_handle    *handle,
169		[in]            uint32           enum_index,
170		[in,out,ref]    winreg_StringBuf *name,
171		[in,out,unique] winreg_StringBuf *keyclass,
172		[in,out,unique] NTTIME           *last_changed_time
173	);
174
175	typedef struct {
176		[value(strlen_m_term(name)*2)] uint16 length;
177		/* size cannot be auto-set by value() as it is the
178		   amount of space the server is allowed to use for this
179		   string in the reply, not its current size */
180		uint16 size;
181		[size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name;
182	} winreg_ValNameBuf;
183
184	/******************/
185	/* Function: 0x0a */
186
187	[public] WERROR winreg_EnumValue(
188		[in,ref]        policy_handle *handle,
189		[in]            uint32 enum_index,
190		[in,out,ref]    winreg_ValNameBuf *name,
191		[in,out,unique] winreg_Type *type,
192		[in,out,unique,size_is(size ? *size : 0),length_is(length ? *length : 0),range(0,0x4000000)] uint8 *value,
193		[in,out,unique] uint32 *size,
194		[in,out,unique] uint32 *length
195	);
196
197	/******************/
198	/* Function: 0x0b */
199	[public] WERROR winreg_FlushKey(
200		[in,ref] policy_handle *handle
201	);
202
203	/******************/
204	/* Function: 0x0c */
205	[public] WERROR winreg_GetKeySecurity(
206		[in,ref] policy_handle *handle,
207		[in] security_secinfo sec_info,
208		[in,out,ref] KeySecurityData *sd
209	);
210
211	/******************/
212	/* Function: 0x0d */
213	WERROR winreg_LoadKey(
214		[in,ref] policy_handle *handle,
215		[in,unique] winreg_String *keyname,
216		[in,unique] winreg_String *filename
217	);
218
219	/******************/
220	/* Function: 0x0e */
221	typedef [public,bitmap32bit] bitmap {
222		REG_NOTIFY_CHANGE_NAME		= 0x00000001,
223		REG_NOTIFY_CHANGE_ATTRIBUTES	= 0x00000002,
224		REG_NOTIFY_CHANGE_LAST_SET	= 0x00000004,
225		REG_NOTIFY_CHANGE_SECURITY	= 0x00000008
226	} winreg_NotifyChangeType;
227
228	[public] WERROR winreg_NotifyChangeKeyValue(
229		[in,ref] policy_handle *handle,
230		[in] boolean8 watch_subtree,
231		[in] winreg_NotifyChangeType notify_filter,
232		[in] uint32 unknown,
233		[in] winreg_String string1,
234		[in] winreg_String string2,
235		[in] uint32 unknown2
236	);
237
238	/******************/
239	/* Function: 0x0f */
240	[public] WERROR winreg_OpenKey(
241		[in,ref] policy_handle *parent_handle,
242		[in] winreg_String keyname,
243		[in] winreg_KeyOptions options,
244		[in] winreg_AccessMask access_mask,
245		[out,ref] policy_handle *handle
246	);
247
248	/******************/
249	/* Function: 0x10 */
250	[public] WERROR winreg_QueryInfoKey(
251		[in,ref] policy_handle *handle,
252		[in,out,ref] winreg_String *classname,
253		[out,ref] uint32 *num_subkeys,
254		[out,ref] uint32 *max_subkeylen,
255		[out,ref] uint32 *max_classlen,
256		[out,ref] uint32 *num_values,
257		[out,ref] uint32 *max_valnamelen,
258		[out,ref] uint32 *max_valbufsize,
259		[out,ref] uint32 *secdescsize,
260		[out,ref] NTTIME *last_changed_time
261	);
262
263	/******************/
264	/* Function: 0x11 */
265	[public] WERROR winreg_QueryValue(
266		[in,ref] policy_handle *handle,
267		[in,ref] winreg_String *value_name,
268		[in,out,unique] winreg_Type *type,
269		[in,out,unique,size_is(data_size ? *data_size : 0),length_is(data_length ? *data_length : 0),range(0,0x4000000)] uint8 *data,
270		[in,out,unique] uint32 *data_size,
271		[in,out,unique] uint32 *data_length
272	);
273
274	/******************/
275	/* Function: 0x12 */
276	WERROR winreg_ReplaceKey(
277		[in,ref] policy_handle *handle,
278		[in,ref] winreg_String *subkey,
279		[in,ref] winreg_String *new_file,
280		[in,ref] winreg_String *old_file
281	);
282
283	/******************/
284	/* Function: 0x13 */
285
286	typedef [public,bitmap32bit] bitmap {
287		REG_WHOLE_HIVE_VOLATILE		= 0x00000001,
288		REG_REFRESH_HIVE 		= 0x00000002,
289		REG_NO_LAZY_FLUSH		= 0x00000004,
290		REG_FORCE_RESTORE		= 0x00000008
291	} winreg_RestoreKeyFlags;
292
293	WERROR winreg_RestoreKey(
294		[in,ref] policy_handle *handle,
295		[in,ref] winreg_String *filename,
296		[in]     winreg_RestoreKeyFlags flags
297	);
298
299	/******************/
300	/* Function: 0x14 */
301
302	typedef struct {
303		uint32 data_size;
304		KeySecurityData sec_data;
305		uint8 inherit;
306	} KeySecurityAttribute;
307
308	WERROR winreg_SaveKey(
309		[in,ref] policy_handle *handle,
310		[in,ref] winreg_String *filename,
311		[in,unique] KeySecurityAttribute *sec_attrib
312	);
313
314	/******************/
315	/* Function: 0x15 */
316	WERROR winreg_SetKeySecurity(
317		[in,ref] policy_handle *handle,
318		[in] security_secinfo sec_info,
319		[in,ref] KeySecurityData *sd
320	);
321
322	/******************/
323	/* Function: 0x16 */
324	WERROR winreg_SetValue(
325		[in,ref]           policy_handle *handle,
326		[in]               winreg_String name,
327		[in]               winreg_Type type,
328		[in,size_is(size),ref] uint8  *data,
329		[in]               uint32 size
330	);
331
332	/******************/
333	/* Function: 0x17 */
334	WERROR winreg_UnLoadKey(
335		[in,ref] policy_handle *handle,
336		[in,ref] winreg_String *subkey
337	);
338
339	/******************/
340	/* Function: 0x18 */
341	WERROR winreg_InitiateSystemShutdown(
342		[in,unique] uint16 *hostname,
343		/*
344		 * Note: lsa_String and winreg_String both result
345		 *       in WERR_INVALID_PARAM
346		 */
347		[in,unique] lsa_StringLarge *message,
348		[in]	uint32 timeout,
349		[in]	uint8 force_apps,
350		[in]	uint8 do_reboot
351	);
352
353	/******************/
354	/* Function: 0x19 */
355	WERROR winreg_AbortSystemShutdown(
356		[in,unique] uint16 *server
357	);
358
359	/******************/
360	/* Function: 0x1a */
361	[public] WERROR winreg_GetVersion(
362		[in,ref]     policy_handle *handle,
363		[out,ref]    uint32 *version
364	);
365
366	/******************/
367	/* Function: 0x1b */
368	WERROR winreg_OpenHKCC(
369		[in,unique] uint16 *system_name,
370		[in]      winreg_AccessMask access_mask,
371		[out,ref] policy_handle *handle
372	);
373
374	/******************/
375	/* Function: 0x1c */
376	WERROR winreg_OpenHKDD(
377		[in,unique] uint16 *system_name,
378		[in]      winreg_AccessMask access_mask,
379		[out,ref] policy_handle *handle
380	);
381
382	typedef struct {
383		winreg_ValNameBuf *ve_valuename;
384		uint32 ve_valuelen;
385		uint32 ve_valueptr;
386		winreg_Type ve_type;
387	} QueryMultipleValue;
388
389	/******************/
390	/* Function: 0x1d */
391	[public] WERROR winreg_QueryMultipleValues(
392		[in,ref] policy_handle *key_handle,
393		[in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in,
394		[out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out,
395		[in] uint32 num_values,
396		[in,out,unique,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer,
397		[in,out,ref] uint32 *buffer_size
398	);
399
400	/******************/
401	/* Function: 0x1e */
402	WERROR winreg_InitiateSystemShutdownEx(
403		[in,unique] uint16 *hostname,
404		/*
405		 * Note: lsa_String and winreg_String both result
406		 *       in WERR_INVALID_PARAM
407		 */
408		[in,unique] lsa_StringLarge *message,
409		[in] uint32 timeout,
410		[in] uint8 force_apps,
411		[in] uint8 do_reboot,
412		[in] uint32 reason
413	);
414
415	/******************/
416	/* Function: 0x1f */
417	WERROR winreg_SaveKeyEx(
418		[in,ref] policy_handle *handle,
419		[in,ref] winreg_String *filename,
420		[in,unique] KeySecurityAttribute *sec_attrib,
421		[in] uint32 flags
422	);
423
424	/******************/
425	/* Function: 0x20 */
426	WERROR winreg_OpenHKPT(
427		[in,unique] uint16 *system_name,
428		[in]      winreg_AccessMask access_mask,
429		[out,ref] policy_handle *handle
430	);
431
432	/******************/
433	/* Function: 0x21 */
434	WERROR winreg_OpenHKPN(
435		[in,unique] uint16 *system_name,
436		[in]      winreg_AccessMask access_mask,
437		[out,ref] policy_handle *handle
438	);
439
440	/******************/
441	/* Function: 0x22 */
442	[public] WERROR winreg_QueryMultipleValues2(
443		[in,ref] policy_handle *key_handle,
444		[in,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_in,
445		[out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values_out,
446		[in] uint32 num_values,
447		[in,out,unique,size_is(*offered),length_is(*offered)] uint8 *buffer,
448		[in,ref] uint32 *offered,
449		[out,ref] uint32 *needed
450	);
451
452	/******************/
453	/* Function: 0x23 */
454	WERROR winreg_DeleteKeyEx(
455		[in,ref] policy_handle *handle,
456		[in,ref] winreg_String *key,
457		[in] winreg_AccessMask access_mask,
458		[in] uint32 reserved
459	);
460}
461