ReactOS  0.4.15-dev-5606-gf34e425
import.c
Go to the documentation of this file.
1 /*
2  * Copyright 2016-2018, 2021 Hugh McMaster
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #include "reg_test.h"
20 
22 {
23  LONG err;
24  HKEY hkey;
25 
27 
28  if (err == ERROR_ACCESS_DENIED)
29  return FALSE;
30 
32  {
34  KEY_READ, NULL, &hkey, NULL))
35  return FALSE;
36 
39  }
40 
41  return TRUE;
42 }
43 
44 BOOL delete_file_(const char *file, unsigned line, const char *fname)
45 {
46  BOOL ret;
47 
48  ret = DeleteFileA(fname);
49  lok(ret, "DeleteFile failed: %u\n", GetLastError());
50 
51  return ret;
52 }
53 
54 static BOOL write_file(const char *fname, const void *str, DWORD size)
55 {
56  HANDLE file;
57  BOOL ret;
58  DWORD written;
59 
61  ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
63  return FALSE;
64 
65  ret = WriteFile(file, str, size, &written, NULL);
66  ok(ret, "WriteFile failed: %u\n", GetLastError());
68 
69  return ret;
70 }
71 
72 static BOOL write_reg_file(const char *fname, const char *contents, BOOL unicode)
73 {
74  int lenA;
75  BOOL ret;
76 
77  lenA = strlen(contents);
78 
79  if (unicode)
80  {
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);
86 
87  ret = write_file(fname, wstr, size);
88  HeapFree(GetProcessHeap(), 0, wstr);
89  }
90  else
91  ret = write_file(fname, contents, lenA);
92 
93  return ret;
94 }
95 
96 BOOL import_reg(const char *file, unsigned line, const char *contents, BOOL unicode, DWORD *rc)
97 {
98  BOOL ret;
99 
100  ret = write_reg_file("test.reg", contents, unicode);
101  if (!ret) return FALSE;
102 
103  run_reg_exe("reg import test.reg", rc);
104 
105  delete_file("test.reg");
106 
107  return ret;
108 }
109 
110 /* Unit tests */
111 
112 static void test_command_syntax(void)
113 {
114  DWORD r;
115 
116  run_reg_exe("reg import", &r);
117  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
118 
119  run_reg_exe("reg import /?", &r);
120  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
121 
122  run_reg_exe("reg import /h", &r);
123  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
124 
125  run_reg_exe("reg import -H", &r);
126  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
127 
128  run_reg_exe("reg import missing.reg", &r);
129  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
130 
131  run_reg_exe("reg import a.reg b.reg", &r);
132  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
133 
134  run_reg_exe("reg import foo.reg /reg:32 /reg:32", &r);
135  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
136 
137  run_reg_exe("reg import foo.reg /reg:32 /reg:64", &r);
138  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
139 
140  run_reg_exe("reg import foo.reg /reg:64 /reg:64", &r);
141  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
142 }
143 
144 static void test_import(void)
145 {
146  DWORD r, dword = 0x123, type, size;
147  char buffer[24];
148  HKEY hkey, subkey = NULL;
149  LONG err;
150  BYTE hex[8];
151 
153 
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 %d, expected 1\n", r);
158 
159  test_import_str("regedit4\n", &r);
160  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
161  "got exit code %d, expected 1\n", r);
162 
163  test_import_str("REGEDIT", &r);
164  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
165 
166  test_import_str("REGEDIT\n", &r);
167  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
168 
169  test_import_str("REGEDIT4\n", &r);
170  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
171 
172  test_import_str(" REGEDIT4\n", &r);
173  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
174 
175  test_import_str("\tREGEDIT4\n", &r);
176  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
177 
178  test_import_str("\nREGEDIT4\n", &r);
179  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
180  "got exit code %d, expected 1\n", r);
181 
182  test_import_str("AREGEDIT4\n", &r);
183  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
184  "got exit code %d, expected 1\n", r);
185 
186  test_import_str("1REGEDIT4\n", &r);
187  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
188  "got exit code %d, expected 1\n", r);
189 
190  test_import_str("REGEDIT3\n", &r);
191  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
192 
193  test_import_str("REGEDIT5\n", &r);
194  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
195 
196  test_import_str("REGEDIT9\n", &r);
197  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
198 
199  test_import_str("REGEDIT 4\n", &r);
200  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
201 
202  test_import_str("REGEDIT4 FOO\n", &r);
203  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
204 
205  test_import_str("REGEDIT4\n"
206  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r);
207  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
208 
210 
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 %d, expected 0\n", r);
215  verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0);
216 
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 %d, expected 0\n", r);
221  verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0);
222 
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 %d, expected 0\n", r);
227  verify_reg_nonexist(hkey, "Test1");
228 
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 %d, expected 1\n", r);
234  verify_reg_nonexist(hkey, "Test2");
235 
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 %d, expected 1\n", r);
241  verify_reg_nonexist(hkey, "Test3");
242 
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 %d, expected 0\n", r);
247  verify_reg_nonexist(hkey, "Test4");
248 
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 %d, expected 0\n", r);
253  verify_reg_nonexist(hkey, "Test5");
254 
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 %d, expected 0\n", r);
259  verify_reg_nonexist(hkey, "Test6");
260 
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 %d, expected 0\n", r);
265  verify_reg_nonexist(hkey, "Test7");
266 
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 %d, expected 0\n", r);
271  verify_reg_nonexist(hkey, "Test8");
272 
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 %d, expected 1\n", r);
278  verify_reg_nonexist(hkey, "Test9");
279 
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 %d, expected 1\n", r);
285  verify_reg_nonexist(hkey, "Test10");
286 
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 %d, expected 1\n", r);
292  verify_reg_nonexist(hkey, "Test11");
293 
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 %d, expected 1\n", r);
299  verify_reg_nonexist(hkey, "Test12");
300 
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 %d, expected 0\n", r);
305  verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0);
306 
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 %d, expected 0\n", r);
311  verify_reg(hkey, "Test2", REG_SZ, "Value2", 7, 0);
312 
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 %d, expected 0\n", r);
317  verify_reg(hkey, "Test3", REG_SZ, "Value3", 7, 0);
318 
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 %d, expected 1\n", r);
322 
323  test_import_str("Windows Registry Editor Version 5.00\n", &r);
324  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
325 
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 %d, expected 0\n", r);
330  verify_reg(hkey, "Test4", REG_SZ, "Value4", 7, 0);
331 
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 %d, expected 0\n", r);
336  verify_reg(hkey, "Test5", REG_SZ, "Value5", 7, 0);
337 
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 %d, expected 0\n", r);
342  verify_reg(hkey, "Test6", REG_SZ, "Value6", 7, 0);
343 
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 %d, 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);
355 
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 %d, 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);
374 
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 %d, 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 %d, expected 0\n", err);
382  if (err == ERROR_SUCCESS)
383  verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
384 
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 %d, 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 %d, expected 0\n", err);
395  if (err == ERROR_SUCCESS)
396  verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
397 
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 %d, 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);
407 
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 %d, 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);
420 
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 %d, 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);
436 
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 %d, 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");
454 
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 %d, 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);
483 
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 %d, expected 0\n", r);
491  verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
492 
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 %d, expected 0\n", r);
500  verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
501 
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 %d, expected 0\n", r);
507  verify_reg_nonexist(hkey, "Multi-Line3");
508 
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 %d, expected 0\n", r);
514  verify_reg_nonexist(hkey, "Multi-Line4");
515 
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 %d, expected 0\n", r);
521  verify_reg_nonexist(hkey, "Multi-Line5");
522 
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 %d, expected 0\n", r);
528  verify_reg_nonexist(hkey, "Multi-Line6");
529 
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 %d, expected 0\n", r);
538  verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
539 
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 %d, expected 0\n", r);
548  verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
549 
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 %d, expected 0\n", r);
558  verify_reg_nonexist(hkey, "Multi-Line9");
559 
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 %d, expected 0\n", r);
568  verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
569 
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 %d, 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);
579 
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 %d, 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");
593 
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 %d, expected 0\n", r);
599  verify_reg_nonexist(hkey, "Wine34a");
600  verify_reg_nonexist(hkey, "Wine34b");
601 
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 %d, expected 0\n", r);
608  verify_reg_nonexist(hkey, "Wine35a");
609  verify_reg_nonexist(hkey, "Wine35b");
610  verify_reg_nonexist(hkey, "Wine35c");
611 
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 %d, 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");
624 
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 %d, expected 0\n", r);
630  verify_reg_nonexist(hkey, "Wine37a");
631  verify_reg_nonexist(hkey, "Wine37b");
632 
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 %d, 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);
640 
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 %d, 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");
652 
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 %d, 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");
664 
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 %d, expected 0\n", r);
669  verify_reg_nonexist(hkey, "TestNoBeginQuote");
670 
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 %d, expected 0\n", r);
675  verify_reg_nonexist(hkey, "TestNoEndQuote");
676 
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 %d, expected 0\n", r);
681  verify_reg_nonexist(hkey, "TestNoQuotes");
682 
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 %d, expected 0\n", r);
687  verify_reg_nonexist(hkey, "NameNoBeginQuote");
688 
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 %d, expected 0\n", r);
693  verify_reg_nonexist(hkey, "NameNoEndQuote");
694 
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 %d, expected 0\n", r);
699  verify_reg_nonexist(hkey, "NameNoQuotes");
700 
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 %d, expected 0\n", r);
705  verify_reg_nonexist(hkey, "MixedQuotes");
706  verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa");
707 
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 %d, 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);
725 
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 %d, expected 0\n", r);
733  verify_reg_nonexist(hkey, "Wine41a");
734  verify_reg_nonexist(hkey, "Wine41b");
735 
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 %d, 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);
744 
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 %d, expected 0\n", r);
750  verify_key_nonexist(hkey, "Subkey1", 0);
751 
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 %d, expected 0\n", r);
756  verify_key_nonexist(hkey, "Subkey2", 0);
757 
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 %d, 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");
769 
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 %d, 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");
810 
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 %d, 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: %d\n", err);
851  ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
852  ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, 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: %d\n", err);
859  ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
860  ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
861  ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
862  /* Wine44k */
863  verify_reg_nonexist(hkey, "Wine44k");
864 
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 %d, 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");
906 
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 %d, 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);
916 
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 %d, 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);
925 
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 %d, expected 0\n", r);
930  verify_key_nonexist(hkey, "No_Opening_Bracket", 0);
931 
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 %d, expected 0\n", r);
935  verify_key_nonexist(hkey, "No_Closing_Bracket", 0);
936 
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 %d, expected 0\n", r);
940  verify_key_nonexist(hkey, "Subkey1a", 0);
941 
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 %d, expected 0\n", r);
945  verify_key_nonexist(hkey, "Subkey1b", 0);
946 
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 %d, expected 0\n", r);
950  verify_key(hkey, "Subkey1c ", 0);
951  delete_key(hkey, "Subkey1c ", 0);
952 
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 %d, expected 0\n", r);
956  verify_key(hkey, "Subkey1d\t", 0);
957  delete_key(hkey, "Subkey1d\t", 0);
958 
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 %d, 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);
969 
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 %d, 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);
981 
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 %d, 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);
994 
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 %d, expected 0\n", r);
1000  verify_key(hkey, "Subkey2a", 0);
1001  verify_key(hkey, "Subkey2b", 0);
1002 
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 %d, expected 0\n", r);
1006  verify_key(hkey, "Subkey2a", 0);
1007 
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 %d, expected 0\n", r);
1011  verify_key(hkey, "Subkey2b", 0);
1012 
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 %d, expected 0\n", r);
1016  verify_key(hkey, "Subkey2a", 0);
1017 
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 %d, expected 0\n", r);
1021  verify_key(hkey, "Subkey2b", 0);
1022 
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 %d, expected 0\n", r);
1027  verify_key_nonexist(hkey, "Subkey2a", 0);
1028  verify_key_nonexist(hkey, "Subkey2b", 0);
1029 
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 %d, expected 0\n", r);
1035  verify_key(hkey, "Subkey3a", 0);
1036  verify_key(hkey, "Subkey3b", 0);
1037 
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 %d, expected 0\n", r);
1042  verify_key_nonexist(hkey, "Subkey3a", 0);
1043  verify_key_nonexist(hkey, "Subkey3b", 0);
1044 
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 %d, expected 0\n", r);
1049  verify_key(hkey, "Subkey4a", 0);
1050 
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 %d, expected 0\n", r);
1056  verify_key_nonexist(hkey, "Subkey4a", 0);
1057  verify_reg_nonexist(hkey, "Wine46a");
1058 
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 %d, expected 0\n", r);
1064  verify_key_nonexist(hkey, "Subkey4b", 0);
1065  verify_reg_nonexist(hkey, "Wine46b");
1066 
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 %d, 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);
1084 
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 %d, 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);
1100 
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 %d, 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");
1129 
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 %d, 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);
1139 
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 %d, expected 0\n", r);
1144  verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0);
1145 
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 %d, 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");
1157 
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 %d, expected 0\n", r);
1164  verify_reg_nonexist(hkey, "Wine51a");
1165  verify_reg_nonexist(hkey, "Wine51b");
1166 
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 %d, 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);
1199 
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 %d, 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");
1221 
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 %d, expected 0\n", r);
1227  verify_reg_nonexist(hkey, "Wine54a");
1228  verify_key_nonexist(hkey, "Subkey1", 0);
1229 
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 %d, expected 0\n", r);
1235  verify_reg_nonexist(hkey, "Wine54b");
1236  verify_key(hkey, "Subkey2", 0);
1237 
1238  delete_key(hkey, "Subkey2", 0);
1239 
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"
1244 
1245  "\"Wine55c\"=hex(2):4c,69,6e,65,20,\\\n"
1246  ";comment\n"
1247  "\"Wine55d\"=\"Test value\"\n"
1248 
1249  "\"Wine55e\"=hex(2):4c,69,6e,65,20,\\\n"
1250  "#comment\n"
1251  "\"Wine55f\"=\"Test value\"\n"
1252 
1253  "\"Wine55g\"=hex(2):4c,69,6e,65,20,\\\n\n"
1254  "\"Wine55h\"=\"Test value\"\n"
1255 
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 %d, 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);
1269 
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"
1274 
1275  "\"Wine56c\"=hex(2):4c,69,6e,65,20,\\\n"
1276  ";comment\n"
1277  "\"Wine56d\"=dword:00000008\n"
1278 
1279  "\"Wine56e\"=hex(2):4c,69,6e,65,20,\\\n"
1280  "#comment\n"
1281  "\"Wine56f\"=dword:00000008\n"
1282 
1283  "\"Wine56g\"=hex(2):4c,69,6e,65,20,\\\n\n"
1284  "\"Wine56h\"=dword:00000008\n"
1285 
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 %d, 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);
1299 
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"
1304 
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"
1308 
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"
1312 
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"
1315 
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 %d, 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);
1329 
1331 
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 %d, expected 0\n", r);
1337  verify_reg_nonexist(hkey, "Wine58a");
1339 
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 %d, expected 0\n", r);
1346  verify_reg_nonexist(hkey, "Wine58b");
1348 
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 %d, expected 0\n", r);
1355  verify_reg_nonexist(hkey, "Wine58c");
1356  verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0);
1357 
1359 
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 %d, expected 0\n", r);
1365  verify_reg_nonexist(hkey, "Wine58d");
1367 
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 %d, expected 0\n", r);
1373  verify_reg_nonexist(hkey, "Wine58e");
1374  verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0);
1375 
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 %d, expected 0\n", r);
1385  verify_reg_nonexist(hkey, "Wine59a");
1386  verify_reg_nonexist(hkey, "Wine59b");
1387 
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 %d, expected 0\n", r);
1396  verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1397 
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 %d, expected 0\n", r);
1406  verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1407 
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 %d, expected 0\n", r);
1416  verify_reg_nonexist(hkey, "Wine60c");
1417 
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 %d, expected 0\n", r);
1426  verify_reg_nonexist(hkey, "Wine60d");
1427 
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 %d, expected 0\n", r);
1436  verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1437 
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 %d, expected 0\n", r);
1446  verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1447 
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 %d, expected 0\n", r);
1455  verify_reg_nonexist(hkey, "Wine61a");
1456  verify_reg_nonexist(hkey, "Wine61b");
1457 
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 %d, 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 %d, expected 0\n", err);
1465  if (err == ERROR_SUCCESS)
1466  verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0);
1467 
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 %d, 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 %d, expected 0\n", err);
1475  if (err == ERROR_SUCCESS)
1476  verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0);
1477 
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 %d, 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 %d, expected 0\n", err);
1485  if (err == ERROR_SUCCESS)
1486  verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0);
1487 
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 %d, 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 %d, expected 0\n", err);
1495  if (err == ERROR_SUCCESS)
1496  verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0);
1497 
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 %d, 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 %d, expected 0\n", err);
1505  if (err == ERROR_SUCCESS)
1506  verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0);
1507 
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 %d, expected 0\n", r);
1512  verify_reg_nonexist(hkey, "Wine62f");
1513 
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 %d, expected 0\n", r);
1521  verify_reg_nonexist(hkey, "Wine63a");
1522  verify_reg_nonexist(hkey, "Wine63b");
1523 
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 %d, 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: %d\n", err);
1546  ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
1547  ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, 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: %d\n", err);
1553  ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
1554  ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
1555  ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
1556 
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 %d, 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);
1577 
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 %d, 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);
1594 
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 %d, 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);
1606 
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 %d, 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);
1628 
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 %d, 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);
1645 
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 %d, 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");
1661 
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 %d, 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);
1672 
1673  close_key(hkey);
1674 
1676 }
1677 
1678 static void test_unicode_import(void)
1679 {
1680  DWORD r, dword = 0x123, type, size;
1681  HKEY hkey, subkey;
1682  LONG err;
1683  char buffer[24];
1684  BYTE hex[8];
1685 
1687 
1688  test_import_wstr("REGEDIT\n", &r);
1689  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1690  "got exit code %d, expected 1\n", r);
1691 
1692  test_import_wstr("REGEDIT4\n", &r);
1693  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1694  "got exit code %d, expected 1\n", r);
1695 
1696  test_import_wstr("\xef\xbb\xbfREGEDIT", &r);
1697  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1698 
1699  test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r);
1700  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1701 
1702  test_import_wstr("\xef\xbb\xbfREGEDIT4", &r);
1703  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1704 
1705  test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r);
1706  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1707 
1708  test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r);
1709  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1710 
1711  test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r);
1712  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1713 
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 %d, expected 1\n", r);
1717 
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 %d, expected 0\n", r);
1721 
1723 
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 %d, expected 0\n", r);
1728  verify_reg_nonexist(hkey, "Test1");
1729 
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 %d, expected 1\n", r);
1735  verify_reg_nonexist(hkey, "Test2");
1736 
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 %d, expected 1\n", r);
1742  verify_reg_nonexist(hkey, "Test3");
1743 
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 %d, expected 0\n", r);
1748  verify_reg_nonexist(hkey, "Test4");
1749 
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 %d, expected 0\n", r);
1754  verify_reg_nonexist(hkey, "Test5");
1755 
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 %d, expected 0\n", r);
1760  verify_reg_nonexist(hkey, "Test6");
1761 
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 %d, expected 0\n", r);
1766  verify_reg_nonexist(hkey, "Test7");
1767 
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 %d, expected 0\n", r);
1772  verify_reg_nonexist(hkey, "Test8");
1773 
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 %d, expected 0\n", r);
1778  verify_reg(hkey, "Unicode1", REG_SZ, "Value1", 7, 0);
1779 
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 %d, expected 0\n", r);
1784  verify_reg(hkey, "Unicode2", REG_SZ, "Value2", 7, 0);
1785 
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 %d, expected 0\n", r);
1790  verify_reg(hkey, "Unicode3", REG_SZ, "Value3", 7, 0);
1791 
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 %d, expected 1\n", r);
1795 
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 %d, expected 1\n", r);
1799 
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 %d, expected 1\n", r);
1803 
1804  test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r);
1805  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1806 
1807  test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r);
1808  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1809 
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 %d, expected 1\n", r);
1813 
1814  test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r);
1815  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1816 
1817  test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r);
1818  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1819 
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 %d, expected 1\n", r);
1823 
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 %d, expected 1\n", r);
1829  verify_reg_nonexist(hkey, "Test9");
1830 
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 %d, expected 1\n", r);
1836  verify_reg_nonexist(hkey, "Test10");
1837 
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 %d, expected 1\n", r);
1843  verify_reg_nonexist(hkey, "Test11");
1844 
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 %d, expected 1\n", r);
1850  verify_reg_nonexist(hkey, "Test12");
1851 
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 %d, expected 0\n", r);
1856  verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0);
1857 
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 %d, expected 0\n", r);
1862  verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0);
1863 
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 %d, expected 0\n", r);
1868  verify_reg(hkey, "Unicode4", REG_SZ, "Value4", 7, 0);
1869 
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 %d, expected 0\n", r);
1874  verify_reg(hkey, "Unicode5", REG_SZ, "Value5", 7, 0);
1875 
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 %d, expected 0\n", r);
1880  verify_reg(hkey, "Unicode6", REG_SZ, "Value6", 7, 0);
1881 
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 %d, 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);
1893 
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 %d, 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);
1912 
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 %d, 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 %d, expected 0\n", err);
1920  if (err == ERROR_SUCCESS)
1921  verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
1922 
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 %d, 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 %d, expected 0\n", err);
1933  if (err == ERROR_SUCCESS)
1934  verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
1935 
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 %d, 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);
1945 
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 %d, 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);
1958 
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 %d, 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);
1974 
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 %d, 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");
1992 
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 %d, 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);
2021 
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 %d, 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);
2031 
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 %d, 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");
2045 
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 %d, expected 0\n", r);
2051  verify_reg_nonexist(hkey, "Wine34a");
2052  verify_reg_nonexist(hkey, "Wine34b");
2053 
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 %d, expected 0\n", r);
2060  verify_reg_nonexist(hkey, "Wine35a");
2061  verify_reg_nonexist(hkey, "Wine35b");
2062  verify_reg_nonexist(hkey, "Wine35c");
2063 
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 %d, 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");
2076 
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 %d, expected 0\n", r);
2082  verify_reg_nonexist(hkey, "Wine37a");
2083  verify_reg_nonexist(hkey, "Wine37b");
2084 
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 %d, 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);
2092 
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 %d, 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");
2104 
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 %d, 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");
2116 
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 %d, expected 0\n", r);
2121  verify_reg_nonexist(hkey, "TestNoBeginQuote");
2122 
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 %d, expected 0\n", r);
2127  verify_reg_nonexist(hkey, "TestNoEndQuote");
2128 
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 %d, expected 0\n", r);
2133  verify_reg_nonexist(hkey, "TestNoQuotes");
2134 
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 %d, expected 0\n", r);
2139  verify_reg_nonexist(hkey, "NameNoBeginQuote");
2140 
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 %d, expected 0\n", r);
2145  verify_reg_nonexist(hkey, "NameNoEndQuote");
2146 
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 %d, expected 0\n", r);
2151  verify_reg_nonexist(hkey, "NameNoQuotes");
2152 
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 %d, expected 0\n", r);
2157  verify_reg_nonexist(hkey, "MixedQuotes");
2158  verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa");
2159 
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 %d, 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);
2177 
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 %d, expected 0\n", r);
2185  verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2186 
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 %d, expected 0\n", r);
2194  verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
2195 
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 %d, expected 0\n", r);
2201  verify_reg_nonexist(hkey, "Multi-Line3");
2202 
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 %d, expected 0\n", r);
2208  verify_reg_nonexist(hkey, "Multi-Line4");
2209 
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 %d, expected 0\n", r);
2215  verify_reg_nonexist(hkey, "Multi-Line5");
2216 
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 %d, expected 0\n", r);
2222  verify_reg_nonexist(hkey, "Multi-Line6");
2223 
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 %d, expected 0\n", r);
2232  verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2233 
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 %d, expected 0\n", r);
2242  verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2243 
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 %d, expected 0\n", r);
2252  verify_reg_nonexist(hkey, "Multi-Line9");
2253 
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 %d, expected 0\n", r);
2262  verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2263 
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 %d, expected 0\n", r);
2271  verify_reg_nonexist(hkey, "Wine41a");
2272  verify_reg_nonexist(hkey, "Wine41b");
2273 
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 %d, 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);
2282 
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 %d, expected 0\n", r);
2288  verify_key_nonexist(hkey, "Subkey1", 0);
2289 
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 %d, expected 0\n", r);
2294  verify_key_nonexist(hkey, "Subkey2", 0);
2295 
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 %d, 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");
2307 
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 %d, 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");
2348 
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 %d, 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: %d\n", err);
2389  ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
2390  ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, 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: %d\n", err);
2397  ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
2398  ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
2399  ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
2400  /* Wine44k */
2401  verify_reg_nonexist(hkey, "Wine44k");
2402 
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 %d, 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");
2444 
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 %d, 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);
2454 
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 %d, 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);
2463 
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 %d, expected 0\n", r);
2468  verify_key_nonexist(hkey, "No_Opening_Bracket", 0);
2469 
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 %d, expected 0\n", r);
2473  verify_key_nonexist(hkey, "No_Closing_Bracket", 0);
2474 
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 %d, expected 0\n", r);
2478  verify_key_nonexist(hkey, "Subkey1a", 0);
2479 
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 %d, expected 0\n", r);
2483  verify_key_nonexist(hkey, "Subkey1b", 0);
2484 
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 %d, expected 0\n", r);
2488  verify_key(hkey, "Subkey1c ", 0);
2489  delete_key(hkey, "Subkey1c ", 0);
2490 
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 %d, expected 0\n", r);
2494  verify_key(hkey, "Subkey1d\t", 0);
2495  delete_key(hkey, "Subkey1d\t", 0);
2496 
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 %d, 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);
2507 
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 %d, 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);
2519 
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 %d, 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);
2532 
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 %d, expected 0\n", r);
2538  verify_key(hkey, "Subkey2a", 0);
2539  verify_key(hkey, "Subkey2b", 0);
2540 
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 %d, expected 0\n", r);
2544  verify_key(hkey, "Subkey2a", 0);
2545 
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 %d, expected 0\n", r);
2549  verify_key(hkey, "Subkey2b", 0);
2550 
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 %d, expected 0\n", r);
2554  verify_key(hkey, "Subkey2a", 0);
2555 
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 %d, expected 0\n", r);
2559  verify_key(hkey, "Subkey2b", 0);
2560 
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 %d, expected 0\n", r);
2565  verify_key_nonexist(hkey, "Subkey2a", 0);
2566  verify_key_nonexist(hkey, "Subkey2b", 0);
2567 
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 %d, expected 0\n", r);
2573  verify_key(hkey, "Subkey3a", 0);
2574  verify_key(hkey, "Subkey3b", 0);
2575 
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 %d, expected 0\n", r);
2580  verify_key_nonexist(hkey, "Subkey3a", 0);
2581  verify_key_nonexist(hkey, "Subkey3b", 0);
2582 
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 %d, expected 0\n", r);
2587  verify_key(hkey, "Subkey4a", 0);
2588 
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 %d, expected 0\n", r);
2594  verify_key_nonexist(hkey, "Subkey4a", 0);
2595  verify_reg_nonexist(hkey, "Wine46a");
2596 
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 %d, expected 0\n", r);
2602  verify_key_nonexist(hkey, "Subkey4b", 0);
2603  verify_reg_nonexist(hkey, "Wine46b");
2604 
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 %d, 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);
2623 
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 %d, 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);
2639 
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 %d, 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");
2668 
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 %d, 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);
2680 
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 %d, expected 0\n", r);
2685  verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0);
2686 
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 %d, 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");
2698 
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 %d, expected 0\n", r);
2705  verify_reg_nonexist(hkey, "Wine51a");
2706  verify_reg_nonexist(hkey, "Wine51b");
2707 
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 %d, 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);
2740 
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 %d, 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");
2762 
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 %d, expected 0\n", r);
2768  verify_reg_nonexist(hkey, "Wine54a");
2769  verify_key_nonexist(hkey, "Subkey1", 0);
2770 
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 %d, expected 0\n", r);
2776  verify_reg_nonexist(hkey, "Wine54b");
2777  verify_key(hkey, "Subkey2", 0);
2778 
2779  delete_key(hkey, "Subkey2", 0);
2780 
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"
2785 
2786  "\"Wine55c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2787  ";comment\n"
2788  "\"Wine55d\"=\"Test value\"\n"
2789 
2790  "\"Wine55e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2791  "#comment\n"
2792  "\"Wine55f\"=\"Test value\"\n"
2793 
2794  "\"Wine55g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
2795  "\"Wine55h\"=\"Test value\"\n"
2796 
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 %d, 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);
2810 
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"
2815 
2816  "\"Wine56c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2817  ";comment\n"
2818  "\"Wine56d\"=dword:00000008\n"
2819 
2820  "\"Wine56e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2821  "#comment\n"
2822  "\"Wine56f\"=dword:00000008\n"
2823 
2824  "\"Wine56g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
2825  "\"Wine56h\"=dword:00000008\n"
2826 
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 %d, 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);
2840 
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"
2845 
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"
2849 
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"
2853 
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"
2856 
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 %d, 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);
2870 
2872 
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 %d, expected 0\n", r);
2878  verify_reg_nonexist(hkey, "Wine58a");
2880 
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 %d, expected 0\n", r);
2887  verify_reg_nonexist(hkey, "Wine58b");
2889 
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 %d, expected 0\n", r);
2896  verify_reg_nonexist(hkey, "Wine58c");
2897  verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0);
2898 
2900 
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 %d, expected 0\n", r);
2906  verify_reg_nonexist(hkey, "Wine58d");
2908 
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 %d, expected 0\n", r);
2914  verify_reg_nonexist(hkey, "Wine58e");
2915  verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0);
2916 
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 %d, expected 0\n", r);
2926  verify_reg_nonexist(hkey, "Wine59a");
2927  verify_reg_nonexist(hkey, "Wine59b");
2928 
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 %d, expected 0\n", r);
2937  verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2938 
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 %d, expected 0\n", r);
2947  verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2948 
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 %d, expected 0\n", r);
2957  verify_reg_nonexist(hkey, "Wine60c");
2958 
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 %d, expected 0\n", r);
2967  verify_reg_nonexist(hkey, "Wine60d");
2968 
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 %d, expected 0\n", r);
2977  verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2978 
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 %d, expected 0\n", r);
2987  verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2988 
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 %d, expected 0\n", r);
2996  verify_reg_nonexist(hkey, "Wine61a");
2997  verify_reg_nonexist(hkey, "Wine61b");
2998 
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 %d, 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 %d, expected 0\n", err);
3006  if (err == ERROR_SUCCESS)
3007  verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0);
3008 
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 %d, 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 %d, expected 0\n", err);
3016  if (err == ERROR_SUCCESS)
3017  verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0);
3018 
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 %d, 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 %d, expected 0\n", err);
3026  if (err == ERROR_SUCCESS)
3027  verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0);
3028 
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 %d, 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 %d, expected 0\n", err);
3036  if (err == ERROR_SUCCESS)
3037  verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0);
3038 
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 %d, 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 %d, expected 0\n", err);
3046  if (err == ERROR_SUCCESS)
3047  verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0);
3048 
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 %d, expected 0\n", r);
3053  verify_reg_nonexist(hkey, "Wine62f");
3054 
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 %d, expected 0\n", r);
3068  verify_reg_nonexist(hkey, "Wine63a");
3069  verify_reg_nonexist(hkey, "Wine63b");
3070 
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 %d, 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: %d\n", err);
3094  ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
3095  ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, 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: %d\n", err);
3101  ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
3102  ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
3103  ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
3104 
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 %d, 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);
3125 
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 %d, 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);
3142 
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 %d, 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);
3154 
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 %d, 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);
3176 
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 %d, 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);
3193 
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 %d, 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");
3209 
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 %d, 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);
3220 
3221  close_key(hkey);
3222 
3224 }
3225 
3227 {
3228  HKEY hkey;
3229  DWORD r, dword;
3230 
3232 
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 %d, expected 0\n", r);
3236 
3238 
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 %d, expected 0\n", r);
3243  verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0);
3244 
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 %d, expected 0\n", r);
3249  verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0);
3250 
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 %d, expected 0\n", r);
3255  verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0);
3256 
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 %d, expected 0\n", r);
3261  verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0);
3262 
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 %d, expected 0\n", r);
3267  verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0);
3268 
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 %d, expected 0\n", r);
3273  verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0);
3274 
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 %d, expected 0\n", r);
3279  verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0);
3280 
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 %d, expected 0\n", r);
3285  verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0);
3286 
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 %d, expected 0\n", r);
3291  verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0);
3292 
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 %d, 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);
3306 
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 %d, 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);
3318 
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 %d, 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);
3328 
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 %d, 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);
3336 
3337  test_import_str("REGEDIT4\n\n"