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
[8];
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
, &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 key deletion. We start by creating some registry keys. */
1649 test_import_str("REGEDIT4\n\n"
1650 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1651 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1652 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1653 todo_wine
verify_key(hkey
, "Subkey2a");
1654 todo_wine
verify_key(hkey
, "Subkey2b");
1656 test_import_str("REGEDIT4\n\n"
1657 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1658 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1659 todo_wine
verify_key(hkey
, "Subkey2a");
1661 test_import_str("REGEDIT4\n\n"
1662 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1663 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1664 todo_wine
verify_key(hkey
, "Subkey2b");
1666 test_import_str("REGEDIT4\n\n"
1667 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1668 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1669 todo_wine
verify_key(hkey
, "Subkey2a");
1671 test_import_str("REGEDIT4\n\n"
1672 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1673 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1674 todo_wine
verify_key(hkey
, "Subkey2b");
1676 test_import_str("REGEDIT4\n\n"
1677 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1678 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1679 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1680 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
1681 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
1683 /* Test case sensitivity when creating and deleting registry keys. */
1684 test_import_str("REGEDIT4\n\n"
1685 "[hkey_CURRENT_user\\" KEY_BASE
"\\Subkey3a]\n\n"
1686 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE
"\\SuBkEy3b]\n\n", &r
);
1687 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1688 todo_wine
verify_key(hkey
, "Subkey3a");
1689 todo_wine
verify_key(hkey
, "Subkey3b");
1691 test_import_str("REGEDIT4\n\n"
1692 "[-HKEY_current_USER\\" KEY_BASE
"\\sUBKEY3A]\n\n"
1693 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE
"\\sUbKeY3B]\n\n", &r
);
1694 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1695 todo_wine
verify_key_nonexist(hkey
, "Subkey3a");
1696 todo_wine
verify_key_nonexist(hkey
, "Subkey3b");
1698 /* Test value deletion. We start by creating some registry values. */
1699 test_import_str("REGEDIT4\n\n"
1700 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1701 "\"Wine46a\"=\"Test Value\"\n"
1702 "\"Wine46b\"=dword:00000008\n"
1703 "\"Wine46c\"=hex:11,22,33,44\n"
1704 "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n"
1705 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1706 "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n"
1707 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
1708 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1709 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
1710 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1711 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
1712 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1713 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1714 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1716 test_import_str("REGEDIT4\n\n"
1717 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1720 "\"Wine46c\"= \t-\t \n"
1721 "\"Wine46d\"=-\"Test\"\n"
1722 "\"Wine46e\"=- ;comment\n"
1723 "\"Wine46f\"=- #comment\n\n", &r
);
1724 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1725 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
1726 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
1727 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
1728 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1729 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
1730 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1732 /* Test the accepted range of the hex-based data types */
1733 test_import_str("REGEDIT4\n\n"
1734 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1735 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
1736 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
1737 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
1738 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
1739 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
1740 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
1741 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
1742 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
1743 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n\n", &r
);
1744 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1745 todo_wine
verify_reg(hkey
, "Wine47a", REG_NONE
, "Value", 6, 0);
1746 todo_wine
verify_reg(hkey
, "Wine47b", 0x10, "Value", 6, 0);
1747 todo_wine
verify_reg(hkey
, "Wine47c", 0x100, "Value", 6, 0);
1748 todo_wine
verify_reg(hkey
, "Wine47d", 0x1000, "Value", 6, 0);
1749 todo_wine
verify_reg(hkey
, "Wine47e", 0x7fff, "Value", 6, 0);
1750 todo_wine
verify_reg(hkey
, "Wine47f", 0xffff, "Value", 6, 0);
1751 todo_wine
verify_reg(hkey
, "Wine47g", 0x7fffffff, "Value", 6, 0);
1752 todo_wine
verify_reg(hkey
, "Wine47h", 0xffffffff, "Value", 6, 0);
1753 todo_wine
verify_reg_nonexist(hkey
, "Wine47i");
1755 test_import_str("REGEDIT4\n\n"
1756 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1757 "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n"
1758 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1759 "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n"
1760 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1761 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1762 todo_wine
verify_reg(hkey
, "Wine48a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1763 todo_wine
verify_reg(hkey
, "Wine48b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1765 test_import_str("REGEDIT4\n\n"
1766 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1767 "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\n\n", &r
);
1768 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1769 todo_wine
verify_reg(hkey
, "Wine49", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1771 test_import_str("REGEDIT4\n\n"
1772 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1773 "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n"
1774 "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n"
1775 "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n"
1776 "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r
);
1777 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1778 todo_wine
verify_reg(hkey
, "Wine50a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1779 todo_wine
verify_reg(hkey
, "Wine50b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1780 todo_wine
verify_reg_nonexist(hkey
, "Wine50c");
1781 todo_wine
verify_reg_nonexist(hkey
, "Wine50d");
1783 /* Test support for characters greater than 0xff */
1784 test_import_str("REGEDIT4\n\n"
1785 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1786 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
1787 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r
);
1788 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1789 todo_wine
verify_reg_nonexist(hkey
, "Wine51a");
1790 todo_wine
verify_reg_nonexist(hkey
, "Wine51b");
1792 /* Test the effect of backslashes in hex data */
1793 test_import_str("REGEDIT4\n\n"
1794 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1795 "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n"
1796 "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n"
1797 "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n"
1798 "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n"
1799 "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n"
1800 "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n"
1801 "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n"
1802 "\"Wine52h\"=hex(2):25,48,4\\\n"
1804 "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n"
1805 "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n"
1806 " 25,50,41,54,48,25,00\n"
1807 "\"Wine52k\"=hex(2):,\\\n"
1808 " 25,48,4f,4d,45,25,00\n"
1809 "\"Wine52l\"=hex(2):\\\n"
1810 " 25,48,4f,4d,45,25,00\n\n", &r
);
1811 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1812 todo_wine
verify_reg_nonexist(hkey
, "Wine52a");
1813 todo_wine
verify_reg_nonexist(hkey
, "Wine52b");
1814 todo_wine
verify_reg_nonexist(hkey
, "Wine52c");
1815 todo_wine
verify_reg_nonexist(hkey
, "Wine52d");
1816 todo_wine
verify_reg_nonexist(hkey
, "Wine52e");
1817 todo_wine
verify_reg_nonexist(hkey
, "Wine52f");
1818 todo_wine
verify_reg_nonexist(hkey
, "Wine52g");
1819 todo_wine
verify_reg_nonexist(hkey
, "Wine52h");
1820 todo_wine
verify_reg_nonexist(hkey
, "Wine52i");
1821 todo_wine
verify_reg_nonexist(hkey
, "Wine52j");
1822 todo_wine
verify_reg_nonexist(hkey
, "Wine52k");
1823 todo_wine
verify_reg(hkey
, "Wine52l", REG_EXPAND_SZ
, "%HOME%", 7, 0);
1825 test_import_str("REGEDIT4\n\n"
1826 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1827 "\"Wine53a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1828 " 25,50,41,54,48,25,00\n"
1829 "\"Wine53b\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
1830 " 25,50,41,54,48,25,00\n"
1831 "\"Wine53c\"=hex(2):25,48,4f,4d,45,25,5c, \\ ;comment\n"
1832 " 25,50,41,54,48,25,00\n"
1833 "\"Wine53d\"=hex(2):25,48,4f,4d,45,25,5c \\ ;comment\n"
1834 " 25,50,41,54,48,25,00\n"
1835 "\"Wine53e\"=hex(2):25,48,4f,4d,45,25,5c,\\\t ;comment\n"
1836 " 25,50,41,54,48,25,00\n"
1837 "\"Wine53f\"=hex(2):25,48,4f,4d,45,25,5c\\\t ;comment\n"
1838 " 25,50,41,54,48,25,00\n\n", &r
);
1839 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1840 todo_wine
verify_reg(hkey
, "Wine53a", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
1841 todo_wine
verify_reg_nonexist(hkey
, "Wine53b");
1842 todo_wine
verify_reg(hkey
, "Wine53c", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
1843 todo_wine
verify_reg_nonexist(hkey
, "Wine53d");
1844 todo_wine
verify_reg(hkey
, "Wine53e", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
1845 todo_wine
verify_reg_nonexist(hkey
, "Wine53f");
1847 test_import_str("REGEDIT4\n\n"
1848 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1849 "\"Wine54a\"=hex(2):4c,69,6e,65,20,\\\n"
1850 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1]\n", &r
);
1851 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1852 todo_wine
verify_reg_nonexist(hkey
, "Wine54a");
1853 todo_wine
verify_key_nonexist(hkey
, "Subkey1");
1855 test_import_str("REGEDIT4\n\n"
1856 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1857 "\"Wine54b\"=hex(2):4c,69,6e,65,20\\\n"
1858 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2]\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
, "Wine54b");
1861 todo_wine
verify_key(hkey
, "Subkey2");
1863 err
= RegDeleteKeyA(hkey
, "Subkey2");
1864 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKey failed: %u\n", err
);
1866 err
= RegCloseKey(hkey
);
1867 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1869 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
1870 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1873 static void test_unicode_import(void)
1875 DWORD r
, dword
= 0x123, type
, size
;
1881 test_import_wstr("REGEDIT\n", &r
);
1882 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1883 "got exit code %d, expected 1\n", r
);
1885 test_import_wstr("REGEDIT4\n", &r
);
1886 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1887 "got exit code %d, expected 1\n", r
);
1889 test_import_wstr("\xef\xbb\xbfREGEDIT", &r
);
1890 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1892 test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r
);
1893 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1895 test_import_wstr("\xef\xbb\xbfREGEDIT4", &r
);
1896 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1898 test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r
);
1899 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1901 test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r
);
1902 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1904 test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r
);
1905 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1907 test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r
);
1908 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1909 "got exit code %d, expected 1\n", r
);
1911 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1912 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n", &r
);
1913 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1915 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
1916 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1918 test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n"
1919 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1920 "\"Test1\"=\"Value\"\n", &r
);
1921 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1922 todo_wine
verify_reg_nonexist(hkey
, "Test1");
1924 test_import_wstr("\xef\xbb\xbfregedit4\n\n"
1925 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1926 "\"Test2\"=\"Value\"\n", &r
);
1927 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1928 "got exit code %d, expected 1\n", r
);
1929 todo_wine
verify_reg_nonexist(hkey
, "Test2");
1931 test_import_wstr("\xef\xbb\xbfRegedit4\n\n"
1932 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1933 "\"Test3\"=\"Value\"\n", &r
);
1934 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1935 "got exit code %d, expected 1\n", r
);
1936 todo_wine
verify_reg_nonexist(hkey
, "Test3");
1938 test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n"
1939 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1940 "\"Test4\"=\"Value\"\n", &r
);
1941 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1942 todo_wine
verify_reg_nonexist(hkey
, "Test4");
1944 test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n"
1945 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1946 "\"Test5\"=\"Value\"\n", &r
);
1947 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1948 todo_wine
verify_reg_nonexist(hkey
, "Test5");
1950 test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n"
1951 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1952 "\"Test6\"=\"Value\"\n", &r
);
1953 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1954 todo_wine
verify_reg_nonexist(hkey
, "Test6");
1956 test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n"
1957 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1958 "\"Test7\"=\"Value\"\n", &r
);
1959 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1960 todo_wine
verify_reg_nonexist(hkey
, "Test7");
1962 test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n"
1963 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1964 "\"Test8\"=\"Value\"\n", &r
);
1965 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1966 todo_wine
verify_reg_nonexist(hkey
, "Test8");
1968 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1969 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1970 "\"Unicode1\"=\"Value1\"\n", &r
);
1971 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1972 todo_wine
verify_reg(hkey
, "Unicode1", REG_SZ
, "Value1", 7, 0);
1974 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1975 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1976 "\"Unicode2\"=\"Value2\"\n\n", &r
);
1977 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1978 todo_wine
verify_reg(hkey
, "Unicode2", REG_SZ
, "Value2", 7, 0);
1980 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1981 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1982 "\"Unicode3\"=\"Value3\"\n\n", &r
);
1983 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1984 todo_wine
verify_reg(hkey
, "Unicode3", REG_SZ
, "Value3", 7, 0);
1986 test_import_wstr("Windows Registry Editor Version 4.00\n", &r
);
1987 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1988 "got exit code %d, expected 1\n", r
);
1990 test_import_wstr("Windows Registry Editor Version 5.00\n", &r
);
1991 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1992 "got exit code %d, expected 1\n", r
);
1994 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r
);
1995 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1996 "got exit code %d, expected 1\n", r
);
1998 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r
);
1999 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2001 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r
);
2002 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2004 test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r
);
2005 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2006 "got exit code %d, expected 1\n", r
);
2008 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r
);
2009 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2011 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r
);
2012 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2014 test_import_wstr("\xef\xbb\xbf\nWindows Registry Editor Version 5.00\n", &r
);
2015 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2016 "got exit code %d, expected 1\n", r
);
2018 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n"
2019 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2020 "\"Test9\"=\"Value\"\n", &r
);
2021 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2022 "got exit code %d, expected 1\n", r
);
2023 todo_wine
verify_reg_nonexist(hkey
, "Test9");
2025 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n"
2026 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2027 "\"Test10\"=\"Value\"\n", &r
);
2028 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2029 "got exit code %d, expected 1\n", r
);
2030 todo_wine
verify_reg_nonexist(hkey
, "Test10");
2032 test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
2033 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2034 "\"Test11\"=\"Value\"\n", &r
);
2035 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2036 "got exit code %d, expected 1\n", r
);
2037 todo_wine
verify_reg_nonexist(hkey
, "Test11");
2039 test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n"
2040 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2041 "\"Test12\"=\"Value\"\n", &r
);
2042 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2043 "got exit code %d, expected 1\n", r
);
2044 todo_wine
verify_reg_nonexist(hkey
, "Test12");
2046 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
2047 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2048 "\"Unicode4\"=\"Value4\"\n", &r
);
2049 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2050 todo_wine
verify_reg(hkey
, "Unicode4", REG_SZ
, "Value4", 7, 0);
2052 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
2053 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2054 "\"Unicode5\"=\"Value5\"\n\n", &r
);
2055 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2056 todo_wine
verify_reg(hkey
, "Unicode5", REG_SZ
, "Value5", 7, 0);
2058 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2059 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2060 "\"Unicode6\"=\"Value6\"\n\n", &r
);
2061 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2062 todo_wine
verify_reg(hkey
, "Unicode6", REG_SZ
, "Value6", 7, 0);
2064 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2065 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2066 "\"Line1\"=\"Value1\"\n\n"
2067 "\"Line2\"=\"Value2\"\n\n\n"
2068 "\"Line3\"=\"Value3\"\n\n\n\n"
2069 "\"Line4\"=\"Value4\"\n\n", &r
);
2070 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2071 todo_wine
verify_reg(hkey
, "Line1", REG_SZ
, "Value1", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2072 todo_wine
verify_reg(hkey
, "Line2", REG_SZ
, "Value2", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2073 todo_wine
verify_reg(hkey
, "Line3", REG_SZ
, "Value3", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2074 todo_wine
verify_reg(hkey
, "Line4", REG_SZ
, "Value4", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2076 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2077 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2078 "\"Wine1\"=dword:00000782\n\n"
2079 "\"Wine2\"=\"Test Value\"\n"
2080 "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2081 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2085 "\"Wine4\"=dword:12345678\n\n", &r
);
2086 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2088 todo_wine
verify_reg(hkey
, "Wine1", REG_DWORD
, &dword
, sizeof(dword
),
2089 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2090 todo_wine
verify_reg(hkey
, "Wine2", REG_SZ
, "Test Value", 11,
2091 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2092 todo_wine
verify_reg(hkey
, "Wine3", REG_MULTI_SZ
, "Line concatenation\0", 20,
2093 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2094 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test", 5,
2095 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2097 todo_wine
verify_reg(hkey
, "Wine4", REG_DWORD
, &dword
, sizeof(dword
),
2098 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2100 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2101 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2102 "\"Wine5\"=\"No newline\"", &r
);
2103 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2104 err
= RegQueryValueExA(hkey
, "Wine5", NULL
, NULL
, NULL
, NULL
);
2105 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
2106 "got %d, expected 0\n", err
);
2107 if (err
== ERROR_SUCCESS
)
2108 verify_reg(hkey
, "Wine5", REG_SZ
, "No newline", 11, 0);
2110 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2111 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2112 "\"Wine6\"=dword:00000050\n\n"
2113 "\"Wine7\"=\"No newline\"", &r
);
2114 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2116 todo_wine
verify_reg(hkey
, "Wine6", REG_DWORD
, &dword
, sizeof(dword
),
2117 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2118 err
= RegQueryValueExA(hkey
, "Wine7", NULL
, NULL
, NULL
, NULL
);
2119 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
2120 "got %d, expected 0\n", err
);
2121 if (err
== ERROR_SUCCESS
)
2122 verify_reg(hkey
, "Wine7", REG_SZ
, "No newline", 11, 0);
2124 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2125 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2127 "\"Wine8\"=\"Line 1\"\n"
2129 "\"Wine9\"=\"Line 2\"\n\n", &r
);
2130 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2131 todo_wine
verify_reg(hkey
, "Wine8", REG_SZ
, "Line 1", 7, 0);
2132 todo_wine
verify_reg(hkey
, "Wine9", REG_SZ
, "Line 2", 7, 0);
2134 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2135 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2136 "\"Wine10\"=\"Value 1\"#comment\n"
2137 "\"Wine11\"=\"Value 2\";comment\n"
2138 "\"Wine12\"=dword:01020304 #comment\n"
2139 "\"Wine13\"=dword:02040608 ;comment\n\n", &r
);
2140 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2141 todo_wine
verify_reg_nonexist(hkey
, "Wine10");
2142 todo_wine
verify_reg(hkey
, "Wine11", REG_SZ
, "Value 2", 8, 0);
2143 todo_wine
verify_reg_nonexist(hkey
, "Wine12");
2145 todo_wine
verify_reg(hkey
, "Wine13", REG_DWORD
, &dword
, sizeof(dword
), 0);
2147 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2148 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2149 "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2151 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2152 "\"Wine15\"=\"A valid line\"\n"
2153 "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2155 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2156 "\"Wine17\"=\"Another valid line\"\n\n", &r
);
2157 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2158 todo_wine
verify_reg_nonexist(hkey
, "Wine14");
2159 todo_wine
verify_reg(hkey
, "Wine15", REG_SZ
, "A valid line", 13, 0);
2160 todo_wine
verify_reg(hkey
, "Wine16", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2161 todo_wine
verify_reg(hkey
, "Wine17", REG_SZ
, "Another valid line", 19, 0);
2163 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2164 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2165 "#\"Comment1\"=\"Value 1\"\n"
2166 ";\"Comment2\"=\"Value 2\"\n"
2167 " #\"Comment3\"=\"Value 3\"\n"
2168 " ;\"Comment4\"=\"Value 4\"\n"
2169 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
2170 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r
);
2171 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2172 todo_wine
verify_reg_nonexist(hkey
, "Comment1");
2173 todo_wine
verify_reg_nonexist(hkey
, "Comment2");
2174 todo_wine
verify_reg_nonexist(hkey
, "Comment3");
2175 todo_wine
verify_reg_nonexist(hkey
, "Comment4");
2176 todo_wine
verify_reg_nonexist(hkey
, "Wine18");
2177 todo_wine
verify_reg_nonexist(hkey
, "Comment5");
2178 todo_wine
verify_reg(hkey
, "Wine19", REG_SZ
, "Value 7", 8, TODO_REG_SIZE
|TODO_REG_DATA
);
2179 todo_wine
verify_reg_nonexist(hkey
, "Comment6");
2181 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2182 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2183 "\"Wine20\"=#\"Value 8\"\n"
2184 "\"Wine21\"=;\"Value 9\"\n"
2185 "\"Wine22\"=\"#comment1\"\n"
2186 "\"Wine23\"=\";comment2\"\n"
2187 "\"Wine24\"=\"Value#comment3\"\n"
2188 "\"Wine25\"=\"Value;comment4\"\n"
2189 "\"Wine26\"=\"Value #comment5\"\n"
2190 "\"Wine27\"=\"Value ;comment6\"\n"
2191 "\"Wine28\"=#dword:00000001\n"
2192 "\"Wine29\"=;dword:00000002\n"
2193 "\"Wine30\"=dword:00000003#comment\n"
2194 "\"Wine31\"=dword:00000004;comment\n\n", &r
);
2195 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2196 todo_wine
verify_reg_nonexist(hkey
, "Wine20");
2197 todo_wine
verify_reg_nonexist(hkey
, "Wine21");
2198 todo_wine
verify_reg(hkey
, "Wine22", REG_SZ
, "#comment1", 10, 0);
2199 todo_wine
verify_reg(hkey
, "Wine23", REG_SZ
, ";comment2", 10, 0);
2200 todo_wine
verify_reg(hkey
, "Wine24", REG_SZ
, "Value#comment3", 15, 0);
2201 todo_wine
verify_reg(hkey
, "Wine25", REG_SZ
, "Value;comment4", 15, 0);
2202 todo_wine
verify_reg(hkey
, "Wine26", REG_SZ
, "Value #comment5", 16, 0);
2203 todo_wine
verify_reg(hkey
, "Wine27", REG_SZ
, "Value ;comment6", 16, 0);
2204 todo_wine
verify_reg_nonexist(hkey
, "Wine28");
2205 todo_wine
verify_reg_nonexist(hkey
, "Wine29");
2206 todo_wine
verify_reg_nonexist(hkey
, "Wine30");
2208 todo_wine
verify_reg(hkey
, "Wine31", REG_DWORD
, &dword
, sizeof(dword
), 0);
2210 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2211 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2212 "\"Wine32a\"=dword:1\n"
2213 "\"Wine32b\"=dword:4444\n\n", &r
);
2214 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2216 todo_wine
verify_reg(hkey
, "Wine32a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2218 todo_wine
verify_reg(hkey
, "Wine32b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2220 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2221 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2222 "\"Wine33a\"=dword:\n"
2223 "\"Wine33b\"=dword:hello\n"
2224 "\"Wine33c\"=dword:123456789\n"
2225 "\"Wine33d\"=dword:012345678\n"
2226 "\"Wine33e\"=dword:000000001\n\n", &r
);
2227 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2228 todo_wine
verify_reg_nonexist(hkey
, "Wine33a");
2229 todo_wine
verify_reg_nonexist(hkey
, "Wine33b");
2230 todo_wine
verify_reg_nonexist(hkey
, "Wine33c");
2231 todo_wine
verify_reg_nonexist(hkey
, "Wine33d");
2232 todo_wine
verify_reg_nonexist(hkey
, "Wine33e");
2234 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2235 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2236 "\"Wine34a\"=dword:12345678abc\n"
2237 "\"Wine34b\"=dword:12345678 abc\n\n", &r
);
2238 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2239 todo_wine
verify_reg_nonexist(hkey
, "Wine34a");
2240 todo_wine
verify_reg_nonexist(hkey
, "Wine34b");
2242 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2243 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2244 "\"Wine35a\"=dword:0x123\n"
2245 "\"Wine35b\"=dword:123 456\n"
2246 "\"Wine35c\"=dword:1234 5678\n\n", &r
);
2247 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2248 todo_wine
verify_reg_nonexist(hkey
, "Wine35a");
2249 todo_wine
verify_reg_nonexist(hkey
, "Wine35b");
2250 todo_wine
verify_reg_nonexist(hkey
, "Wine35c");
2252 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2253 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2254 "\"Wine36a\"=dword:1234;5678\n"
2255 "\"Wine36b\"=dword:1234 ;5678\n"
2256 "\"Wine36c\"=dword:1234#5678\n"
2257 "\"Wine36d\"=dword:1234 #5678\n\n", &r
);
2258 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2260 todo_wine
verify_reg(hkey
, "Wine36a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2261 todo_wine
verify_reg(hkey
, "Wine36b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2262 todo_wine
verify_reg_nonexist(hkey
, "Wine36c");
2263 todo_wine
verify_reg_nonexist(hkey
, "Wine36d");
2265 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2266 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2267 "\"Wine37a\"=\"foo\"bar\"\n"
2268 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r
);
2269 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2270 todo_wine
verify_reg_nonexist(hkey
, "Wine37a");
2271 todo_wine
verify_reg_nonexist(hkey
, "Wine37b");
2273 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2274 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2275 "\"Empty string\"=\"\"\n"
2276 "\"\"=\"Default registry value\"\n\n", &r
);
2277 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2278 todo_wine
verify_reg(hkey
, "Empty string", REG_SZ
, "", 1, 0);
2279 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default registry value", 23, 0);
2281 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2282 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2284 "\"Test38b\"=\\\"\n"
2285 "\"Test38c\"=\\\"Value\\\"\n"
2286 "\"Test38d\"=\\\"Value\"\n\n", &r
);
2287 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2288 todo_wine
verify_reg_nonexist(hkey
, "Test38a");
2289 todo_wine
verify_reg_nonexist(hkey
, "Test38b");
2290 todo_wine
verify_reg_nonexist(hkey
, "Test38c");
2291 todo_wine
verify_reg_nonexist(hkey
, "Test38d");
2293 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2294 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2295 "\"Wine39a\"=\"Value1\" ;comment\n"
2296 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
2297 "\"Wine39c\"=\"Value3\" #comment\n"
2298 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r
);
2299 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2300 todo_wine
verify_reg(hkey
, "Wine39a", REG_SZ
, "Value1", 7, 0);
2301 todo_wine
verify_reg(hkey
, "Wine39b", REG_SZ
, "Value2", 7, 0);
2302 todo_wine
verify_reg_nonexist(hkey
, "Wine39c");
2303 todo_wine
verify_reg_nonexist(hkey
, "Wine39d");
2305 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2306 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2307 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r
);
2308 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2309 todo_wine
verify_reg_nonexist(hkey
, "TestNoBeginQuote");
2311 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2312 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2313 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r
);
2314 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2315 todo_wine
verify_reg_nonexist(hkey
, "TestNoEndQuote");
2317 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2318 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2319 "\"TestNoQuotes\"=Asdffdsa\n", &r
);
2320 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2321 todo_wine
verify_reg_nonexist(hkey
, "TestNoQuotes");
2323 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2324 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2325 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r
);
2326 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2327 todo_wine
verify_reg_nonexist(hkey
, "NameNoBeginQuote");
2329 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2330 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2331 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r
);
2332 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2333 todo_wine
verify_reg_nonexist(hkey
, "NameNoEndQuote");
2335 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2336 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2337 "NameNoQuotes=\"Asdffdsa\"\n", &r
);
2338 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2339 todo_wine
verify_reg_nonexist(hkey
, "NameNoQuotes");
2341 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2342 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2343 "\"MixedQuotes=Asdffdsa\"\n", &r
);
2344 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2345 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes");
2346 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes=Asdffdsa");
2348 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2349 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2350 "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n"
2351 "\"Wine40b\"=\"Value 1\"\n"
2352 "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n"
2353 "\"Wine40d\"=\"Value 2\"\n"
2354 "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n"
2355 "\"Wine40f\"=\"Value 3\"\n"
2356 "\"Wine40g\"=\"Value 4\"\n\n", &r
);
2357 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2358 todo_wine
verify_reg(hkey
, "Wine40a", REG_EXPAND_SZ
, "Line", 5, 0);
2359 todo_wine
verify_reg(hkey
, "Wine40b", REG_SZ
, "Value 1", 8, 0);
2360 todo_wine
verify_reg_nonexist(hkey
, "Wine40c");
2361 todo_wine
verify_reg(hkey
, "Wine40d", REG_SZ
, "Value 2", 8, 0);
2362 todo_wine
verify_reg_nonexist(hkey
, "Wine40e");
2363 todo_wine
verify_reg_nonexist(hkey
, "Wine40f");
2364 todo_wine
verify_reg(hkey
, "Wine40g", REG_SZ
, "Value 4", 8, 0);
2366 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2367 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2368 "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2369 " 63,00,6f,00,6e,00,\\;comment\n"
2370 " 63,00,61,00,74,00,\\;comment\n"
2371 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2372 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2373 todo_wine
verify_reg(hkey
, "Multi-Line1", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2375 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2376 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2377 "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2378 " 63,00,6f,00,6e,00,\\;comment\n"
2379 " 63,00,61,00,74,00,;comment\n"
2380 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2381 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2382 todo_wine
verify_reg(hkey
, "Multi-Line2", REG_MULTI_SZ
, "Line concat", 12, 0);
2384 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2385 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2386 "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
2387 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2388 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2389 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line3");
2391 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2392 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2393 "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
2394 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2395 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2396 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line4");
2398 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2399 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2400 "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
2401 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2402 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2403 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line5");
2405 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2406 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2407 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
2408 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2409 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2410 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line6");
2412 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2413 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2414 "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2415 " 65,00,20,00,\\;comment\n"
2416 " 63,00,6f,00,6e,00,\\;comment\n"
2417 " 63,00,61,00,74,00,\\;comment\n"
2418 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2419 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2420 todo_wine
verify_reg(hkey
, "Multi-Line7", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2422 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2423 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2424 "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n"
2425 " 65,00,20,00,\\;#comment\n"
2426 " 63,00,6f,00,6e,00,\\;#comment\n"
2427 " 63,00,61,00,74,00,\\;#comment\n"
2428 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2429 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2430 todo_wine
verify_reg(hkey
, "Multi-Line8", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2432 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2433 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2434 "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2435 " 65,00,20,00,\\;comment\n"
2436 " 63,00,6f,00,6e,00,\\;comment\n"
2437 " 63,00,61,00,74,00,\\#comment\n"
2438 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2439 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2440 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line9");
2442 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2443 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2444 "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2445 " 63,00,6f,00,6e,00,\\;comment\n"
2446 " 63,00,61,00,74,00,\\\n\n"
2447 " 65,00,6e,00,\\;comment\n\n"
2448 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2449 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2450 todo_wine
verify_reg(hkey
, "Multi-Line10", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2452 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2453 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2454 "\"Wine41a\"=dword:1234\\\n"
2456 "\"Wine41b\"=\"Test \\\n"
2458 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2459 todo_wine
verify_reg_nonexist(hkey
, "Wine41a");
2460 todo_wine
verify_reg_nonexist(hkey
, "Wine41b");
2462 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2463 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2464 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
2465 "\"single'quote\"=dword:00000008\n\n", &r
);
2466 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2467 todo_wine
verify_reg(hkey
, "double\"quote", REG_SZ
, "valid \"or\" not", 15, 0);
2469 todo_wine
verify_reg(hkey
, "single'quote", REG_DWORD
, &dword
, sizeof(dword
), 0);
2471 /* Test key name and value name concatenation */
2472 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2473 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\\n"
2475 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2476 todo_wine
verify_key_nonexist(hkey
, "Subkey1");
2478 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2479 "[HKEY_CURRENT_USER\\" KEY_BASE
"\n"
2480 "\\Subkey2]\n", &r
);
2481 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2482 todo_wine
verify_key_nonexist(hkey
, "Subkey2");
2484 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2485 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2487 "42a\"=\"Value 1\"\n"
2488 "\"Wine42b\"=\"Value 2\"\n"
2490 "\\42c\"=\"Value 3\"\n\n", &r
);
2491 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2492 todo_wine
verify_reg_nonexist(hkey
, "Wine42a");
2493 todo_wine
verify_reg(hkey
, "Wine42b", REG_SZ
, "Value 2", 8, 0);
2494 todo_wine
verify_reg_nonexist(hkey
, "Wine42c");
2496 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
2497 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2498 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2499 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
2500 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
2501 " 75,00,65,00,00,00\n"
2502 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
2503 ",75,00,65,00,00,00\n"
2504 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
2505 " ,75,00,65,00,00,00\n"
2506 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
2507 " 75,00,65,00,00,00\n"
2508 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
2509 "5,00,65,00,00,00\n"
2510 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
2511 " 5,00,65,00,00,00\n"
2512 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
2515 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
2518 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
2519 " 6c,00,75,00,;comment\n"
2521 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
2522 " 6c,00,75,00,\\#comment\n"
2523 " 65,00,00,00\n\n", &r
);
2524 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2525 todo_wine
verify_reg(hkey
, "Wine43a", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2526 todo_wine
verify_reg(hkey
, "Wine43b", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2527 todo_wine
verify_reg_nonexist(hkey
, "Wine43c");
2528 todo_wine
verify_reg_nonexist(hkey
, "Wine43d");
2529 todo_wine
verify_reg_nonexist(hkey
, "Wine43e");
2530 todo_wine
verify_reg_nonexist(hkey
, "Wine43f");
2531 todo_wine
verify_reg_nonexist(hkey
, "Wine43g");
2532 todo_wine
verify_reg(hkey
, "Wine43h", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2533 todo_wine
verify_reg(hkey
, "Wine43i", REG_NONE
, "V\0a\0l\0u", 8, 0);
2534 todo_wine
verify_reg(hkey
, "Wine43j", REG_NONE
, "V\0a\0l\0u", 8, 0);
2535 todo_wine
verify_reg_nonexist(hkey
, "Wine43k");
2537 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2538 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2539 "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2540 "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n"
2541 " 54,00,48,00,25,00,00,00\n"
2542 "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n"
2543 ",54,00,48,00,25,00,00,00\n"
2544 "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n"
2545 " ,54,00,48,00,25,00,00,00\n"
2546 "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n"
2547 " 54,00,48,00,25,00,00,00\n"
2548 "\"Wine44f\"=hex(2):25,00,50,00,4\\\n"
2549 "1,00,54,00,48,00,25,00,00,00\n"
2550 "\"Wine44g\"=hex(2):25,00,50,00,4\\\n"
2551 " 1,00,54,00,48,00,25,00,00,00\n"
2552 "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2555 "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2558 "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2559 " 54,00,48,00;comment\n"
2561 "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2562 " 54,00,48,00,\\#comment\n"
2563 " 25,00,00,00\n\n", &r
);
2564 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2565 todo_wine
verify_reg(hkey
, "Wine44a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2566 todo_wine
verify_reg(hkey
, "Wine44b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2567 todo_wine
verify_reg_nonexist(hkey
, "Wine44c");
2568 todo_wine
verify_reg_nonexist(hkey
, "Wine44d");
2569 todo_wine
verify_reg_nonexist(hkey
, "Wine44e");
2570 todo_wine
verify_reg_nonexist(hkey
, "Wine44f");
2571 todo_wine
verify_reg_nonexist(hkey
, "Wine44g");
2572 todo_wine
verify_reg(hkey
, "Wine44h", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2574 size
= sizeof(buffer
);
2575 err
= RegQueryValueExA(hkey
, "Wine44i", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2576 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2577 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2578 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2579 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2581 size
= sizeof(buffer
);
2582 memset(buffer
, '-', size
);
2583 err
= RegQueryValueExA(hkey
, "Wine44j", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2584 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2585 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2586 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2587 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2589 todo_wine
verify_reg_nonexist(hkey
, "Wine44k");
2591 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2592 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2593 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
2594 "\"Wine45b\"=hex:11,22,33,44,\\\n"
2596 "\"Wine45c\"=hex:11,22,33,44\\\n"
2598 "\"Wine45d\"=hex:11,22,33,44\\\n"
2600 "\"Wine45e\"=hex:11,22,33,44\\\n"
2602 "\"Wine45f\"=hex:11,22,33,4\\\n"
2604 "\"Wine45g\"=hex:11,22,33,4\\\n"
2606 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
2609 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
2612 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
2615 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
2616 " 44,55,66,\\#comment\n"
2618 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2619 hex
[0] = 0x11; hex
[1] = 0x22; hex
[2] = 0x33; hex
[3] = 0x44;
2620 hex
[4] = 0x55; hex
[5] = 0x66; hex
[6] = 0x77; hex
[7] = 0x88;
2621 todo_wine
verify_reg(hkey
, "Wine45a", REG_BINARY
, hex
, sizeof(hex
), 0);
2622 todo_wine
verify_reg(hkey
, "Wine45b", REG_BINARY
, hex
, sizeof(hex
), 0);
2623 todo_wine
verify_reg_nonexist(hkey
, "Wine45c");
2624 todo_wine
verify_reg_nonexist(hkey
, "Wine45d");
2625 todo_wine
verify_reg_nonexist(hkey
, "Wine45e");
2626 todo_wine
verify_reg_nonexist(hkey
, "Wine45f");
2627 todo_wine
verify_reg_nonexist(hkey
, "Wine45g");
2628 todo_wine
verify_reg(hkey
, "Wine45h", REG_BINARY
, hex
, sizeof(hex
), 0);
2629 todo_wine
verify_reg(hkey
, "Wine45i", REG_BINARY
, hex
, 6, 0);
2630 todo_wine
verify_reg(hkey
, "Wine45j", REG_BINARY
, hex
, 6, 0);
2631 todo_wine
verify_reg_nonexist(hkey
, "Wine45k");
2633 /* Test import with subkeys */
2634 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2635 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey\"1]\n"
2636 "\"Wine\\\\31\"=\"Test value\"\n\n", &r
);
2637 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2638 err
= RegOpenKeyExA(hkey
, "Subkey\"1", 0, KEY_READ
, &subkey
);
2639 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2640 todo_wine
verify_reg(subkey
, "Wine\\31", REG_SZ
, "Test value", 11, 0);
2641 err
= RegCloseKey(subkey
);
2642 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2643 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey\"1");
2644 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2646 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2647 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey/2]\n"
2648 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r
);
2649 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2650 err
= RegOpenKeyExA(hkey
, "Subkey/2", 0, KEY_READ
, &subkey
);
2651 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2652 todo_wine
verify_reg(subkey
, "123/\"4;'5", REG_SZ
, "Random value name", 18, 0);
2653 err
= RegCloseKey(subkey
);
2654 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2655 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey/2");
2656 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2658 /* Test key creation */
2659 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2660 "HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Opening_Bracket]\n", &r
);
2661 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2662 todo_wine
verify_key_nonexist(hkey
, "No_Opening_Bracket");
2664 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2665 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Closing_Bracket\n", &r
);
2666 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2667 todo_wine
verify_key_nonexist(hkey
, "No_Closing_Bracket");
2669 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2670 "[ HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1a]\n", &r
);
2671 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2672 todo_wine
verify_key_nonexist(hkey
, "Subkey1a");
2674 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2675 "[\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1b]\n", &r
);
2676 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2677 todo_wine
verify_key_nonexist(hkey
, "Subkey1b");
2679 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2680 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1c ]\n", &r
);
2681 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2682 todo_wine
verify_key(hkey
, "Subkey1c ");
2683 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1c ");
2684 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2686 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2687 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1d\t]\n", &r
);
2688 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2689 todo_wine
verify_key(hkey
, "Subkey1d\t");
2690 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1d\t");
2691 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2693 /* Test key deletion. We start by creating some registry keys. */
2694 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2695 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
2696 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
2697 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2698 todo_wine
verify_key(hkey
, "Subkey2a");
2699 todo_wine
verify_key(hkey
, "Subkey2b");
2701 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2702 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
2703 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2704 todo_wine
verify_key(hkey
, "Subkey2a");
2706 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2707 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
2708 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2709 todo_wine
verify_key(hkey
, "Subkey2b");
2711 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2712 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
2713 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2714 todo_wine
verify_key(hkey
, "Subkey2a");
2716 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2717 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
2718 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2719 todo_wine
verify_key(hkey
, "Subkey2b");
2721 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2722 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
2723 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
2724 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2725 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
2726 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
2728 /* Test case sensitivity when creating and deleting registry keys. */
2729 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2730 "[hkey_CURRENT_user\\" KEY_BASE
"\\Subkey3a]\n\n"
2731 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE
"\\SuBkEy3b]\n\n", &r
);
2732 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2733 todo_wine
verify_key(hkey
, "Subkey3a");
2734 todo_wine
verify_key(hkey
, "Subkey3b");
2736 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2737 "[-HKEY_current_USER\\" KEY_BASE
"\\sUBKEY3A]\n\n"
2738 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE
"\\sUbKeY3B]\n\n", &r
);
2739 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2740 todo_wine
verify_key_nonexist(hkey
, "Subkey3a");
2741 todo_wine
verify_key_nonexist(hkey
, "Subkey3b");
2743 /* Test value deletion. We start by creating some registry values. */
2744 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2745 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2746 "\"Wine46a\"=\"Test Value\"\n"
2747 "\"Wine46b\"=dword:00000008\n"
2748 "\"Wine46c\"=hex:11,22,33,44\n"
2749 "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2750 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2751 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2752 "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2753 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
2754 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2755 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
2756 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2757 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
2758 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2759 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2760 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2762 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2763 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2766 "\"Wine46c\"= \t-\t \n"
2767 "\"Wine46d\"=-\"Test\"\n"
2768 "\"Wine46e\"=- ;comment\n"
2769 "\"Wine46f\"=- #comment\n\n", &r
);
2770 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2771 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
2772 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
2773 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
2774 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2775 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
2776 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2778 /* Test the accepted range of the hex-based data types */
2779 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2780 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2781 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
2782 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
2783 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
2784 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
2785 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
2786 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
2787 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
2788 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
2789 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n\n", &r
);
2790 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2791 todo_wine
verify_reg(hkey
, "Wine47a", REG_NONE
, "Value", 6, 0);
2792 todo_wine
verify_reg(hkey
, "Wine47b", 0x10, "Value", 6, 0);
2793 todo_wine
verify_reg(hkey
, "Wine47c", 0x100, "Value", 6, 0);
2794 todo_wine
verify_reg(hkey
, "Wine47d", 0x1000, "Value", 6, 0);
2795 todo_wine
verify_reg(hkey
, "Wine47e", 0x7fff, "Value", 6, 0);
2796 todo_wine
verify_reg(hkey
, "Wine47f", 0xffff, "Value", 6, 0);
2797 todo_wine
verify_reg(hkey
, "Wine47g", 0x7fffffff, "Value", 6, 0);
2798 todo_wine
verify_reg(hkey
, "Wine47h", 0xffffffff, "Value", 6, 0);
2799 todo_wine
verify_reg_nonexist(hkey
, "Wine47i");
2801 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2802 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2803 "\"Wine48a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00, \\\n"
2804 " 63,00,6f,00,6e,00,63,00,61,00,74,00, \\\n"
2805 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2806 "\"Wine48b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\t\\\n"
2807 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\t \t \\\n"
2808 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2809 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2810 todo_wine
verify_reg(hkey
, "Wine48a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2811 todo_wine
verify_reg(hkey
, "Wine48b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2813 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2814 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2815 "\"Wine49\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,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(hkey
, "Wine49", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2819 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2820 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2821 "\"Wine50a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 ;comment\n"
2822 "\"Wine50b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t;comment\n"
2823 "\"Wine50c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 #comment\n"
2824 "\"Wine50d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t#comment\n\n", &r
);
2825 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2826 todo_wine
verify_reg(hkey
, "Wine50a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2827 todo_wine
verify_reg(hkey
, "Wine50b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2828 todo_wine
verify_reg_nonexist(hkey
, "Wine50c");
2829 todo_wine
verify_reg_nonexist(hkey
, "Wine50d");
2831 /* Test support for characters greater than 0xff */
2832 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2833 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2834 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
2835 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r
);
2836 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2837 todo_wine
verify_reg_nonexist(hkey
, "Wine51a");
2838 todo_wine
verify_reg_nonexist(hkey
, "Wine51b");
2840 /* Test the effect of backslashes in hex data */
2841 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2842 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2843 "\"Wine52a\"=hex(2):25,00,48\\,00,4f,00,4d,00,45,00,25,00,00,00\n"
2844 "\"Wine52b\"=hex(2):25,00,48,00,\\4f,00,4d,00,45,00,25,00,00,00\n"
2845 "\"Wine52c\"=hex(2):25,00,48\\ ,00,4f,00,4d,00,45,00,25,00,00,00\n"
2846 "\"Wine52d\"=hex(2):25,00,48,00,\\ 4f,00,4d,00,45,00,25,00,00,00\n"
2847 "\"Wine52e\"=hex(2):\\25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2848 "\"Wine52f\"=hex(2):\\ 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2849 "\"Wine52g\"=hex(2):25,00,48,00,4\\f,00,4d,00,45,00,25,00,00,00\n"
2850 "\"Wine52h\"=hex(2):25,00,48,00,4\\\n"
2851 " f,00,4d,00,45,00,25,00,00,00\n"
2852 "\"Wine52i\"=hex(2):25,00,50,00,\\,41,00,54,00,48,00,25,00,00,00\n"
2853 "\"Wine52j\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\\\n"
2854 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2855 "\"Wine52k\"=hex(2):,\\\n"
2856 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2857 "\"Wine52l\"=hex(2):\\\n"
2858 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n\n", &r
);
2859 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2860 todo_wine
verify_reg_nonexist(hkey
, "Wine52a");
2861 todo_wine
verify_reg_nonexist(hkey
, "Wine52b");
2862 todo_wine
verify_reg_nonexist(hkey
, "Wine52c");
2863 todo_wine
verify_reg_nonexist(hkey
, "Wine52d");
2864 todo_wine
verify_reg_nonexist(hkey
, "Wine52e");
2865 todo_wine
verify_reg_nonexist(hkey
, "Wine52f");
2866 todo_wine
verify_reg_nonexist(hkey
, "Wine52g");
2867 todo_wine
verify_reg_nonexist(hkey
, "Wine52h");
2868 todo_wine
verify_reg_nonexist(hkey
, "Wine52i");
2869 todo_wine
verify_reg_nonexist(hkey
, "Wine52j");
2870 todo_wine
verify_reg_nonexist(hkey
, "Wine52k");
2871 todo_wine
verify_reg(hkey
, "Wine52l", REG_EXPAND_SZ
, "%HOME%", 7, 0);
2873 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2874 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2875 "\"Wine53a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n"
2876 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2877 "\"Wine53b\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n"
2878 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2879 "\"Wine53c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00, \\ ;comment\n"
2880 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2881 "\"Wine53d\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00 \\ ;comment\n"
2882 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2883 "\"Wine53e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\t ;comment\n"
2884 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2885 "\"Wine53f\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\t ;comment\n"
2886 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r
);
2887 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2888 todo_wine
verify_reg(hkey
, "Wine53a", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
2889 todo_wine
verify_reg_nonexist(hkey
, "Wine53b");
2890 todo_wine
verify_reg(hkey
, "Wine53c", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
2891 todo_wine
verify_reg_nonexist(hkey
, "Wine53d");
2892 todo_wine
verify_reg(hkey
, "Wine53e", REG_EXPAND_SZ
, "%HOME%\\%PATH%", 14, 0);
2893 todo_wine
verify_reg_nonexist(hkey
, "Wine53f");
2895 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2896 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2897 "\"Wine54a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2898 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1]\n", &r
);
2899 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2900 todo_wine
verify_reg_nonexist(hkey
, "Wine54a");
2901 todo_wine
verify_key_nonexist(hkey
, "Subkey1");
2903 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2904 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2905 "\"Wine54b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n"
2906 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2]\n", &r
);
2907 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2908 todo_wine
verify_reg_nonexist(hkey
, "Wine54b");
2909 todo_wine
verify_key(hkey
, "Subkey2");
2911 err
= RegDeleteKeyA(hkey
, "Subkey2");
2912 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKey failed: %u\n", err
);
2914 err
= RegCloseKey(hkey
);
2915 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2917 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
2918 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2921 static void test_import_with_whitespace(void)
2927 test_import_str(" REGEDIT4\n\n"
2928 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
2929 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2931 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
2932 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
2934 test_import_str(" REGEDIT4\n\n"
2935 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2936 "\"Wine1a\"=\"Value\"\n\n", &r
);
2937 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2938 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
2940 test_import_str("\tREGEDIT4\n\n"
2941 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2942 "\"Wine1b\"=\"Value\"\n\n", &r
);
2943 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2944 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
2946 test_import_str(" \t REGEDIT4\n\n"
2947 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2948 "\"Wine1c\"=\"Value\"\n\n", &r
);
2949 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2950 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
2952 test_import_str("REGEDIT4\n\n"
2953 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2954 "\"Wine2a\"=\"Value\"\n\n", &r
);
2955 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2956 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
2958 test_import_str("REGEDIT4\n\n"
2959 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2960 "\"Wine2b\"=\"Value\"\n\n", &r
);
2961 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2962 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
2964 test_import_str("REGEDIT4\n\n"
2965 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2966 "\"Wine2c\"=\"Value\"\n\n", &r
);
2967 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2968 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
2970 test_import_str("REGEDIT4\n\n"
2971 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2972 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
2973 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2974 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
2976 test_import_str("REGEDIT4\n\n"
2977 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2978 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
2979 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2980 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
2982 test_import_str("REGEDIT4\n\n"
2983 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2984 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
2985 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2986 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
2988 test_import_str(" REGEDIT4\n\n"
2989 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2990 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
2991 " \"Wine4b\"=dword:00112233\n"
2992 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n"
2993 " 63,6f,6e,\\;comment\n"
2994 "\t\t\t\t63,61,74,\\;comment\n"
2995 " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2996 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2997 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
2999 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3000 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3002 test_import_str(" REGEDIT4\n\n"
3003 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3004 " \"Wine5a\"=\"Leading spaces\"\n"
3005 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
3006 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
3007 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
3008 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3009 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
3010 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
3011 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
3012 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
3014 test_import_str("REGEDIT4\n\n"
3015 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3016 "\" Wine6a\"=\"Leading spaces\"\n"
3017 "\"\t\tWine6b\"=\"Leading tabs\"\n"
3018 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
3019 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3020 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
3021 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
3022 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
3024 test_import_str("REGEDIT4\n\n"
3025 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3026 "\"Wine7a\"=\" Four spaces in the data\"\n"
3027 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
3028 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3029 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
3030 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
3032 test_import_str("REGEDIT4\n\n"
3033 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3034 "\"Wine8a\"=\"Trailing spaces\" \n"
3035 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
3036 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3037 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
3038 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
3040 test_import_str("REGEDIT4\n\n"
3041 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3042 "\"Wine9a\"=dword: 00000008\n"
3043 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
3044 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3046 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
3047 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3049 test_import_str("REGEDIT4\n\n"
3050 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3051 "@ = \"Test Value\"\n\n", &r
);
3052 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3053 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
3055 test_import_str("REGEDIT4\n\n"
3056 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3057 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
3058 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3059 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
3061 err
= RegCloseKey(hkey
);
3062 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
3064 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
3065 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
3068 static void test_unicode_import_with_whitespace(void)
3074 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3075 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
3076 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3078 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
3079 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
3081 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3082 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3083 "\"Wine1a\"=\"Value\"\n\n", &r
);
3084 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3085 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
3087 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n"
3088 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3089 "\"Wine1b\"=\"Value\"\n\n", &r
);
3090 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3091 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
3093 test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n"
3094 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3095 "\"Wine1c\"=\"Value\"\n\n", &r
);
3096 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3097 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
3099 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3100 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3101 "\"Wine2a\"=\"Value\"\n\n", &r
);
3102 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3103 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
3105 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3106 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3107 "\"Wine2b\"=\"Value\"\n\n", &r
);
3108 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3109 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
3111 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3112 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3113 "\"Wine2c\"=\"Value\"\n\n", &r
);
3114 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3115 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
3117 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3118 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3119 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
3120 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3121 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
3123 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3124 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3125 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
3126 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3127 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
3129 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3130 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3131 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
3132 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3133 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
3135 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3136 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3137 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
3138 " \"Wine4b\"=dword:00112233\n"
3139 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3140 " 63,00,6f,00,6e,00,\\;comment\n"
3141 "\t\t\t\t63,00,61,00,74,00,\\;comment\n"
3142 " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3143 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3144 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
3146 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3147 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3149 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3150 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3151 " \"Wine5a\"=\"Leading spaces\"\n"
3152 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
3153 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
3154 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
3155 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3156 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
3157 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
3158 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
3159 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
3161 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3162 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3163 "\" Wine6a\"=\"Leading spaces\"\n"
3164 "\"\t\tWine6b\"=\"Leading tabs\"\n"
3165 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
3166 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3167 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
3168 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
3169 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
3171 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3172 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3173 "\"Wine7a\"=\" Four spaces in the data\"\n"
3174 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
3175 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3176 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
3177 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
3179 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3180 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3181 "\"Wine8a\"=\"Trailing spaces\" \n"
3182 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
3183 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3184 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
3185 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
3187 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3188 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3189 "\"Wine9a\"=dword: 00000008\n"
3190 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
3191 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3193 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
3194 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3196 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3197 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3198 "@ = \"Test Value\"\n\n", &r
);
3199 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3200 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
3202 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3203 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3204 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
3205 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3206 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
3208 err
= RegCloseKey(hkey
);
3209 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
3211 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
3212 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
3218 if (!run_reg_exe("reg.exe /?", &r
)) {
3219 win_skip("reg.exe not available, skipping reg.exe tests\n");
3228 test_unicode_import();
3229 test_import_with_whitespace();
3230 test_unicode_import_with_whitespace();