win32u: Move cursor clipping functions to input.c.
[wine.git] / programs / reg / tests / import.c
blob882a52fa00f4045181ba68655ab8b962b087caae
1 /*
2 * Copyright 2016-2018, 2021 Hugh McMaster
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "reg_test.h"
21 BOOL is_elevated_process(void)
23 LONG err;
24 HKEY hkey;
26 err = RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
28 if (err == ERROR_ACCESS_DENIED)
29 return FALSE;
31 if (err == ERROR_FILE_NOT_FOUND)
33 if (RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE,
34 KEY_READ, NULL, &hkey, NULL))
35 return FALSE;
37 RegCloseKey(hkey);
38 RegDeleteKeyA(HKEY_CLASSES_ROOT, KEY_BASE);
41 return TRUE;
44 BOOL delete_file_(const char *file, unsigned line, const char *fname)
46 BOOL ret;
48 ret = DeleteFileA(fname);
49 lok(ret, "DeleteFile failed: %lu\n", GetLastError());
51 return ret;
54 static BOOL write_file(const char *fname, const void *str, DWORD size)
56 HANDLE file;
57 BOOL ret;
58 DWORD written;
60 file = CreateFileA(fname, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
61 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
62 if (file == INVALID_HANDLE_VALUE)
63 return FALSE;
65 ret = WriteFile(file, str, size, &written, NULL);
66 ok(ret, "WriteFile failed: %lu\n", GetLastError());
67 CloseHandle(file);
69 return ret;
72 static BOOL write_reg_file(const char *fname, const char *contents, BOOL unicode)
74 int lenA;
75 BOOL ret;
77 lenA = strlen(contents);
79 if (unicode)
81 int len = MultiByteToWideChar(CP_UTF8, 0, contents, lenA, NULL, 0);
82 DWORD size = len * sizeof(WCHAR);
83 WCHAR *wstr = HeapAlloc(GetProcessHeap(), 0, size);
84 if (!wstr) return FALSE;
85 MultiByteToWideChar(CP_UTF8, 0, contents, lenA, wstr, len);
87 ret = write_file(fname, wstr, size);
88 HeapFree(GetProcessHeap(), 0, wstr);
90 else
91 ret = write_file(fname, contents, lenA);
93 return ret;
96 BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc)
98 BOOL ret;
100 ret = write_reg_file("test.reg", contents, unicode);
101 if (!ret) return FALSE;
103 run_reg_exe("reg import test.reg", rc);
105 delete_file("test.reg");
107 return ret;
110 /* Unit tests */
112 static void test_command_syntax(void)
114 DWORD r;
116 run_reg_exe("reg import", &r);
117 ok(r == REG_EXIT_FAILURE, "got exit code %ld, expected 1\n", r);
119 run_reg_exe("reg import /?", &r);
120 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
122 run_reg_exe("reg import /h", &r);
123 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
125 run_reg_exe("reg import -H", &r);
126 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
128 run_reg_exe("reg import missing.reg", &r);
129 ok(r == REG_EXIT_FAILURE, "got exit code %ld, expected 1\n", r);
131 run_reg_exe("reg import a.reg b.reg", &r);
132 ok(r == REG_EXIT_FAILURE, "got exit code %ld, expected 1\n", r);
134 run_reg_exe("reg import foo.reg /reg:32 /reg:32", &r);
135 ok(r == REG_EXIT_FAILURE, "got exit code %ld, expected 1\n", r);
137 run_reg_exe("reg import foo.reg /reg:32 /reg:64", &r);
138 ok(r == REG_EXIT_FAILURE, "got exit code %ld, expected 1\n", r);
140 run_reg_exe("reg import foo.reg /reg:64 /reg:64", &r);
141 ok(r == REG_EXIT_FAILURE, "got exit code %ld, expected 1\n", r);
144 static void test_import(void)
146 DWORD r, dword = 0x123, type, size;
147 char buffer[24];
148 HKEY hkey, subkey = NULL;
149 LONG err;
150 BYTE hex[8];
152 delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0);
154 /* Test file contents */
155 test_import_str("regedit\n", &r);
156 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
157 "got exit code %ld, expected 1\n", r);
159 test_import_str("regedit4\n", &r);
160 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
161 "got exit code %ld, expected 1\n", r);
163 test_import_str("REGEDIT", &r);
164 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
166 test_import_str("REGEDIT\n", &r);
167 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
169 test_import_str("REGEDIT4\n", &r);
170 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
172 test_import_str(" REGEDIT4\n", &r);
173 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
175 test_import_str("\tREGEDIT4\n", &r);
176 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
178 test_import_str("\nREGEDIT4\n", &r);
179 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
180 "got exit code %ld, expected 1\n", r);
182 test_import_str("AREGEDIT4\n", &r);
183 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
184 "got exit code %ld, expected 1\n", r);
186 test_import_str("1REGEDIT4\n", &r);
187 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
188 "got exit code %ld, expected 1\n", r);
190 test_import_str("REGEDIT3\n", &r);
191 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
193 test_import_str("REGEDIT5\n", &r);
194 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
196 test_import_str("REGEDIT9\n", &r);
197 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
199 test_import_str("REGEDIT 4\n", &r);
200 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
202 test_import_str("REGEDIT4 FOO\n", &r);
203 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
205 test_import_str("REGEDIT4\n"
206 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r);
207 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
209 open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey);
211 test_import_str("REGEDIT4\n"
212 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
213 "\"Wine\"=dword:00000123\n\n", &r);
214 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
215 verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0);
217 test_import_str("REGEDIT4\n"
218 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
219 "@=\"Test string\"\n\n", &r);
220 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
221 verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0);
223 test_import_str("REGEDIT3\n\n"
224 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
225 "\"Test1\"=\"Value\"\n", &r);
226 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
227 verify_reg_nonexist(hkey, "Test1");
229 test_import_str("regedit4\n\n"
230 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
231 "\"Test2\"=\"Value\"\n", &r);
232 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
233 "got exit code %ld, expected 1\n", r);
234 verify_reg_nonexist(hkey, "Test2");
236 test_import_str("Regedit4\n\n"
237 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
238 "\"Test3\"=\"Value\"\n", &r);
239 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
240 "got exit code %ld, expected 1\n", r);
241 verify_reg_nonexist(hkey, "Test3");
243 test_import_str("REGEDIT 4\n\n"
244 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
245 "\"Test4\"=\"Value\"\n", &r);
246 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
247 verify_reg_nonexist(hkey, "Test4");
249 test_import_str("REGEDIT4FOO\n\n"
250 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
251 "\"Test5\"=\"Value\"\n", &r);
252 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
253 verify_reg_nonexist(hkey, "Test5");
255 test_import_str("REGEDIT4 FOO\n\n"
256 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
257 "\"Test6\"=\"Value\"\n", &r);
258 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
259 verify_reg_nonexist(hkey, "Test6");
261 test_import_str("REGEDIT5\n\n"
262 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
263 "\"Test7\"=\"Value\"\n", &r);
264 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
265 verify_reg_nonexist(hkey, "Test7");
267 test_import_str("REGEDIT9\n\n"
268 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
269 "\"Test8\"=\"Value\"\n", &r);
270 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
271 verify_reg_nonexist(hkey, "Test8");
273 test_import_str("Windows Registry Editor Version 4.00\n\n"
274 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
275 "\"Test9\"=\"Value\"\n", &r);
276 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
277 "got exit code %ld, expected 1\n", r);
278 verify_reg_nonexist(hkey, "Test9");
280 test_import_str("Windows Registry Editor Version 5\n\n"
281 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
282 "\"Test10\"=\"Value\"\n", &r);
283 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
284 "got exit code %ld, expected 1\n", r);
285 verify_reg_nonexist(hkey, "Test10");
287 test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
288 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
289 "\"Test11\"=\"Value\"\n", &r);
290 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
291 "got exit code %ld, expected 1\n", r);
292 verify_reg_nonexist(hkey, "Test11");
294 test_import_str("Windows Registry Editor version 5.00\n\n"
295 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
296 "\"Test12\"=\"Value\"\n", &r);
297 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
298 "got exit code %ld, expected 1\n", r);
299 verify_reg_nonexist(hkey, "Test12");
301 test_import_str("REGEDIT4\n"
302 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
303 "\"Test1\"=\"Value1\"\n", &r);
304 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
305 verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0);
307 test_import_str("REGEDIT4\n"
308 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
309 "\"Test2\"=\"Value2\"\n\n", &r);
310 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
311 verify_reg(hkey, "Test2", REG_SZ, "Value2", 7, 0);
313 test_import_str("REGEDIT4\n\n"
314 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
315 "\"Test3\"=\"Value3\"\n\n", &r);
316 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
317 verify_reg(hkey, "Test3", REG_SZ, "Value3", 7, 0);
319 test_import_str("Windows Registry Editor Version 4.00\n", &r);
320 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
321 "got exit code %ld, expected 1\n", r);
323 test_import_str("Windows Registry Editor Version 5.00\n", &r);
324 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
326 test_import_str("Windows Registry Editor Version 5.00\n"
327 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
328 "\"Test4\"=\"Value4\"\n", &r);
329 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
330 verify_reg(hkey, "Test4", REG_SZ, "Value4", 7, 0);
332 test_import_str("Windows Registry Editor Version 5.00\n"
333 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
334 "\"Test5\"=\"Value5\"\n\n", &r);
335 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
336 verify_reg(hkey, "Test5", REG_SZ, "Value5", 7, 0);
338 test_import_str("Windows Registry Editor Version 5.00\n\n"
339 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
340 "\"Test6\"=\"Value6\"\n\n", &r);
341 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
342 verify_reg(hkey, "Test6", REG_SZ, "Value6", 7, 0);
344 test_import_str("REGEDIT4\n\n"
345 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
346 "\"Line1\"=\"Value1\"\n\n"
347 "\"Line2\"=\"Value2\"\n\n\n"
348 "\"Line3\"=\"Value3\"\n\n\n\n"
349 "\"Line4\"=\"Value4\"\n\n", &r);
350 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
351 verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0);
352 verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0);
353 verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0);
354 verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0);
356 test_import_str("REGEDIT4\n\n"
357 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
358 "\"Wine1\"=dword:00000782\n\n"
359 "\"Wine2\"=\"Test Value\"\n"
360 "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n"
361 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
362 "#comment\n"
363 "@=\"Test\"\n"
364 ";comment\n\n"
365 "\"Wine4\"=dword:12345678\n\n", &r);
366 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
367 dword = 0x782;
368 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
369 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
370 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
371 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
372 dword = 0x12345678;
373 verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0);
375 test_import_str("REGEDIT4\n\n"
376 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
377 "\"Wine5\"=\"No newline\"", &r);
378 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
379 err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL);
380 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
381 "got exit code %ld, expected 0\n", err);
382 if (err == ERROR_SUCCESS)
383 verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
385 test_import_str("REGEDIT4\n\n"
386 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
387 "\"Wine6\"=dword:00000050\n\n"
388 "\"Wine7\"=\"No newline\"", &r);
389 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
390 dword = 0x50;
391 verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0);
392 err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL);
393 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
394 "got exit code %ld, expected 0\n", err);
395 if (err == ERROR_SUCCESS)
396 verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
398 test_import_str("REGEDIT4\n\n"
399 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
400 "#comment\\\n"
401 "\"Wine8\"=\"Line 1\"\n"
402 ";comment\\\n"
403 "\"Wine9\"=\"Line 2\"\n\n", &r);
404 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
405 verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0);
406 verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0);
408 test_import_str("REGEDIT4\n\n"
409 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
410 "\"Wine10\"=\"Value 1\"#comment\n"
411 "\"Wine11\"=\"Value 2\";comment\n"
412 "\"Wine12\"=dword:01020304 #comment\n"
413 "\"Wine13\"=dword:02040608 ;comment\n\n", &r);
414 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
415 verify_reg_nonexist(hkey, "Wine10");
416 verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0);
417 verify_reg_nonexist(hkey, "Wine12");
418 dword = 0x2040608;
419 verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0);
421 test_import_str("REGEDIT4\n\n"
422 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
423 "\"Wine14\"=hex(7):4c,69,6e,65,20,\\\n"
424 " #comment\n"
425 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
426 "\"Wine15\"=\"A valid line\"\n"
427 "\"Wine16\"=hex(7):4c,69,6e,65,20,\\\n"
428 " ;comment\n"
429 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
430 "\"Wine17\"=\"Another valid line\"\n\n", &r);
431 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
432 verify_reg_nonexist(hkey, "Wine14");
433 verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0);
434 verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
435 verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0);
437 test_import_str("REGEDIT4\n\n"
438 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
439 "#\"Comment1\"=\"Value 1\"\n"
440 ";\"Comment2\"=\"Value 2\"\n"
441 " #\"Comment3\"=\"Value 3\"\n"
442 " ;\"Comment4\"=\"Value 4\"\n"
443 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
444 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r);
445 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
446 verify_reg_nonexist(hkey, "Comment1");
447 verify_reg_nonexist(hkey, "Comment2");
448 verify_reg_nonexist(hkey, "Comment3");
449 verify_reg_nonexist(hkey, "Comment4");
450 verify_reg_nonexist(hkey, "Wine18");
451 verify_reg_nonexist(hkey, "Comment5");
452 verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0);
453 verify_reg_nonexist(hkey, "Comment6");
455 test_import_str("REGEDIT4\n\n"
456 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
457 "\"Wine20\"=#\"Value 8\"\n"
458 "\"Wine21\"=;\"Value 9\"\n"
459 "\"Wine22\"=\"#comment1\"\n"
460 "\"Wine23\"=\";comment2\"\n"
461 "\"Wine24\"=\"Value#comment3\"\n"
462 "\"Wine25\"=\"Value;comment4\"\n"
463 "\"Wine26\"=\"Value #comment5\"\n"
464 "\"Wine27\"=\"Value ;comment6\"\n"
465 "\"Wine28\"=#dword:00000001\n"
466 "\"Wine29\"=;dword:00000002\n"
467 "\"Wine30\"=dword:00000003#comment\n"
468 "\"Wine31\"=dword:00000004;comment\n\n", &r);
469 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
470 verify_reg_nonexist(hkey, "Wine20");
471 verify_reg_nonexist(hkey, "Wine21");
472 verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0);
473 verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0);
474 verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0);
475 verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0);
476 verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0);
477 verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0);
478 verify_reg_nonexist(hkey, "Wine28");
479 verify_reg_nonexist(hkey, "Wine29");
480 verify_reg_nonexist(hkey, "Wine30");
481 dword = 0x00000004;
482 verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0);
484 test_import_str("REGEDIT4\n\n"
485 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
486 "\"Multi-Line1\"=hex(7):4c,69,6e,65,20,\\\n"
487 " 63,6f,6e,\\;comment\n"
488 " 63,61,74,\\;comment\n"
489 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
490 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
491 verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
493 test_import_str("REGEDIT4\n\n"
494 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
495 "\"Multi-Line2\"=hex(7):4c,69,6e,65,20,\\\n"
496 " 63,6f,6e,\\;comment\n"
497 " 63,61,74,;comment\n"
498 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
499 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
500 verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
502 test_import_str("REGEDIT4\n\n"
503 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
504 "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
505 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
506 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
507 verify_reg_nonexist(hkey, "Multi-Line3");
509 test_import_str("REGEDIT4\n\n"
510 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
511 "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
512 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
513 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
514 verify_reg_nonexist(hkey, "Multi-Line4");
516 test_import_str("Windows Registry Editor Version 5.00\n\n"
517 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
518 "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
519 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
520 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
521 verify_reg_nonexist(hkey, "Multi-Line5");
523 test_import_str("Windows Registry Editor Version 5.00\n\n"
524 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
525 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
526 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
527 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
528 verify_reg_nonexist(hkey, "Multi-Line6");
530 test_import_str("REGEDIT4\n\n"
531 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
532 "\"Multi-Line7\"=hex(7):4c,69,6e,\\;comment\n"
533 " 65,20,\\;comment\n"
534 " 63,6f,6e,\\;comment\n"
535 " 63,61,74,\\;comment\n"
536 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
537 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
538 verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
540 test_import_str("REGEDIT4\n\n"
541 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
542 "\"Multi-Line8\"=hex(7):4c,69,6e,\\;#comment\n"
543 " 65,20,\\;#comment\n"
544 " 63,6f,6e,\\;#comment\n"
545 " 63,61,74,\\;#comment\n"
546 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
547 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
548 verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
550 test_import_str("REGEDIT4\n\n"
551 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
552 "\"Multi-Line9\"=hex(7):4c,69,6e,\\;comment\n"
553 " 65,20,\\;comment\n"
554 " 63,6f,6e,\\;comment\n"
555 " 63,61,74,\\#comment\n"
556 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
557 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
558 verify_reg_nonexist(hkey, "Multi-Line9");
560 test_import_str("REGEDIT4\n\n"
561 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
562 "\"Multi-Line10\"=hex(7):4c,69,6e,65,20,\\\n"
563 " 63,6f,6e,\\;comment\n"
564 " 63,61,74,\\\n\n"
565 " 65,6e,\\;comment\n\n"
566 " 61,74,69,6f,6e,00,00\n\n", &r);
567 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
568 verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
570 test_import_str("REGEDIT4\n\n"
571 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
572 "\"Wine32a\"=dword:1\n"
573 "\"Wine32b\"=dword:4444\n\n", &r);
574 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
575 dword = 0x1;
576 verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0);
577 dword = 0x4444;
578 verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0);
580 test_import_str("REGEDIT4\n\n"
581 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
582 "\"Wine33a\"=dword:\n"
583 "\"Wine33b\"=dword:hello\n"
584 "\"Wine33c\"=dword:123456789\n"
585 "\"Wine33d\"=dword:012345678\n"
586 "\"Wine33e\"=dword:000000001\n\n", &r);
587 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
588 verify_reg_nonexist(hkey, "Wine33a");
589 verify_reg_nonexist(hkey, "Wine33b");
590 verify_reg_nonexist(hkey, "Wine33c");
591 verify_reg_nonexist(hkey, "Wine33d");
592 verify_reg_nonexist(hkey, "Wine33e");
594 test_import_str("REGEDIT4\n\n"
595 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
596 "\"Wine34a\"=dword:12345678abc\n"
597 "\"Wine34b\"=dword:12345678 abc\n\n", &r);
598 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
599 verify_reg_nonexist(hkey, "Wine34a");
600 verify_reg_nonexist(hkey, "Wine34b");
602 test_import_str("REGEDIT4\n\n"
603 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
604 "\"Wine35a\"=dword:0x123\n"
605 "\"Wine35b\"=dword:123 456\n"
606 "\"Wine35c\"=dword:1234 5678\n\n", &r);
607 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
608 verify_reg_nonexist(hkey, "Wine35a");
609 verify_reg_nonexist(hkey, "Wine35b");
610 verify_reg_nonexist(hkey, "Wine35c");
612 test_import_str("REGEDIT4\n\n"
613 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
614 "\"Wine36a\"=dword:1234;5678\n"
615 "\"Wine36b\"=dword:1234 ;5678\n"
616 "\"Wine36c\"=dword:1234#5678\n"
617 "\"Wine36d\"=dword:1234 #5678\n\n", &r);
618 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
619 dword = 0x1234;
620 verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0);
621 verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0);
622 verify_reg_nonexist(hkey, "Wine36c");
623 verify_reg_nonexist(hkey, "Wine36d");
625 test_import_str("REGEDIT4\n\n"
626 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
627 "\"Wine37a\"=\"foo\"bar\"\n"
628 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r);
629 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
630 verify_reg_nonexist(hkey, "Wine37a");
631 verify_reg_nonexist(hkey, "Wine37b");
633 test_import_str("REGEDIT4\n\n"
634 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
635 "\"Empty string\"=\"\"\n"
636 "\"\"=\"Default Value Name\"\n\n", &r);
637 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
638 verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0);
639 verify_reg(hkey, NULL, REG_SZ, "Default Value Name", 19, 0);
641 test_import_str("REGEDIT4\n\n"
642 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
643 "\"Test38a\"=\n"
644 "\"Test38b\"=\\\"\n"
645 "\"Test38c\"=\\\"Value\\\"\n"
646 "\"Test38d\"=\\\"Value\"\n\n", &r);
647 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
648 verify_reg_nonexist(hkey, "Test38a");
649 verify_reg_nonexist(hkey, "Test38b");
650 verify_reg_nonexist(hkey, "Test38c");
651 verify_reg_nonexist(hkey, "Test38d");
653 test_import_str("REGEDIT4\n\n"
654 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
655 "\"Wine39a\"=\"Value1\" ;comment\n"
656 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
657 "\"Wine39c\"=\"Value3\" #comment\n"
658 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r);
659 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
660 verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0);
661 verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0);
662 verify_reg_nonexist(hkey, "Wine39c");
663 verify_reg_nonexist(hkey, "Wine39d");
665 test_import_str("REGEDIT4\n\n"
666 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
667 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r);
668 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
669 verify_reg_nonexist(hkey, "TestNoBeginQuote");
671 test_import_str("REGEDIT4\n\n"
672 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
673 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r);
674 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
675 verify_reg_nonexist(hkey, "TestNoEndQuote");
677 test_import_str("REGEDIT4\n\n"
678 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
679 "\"TestNoQuotes\"=Asdffdsa\n", &r);
680 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
681 verify_reg_nonexist(hkey, "TestNoQuotes");
683 test_import_str("REGEDIT4\n\n"
684 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
685 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r);
686 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
687 verify_reg_nonexist(hkey, "NameNoBeginQuote");
689 test_import_str("REGEDIT4\n\n"
690 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
691 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r);
692 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
693 verify_reg_nonexist(hkey, "NameNoEndQuote");
695 test_import_str("REGEDIT4\n\n"
696 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
697 "NameNoQuotes=\"Asdffdsa\"\n", &r);
698 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
699 verify_reg_nonexist(hkey, "NameNoQuotes");
701 test_import_str("REGEDIT4\n\n"
702 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
703 "\"MixedQuotes=Asdffdsa\"\n", &r);
704 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
705 verify_reg_nonexist(hkey, "MixedQuotes");
706 verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa");
708 test_import_str("REGEDIT4\n\n"
709 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
710 "\"Wine40a\"=hex(2):4c,69,6e,65,00\n"
711 "\"Wine40b\"=\"Value 1\"\n"
712 "\"Wine40c\"=hex(2):4c,69,6e,65\\\n"
713 "\"Wine40d\"=\"Value 2\"\n"
714 "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n"
715 "\"Wine40f\"=\"Value 3\"\n"
716 "\"Wine40g\"=\"Value 4\"\n\n", &r);
717 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
718 verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0);
719 verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0);
720 verify_reg_nonexist(hkey, "Wine40c");
721 verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0);
722 verify_reg_nonexist(hkey, "Wine40e");
723 verify_reg_nonexist(hkey, "Wine40f");
724 verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0);
726 test_import_str("REGEDIT4\n\n"
727 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
728 "\"Wine41a\"=dword:1234\\\n"
729 "5678\n"
730 "\"Wine41b\"=\"Test \\\n"
731 "Value\"\n\n", &r);
732 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
733 verify_reg_nonexist(hkey, "Wine41a");
734 verify_reg_nonexist(hkey, "Wine41b");
736 test_import_str("REGEDIT4\n\n"
737 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
738 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
739 "\"single'quote\"=dword:00000008\n\n", &r);
740 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
741 verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0);
742 dword = 0x00000008;
743 verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0);
745 /* Test key name and value name concatenation */
746 test_import_str("REGEDIT4\n\n"
747 "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n"
748 "Subkey1]\n", &r);
749 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
750 verify_key_nonexist(hkey, "Subkey1", 0);
752 test_import_str("REGEDIT4\n\n"
753 "[HKEY_CURRENT_USER\\" KEY_BASE "\n"
754 "\\Subkey2]\n", &r);
755 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
756 verify_key_nonexist(hkey, "Subkey2", 0);
758 test_import_str("REGEDIT4\n\n"
759 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
760 "\"Wine\\\n"
761 "42a\"=\"Value 1\"\n"
762 "\"Wine42b\"=\"Value 2\"\n"
763 "\"Wine\n"
764 "\\42c\"=\"Value 3\"\n\n", &r);
765 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
766 verify_reg_nonexist(hkey, "Wine42a");
767 verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0);
768 verify_reg_nonexist(hkey, "Wine42c");
770 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
771 test_import_str("REGEDIT4\n\n"
772 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
773 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
774 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
775 " 75,00,65,00,00,00\n"
776 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
777 ",75,00,65,00,00,00\n"
778 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
779 " ,75,00,65,00,00,00\n"
780 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
781 " 75,00,65,00,00,00\n"
782 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
783 "5,00,65,00,00,00\n"
784 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
785 " 5,00,65,00,00,00\n"
786 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
787 " 6c,00,75,00,\\\n"
788 " 65,00,00,00\n"
789 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
790 " 6c,00,75,00,\n"
791 " 65,00,00,00\n"
792 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
793 " 6c,00,75,00,;comment\n"
794 " 65,00,00,00\n"
795 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
796 " 6c,00,75,00,\\#comment\n"
797 " 65,00,00,00\n\n", &r);
798 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
799 verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
800 verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
801 verify_reg_nonexist(hkey, "Wine43c");
802 verify_reg_nonexist(hkey, "Wine43d");
803 verify_reg_nonexist(hkey, "Wine43e");
804 verify_reg_nonexist(hkey, "Wine43f");
805 verify_reg_nonexist(hkey, "Wine43g");
806 verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
807 verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0);
808 verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0);
809 verify_reg_nonexist(hkey, "Wine43k");
811 test_import_str("REGEDIT4\n\n"
812 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
813 "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n"
814 "\"Wine44b\"=hex(2):25,50,41,\\\n"
815 " 54,48,25,00\n"
816 "\"Wine44c\"=hex(2):25,50,41\\\n"
817 ",54,48,25,00\n"
818 "\"Wine44d\"=hex(2):25,50,41\\\n"
819 " ,54,48,25,00\n"
820 "\"Wine44e\"=hex(2):25,50,41\\\n"
821 " 54,48,25,00\n"
822 "\"Wine44f\"=hex(2):25,50,4\\\n"
823 "1,54,48,25,00\n"
824 "\"Wine44g\"=hex(2):25,50,4\\\n"
825 " 1,54,48,25,00\n"
826 "\"Wine44h\"=hex(2):25,50,41,\\;comment\n"
827 " 54,48,\\\n"
828 " 25,00\n"
829 "\"Wine44i\"=hex(2):25,50,41,\\;comment\n"
830 " 54,48,\n"
831 " 25,00\n"
832 "\"Wine44j\"=hex(2):25,50,41,\\;comment\n"
833 " 54,48,;comment\n"
834 " 25,00\n"
835 "\"Wine44k\"=hex(2):25,50,41,\\;comment\n"
836 " 54,48,\\#comment\n"
837 " 25,00\n\n", &r);
838 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
839 verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0);
840 verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0);
841 verify_reg_nonexist(hkey, "Wine44c");
842 verify_reg_nonexist(hkey, "Wine44d");
843 verify_reg_nonexist(hkey, "Wine44e");
844 verify_reg_nonexist(hkey, "Wine44f");
845 verify_reg_nonexist(hkey, "Wine44g");
846 verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0);
847 /* Wine44i */
848 size = sizeof(buffer);
849 err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size);
850 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
851 ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
852 ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %lu, expected 6\n", size);
853 ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
854 /* Wine44j */
855 size = sizeof(buffer);
856 memset(buffer, '-', size);
857 err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size);
858 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
859 ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
860 ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %lu, expected 6\n", size);
861 ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
862 /* Wine44k */
863 verify_reg_nonexist(hkey, "Wine44k");
865 test_import_str("REGEDIT4\n\n"
866 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
867 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
868 "\"Wine45b\"=hex:11,22,33,44,\\\n"
869 " 55,66,77,88\n"
870 "\"Wine45c\"=hex:11,22,33,44\\\n"
871 ",55,66,77,88\n"
872 "\"Wine45d\"=hex:11,22,33,44\\\n"
873 " ,55,66,77,88\n"
874 "\"Wine45e\"=hex:11,22,33,44\\\n"
875 " 55,66,77,88\n"
876 "\"Wine45f\"=hex:11,22,33,4\\\n"
877 "4,55,66,77,88\n"
878 "\"Wine45g\"=hex:11,22,33,4\\\n"
879 " 4,55,66,77,88\n"
880 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
881 " 55,66,\\\n"
882 " 77,88\n"
883 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
884 " 55,66,\n"
885 " 77,88\n"
886 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
887 " 55,66,;comment\n"
888 " 77,88\n"
889 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
890 " 44,55,66,\\#comment\n"
891 " 77,88\n\n", &r);
892 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
893 hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44;
894 hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88;
895 verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0);
896 verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0);
897 verify_reg_nonexist(hkey, "Wine45c");
898 verify_reg_nonexist(hkey, "Wine45d");
899 verify_reg_nonexist(hkey, "Wine45e");
900 verify_reg_nonexist(hkey, "Wine45f");
901 verify_reg_nonexist(hkey, "Wine45g");
902 verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0);
903 verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0);
904 verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0);
905 verify_reg_nonexist(hkey, "Wine45k");
907 /* Test import with subkeys */
908 test_import_str("REGEDIT4\n\n"
909 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n"
910 "\"Wine\\\\31\"=\"Test value\"\n\n", &r);
911 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
912 open_key(hkey, "Subkey\"1", 0, &subkey);
913 verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0);
914 close_key(subkey);
915 delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1", 0);
917 test_import_str("REGEDIT4\n\n"
918 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n"
919 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r);
920 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
921 open_key(hkey, "Subkey/2", 0, &subkey);
922 verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0);
923 close_key(subkey);
924 delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2", 0);
926 /* Test key creation */
927 test_import_str("REGEDIT4\n\n"
928 "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r);
929 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
930 verify_key_nonexist(hkey, "No_Opening_Bracket", 0);
932 test_import_str("REGEDIT4\n\n"
933 "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r);
934 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
935 verify_key_nonexist(hkey, "No_Closing_Bracket", 0);
937 test_import_str("REGEDIT4\n\n"
938 "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r);
939 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
940 verify_key_nonexist(hkey, "Subkey1a", 0);
942 test_import_str("REGEDIT4\n\n"
943 "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r);
944 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
945 verify_key_nonexist(hkey, "Subkey1b", 0);
947 test_import_str("REGEDIT4\n\n"
948 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r);
949 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
950 verify_key(hkey, "Subkey1c ", 0);
951 delete_key(hkey, "Subkey1c ", 0);
953 test_import_str("REGEDIT4\n\n"
954 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r);
955 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
956 verify_key(hkey, "Subkey1d\t", 0);
957 delete_key(hkey, "Subkey1d\t", 0);
959 test_import_str("REGEDIT4\n\n"
960 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n"
961 "\"Wine\"=\"Test value\"\n\n", &r);
962 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
963 verify_key(hkey, "Subkey1e\\", 0);
964 verify_key(hkey, "Subkey1e", 0);
965 open_key(hkey, "Subkey1e", 0, &subkey);
966 verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
967 close_key(subkey);
968 delete_key(hkey, "Subkey1e", 0);
970 test_import_str("REGEDIT4\n\n"
971 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n"
972 "\"Wine\"=\"Test value\"\n\n", &r);
973 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
974 verify_key(hkey, "Subkey1f\\\\", 0);
975 verify_key(hkey, "Subkey1f\\", 0);
976 verify_key(hkey, "Subkey1f", 0);
977 open_key(hkey, "Subkey1f\\\\", 0, &subkey);
978 verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
979 close_key(subkey);
980 delete_key(hkey, "Subkey1f\\\\", 0);
982 test_import_str("REGEDIT4\n\n"
983 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n"
984 "\"Wine\"=\"Test value\"\n\n", &r);
985 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
986 verify_key(hkey, "Subkey1g\\\\\\\\", 0);
987 verify_key(hkey, "Subkey1g\\\\", 0);
988 verify_key(hkey, "Subkey1g\\", 0);
989 verify_key(hkey, "Subkey1g", 0);
990 open_key(hkey, "Subkey1g\\\\", 0, &subkey);
991 verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
992 close_key(subkey);
993 delete_key(hkey, "Subkey1g\\\\", 0);
995 /* Test key deletion. We start by creating some registry keys. */
996 test_import_str("REGEDIT4\n\n"
997 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
998 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
999 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1000 verify_key(hkey, "Subkey2a", 0);
1001 verify_key(hkey, "Subkey2b", 0);
1003 test_import_str("REGEDIT4\n\n"
1004 "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
1005 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1006 verify_key(hkey, "Subkey2a", 0);
1008 test_import_str("REGEDIT4\n\n"
1009 "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
1010 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1011 verify_key(hkey, "Subkey2b", 0);
1013 test_import_str("REGEDIT4\n\n"
1014 "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
1015 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1016 verify_key(hkey, "Subkey2a", 0);
1018 test_import_str("REGEDIT4\n\n"
1019 "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
1020 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1021 verify_key(hkey, "Subkey2b", 0);
1023 test_import_str("REGEDIT4\n\n"
1024 "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
1025 "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
1026 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1027 verify_key_nonexist(hkey, "Subkey2a", 0);
1028 verify_key_nonexist(hkey, "Subkey2b", 0);
1030 /* Test case sensitivity when creating and deleting registry keys. */
1031 test_import_str("REGEDIT4\n\n"
1032 "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n"
1033 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r);
1034 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1035 verify_key(hkey, "Subkey3a", 0);
1036 verify_key(hkey, "Subkey3b", 0);
1038 test_import_str("REGEDIT4\n\n"
1039 "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n"
1040 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r);
1041 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1042 verify_key_nonexist(hkey, "Subkey3a", 0);
1043 verify_key_nonexist(hkey, "Subkey3b", 0);
1045 /* Test mixed key creation and deletion. We start by creating a subkey. */
1046 test_import_str("REGEDIT4\n\n"
1047 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r);
1048 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1049 verify_key(hkey, "Subkey4a", 0);
1051 test_import_str("REGEDIT4\n\n"
1052 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
1053 "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n"
1054 "\"Wine46a\"=dword:12345678\n\n", &r);
1055 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1056 verify_key_nonexist(hkey, "Subkey4a", 0);
1057 verify_reg_nonexist(hkey, "Wine46a");
1059 test_import_str("REGEDIT4\n\n"
1060 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
1061 "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n"
1062 "\"Wine46b\"=dword:12345678\n\n", &r);
1063 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1064 verify_key_nonexist(hkey, "Subkey4b", 0);
1065 verify_reg_nonexist(hkey, "Wine46b");
1067 /* Test value deletion. We start by creating some registry values. */
1068 test_import_str("REGEDIT4\n\n"
1069 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1070 "\"Wine46a\"=\"Test Value\"\n"
1071 "\"Wine46b\"=dword:00000008\n"
1072 "\"Wine46c\"=hex:11,22,33,44\n"
1073 "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n"
1074 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1075 "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n"
1076 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r);
1077 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1078 verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0);
1079 verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0);
1080 verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0);
1081 verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1082 verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0);
1083 verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
1085 test_import_str("REGEDIT4\n\n"
1086 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1087 "\"Wine46a\"=-\n"
1088 "\"Wine46b\"= -\n"
1089 "\"Wine46c\"= \t-\t \n"
1090 "\"Wine46d\"=-\"Test\"\n"
1091 "\"Wine46e\"=- ;comment\n"
1092 "\"Wine46f\"=- #comment\n\n", &r);
1093 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1094 verify_reg_nonexist(hkey, "Wine46a");
1095 verify_reg_nonexist(hkey, "Wine46b");
1096 verify_reg_nonexist(hkey, "Wine46c");
1097 verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1098 verify_reg_nonexist(hkey, "Wine46e");
1099 verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
1101 /* Test the accepted range of the hex-based data types */
1102 test_import_str("REGEDIT4\n\n"
1103 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1104 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
1105 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
1106 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
1107 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
1108 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
1109 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
1110 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
1111 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
1112 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n"
1113 "\"Wine47j\"=hex(0x2):56,61,6c,75,65,00\n"
1114 "\"Wine47k\"=hex(0X2):56,61,6c,75,65,00\n"
1115 "\"Wine47l\"=hex(x2):56,61,6c,75,65,00\n\n", &r);
1116 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1117 verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0);
1118 verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0);
1119 verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0);
1120 verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0);
1121 verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0);
1122 verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0);
1123 verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0);
1124 verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0);
1125 verify_reg_nonexist(hkey, "Wine47i");
1126 verify_reg_nonexist(hkey, "Wine47j");
1127 verify_reg_nonexist(hkey, "Wine47k");
1128 verify_reg_nonexist(hkey, "Wine47l");
1130 test_import_str("REGEDIT4\n\n"
1131 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1132 "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n"
1133 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1134 "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n"
1135 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1136 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1137 verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1138 verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1140 test_import_str("REGEDIT4\n\n"
1141 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1142 "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\n\n", &r);
1143 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1144 verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0);
1146 test_import_str("REGEDIT4\n\n"
1147 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1148 "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n"
1149 "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n"
1150 "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n"
1151 "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r);
1152 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1153 verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0);
1154 verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0);
1155 verify_reg_nonexist(hkey, "Wine50c");
1156 verify_reg_nonexist(hkey, "Wine50d");
1158 /* Test support for characters greater than 0xff */
1159 test_import_str("REGEDIT4\n\n"
1160 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1161 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
1162 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r);
1163 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1164 verify_reg_nonexist(hkey, "Wine51a");
1165 verify_reg_nonexist(hkey, "Wine51b");
1167 /* Test the effect of backslashes in hex data */
1168 test_import_str("REGEDIT4\n\n"
1169 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1170 "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n"
1171 "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n"
1172 "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n"
1173 "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n"
1174 "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n"
1175 "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n"
1176 "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n"
1177 "\"Wine52h\"=hex(2):25,48,4\\\n"
1178 " f,4d,45,25,00\n"
1179 "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n"
1180 "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n"
1181 " 25,50,41,54,48,25,00\n"
1182 "\"Wine52k\"=hex(2):,\\\n"
1183 " 25,48,4f,4d,45,25,00\n"
1184 "\"Wine52l\"=hex(2):\\\n"
1185 " 25,48,4f,4d,45,25,00\n\n", &r);
1186 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1187 verify_reg_nonexist(hkey, "Wine52a");
1188 verify_reg_nonexist(hkey, "Wine52b");
1189 verify_reg_nonexist(hkey, "Wine52c");
1190 verify_reg_nonexist(hkey, "Wine52d");
1191 verify_reg_nonexist(hkey, "Wine52e");
1192 verify_reg_nonexist(hkey, "Wine52f");
1193 verify_reg_nonexist(hkey, "Wine52g");
1194 verify_reg_nonexist(hkey, "Wine52h");
1195 verify_reg_nonexist(hkey, "Wine52i");
1196 verify_reg_nonexist(hkey, "Wine52j");
1197 verify_reg_nonexist(hkey, "Wine52k");
1198 verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0);
1200 test_import_str("REGEDIT4\n\n"
1201 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1202 "\"Wine53a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1203 " 25,50,41,54,48,25,00\n"
1204 "\"Wine53b\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
1205 " 25,50,41,54,48,25,00\n"
1206 "\"Wine53c\"=hex(2):25,48,4f,4d,45,25,5c, \\ ;comment\n"
1207 " 25,50,41,54,48,25,00\n"
1208 "\"Wine53d\"=hex(2):25,48,4f,4d,45,25,5c \\ ;comment\n"
1209 " 25,50,41,54,48,25,00\n"
1210 "\"Wine53e\"=hex(2):25,48,4f,4d,45,25,5c,\\\t ;comment\n"
1211 " 25,50,41,54,48,25,00\n"
1212 "\"Wine53f\"=hex(2):25,48,4f,4d,45,25,5c\\\t ;comment\n"
1213 " 25,50,41,54,48,25,00\n\n", &r);
1214 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1215 verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
1216 verify_reg_nonexist(hkey, "Wine53b");
1217 verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
1218 verify_reg_nonexist(hkey, "Wine53d");
1219 verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
1220 verify_reg_nonexist(hkey, "Wine53f");
1222 test_import_str("REGEDIT4\n\n"
1223 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1224 "\"Wine54a\"=hex(2):4c,69,6e,65,20,\\\n"
1225 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r);
1226 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1227 verify_reg_nonexist(hkey, "Wine54a");
1228 verify_key_nonexist(hkey, "Subkey1", 0);
1230 test_import_str("REGEDIT4\n\n"
1231 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1232 "\"Wine54b\"=hex(2):4c,69,6e,65,20\\\n"
1233 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r);
1234 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1235 verify_reg_nonexist(hkey, "Wine54b");
1236 verify_key(hkey, "Subkey2", 0);
1238 delete_key(hkey, "Subkey2", 0);
1240 test_import_str("REGEDIT4\n\n"
1241 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1242 "\"Wine55a\"=hex(2):4c,69,6e,65,20,\\\n"
1243 "\"Wine55b\"=\"Test value\"\n"
1245 "\"Wine55c\"=hex(2):4c,69,6e,65,20,\\\n"
1246 ";comment\n"
1247 "\"Wine55d\"=\"Test value\"\n"
1249 "\"Wine55e\"=hex(2):4c,69,6e,65,20,\\\n"
1250 "#comment\n"
1251 "\"Wine55f\"=\"Test value\"\n"
1253 "\"Wine55g\"=hex(2):4c,69,6e,65,20,\\\n\n"
1254 "\"Wine55h\"=\"Test value\"\n"
1256 "\"Wine55i\"=hex(2):4c,69,6e,65,20\\\n"
1257 "\"Wine55j\"=\"Test value\"\n\n", &r);
1258 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1259 verify_reg_nonexist(hkey, "Wine55a");
1260 verify_reg_nonexist(hkey, "Wine55b");
1261 verify_reg_nonexist(hkey, "Wine55c");
1262 verify_reg_nonexist(hkey, "Wine55d");
1263 verify_reg_nonexist(hkey, "Wine55e");
1264 verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0);
1265 verify_reg_nonexist(hkey, "Wine55g");
1266 verify_reg_nonexist(hkey, "Wine55h");
1267 verify_reg_nonexist(hkey, "Wine55i");
1268 verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0);
1270 test_import_str("REGEDIT4\n\n"
1271 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1272 "\"Wine56a\"=hex(2):4c,69,6e,65,20,\\\n"
1273 "\"Wine56b\"=dword:00000008\n"
1275 "\"Wine56c\"=hex(2):4c,69,6e,65,20,\\\n"
1276 ";comment\n"
1277 "\"Wine56d\"=dword:00000008\n"
1279 "\"Wine56e\"=hex(2):4c,69,6e,65,20,\\\n"
1280 "#comment\n"
1281 "\"Wine56f\"=dword:00000008\n"
1283 "\"Wine56g\"=hex(2):4c,69,6e,65,20,\\\n\n"
1284 "\"Wine56h\"=dword:00000008\n"
1286 "\"Wine56i\"=hex(2):4c,69,6e,65,20\\\n"
1287 "\"Wine56j\"=dword:00000008\n\n", &r);
1288 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1289 verify_reg_nonexist(hkey, "Wine56a");
1290 verify_reg_nonexist(hkey, "Wine56b");
1291 verify_reg_nonexist(hkey, "Wine56c");
1292 verify_reg_nonexist(hkey, "Wine56d");
1293 verify_reg_nonexist(hkey, "Wine56e");
1294 verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0);
1295 verify_reg_nonexist(hkey, "Wine56g");
1296 verify_reg_nonexist(hkey, "Wine56h");
1297 verify_reg_nonexist(hkey, "Wine56i");
1298 verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0);
1300 test_import_str("REGEDIT4\n\n"
1301 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1302 "\"Wine57a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1303 "\"Wine57b\"=hex(2):25,50,41,54,48,25,00\n"
1305 "\"Wine57c\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1306 ";comment\n"
1307 "\"Wine57d\"=hex(2):25,50,41,54,48,25,00\n"
1309 "\"Wine57e\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1310 "#comment\n"
1311 "\"Wine57f\"=hex(2):25,50,41,54,48,25,00\n"
1313 "\"Wine57g\"=hex(2):25,48,4f,4d,45,25,5c,\\\n\n"
1314 "\"Wine57h\"=hex(2):25,50,41,54,48,25,00\n"
1316 "\"Wine57i\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
1317 "\"Wine57j\"=hex(2):25,50,41,54,48,25,00\n\n", &r);
1318 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1319 verify_reg_nonexist(hkey, "Wine57a");
1320 verify_reg_nonexist(hkey, "Wine57b");
1321 verify_reg_nonexist(hkey, "Wine57c");
1322 verify_reg_nonexist(hkey, "Wine57d");
1323 verify_reg_nonexist(hkey, "Wine57e");
1324 verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0);
1325 verify_reg_nonexist(hkey, "Wine57g");
1326 verify_reg_nonexist(hkey, "Wine57h");
1327 verify_reg_nonexist(hkey, "Wine57i");
1328 verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0);
1330 delete_value(hkey, NULL);
1332 test_import_str("REGEDIT4\n\n"
1333 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1334 "\"Wine58a\"=hex(2):4c,69,6e,65,20,\\\n"
1335 "@=\"Default value 1\"\n\n", &r);
1336 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1337 verify_reg_nonexist(hkey, "Wine58a");
1338 verify_reg_nonexist(hkey, NULL);
1340 test_import_str("REGEDIT4\n\n"
1341 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1342 "\"Wine58b\"=hex(2):4c,69,6e,65,20,\\\n"
1343 ";comment\n"
1344 "@=\"Default value 2\"\n\n", &r);
1345 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1346 verify_reg_nonexist(hkey, "Wine58b");
1347 verify_reg_nonexist(hkey, NULL);
1349 test_import_str("REGEDIT4\n\n"
1350 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1351 "\"Wine58c\"=hex(2):4c,69,6e,65,20,\\\n"
1352 "#comment\n"
1353 "@=\"Default value 3\"\n\n", &r);
1354 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1355 verify_reg_nonexist(hkey, "Wine58c");
1356 verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0);
1358 delete_value(hkey, NULL);
1360 test_import_str("REGEDIT4\n\n"
1361 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1362 "\"Wine58d\"=hex(2):4c,69,6e,65,20,\\\n\n"
1363 "@=\"Default value 4\"\n\n", &r);
1364 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1365 verify_reg_nonexist(hkey, "Wine58d");
1366 verify_reg_nonexist(hkey, NULL);
1368 test_import_str("REGEDIT4\n\n"
1369 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1370 "\"Wine58e\"=hex(2):4c,69,6e,65,20\\\n"
1371 "@=\"Default value 5\"\n\n", &r);
1372 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1373 verify_reg_nonexist(hkey, "Wine58e");
1374 verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0);
1376 test_import_str("REGEDIT4\n\n"
1377 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1378 "\"Wine59a\"=hex:11,22,33,\\\n"
1379 "\\\n"
1380 " 44,55,66\n"
1381 "\"Wine59b\"=hex:11,22,33,\\\n"
1382 " \\\n"
1383 " 44,55,66\n\n", &r);
1384 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1385 verify_reg_nonexist(hkey, "Wine59a");
1386 verify_reg_nonexist(hkey, "Wine59b");
1388 test_import_str("REGEDIT4\n\n"
1389 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1390 "\"Wine60a\"=hex(7):4c,69,6e,65,20,\\\n"
1391 " 63,6f,6e,63,61,74,\\\n"
1392 ";comment\n"
1393 " 65,6e,\\;comment\n"
1394 " 61,74,69,6f,6e,00,00\n\n", &r);
1395 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1396 verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1398 test_import_str("REGEDIT4\n\n"
1399 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1400 "\"Wine60b\"=hex(7):4c,69,6e,65,20,\\\n"
1401 " 63,6f,6e,63,61,74,\\\n"
1402 " ;comment\n"
1403 " 65,6e,\\;comment\n"
1404 " 61,74,69,6f,6e,00,00\n\n", &r);
1405 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1406 verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1408 test_import_str("REGEDIT4\n\n"
1409 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1410 "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n"
1411 " 63,6f,6e,63,61,74,\\\n"
1412 "#comment\n"
1413 " 65,6e,\\;comment\n"
1414 " 61,74,69,6f,6e,00,00\n\n", &r);
1415 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1416 verify_reg_nonexist(hkey, "Wine60c");
1418 test_import_str("REGEDIT4\n\n"
1419 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1420 "\"Wine60d\"=hex(7):4c,69,6e,65,20,\\\n"
1421 " 63,6f,6e,63,61,74,\\\n"
1422 " #comment\n"
1423 " 65,6e,\\;comment\n"
1424 " 61,74,69,6f,6e,00,00\n\n", &r);
1425 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1426 verify_reg_nonexist(hkey, "Wine60d");
1428 test_import_str("REGEDIT4\n\n"
1429 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1430 "\"Wine60e\"=hex(7):4c,69,6e,65,20,\\\n"
1431 " 63,6f,6e,\\\n\n"
1432 " 63,61,74,\\\n\n\n"
1433 " 65,6e,\\\n\n\n\n"
1434 " 61,74,69,6f,6e,00,00\n\n", &r);
1435 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1436 verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1438 test_import_str("REGEDIT4\n\n"
1439 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1440 "\"Wine60f\"=hex(7):4c,69,6e,65,20,\\\n"
1441 " 63,6f,6e,\\\n \n"
1442 " 63,61,74,\\\n\t\n\t\n"
1443 " 65,6e,\\\n\t \t\n\t \t\n\t \t\n"
1444 " 61,74,69,6f,6e,00,00\n\n", &r);
1445 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1446 verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1448 test_import_str("REGEDIT4\n\n"
1449 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1450 "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n"
1451 " 25,50,41,54,48,25,00\n"
1452 "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n"
1453 " 25,50,41,54,48,25,00\n\n", &r);
1454 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1455 verify_reg_nonexist(hkey, "Wine61a");
1456 verify_reg_nonexist(hkey, "Wine61b");
1458 test_import_str("REGEDIT4\n\n"
1459 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1460 "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r);
1461 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1462 err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL);
1463 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
1464 "got exit code %ld, expected 0\n", err);
1465 if (err == ERROR_SUCCESS)
1466 verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0);
1468 test_import_str("REGEDIT4\n\n"
1469 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1470 "\"Wine62b\"=hex(2):25,50,41,54,48,25,\\", &r);
1471 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1472 err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL);
1473 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
1474 "got exit code %ld, expected 0\n", err);
1475 if (err == ERROR_SUCCESS)
1476 verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0);
1478 test_import_str("REGEDIT4\n\n"
1479 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1480 "\"Wine62c\"=hex:11,22,33,44,55,\\", &r);
1481 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1482 err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL);
1483 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
1484 "got exit code %ld, expected 0\n", err);
1485 if (err == ERROR_SUCCESS)
1486 verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0);
1488 test_import_str("REGEDIT4\n\n"
1489 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1490 "\"Wine62d\"=hex(7):4c,69,6e,65,\\", &r);
1491 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1492 err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL);
1493 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
1494 "got exit code %ld, expected 0\n", err);
1495 if (err == ERROR_SUCCESS)
1496 verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0);
1498 test_import_str("REGEDIT4\n\n"
1499 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1500 "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r);
1501 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1502 err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL);
1503 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
1504 "got exit code %ld, expected 0\n", err);
1505 if (err == ERROR_SUCCESS)
1506 verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0);
1508 test_import_str("REGEDIT4\n\n"
1509 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1510 "\"Wine62f\"=hex(7):4c,69,6e,65,20\\", &r);
1511 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1512 verify_reg_nonexist(hkey, "Wine62f");
1514 test_import_str("REGEDIT4\n\n"
1515 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1516 "\"Wine63a\"=hex(7):4c,69,6e,65,20,\\\n"
1517 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1518 "\"Wine63b\"=hex(7):4c,69,6e,65,20,\\\n"
1519 " 63,,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1520 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1521 verify_reg_nonexist(hkey, "Wine63a");
1522 verify_reg_nonexist(hkey, "Wine63b");
1524 test_import_str("REGEDIT4\n\n"
1525 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1526 "\"Wine64a\"=hex(7):4c,69,6e,65,00,00\n"
1527 "\"Wine64b\"=hex(7):4c,69,6e,65,20,\\\n"
1528 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1529 "\"Wine64c\"=hex(7):4c,69,6e,65,20,\\;comment\n"
1530 " 63,6f,6e,63,61,74,\\\n"
1531 " 65,6e,61,74,69,6f,6e,00,00\n"
1532 "\"Wine64d\"=hex(7):4c,69,6e,65,20,\\;comment\n"
1533 " 63,6f,6e,63,61,74,\n"
1534 " 65,6e,61,74,69,6f,6e,00,00\n"
1535 "\"Wine64e\"=hex(7):4c,69,6e,65,20,\\\n"
1536 " 63,6f,6e,63,61,74,;comment\n"
1537 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1538 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1539 verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0);
1540 verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1541 verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1542 /* Wine64d */
1543 size = sizeof(buffer);
1544 err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size);
1545 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
1546 ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
1547 ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %lu, expected 12\n", size);
1548 ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
1549 /* Wine64e */
1550 size = sizeof(buffer);
1551 err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size);
1552 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
1553 ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
1554 ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %lu, expected 12\n", size);
1555 ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
1557 test_import_str("REGEDIT4\n\n"
1558 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1559 "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n"
1560 "\"Wine65b\"=hex(100):25,50,41,\\\n"
1561 " 54,48,25,00\n"
1562 "\"Wine65c\"=hex(100):25,50,41,\\;comment\n"
1563 " 54,48,\\\n"
1564 " 25,00\n"
1565 "\"Wine65d\"=hex(100):25,50,41,\\;comment\n"
1566 " 54,48,\n"
1567 " 25,00\n"
1568 "\"Wine65e\"=hex(100):25,50,41,\\;comment\n"
1569 " 54,48,;comment\n"
1570 " 25,00\n", &r);
1571 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1572 verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0);
1573 verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0);
1574 verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0);
1575 verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0);
1576 verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0);
1578 /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/
1579 test_import_str("REGEDIT4\n\n"
1580 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1581 "\"Wine66a\"=hex(7):4c,69,6e,65\n"
1582 "\"Wine66b\"=hex(7):4c,69,6e,65,\n"
1583 "\"Wine66c\"=hex(7):4c,69,6e,65,00\n"
1584 "\"Wine66d\"=hex(7):4c,69,6e,65,00,\n"
1585 "\"Wine66e\"=hex(7):4c,69,6e,65,00,00\n"
1586 "\"Wine66f\"=hex(7):4c,69,6e,65,00,00,\n\n", &r);
1587 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1588 verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0);
1589 verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0);
1590 verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0);
1591 verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0);
1592 verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0);
1593 verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0);
1595 test_import_str("REGEDIT4\n\n"
1596 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1597 "\"Wine67a\"=hex(2):25,50,41,54,48,25\n"
1598 "\"Wine67b\"=hex(2):25,50,41,54,48,25,\n"
1599 "\"Wine67c\"=hex(2):25,50,41,54,48,25,00\n"
1600 "\"Wine67d\"=hex(2):25,50,41,54,48,25,00,\n\n", &r);
1601 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1602 verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0);
1603 verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0);
1604 verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0);
1605 verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0);
1607 test_import_str("REGEDIT4\n\n"
1608 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1609 "\"Wine68a\"=hex(1):\n"
1610 "\"Wine68b\"=hex(2):\n"
1611 "\"Wine68c\"=hex(3):\n"
1612 "\"Wine68d\"=hex(4):\n"
1613 "\"Wine68e\"=hex(7):\n"
1614 "\"Wine68f\"=hex(100):\n"
1615 "\"Wine68g\"=hex(abcd):\n"
1616 "\"Wine68h\"=hex:\n"
1617 "\"Wine68i\"=hex(0):\n\n", &r);
1618 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1619 verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0);
1620 verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0);
1621 verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0);
1622 verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0);
1623 verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0);
1624 verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0);
1625 verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
1626 verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
1627 verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0);
1629 /* Test with escaped null characters */
1630 test_import_str("REGEDIT4\n\n"
1631 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1632 "\"Wine69a\"=\"\\\\0\"\n"
1633 "\"Wine69b\"=\"\\\\0\\\\0\"\n"
1634 "\"Wine69c\"=\"Value1\\\\0\"\n"
1635 "\"Wine69d\"=\"Value2\\\\0\\\\0\\\\0\\\\0\"\n"
1636 "\"Wine69e\"=\"Value3\\\\0Value4\"\n"
1637 "\"Wine69f\"=\"\\\\0Value5\"\n\n", &r);
1638 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1639 verify_reg(hkey, "Wine69a", REG_SZ, "\\0", 3, 0);
1640 verify_reg(hkey, "Wine69b", REG_SZ, "\\0\\0", 5, 0);
1641 verify_reg(hkey, "Wine69c", REG_SZ, "Value1\\0", 9, 0);
1642 verify_reg(hkey, "Wine69d", REG_SZ, "Value2\\0\\0\\0\\0", 15, 0);
1643 verify_reg(hkey, "Wine69e", REG_SZ, "Value3\\0Value4", 15, 0);
1644 verify_reg(hkey, "Wine69f", REG_SZ, "\\0Value5", 9, 0);
1646 test_import_str("REGEDIT4\n\n"
1647 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1648 "\"Wine70a\"=\"\\0\"\n"
1649 "\"Wine70b\"=\"\\0\\0\"\n"
1650 "\"Wine70c\"=\"Value1\\0\"\n"
1651 "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n"
1652 "\"Wine70e\"=\"Value3\\0Value4\"\n"
1653 "\"Wine70f\"=\"\\0Value5\"\n\n", &r);
1654 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1655 verify_reg_nonexist(hkey, "Wine70a");
1656 verify_reg_nonexist(hkey, "Wine70b");
1657 verify_reg_nonexist(hkey, "Wine70c");
1658 verify_reg_nonexist(hkey, "Wine70d");
1659 verify_reg_nonexist(hkey, "Wine70e");
1660 verify_reg_nonexist(hkey, "Wine70f");
1662 /* Test forward and back slashes */
1663 test_import_str("REGEDIT4\n\n"
1664 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1665 "\"count/up\"=\"one/two/three\"\n"
1666 "\"\\\\foo\\\\bar\"=\"\"\n\n"
1667 "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r);
1668 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1669 verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0);
1670 verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0);
1671 verify_key(hkey, "https://winehq.org", 0);
1673 close_key(hkey);
1675 delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0);
1678 static void test_unicode_import(void)
1680 DWORD r, dword = 0x123, type, size;
1681 HKEY hkey, subkey;
1682 LONG err;
1683 char buffer[24];
1684 BYTE hex[8];
1686 delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0);
1688 test_import_wstr("REGEDIT\n", &r);
1689 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1690 "got exit code %ld, expected 1\n", r);
1692 test_import_wstr("REGEDIT4\n", &r);
1693 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1694 "got exit code %ld, expected 1\n", r);
1696 test_import_wstr("\xef\xbb\xbfREGEDIT", &r);
1697 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1699 test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r);
1700 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1702 test_import_wstr("\xef\xbb\xbfREGEDIT4", &r);
1703 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1705 test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r);
1706 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1708 test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r);
1709 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1711 test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r);
1712 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1714 test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r);
1715 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1716 "got exit code %ld, expected 1\n", r);
1718 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1719 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r);
1720 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1722 open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey);
1724 test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n"
1725 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1726 "\"Test1\"=\"Value\"\n", &r);
1727 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1728 verify_reg_nonexist(hkey, "Test1");
1730 test_import_wstr("\xef\xbb\xbfregedit4\n\n"
1731 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1732 "\"Test2\"=\"Value\"\n", &r);
1733 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1734 "got exit code %ld, expected 1\n", r);
1735 verify_reg_nonexist(hkey, "Test2");
1737 test_import_wstr("\xef\xbb\xbfRegedit4\n\n"
1738 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1739 "\"Test3\"=\"Value\"\n", &r);
1740 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1741 "got exit code %ld, expected 1\n", r);
1742 verify_reg_nonexist(hkey, "Test3");
1744 test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n"
1745 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1746 "\"Test4\"=\"Value\"\n", &r);
1747 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1748 verify_reg_nonexist(hkey, "Test4");
1750 test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n"
1751 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1752 "\"Test5\"=\"Value\"\n", &r);
1753 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1754 verify_reg_nonexist(hkey, "Test5");
1756 test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n"
1757 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1758 "\"Test6\"=\"Value\"\n", &r);
1759 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1760 verify_reg_nonexist(hkey, "Test6");
1762 test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n"
1763 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1764 "\"Test7\"=\"Value\"\n", &r);
1765 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1766 verify_reg_nonexist(hkey, "Test7");
1768 test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n"
1769 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1770 "\"Test8\"=\"Value\"\n", &r);
1771 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1772 verify_reg_nonexist(hkey, "Test8");
1774 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1775 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1776 "\"Unicode1\"=\"Value1\"\n", &r);
1777 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1778 verify_reg(hkey, "Unicode1", REG_SZ, "Value1", 7, 0);
1780 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1781 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1782 "\"Unicode2\"=\"Value2\"\n\n", &r);
1783 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1784 verify_reg(hkey, "Unicode2", REG_SZ, "Value2", 7, 0);
1786 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1787 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1788 "\"Unicode3\"=\"Value3\"\n\n", &r);
1789 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1790 verify_reg(hkey, "Unicode3", REG_SZ, "Value3", 7, 0);
1792 test_import_wstr("Windows Registry Editor Version 4.00\n", &r);
1793 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1794 "got exit code %ld, expected 1\n", r);
1796 test_import_wstr("Windows Registry Editor Version 5.00\n", &r);
1797 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1798 "got exit code %ld, expected 1\n", r);
1800 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r);
1801 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1802 "got exit code %ld, expected 1\n", r);
1804 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r);
1805 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1807 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r);
1808 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1810 test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r);
1811 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1812 "got exit code %ld, expected 1\n", r);
1814 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r);
1815 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1817 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r);
1818 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1820 test_import_wstr("\xef\xbb\xbf\nWindows Registry Editor Version 5.00\n", &r);
1821 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1822 "got exit code %ld, expected 1\n", r);
1824 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n"
1825 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1826 "\"Test9\"=\"Value\"\n", &r);
1827 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1828 "got exit code %ld, expected 1\n", r);
1829 verify_reg_nonexist(hkey, "Test9");
1831 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n"
1832 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1833 "\"Test10\"=\"Value\"\n", &r);
1834 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1835 "got exit code %ld, expected 1\n", r);
1836 verify_reg_nonexist(hkey, "Test10");
1838 test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
1839 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1840 "\"Test11\"=\"Value\"\n", &r);
1841 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1842 "got exit code %ld, expected 1\n", r);
1843 verify_reg_nonexist(hkey, "Test11");
1845 test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n"
1846 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1847 "\"Test12\"=\"Value\"\n", &r);
1848 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1849 "got exit code %ld, expected 1\n", r);
1850 verify_reg_nonexist(hkey, "Test12");
1852 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1853 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1854 "\"Wine\"=dword:00000123\n\n", &r);
1855 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1856 verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0);
1858 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1859 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1860 "@=\"Test string\"\n\n", &r);
1861 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1862 verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0);
1864 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
1865 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1866 "\"Unicode4\"=\"Value4\"\n", &r);
1867 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1868 verify_reg(hkey, "Unicode4", REG_SZ, "Value4", 7, 0);
1870 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
1871 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1872 "\"Unicode5\"=\"Value5\"\n\n", &r);
1873 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1874 verify_reg(hkey, "Unicode5", REG_SZ, "Value5", 7, 0);
1876 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1877 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1878 "\"Unicode6\"=\"Value6\"\n\n", &r);
1879 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1880 verify_reg(hkey, "Unicode6", REG_SZ, "Value6", 7, 0);
1882 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1883 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1884 "\"Line1\"=\"Value1\"\n\n"
1885 "\"Line2\"=\"Value2\"\n\n\n"
1886 "\"Line3\"=\"Value3\"\n\n\n\n"
1887 "\"Line4\"=\"Value4\"\n\n", &r);
1888 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1889 verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0);
1890 verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0);
1891 verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0);
1892 verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0);
1894 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1895 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1896 "\"Wine1\"=dword:00000782\n\n"
1897 "\"Wine2\"=\"Test Value\"\n"
1898 "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
1899 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
1900 "#comment\n"
1901 "@=\"Test\"\n"
1902 ";comment\n\n"
1903 "\"Wine4\"=dword:12345678\n\n", &r);
1904 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1905 dword = 0x782;
1906 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
1907 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
1908 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1909 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
1910 dword = 0x12345678;
1911 verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0);
1913 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1914 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1915 "\"Wine5\"=\"No newline\"", &r);
1916 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1917 err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL);
1918 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
1919 "got exit code %ld, expected 0\n", err);
1920 if (err == ERROR_SUCCESS)
1921 verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
1923 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1924 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1925 "\"Wine6\"=dword:00000050\n\n"
1926 "\"Wine7\"=\"No newline\"", &r);
1927 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1928 dword = 0x50;
1929 verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0);
1930 err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL);
1931 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
1932 "got exit code %ld, expected 0\n", err);
1933 if (err == ERROR_SUCCESS)
1934 verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
1936 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1937 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1938 "#comment\\\n"
1939 "\"Wine8\"=\"Line 1\"\n"
1940 ";comment\\\n"
1941 "\"Wine9\"=\"Line 2\"\n\n", &r);
1942 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1943 verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0);
1944 verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0);
1946 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1947 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1948 "\"Wine10\"=\"Value 1\"#comment\n"
1949 "\"Wine11\"=\"Value 2\";comment\n"
1950 "\"Wine12\"=dword:01020304 #comment\n"
1951 "\"Wine13\"=dword:02040608 ;comment\n\n", &r);
1952 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1953 verify_reg_nonexist(hkey, "Wine10");
1954 verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0);
1955 verify_reg_nonexist(hkey, "Wine12");
1956 dword = 0x2040608;
1957 verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0);
1959 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1960 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1961 "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
1962 " #comment\n"
1963 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
1964 "\"Wine15\"=\"A valid line\"\n"
1965 "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
1966 " ;comment\n"
1967 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
1968 "\"Wine17\"=\"Another valid line\"\n\n", &r);
1969 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1970 verify_reg_nonexist(hkey, "Wine14");
1971 verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0);
1972 verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1973 verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0);
1975 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1976 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1977 "#\"Comment1\"=\"Value 1\"\n"
1978 ";\"Comment2\"=\"Value 2\"\n"
1979 " #\"Comment3\"=\"Value 3\"\n"
1980 " ;\"Comment4\"=\"Value 4\"\n"
1981 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
1982 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r);
1983 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
1984 verify_reg_nonexist(hkey, "Comment1");
1985 verify_reg_nonexist(hkey, "Comment2");
1986 verify_reg_nonexist(hkey, "Comment3");
1987 verify_reg_nonexist(hkey, "Comment4");
1988 verify_reg_nonexist(hkey, "Wine18");
1989 verify_reg_nonexist(hkey, "Comment5");
1990 verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0);
1991 verify_reg_nonexist(hkey, "Comment6");
1993 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1994 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1995 "\"Wine20\"=#\"Value 8\"\n"
1996 "\"Wine21\"=;\"Value 9\"\n"
1997 "\"Wine22\"=\"#comment1\"\n"
1998 "\"Wine23\"=\";comment2\"\n"
1999 "\"Wine24\"=\"Value#comment3\"\n"
2000 "\"Wine25\"=\"Value;comment4\"\n"
2001 "\"Wine26\"=\"Value #comment5\"\n"
2002 "\"Wine27\"=\"Value ;comment6\"\n"
2003 "\"Wine28\"=#dword:00000001\n"
2004 "\"Wine29\"=;dword:00000002\n"
2005 "\"Wine30\"=dword:00000003#comment\n"
2006 "\"Wine31\"=dword:00000004;comment\n\n", &r);
2007 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2008 verify_reg_nonexist(hkey, "Wine20");
2009 verify_reg_nonexist(hkey, "Wine21");
2010 verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0);
2011 verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0);
2012 verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0);
2013 verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0);
2014 verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0);
2015 verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0);
2016 verify_reg_nonexist(hkey, "Wine28");
2017 verify_reg_nonexist(hkey, "Wine29");
2018 verify_reg_nonexist(hkey, "Wine30");
2019 dword = 0x00000004;
2020 verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0);
2022 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2023 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2024 "\"Wine32a\"=dword:1\n"
2025 "\"Wine32b\"=dword:4444\n\n", &r);
2026 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2027 dword = 0x1;
2028 verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0);
2029 dword = 0x4444;
2030 verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0);
2032 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2033 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2034 "\"Wine33a\"=dword:\n"
2035 "\"Wine33b\"=dword:hello\n"
2036 "\"Wine33c\"=dword:123456789\n"
2037 "\"Wine33d\"=dword:012345678\n"
2038 "\"Wine33e\"=dword:000000001\n\n", &r);
2039 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2040 verify_reg_nonexist(hkey, "Wine33a");
2041 verify_reg_nonexist(hkey, "Wine33b");
2042 verify_reg_nonexist(hkey, "Wine33c");
2043 verify_reg_nonexist(hkey, "Wine33d");
2044 verify_reg_nonexist(hkey, "Wine33e");
2046 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2047 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2048 "\"Wine34a\"=dword:12345678abc\n"
2049 "\"Wine34b\"=dword:12345678 abc\n\n", &r);
2050 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2051 verify_reg_nonexist(hkey, "Wine34a");
2052 verify_reg_nonexist(hkey, "Wine34b");
2054 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2055 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2056 "\"Wine35a\"=dword:0x123\n"
2057 "\"Wine35b\"=dword:123 456\n"
2058 "\"Wine35c\"=dword:1234 5678\n\n", &r);
2059 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2060 verify_reg_nonexist(hkey, "Wine35a");
2061 verify_reg_nonexist(hkey, "Wine35b");
2062 verify_reg_nonexist(hkey, "Wine35c");
2064 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2065 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2066 "\"Wine36a\"=dword:1234;5678\n"
2067 "\"Wine36b\"=dword:1234 ;5678\n"
2068 "\"Wine36c\"=dword:1234#5678\n"
2069 "\"Wine36d\"=dword:1234 #5678\n\n", &r);
2070 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2071 dword = 0x1234;
2072 verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0);
2073 verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0);
2074 verify_reg_nonexist(hkey, "Wine36c");
2075 verify_reg_nonexist(hkey, "Wine36d");
2077 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2078 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2079 "\"Wine37a\"=\"foo\"bar\"\n"
2080 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r);
2081 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2082 verify_reg_nonexist(hkey, "Wine37a");
2083 verify_reg_nonexist(hkey, "Wine37b");
2085 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2086 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2087 "\"Empty string\"=\"\"\n"
2088 "\"\"=\"Default registry value\"\n\n", &r);
2089 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2090 verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0);
2091 verify_reg(hkey, NULL, REG_SZ, "Default registry value", 23, 0);
2093 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2094 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2095 "\"Test38a\"=\n"
2096 "\"Test38b\"=\\\"\n"
2097 "\"Test38c\"=\\\"Value\\\"\n"
2098 "\"Test38d\"=\\\"Value\"\n\n", &r);
2099 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2100 verify_reg_nonexist(hkey, "Test38a");
2101 verify_reg_nonexist(hkey, "Test38b");
2102 verify_reg_nonexist(hkey, "Test38c");
2103 verify_reg_nonexist(hkey, "Test38d");
2105 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2106 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2107 "\"Wine39a\"=\"Value1\" ;comment\n"
2108 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
2109 "\"Wine39c\"=\"Value3\" #comment\n"
2110 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r);
2111 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2112 verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0);
2113 verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0);
2114 verify_reg_nonexist(hkey, "Wine39c");
2115 verify_reg_nonexist(hkey, "Wine39d");
2117 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2118 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2119 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r);
2120 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2121 verify_reg_nonexist(hkey, "TestNoBeginQuote");
2123 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2124 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2125 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r);
2126 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2127 verify_reg_nonexist(hkey, "TestNoEndQuote");
2129 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2130 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2131 "\"TestNoQuotes\"=Asdffdsa\n", &r);
2132 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2133 verify_reg_nonexist(hkey, "TestNoQuotes");
2135 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2136 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2137 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r);
2138 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2139 verify_reg_nonexist(hkey, "NameNoBeginQuote");
2141 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2142 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2143 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r);
2144 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2145 verify_reg_nonexist(hkey, "NameNoEndQuote");
2147 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2148 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2149 "NameNoQuotes=\"Asdffdsa\"\n", &r);
2150 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2151 verify_reg_nonexist(hkey, "NameNoQuotes");
2153 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2154 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2155 "\"MixedQuotes=Asdffdsa\"\n", &r);
2156 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2157 verify_reg_nonexist(hkey, "MixedQuotes");
2158 verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa");
2160 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2161 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2162 "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n"
2163 "\"Wine40b\"=\"Value 1\"\n"
2164 "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n"
2165 "\"Wine40d\"=\"Value 2\"\n"
2166 "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n"
2167 "\"Wine40f\"=\"Value 3\"\n"
2168 "\"Wine40g\"=\"Value 4\"\n\n", &r);
2169 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2170 verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0);
2171 verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0);
2172 verify_reg_nonexist(hkey, "Wine40c");
2173 verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0);
2174 verify_reg_nonexist(hkey, "Wine40e");
2175 verify_reg_nonexist(hkey, "Wine40f");
2176 verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0);
2178 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2179 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2180 "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2181 " 63,00,6f,00,6e,00,\\;comment\n"
2182 " 63,00,61,00,74,00,\\;comment\n"
2183 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2184 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2185 verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2187 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2188 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2189 "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2190 " 63,00,6f,00,6e,00,\\;comment\n"
2191 " 63,00,61,00,74,00,;comment\n"
2192 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2193 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2194 verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
2196 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2197 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2198 "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
2199 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
2200 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2201 verify_reg_nonexist(hkey, "Multi-Line3");
2203 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2204 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2205 "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
2206 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
2207 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2208 verify_reg_nonexist(hkey, "Multi-Line4");
2210 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2211 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2212 "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
2213 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
2214 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2215 verify_reg_nonexist(hkey, "Multi-Line5");
2217 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2218 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2219 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
2220 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
2221 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2222 verify_reg_nonexist(hkey, "Multi-Line6");
2224 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2225 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2226 "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2227 " 65,00,20,00,\\;comment\n"
2228 " 63,00,6f,00,6e,00,\\;comment\n"
2229 " 63,00,61,00,74,00,\\;comment\n"
2230 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2231 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2232 verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2234 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2235 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2236 "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n"
2237 " 65,00,20,00,\\;#comment\n"
2238 " 63,00,6f,00,6e,00,\\;#comment\n"
2239 " 63,00,61,00,74,00,\\;#comment\n"
2240 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2241 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2242 verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2244 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2245 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2246 "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2247 " 65,00,20,00,\\;comment\n"
2248 " 63,00,6f,00,6e,00,\\;comment\n"
2249 " 63,00,61,00,74,00,\\#comment\n"
2250 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2251 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2252 verify_reg_nonexist(hkey, "Multi-Line9");
2254 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2255 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2256 "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2257 " 63,00,6f,00,6e,00,\\;comment\n"
2258 " 63,00,61,00,74,00,\\\n\n"
2259 " 65,00,6e,00,\\;comment\n\n"
2260 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2261 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2262 verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2264 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2265 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2266 "\"Wine41a\"=dword:1234\\\n"
2267 "5678\n"
2268 "\"Wine41b\"=\"Test \\\n"
2269 "Value\"\n\n", &r);
2270 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2271 verify_reg_nonexist(hkey, "Wine41a");
2272 verify_reg_nonexist(hkey, "Wine41b");
2274 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2275 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2276 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
2277 "\"single'quote\"=dword:00000008\n\n", &r);
2278 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2279 verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0);
2280 dword = 0x00000008;
2281 verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0);
2283 /* Test key name and value name concatenation */
2284 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2285 "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n"
2286 "Subkey1]\n", &r);
2287 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2288 verify_key_nonexist(hkey, "Subkey1", 0);
2290 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2291 "[HKEY_CURRENT_USER\\" KEY_BASE "\n"
2292 "\\Subkey2]\n", &r);
2293 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2294 verify_key_nonexist(hkey, "Subkey2", 0);
2296 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2297 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2298 "\"Wine\\\n"
2299 "42a\"=\"Value 1\"\n"
2300 "\"Wine42b\"=\"Value 2\"\n"
2301 "\"Wine\n"
2302 "\\42c\"=\"Value 3\"\n\n", &r);
2303 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2304 verify_reg_nonexist(hkey, "Wine42a");
2305 verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0);
2306 verify_reg_nonexist(hkey, "Wine42c");
2308 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
2309 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2310 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2311 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
2312 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
2313 " 75,00,65,00,00,00\n"
2314 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
2315 ",75,00,65,00,00,00\n"
2316 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
2317 " ,75,00,65,00,00,00\n"
2318 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
2319 " 75,00,65,00,00,00\n"
2320 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
2321 "5,00,65,00,00,00\n"
2322 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
2323 " 5,00,65,00,00,00\n"
2324 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
2325 " 6c,00,75,00,\\\n"
2326 " 65,00,00,00\n"
2327 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
2328 " 6c,00,75,00,\n"
2329 " 65,00,00,00\n"
2330 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
2331 " 6c,00,75,00,;comment\n"
2332 " 65,00,00,00\n"
2333 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
2334 " 6c,00,75,00,\\#comment\n"
2335 " 65,00,00,00\n\n", &r);
2336 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2337 verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
2338 verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
2339 verify_reg_nonexist(hkey, "Wine43c");
2340 verify_reg_nonexist(hkey, "Wine43d");
2341 verify_reg_nonexist(hkey, "Wine43e");
2342 verify_reg_nonexist(hkey, "Wine43f");
2343 verify_reg_nonexist(hkey, "Wine43g");
2344 verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
2345 verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0);
2346 verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0);
2347 verify_reg_nonexist(hkey, "Wine43k");
2349 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2350 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2351 "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2352 "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n"
2353 " 54,00,48,00,25,00,00,00\n"
2354 "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n"
2355 ",54,00,48,00,25,00,00,00\n"
2356 "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n"
2357 " ,54,00,48,00,25,00,00,00\n"
2358 "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n"
2359 " 54,00,48,00,25,00,00,00\n"
2360 "\"Wine44f\"=hex(2):25,00,50,00,4\\\n"
2361 "1,00,54,00,48,00,25,00,00,00\n"
2362 "\"Wine44g\"=hex(2):25,00,50,00,4\\\n"
2363 " 1,00,54,00,48,00,25,00,00,00\n"
2364 "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2365 " 54,00,48,00,\\\n"
2366 " 25,00,00,00\n"
2367 "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2368 " 54,00,48,00\n"
2369 " 25,00,00,00\n"
2370 "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2371 " 54,00,48,00;comment\n"
2372 " 25,00,00,00\n"
2373 "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2374 " 54,00,48,00,\\#comment\n"
2375 " 25,00,00,00\n\n", &r);
2376 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2377 verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0);
2378 verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0);
2379 verify_reg_nonexist(hkey, "Wine44c");
2380 verify_reg_nonexist(hkey, "Wine44d");
2381 verify_reg_nonexist(hkey, "Wine44e");
2382 verify_reg_nonexist(hkey, "Wine44f");
2383 verify_reg_nonexist(hkey, "Wine44g");
2384 verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0);
2385 /* Wine44i */
2386 size = sizeof(buffer);
2387 err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size);
2388 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
2389 ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
2390 ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %lu, expected 6\n", size);
2391 ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
2392 /* Wine44j */
2393 size = sizeof(buffer);
2394 memset(buffer, '-', size);
2395 err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size);
2396 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
2397 ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
2398 ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %lu, expected 6\n", size);
2399 ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
2400 /* Wine44k */
2401 verify_reg_nonexist(hkey, "Wine44k");
2403 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2404 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2405 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
2406 "\"Wine45b\"=hex:11,22,33,44,\\\n"
2407 " 55,66,77,88\n"
2408 "\"Wine45c\"=hex:11,22,33,44\\\n"
2409 ",55,66,77,88\n"
2410 "\"Wine45d\"=hex:11,22,33,44\\\n"
2411 " ,55,66,77,88\n"
2412 "\"Wine45e\"=hex:11,22,33,44\\\n"
2413 " 55,66,77,88\n"
2414 "\"Wine45f\"=hex:11,22,33,4\\\n"
2415 "4,55,66,77,88\n"
2416 "\"Wine45g\"=hex:11,22,33,4\\\n"
2417 " 4,55,66,77,88\n"
2418 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
2419 " 55,66,\\\n"
2420 " 77,88\n"
2421 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
2422 " 55,66,\n"
2423 " 77,88\n"
2424 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
2425 " 55,66,;comment\n"
2426 " 77,88\n"
2427 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
2428 " 44,55,66,\\#comment\n"
2429 " 77,88\n\n", &r);
2430 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2431 hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44;
2432 hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88;
2433 verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0);
2434 verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0);
2435 verify_reg_nonexist(hkey, "Wine45c");
2436 verify_reg_nonexist(hkey, "Wine45d");
2437 verify_reg_nonexist(hkey, "Wine45e");
2438 verify_reg_nonexist(hkey, "Wine45f");
2439 verify_reg_nonexist(hkey, "Wine45g");
2440 verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0);
2441 verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0);
2442 verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0);
2443 verify_reg_nonexist(hkey, "Wine45k");
2445 /* Test import with subkeys */
2446 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2447 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n"
2448 "\"Wine\\\\31\"=\"Test value\"\n\n", &r);
2449 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2450 open_key(hkey, "Subkey\"1", 0, &subkey);
2451 verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0);
2452 close_key(subkey);
2453 delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1", 0);
2455 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2456 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n"
2457 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r);
2458 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2459 open_key(hkey, "Subkey/2", 0, &subkey);
2460 verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0);
2461 close_key(subkey);
2462 delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2", 0);
2464 /* Test key creation */
2465 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2466 "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r);
2467 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2468 verify_key_nonexist(hkey, "No_Opening_Bracket", 0);
2470 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2471 "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r);
2472 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2473 verify_key_nonexist(hkey, "No_Closing_Bracket", 0);
2475 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2476 "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r);
2477 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2478 verify_key_nonexist(hkey, "Subkey1a", 0);
2480 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2481 "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r);
2482 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2483 verify_key_nonexist(hkey, "Subkey1b", 0);
2485 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2486 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r);
2487 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2488 verify_key(hkey, "Subkey1c ", 0);
2489 delete_key(hkey, "Subkey1c ", 0);
2491 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2492 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r);
2493 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2494 verify_key(hkey, "Subkey1d\t", 0);
2495 delete_key(hkey, "Subkey1d\t", 0);
2497 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2498 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n"
2499 "\"Wine\"=\"Test value\"\n\n", &r);
2500 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2501 verify_key(hkey, "Subkey1e\\", 0);
2502 verify_key(hkey, "Subkey1e", 0);
2503 open_key(hkey, "Subkey1e", 0, &subkey);
2504 verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
2505 close_key(subkey);
2506 delete_key(hkey, "Subkey1e", 0);
2508 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2509 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n"
2510 "\"Wine\"=\"Test value\"\n\n", &r);
2511 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2512 verify_key(hkey, "Subkey1f\\\\", 0);
2513 verify_key(hkey, "Subkey1f\\", 0);
2514 verify_key(hkey, "Subkey1f", 0);
2515 open_key(hkey, "Subkey1f\\\\", 0, &subkey);
2516 verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
2517 close_key(subkey);
2518 delete_key(hkey, "Subkey1f\\\\", 0);
2520 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2521 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n"
2522 "\"Wine\"=\"Test value\"\n\n", &r);
2523 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2524 verify_key(hkey, "Subkey1g\\\\\\\\", 0);
2525 verify_key(hkey, "Subkey1g\\\\", 0);
2526 verify_key(hkey, "Subkey1g\\", 0);
2527 verify_key(hkey, "Subkey1g", 0);
2528 open_key(hkey, "Subkey1g\\\\", 0, &subkey);
2529 verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
2530 close_key(subkey);
2531 delete_key(hkey, "Subkey1g\\\\", 0);
2533 /* Test key deletion. We start by creating some registry keys. */
2534 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2535 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
2536 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
2537 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2538 verify_key(hkey, "Subkey2a", 0);
2539 verify_key(hkey, "Subkey2b", 0);
2541 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2542 "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
2543 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2544 verify_key(hkey, "Subkey2a", 0);
2546 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2547 "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
2548 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2549 verify_key(hkey, "Subkey2b", 0);
2551 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2552 "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
2553 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2554 verify_key(hkey, "Subkey2a", 0);
2556 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2557 "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
2558 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2559 verify_key(hkey, "Subkey2b", 0);
2561 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2562 "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
2563 "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
2564 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2565 verify_key_nonexist(hkey, "Subkey2a", 0);
2566 verify_key_nonexist(hkey, "Subkey2b", 0);
2568 /* Test case sensitivity when creating and deleting registry keys. */
2569 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2570 "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n"
2571 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r);
2572 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2573 verify_key(hkey, "Subkey3a", 0);
2574 verify_key(hkey, "Subkey3b", 0);
2576 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2577 "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n"
2578 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r);
2579 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2580 verify_key_nonexist(hkey, "Subkey3a", 0);
2581 verify_key_nonexist(hkey, "Subkey3b", 0);
2583 /* Test mixed key creation and deletion. We start by creating a subkey. */
2584 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2585 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r);
2586 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2587 verify_key(hkey, "Subkey4a", 0);
2589 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2590 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
2591 "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n"
2592 "\"Wine46a\"=dword:12345678\n\n", &r);
2593 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2594 verify_key_nonexist(hkey, "Subkey4a", 0);
2595 verify_reg_nonexist(hkey, "Wine46a");
2597 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2598 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
2599 "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n"
2600 "\"Wine46b\"=dword:12345678\n\n", &r);
2601 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2602 verify_key_nonexist(hkey, "Subkey4b", 0);
2603 verify_reg_nonexist(hkey, "Wine46b");
2605 /* Test value deletion. We start by creating some registry values. */
2606 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2607 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2608 "\"Wine46a\"=\"Test Value\"\n"
2609 "\"Wine46b\"=dword:00000008\n"
2610 "\"Wine46c\"=hex:11,22,33,44\n"
2611 "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2612 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2613 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2614 "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2615 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r);
2616 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2617 verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0);
2618 verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0);
2619 verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0);
2620 verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2621 verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0);
2622 verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
2624 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2625 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2626 "\"Wine46a\"=-\n"
2627 "\"Wine46b\"= -\n"
2628 "\"Wine46c\"= \t-\t \n"
2629 "\"Wine46d\"=-\"Test\"\n"
2630 "\"Wine46e\"=- ;comment\n"
2631 "\"Wine46f\"=- #comment\n\n", &r);
2632 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2633 verify_reg_nonexist(hkey, "Wine46a");
2634 verify_reg_nonexist(hkey, "Wine46b");
2635 verify_reg_nonexist(hkey, "Wine46c");
2636 verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2637 verify_reg_nonexist(hkey, "Wine46e");
2638 verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
2640 /* Test the accepted range of the hex-based data types */
2641 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2642 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2643 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
2644 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
2645 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
2646 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
2647 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
2648 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
2649 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
2650 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
2651 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n"
2652 "\"Wine47j\"=hex(0x2):56,00,61,00,6c,00,75,00,65,00,00,00\n"
2653 "\"Wine47k\"=hex(0X2):56,00,61,00,6c,00,75,00,65,00,00,00\n"
2654 "\"Wine47l\"=hex(x2):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r);
2655 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2656 verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0);
2657 verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0);
2658 verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0);
2659 verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0);
2660 verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0);
2661 verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0);
2662 verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0);
2663 verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0);
2664 verify_reg_nonexist(hkey, "Wine47i");
2665 verify_reg_nonexist(hkey, "Wine47j");
2666 verify_reg_nonexist(hkey, "Wine47k");
2667 verify_reg_nonexist(hkey, "Wine47l");
2669 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2670 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2671 "\"Wine48a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00, \\\n"
2672 " 63,00,6f,00,6e,00,63,00,61,00,74,00, \\\n"
2673 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2674 "\"Wine48b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\t\\\n"
2675 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\t \t \\\n"
2676 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2677 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2678 verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2679 verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2681 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2682 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2683 "\"Wine49\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r);
2684 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2685 verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0);
2687 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2688 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2689 "\"Wine50a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 ;comment\n"
2690 "\"Wine50b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t;comment\n"
2691 "\"Wine50c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 #comment\n"
2692 "\"Wine50d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t#comment\n\n", &r);
2693 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2694 verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0);
2695 verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0);
2696 verify_reg_nonexist(hkey, "Wine50c");
2697 verify_reg_nonexist(hkey, "Wine50d");
2699 /* Test support for characters greater than 0xff */
2700 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2701 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2702 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
2703 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r);
2704 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2705 verify_reg_nonexist(hkey, "Wine51a");
2706 verify_reg_nonexist(hkey, "Wine51b");
2708 /* Test the effect of backslashes in hex data */
2709 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2710 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2711 "\"Wine52a\"=hex(2):25,00,48\\,00,4f,00,4d,00,45,00,25,00,00,00\n"
2712 "\"Wine52b\"=hex(2):25,00,48,00,\\4f,00,4d,00,45,00,25,00,00,00\n"
2713 "\"Wine52c\"=hex(2):25,00,48\\ ,00,4f,00,4d,00,45,00,25,00,00,00\n"
2714 "\"Wine52d\"=hex(2):25,00,48,00,\\ 4f,00,4d,00,45,00,25,00,00,00\n"
2715 "\"Wine52e\"=hex(2):\\25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2716 "\"Wine52f\"=hex(2):\\ 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2717 "\"Wine52g\"=hex(2):25,00,48,00,4\\f,00,4d,00,45,00,25,00,00,00\n"
2718 "\"Wine52h\"=hex(2):25,00,48,00,4\\\n"
2719 " f,00,4d,00,45,00,25,00,00,00\n"
2720 "\"Wine52i\"=hex(2):25,00,50,00,\\,41,00,54,00,48,00,25,00,00,00\n"
2721 "\"Wine52j\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\\\n"
2722 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2723 "\"Wine52k\"=hex(2):,\\\n"
2724 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2725 "\"Wine52l\"=hex(2):\\\n"
2726 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n\n", &r);
2727 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2728 verify_reg_nonexist(hkey, "Wine52a");
2729 verify_reg_nonexist(hkey, "Wine52b");
2730 verify_reg_nonexist(hkey, "Wine52c");
2731 verify_reg_nonexist(hkey, "Wine52d");
2732 verify_reg_nonexist(hkey, "Wine52e");
2733 verify_reg_nonexist(hkey, "Wine52f");
2734 verify_reg_nonexist(hkey, "Wine52g");
2735 verify_reg_nonexist(hkey, "Wine52h");
2736 verify_reg_nonexist(hkey, "Wine52i");
2737 verify_reg_nonexist(hkey, "Wine52j");
2738 verify_reg_nonexist(hkey, "Wine52k");
2739 verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0);
2741 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2742 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2743 "\"Wine53a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
2744 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2745 "\"Wine53b\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n"
2746 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2747 "\"Wine53c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00, \\ ;comment\n"
2748 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2749 "\"Wine53d\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00 \\ ;comment\n"
2750 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2751 "\"Wine53e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\t ;comment\n"
2752 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2753 "\"Wine53f\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\t ;comment\n"
2754 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r);
2755 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2756 verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
2757 verify_reg_nonexist(hkey, "Wine53b");
2758 verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
2759 verify_reg_nonexist(hkey, "Wine53d");
2760 verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
2761 verify_reg_nonexist(hkey, "Wine53f");
2763 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2764 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2765 "\"Wine54a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2766 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r);
2767 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2768 verify_reg_nonexist(hkey, "Wine54a");
2769 verify_key_nonexist(hkey, "Subkey1", 0);
2771 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2772 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2773 "\"Wine54b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
2774 "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r);
2775 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2776 verify_reg_nonexist(hkey, "Wine54b");
2777 verify_key(hkey, "Subkey2", 0);
2779 delete_key(hkey, "Subkey2", 0);
2781 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2782 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2783 "\"Wine55a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2784 "\"Wine55b\"=\"Test value\"\n"
2786 "\"Wine55c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2787 ";comment\n"
2788 "\"Wine55d\"=\"Test value\"\n"
2790 "\"Wine55e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2791 "#comment\n"
2792 "\"Wine55f\"=\"Test value\"\n"
2794 "\"Wine55g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
2795 "\"Wine55h\"=\"Test value\"\n"
2797 "\"Wine55i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
2798 "\"Wine55j\"=\"Test value\"\n\n", &r);
2799 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2800 verify_reg_nonexist(hkey, "Wine55a");
2801 verify_reg_nonexist(hkey, "Wine55b");
2802 verify_reg_nonexist(hkey, "Wine55c");
2803 verify_reg_nonexist(hkey, "Wine55d");
2804 verify_reg_nonexist(hkey, "Wine55e");
2805 verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0);
2806 verify_reg_nonexist(hkey, "Wine55g");
2807 verify_reg_nonexist(hkey, "Wine55h");
2808 verify_reg_nonexist(hkey, "Wine55i");
2809 verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0);
2811 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2812 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2813 "\"Wine56a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2814 "\"Wine56b\"=dword:00000008\n"
2816 "\"Wine56c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2817 ";comment\n"
2818 "\"Wine56d\"=dword:00000008\n"
2820 "\"Wine56e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2821 "#comment\n"
2822 "\"Wine56f\"=dword:00000008\n"
2824 "\"Wine56g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
2825 "\"Wine56h\"=dword:00000008\n"
2827 "\"Wine56i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
2828 "\"Wine56j\"=dword:00000008\n\n", &r);
2829 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2830 verify_reg_nonexist(hkey, "Wine56a");
2831 verify_reg_nonexist(hkey, "Wine56b");
2832 verify_reg_nonexist(hkey, "Wine56c");
2833 verify_reg_nonexist(hkey, "Wine56d");
2834 verify_reg_nonexist(hkey, "Wine56e");
2835 verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0);
2836 verify_reg_nonexist(hkey, "Wine56g");
2837 verify_reg_nonexist(hkey, "Wine56h");
2838 verify_reg_nonexist(hkey, "Wine56i");
2839 verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0);
2841 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2842 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2843 "\"Wine57a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
2844 "\"Wine57b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2846 "\"Wine57c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
2847 ";comment\n"
2848 "\"Wine57d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2850 "\"Wine57e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
2851 "#comment\n"
2852 "\"Wine57f\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2854 "\"Wine57g\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n\n"
2855 "\"Wine57h\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2857 "\"Wine57i\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n"
2858 "\"Wine57j\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r);
2859 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2860 verify_reg_nonexist(hkey, "Wine57a");
2861 verify_reg_nonexist(hkey, "Wine57b");
2862 verify_reg_nonexist(hkey, "Wine57c");
2863 verify_reg_nonexist(hkey, "Wine57d");
2864 verify_reg_nonexist(hkey, "Wine57e");
2865 verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0);
2866 verify_reg_nonexist(hkey, "Wine57g");
2867 verify_reg_nonexist(hkey, "Wine57h");
2868 verify_reg_nonexist(hkey, "Wine57i");
2869 verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0);
2871 delete_value(hkey, NULL);
2873 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2874 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2875 "\"Wine58a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2876 "@=\"Default value 1\"\n\n", &r);
2877 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2878 verify_reg_nonexist(hkey, "Wine58a");
2879 verify_reg_nonexist(hkey, NULL);
2881 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2882 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2883 "\"Wine58b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2884 ";comment\n"
2885 "@=\"Default value 2\"\n\n", &r);
2886 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2887 verify_reg_nonexist(hkey, "Wine58b");
2888 verify_reg_nonexist(hkey, NULL);
2890 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2891 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2892 "\"Wine58c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2893 "#comment\n"
2894 "@=\"Default value 3\"\n\n", &r);
2895 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2896 verify_reg_nonexist(hkey, "Wine58c");
2897 verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0);
2899 delete_value(hkey, NULL);
2901 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2902 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2903 "\"Wine58d\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
2904 "@=\"Default value 4\"\n\n", &r);
2905 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2906 verify_reg_nonexist(hkey, "Wine58d");
2907 verify_reg_nonexist(hkey, NULL);
2909 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2910 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2911 "\"Wine58e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
2912 "@=\"Default value 5\"\n\n", &r);
2913 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2914 verify_reg_nonexist(hkey, "Wine58e");
2915 verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0);
2917 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2918 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2919 "\"Wine59a\"=hex:11,22,33,\\\n"
2920 "\\\n"
2921 " 44,55,66\n"
2922 "\"Wine59b\"=hex:11,22,33,\\\n"
2923 " \\\n"
2924 " 44,55,66\n\n", &r);
2925 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2926 verify_reg_nonexist(hkey, "Wine59a");
2927 verify_reg_nonexist(hkey, "Wine59b");
2929 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2930 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2931 "\"Wine60a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2932 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2933 ";comment\n"
2934 " 65,00,6e,00,\\;comment\n"
2935 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2936 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2937 verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2939 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2940 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2941 "\"Wine60b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2942 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2943 " ;comment\n"
2944 " 65,00,6e,00,\\;comment\n"
2945 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2946 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2947 verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2949 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2950 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2951 "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n"
2952 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2953 "#comment\n"
2954 " 65,00,6e,00,\\;comment\n"
2955 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2956 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2957 verify_reg_nonexist(hkey, "Wine60c");
2959 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2960 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2961 "\"Wine60d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2962 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2963 " #comment\n"
2964 " 65,00,6e,00,\\;comment\n"
2965 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2966 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2967 verify_reg_nonexist(hkey, "Wine60d");
2969 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2970 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2971 "\"Wine60e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2972 " 63,00,6f,00,6e,00,\\\n\n"
2973 " 63,00,61,00,74,00,\\\n\n\n"
2974 " 65,00,6e,00,\\\n\n\n\n"
2975 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2976 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2977 verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2979 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2980 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2981 "\"Wine60f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2982 " 63,00,6f,00,6e,00,\\\n \n"
2983 " 63,00,61,00,74,00,\\\n\t\n\t\n"
2984 " 65,00,6e,00,\\\n\t \t\n\t \t\n\t \t\n"
2985 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
2986 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2987 verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2989 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2990 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2991 "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n"
2992 " 25,50,41,54,48,25,00\n"
2993 "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n"
2994 " 25,50,41,54,48,25,00\n\n", &r);
2995 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
2996 verify_reg_nonexist(hkey, "Wine61a");
2997 verify_reg_nonexist(hkey, "Wine61b");
2999 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3000 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3001 "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r);
3002 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3003 err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL);
3004 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
3005 "got exit code %ld, expected 0\n", err);
3006 if (err == ERROR_SUCCESS)
3007 verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0);
3009 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3010 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3011 "\"Wine62b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\\", &r);
3012 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3013 err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL);
3014 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
3015 "got exit code %ld, expected 0\n", err);
3016 if (err == ERROR_SUCCESS)
3017 verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0);
3019 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3020 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3021 "\"Wine62c\"=hex:11,22,33,44,55,\\", &r);
3022 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3023 err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL);
3024 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
3025 "got exit code %ld, expected 0\n", err);
3026 if (err == ERROR_SUCCESS)
3027 verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0);
3029 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3030 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3031 "\"Wine62d\"=hex(7):4c,00,69,00,6e,00,65,00,\\", &r);
3032 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3033 err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL);
3034 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
3035 "got exit code %ld, expected 0\n", err);
3036 if (err == ERROR_SUCCESS)
3037 verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0);
3039 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3040 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3041 "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r);
3042 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3043 err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL);
3044 ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
3045 "got exit code %ld, expected 0\n", err);
3046 if (err == ERROR_SUCCESS)
3047 verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0);
3049 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3050 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3051 "\"Wine62f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00\\", &r);
3052 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3053 verify_reg_nonexist(hkey, "Wine62f");
3055 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3056 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3057 "\"Wine63a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3058 " ,63,00,6f,00,6e,00,\\\n"
3059 " 63,00,61,00,74,00,\\\n"
3060 " 65,00,6e,00,\\\n"
3061 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3062 "\"Wine63b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3063 " 63,,00,6f,00,6e,00,\\\n"
3064 " 63,00,61,00,74,00,\\\n"
3065 " 65,00,6e,00,\\\n"
3066 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
3067 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3068 verify_reg_nonexist(hkey, "Wine63a");
3069 verify_reg_nonexist(hkey, "Wine63b");
3071 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3072 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3073 "\"Wine64a\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n"
3074 "\"Wine64b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3075 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3076 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3077 "\"Wine64c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n"
3078 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3079 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3080 "\"Wine64d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n"
3081 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\n"
3082 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3083 "\"Wine64e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3084 " 63,00,6f,00,6e,00,63,00,61,00,74,00,;comment\n"
3085 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
3086 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3087 verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0);
3088 verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3089 verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3090 /* Wine64d */
3091 size = sizeof(buffer);
3092 err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size);
3093 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
3094 ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
3095 ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %lu, expected 12\n", size);
3096 ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
3097 /* Wine64e */
3098 size = sizeof(buffer);
3099 err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size);
3100 ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", err);
3101 ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
3102 ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %lu, expected 12\n", size);
3103 ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
3105 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3106 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3107 "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n"
3108 "\"Wine65b\"=hex(100):25,50,41,\\\n"
3109 " 54,48,25,00\n"
3110 "\"Wine65c\"=hex(100):25,50,41,\\;comment\n"
3111 " 54,48,\\\n"
3112 " 25,00\n"
3113 "\"Wine65d\"=hex(100):25,50,41,\\;comment\n"
3114 " 54,48,\n"
3115 " 25,00\n"
3116 "\"Wine65e\"=hex(100):25,50,41,\\;comment\n"
3117 " 54,48,;comment\n"
3118 " 25,00\n", &r);
3119 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3120 verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0);
3121 verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0);
3122 verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0);
3123 verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0);
3124 verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0);
3126 /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/
3127 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3128 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3129 "\"Wine66a\"=hex(7):4c,00,69,00,6e,00,65,00\n"
3130 "\"Wine66b\"=hex(7):4c,00,69,00,6e,00,65,00,\n"
3131 "\"Wine66c\"=hex(7):4c,00,69,00,6e,00,65,00,00,00\n"
3132 "\"Wine66d\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,\n"
3133 "\"Wine66e\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n"
3134 "\"Wine66f\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00,\n\n", &r);
3135 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3136 verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0);
3137 verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0);
3138 verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0);
3139 verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0);
3140 verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0);
3141 verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0);
3143 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3144 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3145 "\"Wine67a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00\n"
3146 "\"Wine67b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\n"
3147 "\"Wine67c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3148 "\"Wine67d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r);
3149 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3150 verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0);
3151 verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0);
3152 verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0);
3153 verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0);
3155 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3156 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3157 "\"Wine68a\"=hex(1):\n"
3158 "\"Wine68b\"=hex(2):\n"
3159 "\"Wine68c\"=hex(3):\n"
3160 "\"Wine68d\"=hex(4):\n"
3161 "\"Wine68e\"=hex(7):\n"
3162 "\"Wine68f\"=hex(100):\n"
3163 "\"Wine68g\"=hex(abcd):\n"
3164 "\"Wine68h\"=hex:\n"
3165 "\"Wine68i\"=hex(0):\n\n", &r);
3166 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3167 verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0);
3168 verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0);
3169 verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0);
3170 verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0);
3171 verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0);
3172 verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0);
3173 verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
3174 verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
3175 verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0);
3177 /* Test with embedded null characters */
3178 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3179 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3180 "\"Wine69a\"=\"\\\\0\"\n"
3181 "\"Wine69b\"=\"\\\\0\\\\0\"\n"
3182 "\"Wine69c\"=\"Value1\\\\0\"\n"
3183 "\"Wine69d\"=\"Value2\\\\0\\\\0\\\\0\\\\0\"\n"
3184 "\"Wine69e\"=\"Value3\\\\0Value4\"\n"
3185 "\"Wine69f\"=\"\\\\0Value5\"\n\n", &r);
3186 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3187 verify_reg(hkey, "Wine69a", REG_SZ, "\\0", 3, 0);
3188 verify_reg(hkey, "Wine69b", REG_SZ, "\\0\\0", 5, 0);
3189 verify_reg(hkey, "Wine69c", REG_SZ, "Value1\\0", 9, 0);
3190 verify_reg(hkey, "Wine69d", REG_SZ, "Value2\\0\\0\\0\\0", 15, 0);
3191 verify_reg(hkey, "Wine69e", REG_SZ, "Value3\\0Value4", 15, 0);
3192 verify_reg(hkey, "Wine69f", REG_SZ, "\\0Value5", 9, 0);
3194 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3195 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3196 "\"Wine70a\"=\"\\0\"\n"
3197 "\"Wine70b\"=\"\\0\\0\"\n"
3198 "\"Wine70c\"=\"Value1\\0\"\n"
3199 "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n"
3200 "\"Wine70e\"=\"Value3\\0Value4\"\n"
3201 "\"Wine70f\"=\"\\0Value5\"\n\n", &r);
3202 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3203 verify_reg_nonexist(hkey, "Wine70a");
3204 verify_reg_nonexist(hkey, "Wine70b");
3205 verify_reg_nonexist(hkey, "Wine70c");
3206 verify_reg_nonexist(hkey, "Wine70d");
3207 verify_reg_nonexist(hkey, "Wine70e");
3208 verify_reg_nonexist(hkey, "Wine70f");
3210 /* Test forward and back slashes */
3211 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3212 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3213 "\"count/up\"=\"one/two/three\"\n"
3214 "\"\\\\foo\\\\bar\"=\"\"\n\n"
3215 "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r);
3216 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3217 verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0);
3218 verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0);
3219 verify_key(hkey, "https://winehq.org", 0);
3221 close_key(hkey);
3223 delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0);
3226 static void test_import_with_whitespace(void)
3228 HKEY hkey;
3229 DWORD r, dword;
3231 delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0);
3233 test_import_str(" REGEDIT4\n\n"
3234 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r);
3235 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3237 open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
3239 test_import_str(" REGEDIT4\n\n"
3240 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3241 "\"Wine1a\"=\"Value\"\n\n", &r);
3242 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3243 verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0);
3245 test_import_str("\tREGEDIT4\n\n"
3246 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3247 "\"Wine1b\"=\"Value\"\n\n", &r);
3248 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3249 verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0);
3251 test_import_str(" \t REGEDIT4\n\n"
3252 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3253 "\"Wine1c\"=\"Value\"\n\n", &r);
3254 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3255 verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0);
3257 test_import_str("REGEDIT4\n\n"
3258 " [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3259 "\"Wine2a\"=\"Value\"\n\n", &r);
3260 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3261 verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0);
3263 test_import_str("REGEDIT4\n\n"
3264 "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3265 "\"Wine2b\"=\"Value\"\n\n", &r);
3266 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3267 verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0);
3269 test_import_str("REGEDIT4\n\n"
3270 " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3271 "\"Wine2c\"=\"Value\"\n\n", &r);
3272 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3273 verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0);
3275 test_import_str("REGEDIT4\n\n"
3276 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3277 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r);
3278 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3279 verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0);
3281 test_import_str("REGEDIT4\n\n"
3282 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3283 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r);
3284 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3285 verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0);
3287 test_import_str("REGEDIT4\n\n"
3288 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3289 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r);
3290 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3291 verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0);
3293 test_import_str(" REGEDIT4\n\n"
3294 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3295 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
3296 " \"Wine4b\"=dword:00112233\n"
3297 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n"
3298 " 63,6f,6e,\\;comment\n"
3299 "\t\t\t\t63,61,74,\\;comment\n"
3300 " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r);
3301 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3302 verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0);
3303 dword = 0x112233;
3304 verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0);
3305 verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3307 test_import_str(" REGEDIT4\n\n"
3308 "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3309 " \"Wine5a\"=\"Leading spaces\"\n"
3310 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
3311 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
3312 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r);
3313 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3314 verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0);
3315 verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0);
3316 verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0);
3317 verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0);
3319 test_import_str("REGEDIT4\n\n"
3320 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3321 "\" Wine6a\"=\"Leading spaces\"\n"
3322 "\"\t\tWine6b\"=\"Leading tabs\"\n"
3323 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r);
3324 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3325 verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0);
3326 verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0);
3327 verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0);
3329 test_import_str("REGEDIT4\n\n"
3330 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3331 "\"Wine7a\"=\" Four spaces in the data\"\n"
3332 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r);
3333 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3334 verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0);
3335 verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0);
3337 test_import_str("REGEDIT4\n\n"
3338 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3339 "\"Wine8a\"=\"Trailing spaces\" \n"
3340 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r);
3341 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3342 verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0);
3343 verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0);
3345 test_import_str("REGEDIT4\n\n"
3346 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3347 "\"Wine9a\"=dword: 00000008\n"
3348 "\"Wine9b\"=dword:\t\t00000008\n\n", &r);
3349 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3350 dword = 0x00000008;
3351 verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0);
3352 verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0);
3354 test_import_str("REGEDIT4\n\n"
3355 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3356 "@ = \"Test Value\"\n\n", &r);
3357 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3358 verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0);
3360 test_import_str("REGEDIT4\n\n"
3361 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3362 "\t@\t=\tdword:\t00000008\t\n\n", &r);
3363 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3364 verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0);
3366 close_key(hkey);
3368 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
3371 static void test_unicode_import_with_whitespace(void)
3373 HKEY hkey;
3374 DWORD r, dword;
3376 delete_tree(HKEY_CURRENT_USER, KEY_BASE, 0);
3378 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3379 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r);
3380 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3382 open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
3384 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3385 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3386 "\"Wine1a\"=\"Value\"\n\n", &r);
3387 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3388 verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0);
3390 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n"
3391 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3392 "\"Wine1b\"=\"Value\"\n\n", &r);
3393 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3394 verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0);
3396 test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n"
3397 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3398 "\"Wine1c\"=\"Value\"\n\n", &r);
3399 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3400 verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0);
3402 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3403 " [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3404 "\"Wine2a\"=\"Value\"\n\n", &r);
3405 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3406 verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0);
3408 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3409 "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3410 "\"Wine2b\"=\"Value\"\n\n", &r);
3411 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3412 verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0);
3414 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3415 " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3416 "\"Wine2c\"=\"Value\"\n\n", &r);
3417 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3418 verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0);
3420 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3421 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3422 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r);
3423 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3424 verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0);
3426 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3427 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3428 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r);
3429 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3430 verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0);
3432 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3433 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3434 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r);
3435 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3436 verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0);
3438 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3439 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3440 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
3441 " \"Wine4b\"=dword:00112233\n"
3442 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3443 " 63,00,6f,00,6e,00,\\;comment\n"
3444 "\t\t\t\t63,00,61,00,74,00,\\;comment\n"
3445 " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r);
3446 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3447 verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0);
3448 dword = 0x112233;
3449 verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0);
3450 verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3452 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3453 "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3454 " \"Wine5a\"=\"Leading spaces\"\n"
3455 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
3456 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
3457 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r);
3458 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3459 verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0);
3460 verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0);
3461 verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0);
3462 verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0);
3464 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3465 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3466 "\" Wine6a\"=\"Leading spaces\"\n"
3467 "\"\t\tWine6b\"=\"Leading tabs\"\n"
3468 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r);
3469 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3470 verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0);
3471 verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0);
3472 verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0);
3474 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3475 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3476 "\"Wine7a\"=\" Four spaces in the data\"\n"
3477 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r);
3478 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3479 verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0);
3480 verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0);
3482 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3483 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3484 "\"Wine8a\"=\"Trailing spaces\" \n"
3485 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r);
3486 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3487 verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0);
3488 verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0);
3490 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3491 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3492 "\"Wine9a\"=dword: 00000008\n"
3493 "\"Wine9b\"=dword:\t\t00000008\n\n", &r);
3494 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3495 dword = 0x00000008;
3496 verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0);
3497 verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0);
3499 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3500 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3501 "@ = \"Test Value\"\n\n", &r);
3502 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3503 verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0);
3505 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3506 "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
3507 "\t@\t=\tdword:\t00000008\t\n\n", &r);
3508 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3509 verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0);
3511 close_key(hkey);
3513 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
3516 static void test_import_win31(void)
3518 HKEY hkey;
3519 DWORD r;
3521 /* Check if reg.exe is running with elevated privileges */
3522 if (!is_elevated_process())
3524 win_skip("reg.exe is not running with elevated privileges; "
3525 "skipping Windows 3.1 import tests\n");
3526 return;
3529 /* Test simple value */
3530 test_import_str("REGEDIT\r\n"
3531 "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n", &r);
3532 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3533 open_key(HKEY_CLASSES_ROOT, KEY_BASE, KEY_SET_VALUE, &hkey);
3534 verify_reg(hkey, "", REG_SZ, "Value0", 7, 0);
3536 /* Test proper handling of spaces and equals signs */
3537 test_import_str("REGEDIT\r\n"
3538 "HKEY_CLASSES_ROOT\\" KEY_BASE " =Value1\r\n", &r);
3539 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3540 verify_reg(hkey, "", REG_SZ, "Value1", 7, 0);
3542 test_import_str("REGEDIT\r\n"
3543 "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2\r\n", &r);
3544 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3545 verify_reg(hkey, "", REG_SZ, " Value2", 8, 0);
3547 test_import_str("REGEDIT\r\n"
3548 "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value3 \r\n", &r);
3549 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3550 verify_reg(hkey, "", REG_SZ, "Value3 ", 8, 0);
3552 test_import_str("REGEDIT\r\n"
3553 "HKEY_CLASSES_ROOT\\" KEY_BASE " Value4\r\n", &r);
3554 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3555 verify_reg(hkey, "", REG_SZ, "Value4", 7, 0);
3557 test_import_str("REGEDIT\r\n"
3558 "HKEY_CLASSES_ROOT\\" KEY_BASE " Value5\r\n", &r);
3559 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3560 verify_reg(hkey, "", REG_SZ, "Value5", 7, 0);
3562 test_import_str("REGEDIT\r\n"
3563 "HKEY_CLASSES_ROOT\\" KEY_BASE "\r\n", &r);
3564 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3565 verify_reg(hkey, "", REG_SZ, "", 1, 0);
3567 test_import_str("REGEDIT\r\n"
3568 "HKEY_CLASSES_ROOT\\" KEY_BASE " \r\n", &r);
3569 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3570 verify_reg(hkey, "", REG_SZ, "", 1, 0);
3572 test_import_str("REGEDIT\r\n"
3573 "HKEY_CLASSES_ROOT\\" KEY_BASE " = No newline", &r);
3574 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3575 verify_reg(hkey, "", REG_SZ, "No newline", 11, 0);
3577 delete_value(hkey, NULL);
3579 /* Test character validity at the start of the line */
3580 test_import_str("REGEDIT\r\n"
3581 " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1a\r\n", &r);
3582 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3583 verify_reg_nonexist(hkey, "");
3585 test_import_str("REGEDIT\r\n"
3586 " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1b\r\n", &r);
3587 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3588 verify_reg_nonexist(hkey, "");
3590 test_import_str("REGEDIT\r\n"
3591 "\tHKEY_CLASSES_ROOT\\" KEY_BASE " = Value1c\r\n", &r);
3592 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3593 verify_reg_nonexist(hkey, "");
3595 test_import_str("REGEDIT\r\n"
3596 ";HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2a\r\n", &r);
3597 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3598 verify_reg_nonexist(hkey, "");
3600 test_import_str("REGEDIT\r\n"
3601 "#HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2b\r\n", &r);
3602 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3603 verify_reg_nonexist(hkey, "");
3605 /* Test case sensitivity */
3606 test_import_str("REGEDIT\r\n"
3607 "hkey_classes_root\\" KEY_BASE " = Value3a\r\n", &r);
3608 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3609 verify_reg_nonexist(hkey, "");
3611 test_import_str("REGEDIT\r\n"
3612 "hKEY_CLASSES_ROOT\\" KEY_BASE " = Value3b\r\n", &r);
3613 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3614 verify_reg_nonexist(hkey, "");
3616 test_import_str("REGEDIT\r\n"
3617 "Hkey_Classes_Root\\" KEY_BASE " = Value3c\r\n", &r);
3618 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3619 verify_reg_nonexist(hkey, "");
3621 close_key(hkey);
3623 delete_key(HKEY_CLASSES_ROOT, KEY_BASE, 0);
3626 static BOOL write_test_files(void)
3628 const char *test1, *test2;
3629 BOOL ret;
3631 test1 = "REGEDIT4\n\n"
3632 "[HKEY_LOCAL_MACHINE\\" KEY_BASE "]\n"
3633 "\"Wine1\"=dword:00000123\n\n"
3634 "\"Wine2\"=\"Test Value\"\n"
3635 "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n"
3636 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
3637 "#comment\n"
3638 "@=\"Test\"\n"
3639 ";comment\n\n"
3640 "\"Wine4\"=hex(2):25,50,41,54,48,25,00\n\n";
3642 test2 = "\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3643 "[HKEY_LOCAL_MACHINE\\" KEY_BASE "\\subkey]\n"
3644 "\"Empty string\"=\"\"\n"
3645 "\"\"=\"Default registry value\"\n\n";
3647 ret = write_reg_file("reg4.reg", test1, FALSE);
3648 ret = write_reg_file("reg5.reg", test2, TRUE);
3650 return ret;
3653 static void test_registry_view_win32(void)
3655 DWORD r, dword = 0x123;
3656 BOOL is_wow64, is_win32;
3657 HKEY hkey, subkey;
3659 IsWow64Process(GetCurrentProcess(), &is_wow64);
3660 is_win32 = !is_wow64 && (sizeof(void *) == sizeof(int));
3662 if (!is_win32) return;
3664 if (!write_test_files()) return;
3666 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3668 /* Try adding to the 32-bit registry view (32-bit Windows) */
3669 run_reg_exe("reg import reg4.reg /reg:32", &r);
3670 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3672 run_reg_exe("reg import reg5.reg /reg:32", &r);
3673 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3675 open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey);
3676 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
3677 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
3678 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3679 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
3680 verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0);
3682 open_key(hkey, "subkey", KEY_WOW64_32KEY, &subkey);
3683 verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0);
3684 verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0);
3685 close_key(subkey);
3686 close_key(hkey);
3688 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3689 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3691 /* Try adding to the 64-bit registry view, which doesn't exist on 32-bit Windows */
3692 run_reg_exe("reg import reg4.reg /reg:64", &r);
3693 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3695 run_reg_exe("reg import reg5.reg /reg:64", &r);
3696 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3698 open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
3699 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
3700 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
3701 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3702 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
3703 verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0);
3705 open_key(hkey, "subkey", KEY_WOW64_64KEY, &subkey);
3706 verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0);
3707 verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0);
3708 close_key(subkey);
3709 close_key(hkey);
3711 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3713 delete_file("reg4.reg");
3714 delete_file("reg5.reg");
3717 static void test_registry_view_win64(void)
3719 DWORD r, dword = 0x123;
3720 BOOL is_wow64, is_win64;
3721 HKEY hkey, subkey;
3723 IsWow64Process(GetCurrentProcess(), &is_wow64);
3724 is_win64 = !is_wow64 && (sizeof(void *) > sizeof(int));
3726 if (!is_win64) return;
3728 if (!write_test_files()) return;
3730 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3731 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3733 /* Try adding to the 32-bit registry view (64-bit Windows) */
3734 run_reg_exe("reg import reg4.reg /reg:32", &r);
3735 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3737 run_reg_exe("reg import reg5.reg /reg:32", &r);
3738 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3740 open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey);
3741 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
3742 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
3743 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3744 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
3745 verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0);
3747 open_key(hkey, "subkey", KEY_WOW64_32KEY, &subkey);
3748 verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0);
3749 verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0);
3750 close_key(subkey);
3751 close_key(hkey);
3753 verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3755 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3757 /* Try adding to the 64-bit registry view (64-bit Windows) */
3758 run_reg_exe("reg import reg4.reg /reg:64", &r);
3759 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3761 run_reg_exe("reg import reg5.reg /reg:64", &r);
3762 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3764 open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
3765 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
3766 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
3767 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3768 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
3769 verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0);
3771 open_key(hkey, "subkey", KEY_WOW64_64KEY, &subkey);
3772 verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0);
3773 verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0);
3774 close_key(subkey);
3775 close_key(hkey);
3777 verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3779 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3781 delete_file("reg4.reg");
3782 delete_file("reg5.reg");
3785 static void test_registry_view_wow64(void)
3787 DWORD r, dword = 0x123;
3788 BOOL is_wow64;
3789 HKEY hkey, subkey;
3791 IsWow64Process(GetCurrentProcess(), &is_wow64);
3793 if (!is_wow64) return;
3795 if (!write_test_files()) return;
3797 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3798 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3800 /* Try adding to the 32-bit registry view (WOW64) */
3801 run_reg_exe("reg import reg4.reg /reg:32", &r);
3802 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3804 run_reg_exe("reg import reg5.reg /reg:32", &r);
3805 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3807 open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY, &hkey);
3808 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
3809 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
3810 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3811 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
3812 verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0);
3814 open_key(hkey, "subkey", KEY_WOW64_32KEY, &subkey);
3815 verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0);
3816 verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0);
3817 close_key(subkey);
3818 close_key(hkey);
3820 verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3822 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3824 /* Try adding to the 64-bit registry view (WOW64) */
3825 run_reg_exe("reg import reg4.reg /reg:64", &r);
3826 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3828 run_reg_exe("reg import reg5.reg /reg:64", &r);
3829 ok(r == REG_EXIT_SUCCESS, "got exit code %ld, expected 0\n", r);
3831 open_key(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY, &hkey);
3832 verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
3833 verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
3834 verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
3835 verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
3836 verify_reg(hkey, "Wine4", REG_EXPAND_SZ, "%PATH%", 7, 0);
3838 open_key(hkey, "subkey", KEY_WOW64_64KEY, &subkey);
3839 verify_reg(subkey, "Empty string", REG_SZ, "", 1, 0);
3840 verify_reg(subkey, NULL, REG_SZ, "Default registry value", 23, 0);
3841 close_key(subkey);
3842 close_key(hkey);
3844 verify_key_nonexist(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_32KEY);
3846 delete_tree(HKEY_LOCAL_MACHINE, KEY_BASE, KEY_WOW64_64KEY);
3848 delete_file("reg4.reg");
3849 delete_file("reg5.reg");
3852 START_TEST(import)
3854 DWORD r;
3856 if (!run_reg_exe("reg.exe /?", &r)) {
3857 win_skip("reg.exe not available, skipping 'import' tests\n");
3858 return;
3861 test_command_syntax();
3862 test_import();
3863 test_unicode_import();
3864 test_import_with_whitespace();
3865 test_unicode_import_with_whitespace();
3866 test_import_win31();
3868 /* Check if reg.exe is running with elevated privileges */
3869 if (!is_elevated_process())
3871 win_skip("reg.exe is not running with elevated privileges; "
3872 "skipping registry view tests\n");
3873 return;
3876 test_registry_view_win32();
3877 test_registry_view_win64();
3878 test_registry_view_wow64();