summaryrefslogtreecommitdiffstats
path: root/librpc/idl/ODJ.idl
blob: 00c731b76a934a16765a4ce98894a3cca7918eb2 (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
/*
   The MIT License (MIT)
   Copyright (c) Microsoft Corporation

   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
   associated documentation files (the "Software"), to deal in the Software without restriction,
   including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
   subject to the following conditions:

   The above copyright notice and this permission notice shall be included in all copies or substantial
   portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
   NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

   The Offline Domain Join IDL has been derived from :

	https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/NetMgmt/odj-idl.md
*/

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

#include "idl_types.h"

cpp_quote("#define OP_JP2_FLAG_PERSISTENTSITE    0x00000001")

[
  uuid("11111111-3333-5555-7777-99999999"),
  version(0.0),
  pointer_default(unique),
  helpstring("Offline Domain Join IDL"),
  helper("../librpc/ndr/ndr_ODJ.h")
]
interface ODJ
{
	typedef struct {
		uint32 cbBlob;
		[size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob;
	} OP_BLOB;

	/* Contains a serialized ODJ_WIN7_BLOB structure. */
	const string ODJ_GUID_JOIN_PROVIDER	= "{631c7621-5289-4321-bc9e-80f843f868c3}";

	/* Contains a serialized OP_JOIN_PROV2_PART structure. */
	const string ODJ_GUID_JOIN_PROVIDER2	= "{57BFC56B-52F9-480C-ADCB-91B3F8A82317}";

	/* Contains a serialized OP_JOIN_PROV3_PART structure. */
	const string ODJ_GUID_JOIN_PROVIDER3	= "{FC0CCF25-7FFA-474A-8611-69FFE269645F}";

	/* Contains a serialized OP_CERT_PART structure. */
	const string ODJ_GUID_CERT_PROVIDER	= "{9c0971e9-832f-4873-8e87-ef1419d4781e}";

	/* Contains a serialized OP_POLICY_PART structure. */
	const string ODJ_GUID_POLICY_PROVIDER	= "{68fb602a-0c09-48ce-b75f-07b7bd58f7ec}";

#if 0
	typedef struct {
		char Value[6];
	} SID_IDENTIFIER_AUTHORITY;

	typedef struct {
		char Revision;
		char SubAuthorityCount;
		SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
		[size_is(SubAuthorityCount)] uint32 SubAuthority[*];
	} ODJ_SID;

	typedef struct {
		USHORT Length;
		USHORT MaximumLength;
		[size_is(MaximumLength/2), length_is(Length/2)] PWSTR Buffer;
	} ODJ_UNICODE_STRING;
#endif
#define ODJ_SID dom_sid2
#define ODJ_UNICODE_STRING lsa_StringLarge

#define ODJ_DECLARE_SERIALIZED_PTR(el_name) \
	typedef [public] struct { \
		el_name *p; \
	} el_name ##_ctr; \
	\
	typedef [public,gensize] struct { \
		[subcontext(0xFFFFFC01)] el_name ## _ctr s; \
	} el_name ## _serialized_ptr;

	typedef struct {
		ODJ_UNICODE_STRING Name;
		ODJ_UNICODE_STRING DnsDomainName;
		ODJ_UNICODE_STRING DnsForestName;
		GUID DomainGuid;
		ODJ_SID *Sid;
	} ODJ_POLICY_DNS_DOMAIN_INFO;

	typedef struct {
		[string,charset(UTF16)] uint16 *lpDomain;
		[string,charset(UTF16)] uint16 *lpMachineName;
		[string,charset(UTF16)] [flag(NDR_SECRET)] uint16 *lpMachinePassword;
		/*
		 * Not sure whether the following 4 bytes are padding or a
		 * pointer, at least it's value may not be 0 for Windows to accept our
		 * generated win7blobs - gd
		 */
#if 0
		[flag(NDR_ALIGN8)]   DATA_BLOB _pad;
#else
		[value(0xffffffff)] uint32 _pad;
#endif
		ODJ_POLICY_DNS_DOMAIN_INFO DnsDomainInfo;
		netr_DsRGetDCNameInfo DcInfo;
		DWORD Options;
	} ODJ_WIN7BLOB;

	typedef ODJ_WIN7BLOB *PODJ_WIN7BLOB;

	typedef struct {
		DWORD     dwFlags;
		[string,charset(UTF16)] uint16 *lpNetbiosName;
		[string,charset(UTF16)] uint16 *lpSiteName;
		[string,charset(UTF16)] uint16 *lpPrimaryDNSDomain;
		DWORD             dwReserved;
		[string,charset(UTF16)] uint16 *lpReserved;
	} OP_JOINPROV2_PART;

	typedef struct {
		DWORD Rid;
		[string,charset(UTF16)] uint16 *lpSid;
	} OP_JOINPROV3_PART;

	typedef struct {
		[string,charset(UTF16)] uint16   *pKeyPath;
		[string,charset(UTF16)] uint16   *pValueName;
		winreg_Type                      ulValueType;
		uint32                           cbValueData;
		[size_is(cbValueData),flag(LIBNDR_PRINT_ARRAY_HEX)]  uint8   *pValueData;
	} OP_POLICY_ELEMENT;

	typedef struct {
		[string,charset(UTF16)] uint16              *pSource;
		uint32                                       ulRootKeyId;
		uint32                                       cElements;
		[size_is(cElements)]    OP_POLICY_ELEMENT   *pElements;
	} OP_POLICY_ELEMENT_LIST;

	typedef struct {
		uint32                                       cElementLists;
		[size_is(cElementLists)]
		OP_POLICY_ELEMENT_LIST *pElementLists;
		OP_BLOB                                     Extension;
	} OP_POLICY_PART;

	typedef struct {
		[string,charset(UTF16)] uint16 *pTemplateName;
		uint32                       ulPrivateKeyExportPolicy;
		[string,charset(UTF16)] uint16 *pPolicyServerUrl;
		uint32                       ulPolicyServerUrlFlags;
		[string,charset(UTF16)] uint16 *pPolicyServerId;
		uint32                       cbPfx;
		[size_is(cbPfx)]    uint8   *pPfx;
	} OP_CERT_PFX_STORE;

	typedef struct {
		uint32                       StoreLocation;
		[string,charset(UTF16)] uint16 *pStoreName;
		uint32                       cbSst;
		[size_is(cbSst)]    uint8   *pSst;
	} OP_CERT_SST_STORE;

	typedef struct {
	        uint32                                       cPfxStores;
		[size_is(cPfxStores)]   OP_CERT_PFX_STORE   *pPfxStores;
		uint32                                       cSstStores;
		[size_is(cSstStores)]   OP_CERT_SST_STORE   *pSstStores;
		OP_BLOB                                     Extension;
	} OP_CERT_PART;

	ODJ_DECLARE_SERIALIZED_PTR(ODJ_WIN7BLOB)
	ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV2_PART)
	ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV3_PART)
	ODJ_DECLARE_SERIALIZED_PTR(OP_POLICY_PART)
	ODJ_DECLARE_SERIALIZED_PTR(OP_CERT_PART)

	typedef [public,nodiscriminant,gensize] union {
		[case(1)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB win7blob;
		[case(2)] [subcontext(0xFFFFFC01)] OP_JOINPROV2_PART_ctr join_prov2;
		[case(3)] [subcontext(0xFFFFFC01)] OP_JOINPROV3_PART_ctr join_prov3;
		[case(4)] [subcontext(0xFFFFFC01)] OP_CERT_PART_ctr cert_part;
		[case(5)] [subcontext(0xFFFFFC01)] OP_POLICY_PART_ctr policy_part;
		[default];
	} OP_PACKAGE_PART_u;

	typedef [public,bitmap32bit] bitmap {
		OPSPI_PACKAGE_PART_ESSENTIAL	= 0x00000001
	} ODJ_PackageFlags;

	typedef struct {
		GUID    PartType;
		uint32   ulFlags;
#if 1
		[value(ndr_size_OP_PACKAGE_PART_u(Part, odj_switch_level_from_guid(&PartType), 0))] uint32 part_len;
		[subcontext(4),subcontext_size(part_len),switch_is(odj_switch_level_from_guid(&PartType))] OP_PACKAGE_PART_u *Part;
#else
		OP_BLOB Part;
#endif
		OP_BLOB Extension;
	} OP_PACKAGE_PART;

	ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART)

	typedef struct {
		uint32                                 cParts;
		[size_is(cParts)]   OP_PACKAGE_PART   *pParts;
		OP_BLOB                               Extension;
	} OP_PACKAGE_PART_COLLECTION;

	ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART_COLLECTION)

	typedef struct {
		[value(ndr_size_OP_PACKAGE_PART_COLLECTION_serialized_ptr(w, 0))] uint32 cbBlob;
		[subcontext(4), subcontext_size(cbBlob)] OP_PACKAGE_PART_COLLECTION_serialized_ptr *w;
	} OP_PACKAGE_PART_COLLECTION_blob;

	typedef struct {
		GUID    EncryptionType;
		OP_BLOB EncryptionContext;
#if 1
		OP_PACKAGE_PART_COLLECTION_blob WrappedPartCollection;
#else
		OP_BLOB WrappedPartCollection;
#endif
		uint32   cbDecryptedPartCollection;
		OP_BLOB Extension;
	} OP_PACKAGE;

	ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE)

	typedef [v1_enum,public] enum {
		ODJ_WIN7_FORMAT = 0x00000001,	/* blob is ODJ_WIN7BLOB */
		ODJ_WIN8_FORMAT = 0x00000002	/* blob is OP_PACKAGE */
	} ODJFormat;

	typedef [public,nodiscriminant,gensize] union {
		[case(ODJ_WIN7_FORMAT)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB odj_win7blob;
		[case(ODJ_WIN8_FORMAT)] [subcontext(0xFFFFFC01)] OP_PACKAGE_ctr op_package;
		[default] [subcontext(0xFFFFFC01)] [flag(LIBNDR_FLAG_REMAINING)] DATA_BLOB blob;
	} ODJ_BLOB_u;

	typedef struct {
		ODJFormat ulODJFormat;
		[value(ndr_size_ODJ_BLOB_u(pBlob, ulODJFormat, 0))] uint32 cbBlob;
#if 1
		[switch_is(ulODJFormat), subcontext(4), subcontext_size(cbBlob)] ODJ_BLOB_u *pBlob;
#else
		[size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob;
#endif
	} ODJ_BLOB;

	typedef [public] struct {
		[value(1)] uint32 ulVersion;
		uint32 ulcBlobs;
		[size_is(ulcBlobs)] ODJ_BLOB *pBlobs;
	} ODJ_PROVISION_DATA;

	ODJ_DECLARE_SERIALIZED_PTR(ODJ_PROVISION_DATA)
}