2 * Copyright 2014 Akihiro Sagawa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/test.h"
23 #define lok ok_(__FILE__,line)
24 #define KEY_BASE "Software\\Wine\\reg_test"
25 #define REG_EXIT_SUCCESS 0
26 #define REG_EXIT_FAILURE 1
27 #define TODO_REG_TYPE (0x0001u)
28 #define TODO_REG_SIZE (0x0002u)
29 #define TODO_REG_DATA (0x0004u)
31 #define run_reg_exe(c,r) run_reg_exe_(__LINE__,c,r)
32 static BOOL
run_reg_exe_(unsigned line
, const char *cmd
, DWORD
*rc
)
34 STARTUPINFOA si
= {sizeof(STARTUPINFOA
)};
35 PROCESS_INFORMATION pi
;
40 si
.dwFlags
= STARTF_USESTDHANDLES
;
41 si
.hStdInput
= INVALID_HANDLE_VALUE
;
42 si
.hStdOutput
= INVALID_HANDLE_VALUE
;
43 si
.hStdError
= INVALID_HANDLE_VALUE
;
46 if (!CreateProcessA(NULL
, cmdline
, NULL
, NULL
, TRUE
, 0, NULL
, NULL
, &si
, &pi
))
49 ret
= WaitForSingleObject(pi
.hProcess
, 10000);
50 if (ret
== WAIT_TIMEOUT
)
51 TerminateProcess(pi
.hProcess
, 1);
53 bret
= GetExitCodeProcess(pi
.hProcess
, rc
);
54 lok(bret
, "GetExitCodeProcess failed: %d\n", GetLastError());
56 CloseHandle(pi
.hThread
);
57 CloseHandle(pi
.hProcess
);
61 #define verify_reg(k,v,t,d,s,todo) verify_reg_(__LINE__,k,v,t,d,s,todo)
62 static void verify_reg_(unsigned line
, HKEY hkey
, const char* value
,
63 DWORD exp_type
, const void *exp_data
, DWORD exp_size
, DWORD todo
)
70 memset(data
, 0xdd, size
);
71 err
= RegQueryValueExA(hkey
, value
, NULL
, &type
, data
, &size
);
72 lok(err
== ERROR_SUCCESS
, "RegQueryValueEx failed: got %d\n", err
);
73 if (err
!= ERROR_SUCCESS
)
76 todo_wine_if (todo
& TODO_REG_TYPE
)
77 lok(type
== exp_type
, "got wrong type %d, expected %d\n", type
, exp_type
);
78 todo_wine_if (todo
& TODO_REG_SIZE
)
79 lok(size
== exp_size
, "got wrong size %d, expected %d\n", size
, exp_size
);
80 todo_wine_if (todo
& TODO_REG_DATA
)
81 lok(memcmp(data
, exp_data
, size
) == 0, "got wrong data\n");
84 #define verify_reg_nonexist(k,v) verify_reg_nonexist_(__LINE__,k,v)
85 static void verify_reg_nonexist_(unsigned line
, HKEY hkey
, const char *value
)
89 err
= RegQueryValueExA(hkey
, value
, NULL
, NULL
, NULL
, NULL
);
90 lok(err
== ERROR_FILE_NOT_FOUND
, "registry value '%s' shouldn't exist; got %d, expected 2\n",
91 (value
&& *value
) ? value
: "(Default)", err
);
94 #define verify_key(k,s) verify_key_(__LINE__,k,s)
95 static void verify_key_(unsigned line
, HKEY key_base
, const char *subkey
)
100 err
= RegOpenKeyExA(key_base
, subkey
, 0, KEY_READ
, &hkey
);
101 lok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d\n", err
);
107 #define verify_key_nonexist(k,s) verify_key_nonexist_(__LINE__,k,s)
108 static void verify_key_nonexist_(unsigned line
, HKEY key_base
, const char *subkey
)
113 err
= RegOpenKeyExA(key_base
, subkey
, 0, KEY_READ
, &hkey
);
114 lok(err
== ERROR_FILE_NOT_FOUND
, "registry key '%s' shouldn't exist; got %d, expected 2\n",
121 static void test_add(void)
125 DWORD r
, dword
, type
, size
;
128 run_reg_exe("reg add", &r
);
129 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
131 run_reg_exe("reg add /?", &r
);
132 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
134 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
135 ok(err
== ERROR_SUCCESS
|| err
== ERROR_FILE_NOT_FOUND
, "got %d\n", err
);
137 verify_key_nonexist(HKEY_CURRENT_USER
, KEY_BASE
);
139 run_reg_exe("reg add HKCU\\" KEY_BASE
" /f", &r
);
140 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
142 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
143 ok(err
== ERROR_SUCCESS
, "key creation failed, got %d\n", err
);
145 /* Test empty type */
146 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v emptyType /t \"\" /d WineTest /f", &r
);
147 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
149 /* Test input key formats */
150 run_reg_exe("reg add \\HKCU\\" KEY_BASE
"\\keytest0 /f", &r
);
151 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
152 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest0");
153 ok(err
== ERROR_FILE_NOT_FOUND
, "got exit code %d\n", err
);
155 run_reg_exe("reg add \\\\HKCU\\" KEY_BASE
"\\keytest1 /f", &r
);
156 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
157 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest1");
158 ok(err
== ERROR_FILE_NOT_FOUND
, "got exit code %d\n", err
);
160 run_reg_exe("reg add HKCU\\" KEY_BASE
"\\keytest2\\\\ /f", &r
);
161 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */),
162 "got exit code %u\n", r
);
163 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest2");
164 ok(err
== ERROR_FILE_NOT_FOUND
|| broken(err
== ERROR_SUCCESS
/* WinXP */),
165 "got exit code %d\n", err
);
167 run_reg_exe("reg add HKCU\\" KEY_BASE
"\\keytest3\\ /f", &r
);
168 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
169 verify_key(hkey
, "keytest3");
170 err
= RegDeleteKeyA(hkey
, "keytest3");
171 ok(err
== ERROR_SUCCESS
, "got exit code %d\n", err
);
173 run_reg_exe("reg add HKCU\\" KEY_BASE
"\\keytest4 /f", &r
);
174 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
175 verify_key(hkey
, "keytest4");
176 err
= RegDeleteKeyA(hkey
, "keytest4");
177 ok(err
== ERROR_SUCCESS
, "got exit code %d\n", err
);
180 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v none0 /d deadbeef /t REG_NONE /f", &r
);
181 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d\n", r
);
182 verify_reg(hkey
, "none0", REG_NONE
, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0);
184 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v none1 /t REG_NONE /f", &r
);
185 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
186 verify_reg(hkey
, "none1", REG_NONE
, "\0", 2, 0);
188 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_NONE /f", &r
);
189 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
190 verify_reg(hkey
, NULL
, REG_NONE
, "\0", 2, 0);
193 run_reg_exe("reg add HKCU\\" KEY_BASE
" /d WineTest /f", &r
);
194 ok(r
== REG_EXIT_SUCCESS
|| broken(r
== REG_EXIT_FAILURE
/* WinXP */),
195 "got exit code %d, expected 0\n", r
);
196 if (r
== REG_EXIT_SUCCESS
)
197 verify_reg(hkey
, "", REG_SZ
, "WineTest", 9, 0);
199 win_skip("broken reg.exe detected\n");
201 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v test /d deadbeef /f", &r
);
202 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
203 verify_reg(hkey
, "test", REG_SZ
, "deadbeef", 9, 0);
205 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v test /f", &r
);
206 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
207 verify_reg(hkey
, "test", REG_SZ
, "", 1, 0);
209 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v test1 /t REG_SZ /f /d", &r
);
210 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
212 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE
" /ve /d WineTEST /f", &r
);
213 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
214 verify_reg(hkey
, "", REG_SZ
, "WineTEST", 9, 0);
216 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_SZ /v test2 /f", &r
);
217 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
218 verify_reg(hkey
, "test2", REG_SZ
, "", 1, 0);
220 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_SZ /v test3 /f /d \"\"", &r
);
221 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
222 verify_reg(hkey
, "test3", REG_SZ
, "", 1, 0);
224 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /f", &r
);
225 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
226 verify_reg(hkey
, NULL
, REG_SZ
, "", 1, 0);
228 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_SZ /f", &r
);
229 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
230 verify_reg(hkey
, NULL
, REG_SZ
, "", 1, 0);
233 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r
);
234 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
235 verify_reg(hkey
, "expand0", REG_EXPAND_SZ
, "dead%PATH%beef", 15, 0);
237 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r
);
238 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
239 verify_reg(hkey
, "expand1", REG_EXPAND_SZ
, "dead^%PATH^%beef", 17, 0);
241 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_EXPAND_SZ /v expand2 /f", &r
);
242 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
243 verify_reg(hkey
, "expand2", REG_EXPAND_SZ
, "", 1, 0);
245 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE
" /ve /t REG_EXPAND_SZ /d WineTEST /f", &r
);
246 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
247 verify_reg(hkey
, "", REG_EXPAND_SZ
, "WineTEST", 9, 0);
249 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r
);
250 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
251 verify_reg(hkey
, "expand3", REG_EXPAND_SZ
, "", 1, 0);
253 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_EXPAND_SZ /f", &r
);
254 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
255 verify_reg(hkey
, NULL
, REG_EXPAND_SZ
, "", 1, 0);
258 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin0 /f", &r
);
259 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
260 verify_reg(hkey
, "bin0", REG_BINARY
, buffer
, 0, 0);
262 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE
" /ve /t REG_BINARY /d deadbeef /f", &r
);
263 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
265 verify_reg(hkey
, "", REG_BINARY
, &dword
, sizeof(DWORD
), 0);
267 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r
);
268 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
269 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin2 /f /d x01", &r
);
270 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
271 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin3 /f /d 01x", &r
);
272 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
274 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r
);
275 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
276 /* Remaining nibble prefixed */
277 buffer
[0] = 0x0d; buffer
[1] = 0xea; buffer
[2] = 0xdb;
278 buffer
[3] = 0xee; buffer
[4] = 0xf0; buffer
[5] = 0xdd;
279 /* Remaining nibble suffixed on winXP */
280 buffer
[6] = 0xde; buffer
[7] = 0xad; buffer
[8] = 0xbe;
281 buffer
[9] = 0xef; buffer
[10] = 0x0d; buffer
[11] = 0xd0;
283 err
= RegQueryValueExA(hkey
, "bin4", NULL
, &type
, (void *) (buffer
+12), &size
);
284 ok(err
== ERROR_SUCCESS
, "RegQueryValueEx failed: got %d\n", err
);
285 ok(type
== REG_BINARY
, "got wrong type %u\n", type
);
286 ok(size
== 6, "got wrong size %u\n", size
);
287 ok(memcmp(buffer
, buffer
+12, 6) == 0 ||
288 broken(memcmp(buffer
+6, buffer
+12, 6) == 0 /* WinXP */), "got wrong data\n");
290 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin5 /d \"\" /f", &r
);
291 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
292 verify_reg(hkey
, "bin5", REG_BINARY
, buffer
, 0, 0);
294 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v bin6 /t REG_BINARY /f /d", &r
);
295 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
297 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_BINARY /f", &r
);
298 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
299 verify_reg(hkey
, NULL
, REG_BINARY
, buffer
, 0, 0);
302 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_DWORD /f /d 12345678", &r
);
303 ok(r
== REG_EXIT_SUCCESS
|| broken(r
== REG_EXIT_FAILURE
/* WinXP */),
304 "got exit code %d, expected 0\n", r
);
306 if (r
== REG_EXIT_SUCCESS
)
307 verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(dword
), 0);
309 win_skip("broken reg.exe detected\n");
311 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword0 /t REG_DWORD /f /d", &r
);
312 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
313 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword1 /t REG_DWORD /f", &r
);
314 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */),
315 "got exit code %d, expected 1\n", r
);
316 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword2 /t REG_DWORD /d zzz /f", &r
);
317 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
318 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword3 /t REG_DWORD /d deadbeef /f", &r
);
319 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
320 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword4 /t REG_DWORD /d 123xyz /f", &r
);
321 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
323 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword5 /t reg_dword /d 12345678 /f", &r
);
324 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
326 verify_reg(hkey
, "dword5", REG_DWORD
, &dword
, sizeof(dword
), 0);
328 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword6 /t REG_DWORD /D 0123 /f", &r
);
329 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
330 size
= sizeof(dword
);
331 err
= RegQueryValueExA(hkey
, "dword6", NULL
, &type
, (LPBYTE
)&dword
, &size
);
332 ok(err
== ERROR_SUCCESS
, "RegQueryValueEx failed: got %d\n", err
);
333 ok(type
== REG_DWORD
, "got wrong type %d, expected %d\n", type
, REG_DWORD
);
334 ok(size
== sizeof(DWORD
), "got wrong size %d, expected %d\n", size
, (int)sizeof(DWORD
));
335 ok(dword
== 123 || broken(dword
== 0123 /* WinXP */), "got wrong data %d, expected 123\n", dword
);
337 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword7 /t reg_dword /d 0xabcdefg /f", &r
);
338 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
340 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword8 /t REG_dword /d 0xdeadbeef /f", &r
);
341 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
343 verify_reg(hkey
, "dword8", REG_DWORD
, &dword
, sizeof(dword
), 0);
345 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_DWORD /v dword9 /f /d -1", &r
);
346 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
347 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_DWORD /v dword10 /f /d -0x1", &r
);
348 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
350 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword8 /t REG_dword /d 0x01ffffffff /f", &r
);
351 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %d\n", r
);
353 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword12 /t REG_DWORD /d 0xffffffff /f", &r
);
354 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
356 verify_reg(hkey
, "dword12", REG_DWORD
, &dword
, sizeof(dword
), 0);
358 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword13 /t REG_DWORD /d 00x123 /f", &r
);
359 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
361 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword14 /t REG_DWORD /d 0X123 /f", &r
);
362 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
364 verify_reg(hkey
, "dword14", REG_DWORD
, &dword
, sizeof(dword
), 0);
366 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword15 /t REG_DWORD /d 4294967296 /f", &r
);
367 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
369 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_DWORD /f", &r
);
370 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
372 /* REG_DWORD_LITTLE_ENDIAN */
373 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r
);
374 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
376 verify_reg(hkey
, "DWORD_LE", REG_DWORD_LITTLE_ENDIAN
, &dword
, sizeof(dword
), 0);
378 /* REG_DWORD_BIG_ENDIAN */
379 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r
);
380 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
382 verify_reg(hkey
, "DWORD_BE", REG_DWORD_BIG_ENDIAN
, &dword
, sizeof(dword
), 0);
383 /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like
384 * an ordinary REG_DWORD - that is little endian. GG */
386 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_BE2 /t REG_DWORD_BIG_ENDIAN /f /d", &r
);
387 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
389 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_BE3 /t REG_DWORD_BIG_ENDIAN /f", &r
);
390 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
392 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_DWORD_BIG_ENDIAN /f", &r
);
393 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
396 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r
);
397 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
398 memcpy(buffer
, "three\0little\0strings\0", 22);
399 verify_reg(hkey
, "multi0", REG_MULTI_SZ
, buffer
, 22, 0);
401 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r
);
402 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
403 verify_reg(hkey
, "multi1", REG_MULTI_SZ
, buffer
, 22, 0);
405 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r
);
406 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
407 verify_reg(hkey
, "multi2", REG_MULTI_SZ
, &buffer
[21], 1, 0);
409 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi3 /f", &r
);
410 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
411 verify_reg(hkey
, "multi3", REG_MULTI_SZ
, &buffer
[21], 1, 0);
413 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r
);
414 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
415 verify_reg(hkey
, "multi4", REG_MULTI_SZ
, "threelittlestrings\0", 20, 0);
417 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r
);
418 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
419 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r
);
420 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
421 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r
);
422 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
423 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r
);
424 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
425 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r
);
426 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
427 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r
);
428 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
430 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r
);
431 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
432 buffer
[0]='a'; buffer
[1]=0; buffer
[2]=0;
433 verify_reg(hkey
, "multi11", REG_MULTI_SZ
, buffer
, 3, 0);
435 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi12 /t REG_MULTI_SZ /f /d", &r
);
436 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
438 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi13 /t REG_MULTI_SZ /f /s", &r
);
439 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
441 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi14 /t REG_MULTI_SZ /d \"\\0a\" /f", &r
);
442 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
444 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi15 /t REG_MULTI_SZ /d \"a\\0\" /f", &r
);
445 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
446 verify_reg(hkey
, "multi15", REG_MULTI_SZ
, buffer
, 3, 0);
448 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi16 /d \"two\\0\\0strings\" /f", &r
);
449 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
451 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi17 /t REG_MULTI_SZ /s \"#\" /d \"#\" /f", &r
);
452 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
453 buffer
[0] = 0; buffer
[1] = 0;
454 verify_reg(hkey
, "multi17", REG_MULTI_SZ
, buffer
, 2, 0);
456 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi18 /t REG_MULTI_SZ /d \"\\0\" /f", &r
);
457 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
458 verify_reg(hkey
, "multi18", REG_MULTI_SZ
, buffer
, 2, 0);
460 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi19 /t REG_MULTI_SZ /s \"#\" /d \"two\\0#strings\" /f", &r
);
461 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
462 verify_reg(hkey
, "multi19", REG_MULTI_SZ
, "two\\0\0strings\0", 15, 0);
464 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi20 /t REG_MULTI_SZ /s \"#\" /d \"two#\\0strings\" /f", &r
);
465 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
466 verify_reg(hkey
, "multi20", REG_MULTI_SZ
, "two\0\\0strings\0", 15, 0);
468 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi21 /t REG_MULTI_SZ /s \"#\" /d \"two\\0\\0strings\" /f", &r
);
469 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
470 verify_reg(hkey
, "multi21", REG_MULTI_SZ
, "two\\0\\0strings\0", 16, 0);
472 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_MULTI_SZ /f", &r
);
473 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
474 verify_reg(hkey
, NULL
, REG_MULTI_SZ
, buffer
, 1, 0);
478 /* Test duplicate switches */
479 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dup1 /t REG_DWORD /d 123 /f /t REG_SZ", &r
);
480 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */),
481 "got exit code %u, expected 1\n", r
);
483 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dup2 /t REG_DWORD /d 123 /f /d 456", &r
);
484 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
486 /* Test invalid switches */
487 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid1 /a", &r
);
488 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
490 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid2 /ae", &r
);
491 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
493 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid3 /", &r
);
494 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
496 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid4 -", &r
);
497 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
499 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
500 ok(err
== ERROR_SUCCESS
, "got %d\n", err
);
503 static void test_delete(void)
508 const DWORD deadbeef
= 0xdeadbeef;
510 run_reg_exe("reg delete", &r
);
511 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
513 run_reg_exe("reg delete /?", &r
);
514 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
516 err
= RegCreateKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hkey
, NULL
);
517 ok(err
== ERROR_SUCCESS
, "got %d\n", err
);
519 err
= RegSetValueExA(hkey
, "foo", 0, REG_DWORD
, (LPBYTE
)&deadbeef
, sizeof(deadbeef
));
520 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
522 err
= RegSetValueExA(hkey
, "bar", 0, REG_DWORD
, (LPBYTE
)&deadbeef
, sizeof(deadbeef
));
523 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
525 err
= RegSetValueExA(hkey
, "", 0, REG_DWORD
, (LPBYTE
)&deadbeef
, sizeof(deadbeef
));
526 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
528 err
= RegCreateKeyExA(hkey
, "subkey", 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hsubkey
, NULL
);
529 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
530 RegCloseKey(hsubkey
);
532 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v bar /f", &r
);
533 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
534 verify_reg_nonexist(hkey
, "bar");
536 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /ve /f", &r
);
537 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
538 verify_reg_nonexist(hkey
, "");
540 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /va /f", &r
);
541 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
542 verify_reg_nonexist(hkey
, "foo");
543 verify_key(hkey
, "subkey");
547 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /f", &r
);
548 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
549 verify_key_nonexist(HKEY_CURRENT_USER
, KEY_BASE
);
551 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /f", &r
);
552 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
555 static void test_query(void)
560 const char hello
[] = "Hello";
561 const char world
[] = "World";
562 const char empty1
[] = "Empty1";
563 const char empty2
[] = "Empty2";
564 const DWORD dword1
= 0x123;
565 const DWORD dword2
= 0xabc;
567 run_reg_exe("reg query", &r
);
568 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
570 run_reg_exe("reg query /?", &r
);
571 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
573 /* Create a test key */
574 err
= RegCreateKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &key
, NULL
);
575 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
577 run_reg_exe("reg query HKCU\\" KEY_BASE
" /ve", &r
);
578 ok(r
== REG_EXIT_SUCCESS
|| broken(r
== REG_EXIT_FAILURE
/* WinXP */),
579 "got exit code %d, expected 0\n", r
);
581 err
= RegSetValueExA(key
, "Test", 0, REG_SZ
, (BYTE
*)hello
, sizeof(hello
));
582 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
584 err
= RegSetValueExA(key
, "Wine", 0, REG_DWORD
, (BYTE
*)&dword1
, sizeof(dword1
));
585 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
587 err
= RegSetValueExA(key
, NULL
, 0, REG_SZ
, (BYTE
*)empty1
, sizeof(empty1
));
588 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
590 run_reg_exe("reg query HKCU\\" KEY_BASE
, &r
);
591 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
593 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v", &r
);
594 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
596 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Missing", &r
);
597 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
599 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Test", &r
);
600 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
602 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Wine", &r
);
603 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
605 run_reg_exe("reg query HKCU\\" KEY_BASE
" /ve", &r
);
606 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
608 /* Create a test subkey */
609 err
= RegCreateKeyExA(key
, "Subkey", 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &subkey
, NULL
);
610 ok(err
== ERROR_SUCCESS
, "got %d\n", err
);
612 err
= RegSetValueExA(subkey
, "Test", 0, REG_SZ
, (BYTE
*)world
, sizeof(world
));
613 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
615 err
= RegSetValueExA(subkey
, "Wine", 0, REG_DWORD
, (BYTE
*)&dword2
, sizeof(dword2
));
616 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
618 err
= RegSetValueExA(subkey
, NULL
, 0, REG_SZ
, (BYTE
*)empty2
, sizeof(empty2
));
619 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
621 err
= RegCloseKey(subkey
);
622 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
624 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey", &r
);
625 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
627 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey /v Test", &r
);
628 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
630 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey /v Wine", &r
);
631 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
633 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey /ve", &r
);
634 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
637 run_reg_exe("reg query HKCU\\" KEY_BASE
" /s", &r
);
638 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
640 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Test /s", &r
);
641 ok(r
== REG_EXIT_SUCCESS
|| r
== REG_EXIT_FAILURE
/* WinXP */,
642 "got exit code %d, expected 0\n", r
);
644 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Wine /s", &r
);
645 ok(r
== REG_EXIT_SUCCESS
|| r
== REG_EXIT_FAILURE
/* WinXP */,
646 "got exit code %d, expected 0\n", r
);
648 run_reg_exe("reg query HKCU\\" KEY_BASE
" /ve /s", &r
);
649 ok(r
== REG_EXIT_SUCCESS
|| r
== REG_EXIT_FAILURE
/* WinXP */,
650 "got exit code %d, expected 0\n", r
);
652 /* Clean-up, then query */
653 err
= RegDeleteKeyA(key
, "subkey");
654 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
656 err
= RegCloseKey(key
);
657 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
659 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey", &r
);
660 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
662 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
663 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
665 run_reg_exe("reg query HKCU\\" KEY_BASE
, &r
);
666 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
669 static void test_v_flags(void)
673 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v Wine /ve", &r
);
674 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
676 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v Wine /ve", &r
);
677 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
679 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v Wine /va", &r
);
680 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
682 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /ve /va", &r
);
683 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
686 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v", &r
);
687 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
689 run_reg_exe("reg add HKCU\\" KEY_BASE
" /d Test /f /v", &r
);
690 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
692 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v", &r
);
693 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
695 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /f /v", &r
);
696 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
698 /* Multiple /v switches */
699 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v Wine /t REG_DWORD /d 0x1 /v Test /f", &r
);
700 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
702 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v Wine /v Test /f", &r
);
703 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
706 static BOOL
write_reg_file(const char *value
, char *tmp_name
)
708 static const char regedit4
[] = "REGEDIT4";
709 static const char key
[] = "[HKEY_CURRENT_USER\\" KEY_BASE
"]";
710 char file_data
[MAX_PATH
], tmp_path
[MAX_PATH
];
715 sprintf(file_data
, "%s\n\n%s\n%s\n", regedit4
, key
, value
);
717 GetTempPathA(MAX_PATH
, tmp_path
);
718 GetTempFileNameA(tmp_path
, "reg", 0, tmp_name
);
720 hfile
= CreateFileA(tmp_name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, 0);
721 if (hfile
== INVALID_HANDLE_VALUE
)
724 ret
= WriteFile(hfile
, file_data
, strlen(file_data
), &written
, NULL
);
729 #define test_import_str(c,r) test_import_str_(__LINE__,c,r)
730 static BOOL
test_import_str_(unsigned line
, const char *file_contents
, DWORD
*rc
)
736 regfile
= CreateFileA("test.reg", GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
737 FILE_ATTRIBUTE_NORMAL
, NULL
);
738 lok(regfile
!= INVALID_HANDLE_VALUE
, "Failed to create test.reg file\n");
739 if(regfile
== INVALID_HANDLE_VALUE
)
742 ret
= WriteFile(regfile
, file_contents
, strlen(file_contents
), &written
, NULL
);
743 lok(ret
, "WriteFile failed: %u\n", GetLastError());
744 CloseHandle(regfile
);
746 run_reg_exe("reg import test.reg", rc
);
748 ret
= DeleteFileA("test.reg");
749 lok(ret
, "DeleteFile failed: %u\n", GetLastError());
754 #define test_import_wstr(c,r) test_import_wstr_(__LINE__,c,r)
755 static BOOL
test_import_wstr_(unsigned line
, const char *file_contents
, DWORD
*rc
)
757 int lenA
, len
, memsize
;
763 lenA
= strlen(file_contents
);
765 len
= MultiByteToWideChar(CP_UTF8
, 0, file_contents
, lenA
, NULL
, 0);
766 memsize
= len
* sizeof(WCHAR
);
767 wstr
= HeapAlloc(GetProcessHeap(), 0, memsize
);
768 if (!wstr
) return FALSE
;
769 MultiByteToWideChar(CP_UTF8
, 0, file_contents
, lenA
, wstr
, memsize
);
771 regfile
= CreateFileA("test.reg", GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
772 FILE_ATTRIBUTE_NORMAL
, NULL
);
773 lok(regfile
!= INVALID_HANDLE_VALUE
, "Failed to create test.reg file\n");
774 if(regfile
== INVALID_HANDLE_VALUE
)
777 ret
= WriteFile(regfile
, wstr
, memsize
, &written
, NULL
);
778 lok(ret
, "WriteFile failed: %u\n", GetLastError());
779 CloseHandle(regfile
);
781 HeapFree(GetProcessHeap(), 0, wstr
);
783 run_reg_exe("reg import test.reg", rc
);
785 ret
= DeleteFileA("test.reg");
786 lok(ret
, "DeleteFile failed: %u\n", GetLastError());
791 static void test_import(void)
793 DWORD r
, dword
= 0x123, type
, size
;
794 char test1_reg
[MAX_PATH
], test2_reg
[MAX_PATH
], cmdline
[MAX_PATH
];
795 char test_string
[] = "Test string", buffer
[24];
800 run_reg_exe("reg import", &r
);
801 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
803 run_reg_exe("reg import /?", &r
);
804 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
806 run_reg_exe("reg import missing.reg", &r
);
807 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
809 /* Create test files */
810 ok(write_reg_file("\"Wine\"=dword:00000123", test1_reg
), "Failed to write registry file\n");
811 ok(write_reg_file("@=\"Test string\"", test2_reg
), "Failed to write registry file\n");
813 sprintf(cmdline
, "reg import %s", test1_reg
);
814 run_reg_exe(cmdline
, &r
);
815 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
817 sprintf(cmdline
, "reg import %s", test2_reg
);
818 run_reg_exe(cmdline
, &r
);
819 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
821 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
822 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
824 todo_wine
verify_reg(hkey
, "Wine", REG_DWORD
, &dword
, sizeof(dword
), 0);
825 todo_wine
verify_reg(hkey
, "", REG_SZ
, test_string
, sizeof(test_string
), 0);
827 err
= RegCloseKey(hkey
);
828 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
830 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
831 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
833 sprintf(cmdline
, "reg import %s %s", test1_reg
, test2_reg
);
834 run_reg_exe(cmdline
, &r
);
835 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
837 DeleteFileA(test1_reg
);
838 DeleteFileA(test2_reg
);
840 /* Test file contents */
841 test_import_str("regedit\n", &r
);
842 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
843 "got exit code %d, expected 1\n", r
);
845 test_import_str("regedit4\n", &r
);
846 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
847 "got exit code %d, expected 1\n", r
);
849 test_import_str("REGEDIT", &r
);
850 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
852 test_import_str("REGEDIT\n", &r
);
853 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
855 test_import_str("REGEDIT4\n", &r
);
856 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
858 test_import_str(" REGEDIT4\n", &r
);
859 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
861 test_import_str("\tREGEDIT4\n", &r
);
862 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
864 test_import_str("\nREGEDIT4\n", &r
);
865 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
866 "got exit code %d, expected 1\n", r
);
868 test_import_str("AREGEDIT4\n", &r
);
869 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
870 "got exit code %d, expected 1\n", r
);
872 test_import_str("1REGEDIT4\n", &r
);
873 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
874 "got exit code %d, expected 1\n", r
);
876 test_import_str("REGEDIT3\n", &r
);
877 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
879 test_import_str("REGEDIT5\n", &r
);
880 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
882 test_import_str("REGEDIT9\n", &r
);
883 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
885 test_import_str("REGEDIT 4\n", &r
);
886 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
888 test_import_str("REGEDIT4 FOO\n", &r
);
889 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
891 test_import_str("REGEDIT4\n"
892 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n", &r
);
893 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
895 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
|KEY_SET_VALUE
, &hkey
);
896 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
898 test_import_str("REGEDIT3\n\n"
899 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
900 "\"Test1\"=\"Value\"\n", &r
);
901 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
902 todo_wine
verify_reg_nonexist(hkey
, "Test1");
904 test_import_str("regedit4\n\n"
905 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
906 "\"Test2\"=\"Value\"\n", &r
);
907 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
908 "got exit code %d, expected 1\n", r
);
909 todo_wine
verify_reg_nonexist(hkey
, "Test2");
911 test_import_str("Regedit4\n\n"
912 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
913 "\"Test3\"=\"Value\"\n", &r
);
914 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
915 "got exit code %d, expected 1\n", r
);
916 todo_wine
verify_reg_nonexist(hkey
, "Test3");
918 test_import_str("REGEDIT 4\n\n"
919 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
920 "\"Test4\"=\"Value\"\n", &r
);
921 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
922 todo_wine
verify_reg_nonexist(hkey
, "Test4");
924 test_import_str("REGEDIT4FOO\n\n"
925 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
926 "\"Test5\"=\"Value\"\n", &r
);
927 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
928 todo_wine
verify_reg_nonexist(hkey
, "Test5");
930 test_import_str("REGEDIT4 FOO\n\n"
931 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
932 "\"Test6\"=\"Value\"\n", &r
);
933 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
934 todo_wine
verify_reg_nonexist(hkey
, "Test6");
936 test_import_str("REGEDIT5\n\n"
937 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
938 "\"Test7\"=\"Value\"\n", &r
);
939 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
940 todo_wine
verify_reg_nonexist(hkey
, "Test7");
942 test_import_str("REGEDIT9\n\n"
943 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
944 "\"Test8\"=\"Value\"\n", &r
);
945 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
946 todo_wine
verify_reg_nonexist(hkey
, "Test8");
948 test_import_str("Windows Registry Editor Version 4.00\n\n"
949 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
950 "\"Test9\"=\"Value\"\n", &r
);
951 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
952 "got exit code %d, expected 1\n", r
);
953 todo_wine
verify_reg_nonexist(hkey
, "Test9");
955 test_import_str("Windows Registry Editor Version 5\n\n"
956 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
957 "\"Test10\"=\"Value\"\n", &r
);
958 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
959 "got exit code %d, expected 1\n", r
);
960 todo_wine
verify_reg_nonexist(hkey
, "Test10");
962 test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
963 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
964 "\"Test11\"=\"Value\"\n", &r
);
965 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
966 "got exit code %d, expected 1\n", r
);
967 todo_wine
verify_reg_nonexist(hkey
, "Test11");
969 test_import_str("Windows Registry Editor version 5.00\n\n"
970 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
971 "\"Test12\"=\"Value\"\n", &r
);
972 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
973 "got exit code %d, expected 1\n", r
);
974 todo_wine
verify_reg_nonexist(hkey
, "Test12");
976 test_import_str("REGEDIT4\n"
977 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
978 "\"Test1\"=\"Value1\"\n", &r
);
979 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
980 todo_wine
verify_reg(hkey
, "Test1", REG_SZ
, "Value1", 7, 0);
982 test_import_str("REGEDIT4\n"
983 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
984 "\"Test2\"=\"Value2\"\n\n", &r
);
985 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
986 todo_wine
verify_reg(hkey
, "Test2", REG_SZ
, "Value2", 7, 0);
988 test_import_str("REGEDIT4\n\n"
989 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
990 "\"Test3\"=\"Value3\"\n\n", &r
);
991 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
992 todo_wine
verify_reg(hkey
, "Test3", REG_SZ
, "Value3", 7, 0);
994 test_import_str("Windows Registry Editor Version 4.00\n", &r
);
995 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
996 "got exit code %d, expected 1\n", r
);
998 test_import_str("Windows Registry Editor Version 5.00\n", &r
);
999 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1001 test_import_str("Windows Registry Editor Version 5.00\n"
1002 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1003 "\"Test4\"=\"Value4\"\n", &r
);
1004 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1005 todo_wine
verify_reg(hkey
, "Test4", REG_SZ
, "Value4", 7, 0);
1007 test_import_str("Windows Registry Editor Version 5.00\n"
1008 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1009 "\"Test5\"=\"Value5\"\n\n", &r
);
1010 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1011 todo_wine
verify_reg(hkey
, "Test5", REG_SZ
, "Value5", 7, 0);
1013 test_import_str("Windows Registry Editor Version 5.00\n\n"
1014 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1015 "\"Test6\"=\"Value6\"\n\n", &r
);
1016 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1017 todo_wine
verify_reg(hkey
, "Test6", REG_SZ
, "Value6", 7, 0);
1019 test_import_str("REGEDIT4\n\n"
1020 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1021 "\"Line1\"=\"Value1\"\n\n"
1022 "\"Line2\"=\"Value2\"\n\n\n"
1023 "\"Line3\"=\"Value3\"\n\n\n\n"
1024 "\"Line4\"=\"Value4\"\n\n", &r
);
1025 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1026 todo_wine
verify_reg(hkey
, "Line1", REG_SZ
, "Value1", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1027 todo_wine
verify_reg(hkey
, "Line2", REG_SZ
, "Value2", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1028 todo_wine
verify_reg(hkey
, "Line3", REG_SZ
, "Value3", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1029 todo_wine
verify_reg(hkey
, "Line4", REG_SZ
, "Value4", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1031 test_import_str("REGEDIT4\n\n"
1032 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1033 "\"Wine1\"=dword:00000782\n\n"
1034 "\"Wine2\"=\"Test Value\"\n"
1035 "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n"
1036 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1040 "\"Wine4\"=dword:12345678\n\n", &r
);
1041 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1043 todo_wine
verify_reg(hkey
, "Wine1", REG_DWORD
, &dword
, sizeof(dword
),
1044 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1045 todo_wine
verify_reg(hkey
, "Wine2", REG_SZ
, "Test Value", 11,
1046 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1047 todo_wine
verify_reg(hkey
, "Wine3", REG_MULTI_SZ
, "Line concatenation\0", 20,
1048 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1049 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test", 5,
1050 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1052 todo_wine
verify_reg(hkey
, "Wine4", REG_DWORD
, &dword
, sizeof(dword
),
1053 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1055 test_import_str("REGEDIT4\n\n"
1056 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1057 "\"Wine5\"=\"No newline\"", &r
);
1058 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1059 err
= RegQueryValueExA(hkey
, "Wine5", NULL
, NULL
, NULL
, NULL
);
1060 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
1061 "got %d, expected 0\n", err
);
1062 if (err
== ERROR_SUCCESS
)
1063 verify_reg(hkey
, "Wine5", REG_SZ
, "No newline", 11, 0);
1065 test_import_str("REGEDIT4\n\n"
1066 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1067 "\"Wine6\"=dword:00000050\n\n"
1068 "\"Wine7\"=\"No newline\"", &r
);
1069 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1071 todo_wine
verify_reg(hkey
, "Wine6", REG_DWORD
, &dword
, sizeof(dword
),
1072 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1073 err
= RegQueryValueExA(hkey
, "Wine7", NULL
, NULL
, NULL
, NULL
);
1074 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
1075 "got %d, expected 0\n", err
);
1076 if (err
== ERROR_SUCCESS
)
1077 verify_reg(hkey
, "Wine7", REG_SZ
, "No newline", 11, 0);
1079 test_import_str("REGEDIT4\n\n"
1080 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1082 "\"Wine8\"=\"Line 1\"\n"
1084 "\"Wine9\"=\"Line 2\"\n\n", &r
);
1085 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1086 todo_wine
verify_reg(hkey
, "Wine8", REG_SZ
, "Line 1", 7, 0);
1087 todo_wine
verify_reg(hkey
, "Wine9", REG_SZ
, "Line 2", 7, 0);
1089 test_import_str("REGEDIT4\n\n"
1090 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1091 "\"Wine10\"=\"Value 1\"#comment\n"
1092 "\"Wine11\"=\"Value 2\";comment\n"
1093 "\"Wine12\"=dword:01020304 #comment\n"
1094 "\"Wine13\"=dword:02040608 ;comment\n\n", &r
);
1095 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1096 todo_wine
verify_reg_nonexist(hkey
, "Wine10");
1097 todo_wine
verify_reg(hkey
, "Wine11", REG_SZ
, "Value 2", 8, 0);
1098 todo_wine
verify_reg_nonexist(hkey
, "Wine12");
1100 todo_wine
verify_reg(hkey
, "Wine13", REG_DWORD
, &dword
, sizeof(dword
), 0);
1102 test_import_str("REGEDIT4\n\n"
1103 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1104 "\"Wine14\"=hex(7):4c,69,6e,65,20,\\\n"
1106 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1107 "\"Wine15\"=\"A valid line\"\n"
1108 "\"Wine16\"=hex(7):4c,69,6e,65,20,\\\n"
1110 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1111 "\"Wine17\"=\"Another valid line\"\n\n", &r
);
1112 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1113 todo_wine
verify_reg_nonexist(hkey
, "Wine14");
1114 todo_wine
verify_reg(hkey
, "Wine15", REG_SZ
, "A valid line", 13, 0);
1115 todo_wine
verify_reg(hkey
, "Wine16", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1116 todo_wine
verify_reg(hkey
, "Wine17", REG_SZ
, "Another valid line", 19, 0);
1118 test_import_str("REGEDIT4\n\n"
1119 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1120 "#\"Comment1\"=\"Value 1\"\n"
1121 ";\"Comment2\"=\"Value 2\"\n"
1122 " #\"Comment3\"=\"Value 3\"\n"
1123 " ;\"Comment4\"=\"Value 4\"\n"
1124 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
1125 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r
);
1126 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1127 todo_wine
verify_reg_nonexist(hkey
, "Comment1");
1128 todo_wine
verify_reg_nonexist(hkey
, "Comment2");
1129 todo_wine
verify_reg_nonexist(hkey
, "Comment3");
1130 todo_wine
verify_reg_nonexist(hkey
, "Comment4");
1131 todo_wine
verify_reg_nonexist(hkey
, "Wine18");
1132 todo_wine
verify_reg_nonexist(hkey
, "Comment5");
1133 todo_wine
verify_reg(hkey
, "Wine19", REG_SZ
, "Value 7", 8, TODO_REG_SIZE
|TODO_REG_DATA
);
1134 todo_wine
verify_reg_nonexist(hkey
, "Comment6");
1136 test_import_str("REGEDIT4\n\n"
1137 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1138 "\"Wine20\"=#\"Value 8\"\n"
1139 "\"Wine21\"=;\"Value 9\"\n"
1140 "\"Wine22\"=\"#comment1\"\n"
1141 "\"Wine23\"=\";comment2\"\n"
1142 "\"Wine24\"=\"Value#comment3\"\n"
1143 "\"Wine25\"=\"Value;comment4\"\n"
1144 "\"Wine26\"=\"Value #comment5\"\n"
1145 "\"Wine27\"=\"Value ;comment6\"\n"
1146 "\"Wine28\"=#dword:00000001\n"
1147 "\"Wine29\"=;dword:00000002\n"
1148 "\"Wine30\"=dword:00000003#comment\n"
1149 "\"Wine31\"=dword:00000004;comment\n\n", &r
);
1150 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1151 todo_wine
verify_reg_nonexist(hkey
, "Wine20");
1152 todo_wine
verify_reg_nonexist(hkey
, "Wine21");
1153 todo_wine
verify_reg(hkey
, "Wine22", REG_SZ
, "#comment1", 10, 0);
1154 todo_wine
verify_reg(hkey
, "Wine23", REG_SZ
, ";comment2", 10, 0);
1155 todo_wine
verify_reg(hkey
, "Wine24", REG_SZ
, "Value#comment3", 15, 0);
1156 todo_wine
verify_reg(hkey
, "Wine25", REG_SZ
, "Value;comment4", 15, 0);
1157 todo_wine
verify_reg(hkey
, "Wine26", REG_SZ
, "Value #comment5", 16, 0);
1158 todo_wine
verify_reg(hkey
, "Wine27", REG_SZ
, "Value ;comment6", 16, 0);
1159 todo_wine
verify_reg_nonexist(hkey
, "Wine28");
1160 todo_wine
verify_reg_nonexist(hkey
, "Wine29");
1161 todo_wine
verify_reg_nonexist(hkey
, "Wine30");
1163 todo_wine
verify_reg(hkey
, "Wine31", REG_DWORD
, &dword
, sizeof(dword
), 0);
1165 test_import_str("REGEDIT4\n\n"
1166 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1167 "\"Multi-Line1\"=hex(7):4c,69,6e,65,20,\\\n"
1168 " 63,6f,6e,\\;comment\n"
1169 " 63,61,74,\\;comment\n"
1170 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1171 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1172 todo_wine
verify_reg(hkey
, "Multi-Line1", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1174 test_import_str("REGEDIT4\n\n"
1175 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1176 "\"Multi-Line2\"=hex(7):4c,69,6e,65,20,\\\n"
1177 " 63,6f,6e,\\;comment\n"
1178 " 63,61,74,;comment\n"
1179 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1180 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1181 todo_wine
verify_reg(hkey
, "Multi-Line2", REG_MULTI_SZ
, "Line concat", 12, 0);
1183 test_import_str("REGEDIT4\n\n"
1184 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1185 "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
1186 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1187 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1188 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line3");
1190 test_import_str("REGEDIT4\n\n"
1191 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1192 "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
1193 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1194 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1195 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line4");
1197 test_import_str("Windows Registry Editor Version 5.00\n\n"
1198 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1199 "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
1200 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1201 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1202 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line5");
1204 test_import_str("Windows Registry Editor Version 5.00\n\n"
1205 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1206 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
1207 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1208 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1209 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line6");
1211 test_import_str("REGEDIT4\n\n"
1212 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1213 "\"Multi-Line7\"=hex(7):4c,69,6e,\\;comment\n"
1214 " 65,20,\\;comment\n"
1215 " 63,6f,6e,\\;comment\n"
1216 " 63,61,74,\\;comment\n"
1217 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1218 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1219 todo_wine
verify_reg(hkey
, "Multi-Line7", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1221 test_import_str("REGEDIT4\n\n"
1222 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1223 "\"Multi-Line8\"=hex(7):4c,69,6e,\\;#comment\n"
1224 " 65,20,\\;#comment\n"
1225 " 63,6f,6e,\\;#comment\n"
1226 " 63,61,74,\\;#comment\n"
1227 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1228 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1229 todo_wine
verify_reg(hkey
, "Multi-Line8", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1231 test_import_str("REGEDIT4\n\n"
1232 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1233 "\"Multi-Line9\"=hex(7):4c,69,6e,\\;comment\n"
1234 " 65,20,\\;comment\n"
1235 " 63,6f,6e,\\;comment\n"
1236 " 63,61,74,\\#comment\n"
1237 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1238 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1239 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line9");
1241 test_import_str("REGEDIT4\n\n"
1242 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1243 "\"Multi-Line10\"=hex(7):4c,69,6e,65,20,\\\n"
1244 " 63,6f,6e,\\;comment\n"
1246 " 65,6e,\\;comment\n\n"
1247 " 61,74,69,6f,6e,00,00\n\n", &r
);
1248 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1249 todo_wine
verify_reg(hkey
, "Multi-Line10", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1251 test_import_str("REGEDIT4\n\n"
1252 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1253 "\"Wine32a\"=dword:1\n"
1254 "\"Wine32b\"=dword:4444\n\n", &r
);
1255 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1257 todo_wine
verify_reg(hkey
, "Wine32a", REG_DWORD
, &dword
, sizeof(dword
), 0);
1259 todo_wine
verify_reg(hkey
, "Wine32b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1261 test_import_str("REGEDIT4\n\n"
1262 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1263 "\"Wine33a\"=dword:\n"
1264 "\"Wine33b\"=dword:hello\n"
1265 "\"Wine33c\"=dword:123456789\n"
1266 "\"Wine33d\"=dword:012345678\n"
1267 "\"Wine33e\"=dword:000000001\n\n", &r
);
1268 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1269 todo_wine
verify_reg_nonexist(hkey
, "Wine33a");
1270 todo_wine
verify_reg_nonexist(hkey
, "Wine33b");
1271 todo_wine
verify_reg_nonexist(hkey
, "Wine33c");
1272 todo_wine
verify_reg_nonexist(hkey
, "Wine33d");
1273 todo_wine
verify_reg_nonexist(hkey
, "Wine33e");
1275 test_import_str("REGEDIT4\n\n"
1276 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1277 "\"Wine34a\"=dword:12345678abc\n"
1278 "\"Wine34b\"=dword:12345678 abc\n\n", &r
);
1279 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1280 todo_wine
verify_reg_nonexist(hkey
, "Wine34a");
1281 todo_wine
verify_reg_nonexist(hkey
, "Wine34b");
1283 test_import_str("REGEDIT4\n\n"
1284 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1285 "\"Wine35a\"=dword:0x123\n"
1286 "\"Wine35b\"=dword:123 456\n"
1287 "\"Wine35c\"=dword:1234 5678\n\n", &r
);
1288 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1289 todo_wine
verify_reg_nonexist(hkey
, "Wine35a");
1290 todo_wine
verify_reg_nonexist(hkey
, "Wine35b");
1291 todo_wine
verify_reg_nonexist(hkey
, "Wine35c");
1293 test_import_str("REGEDIT4\n\n"
1294 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1295 "\"Wine36a\"=dword:1234;5678\n"
1296 "\"Wine36b\"=dword:1234 ;5678\n"
1297 "\"Wine36c\"=dword:1234#5678\n"
1298 "\"Wine36d\"=dword:1234 #5678\n\n", &r
);
1299 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1301 todo_wine
verify_reg(hkey
, "Wine36a", REG_DWORD
, &dword
, sizeof(dword
), 0);
1302 todo_wine
verify_reg(hkey
, "Wine36b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1303 todo_wine
verify_reg_nonexist(hkey
, "Wine36c");
1304 todo_wine
verify_reg_nonexist(hkey
, "Wine36d");
1306 test_import_str("REGEDIT4\n\n"
1307 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1308 "\"Wine37a\"=\"foo\"bar\"\n"
1309 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r
);
1310 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1311 todo_wine
verify_reg_nonexist(hkey
, "Wine37a");
1312 todo_wine
verify_reg_nonexist(hkey
, "Wine37b");
1314 test_import_str("REGEDIT4\n\n"
1315 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1316 "\"Empty string\"=\"\"\n"
1317 "\"\"=\"Default Value Name\"\n\n", &r
);
1318 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1319 todo_wine
verify_reg(hkey
, "Empty string", REG_SZ
, "", 1, 0);
1320 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default Value Name", 19, 0);
1322 test_import_str("REGEDIT4\n\n"
1323 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1325 "\"Test38b\"=\\\"\n"
1326 "\"Test38c\"=\\\"Value\\\"\n"
1327 "\"Test38d\"=\\\"Value\"\n\n", &r
);
1328 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1329 todo_wine
verify_reg_nonexist(hkey
, "Test38a");
1330 todo_wine
verify_reg_nonexist(hkey
, "Test38b");
1331 todo_wine
verify_reg_nonexist(hkey
, "Test38c");
1332 todo_wine
verify_reg_nonexist(hkey
, "Test38d");
1334 test_import_str("REGEDIT4\n\n"
1335 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1336 "\"Wine39a\"=\"Value1\" ;comment\n"
1337 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
1338 "\"Wine39c\"=\"Value3\" #comment\n"
1339 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r
);
1340 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1341 todo_wine
verify_reg(hkey
, "Wine39a", REG_SZ
, "Value1", 7, 0);
1342 todo_wine
verify_reg(hkey
, "Wine39b", REG_SZ
, "Value2", 7, 0);
1343 todo_wine
verify_reg_nonexist(hkey
, "Wine39c");
1344 todo_wine
verify_reg_nonexist(hkey
, "Wine39d");
1346 test_import_str("REGEDIT4\n\n"
1347 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1348 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r
);
1349 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1350 todo_wine
verify_reg_nonexist(hkey
, "TestNoBeginQuote");
1352 test_import_str("REGEDIT4\n\n"
1353 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1354 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r
);
1355 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1356 todo_wine
verify_reg_nonexist(hkey
, "TestNoEndQuote");
1358 test_import_str("REGEDIT4\n\n"
1359 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1360 "\"TestNoQuotes\"=Asdffdsa\n", &r
);
1361 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1362 todo_wine
verify_reg_nonexist(hkey
, "TestNoQuotes");
1364 test_import_str("REGEDIT4\n\n"
1365 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1366 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r
);
1367 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1368 todo_wine
verify_reg_nonexist(hkey
, "NameNoBeginQuote");
1370 test_import_str("REGEDIT4\n\n"
1371 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1372 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r
);
1373 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1374 todo_wine
verify_reg_nonexist(hkey
, "NameNoEndQuote");
1376 test_import_str("REGEDIT4\n\n"
1377 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1378 "NameNoQuotes=\"Asdffdsa\"\n", &r
);
1379 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1380 todo_wine
verify_reg_nonexist(hkey
, "NameNoQuotes");
1382 test_import_str("REGEDIT4\n\n"
1383 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1384 "\"MixedQuotes=Asdffdsa\"\n", &r
);
1385 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1386 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes");
1387 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes=Asdffdsa");
1389 test_import_str("REGEDIT4\n\n"
1390 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1391 "\"Wine40a\"=hex(2):4c,69,6e,65,00\n"
1392 "\"Wine40b\"=\"Value 1\"\n"
1393 "\"Wine40c\"=hex(2):4c,69,6e,65\\\n"
1394 "\"Wine40d\"=\"Value 2\"\n"
1395 "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n"
1396 "\"Wine40f\"=\"Value 3\"\n"
1397 "\"Wine40g\"=\"Value 4\"\n\n", &r
);
1398 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1399 todo_wine
verify_reg(hkey
, "Wine40a", REG_EXPAND_SZ
, "Line", 5, 0);
1400 todo_wine
verify_reg(hkey
, "Wine40b", REG_SZ
, "Value 1", 8, 0);
1401 todo_wine
verify_reg_nonexist(hkey
, "Wine40c");
1402 todo_wine
verify_reg(hkey
, "Wine40d", REG_SZ
, "Value 2", 8, 0);
1403 todo_wine
verify_reg_nonexist(hkey
, "Wine40e");
1404 todo_wine
verify_reg_nonexist(hkey
, "Wine40f");
1405 todo_wine
verify_reg(hkey
, "Wine40g", REG_SZ
, "Value 4", 8, 0);
1407 test_import_str("REGEDIT4\n\n"
1408 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1409 "\"Wine41a\"=dword:1234\\\n"
1411 "\"Wine41b\"=\"Test \\\n"
1413 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1414 todo_wine
verify_reg_nonexist(hkey
, "Wine41a");
1415 todo_wine
verify_reg_nonexist(hkey
, "Wine41b");
1417 test_import_str("REGEDIT4\n\n"
1418 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1419 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
1420 "\"single'quote\"=dword:00000008\n\n", &r
);
1421 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1422 todo_wine
verify_reg(hkey
, "double\"quote", REG_SZ
, "valid \"or\" not", 15, 0);
1424 todo_wine
verify_reg(hkey
, "single'quote", REG_DWORD
, &dword
, sizeof(dword
), 0);
1426 /* Test key name and value name concatenation */
1427 test_import_str("REGEDIT4\n\n"
1428 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\\n"
1430 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1431 todo_wine
verify_key_nonexist(hkey
, "Subkey1");
1433 test_import_str("REGEDIT4\n\n"
1434 "[HKEY_CURRENT_USER\\" KEY_BASE
"\n"
1435 "\\Subkey2]\n", &r
);
1436 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1437 todo_wine
verify_key_nonexist(hkey
, "Subkey2");
1439 test_import_str("REGEDIT4\n\n"
1440 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1442 "42a\"=\"Value 1\"\n"
1443 "\"Wine42b\"=\"Value 2\"\n"
1445 "\\42c\"=\"Value 3\"\n\n", &r
);
1446 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1447 todo_wine
verify_reg_nonexist(hkey
, "Wine42a");
1448 todo_wine
verify_reg(hkey
, "Wine42b", REG_SZ
, "Value 2", 8, 0);
1449 todo_wine
verify_reg_nonexist(hkey
, "Wine42c");
1451 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
1452 test_import_str("REGEDIT4\n\n"
1453 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1454 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
1455 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
1456 " 75,00,65,00,00,00\n"
1457 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
1458 ",75,00,65,00,00,00\n"
1459 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
1460 " ,75,00,65,00,00,00\n"
1461 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
1462 " 75,00,65,00,00,00\n"
1463 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
1464 "5,00,65,00,00,00\n"
1465 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
1466 " 5,00,65,00,00,00\n"
1467 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
1470 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
1473 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
1474 " 6c,00,75,00,;comment\n"
1476 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
1477 " 6c,00,75,00,\\#comment\n"
1478 " 65,00,00,00\n\n", &r
);
1479 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1480 todo_wine
verify_reg(hkey
, "Wine43a", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1481 todo_wine
verify_reg(hkey
, "Wine43b", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1482 todo_wine
verify_reg_nonexist(hkey
, "Wine43c");
1483 todo_wine
verify_reg_nonexist(hkey
, "Wine43d");
1484 todo_wine
verify_reg_nonexist(hkey
, "Wine43e");
1485 todo_wine
verify_reg_nonexist(hkey
, "Wine43f");
1486 todo_wine
verify_reg_nonexist(hkey
, "Wine43g");
1487 todo_wine
verify_reg(hkey
, "Wine43h", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1488 todo_wine
verify_reg(hkey
, "Wine43i", REG_NONE
, "V\0a\0l\0u", 8, 0);
1489 todo_wine
verify_reg(hkey
, "Wine43j", REG_NONE
, "V\0a\0l\0u", 8, 0);
1490 todo_wine
verify_reg_nonexist(hkey
, "Wine43k");
1492 test_import_str("REGEDIT4\n\n"
1493 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1494 "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n"
1495 "\"Wine44b\"=hex(2):25,50,41,\\\n"
1497 "\"Wine44c\"=hex(2):25,50,41\\\n"
1499 "\"Wine44d\"=hex(2):25,50,41\\\n"
1501 "\"Wine44e\"=hex(2):25,50,41\\\n"
1503 "\"Wine44f\"=hex(2):25,50,4\\\n"
1505 "\"Wine44g\"=hex(2):25,50,4\\\n"
1507 "\"Wine44h\"=hex(2):25,50,41,\\;comment\n"
1510 "\"Wine44i\"=hex(2):25,50,41,\\;comment\n"
1513 "\"Wine44j\"=hex(2):25,50,41,\\;comment\n"
1516 "\"Wine44k\"=hex(2):25,50,41,\\;comment\n"
1517 " 54,48,\\#comment\n"
1519 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1520 todo_wine
verify_reg(hkey
, "Wine44a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1521 todo_wine
verify_reg(hkey
, "Wine44b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1522 todo_wine
verify_reg_nonexist(hkey
, "Wine44c");
1523 todo_wine
verify_reg_nonexist(hkey
, "Wine44d");
1524 todo_wine
verify_reg_nonexist(hkey
, "Wine44e");
1525 todo_wine
verify_reg_nonexist(hkey
, "Wine44f");
1526 todo_wine
verify_reg_nonexist(hkey
, "Wine44g");
1527 todo_wine
verify_reg(hkey
, "Wine44h", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1529 size
= sizeof(buffer
);
1530 err
= RegQueryValueExA(hkey
, "Wine44i", NULL
, &type
, (BYTE
*)&buffer
, &size
);
1531 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
1532 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
1533 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
1534 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
1536 size
= sizeof(buffer
);
1537 memset(buffer
, '-', size
);
1538 err
= RegQueryValueExA(hkey
, "Wine44j", NULL
, &type
, (BYTE
*)&buffer
, &size
);
1539 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
1540 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
1541 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
1542 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
1544 todo_wine
verify_reg_nonexist(hkey
, "Wine44k");
1546 test_import_str("REGEDIT4\n\n"
1547 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1548 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
1549 "\"Wine45b\"=hex:11,22,33,44,\\\n"
1551 "\"Wine45c\"=hex:11,22,33,44\\\n"
1553 "\"Wine45d\"=hex:11,22,33,44\\\n"
1555 "\"Wine45e\"=hex:11,22,33,44\\\n"
1557 "\"Wine45f\"=hex:11,22,33,4\\\n"
1559 "\"Wine45g\"=hex:11,22,33,4\\\n"
1561 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
1564 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
1567 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
1570 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
1571 " 44,55,66,\\#comment\n"
1573 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1574 hex
[0] = 0x11; hex
[1] = 0x22; hex
[2] = 0x33; hex
[3] = 0x44;
1575 hex
[4] = 0x55; hex
[5] = 0x66; hex
[6] = 0x77; hex
[7] = 0x88;
1576 todo_wine
verify_reg(hkey
, "Wine45a", REG_BINARY
, hex
, sizeof(hex
), 0);
1577 todo_wine
verify_reg(hkey
, "Wine45b", REG_BINARY
, hex
, sizeof(hex
), 0);
1578 todo_wine
verify_reg_nonexist(hkey
, "Wine45c");
1579 todo_wine
verify_reg_nonexist(hkey
, "Wine45d");
1580 todo_wine
verify_reg_nonexist(hkey
, "Wine45e");
1581 todo_wine
verify_reg_nonexist(hkey
, "Wine45f");
1582 todo_wine
verify_reg_nonexist(hkey
, "Wine45g");
1583 todo_wine
verify_reg(hkey
, "Wine45h", REG_BINARY
, hex
, sizeof(hex
), 0);
1584 todo_wine
verify_reg(hkey
, "Wine45i", REG_BINARY
, hex
, 6, 0);
1585 todo_wine
verify_reg(hkey
, "Wine45j", REG_BINARY
, hex
, 6, 0);
1586 todo_wine
verify_reg_nonexist(hkey
, "Wine45k");
1588 /* Test import with subkeys */
1589 test_import_str("REGEDIT4\n\n"
1590 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey\"1]\n"
1591 "\"Wine\\\\31\"=\"Test value\"\n\n", &r
);
1592 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1593 err
= RegOpenKeyExA(hkey
, "Subkey\"1", 0, KEY_READ
, &subkey
);
1594 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1595 todo_wine
verify_reg(subkey
, "Wine\\31", REG_SZ
, "Test value", 11, 0);
1596 err
= RegCloseKey(subkey
);
1597 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1598 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey\"1");
1599 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1601 test_import_str("REGEDIT4\n\n"
1602 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey/2]\n"
1603 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r
);
1604 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1605 err
= RegOpenKeyExA(hkey
, "Subkey/2", 0, KEY_READ
, &subkey
);
1606 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1607 todo_wine
verify_reg(subkey
, "123/\"4;'5", REG_SZ
, "Random value name", 18, 0);
1608 err
= RegCloseKey(subkey
);
1609 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1610 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey/2");
1611 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1613 /* Test key creation */
1614 test_import_str("REGEDIT4\n\n"
1615 "HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Opening_Bracket]\n", &r
);
1616 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1617 todo_wine
verify_key_nonexist(hkey
, "No_Opening_Bracket");
1619 test_import_str("REGEDIT4\n\n"
1620 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Closing_Bracket\n", &r
);
1621 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1622 todo_wine
verify_key_nonexist(hkey
, "No_Closing_Bracket");
1624 test_import_str("REGEDIT4\n\n"
1625 "[ HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1a]\n", &r
);
1626 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1627 todo_wine
verify_key_nonexist(hkey
, "Subkey1a");
1629 test_import_str("REGEDIT4\n\n"
1630 "[\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1b]\n", &r
);
1631 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1632 todo_wine
verify_key_nonexist(hkey
, "Subkey1b");
1634 test_import_str("REGEDIT4\n\n"
1635 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1c ]\n", &r
);
1636 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1637 todo_wine
verify_key(hkey
, "Subkey1c ");
1638 err
= RegDeleteKeyA(hkey
, "Subkey1c ");
1639 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1641 test_import_str("REGEDIT4\n\n"
1642 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1d\t]\n", &r
);
1643 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1644 todo_wine
verify_key(hkey
, "Subkey1d\t");
1645 err
= RegDeleteKeyA(hkey
, "Subkey1d\t");
1646 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1648 test_import_str("REGEDIT4\n\n"
1649 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1e\\]\n"
1650 "\"Wine\"=\"Test value\"\n\n", &r
);
1651 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1652 todo_wine
verify_key(hkey
, "Subkey1e\\");
1653 todo_wine
verify_key(hkey
, "Subkey1e");
1654 err
= RegOpenKeyExA(hkey
, "Subkey1e", 0, KEY_READ
, &subkey
);
1655 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %u, expected 0\n", err
);
1656 todo_wine
verify_reg(subkey
, "Wine", REG_SZ
, "Test value", 11, 0);
1657 RegCloseKey(subkey
);
1658 err
= RegDeleteKeyA(hkey
, "Subkey1e");
1659 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %u, expected 0\n", err
);
1661 test_import_str("REGEDIT4\n\n"
1662 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1f\\\\]\n"
1663 "\"Wine\"=\"Test value\"\n\n", &r
);
1664 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1665 todo_wine
verify_key(hkey
, "Subkey1f\\\\");
1666 todo_wine
verify_key(hkey
, "Subkey1f\\");
1667 todo_wine
verify_key(hkey
, "Subkey1f");
1668 err
= RegOpenKeyExA(hkey
, "Subkey1f\\\\", 0, KEY_READ
, &subkey
);
1669 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %u, expected 0\n", err
);
1670 todo_wine
verify_reg(subkey
, "Wine", REG_SZ
, "Test value", 11, 0);
1671 RegCloseKey(subkey
);
1672 err
= RegDeleteKeyA(hkey
, "Subkey1f\\\\");
1673 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %u, expected 0\n", err
);
1675 test_import_str("REGEDIT4\n\n"
1676 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1g\\\\\\\\]\n"
1677 "\"Wine\"=\"Test value\"\n\n", &r
);
1678 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1679 todo_wine
verify_key(hkey
, "Subkey1g\\\\\\\\");
1680 todo_wine
verify_key(hkey
, "Subkey1g\\\\");
1681 todo_wine
verify_key(hkey
, "Subkey1g\\");
1682 todo_wine
verify_key(hkey
, "Subkey1g");
1683 err
= RegOpenKeyExA(hkey
, "Subkey1g\\\\", 0, KEY_READ
, &subkey
);
1684 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %u, expected 0\n", err
);
1685 todo_wine
verify_reg(subkey
, "Wine", REG_SZ
, "Test value", 11, 0);
1686 RegCloseKey(subkey
);
1687 err
= RegDeleteKeyA(hkey
, "Subkey1g\\\\");
1688 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %u, expected 0\n", err
);
1690 /* Test key deletion. We start by creating some registry keys. */
1691 test_import_str("REGEDIT4\n\n"
1692 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1693 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1694 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1695 todo_wine
verify_key(hkey
, "Subkey2a");
1696 todo_wine
verify_key(hkey
, "Subkey2b");
1698 test_import_str("REGEDIT4\n\n"
1699 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1700 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1701 todo_wine
verify_key(hkey
, "Subkey2a");
1703 test_import_str("REGEDIT4\n\n"
1704 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1705 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1706 todo_wine
verify_key(hkey
, "Subkey2b");
1708 test_import_str("REGEDIT4\n\n"
1709 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1710 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1711 todo_wine
verify_key(hkey
, "Subkey2a");
1713 test_import_str("REGEDIT4\n\n"
1714 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1715 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1716 todo_wine
verify_key(hkey
, "Subkey2b");
1718 test_import_str("REGEDIT4\n\n"
1719 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1720 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1721 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1722 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
1723 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
1725 /* Test case sensitivity when creating and deleting registry keys. */
1726 test_import_str("REGEDIT4\n\n"
1727 "[hkey_CURRENT_user\\" KEY_BASE
"\\Subkey3a]\n\n"
1728 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE
"\\SuBkEy3b]\n\n", &r
);
1729 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1730 todo_wine
verify_key(hkey
, "Subkey3a");
1731 todo_wine
verify_key(hkey
, "Subkey3b");
1733 test_import_str("REGEDIT4\n\n"
1734 "[-HKEY_current_USER\\" KEY_BASE
"\\sUBKEY3A]\n\n"
1735 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE
"\\sUbKeY3B]\n\n", &r
);
1736 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1737 todo_wine
verify_key_nonexist(hkey
, "Subkey3a");
1738 todo_wine
verify_key_nonexist(hkey
, "Subkey3b");
1740 /* Test value deletion. We start by creating some registry values. */
1741 test_import_str("REGEDIT4\n\n"
1742 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1743 "\"Wine46a\"=\"Test Value\"\n"
1744 "\"Wine46b\"=dword:00000008\n"
1745 "\"Wine46c\"=hex:11,22,33,44\n"
1746 "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n"
1747 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1748 "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n"
1749 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
1750 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1751 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
1752 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1753 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
1754 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1755 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1756 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1758 test_import_str("REGEDIT4\n\n"
1759 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1762 "\"Wine46c\"= \t-\t \n"
1763 "\"Wine46d\"=-\"Test\"\n"
1764 "\"Wine46e\"=- ;comment\n"
1765 "\"Wine46f\"=- #comment\n\n", &r
);
1766 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1767 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
1768 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
1769 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
1770 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1771 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
1772 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1774 /* Test the accepted range of the hex-based data types */
1775 test_import_str("REGEDIT4\n\n"
1776 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1777 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
1778 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
1779 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
1780 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
1781 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
1782 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
1783 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
1784 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
1785 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n"
1786 "\"Wine47j\"=hex(0x2):56,61,6c,75,65,00\n"
1787 "\"Wine47k\"=hex(0X2):56,61,6c,75,65,00\n"
1788 "\"Wine47l\"=hex(x2):56,61,6c,75,65,00\n\n", &r
);
1789 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1790 todo_wine
verify_reg(hkey
, "Wine47a", REG_NONE
, "Value", 6, 0);
1791 todo_wine
verify_reg(hkey
, "Wine47b", 0x10, "Value", 6, 0);
1792 todo_wine
verify_reg(hkey
, "Wine47c", 0x100, "Value", 6, 0);
1793 todo_wine
verify_reg(hkey
, "Wine47d", 0x1000, "Value", 6, 0);
1794 todo_wine
verify_reg(hkey
, "Wine47e", 0x7fff, "Value", 6, 0);
1795 todo_wine
verify_reg(hkey
, "Wine47f", 0xffff, "Value", 6, 0);
1796 todo_wine
verify_reg(hkey
, "Wine47g", 0x7fffffff, "Value", 6, 0);
1797 todo_wine
verify_reg(hkey
, "Wine47h", 0xffffffff, "Value", 6, 0);
1798 todo_wine
verify_reg_nonexist(hkey
, "Wine47i");
1799 todo_wine
verify_reg_nonexist(hkey
, "Wine47j");
1800 todo_wine
verify_reg_nonexist(hkey
, "Wine47k");
1801 todo_wine
verify_reg_nonexist(hkey
, "Wine47l");
1803 test_import_str("REGEDIT4\n\n"
1804 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1805 "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n"
1806 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1807 "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n"
1808 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1809 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1810 todo_wine
verify_reg(hkey
, "Wine48a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1811 todo_wine
verify_reg(hkey
, "Wine48b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1813 test_import_str("REGEDIT4\n\n"
1814 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1815 "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\n\n", &r
);
1816 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1817 todo_wine
verify_reg(hkey
, "Wine49", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1819 test_import_str("REGEDIT4\n\n"
1820 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1821 "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n"
1822 "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n"
1823 "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n"
1824 "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r
);
1825 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1826 todo_wine
verify_reg(hkey
, "Wine50a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1827 todo_wine
verify_reg(hkey
, "Wine50b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1828 todo_wine
verify_reg_nonexist(hkey
, "Wine50c");
1829 todo_wine
verify_reg_nonexist(hkey
, "Wine50d");
1831 /* Test support for characters greater than 0xff */
1832 test_import_str("REGEDIT4\n\n"
1833 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1834 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
1835 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r
);
1836 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1837 todo_wine
verify_reg_nonexist(hkey
, "Wine51a");
1838 todo_wine
verify_reg_nonexist(hkey
, "Wine51b");
1840 /* Test the effect of backslashes in hex data */
1841 test_import_str("REGEDIT4\n\n"
1842 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1843 "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n"
1844 "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n"
1845 "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n"
1846 "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n"
1847 "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n"
1848 "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n"
1849 "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n"
1850 "\"Wine52h\"=hex(2):25,48,4\\\n"
1852 "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n"
1853 "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n"
1854 " 25,50,41,54,48,25,00\n"
1855 "\"Wine52k\"=hex(2):,\\\n"
1856 " 25,48,4f,4d,45,25,00\n"
1857 "\"Wine52l\"=hex(2):\\\n"
1858 " 25,48,4f,4d,45,25,00\n\n", &r
);
1859 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1860 todo_wine
verify_reg_nonexist(hkey
, "Wine52a");
1861 todo_wine
verify_reg_nonexist(hkey
, "Wine52b");
1862 todo_wine
verify_reg_nonexist(hkey
, "Wine52c");
1863 todo_wine
verify_reg_nonexist(hkey
, "Wine52d");
1864 todo_wine
verify_reg_nonexist(hkey
, "Wine52e");
1865 todo_wine
verify_reg_nonexist(hkey
, "Wine52f");
1866 todo_wine
verify_reg_nonexist(hkey
, "Wine52g");
1867 todo_wine
verify_reg_nonexist(hkey
, "Wine52h");
1868 todo_wine
verify_reg_nonexist(hkey
, "Wine52i");
1869 todo_wine
verify_reg_nonexist(hkey
, "Wine52j");
1870 todo_wine
verify_reg_nonexist(hkey
, "Wine52k");
1871 todo_wine
verify_reg(hkey
, "Wine52l", REG_EXPAND_SZ
, "%HOME%", 7, 0);
1873 test_import_str("REGEDIT4\n\n"
1874 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1875 "\"Wine53a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1876 " 25,50,41,54,48,25,00\n"
1877 "\"Wine53b\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
1878 " 25,50,41,54,48,25,00\n"
1879 "\"Wine53c\"=hex(2):25,48,4f,4d,45,25,5c, \\ ;comment\n"
1880 " 25,50,41,54,48,25,00\n"
1881 "\"Wine53d\"=hex(2):25,48,4f,4d,45,25,5c \\ ;comment\n"
1882 " 25,50,41,54,48,25,00\n"
1883 "\"Wine53e\"=hex(2):25,48,4f,4d,45,25,5c,\\\t ;comment\n"
1884 " 25,50,41,54,48,25,00\n"
1885 "\"Wine53f\"=hex(2):25,48,4f,4d,45,25,5c\\\t ;comment\n"
1886 " 25,50,41,54,48,25,00\n\n", &r
);
1887 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1888 todo_wine
verify_reg(hkey
, "Wine53a", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
1889 todo_wine
verify_reg_nonexist(hkey
, "Wine53b");
1890 todo_wine
verify_reg(hkey
, "Wine53c", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
1891 todo_wine
verify_reg_nonexist(hkey
, "Wine53d");
1892 todo_wine
verify_reg(hkey
, "Wine53e", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
1893 todo_wine
verify_reg_nonexist(hkey
, "Wine53f");
1895 test_import_str("REGEDIT4\n\n"
1896 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1897 "\"Wine54a\"=hex(2):4c,69,6e,65,20,\\\n"
1898 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1]\n", &r
);
1899 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1900 todo_wine
verify_reg_nonexist(hkey
, "Wine54a");
1901 todo_wine
verify_key_nonexist(hkey
, "Subkey1");
1903 test_import_str("REGEDIT4\n\n"
1904 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1905 "\"Wine54b\"=hex(2):4c,69,6e,65,20\\\n"
1906 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2]\n", &r
);
1907 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1908 todo_wine
verify_reg_nonexist(hkey
, "Wine54b");
1909 todo_wine
verify_key(hkey
, "Subkey2");
1911 err
= RegDeleteKeyA(hkey
, "Subkey2");
1912 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKey failed: %u\n", err
);
1914 test_import_str("REGEDIT4\n\n"
1915 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1916 "\"Wine55a\"=hex(2):4c,69,6e,65,20,\\\n"
1917 "\"Wine55b\"=\"Test value\"\n"
1919 "\"Wine55c\"=hex(2):4c,69,6e,65,20,\\\n"
1921 "\"Wine55d\"=\"Test value\"\n"
1923 "\"Wine55e\"=hex(2):4c,69,6e,65,20,\\\n"
1925 "\"Wine55f\"=\"Test value\"\n"
1927 "\"Wine55g\"=hex(2):4c,69,6e,65,20,\\\n\n"
1928 "\"Wine55h\"=\"Test value\"\n"
1930 "\"Wine55i\"=hex(2):4c,69,6e,65,20\\\n"
1931 "\"Wine55j\"=\"Test value\"\n\n", &r
);
1932 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1933 todo_wine
verify_reg_nonexist(hkey
, "Wine55a");
1934 todo_wine
verify_reg_nonexist(hkey
, "Wine55b");
1935 todo_wine
verify_reg_nonexist(hkey
, "Wine55c");
1936 todo_wine
verify_reg_nonexist(hkey
, "Wine55d");
1937 todo_wine
verify_reg_nonexist(hkey
, "Wine55e");
1938 todo_wine
verify_reg(hkey
, "Wine55f", REG_SZ
, "Test value", 11, 0);
1939 todo_wine
verify_reg_nonexist(hkey
, "Wine55g");
1940 todo_wine
verify_reg_nonexist(hkey
, "Wine55h");
1941 todo_wine
verify_reg_nonexist(hkey
, "Wine55i");
1942 todo_wine
verify_reg(hkey
, "Wine55j", REG_SZ
, "Test value", 11, 0);
1944 test_import_str("REGEDIT4\n\n"
1945 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1946 "\"Wine56a\"=hex(2):4c,69,6e,65,20,\\\n"
1947 "\"Wine56b\"=dword:00000008\n"
1949 "\"Wine56c\"=hex(2):4c,69,6e,65,20,\\\n"
1951 "\"Wine56d\"=dword:00000008\n"
1953 "\"Wine56e\"=hex(2):4c,69,6e,65,20,\\\n"
1955 "\"Wine56f\"=dword:00000008\n"
1957 "\"Wine56g\"=hex(2):4c,69,6e,65,20,\\\n\n"
1958 "\"Wine56h\"=dword:00000008\n"
1960 "\"Wine56i\"=hex(2):4c,69,6e,65,20\\\n"
1961 "\"Wine56j\"=dword:00000008\n\n", &r
);
1962 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1963 todo_wine
verify_reg_nonexist(hkey
, "Wine56a");
1964 todo_wine
verify_reg_nonexist(hkey
, "Wine56b");
1965 todo_wine
verify_reg_nonexist(hkey
, "Wine56c");
1966 todo_wine
verify_reg_nonexist(hkey
, "Wine56d");
1967 todo_wine
verify_reg_nonexist(hkey
, "Wine56e");
1968 todo_wine
verify_reg(hkey
, "Wine56f", REG_DWORD
, &dword
, sizeof(dword
), 0);
1969 todo_wine
verify_reg_nonexist(hkey
, "Wine56g");
1970 todo_wine
verify_reg_nonexist(hkey
, "Wine56h");
1971 todo_wine
verify_reg_nonexist(hkey
, "Wine56i");
1972 todo_wine
verify_reg(hkey
, "Wine56j", REG_DWORD
, &dword
, sizeof(dword
), 0);
1974 test_import_str("REGEDIT4\n\n"
1975 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1976 "\"Wine57a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1977 "\"Wine57b\"=hex(2):25,50,41,54,48,25,00\n"
1979 "\"Wine57c\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1981 "\"Wine57d\"=hex(2):25,50,41,54,48,25,00\n"
1983 "\"Wine57e\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1985 "\"Wine57f\"=hex(2):25,50,41,54,48,25,00\n"
1987 "\"Wine57g\"=hex(2):25,48,4f,4d,45,25,5c,\\\n\n"
1988 "\"Wine57h\"=hex(2):25,50,41,54,48,25,00\n"
1990 "\"Wine57i\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
1991 "\"Wine57j\"=hex(2):25,50,41,54,48,25,00\n\n", &r
);
1992 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1993 todo_wine
verify_reg_nonexist(hkey
, "Wine57a");
1994 todo_wine
verify_reg_nonexist(hkey
, "Wine57b");
1995 todo_wine
verify_reg_nonexist(hkey
, "Wine57c");
1996 todo_wine
verify_reg_nonexist(hkey
, "Wine57d");
1997 todo_wine
verify_reg_nonexist(hkey
, "Wine57e");
1998 todo_wine
verify_reg(hkey
, "Wine57f", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1999 todo_wine
verify_reg_nonexist(hkey
, "Wine57g");
2000 todo_wine
verify_reg_nonexist(hkey
, "Wine57h");
2001 todo_wine
verify_reg_nonexist(hkey
, "Wine57i");
2002 todo_wine
verify_reg(hkey
, "Wine57j", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2004 err
= RegDeleteValueW(hkey
, NULL
);
2005 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteValue failed: %u\n", err
);
2007 test_import_str("REGEDIT4\n\n"
2008 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2009 "\"Wine58a\"=hex(2):4c,69,6e,65,20,\\\n"
2010 "@=\"Default value 1\"\n\n", &r
);
2011 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2012 todo_wine
verify_reg_nonexist(hkey
, "Wine58a");
2013 todo_wine
verify_reg_nonexist(hkey
, NULL
);
2015 test_import_str("REGEDIT4\n\n"
2016 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2017 "\"Wine58b\"=hex(2):4c,69,6e,65,20,\\\n"
2019 "@=\"Default value 2\"\n\n", &r
);
2020 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2021 todo_wine
verify_reg_nonexist(hkey
, "Wine58b");
2022 todo_wine
verify_reg_nonexist(hkey
, NULL
);
2024 test_import_str("REGEDIT4\n\n"
2025 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2026 "\"Wine58c\"=hex(2):4c,69,6e,65,20,\\\n"
2028 "@=\"Default value 3\"\n\n", &r
);
2029 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2030 todo_wine
verify_reg_nonexist(hkey
, "Wine58c");
2031 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default value 3", 16, 0);
2033 err
= RegDeleteValueW(hkey
, NULL
);
2034 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteValue failed: %u\n", err
);
2036 test_import_str("REGEDIT4\n\n"
2037 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2038 "\"Wine58d\"=hex(2):4c,69,6e,65,20,\\\n\n"
2039 "@=\"Default value 4\"\n\n", &r
);
2040 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2041 todo_wine
verify_reg_nonexist(hkey
, "Wine58d");
2042 todo_wine
verify_reg_nonexist(hkey
, NULL
);
2044 test_import_str("REGEDIT4\n\n"
2045 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2046 "\"Wine58e\"=hex(2):4c,69,6e,65,20\\\n"
2047 "@=\"Default value 5\"\n\n", &r
);
2048 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2049 todo_wine
verify_reg_nonexist(hkey
, "Wine58e");
2050 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default value 5", 16, 0);
2052 test_import_str("REGEDIT4\n\n"
2053 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2054 "\"Wine59a\"=hex:11,22,33,\\\n"
2057 "\"Wine59b\"=hex:11,22,33,\\\n"
2059 " 44,55,66\n\n", &r
);
2060 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2061 todo_wine
verify_reg_nonexist(hkey
, "Wine59a");
2062 todo_wine
verify_reg_nonexist(hkey
, "Wine59b");
2064 test_import_str("REGEDIT4\n\n"
2065 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2066 "\"Wine60a\"=hex(7):4c,69,6e,65,20,\\\n"
2067 " 63,6f,6e,63,61,74,\\\n"
2069 " 65,6e,\\;comment\n"
2070 " 61,74,69,6f,6e,00,00\n\n", &r
);
2071 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2072 todo_wine
verify_reg(hkey
, "Wine60a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2074 test_import_str("REGEDIT4\n\n"
2075 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2076 "\"Wine60b\"=hex(7):4c,69,6e,65,20,\\\n"
2077 " 63,6f,6e,63,61,74,\\\n"
2079 " 65,6e,\\;comment\n"
2080 " 61,74,69,6f,6e,00,00\n\n", &r
);
2081 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2082 todo_wine
verify_reg(hkey
, "Wine60b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2084 test_import_str("REGEDIT4\n\n"
2085 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2086 "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n"
2087 " 63,6f,6e,63,61,74,\\\n"
2089 " 65,6e,\\;comment\n"
2090 " 61,74,69,6f,6e,00,00\n\n", &r
);
2091 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2092 todo_wine
verify_reg_nonexist(hkey
, "Wine60c");
2094 test_import_str("REGEDIT4\n\n"
2095 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2096 "\"Wine60d\"=hex(7):4c,69,6e,65,20,\\\n"
2097 " 63,6f,6e,63,61,74,\\\n"
2099 " 65,6e,\\;comment\n"
2100 " 61,74,69,6f,6e,00,00\n\n", &r
);
2101 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2102 todo_wine
verify_reg_nonexist(hkey
, "Wine60d");
2104 test_import_str("REGEDIT4\n\n"
2105 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2106 "\"Wine60e\"=hex(7):4c,69,6e,65,20,\\\n"
2108 " 63,61,74,\\\n\n\n"
2110 " 61,74,69,6f,6e,00,00\n\n", &r
);
2111 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2112 todo_wine
verify_reg(hkey
, "Wine60e", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2114 test_import_str("REGEDIT4\n\n"
2115 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2116 "\"Wine60f\"=hex(7):4c,69,6e,65,20,\\\n"
2118 " 63,61,74,\\\n\t\n\t\n"
2119 " 65,6e,\\\n\t \t\n\t \t\n\t \t\n"
2120 " 61,74,69,6f,6e,00,00\n\n", &r
);
2121 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2122 todo_wine
verify_reg(hkey
, "Wine60f", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2124 test_import_str("REGEDIT4\n\n"
2125 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2126 "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n"
2127 " 25,50,41,54,48,25,00\n"
2128 "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n"
2129 " 25,50,41,54,48,25,00\n\n", &r
);
2130 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2131 todo_wine
verify_reg_nonexist(hkey
, "Wine61a");
2132 todo_wine
verify_reg_nonexist(hkey
, "Wine61b");
2134 test_import_str("REGEDIT4\n\n"
2135 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2136 "\"Wine62a\"=hex(7):4c,69,6e,65,20,\\", &r
);
2137 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2138 err
= RegQueryValueExA(hkey
, "Wine62a", NULL
, NULL
, NULL
, NULL
);
2139 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
) /* WinXP */,
2140 "got %u, expected 0\n", err
);
2141 if (err
== ERROR_SUCCESS
)
2142 todo_wine
verify_reg(hkey
, "Wine62a", REG_MULTI_SZ
, "Line ", 6, 0);
2144 test_import_str("REGEDIT4\n\n"
2145 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2146 "\"Wine62b\"=hex(7):4c,69,6e,65,20\\", &r
);
2147 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2148 todo_wine
verify_reg_nonexist(hkey
, "Wine62b");
2150 test_import_str("REGEDIT4\n\n"
2151 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2152 "\"Wine63a\"=hex(7):4c,69,6e,65,20,\\\n"
2153 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
2154 "\"Wine63b\"=hex(7):4c,69,6e,65,20,\\\n"
2155 " 63,,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2156 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2157 todo_wine
verify_reg_nonexist(hkey
, "Wine63a");
2158 todo_wine
verify_reg_nonexist(hkey
, "Wine63b");
2160 test_import_str("REGEDIT4\n\n"
2161 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2162 "\"Wine64a\"=hex(7):4c,69,6e,65,00,00\n"
2163 "\"Wine64b\"=hex(7):4c,69,6e,65,20,\\\n"
2164 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
2165 "\"Wine64c\"=hex(7):4c,69,6e,65,20,\\;comment\n"
2166 " 63,6f,6e,63,61,74,\\\n"
2167 " 65,6e,61,74,69,6f,6e,00,00\n"
2168 "\"Wine64d\"=hex(7):4c,69,6e,65,20,\\;comment\n"
2169 " 63,6f,6e,63,61,74,\n"
2170 " 65,6e,61,74,69,6f,6e,00,00\n"
2171 "\"Wine64e\"=hex(7):4c,69,6e,65,20,\\\n"
2172 " 63,6f,6e,63,61,74,;comment\n"
2173 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2174 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2175 todo_wine
verify_reg(hkey
, "Wine64a", REG_MULTI_SZ
, "Line\0", 6, 0);
2176 todo_wine
verify_reg(hkey
, "Wine64b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2177 todo_wine
verify_reg(hkey
, "Wine64c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2179 size
= sizeof(buffer
);
2180 err
= RegQueryValueExA(hkey
, "Wine64d", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2181 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2182 todo_wine
ok(type
== REG_MULTI_SZ
, "got wrong type %u, expected %u\n", type
, REG_MULTI_SZ
);
2183 todo_wine
ok(size
== 12 || broken(size
== 11) /* WinXP */, "got wrong size %u, expected 12\n", size
);
2184 todo_wine
ok(memcmp(buffer
, "Line concat", size
) == 0, "got wrong data\n");
2186 size
= sizeof(buffer
);
2187 err
= RegQueryValueExA(hkey
, "Wine64e", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2188 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2189 todo_wine
ok(type
== REG_MULTI_SZ
, "got wrong type %u, expected %u\n", type
, REG_MULTI_SZ
);
2190 todo_wine
ok(size
== 12 || broken(size
== 11) /* WinXP */, "got wrong size %u, expected 12\n", size
);
2191 todo_wine
ok(memcmp(buffer
, "Line concat", size
) == 0, "got wrong data\n");
2193 test_import_str("REGEDIT4\n\n"
2194 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2195 "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n"
2196 "\"Wine65b\"=hex(100):25,50,41,\\\n"
2198 "\"Wine65c\"=hex(100):25,50,41,\\;comment\n"
2201 "\"Wine65d\"=hex(100):25,50,41,\\;comment\n"
2204 "\"Wine65e\"=hex(100):25,50,41,\\;comment\n"
2207 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2208 todo_wine
verify_reg(hkey
, "Wine65a", 0x100, "%PATH%", 7, 0);
2209 todo_wine
verify_reg(hkey
, "Wine65b", 0x100, "%PATH%", 7, 0);
2210 todo_wine
verify_reg(hkey
, "Wine65c", 0x100, "%PATH%", 7, 0);
2211 todo_wine
verify_reg(hkey
, "Wine65d", 0x100, "%PATH", 5, 0);
2212 todo_wine
verify_reg(hkey
, "Wine65e", 0x100, "%PATH", 5, 0);
2214 /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/
2215 test_import_str("REGEDIT4\n\n"
2216 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2217 "\"Wine66a\"=hex(7):4c,69,6e,65\n"
2218 "\"Wine66b\"=hex(7):4c,69,6e,65,\n"
2219 "\"Wine66c\"=hex(7):4c,69,6e,65,00\n"
2220 "\"Wine66d\"=hex(7):4c,69,6e,65,00,\n"
2221 "\"Wine66e\"=hex(7):4c,69,6e,65,00,00\n"
2222 "\"Wine66f\"=hex(7):4c,69,6e,65,00,00,\n\n", &r
);
2223 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2224 todo_wine
verify_reg(hkey
, "Wine66a", REG_MULTI_SZ
, "Line", 5, 0);
2225 todo_wine
verify_reg(hkey
, "Wine66b", REG_MULTI_SZ
, "Line", 5, 0);
2226 todo_wine
verify_reg(hkey
, "Wine66c", REG_MULTI_SZ
, "Line", 5, 0);
2227 todo_wine
verify_reg(hkey
, "Wine66d", REG_MULTI_SZ
, "Line", 5, 0);
2228 todo_wine
verify_reg(hkey
, "Wine66e", REG_MULTI_SZ
, "Line\0", 6, 0);
2229 todo_wine
verify_reg(hkey
, "Wine66f", REG_MULTI_SZ
, "Line\0", 6, 0);
2231 test_import_str("REGEDIT4\n\n"
2232 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2233 "\"Wine67a\"=hex(2):25,50,41,54,48,25\n"
2234 "\"Wine67b\"=hex(2):25,50,41,54,48,25,\n"
2235 "\"Wine67c\"=hex(2):25,50,41,54,48,25,00\n"
2236 "\"Wine67d\"=hex(2):25,50,41,54,48,25,00,\n\n", &r
);
2237 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2238 todo_wine
verify_reg(hkey
, "Wine67a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2239 todo_wine
verify_reg(hkey
, "Wine67b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2240 todo_wine
verify_reg(hkey
, "Wine67c", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2241 todo_wine
verify_reg(hkey
, "Wine67d", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2243 err
= RegCloseKey(hkey
);
2244 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2246 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
2247 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2250 static void test_unicode_import(void)
2252 DWORD r
, dword
= 0x123, type
, size
;
2258 test_import_wstr("REGEDIT\n", &r
);
2259 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2260 "got exit code %d, expected 1\n", r
);
2262 test_import_wstr("REGEDIT4\n", &r
);
2263 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2264 "got exit code %d, expected 1\n", r
);
2266 test_import_wstr("\xef\xbb\xbfREGEDIT", &r
);
2267 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2269 test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r
);
2270 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2272 test_import_wstr("\xef\xbb\xbfREGEDIT4", &r
);
2273 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2275 test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r
);
2276 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2278 test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r
);
2279 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2281 test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r
);
2282 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2284 test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r
);
2285 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2286 "got exit code %d, expected 1\n", r
);
2288 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
2289 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n", &r
);
2290 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2292 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
|KEY_SET_VALUE
, &hkey
);
2293 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2295 test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n"
2296 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2297 "\"Test1\"=\"Value\"\n", &r
);
2298 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2299 todo_wine
verify_reg_nonexist(hkey
, "Test1");
2301 test_import_wstr("\xef\xbb\xbfregedit4\n\n"
2302 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2303 "\"Test2\"=\"Value\"\n", &r
);
2304 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2305 "got exit code %d, expected 1\n", r
);
2306 todo_wine
verify_reg_nonexist(hkey
, "Test2");
2308 test_import_wstr("\xef\xbb\xbfRegedit4\n\n"
2309 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2310 "\"Test3\"=\"Value\"\n", &r
);
2311 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2312 "got exit code %d, expected 1\n", r
);
2313 todo_wine
verify_reg_nonexist(hkey
, "Test3");
2315 test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n"
2316 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2317 "\"Test4\"=\"Value\"\n", &r
);
2318 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2319 todo_wine
verify_reg_nonexist(hkey
, "Test4");
2321 test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n"
2322 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2323 "\"Test5\"=\"Value\"\n", &r
);
2324 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2325 todo_wine
verify_reg_nonexist(hkey
, "Test5");
2327 test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n"
2328 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2329 "\"Test6\"=\"Value\"\n", &r
);
2330 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2331 todo_wine
verify_reg_nonexist(hkey
, "Test6");
2333 test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n"
2334 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2335 "\"Test7\"=\"Value\"\n", &r
);
2336 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2337 todo_wine
verify_reg_nonexist(hkey
, "Test7");
2339 test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n"
2340 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2341 "\"Test8\"=\"Value\"\n", &r
);
2342 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2343 todo_wine
verify_reg_nonexist(hkey
, "Test8");
2345 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
2346 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2347 "\"Unicode1\"=\"Value1\"\n", &r
);
2348 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2349 todo_wine
verify_reg(hkey
, "Unicode1", REG_SZ
, "Value1", 7, 0);
2351 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
2352 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2353 "\"Unicode2\"=\"Value2\"\n\n", &r
);
2354 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2355 todo_wine
verify_reg(hkey
, "Unicode2", REG_SZ
, "Value2", 7, 0);
2357 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2358 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2359 "\"Unicode3\"=\"Value3\"\n\n", &r
);
2360 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2361 todo_wine
verify_reg(hkey
, "Unicode3", REG_SZ
, "Value3", 7, 0);
2363 test_import_wstr("Windows Registry Editor Version 4.00\n", &r
);
2364 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2365 "got exit code %d, expected 1\n", r
);
2367 test_import_wstr("Windows Registry Editor Version 5.00\n", &r
);
2368 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2369 "got exit code %d, expected 1\n", r
);
2371 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r
);
2372 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2373 "got exit code %d, expected 1\n", r
);
2375 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r
);
2376 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2378 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r
);
2379 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2381 test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r
);
2382 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2383 "got exit code %d, expected 1\n", r
);
2385 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r
);
2386 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2388 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r
);
2389 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2391 test_import_wstr("\xef\xbb\xbf\nWindows Registry Editor Version 5.00\n", &r
);
2392 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2393 "got exit code %d, expected 1\n", r
);
2395 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n"
2396 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2397 "\"Test9\"=\"Value\"\n", &r
);
2398 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2399 "got exit code %d, expected 1\n", r
);
2400 todo_wine
verify_reg_nonexist(hkey
, "Test9");
2402 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n"
2403 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2404 "\"Test10\"=\"Value\"\n", &r
);
2405 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2406 "got exit code %d, expected 1\n", r
);
2407 todo_wine
verify_reg_nonexist(hkey
, "Test10");
2409 test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
2410 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2411 "\"Test11\"=\"Value\"\n", &r
);
2412 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2413 "got exit code %d, expected 1\n", r
);
2414 todo_wine
verify_reg_nonexist(hkey
, "Test11");
2416 test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n"
2417 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2418 "\"Test12\"=\"Value\"\n", &r
);
2419 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2420 "got exit code %d, expected 1\n", r
);
2421 todo_wine
verify_reg_nonexist(hkey
, "Test12");
2423 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
2424 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2425 "\"Unicode4\"=\"Value4\"\n", &r
);
2426 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2427 todo_wine
verify_reg(hkey
, "Unicode4", REG_SZ
, "Value4", 7, 0);
2429 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
2430 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2431 "\"Unicode5\"=\"Value5\"\n\n", &r
);
2432 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2433 todo_wine
verify_reg(hkey
, "Unicode5", REG_SZ
, "Value5", 7, 0);
2435 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2436 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2437 "\"Unicode6\"=\"Value6\"\n\n", &r
);
2438 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2439 todo_wine
verify_reg(hkey
, "Unicode6", REG_SZ
, "Value6", 7, 0);
2441 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2442 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2443 "\"Line1\"=\"Value1\"\n\n"
2444 "\"Line2\"=\"Value2\"\n\n\n"
2445 "\"Line3\"=\"Value3\"\n\n\n\n"
2446 "\"Line4\"=\"Value4\"\n\n", &r
);
2447 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2448 todo_wine
verify_reg(hkey
, "Line1", REG_SZ
, "Value1", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2449 todo_wine
verify_reg(hkey
, "Line2", REG_SZ
, "Value2", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2450 todo_wine
verify_reg(hkey
, "Line3", REG_SZ
, "Value3", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2451 todo_wine
verify_reg(hkey
, "Line4", REG_SZ
, "Value4", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2453 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2454 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2455 "\"Wine1\"=dword:00000782\n\n"
2456 "\"Wine2\"=\"Test Value\"\n"
2457 "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2458 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2462 "\"Wine4\"=dword:12345678\n\n", &r
);
2463 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2465 todo_wine
verify_reg(hkey
, "Wine1", REG_DWORD
, &dword
, sizeof(dword
),
2466 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2467 todo_wine
verify_reg(hkey
, "Wine2", REG_SZ
, "Test Value", 11,
2468 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2469 todo_wine
verify_reg(hkey
, "Wine3", REG_MULTI_SZ
, "Line concatenation\0", 20,
2470 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2471 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test", 5,
2472 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2474 todo_wine
verify_reg(hkey
, "Wine4", REG_DWORD
, &dword
, sizeof(dword
),
2475 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2477 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2478 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2479 "\"Wine5\"=\"No newline\"", &r
);
2480 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2481 err
= RegQueryValueExA(hkey
, "Wine5", NULL
, NULL
, NULL
, NULL
);
2482 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
2483 "got %d, expected 0\n", err
);
2484 if (err
== ERROR_SUCCESS
)
2485 verify_reg(hkey
, "Wine5", REG_SZ
, "No newline", 11, 0);
2487 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2488 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2489 "\"Wine6\"=dword:00000050\n\n"
2490 "\"Wine7\"=\"No newline\"", &r
);
2491 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2493 todo_wine
verify_reg(hkey
, "Wine6", REG_DWORD
, &dword
, sizeof(dword
),
2494 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2495 err
= RegQueryValueExA(hkey
, "Wine7", NULL
, NULL
, NULL
, NULL
);
2496 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
2497 "got %d, expected 0\n", err
);
2498 if (err
== ERROR_SUCCESS
)
2499 verify_reg(hkey
, "Wine7", REG_SZ
, "No newline", 11, 0);
2501 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2502 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2504 "\"Wine8\"=\"Line 1\"\n"
2506 "\"Wine9\"=\"Line 2\"\n\n", &r
);
2507 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2508 todo_wine
verify_reg(hkey
, "Wine8", REG_SZ
, "Line 1", 7, 0);
2509 todo_wine
verify_reg(hkey
, "Wine9", REG_SZ
, "Line 2", 7, 0);
2511 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2512 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2513 "\"Wine10\"=\"Value 1\"#comment\n"
2514 "\"Wine11\"=\"Value 2\";comment\n"
2515 "\"Wine12\"=dword:01020304 #comment\n"
2516 "\"Wine13\"=dword:02040608 ;comment\n\n", &r
);
2517 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2518 todo_wine
verify_reg_nonexist(hkey
, "Wine10");
2519 todo_wine
verify_reg(hkey
, "Wine11", REG_SZ
, "Value 2", 8, 0);
2520 todo_wine
verify_reg_nonexist(hkey
, "Wine12");
2522 todo_wine
verify_reg(hkey
, "Wine13", REG_DWORD
, &dword
, sizeof(dword
), 0);
2524 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2525 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2526 "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2528 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2529 "\"Wine15\"=\"A valid line\"\n"
2530 "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2532 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2533 "\"Wine17\"=\"Another valid line\"\n\n", &r
);
2534 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2535 todo_wine
verify_reg_nonexist(hkey
, "Wine14");
2536 todo_wine
verify_reg(hkey
, "Wine15", REG_SZ
, "A valid line", 13, 0);
2537 todo_wine
verify_reg(hkey
, "Wine16", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2538 todo_wine
verify_reg(hkey
, "Wine17", REG_SZ
, "Another valid line", 19, 0);
2540 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2541 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2542 "#\"Comment1\"=\"Value 1\"\n"
2543 ";\"Comment2\"=\"Value 2\"\n"
2544 " #\"Comment3\"=\"Value 3\"\n"
2545 " ;\"Comment4\"=\"Value 4\"\n"
2546 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
2547 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r
);
2548 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2549 todo_wine
verify_reg_nonexist(hkey
, "Comment1");
2550 todo_wine
verify_reg_nonexist(hkey
, "Comment2");
2551 todo_wine
verify_reg_nonexist(hkey
, "Comment3");
2552 todo_wine
verify_reg_nonexist(hkey
, "Comment4");
2553 todo_wine
verify_reg_nonexist(hkey
, "Wine18");
2554 todo_wine
verify_reg_nonexist(hkey
, "Comment5");
2555 todo_wine
verify_reg(hkey
, "Wine19", REG_SZ
, "Value 7", 8, TODO_REG_SIZE
|TODO_REG_DATA
);
2556 todo_wine
verify_reg_nonexist(hkey
, "Comment6");
2558 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2559 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2560 "\"Wine20\"=#\"Value 8\"\n"
2561 "\"Wine21\"=;\"Value 9\"\n"
2562 "\"Wine22\"=\"#comment1\"\n"
2563 "\"Wine23\"=\";comment2\"\n"
2564 "\"Wine24\"=\"Value#comment3\"\n"
2565 "\"Wine25\"=\"Value;comment4\"\n"
2566 "\"Wine26\"=\"Value #comment5\"\n"
2567 "\"Wine27\"=\"Value ;comment6\"\n"
2568 "\"Wine28\"=#dword:00000001\n"
2569 "\"Wine29\"=;dword:00000002\n"
2570 "\"Wine30\"=dword:00000003#comment\n"
2571 "\"Wine31\"=dword:00000004;comment\n\n", &r
);
2572 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2573 todo_wine
verify_reg_nonexist(hkey
, "Wine20");
2574 todo_wine
verify_reg_nonexist(hkey
, "Wine21");
2575 todo_wine
verify_reg(hkey
, "Wine22", REG_SZ
, "#comment1", 10, 0);
2576 todo_wine
verify_reg(hkey
, "Wine23", REG_SZ
, ";comment2", 10, 0);
2577 todo_wine
verify_reg(hkey
, "Wine24", REG_SZ
, "Value#comment3", 15, 0);
2578 todo_wine
verify_reg(hkey
, "Wine25", REG_SZ
, "Value;comment4", 15, 0);
2579 todo_wine
verify_reg(hkey
, "Wine26", REG_SZ
, "Value #comment5", 16, 0);
2580 todo_wine
verify_reg(hkey
, "Wine27", REG_SZ
, "Value ;comment6", 16, 0);
2581 todo_wine
verify_reg_nonexist(hkey
, "Wine28");
2582 todo_wine
verify_reg_nonexist(hkey
, "Wine29");
2583 todo_wine
verify_reg_nonexist(hkey
, "Wine30");
2585 todo_wine
verify_reg(hkey
, "Wine31", REG_DWORD
, &dword
, sizeof(dword
), 0);
2587 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2588 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2589 "\"Wine32a\"=dword:1\n"
2590 "\"Wine32b\"=dword:4444\n\n", &r
);
2591 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2593 todo_wine
verify_reg(hkey
, "Wine32a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2595 todo_wine
verify_reg(hkey
, "Wine32b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2597 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2598 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2599 "\"Wine33a\"=dword:\n"
2600 "\"Wine33b\"=dword:hello\n"
2601 "\"Wine33c\"=dword:123456789\n"
2602 "\"Wine33d\"=dword:012345678\n"
2603 "\"Wine33e\"=dword:000000001\n\n", &r
);
2604 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2605 todo_wine
verify_reg_nonexist(hkey
, "Wine33a");
2606 todo_wine
verify_reg_nonexist(hkey
, "Wine33b");
2607 todo_wine
verify_reg_nonexist(hkey
, "Wine33c");
2608 todo_wine
verify_reg_nonexist(hkey
, "Wine33d");
2609 todo_wine
verify_reg_nonexist(hkey
, "Wine33e");
2611 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2612 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2613 "\"Wine34a\"=dword:12345678abc\n"
2614 "\"Wine34b\"=dword:12345678 abc\n\n", &r
);
2615 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2616 todo_wine
verify_reg_nonexist(hkey
, "Wine34a");
2617 todo_wine
verify_reg_nonexist(hkey
, "Wine34b");
2619 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2620 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2621 "\"Wine35a\"=dword:0x123\n"
2622 "\"Wine35b\"=dword:123 456\n"
2623 "\"Wine35c\"=dword:1234 5678\n\n", &r
);
2624 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2625 todo_wine
verify_reg_nonexist(hkey
, "Wine35a");
2626 todo_wine
verify_reg_nonexist(hkey
, "Wine35b");
2627 todo_wine
verify_reg_nonexist(hkey
, "Wine35c");
2629 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2630 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2631 "\"Wine36a\"=dword:1234;5678\n"
2632 "\"Wine36b\"=dword:1234 ;5678\n"
2633 "\"Wine36c\"=dword:1234#5678\n"
2634 "\"Wine36d\"=dword:1234 #5678\n\n", &r
);
2635 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2637 todo_wine
verify_reg(hkey
, "Wine36a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2638 todo_wine
verify_reg(hkey
, "Wine36b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2639 todo_wine
verify_reg_nonexist(hkey
, "Wine36c");
2640 todo_wine
verify_reg_nonexist(hkey
, "Wine36d");
2642 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2643 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2644 "\"Wine37a\"=\"foo\"bar\"\n"
2645 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r
);
2646 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2647 todo_wine
verify_reg_nonexist(hkey
, "Wine37a");
2648 todo_wine
verify_reg_nonexist(hkey
, "Wine37b");
2650 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2651 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2652 "\"Empty string\"=\"\"\n"
2653 "\"\"=\"Default registry value\"\n\n", &r
);
2654 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2655 todo_wine
verify_reg(hkey
, "Empty string", REG_SZ
, "", 1, 0);
2656 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default registry value", 23, 0);
2658 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2659 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2661 "\"Test38b\"=\\\"\n"
2662 "\"Test38c\"=\\\"Value\\\"\n"
2663 "\"Test38d\"=\\\"Value\"\n\n", &r
);
2664 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2665 todo_wine
verify_reg_nonexist(hkey
, "Test38a");
2666 todo_wine
verify_reg_nonexist(hkey
, "Test38b");
2667 todo_wine
verify_reg_nonexist(hkey
, "Test38c");
2668 todo_wine
verify_reg_nonexist(hkey
, "Test38d");
2670 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2671 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2672 "\"Wine39a\"=\"Value1\" ;comment\n"
2673 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
2674 "\"Wine39c\"=\"Value3\" #comment\n"
2675 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r
);
2676 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2677 todo_wine
verify_reg(hkey
, "Wine39a", REG_SZ
, "Value1", 7, 0);
2678 todo_wine
verify_reg(hkey
, "Wine39b", REG_SZ
, "Value2", 7, 0);
2679 todo_wine
verify_reg_nonexist(hkey
, "Wine39c");
2680 todo_wine
verify_reg_nonexist(hkey
, "Wine39d");
2682 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2683 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2684 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r
);
2685 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2686 todo_wine
verify_reg_nonexist(hkey
, "TestNoBeginQuote");
2688 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2689 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2690 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r
);
2691 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2692 todo_wine
verify_reg_nonexist(hkey
, "TestNoEndQuote");
2694 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2695 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2696 "\"TestNoQuotes\"=Asdffdsa\n", &r
);
2697 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2698 todo_wine
verify_reg_nonexist(hkey
, "TestNoQuotes");
2700 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2701 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2702 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r
);
2703 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2704 todo_wine
verify_reg_nonexist(hkey
, "NameNoBeginQuote");
2706 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2707 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2708 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r
);
2709 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2710 todo_wine
verify_reg_nonexist(hkey
, "NameNoEndQuote");
2712 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2713 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2714 "NameNoQuotes=\"Asdffdsa\"\n", &r
);
2715 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2716 todo_wine
verify_reg_nonexist(hkey
, "NameNoQuotes");
2718 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2719 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2720 "\"MixedQuotes=Asdffdsa\"\n", &r
);
2721 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2722 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes");
2723 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes=Asdffdsa");
2725 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2726 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2727 "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n"
2728 "\"Wine40b\"=\"Value 1\"\n"
2729 "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n"
2730 "\"Wine40d\"=\"Value 2\"\n"
2731 "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n"
2732 "\"Wine40f\"=\"Value 3\"\n"
2733 "\"Wine40g\"=\"Value 4\"\n\n", &r
);
2734 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2735 todo_wine
verify_reg(hkey
, "Wine40a", REG_EXPAND_SZ
, "Line", 5, 0);
2736 todo_wine
verify_reg(hkey
, "Wine40b", REG_SZ
, "Value 1", 8, 0);
2737 todo_wine
verify_reg_nonexist(hkey
, "Wine40c");
2738 todo_wine
verify_reg(hkey
, "Wine40d", REG_SZ
, "Value 2", 8, 0);
2739 todo_wine
verify_reg_nonexist(hkey
, "Wine40e");
2740 todo_wine
verify_reg_nonexist(hkey
, "Wine40f");
2741 todo_wine
verify_reg(hkey
, "Wine40g", REG_SZ
, "Value 4", 8, 0);
2743 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2744 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2745 "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2746 " 63,00,6f,00,6e,00,\\;comment\n"
2747 " 63,00,61,00,74,00,\\;comment\n"
2748 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2749 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2750 todo_wine
verify_reg(hkey
, "Multi-Line1", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2752 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2753 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2754 "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2755 " 63,00,6f,00,6e,00,\\;comment\n"
2756 " 63,00,61,00,74,00,;comment\n"
2757 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2758 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2759 todo_wine
verify_reg(hkey
, "Multi-Line2", REG_MULTI_SZ
, "Line concat", 12, 0);
2761 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2762 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2763 "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
2764 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2765 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2766 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line3");
2768 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2769 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2770 "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
2771 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2772 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2773 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line4");
2775 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2776 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2777 "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
2778 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2779 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2780 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line5");
2782 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2783 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2784 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
2785 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2786 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2787 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line6");
2789 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2790 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2791 "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2792 " 65,00,20,00,\\;comment\n"
2793 " 63,00,6f,00,6e,00,\\;comment\n"
2794 " 63,00,61,00,74,00,\\;comment\n"
2795 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2796 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2797 todo_wine
verify_reg(hkey
, "Multi-Line7", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2799 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2800 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2801 "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n"
2802 " 65,00,20,00,\\;#comment\n"
2803 " 63,00,6f,00,6e,00,\\;#comment\n"
2804 " 63,00,61,00,74,00,\\;#comment\n"
2805 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2806 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2807 todo_wine
verify_reg(hkey
, "Multi-Line8", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2809 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2810 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2811 "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2812 " 65,00,20,00,\\;comment\n"
2813 " 63,00,6f,00,6e,00,\\;comment\n"
2814 " 63,00,61,00,74,00,\\#comment\n"
2815 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2816 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2817 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line9");
2819 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2820 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2821 "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2822 " 63,00,6f,00,6e,00,\\;comment\n"
2823 " 63,00,61,00,74,00,\\\n\n"
2824 " 65,00,6e,00,\\;comment\n\n"
2825 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2826 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2827 todo_wine
verify_reg(hkey
, "Multi-Line10", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2829 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2830 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2831 "\"Wine41a\"=dword:1234\\\n"
2833 "\"Wine41b\"=\"Test \\\n"
2835 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2836 todo_wine
verify_reg_nonexist(hkey
, "Wine41a");
2837 todo_wine
verify_reg_nonexist(hkey
, "Wine41b");
2839 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2840 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2841 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
2842 "\"single'quote\"=dword:00000008\n\n", &r
);
2843 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2844 todo_wine
verify_reg(hkey
, "double\"quote", REG_SZ
, "valid \"or\" not", 15, 0);
2846 todo_wine
verify_reg(hkey
, "single'quote", REG_DWORD
, &dword
, sizeof(dword
), 0);
2848 /* Test key name and value name concatenation */
2849 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2850 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\\n"
2852 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2853 todo_wine
verify_key_nonexist(hkey
, "Subkey1");
2855 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2856 "[HKEY_CURRENT_USER\\" KEY_BASE
"\n"
2857 "\\Subkey2]\n", &r
);
2858 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2859 todo_wine
verify_key_nonexist(hkey
, "Subkey2");
2861 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2862 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2864 "42a\"=\"Value 1\"\n"
2865 "\"Wine42b\"=\"Value 2\"\n"
2867 "\\42c\"=\"Value 3\"\n\n", &r
);
2868 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2869 todo_wine
verify_reg_nonexist(hkey
, "Wine42a");
2870 todo_wine
verify_reg(hkey
, "Wine42b", REG_SZ
, "Value 2", 8, 0);
2871 todo_wine
verify_reg_nonexist(hkey
, "Wine42c");
2873 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
2874 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2875 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2876 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
2877 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
2878 " 75,00,65,00,00,00\n"
2879 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
2880 ",75,00,65,00,00,00\n"
2881 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
2882 " ,75,00,65,00,00,00\n"
2883 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
2884 " 75,00,65,00,00,00\n"
2885 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
2886 "5,00,65,00,00,00\n"
2887 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
2888 " 5,00,65,00,00,00\n"
2889 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
2892 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
2895 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
2896 " 6c,00,75,00,;comment\n"
2898 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
2899 " 6c,00,75,00,\\#comment\n"
2900 " 65,00,00,00\n\n", &r
);
2901 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2902 todo_wine
verify_reg(hkey
, "Wine43a", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2903 todo_wine
verify_reg(hkey
, "Wine43b", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2904 todo_wine
verify_reg_nonexist(hkey
, "Wine43c");
2905 todo_wine
verify_reg_nonexist(hkey
, "Wine43d");
2906 todo_wine
verify_reg_nonexist(hkey
, "Wine43e");
2907 todo_wine
verify_reg_nonexist(hkey
, "Wine43f");
2908 todo_wine
verify_reg_nonexist(hkey
, "Wine43g");
2909 todo_wine
verify_reg(hkey
, "Wine43h", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2910 todo_wine
verify_reg(hkey
, "Wine43i", REG_NONE
, "V\0a\0l\0u", 8, 0);
2911 todo_wine
verify_reg(hkey
, "Wine43j", REG_NONE
, "V\0a\0l\0u", 8, 0);
2912 todo_wine
verify_reg_nonexist(hkey
, "Wine43k");
2914 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2915 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2916 "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2917 "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n"
2918 " 54,00,48,00,25,00,00,00\n"
2919 "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n"
2920 ",54,00,48,00,25,00,00,00\n"
2921 "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n"
2922 " ,54,00,48,00,25,00,00,00\n"
2923 "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n"
2924 " 54,00,48,00,25,00,00,00\n"
2925 "\"Wine44f\"=hex(2):25,00,50,00,4\\\n"
2926 "1,00,54,00,48,00,25,00,00,00\n"
2927 "\"Wine44g\"=hex(2):25,00,50,00,4\\\n"
2928 " 1,00,54,00,48,00,25,00,00,00\n"
2929 "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2932 "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2935 "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2936 " 54,00,48,00;comment\n"
2938 "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2939 " 54,00,48,00,\\#comment\n"
2940 " 25,00,00,00\n\n", &r
);
2941 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2942 todo_wine
verify_reg(hkey
, "Wine44a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2943 todo_wine
verify_reg(hkey
, "Wine44b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2944 todo_wine
verify_reg_nonexist(hkey
, "Wine44c");
2945 todo_wine
verify_reg_nonexist(hkey
, "Wine44d");
2946 todo_wine
verify_reg_nonexist(hkey
, "Wine44e");
2947 todo_wine
verify_reg_nonexist(hkey
, "Wine44f");
2948 todo_wine
verify_reg_nonexist(hkey
, "Wine44g");
2949 todo_wine
verify_reg(hkey
, "Wine44h", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2951 size
= sizeof(buffer
);
2952 err
= RegQueryValueExA(hkey
, "Wine44i", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2953 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2954 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2955 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2956 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2958 size
= sizeof(buffer
);
2959 memset(buffer
, '-', size
);
2960 err
= RegQueryValueExA(hkey
, "Wine44j", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2961 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2962 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2963 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2964 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2966 todo_wine
verify_reg_nonexist(hkey
, "Wine44k");
2968 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2969 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2970 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
2971 "\"Wine45b\"=hex:11,22,33,44,\\\n"
2973 "\"Wine45c\"=hex:11,22,33,44\\\n"
2975 "\"Wine45d\"=hex:11,22,33,44\\\n"
2977 "\"Wine45e\"=hex:11,22,33,44\\\n"
2979 "\"Wine45f\"=hex:11,22,33,4\\\n"
2981 "\"Wine45g\"=hex:11,22,33,4\\\n"
2983 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
2986 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
2989 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
2992 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
2993 " 44,55,66,\\#comment\n"
2995 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2996 hex
[0] = 0x11; hex
[1] = 0x22; hex
[2] = 0x33; hex
[3] = 0x44;
2997 hex
[4] = 0x55; hex
[5] = 0x66; hex
[6] = 0x77; hex
[7] = 0x88;
2998 todo_wine
verify_reg(hkey
, "Wine45a", REG_BINARY
, hex
, sizeof(hex
), 0);
2999 todo_wine
verify_reg(hkey
, "Wine45b", REG_BINARY
, hex
, sizeof(hex
), 0);
3000 todo_wine
verify_reg_nonexist(hkey
, "Wine45c");
3001 todo_wine
verify_reg_nonexist(hkey
, "Wine45d");
3002 todo_wine
verify_reg_nonexist(hkey
, "Wine45e");
3003 todo_wine
verify_reg_nonexist(hkey
, "Wine45f");
3004 todo_wine
verify_reg_nonexist(hkey
, "Wine45g");
3005 todo_wine
verify_reg(hkey
, "Wine45h", REG_BINARY
, hex
, sizeof(hex
), 0);
3006 todo_wine
verify_reg(hkey
, "Wine45i", REG_BINARY
, hex
, 6, 0);
3007 todo_wine
verify_reg(hkey
, "Wine45j", REG_BINARY
, hex
, 6, 0);
3008 todo_wine
verify_reg_nonexist(hkey
, "Wine45k");
3010 /* Test import with subkeys */
3011 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3012 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey\"1]\n"
3013 "\"Wine\\\\31\"=\"Test value\"\n\n", &r
);
3014 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3015 err
= RegOpenKeyExA(hkey
, "Subkey\"1", 0, KEY_READ
, &subkey
);
3016 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3017 todo_wine
verify_reg(subkey
, "Wine\\31", REG_SZ
, "Test value", 11, 0);
3018 err
= RegCloseKey(subkey
);
3019 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3020 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey\"1");
3021 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3023 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3024 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey/2]\n"
3025 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r
);
3026 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3027 err
= RegOpenKeyExA(hkey
, "Subkey/2", 0, KEY_READ
, &subkey
);
3028 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3029 todo_wine
verify_reg(subkey
, "123/\"4;'5", REG_SZ
, "Random value name", 18, 0);
3030 err
= RegCloseKey(subkey
);
3031 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3032 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey/2");
3033 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3035 /* Test key creation */
3036 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3037 "HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Opening_Bracket]\n", &r
);
3038 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3039 todo_wine
verify_key_nonexist(hkey
, "No_Opening_Bracket");
3041 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3042 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Closing_Bracket\n", &r
);
3043 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3044 todo_wine
verify_key_nonexist(hkey
, "No_Closing_Bracket");
3046 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3047 "[ HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1a]\n", &r
);
3048 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3049 todo_wine
verify_key_nonexist(hkey
, "Subkey1a");
3051 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3052 "[\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1b]\n", &r
);
3053 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3054 todo_wine
verify_key_nonexist(hkey
, "Subkey1b");
3056 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3057 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1c ]\n", &r
);
3058 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3059 todo_wine
verify_key(hkey
, "Subkey1c ");
3060 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1c ");
3061 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3063 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3064 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1d\t]\n", &r
);
3065 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3066 todo_wine
verify_key(hkey
, "Subkey1d\t");
3067 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1d\t");
3068 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3070 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3071 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1e\\]\n"
3072 "\"Wine\"=\"Test value\"\n\n", &r
);
3073 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3074 todo_wine
verify_key(hkey
, "Subkey1e\\");
3075 todo_wine
verify_key(hkey
, "Subkey1e");
3076 err
= RegOpenKeyExA(hkey
, "Subkey1e", 0, KEY_READ
, &subkey
);
3077 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %u, expected 0\n", err
);
3078 todo_wine
verify_reg(subkey
, "Wine", REG_SZ
, "Test value", 11, 0);
3079 RegCloseKey(subkey
);
3080 err
= RegDeleteKeyA(hkey
, "Subkey1e");
3081 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %u, expected 0\n", err
);
3083 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3084 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1f\\\\]\n"
3085 "\"Wine\"=\"Test value\"\n\n", &r
);
3086 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3087 todo_wine
verify_key(hkey
, "Subkey1f\\\\");
3088 todo_wine
verify_key(hkey
, "Subkey1f\\");
3089 todo_wine
verify_key(hkey
, "Subkey1f");
3090 err
= RegOpenKeyExA(hkey
, "Subkey1f\\\\", 0, KEY_READ
, &subkey
);
3091 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %u, expected 0\n", err
);
3092 todo_wine
verify_reg(subkey
, "Wine", REG_SZ
, "Test value", 11, 0);
3093 RegCloseKey(subkey
);
3094 err
= RegDeleteKeyA(hkey
, "Subkey1f\\\\");
3095 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %u, expected 0\n", err
);
3097 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3098 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1g\\\\\\\\]\n"
3099 "\"Wine\"=\"Test value\"\n\n", &r
);
3100 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3101 todo_wine
verify_key(hkey
, "Subkey1g\\\\\\\\");
3102 todo_wine
verify_key(hkey
, "Subkey1g\\\\");
3103 todo_wine
verify_key(hkey
, "Subkey1g\\");
3104 todo_wine
verify_key(hkey
, "Subkey1g");
3105 err
= RegOpenKeyExA(hkey
, "Subkey1g\\\\", 0, KEY_READ
, &subkey
);
3106 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %u, expected 0\n", err
);
3107 todo_wine
verify_reg(subkey
, "Wine", REG_SZ
, "Test value", 11, 0);
3108 RegCloseKey(subkey
);
3109 err
= RegDeleteKeyA(hkey
, "Subkey1g\\\\");
3110 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %u, expected 0\n", err
);
3112 /* Test key deletion. We start by creating some registry keys. */
3113 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3114 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
3115 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
3116 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3117 todo_wine
verify_key(hkey
, "Subkey2a");
3118 todo_wine
verify_key(hkey
, "Subkey2b");
3120 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3121 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
3122 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3123 todo_wine
verify_key(hkey
, "Subkey2a");
3125 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3126 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
3127 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3128 todo_wine
verify_key(hkey
, "Subkey2b");
3130 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3131 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
3132 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3133 todo_wine
verify_key(hkey
, "Subkey2a");
3135 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3136 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
3137 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3138 todo_wine
verify_key(hkey
, "Subkey2b");
3140 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3141 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
3142 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
3143 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3144 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
3145 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
3147 /* Test case sensitivity when creating and deleting registry keys. */
3148 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3149 "[hkey_CURRENT_user\\" KEY_BASE
"\\Subkey3a]\n\n"
3150 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE
"\\SuBkEy3b]\n\n", &r
);
3151 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3152 todo_wine
verify_key(hkey
, "Subkey3a");
3153 todo_wine
verify_key(hkey
, "Subkey3b");
3155 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3156 "[-HKEY_current_USER\\" KEY_BASE
"\\sUBKEY3A]\n\n"
3157 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE
"\\sUbKeY3B]\n\n", &r
);
3158 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3159 todo_wine
verify_key_nonexist(hkey
, "Subkey3a");
3160 todo_wine
verify_key_nonexist(hkey
, "Subkey3b");
3162 /* Test value deletion. We start by creating some registry values. */
3163 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3164 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3165 "\"Wine46a\"=\"Test Value\"\n"
3166 "\"Wine46b\"=dword:00000008\n"
3167 "\"Wine46c\"=hex:11,22,33,44\n"
3168 "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3169 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3170 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3171 "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3172 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
3173 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3174 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
3175 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3176 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
3177 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3178 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3179 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
3181 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3182 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3185 "\"Wine46c\"= \t-\t \n"
3186 "\"Wine46d\"=-\"Test\"\n"
3187 "\"Wine46e\"=- ;comment\n"
3188 "\"Wine46f\"=- #comment\n\n", &r
);
3189 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3190 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
3191 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
3192 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
3193 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3194 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
3195 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
3197 /* Test the accepted range of the hex-based data types */
3198 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3199 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3200 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
3201 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
3202 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
3203 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
3204 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
3205 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
3206 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
3207 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
3208 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n"
3209 "\"Wine47j\"=hex(0x2):56,00,61,00,6c,00,75,00,65,00,00,00\n"
3210 "\"Wine47k\"=hex(0X2):56,00,61,00,6c,00,75,00,65,00,00,00\n"
3211 "\"Wine47l\"=hex(x2):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
3212 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3213 todo_wine
verify_reg(hkey
, "Wine47a", REG_NONE
, "Value", 6, 0);
3214 todo_wine
verify_reg(hkey
, "Wine47b", 0x10, "Value", 6, 0);
3215 todo_wine
verify_reg(hkey
, "Wine47c", 0x100, "Value", 6, 0);
3216 todo_wine
verify_reg(hkey
, "Wine47d", 0x1000, "Value", 6, 0);
3217 todo_wine
verify_reg(hkey
, "Wine47e", 0x7fff, "Value", 6, 0);
3218 todo_wine
verify_reg(hkey
, "Wine47f", 0xffff, "Value", 6, 0);
3219 todo_wine
verify_reg(hkey
, "Wine47g", 0x7fffffff, "Value", 6, 0);
3220 todo_wine
verify_reg(hkey
, "Wine47h", 0xffffffff, "Value", 6, 0);
3221 todo_wine
verify_reg_nonexist(hkey
, "Wine47i");
3222 todo_wine
verify_reg_nonexist(hkey
, "Wine47j");
3223 todo_wine
verify_reg_nonexist(hkey
, "Wine47k");
3224 todo_wine
verify_reg_nonexist(hkey
, "Wine47l");
3226 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3227 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3228 "\"Wine48a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00, \\\n"
3229 " 63,00,6f,00,6e,00,63,00,61,00,74,00, \\\n"
3230 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3231 "\"Wine48b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\t\\\n"
3232 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\t \t \\\n"
3233 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3234 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3235 todo_wine
verify_reg(hkey
, "Wine48a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3236 todo_wine
verify_reg(hkey
, "Wine48b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3238 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3239 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3240 "\"Wine49\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r
);
3241 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3242 todo_wine
verify_reg(hkey
, "Wine49", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3244 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3245 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3246 "\"Wine50a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 ;comment\n"
3247 "\"Wine50b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t;comment\n"
3248 "\"Wine50c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 #comment\n"
3249 "\"Wine50d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t#comment\n\n", &r
);
3250 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3251 todo_wine
verify_reg(hkey
, "Wine50a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3252 todo_wine
verify_reg(hkey
, "Wine50b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3253 todo_wine
verify_reg_nonexist(hkey
, "Wine50c");
3254 todo_wine
verify_reg_nonexist(hkey
, "Wine50d");
3256 /* Test support for characters greater than 0xff */
3257 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3258 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3259 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
3260 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r
);
3261 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3262 todo_wine
verify_reg_nonexist(hkey
, "Wine51a");
3263 todo_wine
verify_reg_nonexist(hkey
, "Wine51b");
3265 /* Test the effect of backslashes in hex data */
3266 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3267 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3268 "\"Wine52a\"=hex(2):25,00,48\\,00,4f,00,4d,00,45,00,25,00,00,00\n"
3269 "\"Wine52b\"=hex(2):25,00,48,00,\\4f,00,4d,00,45,00,25,00,00,00\n"
3270 "\"Wine52c\"=hex(2):25,00,48\\ ,00,4f,00,4d,00,45,00,25,00,00,00\n"
3271 "\"Wine52d\"=hex(2):25,00,48,00,\\ 4f,00,4d,00,45,00,25,00,00,00\n"
3272 "\"Wine52e\"=hex(2):\\25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
3273 "\"Wine52f\"=hex(2):\\ 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
3274 "\"Wine52g\"=hex(2):25,00,48,00,4\\f,00,4d,00,45,00,25,00,00,00\n"
3275 "\"Wine52h\"=hex(2):25,00,48,00,4\\\n"
3276 " f,00,4d,00,45,00,25,00,00,00\n"
3277 "\"Wine52i\"=hex(2):25,00,50,00,\\,41,00,54,00,48,00,25,00,00,00\n"
3278 "\"Wine52j\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\\\n"
3279 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3280 "\"Wine52k\"=hex(2):,\\\n"
3281 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
3282 "\"Wine52l\"=hex(2):\\\n"
3283 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n\n", &r
);
3284 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3285 todo_wine
verify_reg_nonexist(hkey
, "Wine52a");
3286 todo_wine
verify_reg_nonexist(hkey
, "Wine52b");
3287 todo_wine
verify_reg_nonexist(hkey
, "Wine52c");
3288 todo_wine
verify_reg_nonexist(hkey
, "Wine52d");
3289 todo_wine
verify_reg_nonexist(hkey
, "Wine52e");
3290 todo_wine
verify_reg_nonexist(hkey
, "Wine52f");
3291 todo_wine
verify_reg_nonexist(hkey
, "Wine52g");
3292 todo_wine
verify_reg_nonexist(hkey
, "Wine52h");
3293 todo_wine
verify_reg_nonexist(hkey
, "Wine52i");
3294 todo_wine
verify_reg_nonexist(hkey
, "Wine52j");
3295 todo_wine
verify_reg_nonexist(hkey
, "Wine52k");
3296 todo_wine
verify_reg(hkey
, "Wine52l", REG_EXPAND_SZ
, "%HOME%", 7, 0);
3298 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3299 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3300 "\"Wine53a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
3301 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3302 "\"Wine53b\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n"
3303 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3304 "\"Wine53c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00, \\ ;comment\n"
3305 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3306 "\"Wine53d\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00 \\ ;comment\n"
3307 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3308 "\"Wine53e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\t ;comment\n"
3309 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3310 "\"Wine53f\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\t ;comment\n"
3311 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r
);
3312 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3313 todo_wine
verify_reg(hkey
, "Wine53a", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
3314 todo_wine
verify_reg_nonexist(hkey
, "Wine53b");
3315 todo_wine
verify_reg(hkey
, "Wine53c", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
3316 todo_wine
verify_reg_nonexist(hkey
, "Wine53d");
3317 todo_wine
verify_reg(hkey
, "Wine53e", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
3318 todo_wine
verify_reg_nonexist(hkey
, "Wine53f");
3320 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3321 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3322 "\"Wine54a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3323 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1]\n", &r
);
3324 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3325 todo_wine
verify_reg_nonexist(hkey
, "Wine54a");
3326 todo_wine
verify_key_nonexist(hkey
, "Subkey1");
3328 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3329 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3330 "\"Wine54b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
3331 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2]\n", &r
);
3332 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3333 todo_wine
verify_reg_nonexist(hkey
, "Wine54b");
3334 todo_wine
verify_key(hkey
, "Subkey2");
3336 err
= RegDeleteKeyA(hkey
, "Subkey2");
3337 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKey failed: %u\n", err
);
3339 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3340 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3341 "\"Wine55a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3342 "\"Wine55b\"=\"Test value\"\n"
3344 "\"Wine55c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3346 "\"Wine55d\"=\"Test value\"\n"
3348 "\"Wine55e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3350 "\"Wine55f\"=\"Test value\"\n"
3352 "\"Wine55g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
3353 "\"Wine55h\"=\"Test value\"\n"
3355 "\"Wine55i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
3356 "\"Wine55j\"=\"Test value\"\n\n", &r
);
3357 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3358 todo_wine
verify_reg_nonexist(hkey
, "Wine55a");
3359 todo_wine
verify_reg_nonexist(hkey
, "Wine55b");
3360 todo_wine
verify_reg_nonexist(hkey
, "Wine55c");
3361 todo_wine
verify_reg_nonexist(hkey
, "Wine55d");
3362 todo_wine
verify_reg_nonexist(hkey
, "Wine55e");
3363 todo_wine
verify_reg(hkey
, "Wine55f", REG_SZ
, "Test value", 11, 0);
3364 todo_wine
verify_reg_nonexist(hkey
, "Wine55g");
3365 todo_wine
verify_reg_nonexist(hkey
, "Wine55h");
3366 todo_wine
verify_reg_nonexist(hkey
, "Wine55i");
3367 todo_wine
verify_reg(hkey
, "Wine55j", REG_SZ
, "Test value", 11, 0);
3369 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3370 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3371 "\"Wine56a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3372 "\"Wine56b\"=dword:00000008\n"
3374 "\"Wine56c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3376 "\"Wine56d\"=dword:00000008\n"
3378 "\"Wine56e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3380 "\"Wine56f\"=dword:00000008\n"
3382 "\"Wine56g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
3383 "\"Wine56h\"=dword:00000008\n"
3385 "\"Wine56i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
3386 "\"Wine56j\"=dword:00000008\n\n", &r
);
3387 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3388 todo_wine
verify_reg_nonexist(hkey
, "Wine56a");
3389 todo_wine
verify_reg_nonexist(hkey
, "Wine56b");
3390 todo_wine
verify_reg_nonexist(hkey
, "Wine56c");
3391 todo_wine
verify_reg_nonexist(hkey
, "Wine56d");
3392 todo_wine
verify_reg_nonexist(hkey
, "Wine56e");
3393 todo_wine
verify_reg(hkey
, "Wine56f", REG_DWORD
, &dword
, sizeof(dword
), 0);
3394 todo_wine
verify_reg_nonexist(hkey
, "Wine56g");
3395 todo_wine
verify_reg_nonexist(hkey
, "Wine56h");
3396 todo_wine
verify_reg_nonexist(hkey
, "Wine56i");
3397 todo_wine
verify_reg(hkey
, "Wine56j", REG_DWORD
, &dword
, sizeof(dword
), 0);
3399 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3400 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3401 "\"Wine57a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
3402 "\"Wine57b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3404 "\"Wine57c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
3406 "\"Wine57d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3408 "\"Wine57e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
3410 "\"Wine57f\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3412 "\"Wine57g\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n\n"
3413 "\"Wine57h\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3415 "\"Wine57i\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n"
3416 "\"Wine57j\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r
);
3417 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3418 todo_wine
verify_reg_nonexist(hkey
, "Wine57a");
3419 todo_wine
verify_reg_nonexist(hkey
, "Wine57b");
3420 todo_wine
verify_reg_nonexist(hkey
, "Wine57c");
3421 todo_wine
verify_reg_nonexist(hkey
, "Wine57d");
3422 todo_wine
verify_reg_nonexist(hkey
, "Wine57e");
3423 todo_wine
verify_reg(hkey
, "Wine57f", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3424 todo_wine
verify_reg_nonexist(hkey
, "Wine57g");
3425 todo_wine
verify_reg_nonexist(hkey
, "Wine57h");
3426 todo_wine
verify_reg_nonexist(hkey
, "Wine57i");
3427 todo_wine
verify_reg(hkey
, "Wine57j", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3429 err
= RegDeleteValueW(hkey
, NULL
);
3430 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteValue failed: %u\n", err
);
3432 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3433 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3434 "\"Wine58a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3435 "@=\"Default value 1\"\n\n", &r
);
3436 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3437 todo_wine
verify_reg_nonexist(hkey
, "Wine58a");
3438 todo_wine
verify_reg_nonexist(hkey
, NULL
);
3440 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3441 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3442 "\"Wine58b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3444 "@=\"Default value 2\"\n\n", &r
);
3445 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3446 todo_wine
verify_reg_nonexist(hkey
, "Wine58b");
3447 todo_wine
verify_reg_nonexist(hkey
, NULL
);
3449 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3450 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3451 "\"Wine58c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3453 "@=\"Default value 3\"\n\n", &r
);
3454 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3455 todo_wine
verify_reg_nonexist(hkey
, "Wine58c");
3456 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default value 3", 16, 0);
3458 err
= RegDeleteValueW(hkey
, NULL
);
3459 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteValue failed: %u\n", err
);
3461 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3462 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3463 "\"Wine58d\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n"
3464 "@=\"Default value 4\"\n\n", &r
);
3465 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3466 todo_wine
verify_reg_nonexist(hkey
, "Wine58d");
3467 todo_wine
verify_reg_nonexist(hkey
, NULL
);
3469 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3470 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3471 "\"Wine58e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
3472 "@=\"Default value 5\"\n\n", &r
);
3473 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3474 todo_wine
verify_reg_nonexist(hkey
, "Wine58e");
3475 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default value 5", 16, 0);
3477 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3478 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3479 "\"Wine59a\"=hex:11,22,33,\\\n"
3482 "\"Wine59b\"=hex:11,22,33,\\\n"
3484 " 44,55,66\n\n", &r
);
3485 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3486 todo_wine
verify_reg_nonexist(hkey
, "Wine59a");
3487 todo_wine
verify_reg_nonexist(hkey
, "Wine59b");
3489 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3490 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3491 "\"Wine60a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3492 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3494 " 65,00,6e,00,\\;comment\n"
3495 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3496 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3497 todo_wine
verify_reg(hkey
, "Wine60a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3499 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3500 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3501 "\"Wine60b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3502 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3504 " 65,00,6e,00,\\;comment\n"
3505 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3506 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3507 todo_wine
verify_reg(hkey
, "Wine60b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3509 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3510 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3511 "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n"
3512 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3514 " 65,00,6e,00,\\;comment\n"
3515 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3516 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3517 todo_wine
verify_reg_nonexist(hkey
, "Wine60c");
3519 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3520 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3521 "\"Wine60d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3522 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3524 " 65,00,6e,00,\\;comment\n"
3525 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3526 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3527 todo_wine
verify_reg_nonexist(hkey
, "Wine60d");
3529 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3530 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3531 "\"Wine60e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3532 " 63,00,6f,00,6e,00,\\\n\n"
3533 " 63,00,61,00,74,00,\\\n\n\n"
3534 " 65,00,6e,00,\\\n\n\n\n"
3535 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3536 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3537 todo_wine
verify_reg(hkey
, "Wine60e", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3539 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3540 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3541 "\"Wine60f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3542 " 63,00,6f,00,6e,00,\\\n \n"
3543 " 63,00,61,00,74,00,\\\n\t\n\t\n"
3544 " 65,00,6e,00,\\\n\t \t\n\t \t\n\t \t\n"
3545 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3546 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3547 todo_wine
verify_reg(hkey
, "Wine60f", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3549 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3550 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3551 "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n"
3552 " 25,50,41,54,48,25,00\n"
3553 "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n"
3554 " 25,50,41,54,48,25,00\n\n", &r
);
3555 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3556 todo_wine
verify_reg_nonexist(hkey
, "Wine61a");
3557 todo_wine
verify_reg_nonexist(hkey
, "Wine61b");
3559 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3560 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3561 "\"Wine62a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\", &r
);
3562 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3563 err
= RegQueryValueExA(hkey
, "Wine62a", NULL
, NULL
, NULL
, NULL
);
3564 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
) /* WinXP */,
3565 "got %u, expected 0\n", err
);
3566 if (err
== ERROR_SUCCESS
)
3567 todo_wine
verify_reg(hkey
, "Wine62a", REG_MULTI_SZ
, "Line ", 6, 0);
3569 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3570 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3571 "\"Wine62b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00\\", &r
);
3572 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3573 todo_wine
verify_reg_nonexist(hkey
, "Wine62b");
3575 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3576 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3577 "\"Wine63a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3578 " ,63,00,6f,00,6e,00,\\\n"
3579 " 63,00,61,00,74,00,\\\n"
3581 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3582 "\"Wine63b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3583 " 63,,00,6f,00,6e,00,\\\n"
3584 " 63,00,61,00,74,00,\\\n"
3586 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3587 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3588 todo_wine
verify_reg_nonexist(hkey
, "Wine63a");
3589 todo_wine
verify_reg_nonexist(hkey
, "Wine63b");
3591 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3592 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3593 "\"Wine64a\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n"
3594 "\"Wine64b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3595 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3596 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3597 "\"Wine64c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n"
3598 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
3599 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3600 "\"Wine64d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n"
3601 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\n"
3602 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
3603 "\"Wine64e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3604 " 63,00,6f,00,6e,00,63,00,61,00,74,00,;comment\n"
3605 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3606 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3607 todo_wine
verify_reg(hkey
, "Wine64a", REG_MULTI_SZ
, "Line\0", 6, 0);
3608 todo_wine
verify_reg(hkey
, "Wine64b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3609 todo_wine
verify_reg(hkey
, "Wine64c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3611 size
= sizeof(buffer
);
3612 err
= RegQueryValueExA(hkey
, "Wine64d", NULL
, &type
, (BYTE
*)&buffer
, &size
);
3613 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
3614 todo_wine
ok(type
== REG_MULTI_SZ
, "got wrong type %u, expected %u\n", type
, REG_MULTI_SZ
);
3615 todo_wine
ok(size
== 12 || broken(size
== 11) /* WinXP */, "got wrong size %u, expected 12\n", size
);
3616 todo_wine
ok(memcmp(buffer
, "Line concat", size
) == 0, "got wrong data\n");
3618 size
= sizeof(buffer
);
3619 err
= RegQueryValueExA(hkey
, "Wine64e", NULL
, &type
, (BYTE
*)&buffer
, &size
);
3620 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
3621 todo_wine
ok(type
== REG_MULTI_SZ
, "got wrong type %u, expected %u\n", type
, REG_MULTI_SZ
);
3622 todo_wine
ok(size
== 12 || broken(size
== 11) /* WinXP */, "got wrong size %u, expected 12\n", size
);
3623 todo_wine
ok(memcmp(buffer
, "Line concat", size
) == 0, "got wrong data\n");
3625 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3626 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3627 "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n"
3628 "\"Wine65b\"=hex(100):25,50,41,\\\n"
3630 "\"Wine65c\"=hex(100):25,50,41,\\;comment\n"
3633 "\"Wine65d\"=hex(100):25,50,41,\\;comment\n"
3636 "\"Wine65e\"=hex(100):25,50,41,\\;comment\n"
3639 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3640 todo_wine
verify_reg(hkey
, "Wine65a", 0x100, "%PATH%", 7, 0);
3641 todo_wine
verify_reg(hkey
, "Wine65b", 0x100, "%PATH%", 7, 0);
3642 todo_wine
verify_reg(hkey
, "Wine65c", 0x100, "%PATH%", 7, 0);
3643 todo_wine
verify_reg(hkey
, "Wine65d", 0x100, "%PATH", 5, 0);
3644 todo_wine
verify_reg(hkey
, "Wine65e", 0x100, "%PATH", 5, 0);
3646 /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/
3647 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3648 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3649 "\"Wine66a\"=hex(7):4c,00,69,00,6e,00,65,00\n"
3650 "\"Wine66b\"=hex(7):4c,00,69,00,6e,00,65,00,\n"
3651 "\"Wine66c\"=hex(7):4c,00,69,00,6e,00,65,00,00,00\n"
3652 "\"Wine66d\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,\n"
3653 "\"Wine66e\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n"
3654 "\"Wine66f\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00,\n\n", &r
);
3655 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3656 todo_wine
verify_reg(hkey
, "Wine66a", REG_MULTI_SZ
, "Line", 5, 0);
3657 todo_wine
verify_reg(hkey
, "Wine66b", REG_MULTI_SZ
, "Line", 5, 0);
3658 todo_wine
verify_reg(hkey
, "Wine66c", REG_MULTI_SZ
, "Line", 5, 0);
3659 todo_wine
verify_reg(hkey
, "Wine66d", REG_MULTI_SZ
, "Line", 5, 0);
3660 todo_wine
verify_reg(hkey
, "Wine66e", REG_MULTI_SZ
, "Line\0", 6, 0);
3661 todo_wine
verify_reg(hkey
, "Wine66f", REG_MULTI_SZ
, "Line\0", 6, 0);
3663 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3664 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3665 "\"Wine67a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00\n"
3666 "\"Wine67b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\n"
3667 "\"Wine67c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
3668 "\"Wine67d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r
);
3669 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3670 todo_wine
verify_reg(hkey
, "Wine67a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3671 todo_wine
verify_reg(hkey
, "Wine67b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3672 todo_wine
verify_reg(hkey
, "Wine67c", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3673 todo_wine
verify_reg(hkey
, "Wine67d", REG_EXPAND_SZ
, "%PATH%", 7, 0);
3675 err
= RegCloseKey(hkey
);
3676 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3678 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
3679 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
3682 static void test_import_with_whitespace(void)
3688 test_import_str(" REGEDIT4\n\n"
3689 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
3690 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3692 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
3693 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
3695 test_import_str(" REGEDIT4\n\n"
3696 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3697 "\"Wine1a\"=\"Value\"\n\n", &r
);
3698 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3699 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
3701 test_import_str("\tREGEDIT4\n\n"
3702 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3703 "\"Wine1b\"=\"Value\"\n\n", &r
);
3704 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3705 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
3707 test_import_str(" \t REGEDIT4\n\n"
3708 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3709 "\"Wine1c\"=\"Value\"\n\n", &r
);
3710 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3711 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
3713 test_import_str("REGEDIT4\n\n"
3714 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3715 "\"Wine2a\"=\"Value\"\n\n", &r
);
3716 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3717 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
3719 test_import_str("REGEDIT4\n\n"
3720 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3721 "\"Wine2b\"=\"Value\"\n\n", &r
);
3722 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3723 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
3725 test_import_str("REGEDIT4\n\n"
3726 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3727 "\"Wine2c\"=\"Value\"\n\n", &r
);
3728 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3729 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
3731 test_import_str("REGEDIT4\n\n"
3732 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3733 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
3734 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3735 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
3737 test_import_str("REGEDIT4\n\n"
3738 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3739 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
3740 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3741 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
3743 test_import_str("REGEDIT4\n\n"
3744 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3745 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
3746 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3747 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
3749 test_import_str(" REGEDIT4\n\n"
3750 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3751 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
3752 " \"Wine4b\"=dword:00112233\n"
3753 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n"
3754 " 63,6f,6e,\\;comment\n"
3755 "\t\t\t\t63,61,74,\\;comment\n"
3756 " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
3757 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3758 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
3760 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3761 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3763 test_import_str(" REGEDIT4\n\n"
3764 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3765 " \"Wine5a\"=\"Leading spaces\"\n"
3766 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
3767 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
3768 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
3769 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3770 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
3771 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
3772 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
3773 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
3775 test_import_str("REGEDIT4\n\n"
3776 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3777 "\" Wine6a\"=\"Leading spaces\"\n"
3778 "\"\t\tWine6b\"=\"Leading tabs\"\n"
3779 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
3780 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3781 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
3782 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
3783 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
3785 test_import_str("REGEDIT4\n\n"
3786 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3787 "\"Wine7a\"=\" Four spaces in the data\"\n"
3788 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
3789 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3790 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
3791 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
3793 test_import_str("REGEDIT4\n\n"
3794 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3795 "\"Wine8a\"=\"Trailing spaces\" \n"
3796 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
3797 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3798 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
3799 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
3801 test_import_str("REGEDIT4\n\n"
3802 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3803 "\"Wine9a\"=dword: 00000008\n"
3804 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
3805 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3807 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
3808 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3810 test_import_str("REGEDIT4\n\n"
3811 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3812 "@ = \"Test Value\"\n\n", &r
);
3813 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3814 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
3816 test_import_str("REGEDIT4\n\n"
3817 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3818 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
3819 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3820 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
3822 err
= RegCloseKey(hkey
);
3823 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
3825 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
3826 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
3829 static void test_unicode_import_with_whitespace(void)
3835 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3836 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
3837 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3839 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
3840 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
3842 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3843 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3844 "\"Wine1a\"=\"Value\"\n\n", &r
);
3845 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3846 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
3848 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n"
3849 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3850 "\"Wine1b\"=\"Value\"\n\n", &r
);
3851 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3852 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
3854 test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n"
3855 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3856 "\"Wine1c\"=\"Value\"\n\n", &r
);
3857 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3858 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
3860 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3861 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3862 "\"Wine2a\"=\"Value\"\n\n", &r
);
3863 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3864 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
3866 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3867 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3868 "\"Wine2b\"=\"Value\"\n\n", &r
);
3869 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3870 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
3872 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3873 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3874 "\"Wine2c\"=\"Value\"\n\n", &r
);
3875 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3876 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
3878 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3879 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3880 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
3881 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3882 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
3884 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3885 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3886 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
3887 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3888 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
3890 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3891 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3892 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
3893 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3894 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
3896 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3897 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3898 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
3899 " \"Wine4b\"=dword:00112233\n"
3900 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3901 " 63,00,6f,00,6e,00,\\;comment\n"
3902 "\t\t\t\t63,00,61,00,74,00,\\;comment\n"
3903 " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3904 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3905 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
3907 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3908 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3910 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3911 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3912 " \"Wine5a\"=\"Leading spaces\"\n"
3913 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
3914 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
3915 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
3916 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3917 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
3918 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
3919 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
3920 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
3922 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3923 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3924 "\" Wine6a\"=\"Leading spaces\"\n"
3925 "\"\t\tWine6b\"=\"Leading tabs\"\n"
3926 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
3927 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3928 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
3929 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
3930 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
3932 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3933 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3934 "\"Wine7a\"=\" Four spaces in the data\"\n"
3935 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
3936 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3937 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
3938 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
3940 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3941 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3942 "\"Wine8a\"=\"Trailing spaces\" \n"
3943 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
3944 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3945 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
3946 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
3948 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3949 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3950 "\"Wine9a\"=dword: 00000008\n"
3951 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
3952 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3954 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
3955 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3957 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3958 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3959 "@ = \"Test Value\"\n\n", &r
);
3960 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3961 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
3963 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3964 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3965 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
3966 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3967 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
3969 err
= RegCloseKey(hkey
);
3970 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
3972 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
3973 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
3979 if (!run_reg_exe("reg.exe /?", &r
)) {
3980 win_skip("reg.exe not available, skipping reg.exe tests\n");
3989 test_unicode_import();
3990 test_import_with_whitespace();
3991 test_unicode_import_with_whitespace();