|
root / base / usr / src / uts / common / smbsrv / ndl / winreg.ndl
winreg.ndl Plain Text 481 lines 11.9 KB
  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
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 *
 * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
 */

#ifndef _MLSVC_WINREG_NDL_
#define _MLSVC_WINREG_NDL_

/*
 * Windows Registry (WINREG) RPC interface definition.
 *
 * The Windows registry is split into a number of hives, which are divided
 * by function.  The hive names are abbreviated and prefixed by HKEY or HK.
 *
 * HKEY_CLASSES_ROOT     (HKCR)	Information about registered applications
 * HKEY_CURRENT_USER     (HKCU)	Settings for the current logged in user.
 * HKEY_LOCAL_MACHINE    (HKLM)	Settings for all users on the computer.
 * HKEY_USERS            (HKU)	HKEY_CURRENT_USER subkeys for user accounts.
 * HKEY_CURRENT_CONFIG   (HKCC)	Runtime configuration information.
 * HKEY_PERFORMANCE_DATA (HKPD)	Runtime performance data.
 * HKEY_DYN_DATA         (HKDD)	Runtime data for Windows 9x applications.
 * HKEY_PERFORMANCE_TEXT (HKPT)	Runtime performance information.
 * HKEY_PERFORMANCE_NLS  (HKPN)	Runtime performance information.
 */

#include <libmlrpc/ndrtypes.ndl>

/* Windows NT */
#define WINREG_OPNUM_OpenHKCR		0x00
#define WINREG_OPNUM_OpenHKCU		0x01
#define WINREG_OPNUM_OpenHKLM		0x02
#define WINREG_OPNUM_OpenHKPD		0x03
#define WINREG_OPNUM_OpenHKUsers	0x04
#define WINREG_OPNUM_Close		0x05
#define WINREG_OPNUM_CreateKey		0x06
#define WINREG_OPNUM_DeleteKey		0x07
#define WINREG_OPNUM_DeleteValue	0x08
#define WINREG_OPNUM_EnumKey		0x09
#define WINREG_OPNUM_EnumValue		0x0a
#define WINREG_OPNUM_FlushKey		0x0b
#define WINREG_OPNUM_GetKeySec		0x0c
#define WINREG_OPNUM_LoadKey		0x0d
#define WINREG_OPNUM_NotifyChange	0x0e
#define WINREG_OPNUM_OpenKey		0x0f
#define WINREG_OPNUM_QueryKey		0x10
#define WINREG_OPNUM_QueryValue		0x11
#define WINREG_OPNUM_ReplaceKey		0x12
#define WINREG_OPNUM_RestoreKey		0x13
#define WINREG_OPNUM_SaveKey		0x14
#define WINREG_OPNUM_SetKeySec		0x15

/* Windows 2000 */
#define WINREG_OPNUM_CreateValue	0x16
#define WINREG_OPNUM_UnloadKey		0x17
#define WINREG_OPNUM_Shutdown		0x18
#define WINREG_OPNUM_AbortShutdown	0x19
#define WINREG_OPNUM_GetVersion		0x1a
#define WINREG_OPNUM_OpenHKCC		0x1b
#define WINREG_OPNUM_OpenHKDD		0x1c
#define WINREG_OPNUM_QueryMultiValues	0x1d
#define WINREG_OPNUM_ShutdownEx		0x1e

/* Windows XP and Windows Server 2003 */
#define WINREG_OPNUM_SavekeyEx		0x1f
#define WINREG_OPNUM_OpenHKPT		0x20
#define WINREG_OPNUM_OpenHKPN		0x21

/* Windows 2003 SP1 */
#define WINREG_OPNUM_QueryMultiValues2	0x22
#define WINREG_OPNUM_DeleteKeyEx	0x23

#define	WINREG_TYPE_NONE		0
#define WINREG_SZ			1
#define WINREG_EXPAND_SZ		2
#define WINREG_BINARY			3
#define WINREG_DWORD			4
#define WINREG_DWORD_BIG_ENDIAN		5
#define WINREG_LINK			6
#define WINREG_MULTI_SZ			7
#define WINREG_RESOURCE_LIST		8
#define WINREG_RESOURCE_DESC		9
#define WINREG_RESOURCE_REQ_LIST	10
#define WINREG_QWORD			11

#define	WINREG_ACCESS_QUERY_VALUE	0x00000001
#define WINREG_ACCESS_SET_VALUE		0x00000002
#define WINREG_ACCESS_CREATE_KEY	0x00000004
#define WINREG_ACCESS_ENUMERATE		0x00000008
#define WINREG_ACCESS_NOTIFY		0x00000010
#define WINREG_ACCESS_CREATE_LINK	0x00000020
#define WINREG_ACCESS_KEY64		0x00000100
#define WINREG_ACCESS_KEY32		0x00000200

CONTEXT_HANDLE(winreg_handle) winreg_handle_t;

struct winreg_string_desc {
	WORD	length;
	WORD	allosize;
	LPTSTR	str;
};
typedef struct winreg_string_desc winreg_string_t;

