2 Unix SMB/CIFS implementation.
3 test suite for winreg ndr operations
5 Copyright (C) Jelmer Vernooij 2007
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "torture/ndr/ndr.h"
24 #include "librpc/gen_ndr/ndr_winreg.h"
25 #include "librpc/gen_ndr/ndr_security.h"
26 #include "libcli/security/security.h"
28 static const uint8_t closekey_in_data[] = {
29 0x00, 0x00, 0x00, 0x00, 0x1d, 0xd8, 0xd7, 0xaa, 0x8d, 0x6c, 0x3f, 0x48,
30 0xa7, 0x1e, 0x02, 0x6a, 0x47, 0xf6, 0x7b, 0xae
33 static bool closekey_in_check(struct torture_context *tctx,
34 struct winreg_CloseKey *ck)
36 torture_assert(tctx, ck->in.handle != NULL, "handle invalid");
37 torture_assert_int_equal(tctx, ck->in.handle->handle_type, 0, "handle type");
41 const static uint8_t closekey_out_data[] = {
42 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
46 static bool closekey_out_check(struct torture_context *tctx,
47 struct winreg_CloseKey *ck)
49 torture_assert_int_equal(tctx, ck->out.handle->handle_type, 0, "handle type");
50 torture_assert_werr_ok(tctx, ck->out.result, "return code");
54 static const uint8_t OpenHKLM_In[] = {
55 0x01, 0x00, 0x00, 0x00, 0xe0, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02
58 static bool openhklm_in_check(struct torture_context *tctx,
59 struct winreg_OpenHKLM *r)
61 torture_assert(tctx, r->in.system_name != NULL, "system name pointer");
62 torture_assert_int_equal(tctx, *r->in.system_name, 34016, "system name");
63 torture_assert_int_equal(tctx, r->in.access_mask, 0x02000000, "access mask");
67 static const uint8_t openhklm_out_data[] = {
68 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
69 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3, 0x00, 0x00, 0x00, 0x00
72 static bool openhklm_out_check(struct torture_context *tctx,
73 struct winreg_OpenHKLM *r)
75 torture_assert(tctx, r->out.handle != NULL, "handle pointer");
76 torture_assert_int_equal(tctx, r->out.handle->handle_type, 0, "handle_type");
77 torture_assert_werr_ok(tctx, r->out.result, "return code");
81 static const uint8_t createkey_in_data[] = {
82 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
83 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3, 0x16, 0x00, 0x16, 0x00,
84 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85 0x0b, 0x00, 0x00, 0x00, 0x73, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x74, 0x00,
86 0x74, 0x00, 0x79, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x74, 0x00,
87 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
89 0x00, 0x00, 0x00, 0x00
92 static bool createkey_in_check(struct torture_context *tctx,
93 struct winreg_CreateKey *r)
95 torture_assert_str_equal(tctx, r->in.name.name, "spottyfoot", "name");
96 torture_assert(tctx, r->in.keyclass.name == NULL, "keyclass");
97 torture_assert_int_equal(tctx, r->in.options, 0, "option");
98 torture_assert_int_equal(tctx, r->in.access_mask, 0x2000000, "access mask");
99 torture_assert(tctx, r->in.secdesc == NULL, "secdesc");
100 torture_assert(tctx, r->in.action_taken == NULL, "action_taken");
105 static const uint8_t createkey_out_data[] = {
106 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
108 0x57, 0x00, 0x00, 0x00
111 static bool createkey_out_check(struct torture_context *tctx,
112 struct winreg_CreateKey *r)
114 torture_assert(tctx, GUID_all_zero(&r->out.new_handle->uuid), "new_handle");
115 torture_assert(tctx, r->out.action_taken == NULL, "action_taken pointer");
116 torture_assert_werr_equal(tctx, r->out.result, WERR_INVALID_PARAM,
122 static const uint8_t enumvalue_in_data[] = {
123 0x00, 0x00, 0x00, 0x00, 0xae, 0x1a, 0xbd, 0xbe, 0xbb, 0x94, 0xce, 0x4e,
124 0xba, 0xcf, 0x56, 0xeb, 0xe5, 0xb3, 0x6c, 0xa3, 0x05, 0x00, 0x00, 0x00,
125 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
126 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
127 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
129 0xff, 0xff, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
132 static bool enumvalue_in_check(struct torture_context *tctx,
133 struct winreg_EnumValue *r)
135 torture_assert_int_equal(tctx, r->in.enum_index, 5, "enum index");
136 torture_assert(tctx, r->in.type != NULL, "type pointer");
137 torture_assert_int_equal(tctx, *r->in.type, 0, "type");
138 torture_assert_int_equal(tctx, *r->in.size, 65535, "size");
139 torture_assert_int_equal(tctx, *r->in.length, 0, "length");
140 torture_assert_int_equal(tctx, r->in.name->size, 512, "name size");
141 torture_assert_int_equal(tctx, r->in.name->length, 0, "name length");
146 static const uint8_t enumvalue_out_data[] = {
147 0x12, 0x00, 0x00, 0x02, 0x28, 0x91, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00,
148 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x48, 0x00, 0x4f, 0x00,
149 0x4d, 0x00, 0x45, 0x00, 0x50, 0x00, 0x41, 0x00, 0x54, 0x00, 0x48, 0x00,
150 0x00, 0x00, 0x00, 0x00, 0xd8, 0x8c, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00,
151 0xe0, 0x00, 0x0c, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
152 0x4c, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x44, 0x00, 0x6f, 0x00, 0x63, 0x00,
153 0x75, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x73, 0x00,
154 0x20, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x20, 0x00, 0x53, 0x00,
155 0x65, 0x00, 0x74, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00,
156 0x73, 0x00, 0x5c, 0x00, 0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00,
157 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x61, 0x00,
158 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf0, 0x8c, 0x07, 0x00,
159 0x4c, 0x00, 0x00, 0x00, 0xf8, 0x8c, 0x07, 0x00, 0x4c, 0x00, 0x00, 0x00,
160 0x00, 0x00, 0x00, 0x00
163 static bool enumvalue_out_check(struct torture_context *tctx,
164 struct winreg_EnumValue *r)
166 torture_assert_int_equal(tctx, r->out.name->size, 512, "name size");
167 torture_assert_int_equal(tctx, r->out.name->length, 18, "name length");
168 torture_assert_str_equal(tctx, r->out.name->name, "HOMEPATH", "name");
169 torture_assert_int_equal(tctx, *r->out.type, 1, "type");
170 torture_assert_int_equal(tctx, *r->out.size, 76, "size");
171 torture_assert_int_equal(tctx, *r->out.length, 76, "length");
172 torture_assert_werr_ok(tctx, r->out.result, "return code");
177 static const uint8_t queryvalue_in_data[] = {
178 0x00, 0x00, 0x00, 0x00, 0xae, 0x1a, 0xbd, 0xbe, 0xbb, 0x94, 0xce, 0x4e,
179 0xba, 0xcf, 0x56, 0xeb, 0xe5, 0xb3, 0x6c, 0xa3, 0x12, 0x00, 0x12, 0x00,
180 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
181 0x09, 0x00, 0x00, 0x00, 0x48, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x45, 0x00,
182 0x50, 0x00, 0x41, 0x00, 0x54, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00,
183 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184 0x03, 0x00, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x00
188 static bool queryvalue_in_check(struct torture_context *tctx,
189 struct winreg_QueryValue *r)
191 torture_assert_str_equal(tctx, r->in.value_name.name, "HOMEPATH", "name");
192 torture_assert_int_equal(tctx, *r->in.type, 0, "type");
193 torture_assert_int_equal(tctx, *r->in.size, 4095, "size");
194 torture_assert_int_equal(tctx, *r->in.length, 0, "length");
195 torture_assert(tctx, r->in.data == NULL, "data pointer");
200 static const uint8_t queryvalue_out_data[] = {
201 0xd8, 0xf5, 0x0b, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
202 0xe4, 0xf5, 0x0b, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xec, 0xf5, 0x0b, 0x00,
203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
206 static bool queryvalue_out_check(struct torture_context *tctx,
207 struct winreg_QueryValue *r)
209 torture_assert_werr_ok(tctx, r->out.result, "return code");
210 torture_assert_int_equal(tctx, *r->out.type, 1, "type");
211 torture_assert(tctx, r->out.data == NULL, "data pointer");
212 torture_assert_int_equal(tctx, *r->out.size, 76, "size");
213 torture_assert_int_equal(tctx, *r->out.length, 0, "length");
218 static const uint8_t querymultiplevalues_in_data[] = {
219 0x00, 0x00, 0x00, 0x00, 0xae, 0x1a, 0xbd, 0xbe, 0xbb, 0x94, 0xce, 0x4e,
220 0xba, 0xcf, 0x56, 0xeb, 0xe5, 0xb3, 0x6c, 0xa3, 0x01, 0x00, 0x00, 0x00,
221 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
223 0x12, 0x00, 0x12, 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
224 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x48, 0x00, 0x4f, 0x00,
225 0x4d, 0x00, 0x45, 0x00, 0x50, 0x00, 0x41, 0x00, 0x54, 0x00, 0x48, 0x00,
226 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
227 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
228 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
229 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
230 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00
233 static bool querymultiplevalues_in_check(struct torture_context *tctx,
234 struct winreg_QueryMultipleValues *r)
236 torture_assert_int_equal(tctx, r->in.num_values, 1, "num values");
237 torture_assert_str_equal(tctx, r->in.values[0].name->name, "HOMEPATH",
240 torture_assert_int_equal(tctx, r->in.values[0].type, 0, "type");
241 torture_assert_int_equal(tctx, r->in.values[0].offset, 0, "offset");
242 torture_assert_int_equal(tctx, r->in.values[0].length, 0, "length");
243 torture_assert_int_equal(tctx, *r->in.buffer_size, 76, "buffer size");
248 static const uint8_t querymultiplevalues_out_data[] = {
249 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
250 0xd8, 0x8c, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
251 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x12, 0x00, 0x38, 0x87, 0x07, 0x00,
252 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
253 0x48, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x45, 0x00, 0x50, 0x00, 0x41, 0x00,
254 0x54, 0x00, 0x48, 0x00, 0xc8, 0x95, 0x08, 0x00, 0x4c, 0x00, 0x00, 0x00,
255 0x00, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
256 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
257 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
258 0x00, 0x00, 0x00, 0x00, 0x4c, 0x4d, 0x45, 0x4d, 0xc8, 0x95, 0x08, 0x00,
259 0x50, 0x87, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x07, 0x00,
260 0x00, 0x01, 0x0c, 0x00, 0x50, 0x95, 0x08, 0x00, 0x48, 0x96, 0x08, 0x00,
261 0xdc, 0x00, 0x00, 0x00, 0xc0, 0x83, 0x00, 0x01, 0x0d, 0xf0, 0xff, 0xff,
262 0x4c, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00
265 static bool querymultiplevalues_out_check(struct torture_context *tctx,
266 struct winreg_QueryMultipleValues *r)
268 torture_assert_str_equal(tctx, r->out.values[0].name->name, "HOMEPATH",
271 torture_assert_int_equal(tctx, r->out.values[0].type, 0, "type");
272 torture_assert_int_equal(tctx, r->out.values[0].offset, 0, "offset");
273 torture_assert_int_equal(tctx, r->out.values[0].length, 0, "length");
274 /* FIXME: r->out.buffer */
275 torture_assert_int_equal(tctx, *r->out.buffer_size, 76, "buffer size");
276 torture_assert_werr_equal(tctx, r->out.result, WERR_MORE_DATA,
282 static const uint8_t flushkey_in_data[] = {
283 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
284 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3
287 static bool flushkey_in_check(struct torture_context *tctx,
288 struct winreg_FlushKey *r)
290 torture_assert_int_equal(tctx, r->in.handle->handle_type, 0, "handle type");
294 static const uint8_t flushkey_out_data[] = {
295 0x00, 0x00, 0x00, 0x00
298 static bool flushkey_out_check(struct torture_context *tctx,
299 struct winreg_FlushKey *r)
301 torture_assert_werr_ok(tctx, r->out.result, "return code");
306 static const uint8_t openkey_in_data[] = {
307 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
308 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3, 0x16, 0x00, 0x16, 0x00,
309 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
310 0x0b, 0x00, 0x00, 0x00, 0x73, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x74, 0x00,
311 0x74, 0x00, 0x79, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x74, 0x00,
312 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02
315 static bool openkey_in_check(struct torture_context *tctx, struct winreg_OpenKey *r)
317 torture_assert_int_equal(tctx, r->in.unknown, 0, "unknown");
318 torture_assert_int_equal(tctx, r->in.access_mask, 0x02000000, "access mask");
319 torture_assert_str_equal(tctx, r->in.keyname.name, "spottyfoot", "keyname");
320 /* FIXME: parent handle */
324 static const uint8_t openkey_out_data[] = {
325 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
329 static bool openkey_out_check(struct torture_context *tctx, struct winreg_OpenKey *r)
331 torture_assert(tctx, GUID_all_zero(&r->out.handle->uuid), "handle");
332 torture_assert_werr_equal(tctx, r->out.result, WERR_BADFILE, "return code");
336 static const uint8_t deletekey_in_data[] = {
337 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
338 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3, 0x16, 0x00, 0x16, 0x00,
339 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x0b, 0x00, 0x00, 0x00, 0x73, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x74, 0x00,
341 0x74, 0x00, 0x79, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x74, 0x00,
345 static bool deletekey_in_check(struct torture_context *tctx, struct winreg_DeleteKey *r)
348 torture_assert_str_equal(tctx, r->in.key.name, "spottyfoot", "key name");
352 static const uint8_t deletekey_out_data[] = {
353 0x02, 0x00, 0x00, 0x00
356 static bool deletekey_out_check(struct torture_context *tctx, struct winreg_DeleteKey *r)
358 torture_assert_werr_equal(tctx, r->out.result, WERR_BADFILE, "return code");
362 static const uint8_t getversion_in_data[] = {
363 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
364 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3
367 static bool getversion_in_check(struct torture_context *tctx, struct winreg_GetVersion *r)
373 static const uint8_t getversion_out_data[] = {
374 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
377 static bool getversion_out_check(struct torture_context *tctx, struct winreg_GetVersion *r)
379 torture_assert_int_equal(tctx, *r->out.version, 5, "version");
380 torture_assert_werr_ok(tctx, r->out.result, "return code");
384 static const uint8_t queryinfokey_in_data[] = {
385 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
386 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3, 0x00, 0x00, 0x00, 0x00,
387 0x00, 0x00, 0x00, 0x00
390 static bool queryinfokey_in_check(struct torture_context *tctx, struct winreg_QueryInfoKey *r)
393 torture_assert(tctx, r->in.class_in->name == NULL, "class in");
397 static const uint8_t queryinfokey_out_data[] = {
398 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
399 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
400 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00,
401 0x10, 0x48, 0x02, 0x3a, 0xcf, 0xfd, 0xc4, 0x01, 0x00, 0x00, 0x00, 0x00
404 static bool queryinfokey_out_check(struct torture_context *tctx, struct winreg_QueryInfoKey *r)
406 torture_assert(tctx, r->out.class_in != NULL, "class out");
407 torture_assert(tctx, r->out.class_in->name != NULL, "class out name");
408 torture_assert_str_equal(tctx, r->out.class_in->name, "", "class out name");
409 torture_assert_int_equal(tctx, *r->out.num_subkeys, 0, "num subkeys");
410 torture_assert_int_equal(tctx, *r->out.max_subkeylen, 0, "subkey length");
411 torture_assert_int_equal(tctx, *r->out.max_subkeysize, 140, "subkey size");
412 torture_assert_werr_ok(tctx, r->out.result, "return code");
416 static const uint8_t notifychangekeyvalue_in_data[] = {
417 0x00, 0x00, 0x00, 0x00, 0xb2, 0x64, 0xbc, 0xb3, 0x7f, 0x90, 0x29, 0x4a,
418 0xb4, 0xb3, 0x91, 0xe7, 0xe4, 0x4a, 0x58, 0xe3, 0x01, 0x00, 0x00, 0x00,
419 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
420 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
421 0x00, 0x00, 0x00, 0x00
424 static bool notifychangekeyvalue_in_check(struct torture_context *tctx, struct winreg_NotifyChangeKeyValue *r)
426 torture_assert_int_equal(tctx, r->in.watch_subtree, 1, "watch subtree");
427 torture_assert_int_equal(tctx, r->in.notify_filter, 0, "notify filter");
428 torture_assert_int_equal(tctx, r->in.unknown, 0, "unknown");
429 torture_assert(tctx, r->in.string1.name == NULL, "string1");
430 torture_assert(tctx, r->in.string2.name == NULL, "string2");
431 torture_assert_int_equal(tctx, r->in.unknown2, 0, "unknown2");
435 static const uint8_t notifychangekeyvalue_out_data[] = {
436 0x57, 0x00, 0x00, 0x00
439 static bool notifychangekeyvalue_out_check(struct torture_context *tctx, struct winreg_NotifyChangeKeyValue *r)
441 torture_assert_werr_equal(tctx, r->out.result, WERR_INVALID_PARAM, "notify change key value");
445 static const uint8_t getkeysecurity_in_data[] = {
446 0x00, 0x00, 0x00, 0x00, 0xbd, 0xaa, 0xf6, 0x59, 0xc1, 0x82, 0x1f, 0x4d,
447 0x84, 0xa9, 0xdd, 0xae, 0x60, 0x77, 0x1e, 0x45, 0x00, 0x00, 0x00, 0x02,
448 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
451 static bool getkeysecurity_in_check(struct torture_context *tctx, struct winreg_GetKeySecurity *r)
454 torture_assert_int_equal(tctx, r->in.sec_info, 2, "sec info");
455 torture_assert_int_equal(tctx, r->in.sd->size, 65536, "sd size");
456 torture_assert_int_equal(tctx, r->in.sd->len, 0, "sd len");
457 torture_assert(tctx, r->in.sd->data == NULL, "sd data");
461 static const uint8_t getkeysecurity_out_data[] = {
462 0x08, 0x91, 0x08, 0x00, 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
463 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
464 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
465 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
468 static bool getkeysecurity_out_check(struct torture_context *tctx, struct winreg_GetKeySecurity *r)
470 torture_assert_int_equal(tctx, r->in.sd->size, 20, "sd size");
471 torture_assert_int_equal(tctx, r->in.sd->len, 20, "sd len");
472 torture_assert_werr_ok(tctx, r->out.result, "return code");
476 struct torture_suite *ndr_winreg_suite(TALLOC_CTX *ctx)
478 struct torture_suite *suite = torture_suite_create(ctx, "winreg");
480 torture_suite_add_ndr_pull_fn_test(suite, winreg_CloseKey, closekey_in_data, NDR_IN, closekey_in_check );
481 torture_suite_add_ndr_pull_fn_test(suite, winreg_CloseKey, closekey_out_data, NDR_IN, closekey_out_check );
483 torture_suite_add_ndr_pull_fn_test(suite, winreg_OpenHKLM, OpenHKLM_In, NDR_IN, openhklm_in_check );
484 torture_suite_add_ndr_pull_fn_test(suite, winreg_OpenHKLM, openhklm_out_data, NDR_OUT, openhklm_out_check );
486 torture_suite_add_ndr_pull_fn_test(suite, winreg_CreateKey, createkey_in_data, NDR_IN, createkey_in_check );
487 torture_suite_add_ndr_pull_fn_test(suite, winreg_CreateKey, createkey_out_data, NDR_OUT, createkey_out_check );
489 torture_suite_add_ndr_pull_fn_test(suite, winreg_EnumValue, enumvalue_in_data, NDR_IN, enumvalue_in_check );
490 torture_suite_add_ndr_pull_fn_test(suite, winreg_EnumValue, enumvalue_out_data, NDR_OUT, enumvalue_out_check );
492 torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryValue, queryvalue_in_data, NDR_IN, queryvalue_in_check );
493 torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryValue, queryvalue_out_data, NDR_OUT, queryvalue_out_check );
495 /*torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryMultipleValues, querymultiplevalues_in_data, NDR_IN, querymultiplevalues_in_check );
496 torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryMultipleValues, querymultiplevalues_out_data, NDR_OUT, querymultiplevalues_out_check );*/
498 torture_suite_add_ndr_pull_fn_test(suite, winreg_FlushKey, flushkey_in_data, NDR_IN, flushkey_in_check );
499 torture_suite_add_ndr_pull_fn_test(suite, winreg_FlushKey, flushkey_out_data, NDR_OUT, flushkey_out_check );
501 torture_suite_add_ndr_pull_fn_test(suite, winreg_OpenKey, openkey_in_data, NDR_IN, openkey_in_check );
502 torture_suite_add_ndr_pull_fn_test(suite, winreg_OpenKey, openkey_out_data, NDR_OUT, openkey_out_check );
504 torture_suite_add_ndr_pull_fn_test(suite, winreg_DeleteKey, deletekey_in_data, NDR_IN, deletekey_in_check );
505 torture_suite_add_ndr_pull_fn_test(suite, winreg_DeleteKey, deletekey_out_data, NDR_OUT, deletekey_out_check );
507 torture_suite_add_ndr_pull_fn_test(suite, winreg_GetVersion, getversion_in_data, NDR_IN, getversion_in_check );
508 torture_suite_add_ndr_pull_fn_test(suite, winreg_GetVersion, getversion_out_data, NDR_OUT, getversion_out_check );
510 torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryInfoKey, queryinfokey_in_data, NDR_IN, queryinfokey_in_check );
511 /*torture_suite_add_ndr_pull_fn_test(suite, winreg_QueryInfoKey, queryinfokey_out_data, NDR_OUT, queryinfokey_out_check );*/
513 torture_suite_add_ndr_pull_fn_test(suite, winreg_NotifyChangeKeyValue, notifychangekeyvalue_in_data, NDR_IN, notifychangekeyvalue_in_check );
514 torture_suite_add_ndr_pull_fn_test(suite, winreg_NotifyChangeKeyValue, notifychangekeyvalue_out_data, NDR_OUT, notifychangekeyvalue_out_check );
516 /*torture_suite_add_ndr_pull_fn_test(suite, winreg_GetKeySecurity, getkeysecurity_in_data, NDR_IN, getkeysecurity_in_check );
517 torture_suite_add_ndr_pull_fn_test(suite, winreg_GetKeySecurity, getkeysecurity_out_data, NDR_OUT, getkeysecurity_out_check );*/