summaryrefslogtreecommitdiff
path: root/librpc/idl/winreg.idl
blob: 349018a7b6dc264dc0bdc0b4e5170c2c0632ee90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
/*
  winreg interface definition
*/

import "lsa.idl", "security.idl", "misc.idl";

[ 
  uuid("338cd001-2244-31f1-aaaa-900038001003"),
  version(1.0),
  endpoint("ncacn_np:[\\pipe\\winreg]","ncacn_ip_tcp:","ncalrpc:"),
  pointer_default(unique),
  helpstring("Remote Registry Service")
] interface winreg
{
	typedef bitmap security_secinfo security_secinfo;

	/*
	 * Access Bits for registry ACLS
	 */

	typedef [bitmap32bit] bitmap {
		KEY_QUERY_VALUE 		= 0x00001,
		KEY_SET_VALUE 			= 0x00002,
		KEY_CREATE_SUB_KEY 		= 0x00004,
		KEY_ENUMERATE_SUB_KEYS		= 0x00008,
		KEY_NOTIFY			= 0x00010,
		KEY_CREATE_LINK 		= 0x00020,
		KEY_WOW64_64KEY 		= 0x00100,
		KEY_WOW64_32KEY 		= 0x00200
	} winreg_AccessMask;

	const int REG_KEY_READ = (	STANDARD_RIGHTS_READ_ACCESS	|
					KEY_QUERY_VALUE			|
					KEY_ENUMERATE_SUB_KEYS 		|
					KEY_NOTIFY);

	const int REG_KEY_EXECUTE = REG_KEY_READ;

	const int REG_KEY_WRITE = (	STANDARD_RIGHTS_WRITE_ACCESS	|
					KEY_SET_VALUE	 		|
					KEY_CREATE_SUB_KEY);

	const int REG_KEY_ALL = (	STANDARD_RIGHTS_REQUIRED_ACCESS |
					REG_KEY_READ 			|
					REG_KEY_WRITE 			|
					KEY_CREATE_LINK);

	typedef [public] struct {
		[value(strlen_m_term(name)*2)] uint16 name_len;
		[value(strlen_m_term(name)*2)] uint16 name_size;
		[string,charset(UTF16)] uint16 *name;
	} winreg_String;

	/******************/
	/* Function: 0x00 */
	WERROR winreg_OpenHKCR(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x01 */
	WERROR winreg_OpenHKCU(
	        [in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x02 */
	[public] WERROR winreg_OpenHKLM(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x03 */
	WERROR winreg_OpenHKPD(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x04 */
	WERROR winreg_OpenHKU(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x05 */
	[public] WERROR winreg_CloseKey(
		[in,out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x06 */

	typedef struct {
		[size_is(size),length_is(len)] uint8 *data;
		uint32 size;
		uint32 len;
	} KeySecurityData;

	typedef struct {
		uint32 length;
		KeySecurityData sd;
		boolean8  inherit;
	} winreg_SecBuf;

	typedef [bitmap32bit] bitmap {
		REG_OPTION_NON_VOLATILE		= 0x00000000,
		REG_OPTION_VOLATILE		= 0x00000001,
		REG_OPTION_CREATE_LINK		= 0x00000002,
		REG_OPTION_BACKUP_RESTORE	= 0x00000004,
		REG_OPTION_OPEN_LINK		= 0x00000008
	} winreg_KeyOptions;

	typedef [v1_enum] enum {
		REG_ACTION_NONE         = 0, /* used by caller */
		REG_CREATED_NEW_KEY     = 1,
		REG_OPENED_EXISTING_KEY = 2
	} winreg_CreateAction;

	[public] WERROR winreg_CreateKey(
		[in,ref] policy_handle *handle,
		[in] winreg_String name,
		[in] winreg_String keyclass,
		[in] winreg_KeyOptions options,
		[in] winreg_AccessMask access_mask,
		[in,unique] winreg_SecBuf *secdesc,
		[out,ref] policy_handle *new_handle,
		[in,out,unique] winreg_CreateAction *action_taken
	);

	/******************/
	/* Function: 0x07 */
	[public] WERROR winreg_DeleteKey(
		[in,ref] policy_handle *handle,
		[in]	 winreg_String key
	);

	/******************/
	/* Function: 0x08 */
	WERROR winreg_DeleteValue(
		[in,ref] policy_handle *handle,
		[in]	 winreg_String value
	);

	typedef struct {
		[value(strlen_m_term_null(name)*2)] uint16 length;
		/* size cannot be auto-set by value() as it is the
		   amount of space the server is allowed to use for this
		   string in the reply, not its current size */
		uint16 size;
		[size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name;
	} winreg_StringBuf;

	/******************/
	/* Function: 0x09 */
	[public] WERROR winreg_EnumKey(
		[in,ref]        policy_handle    *handle,
		[in]            uint32           enum_index,
		[in,out,ref]    winreg_StringBuf *name,
		[in,out,unique] winreg_StringBuf *keyclass,
		[in,out,unique] NTTIME           *last_changed_time
	);

	typedef struct {
		[value(strlen_m_term(name)*2)] uint16 length;
		/* size cannot be auto-set by value() as it is the
		   amount of space the server is allowed to use for this
		   string in the reply, not its current size */
		uint16 size;
		[size_is(size/2),length_is(length/2),charset(UTF16)] uint16 *name;
	} winreg_ValNameBuf;

	/******************/
	/* Function: 0x0a */

	[public] WERROR winreg_EnumValue(
		[in,ref]        policy_handle *handle,
		[in]            uint32 enum_index,
		[in,out,ref]    winreg_ValNameBuf *name,
		[in,out,unique] winreg_Type *type,
		[in,out,unique,size_is(*size),length_is(*length)] uint8 *value,
		[in,out,unique] uint32 *size,
		[in,out,unique] uint32 *length
	);

	/******************/
	/* Function: 0x0b */
	[public] WERROR winreg_FlushKey(
		[in,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x0c */
	[public] WERROR winreg_GetKeySecurity(
		[in,ref] policy_handle *handle,
		[in] security_secinfo sec_info,
		[in,out,ref] KeySecurityData *sd
	);

	/******************/
	/* Function: 0x0d */
	WERROR winreg_LoadKey(
		[in,ref] policy_handle *handle,
		[in,unique] winreg_String *keyname,
		[in,unique] winreg_String *filename
	);

	/******************/
	/* Function: 0x0e */
	typedef [public,bitmap32bit] bitmap {
		REG_NOTIFY_CHANGE_NAME		= 0x00000001,
		REG_NOTIFY_CHANGE_ATTRIBUTES	= 0x00000002,
		REG_NOTIFY_CHANGE_LAST_SET	= 0x00000004,
		REG_NOTIFY_CHANGE_SECURITY	= 0x00000008
	} winreg_NotifyChangeType;

	[public] WERROR winreg_NotifyChangeKeyValue(
		[in,ref] policy_handle *handle,
		[in] boolean8 watch_subtree,
		[in] winreg_NotifyChangeType notify_filter,
		[in] uint32 unknown,
		[in] winreg_String string1,
		[in] winreg_String string2,
		[in] uint32 unknown2
	);

	/******************/
	/* Function: 0x0f */
	[public] WERROR winreg_OpenKey(
		[in,ref] policy_handle *parent_handle,
		[in] winreg_String keyname,
		[in] winreg_KeyOptions options,
		[in] winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x10 */
	[public] WERROR winreg_QueryInfoKey(
		[in,ref] policy_handle *handle,
		[in,out,ref] winreg_String *classname,
		[out,ref] uint32 *num_subkeys,
		[out,ref] uint32 *max_subkeylen,
		[out,ref] uint32 *max_classlen,
		[out,ref] uint32 *num_values,
		[out,ref] uint32 *max_valnamelen,
		[out,ref] uint32 *max_valbufsize,
		[out,ref] uint32 *secdescsize,
		[out,ref] NTTIME *last_changed_time
	);

	/******************/
	/* Function: 0x11 */
	[public] WERROR winreg_QueryValue(
		[in,ref] policy_handle *handle,
		[in,ref] winreg_String *value_name,
		[in,out,unique] winreg_Type *type,
		[in,out,unique,size_is(data_size ? *data_size : 0),length_is(data_length ? *data_length : 0),range(0,0x4000000)] uint8 *data,
		[in,out,unique] uint32 *data_size,
		[in,out,unique] uint32 *data_length
	);

	/******************/
	/* Function: 0x12 */
	WERROR winreg_ReplaceKey(
		[in,ref] policy_handle *handle,
		[in,ref] winreg_String *subkey,
		[in,ref] winreg_String *new_file,
		[in,ref] winreg_String *old_file
	);

	/******************/
	/* Function: 0x13 */
	WERROR winreg_RestoreKey(
		[in,ref] policy_handle *handle,
		[in,ref] winreg_String *filename,
		[in]     uint32 flags 
	);

	/******************/
	/* Function: 0x14 */

	typedef struct {
		uint32 data_size;
		KeySecurityData sec_data;
		uint8 inherit;
	} KeySecurityAttribute;

	WERROR winreg_SaveKey(
		[in,ref] policy_handle *handle,
		[in,ref] winreg_String *filename,
		[in,unique] KeySecurityAttribute *sec_attrib
	);

	/******************/
	/* Function: 0x15 */
	WERROR winreg_SetKeySecurity(
		[in,ref] policy_handle *handle,
		[in] security_secinfo sec_info,
		[in,ref] KeySecurityData *sd
	);

	/******************/
	/* Function: 0x16 */
	WERROR winreg_SetValue(
		[in,ref]           policy_handle *handle,
		[in]               winreg_String name,
		[in]               winreg_Type type,
		[in,size_is(size),ref] uint8  *data,
		[in]               uint32 size
	);

	/******************/
	/* Function: 0x17 */
	WERROR winreg_UnLoadKey(
		[in,ref] policy_handle *handle,
		[in,ref] winreg_String *subkey
	);

	/******************/
	/* Function: 0x18 */
	WERROR winreg_InitiateSystemShutdown(
		[in,unique] uint16 *hostname,
		/*
		 * Note: lsa_String and winreg_String both result
		 *       in WERR_INVALID_PARAM
		 */
		[in,unique] lsa_StringLarge *message,
		[in]	uint32 timeout,
		[in]	uint8 force_apps,
		[in]	uint8 do_reboot
	);

	/******************/
	/* Function: 0x19 */
	WERROR winreg_AbortSystemShutdown(
		[in,unique] uint16 *server
	);

	/******************/
	/* Function: 0x1a */
	[public] WERROR winreg_GetVersion(
		[in,ref]     policy_handle *handle,
		[out,ref]    uint32 *version
	);

	/******************/
	/* Function: 0x1b */
	WERROR winreg_OpenHKCC(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x1c */
	WERROR winreg_OpenHKDD(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	typedef struct {
		winreg_String *name;
		winreg_Type type;
		uint32 offset;
		uint32 length;
	} QueryMultipleValue;
	
	/******************/
	/* Function: 0x1d */
	[public] WERROR winreg_QueryMultipleValues(
		[in,ref] policy_handle *key_handle, 
		[in,out,ref,size_is(num_values),length_is(num_values)] QueryMultipleValue *values,
		[in] uint32 num_values,
		[in,out,unique,size_is(*buffer_size),length_is(*buffer_size)] uint8 *buffer,
		[in,out,ref] uint32 *buffer_size
	);

	/******************/
	/* Function: 0x1e */
	WERROR winreg_InitiateSystemShutdownEx(
		[in,unique] uint16 *hostname,
		/*
		 * Note: lsa_String and winreg_String both result
		 *       in WERR_INVALID_PARAM
		 */
		[in,unique] lsa_StringLarge *message,
		[in] uint32 timeout,
		[in] uint8 force_apps,
		[in] uint8 do_reboot,
		[in] uint32 reason
	);

	/******************/
	/* Function: 0x1f */
	WERROR winreg_SaveKeyEx(
		[in,ref] policy_handle *handle,
		[in,ref] winreg_String *filename,
		[in,unique] KeySecurityAttribute *sec_attrib,
		[in] uint32 flags
	);

	/******************/
	/* Function: 0x20 */
	WERROR winreg_OpenHKPT(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x21 */
	WERROR winreg_OpenHKPN(
		[in,unique] uint16 *system_name,
		[in]      winreg_AccessMask access_mask,
		[out,ref] policy_handle *handle
	);

	/******************/
	/* Function: 0x22 */
	[todo] WERROR winreg_QueryMultipleValues2(
	);

	/******************/
	/* Function: 0x23 */
	WERROR winreg_DeleteKeyEx(
		[in,ref] policy_handle *handle,
		[in,ref] winreg_String *key,
		[in] winreg_AccessMask access_mask,
		[in] uint32 reserved
	);
}