/*
 * Fake Varying/Conformant with a funny conformant.
 */
struct winreg_value {
	DWORD	vc_first_is;	/* 0 */
	DWORD	vc_length_is;
    SIZE_IS(vc_length_is)
	BYTE	value[ANY_SIZE_ARRAY];
};

struct winreg_vcs {
	DWORD	vc_first_is;	/* 0 */
	DWORD	vc_length_is;
    SIZE_IS(vc_length_is)
	WORD	value[ANY_SIZE_ARRAY];
};

struct winreg_vcbuf {
	WORD wclen;
	WORD wcsize;
	struct winreg_vcs *buf;
};
typedef struct winreg_vcbuf winreg_vcbuf_t;

struct file_time {
	DWORD	low;
	DWORD	high;
};
typedef struct file_time file_time_t;

struct winreg_secdesc {
	struct winreg_value	*sd_buf;
	DWORD			sd_len;
	DWORD			sd_size;
};

OPERATION(WINREG_OPNUM_OpenHKCR)
struct winreg_OpenHKCR {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKCU)
struct winreg_OpenHKCU {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKLM)
struct winreg_OpenHKLM {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKPD)
struct winreg_OpenHKPD {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKUsers)
struct winreg_OpenHKUsers {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};


OPERATION(WINREG_OPNUM_Close)
struct winreg_Close {
	IN  winreg_handle_t	handle;
	OUT winreg_handle_t	result_handle;
	OUT DWORD		status;
};

#define	WINREG_ACTION_NONE		0
#define	WINREG_ACTION_NEW_KEY		1
#define	WINREG_ACTION_EXISTING_KEY	2

OPERATION(WINREG_OPNUM_CreateKey)
struct winreg_CreateKey {
	IN winreg_handle_t	handle;
	IN winreg_string_t	subkey;
	IN winreg_string_t	keyclass;
	IN DWORD		options;
	IN DWORD		access_mask;
	IN DWORD		*sd;
	OUT winreg_handle_t	result_handle;
	OUT DWORD		*action;
	OUT DWORD		status;
};


OPERATION(WINREG_OPNUM_DeleteKey)
struct winreg_DeleteKey {
	IN winreg_handle_t	handle;
	IN winreg_string_t	subkey;
	OUT DWORD		status;
};


OPERATION(WINREG_OPNUM_DeleteValue)
struct winreg_DeleteValue {
	IN winreg_handle_t	handle;
	IN winreg_string_t	name;
	OUT DWORD		status;
};

/*
 * Some of the OUT parameters are also supplied
 * as IN parameters but we can ignore them.
 */
OPERATION(WINREG_OPNUM_EnumKey)
struct winreg_EnumKey {
	IN	winreg_handle_t	handle;
	IN	DWORD	index;
	IN	winreg_string_t	name_in;
	IN	winreg_string_t	*class_in;
	OUT	winreg_string_t	name_out;
	OUT	winreg_string_t	*class_out;
	INOUT	file_time_t	*change_time;
	OUT	DWORD		status;
};

/*
 * Some of the OUT parameters are also supplied
 * as IN parameters but we can ignore them.
 */
OPERATION(WINREG_OPNUM_EnumValue)
struct winreg_EnumValue {
	IN winreg_handle_t	handle;
	IN DWORD		index;
	/* IN	ignore the remaining input data */

	OUT winreg_vcbuf_t	name;
	OUT DWORD		*type;
	OUT struct winreg_value *value;
	OUT DWORD		*value_size;
	OUT DWORD		*value_size_total;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_FlushKey)
struct winreg_FlushKey {
	IN winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_GetKeySec)
struct winreg_GetKeySec {
	IN		winreg_handle_t		handle;
	IN		DWORD			sec_info;
	OUT REFERENCE	struct winreg_secdesc	*sd;
	OUT		DWORD			status;
};

OPERATION(WINREG_OPNUM_NotifyChange)
struct winreg_NotifyChange {
	IN  winreg_handle_t	handle;
	IN  DWORD		watch_subtree;
	IN  DWORD		notify_filter;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenKey)
struct winreg_OpenKey {
	IN  winreg_handle_t	handle;
	IN  winreg_string_t	name;
	IN  DWORD		options;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	result_handle;
	OUT DWORD		status;
};


OPERATION(WINREG_OPNUM_QueryKey)
struct winreg_QueryKey {
	IN  winreg_handle_t	handle;
	INOUT winreg_string_t	name;
	OUT DWORD 		num_subkeys;
	OUT DWORD 		max_subkey_len;
	OUT DWORD 		max_class_len;
	OUT DWORD 		num_values;
	OUT DWORD 		max_value_namelen;
	OUT DWORD 		max_value_len;
	OUT DWORD 		secdesc_size;
	OUT file_time_t 	last_write_time;
	OUT DWORD		status;
};


/*
 * Some of the OUT parameters are also supplied
 * as IN parameters but we can ignore them.
 */
OPERATION(WINREG_OPNUM_QueryValue)
struct winreg_QueryValue {
	IN  winreg_handle_t	handle;
	IN  winreg_string_t	value_name;
	/* IN	ignore the remaining input data */

	OUT DWORD		*type;
	OUT struct winreg_value	*value;
	OUT DWORD		*value_size;
	OUT DWORD		*value_size_total;
	OUT DWORD		status;
};


OPERATION(WINREG_OPNUM_SetKeySec)
struct winreg_SetKeySec {
	IN winreg_handle_t	handle;
	IN DWORD		access_mask;
	IN DWORD		sd;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_CreateValue)
struct winreg_CreateValue {
	IN winreg_handle_t	handle;
	IN winreg_string_t	name;
	IN winreg_string_t	class;
	IN DWORD		options;
	/* IN	ignore the remaining input data */

	OUT DWORD		status;
};


/*
 * The real structure of shutdown passes some strings, a timeout
 * and reboot/shutdown flags but this allows us to accept the call,
 * without anything appearing in the log, and return access denied.
 */
OPERATION(WINREG_OPNUM_Shutdown)
struct winreg_Shutdown {
	IN DWORD		ignored;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_AbortShutdown)
struct winreg_AbortShutdown {
	IN DWORD		ignored;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_GetVersion)
struct winreg_GetVersion {
	IN winreg_handle_t	handle;
	OUT DWORD		version;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKCC)
struct winreg_OpenHKCC {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKDD)
struct winreg_OpenHKDD {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKPT)
struct winreg_OpenHKPT {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

OPERATION(WINREG_OPNUM_OpenHKPN)
struct winreg_OpenHKPN {
	IN  DWORD		*server;
	IN  DWORD		access_mask;
	OUT winreg_handle_t	handle;
	OUT DWORD		status;
};

/*
 * The WINREG interface.
 */
INTERFACE(0)
union winreg_interface {
	CASE(WINREG_OPNUM_OpenHKCR)
		struct winreg_OpenHKCR		OpenHKCR;
	CASE(WINREG_OPNUM_OpenHKCU)
		struct winreg_OpenHKCU		OpenHKCU;
	CASE(WINREG_OPNUM_OpenHKLM)
		struct winreg_OpenHKLM		OpenHKLM;
	CASE(WINREG_OPNUM_OpenHKPD)
		struct winreg_OpenHKPD		OpenHKPD;
	CASE(WINREG_OPNUM_OpenHKUsers)
		struct winreg_OpenHKUsers	OpenHKUsers;
	CASE(WINREG_OPNUM_Close)
		struct winreg_Close		Close;
	CASE(WINREG_OPNUM_CreateKey)
		struct winreg_CreateKey		CreateKey;
	CASE(WINREG_OPNUM_DeleteKey)
		struct winreg_DeleteKey		DeleteKey;
	CASE(WINREG_OPNUM_DeleteValue)
		struct winreg_DeleteValue	DeleteValue;
	CASE(WINREG_OPNUM_EnumKey)
		struct winreg_EnumKey		EnumKey;
	CASE(WINREG_OPNUM_EnumValue)
		struct winreg_EnumValue		EnumValue;
	CASE(WINREG_OPNUM_FlushKey)
		struct winreg_FlushKey		FlushKey;
	CASE(WINREG_OPNUM_GetKeySec)
		struct winreg_GetKeySec		GetKeySec;
	CASE(WINREG_OPNUM_NotifyChange)
		struct winreg_NotifyChange	NotifyChange;
	CASE(WINREG_OPNUM_OpenKey)
		struct winreg_OpenKey		OpenKey;
	CASE(WINREG_OPNUM_QueryKey)
		struct winreg_QueryKey		QueryKey;
	CASE(WINREG_OPNUM_QueryValue)
		struct winreg_QueryValue	QueryValue;
	CASE(WINREG_OPNUM_SetKeySec)
		struct winreg_SetKeySec		SetKeySec;
	CASE(WINREG_OPNUM_CreateValue)
		struct winreg_CreateValue	CreateValue;
	CASE(WINREG_OPNUM_Shutdown)
		struct winreg_Shutdown		Shutdown;
	CASE(WINREG_OPNUM_AbortShutdown)
		struct winreg_AbortShutdown	AbortShutdown;
	CASE(WINREG_OPNUM_GetVersion)
		struct winreg_GetVersion	GetVersion;
	CASE(WINREG_OPNUM_OpenHKCC)
		struct winreg_OpenHKCC		OpenHKCC;
	CASE(WINREG_OPNUM_OpenHKDD)
		struct winreg_OpenHKDD		OpenHKDD;
	CASE(WINREG_OPNUM_OpenHKPT)
		struct winreg_OpenHKPT		OpenHKPT;
	CASE(WINREG_OPNUM_OpenHKPN)
		struct winreg_OpenHKPN		OpenHKPN;
};
typedef union winreg_interface	winreg_interface_t;
EXTERNTYPEINFO(winreg_interface)

#endif /* _MLSVC_WINREG_NDL_ */