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_exist(k,s) verify_key_exist_(__LINE__,k,s)
95 static void verify_key_exist_(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 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
138 ok(err
== ERROR_FILE_NOT_FOUND
, "got %d\n", err
);
140 run_reg_exe("reg add HKCU\\" KEY_BASE
" /f", &r
);
141 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
143 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
144 ok(err
== ERROR_SUCCESS
, "key creation failed, got %d\n", err
);
146 /* Test empty type */
147 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v emptyType /t \"\" /d WineTest /f", &r
);
148 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
150 /* Test input key formats */
151 run_reg_exe("reg add \\HKCU\\" KEY_BASE
"\\keytest0 /f", &r
);
152 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
153 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest0");
154 ok(err
== ERROR_FILE_NOT_FOUND
, "got exit code %d\n", err
);
156 run_reg_exe("reg add \\\\HKCU\\" KEY_BASE
"\\keytest1 /f", &r
);
157 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
158 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest1");
159 ok(err
== ERROR_FILE_NOT_FOUND
, "got exit code %d\n", err
);
161 run_reg_exe("reg add HKCU\\" KEY_BASE
"\\keytest2\\\\ /f", &r
);
162 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */),
163 "got exit code %u\n", r
);
164 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest2");
165 ok(err
== ERROR_FILE_NOT_FOUND
|| broken(err
== ERROR_SUCCESS
/* WinXP */),
166 "got exit code %d\n", err
);
168 run_reg_exe("reg add HKCU\\" KEY_BASE
"\\keytest3\\ /f", &r
);
169 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
170 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest3", 0, KEY_READ
, &subkey
);
171 ok(err
== ERROR_SUCCESS
, "key creation failed, got %d\n", err
);
173 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest3");
174 ok(err
== ERROR_SUCCESS
, "got exit code %d\n", err
);
176 run_reg_exe("reg add HKCU\\" KEY_BASE
"\\keytest4 /f", &r
);
177 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
178 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest4", 0, KEY_READ
, &subkey
);
179 ok(err
== ERROR_SUCCESS
, "key creation failed, got %d\n", err
);
181 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\keytest4");
182 ok(err
== ERROR_SUCCESS
, "got exit code %d\n", err
);
185 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v none0 /d deadbeef /t REG_NONE /f", &r
);
186 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d\n", r
);
187 verify_reg(hkey
, "none0", REG_NONE
, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0);
189 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v none1 /t REG_NONE /f", &r
);
190 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
191 verify_reg(hkey
, "none1", REG_NONE
, "\0", 2, 0);
193 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_NONE /f", &r
);
194 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
195 verify_reg(hkey
, NULL
, REG_NONE
, "\0", 2, 0);
198 run_reg_exe("reg add HKCU\\" KEY_BASE
" /d WineTest /f", &r
);
199 ok(r
== REG_EXIT_SUCCESS
|| broken(r
== REG_EXIT_FAILURE
/* WinXP */),
200 "got exit code %d, expected 0\n", r
);
201 if (r
== REG_EXIT_SUCCESS
)
202 verify_reg(hkey
, "", REG_SZ
, "WineTest", 9, 0);
204 win_skip("broken reg.exe detected\n");
206 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v test /d deadbeef /f", &r
);
207 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
208 verify_reg(hkey
, "test", REG_SZ
, "deadbeef", 9, 0);
210 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v test /f", &r
);
211 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
212 verify_reg(hkey
, "test", REG_SZ
, "", 1, 0);
214 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v test1 /t REG_SZ /f /d", &r
);
215 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
217 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE
" /ve /d WineTEST /f", &r
);
218 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
219 verify_reg(hkey
, "", REG_SZ
, "WineTEST", 9, 0);
221 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_SZ /v test2 /f", &r
);
222 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
223 verify_reg(hkey
, "test2", REG_SZ
, "", 1, 0);
225 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_SZ /v test3 /f /d \"\"", &r
);
226 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
227 verify_reg(hkey
, "test3", REG_SZ
, "", 1, 0);
229 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /f", &r
);
230 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
231 verify_reg(hkey
, NULL
, REG_SZ
, "", 1, 0);
233 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_SZ /f", &r
);
234 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
235 verify_reg(hkey
, NULL
, REG_SZ
, "", 1, 0);
238 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r
);
239 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
240 verify_reg(hkey
, "expand0", REG_EXPAND_SZ
, "dead%PATH%beef", 15, 0);
242 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r
);
243 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
244 verify_reg(hkey
, "expand1", REG_EXPAND_SZ
, "dead^%PATH^%beef", 17, 0);
246 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_EXPAND_SZ /v expand2 /f", &r
);
247 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
248 verify_reg(hkey
, "expand2", REG_EXPAND_SZ
, "", 1, 0);
250 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE
" /ve /t REG_EXPAND_SZ /d WineTEST /f", &r
);
251 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
252 verify_reg(hkey
, "", REG_EXPAND_SZ
, "WineTEST", 9, 0);
254 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r
);
255 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
256 verify_reg(hkey
, "expand3", REG_EXPAND_SZ
, "", 1, 0);
258 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_EXPAND_SZ /f", &r
);
259 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
260 verify_reg(hkey
, NULL
, REG_EXPAND_SZ
, "", 1, 0);
263 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin0 /f", &r
);
264 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
265 verify_reg(hkey
, "bin0", REG_BINARY
, buffer
, 0, 0);
267 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE
" /ve /t REG_BINARY /d deadbeef /f", &r
);
268 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
270 verify_reg(hkey
, "", REG_BINARY
, &dword
, sizeof(DWORD
), 0);
272 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r
);
273 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
274 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin2 /f /d x01", &r
);
275 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
276 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin3 /f /d 01x", &r
);
277 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
279 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r
);
280 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
281 /* Remaining nibble prefixed */
282 buffer
[0] = 0x0d; buffer
[1] = 0xea; buffer
[2] = 0xdb;
283 buffer
[3] = 0xee; buffer
[4] = 0xf0; buffer
[5] = 0xdd;
284 /* Remaining nibble suffixed on winXP */
285 buffer
[6] = 0xde; buffer
[7] = 0xad; buffer
[8] = 0xbe;
286 buffer
[9] = 0xef; buffer
[10] = 0x0d; buffer
[11] = 0xd0;
288 err
= RegQueryValueExA(hkey
, "bin4", NULL
, &type
, (void *) (buffer
+12), &size
);
289 ok(err
== ERROR_SUCCESS
, "RegQueryValueEx failed: got %d\n", err
);
290 ok(type
== REG_BINARY
, "got wrong type %u\n", type
);
291 ok(size
== 6, "got wrong size %u\n", size
);
292 ok(memcmp(buffer
, buffer
+12, 6) == 0 ||
293 broken(memcmp(buffer
+6, buffer
+12, 6) == 0 /* WinXP */), "got wrong data\n");
295 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_BINARY /v bin5 /d \"\" /f", &r
);
296 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
297 verify_reg(hkey
, "bin5", REG_BINARY
, buffer
, 0, 0);
299 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v bin6 /t REG_BINARY /f /d", &r
);
300 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
302 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_BINARY /f", &r
);
303 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
304 verify_reg(hkey
, NULL
, REG_BINARY
, buffer
, 0, 0);
307 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_DWORD /f /d 12345678", &r
);
308 ok(r
== REG_EXIT_SUCCESS
|| broken(r
== REG_EXIT_FAILURE
/* WinXP */),
309 "got exit code %d, expected 0\n", r
);
311 if (r
== REG_EXIT_SUCCESS
)
312 verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(dword
), 0);
314 win_skip("broken reg.exe detected\n");
316 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword0 /t REG_DWORD /f /d", &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 dword1 /t REG_DWORD /f", &r
);
319 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */),
320 "got exit code %d, expected 1\n", r
);
321 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword2 /t REG_DWORD /d zzz /f", &r
);
322 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
323 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword3 /t REG_DWORD /d deadbeef /f", &r
);
324 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
325 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword4 /t REG_DWORD /d 123xyz /f", &r
);
326 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
328 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword5 /t reg_dword /d 12345678 /f", &r
);
329 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
331 verify_reg(hkey
, "dword5", REG_DWORD
, &dword
, sizeof(dword
), 0);
333 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword6 /t REG_DWORD /D 0123 /f", &r
);
334 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
335 size
= sizeof(dword
);
336 err
= RegQueryValueExA(hkey
, "dword6", NULL
, &type
, (LPBYTE
)&dword
, &size
);
337 ok(err
== ERROR_SUCCESS
, "RegQueryValueEx failed: got %d\n", err
);
338 ok(type
== REG_DWORD
, "got wrong type %d, expected %d\n", type
, REG_DWORD
);
339 ok(size
== sizeof(DWORD
), "got wrong size %d, expected %d\n", size
, (int)sizeof(DWORD
));
340 ok(dword
== 123 || broken(dword
== 0123 /* WinXP */), "got wrong data %d, expected 123\n", dword
);
342 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword7 /t reg_dword /d 0xabcdefg /f", &r
);
343 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
345 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword8 /t REG_dword /d 0xdeadbeef /f", &r
);
346 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
348 verify_reg(hkey
, "dword8", REG_DWORD
, &dword
, sizeof(dword
), 0);
350 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_DWORD /v dword9 /f /d -1", &r
);
351 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
352 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_DWORD /v dword10 /f /d -0x1", &r
);
353 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
355 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword8 /t REG_dword /d 0x01ffffffff /f", &r
);
356 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %d\n", r
);
358 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword12 /t REG_DWORD /d 0xffffffff /f", &r
);
359 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
361 verify_reg(hkey
, "dword12", REG_DWORD
, &dword
, sizeof(dword
), 0);
363 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword13 /t REG_DWORD /d 00x123 /f", &r
);
364 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
366 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword14 /t REG_DWORD /d 0X123 /f", &r
);
367 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
369 verify_reg(hkey
, "dword14", REG_DWORD
, &dword
, sizeof(dword
), 0);
371 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dword15 /t REG_DWORD /d 4294967296 /f", &r
);
372 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
374 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_DWORD /f", &r
);
375 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
377 /* REG_DWORD_LITTLE_ENDIAN */
378 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r
);
379 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
381 verify_reg(hkey
, "DWORD_LE", REG_DWORD_LITTLE_ENDIAN
, &dword
, sizeof(dword
), 0);
383 /* REG_DWORD_BIG_ENDIAN */
384 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r
);
385 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
387 verify_reg(hkey
, "DWORD_BE", REG_DWORD_BIG_ENDIAN
, &dword
, sizeof(dword
), 0);
388 /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like
389 * an ordinary REG_DWORD - that is little endian. GG */
391 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_BE2 /t REG_DWORD_BIG_ENDIAN /f /d", &r
);
392 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
394 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v DWORD_BE3 /t REG_DWORD_BIG_ENDIAN /f", &r
);
395 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
397 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_DWORD_BIG_ENDIAN /f", &r
);
398 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */), "got exit code %u\n", r
);
401 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r
);
402 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
403 memcpy(buffer
, "three\0little\0strings\0", 22);
404 verify_reg(hkey
, "multi0", REG_MULTI_SZ
, buffer
, 22, 0);
406 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r
);
407 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
408 verify_reg(hkey
, "multi1", REG_MULTI_SZ
, buffer
, 22, 0);
410 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r
);
411 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
412 verify_reg(hkey
, "multi2", REG_MULTI_SZ
, &buffer
[21], 1, 0);
414 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi3 /f", &r
);
415 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u\n", r
);
416 verify_reg(hkey
, "multi3", REG_MULTI_SZ
, &buffer
[21], 1, 0);
418 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r
);
419 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
420 verify_reg(hkey
, "multi4", REG_MULTI_SZ
, "threelittlestrings\0", 20, 0);
422 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r
);
423 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
424 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r
);
425 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
426 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r
);
427 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
428 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r
);
429 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 multi9 /s \"#\" /d \"two##strings\" /f", &r
);
431 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
432 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r
);
433 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
435 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r
);
436 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
437 buffer
[0]='a'; buffer
[1]=0; buffer
[2]=0;
438 verify_reg(hkey
, "multi11", REG_MULTI_SZ
, buffer
, 3, 0);
440 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi12 /t REG_MULTI_SZ /f /d", &r
);
441 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
443 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi13 /t REG_MULTI_SZ /f /s", &r
);
444 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
446 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi14 /t REG_MULTI_SZ /d \"\\0a\" /f", &r
);
447 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
449 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi15 /t REG_MULTI_SZ /d \"a\\0\" /f", &r
);
450 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
451 verify_reg(hkey
, "multi15", REG_MULTI_SZ
, buffer
, 3, 0);
453 run_reg_exe("reg add HKCU\\" KEY_BASE
" /t REG_MULTI_SZ /v multi16 /d \"two\\0\\0strings\" /f", &r
);
454 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
456 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi17 /t REG_MULTI_SZ /s \"#\" /d \"#\" /f", &r
);
457 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
458 buffer
[0] = 0; buffer
[1] = 0;
459 verify_reg(hkey
, "multi17", REG_MULTI_SZ
, buffer
, 2, 0);
461 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi18 /t REG_MULTI_SZ /d \"\\0\" /f", &r
);
462 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
463 verify_reg(hkey
, "multi18", REG_MULTI_SZ
, buffer
, 2, 0);
465 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi19 /t REG_MULTI_SZ /s \"#\" /d \"two\\0#strings\" /f", &r
);
466 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
467 verify_reg(hkey
, "multi19", REG_MULTI_SZ
, "two\\0\0strings\0", 15, 0);
469 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi20 /t REG_MULTI_SZ /s \"#\" /d \"two#\\0strings\" /f", &r
);
470 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
471 verify_reg(hkey
, "multi20", REG_MULTI_SZ
, "two\0\\0strings\0", 15, 0);
473 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v multi21 /t REG_MULTI_SZ /s \"#\" /d \"two\\0\\0strings\" /f", &r
);
474 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
475 verify_reg(hkey
, "multi21", REG_MULTI_SZ
, "two\\0\\0strings\0", 16, 0);
477 run_reg_exe("reg add HKCU\\" KEY_BASE
" /ve /t REG_MULTI_SZ /f", &r
);
478 ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
479 verify_reg(hkey
, NULL
, REG_MULTI_SZ
, buffer
, 1, 0);
483 /* Test duplicate switches */
484 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dup1 /t REG_DWORD /d 123 /f /t REG_SZ", &r
);
485 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
/* WinXP */),
486 "got exit code %u, expected 1\n", r
);
488 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v dup2 /t REG_DWORD /d 123 /f /d 456", &r
);
489 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
491 /* Test invalid switches */
492 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid1 /a", &r
);
493 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
495 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid2 /ae", &r
);
496 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
498 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid3 /", &r
);
499 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
501 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v invalid4 -", &r
);
502 ok(r
== REG_EXIT_FAILURE
, "got exit code %u, expected 1\n", r
);
504 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
505 ok(err
== ERROR_SUCCESS
, "got %d\n", err
);
508 static void test_delete(void)
513 const DWORD deadbeef
= 0xdeadbeef;
515 run_reg_exe("reg delete", &r
);
516 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
518 run_reg_exe("reg delete /?", &r
);
519 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
521 err
= RegCreateKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hkey
, NULL
);
522 ok(err
== ERROR_SUCCESS
, "got %d\n", err
);
524 err
= RegSetValueExA(hkey
, "foo", 0, REG_DWORD
, (LPBYTE
)&deadbeef
, sizeof(deadbeef
));
525 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
527 err
= RegSetValueExA(hkey
, "bar", 0, REG_DWORD
, (LPBYTE
)&deadbeef
, sizeof(deadbeef
));
528 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
530 err
= RegSetValueExA(hkey
, "", 0, REG_DWORD
, (LPBYTE
)&deadbeef
, sizeof(deadbeef
));
531 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
533 err
= RegCreateKeyExA(hkey
, "subkey", 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &hsubkey
, NULL
);
534 ok(err
== ERROR_SUCCESS
, "got %d\n" ,err
);
535 RegCloseKey(hsubkey
);
537 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v bar /f", &r
);
538 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
539 verify_reg_nonexist(hkey
, "bar");
541 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /ve /f", &r
);
542 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
543 verify_reg_nonexist(hkey
, "");
545 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /va /f", &r
);
546 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
547 verify_reg_nonexist(hkey
, "foo");
548 err
= RegOpenKeyExA(hkey
, "subkey", 0, KEY_READ
, &hsubkey
);
549 ok(err
== ERROR_SUCCESS
, "got %d\n", err
);
550 RegCloseKey(hsubkey
);
553 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /f", &r
);
554 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
555 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
556 ok(err
== ERROR_FILE_NOT_FOUND
, "got %d\n", err
);
558 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /f", &r
);
559 ok(r
== REG_EXIT_FAILURE
, "got exit code %u\n", r
);
562 static void test_query(void)
567 const char hello
[] = "Hello";
568 const char world
[] = "World";
569 const char empty1
[] = "Empty1";
570 const char empty2
[] = "Empty2";
571 const DWORD dword1
= 0x123;
572 const DWORD dword2
= 0xabc;
574 run_reg_exe("reg query", &r
);
575 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
577 run_reg_exe("reg query /?", &r
);
578 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
580 /* Create a test key */
581 err
= RegCreateKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &key
, NULL
);
582 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
584 run_reg_exe("reg query HKCU\\" KEY_BASE
" /ve", &r
);
585 ok(r
== REG_EXIT_SUCCESS
|| broken(r
== REG_EXIT_FAILURE
/* WinXP */),
586 "got exit code %d, expected 0\n", r
);
588 err
= RegSetValueExA(key
, "Test", 0, REG_SZ
, (BYTE
*)hello
, sizeof(hello
));
589 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
591 err
= RegSetValueExA(key
, "Wine", 0, REG_DWORD
, (BYTE
*)&dword1
, sizeof(dword1
));
592 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
594 err
= RegSetValueExA(key
, NULL
, 0, REG_SZ
, (BYTE
*)empty1
, sizeof(empty1
));
595 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
597 run_reg_exe("reg query HKCU\\" KEY_BASE
, &r
);
598 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
600 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v", &r
);
601 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
603 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Missing", &r
);
604 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
606 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Test", &r
);
607 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
609 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Wine", &r
);
610 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
612 run_reg_exe("reg query HKCU\\" KEY_BASE
" /ve", &r
);
613 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
615 /* Create a test subkey */
616 err
= RegCreateKeyExA(key
, "Subkey", 0, NULL
, 0, KEY_ALL_ACCESS
, NULL
, &subkey
, NULL
);
617 ok(err
== ERROR_SUCCESS
, "got %d\n", err
);
619 err
= RegSetValueExA(subkey
, "Test", 0, REG_SZ
, (BYTE
*)world
, sizeof(world
));
620 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
622 err
= RegSetValueExA(subkey
, "Wine", 0, REG_DWORD
, (BYTE
*)&dword2
, sizeof(dword2
));
623 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
625 err
= RegSetValueExA(subkey
, NULL
, 0, REG_SZ
, (BYTE
*)empty2
, sizeof(empty2
));
626 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
628 err
= RegCloseKey(subkey
);
629 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
631 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey", &r
);
632 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
634 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey /v Test", &r
);
635 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
637 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey /v Wine", &r
);
638 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
640 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey /ve", &r
);
641 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
644 run_reg_exe("reg query HKCU\\" KEY_BASE
" /s", &r
);
645 ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
647 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Test /s", &r
);
648 ok(r
== REG_EXIT_SUCCESS
|| r
== REG_EXIT_FAILURE
/* WinXP */,
649 "got exit code %d, expected 0\n", r
);
651 run_reg_exe("reg query HKCU\\" KEY_BASE
" /v Wine /s", &r
);
652 ok(r
== REG_EXIT_SUCCESS
|| r
== REG_EXIT_FAILURE
/* WinXP */,
653 "got exit code %d, expected 0\n", r
);
655 run_reg_exe("reg query HKCU\\" KEY_BASE
" /ve /s", &r
);
656 ok(r
== REG_EXIT_SUCCESS
|| r
== REG_EXIT_FAILURE
/* WinXP */,
657 "got exit code %d, expected 0\n", r
);
659 /* Clean-up, then query */
660 err
= RegDeleteKeyA(key
, "subkey");
661 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
663 err
= RegCloseKey(key
);
664 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
666 run_reg_exe("reg query HKCU\\" KEY_BASE
"\\subkey", &r
);
667 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
669 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
670 ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
672 run_reg_exe("reg query HKCU\\" KEY_BASE
, &r
);
673 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
676 static void test_v_flags(void)
680 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v Wine /ve", &r
);
681 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
683 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v Wine /ve", &r
);
684 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
686 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v Wine /va", &r
);
687 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
689 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /ve /va", &r
);
690 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
693 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v", &r
);
694 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
696 run_reg_exe("reg add HKCU\\" KEY_BASE
" /d Test /f /v", &r
);
697 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
699 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v", &r
);
700 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
702 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /f /v", &r
);
703 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
705 /* Multiple /v switches */
706 run_reg_exe("reg add HKCU\\" KEY_BASE
" /v Wine /t REG_DWORD /d 0x1 /v Test /f", &r
);
707 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
709 run_reg_exe("reg delete HKCU\\" KEY_BASE
" /v Wine /v Test /f", &r
);
710 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
713 static BOOL
write_reg_file(const char *value
, char *tmp_name
)
715 static const char regedit4
[] = "REGEDIT4";
716 static const char key
[] = "[HKEY_CURRENT_USER\\" KEY_BASE
"]";
717 char file_data
[MAX_PATH
], tmp_path
[MAX_PATH
];
722 sprintf(file_data
, "%s\n\n%s\n%s\n", regedit4
, key
, value
);
724 GetTempPathA(MAX_PATH
, tmp_path
);
725 GetTempFileNameA(tmp_path
, "reg", 0, tmp_name
);
727 hfile
= CreateFileA(tmp_name
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, 0);
728 if (hfile
== INVALID_HANDLE_VALUE
)
731 ret
= WriteFile(hfile
, file_data
, strlen(file_data
), &written
, NULL
);
736 #define test_import_str(c,r) test_import_str_(__LINE__,c,r)
737 static BOOL
test_import_str_(unsigned line
, const char *file_contents
, DWORD
*rc
)
743 regfile
= CreateFileA("test.reg", GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
744 FILE_ATTRIBUTE_NORMAL
, NULL
);
745 lok(regfile
!= INVALID_HANDLE_VALUE
, "Failed to create test.reg file\n");
746 if(regfile
== INVALID_HANDLE_VALUE
)
749 ret
= WriteFile(regfile
, file_contents
, strlen(file_contents
), &written
, NULL
);
750 lok(ret
, "WriteFile failed: %u\n", GetLastError());
751 CloseHandle(regfile
);
753 run_reg_exe("reg import test.reg", rc
);
755 ret
= DeleteFileA("test.reg");
756 lok(ret
, "DeleteFile failed: %u\n", GetLastError());
761 #define test_import_wstr(c,r) test_import_wstr_(__LINE__,c,r)
762 static BOOL
test_import_wstr_(unsigned line
, const char *file_contents
, DWORD
*rc
)
764 int lenA
, len
, memsize
;
770 lenA
= strlen(file_contents
);
772 len
= MultiByteToWideChar(CP_UTF8
, 0, file_contents
, lenA
, NULL
, 0);
773 memsize
= len
* sizeof(WCHAR
);
774 wstr
= HeapAlloc(GetProcessHeap(), 0, memsize
);
775 if (!wstr
) return FALSE
;
776 MultiByteToWideChar(CP_UTF8
, 0, file_contents
, lenA
, wstr
, memsize
);
778 regfile
= CreateFileA("test.reg", GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
779 FILE_ATTRIBUTE_NORMAL
, NULL
);
780 lok(regfile
!= INVALID_HANDLE_VALUE
, "Failed to create test.reg file\n");
781 if(regfile
== INVALID_HANDLE_VALUE
)
784 ret
= WriteFile(regfile
, wstr
, memsize
, &written
, NULL
);
785 lok(ret
, "WriteFile failed: %u\n", GetLastError());
786 CloseHandle(regfile
);
788 HeapFree(GetProcessHeap(), 0, wstr
);
790 run_reg_exe("reg import test.reg", rc
);
792 ret
= DeleteFileA("test.reg");
793 lok(ret
, "DeleteFile failed: %u\n", GetLastError());
798 static void test_import(void)
800 DWORD r
, dword
= 0x123, type
, size
;
801 char test1_reg
[MAX_PATH
], test2_reg
[MAX_PATH
], cmdline
[MAX_PATH
];
802 char test_string
[] = "Test string", buffer
[8];
807 run_reg_exe("reg import", &r
);
808 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
810 run_reg_exe("reg import /?", &r
);
811 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
813 run_reg_exe("reg import missing.reg", &r
);
814 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
816 /* Create test files */
817 ok(write_reg_file("\"Wine\"=dword:00000123", test1_reg
), "Failed to write registry file\n");
818 ok(write_reg_file("@=\"Test string\"", test2_reg
), "Failed to write registry file\n");
820 sprintf(cmdline
, "reg import %s", test1_reg
);
821 run_reg_exe(cmdline
, &r
);
822 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
824 sprintf(cmdline
, "reg import %s", test2_reg
);
825 run_reg_exe(cmdline
, &r
);
826 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
828 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
829 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
831 todo_wine
verify_reg(hkey
, "Wine", REG_DWORD
, &dword
, sizeof(dword
), 0);
832 todo_wine
verify_reg(hkey
, "", REG_SZ
, test_string
, sizeof(test_string
), 0);
834 err
= RegCloseKey(hkey
);
835 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
837 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
838 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
840 sprintf(cmdline
, "reg import %s %s", test1_reg
, test2_reg
);
841 run_reg_exe(cmdline
, &r
);
842 ok(r
== REG_EXIT_FAILURE
, "got exit code %d, expected 1\n", r
);
844 DeleteFileA(test1_reg
);
845 DeleteFileA(test2_reg
);
847 /* Test file contents */
848 test_import_str("regedit\n", &r
);
849 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
850 "got exit code %d, expected 1\n", r
);
852 test_import_str("regedit4\n", &r
);
853 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
854 "got exit code %d, expected 1\n", r
);
856 test_import_str("REGEDIT", &r
);
857 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
859 test_import_str("REGEDIT\n", &r
);
860 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
862 test_import_str("REGEDIT4\n", &r
);
863 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
865 test_import_str(" REGEDIT4\n", &r
);
866 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
868 test_import_str("\tREGEDIT4\n", &r
);
869 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
871 test_import_str("\nREGEDIT4\n", &r
);
872 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
873 "got exit code %d, expected 1\n", r
);
875 test_import_str("AREGEDIT4\n", &r
);
876 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
877 "got exit code %d, expected 1\n", r
);
879 test_import_str("1REGEDIT4\n", &r
);
880 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
881 "got exit code %d, expected 1\n", r
);
883 test_import_str("REGEDIT3\n", &r
);
884 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
886 test_import_str("REGEDIT5\n", &r
);
887 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
889 test_import_str("REGEDIT9\n", &r
);
890 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
892 test_import_str("REGEDIT 4\n", &r
);
893 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
895 test_import_str("REGEDIT4 FOO\n", &r
);
896 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
898 test_import_str("REGEDIT4\n"
899 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n", &r
);
900 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
902 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
903 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
905 test_import_str("REGEDIT3\n\n"
906 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
907 "\"Test1\"=\"Value\"\n", &r
);
908 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
909 todo_wine
verify_reg_nonexist(hkey
, "Test1");
911 test_import_str("regedit4\n\n"
912 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
913 "\"Test2\"=\"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
, "Test2");
918 test_import_str("Regedit4\n\n"
919 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
920 "\"Test3\"=\"Value\"\n", &r
);
921 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
922 "got exit code %d, expected 1\n", r
);
923 todo_wine
verify_reg_nonexist(hkey
, "Test3");
925 test_import_str("REGEDIT 4\n\n"
926 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
927 "\"Test4\"=\"Value\"\n", &r
);
928 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
929 todo_wine
verify_reg_nonexist(hkey
, "Test4");
931 test_import_str("REGEDIT4FOO\n\n"
932 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
933 "\"Test5\"=\"Value\"\n", &r
);
934 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
935 todo_wine
verify_reg_nonexist(hkey
, "Test5");
937 test_import_str("REGEDIT4 FOO\n\n"
938 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
939 "\"Test6\"=\"Value\"\n", &r
);
940 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
941 todo_wine
verify_reg_nonexist(hkey
, "Test6");
943 test_import_str("REGEDIT5\n\n"
944 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
945 "\"Test7\"=\"Value\"\n", &r
);
946 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
947 todo_wine
verify_reg_nonexist(hkey
, "Test7");
949 test_import_str("REGEDIT9\n\n"
950 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
951 "\"Test8\"=\"Value\"\n", &r
);
952 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
953 todo_wine
verify_reg_nonexist(hkey
, "Test8");
955 test_import_str("Windows Registry Editor Version 4.00\n\n"
956 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
957 "\"Test9\"=\"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
, "Test9");
962 test_import_str("Windows Registry Editor Version 5\n\n"
963 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
964 "\"Test10\"=\"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
, "Test10");
969 test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
970 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
971 "\"Test11\"=\"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
, "Test11");
976 test_import_str("Windows Registry Editor version 5.00\n\n"
977 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
978 "\"Test12\"=\"Value\"\n", &r
);
979 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
980 "got exit code %d, expected 1\n", r
);
981 todo_wine
verify_reg_nonexist(hkey
, "Test12");
983 test_import_str("REGEDIT4\n"
984 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
985 "\"Test1\"=\"Value1\"\n", &r
);
986 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
987 todo_wine
verify_reg(hkey
, "Test1", REG_SZ
, "Value1", 7, 0);
989 test_import_str("REGEDIT4\n"
990 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
991 "\"Test2\"=\"Value2\"\n\n", &r
);
992 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
993 todo_wine
verify_reg(hkey
, "Test2", REG_SZ
, "Value2", 7, 0);
995 test_import_str("REGEDIT4\n\n"
996 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
997 "\"Test3\"=\"Value3\"\n\n", &r
);
998 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
999 todo_wine
verify_reg(hkey
, "Test3", REG_SZ
, "Value3", 7, 0);
1001 test_import_str("Windows Registry Editor Version 4.00\n", &r
);
1002 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1003 "got exit code %d, expected 1\n", r
);
1005 test_import_str("Windows Registry Editor Version 5.00\n", &r
);
1006 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1008 test_import_str("Windows Registry Editor Version 5.00\n"
1009 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1010 "\"Test4\"=\"Value4\"\n", &r
);
1011 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1012 todo_wine
verify_reg(hkey
, "Test4", REG_SZ
, "Value4", 7, 0);
1014 test_import_str("Windows Registry Editor Version 5.00\n"
1015 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1016 "\"Test5\"=\"Value5\"\n\n", &r
);
1017 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1018 todo_wine
verify_reg(hkey
, "Test5", REG_SZ
, "Value5", 7, 0);
1020 test_import_str("Windows Registry Editor Version 5.00\n\n"
1021 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1022 "\"Test6\"=\"Value6\"\n\n", &r
);
1023 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1024 todo_wine
verify_reg(hkey
, "Test6", REG_SZ
, "Value6", 7, 0);
1026 test_import_str("REGEDIT4\n\n"
1027 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1028 "\"Line1\"=\"Value1\"\n\n"
1029 "\"Line2\"=\"Value2\"\n\n\n"
1030 "\"Line3\"=\"Value3\"\n\n\n\n"
1031 "\"Line4\"=\"Value4\"\n\n", &r
);
1032 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1033 todo_wine
verify_reg(hkey
, "Line1", REG_SZ
, "Value1", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1034 todo_wine
verify_reg(hkey
, "Line2", REG_SZ
, "Value2", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1035 todo_wine
verify_reg(hkey
, "Line3", REG_SZ
, "Value3", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1036 todo_wine
verify_reg(hkey
, "Line4", REG_SZ
, "Value4", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1038 test_import_str("REGEDIT4\n\n"
1039 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1040 "\"Wine1\"=dword:00000782\n\n"
1041 "\"Wine2\"=\"Test Value\"\n"
1042 "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n"
1043 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1047 "\"Wine4\"=dword:12345678\n\n", &r
);
1048 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1050 todo_wine
verify_reg(hkey
, "Wine1", REG_DWORD
, &dword
, sizeof(dword
),
1051 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1052 todo_wine
verify_reg(hkey
, "Wine2", REG_SZ
, "Test Value", 11,
1053 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1054 todo_wine
verify_reg(hkey
, "Wine3", REG_MULTI_SZ
, "Line concatenation\0", 20,
1055 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1056 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test", 5,
1057 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1059 todo_wine
verify_reg(hkey
, "Wine4", REG_DWORD
, &dword
, sizeof(dword
),
1060 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1062 test_import_str("REGEDIT4\n\n"
1063 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1064 "\"Wine5\"=\"No newline\"", &r
);
1065 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1066 err
= RegQueryValueExA(hkey
, "Wine5", NULL
, NULL
, NULL
, NULL
);
1067 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
1068 "got %d, expected 0\n", err
);
1069 if (err
== ERROR_SUCCESS
)
1070 verify_reg(hkey
, "Wine5", REG_SZ
, "No newline", 11, 0);
1072 test_import_str("REGEDIT4\n\n"
1073 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1074 "\"Wine6\"=dword:00000050\n\n"
1075 "\"Wine7\"=\"No newline\"", &r
);
1076 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1078 todo_wine
verify_reg(hkey
, "Wine6", REG_DWORD
, &dword
, sizeof(dword
),
1079 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1080 err
= RegQueryValueExA(hkey
, "Wine7", NULL
, NULL
, NULL
, NULL
);
1081 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
1082 "got %d, expected 0\n", err
);
1083 if (err
== ERROR_SUCCESS
)
1084 verify_reg(hkey
, "Wine7", REG_SZ
, "No newline", 11, 0);
1086 test_import_str("REGEDIT4\n\n"
1087 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1089 "\"Wine8\"=\"Line 1\"\n"
1091 "\"Wine9\"=\"Line 2\"\n\n", &r
);
1092 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1093 todo_wine
verify_reg(hkey
, "Wine8", REG_SZ
, "Line 1", 7, 0);
1094 todo_wine
verify_reg(hkey
, "Wine9", REG_SZ
, "Line 2", 7, 0);
1096 test_import_str("REGEDIT4\n\n"
1097 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1098 "\"Wine10\"=\"Value 1\"#comment\n"
1099 "\"Wine11\"=\"Value 2\";comment\n"
1100 "\"Wine12\"=dword:01020304 #comment\n"
1101 "\"Wine13\"=dword:02040608 ;comment\n\n", &r
);
1102 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1103 todo_wine
verify_reg_nonexist(hkey
, "Wine10");
1104 todo_wine
verify_reg(hkey
, "Wine11", REG_SZ
, "Value 2", 8, 0);
1105 todo_wine
verify_reg_nonexist(hkey
, "Wine12");
1107 todo_wine
verify_reg(hkey
, "Wine13", REG_DWORD
, &dword
, sizeof(dword
), 0);
1109 test_import_str("REGEDIT4\n\n"
1110 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1111 "\"Wine14\"=hex(7):4c,69,6e,65,20,\\\n"
1113 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1114 "\"Wine15\"=\"A valid line\"\n"
1115 "\"Wine16\"=hex(7):4c,69,6e,65,20,\\\n"
1117 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1118 "\"Wine17\"=\"Another valid line\"\n\n", &r
);
1119 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1120 todo_wine
verify_reg_nonexist(hkey
, "Wine14");
1121 todo_wine
verify_reg(hkey
, "Wine15", REG_SZ
, "A valid line", 13, 0);
1122 todo_wine
verify_reg(hkey
, "Wine16", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1123 todo_wine
verify_reg(hkey
, "Wine17", REG_SZ
, "Another valid line", 19, 0);
1125 test_import_str("REGEDIT4\n\n"
1126 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1127 "#\"Comment1\"=\"Value 1\"\n"
1128 ";\"Comment2\"=\"Value 2\"\n"
1129 " #\"Comment3\"=\"Value 3\"\n"
1130 " ;\"Comment4\"=\"Value 4\"\n"
1131 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
1132 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r
);
1133 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1134 todo_wine
verify_reg_nonexist(hkey
, "Comment1");
1135 todo_wine
verify_reg_nonexist(hkey
, "Comment2");
1136 todo_wine
verify_reg_nonexist(hkey
, "Comment3");
1137 todo_wine
verify_reg_nonexist(hkey
, "Comment4");
1138 todo_wine
verify_reg_nonexist(hkey
, "Wine18");
1139 todo_wine
verify_reg_nonexist(hkey
, "Comment5");
1140 todo_wine
verify_reg(hkey
, "Wine19", REG_SZ
, "Value 7", 8, TODO_REG_SIZE
|TODO_REG_DATA
);
1141 todo_wine
verify_reg_nonexist(hkey
, "Comment6");
1143 test_import_str("REGEDIT4\n\n"
1144 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1145 "\"Wine20\"=#\"Value 8\"\n"
1146 "\"Wine21\"=;\"Value 9\"\n"
1147 "\"Wine22\"=\"#comment1\"\n"
1148 "\"Wine23\"=\";comment2\"\n"
1149 "\"Wine24\"=\"Value#comment3\"\n"
1150 "\"Wine25\"=\"Value;comment4\"\n"
1151 "\"Wine26\"=\"Value #comment5\"\n"
1152 "\"Wine27\"=\"Value ;comment6\"\n"
1153 "\"Wine28\"=#dword:00000001\n"
1154 "\"Wine29\"=;dword:00000002\n"
1155 "\"Wine30\"=dword:00000003#comment\n"
1156 "\"Wine31\"=dword:00000004;comment\n\n", &r
);
1157 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1158 todo_wine
verify_reg_nonexist(hkey
, "Wine20");
1159 todo_wine
verify_reg_nonexist(hkey
, "Wine21");
1160 todo_wine
verify_reg(hkey
, "Wine22", REG_SZ
, "#comment1", 10, 0);
1161 todo_wine
verify_reg(hkey
, "Wine23", REG_SZ
, ";comment2", 10, 0);
1162 todo_wine
verify_reg(hkey
, "Wine24", REG_SZ
, "Value#comment3", 15, 0);
1163 todo_wine
verify_reg(hkey
, "Wine25", REG_SZ
, "Value;comment4", 15, 0);
1164 todo_wine
verify_reg(hkey
, "Wine26", REG_SZ
, "Value #comment5", 16, 0);
1165 todo_wine
verify_reg(hkey
, "Wine27", REG_SZ
, "Value ;comment6", 16, 0);
1166 todo_wine
verify_reg_nonexist(hkey
, "Wine28");
1167 todo_wine
verify_reg_nonexist(hkey
, "Wine29");
1168 todo_wine
verify_reg_nonexist(hkey
, "Wine30");
1170 todo_wine
verify_reg(hkey
, "Wine31", REG_DWORD
, &dword
, sizeof(dword
), 0);
1172 test_import_str("REGEDIT4\n\n"
1173 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1174 "\"Multi-Line1\"=hex(7):4c,69,6e,65,20,\\\n"
1175 " 63,6f,6e,\\;comment\n"
1176 " 63,61,74,\\;comment\n"
1177 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1178 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1179 todo_wine
verify_reg(hkey
, "Multi-Line1", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1181 test_import_str("REGEDIT4\n\n"
1182 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1183 "\"Multi-Line2\"=hex(7):4c,69,6e,65,20,\\\n"
1184 " 63,6f,6e,\\;comment\n"
1185 " 63,61,74,;comment\n"
1186 " 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(hkey
, "Multi-Line2", REG_MULTI_SZ
, "Line concat", 12, 0);
1190 test_import_str("REGEDIT4\n\n"
1191 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1192 "\"Multi-Line3\"=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-Line3");
1197 test_import_str("REGEDIT4\n\n"
1198 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1199 "\"Multi-Line4\"=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-Line4");
1204 test_import_str("Windows Registry Editor Version 5.00\n\n"
1205 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1206 "\"Multi-Line5\"=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-Line5");
1211 test_import_str("Windows Registry Editor Version 5.00\n\n"
1212 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1213 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
1214 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1215 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1216 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line6");
1218 test_import_str("REGEDIT4\n\n"
1219 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1220 "\"Multi-Line7\"=hex(7):4c,69,6e,\\;comment\n"
1221 " 65,20,\\;comment\n"
1222 " 63,6f,6e,\\;comment\n"
1223 " 63,61,74,\\;comment\n"
1224 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1225 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1226 todo_wine
verify_reg(hkey
, "Multi-Line7", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1228 test_import_str("REGEDIT4\n\n"
1229 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1230 "\"Multi-Line8\"=hex(7):4c,69,6e,\\;#comment\n"
1231 " 65,20,\\;#comment\n"
1232 " 63,6f,6e,\\;#comment\n"
1233 " 63,61,74,\\;#comment\n"
1234 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1235 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1236 todo_wine
verify_reg(hkey
, "Multi-Line8", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1238 test_import_str("REGEDIT4\n\n"
1239 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1240 "\"Multi-Line9\"=hex(7):4c,69,6e,\\;comment\n"
1241 " 65,20,\\;comment\n"
1242 " 63,6f,6e,\\;comment\n"
1243 " 63,61,74,\\#comment\n"
1244 " 65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1245 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1246 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line9");
1248 test_import_str("REGEDIT4\n\n"
1249 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1250 "\"Multi-Line10\"=hex(7):4c,69,6e,65,20,\\\n"
1251 " 63,6f,6e,\\;comment\n"
1253 " 65,6e,\\;comment\n\n"
1254 " 61,74,69,6f,6e,00,00\n\n", &r
);
1255 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1256 todo_wine
verify_reg(hkey
, "Multi-Line10", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1258 test_import_str("REGEDIT4\n\n"
1259 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1260 "\"Wine32a\"=dword:1\n"
1261 "\"Wine32b\"=dword:4444\n\n", &r
);
1262 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1264 todo_wine
verify_reg(hkey
, "Wine32a", REG_DWORD
, &dword
, sizeof(dword
), 0);
1266 todo_wine
verify_reg(hkey
, "Wine32b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1268 test_import_str("REGEDIT4\n\n"
1269 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1270 "\"Wine33a\"=dword:\n"
1271 "\"Wine33b\"=dword:hello\n"
1272 "\"Wine33c\"=dword:123456789\n"
1273 "\"Wine33d\"=dword:012345678\n"
1274 "\"Wine33e\"=dword:000000001\n\n", &r
);
1275 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1276 todo_wine
verify_reg_nonexist(hkey
, "Wine33a");
1277 todo_wine
verify_reg_nonexist(hkey
, "Wine33b");
1278 todo_wine
verify_reg_nonexist(hkey
, "Wine33c");
1279 todo_wine
verify_reg_nonexist(hkey
, "Wine33d");
1280 todo_wine
verify_reg_nonexist(hkey
, "Wine33e");
1282 test_import_str("REGEDIT4\n\n"
1283 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1284 "\"Wine34a\"=dword:12345678abc\n"
1285 "\"Wine34b\"=dword:12345678 abc\n\n", &r
);
1286 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1287 todo_wine
verify_reg_nonexist(hkey
, "Wine34a");
1288 todo_wine
verify_reg_nonexist(hkey
, "Wine34b");
1290 test_import_str("REGEDIT4\n\n"
1291 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1292 "\"Wine35a\"=dword:0x123\n"
1293 "\"Wine35b\"=dword:123 456\n"
1294 "\"Wine35c\"=dword:1234 5678\n\n", &r
);
1295 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1296 todo_wine
verify_reg_nonexist(hkey
, "Wine35a");
1297 todo_wine
verify_reg_nonexist(hkey
, "Wine35b");
1298 todo_wine
verify_reg_nonexist(hkey
, "Wine35c");
1300 test_import_str("REGEDIT4\n\n"
1301 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1302 "\"Wine36a\"=dword:1234;5678\n"
1303 "\"Wine36b\"=dword:1234 ;5678\n"
1304 "\"Wine36c\"=dword:1234#5678\n"
1305 "\"Wine36d\"=dword:1234 #5678\n\n", &r
);
1306 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1308 todo_wine
verify_reg(hkey
, "Wine36a", REG_DWORD
, &dword
, sizeof(dword
), 0);
1309 todo_wine
verify_reg(hkey
, "Wine36b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1310 todo_wine
verify_reg_nonexist(hkey
, "Wine36c");
1311 todo_wine
verify_reg_nonexist(hkey
, "Wine36d");
1313 test_import_str("REGEDIT4\n\n"
1314 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1315 "\"Wine37a\"=\"foo\"bar\"\n"
1316 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r
);
1317 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1318 todo_wine
verify_reg_nonexist(hkey
, "Wine37a");
1319 todo_wine
verify_reg_nonexist(hkey
, "Wine37b");
1321 test_import_str("REGEDIT4\n\n"
1322 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1323 "\"Empty string\"=\"\"\n"
1324 "\"\"=\"Default Value Name\"\n\n", &r
);
1325 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1326 todo_wine
verify_reg(hkey
, "Empty string", REG_SZ
, "", 1, 0);
1327 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default Value Name", 19, 0);
1329 test_import_str("REGEDIT4\n\n"
1330 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1332 "\"Test38b\"=\\\"\n"
1333 "\"Test38c\"=\\\"Value\\\"\n"
1334 "\"Test38d\"=\\\"Value\"\n\n", &r
);
1335 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1336 todo_wine
verify_reg_nonexist(hkey
, "Test38a");
1337 todo_wine
verify_reg_nonexist(hkey
, "Test38b");
1338 todo_wine
verify_reg_nonexist(hkey
, "Test38c");
1339 todo_wine
verify_reg_nonexist(hkey
, "Test38d");
1341 test_import_str("REGEDIT4\n\n"
1342 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1343 "\"Wine39a\"=\"Value1\" ;comment\n"
1344 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
1345 "\"Wine39c\"=\"Value3\" #comment\n"
1346 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r
);
1347 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1348 todo_wine
verify_reg(hkey
, "Wine39a", REG_SZ
, "Value1", 7, 0);
1349 todo_wine
verify_reg(hkey
, "Wine39b", REG_SZ
, "Value2", 7, 0);
1350 todo_wine
verify_reg_nonexist(hkey
, "Wine39c");
1351 todo_wine
verify_reg_nonexist(hkey
, "Wine39d");
1353 test_import_str("REGEDIT4\n\n"
1354 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1355 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r
);
1356 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1357 todo_wine
verify_reg_nonexist(hkey
, "TestNoBeginQuote");
1359 test_import_str("REGEDIT4\n\n"
1360 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1361 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r
);
1362 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1363 todo_wine
verify_reg_nonexist(hkey
, "TestNoEndQuote");
1365 test_import_str("REGEDIT4\n\n"
1366 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1367 "\"TestNoQuotes\"=Asdffdsa\n", &r
);
1368 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1369 todo_wine
verify_reg_nonexist(hkey
, "TestNoQuotes");
1371 test_import_str("REGEDIT4\n\n"
1372 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1373 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r
);
1374 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1375 todo_wine
verify_reg_nonexist(hkey
, "NameNoBeginQuote");
1377 test_import_str("REGEDIT4\n\n"
1378 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1379 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r
);
1380 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1381 todo_wine
verify_reg_nonexist(hkey
, "NameNoEndQuote");
1383 test_import_str("REGEDIT4\n\n"
1384 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1385 "NameNoQuotes=\"Asdffdsa\"\n", &r
);
1386 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1387 todo_wine
verify_reg_nonexist(hkey
, "NameNoQuotes");
1389 test_import_str("REGEDIT4\n\n"
1390 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1391 "\"MixedQuotes=Asdffdsa\"\n", &r
);
1392 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1393 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes");
1394 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes=Asdffdsa");
1396 test_import_str("REGEDIT4\n\n"
1397 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1398 "\"Wine40a\"=hex(2):4c,69,6e,65,00\n"
1399 "\"Wine40b\"=\"Value 1\"\n"
1400 "\"Wine40c\"=hex(2):4c,69,6e,65\\\n"
1401 "\"Wine40d\"=\"Value 2\"\n"
1402 "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n"
1403 "\"Wine40f\"=\"Value 3\"\n"
1404 "\"Wine40g\"=\"Value 4\"\n\n", &r
);
1405 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1406 todo_wine
verify_reg(hkey
, "Wine40a", REG_EXPAND_SZ
, "Line", 5, 0);
1407 todo_wine
verify_reg(hkey
, "Wine40b", REG_SZ
, "Value 1", 8, 0);
1408 todo_wine
verify_reg_nonexist(hkey
, "Wine40c");
1409 todo_wine
verify_reg(hkey
, "Wine40d", REG_SZ
, "Value 2", 8, 0);
1410 todo_wine
verify_reg_nonexist(hkey
, "Wine40e");
1411 todo_wine
verify_reg_nonexist(hkey
, "Wine40f");
1412 todo_wine
verify_reg(hkey
, "Wine40g", REG_SZ
, "Value 4", 8, 0);
1414 test_import_str("REGEDIT4\n\n"
1415 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1416 "\"Wine41a\"=dword:1234\\\n"
1418 "\"Wine41b\"=\"Test \\\n"
1420 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1421 todo_wine
verify_reg_nonexist(hkey
, "Wine41a");
1422 todo_wine
verify_reg_nonexist(hkey
, "Wine41b");
1424 test_import_str("REGEDIT4\n\n"
1425 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1426 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
1427 "\"single'quote\"=dword:00000008\n\n", &r
);
1428 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1429 todo_wine
verify_reg(hkey
, "double\"quote", REG_SZ
, "valid \"or\" not", 15, 0);
1431 todo_wine
verify_reg(hkey
, "single'quote", REG_DWORD
, &dword
, sizeof(dword
), 0);
1433 /* Test key name and value name concatenation */
1434 test_import_str("REGEDIT4\n\n"
1435 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\\n"
1437 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1438 err
= RegOpenKeyExA(hkey
, "Subkey1", 0, KEY_READ
, &subkey
);
1439 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
1441 test_import_str("REGEDIT4\n\n"
1442 "[HKEY_CURRENT_USER\\" KEY_BASE
"\n"
1443 "\\Subkey2]\n", &r
);
1444 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1445 err
= RegOpenKeyExA(hkey
, "Subkey2", 0, KEY_READ
, &subkey
);
1446 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
1448 test_import_str("REGEDIT4\n\n"
1449 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1451 "42a\"=\"Value 1\"\n"
1452 "\"Wine42b\"=\"Value 2\"\n"
1454 "\\42c\"=\"Value 3\"\n\n", &r
);
1455 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1456 todo_wine
verify_reg_nonexist(hkey
, "Wine42a");
1457 todo_wine
verify_reg(hkey
, "Wine42b", REG_SZ
, "Value 2", 8, 0);
1458 todo_wine
verify_reg_nonexist(hkey
, "Wine42c");
1460 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
1461 test_import_str("REGEDIT4\n\n"
1462 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1463 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
1464 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
1465 " 75,00,65,00,00,00\n"
1466 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
1467 ",75,00,65,00,00,00\n"
1468 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
1469 " ,75,00,65,00,00,00\n"
1470 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
1471 " 75,00,65,00,00,00\n"
1472 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
1473 "5,00,65,00,00,00\n"
1474 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
1475 " 5,00,65,00,00,00\n"
1476 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
1479 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
1482 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
1483 " 6c,00,75,00,;comment\n"
1485 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
1486 " 6c,00,75,00,\\#comment\n"
1487 " 65,00,00,00\n\n", &r
);
1488 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1489 todo_wine
verify_reg(hkey
, "Wine43a", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1490 todo_wine
verify_reg(hkey
, "Wine43b", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1491 todo_wine
verify_reg_nonexist(hkey
, "Wine43c");
1492 todo_wine
verify_reg_nonexist(hkey
, "Wine43d");
1493 todo_wine
verify_reg_nonexist(hkey
, "Wine43e");
1494 todo_wine
verify_reg_nonexist(hkey
, "Wine43f");
1495 todo_wine
verify_reg_nonexist(hkey
, "Wine43g");
1496 todo_wine
verify_reg(hkey
, "Wine43h", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1497 todo_wine
verify_reg(hkey
, "Wine43i", REG_NONE
, "V\0a\0l\0u", 8, 0);
1498 todo_wine
verify_reg(hkey
, "Wine43j", REG_NONE
, "V\0a\0l\0u", 8, 0);
1499 todo_wine
verify_reg_nonexist(hkey
, "Wine43k");
1501 test_import_str("REGEDIT4\n\n"
1502 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1503 "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n"
1504 "\"Wine44b\"=hex(2):25,50,41,\\\n"
1506 "\"Wine44c\"=hex(2):25,50,41\\\n"
1508 "\"Wine44d\"=hex(2):25,50,41\\\n"
1510 "\"Wine44e\"=hex(2):25,50,41\\\n"
1512 "\"Wine44f\"=hex(2):25,50,4\\\n"
1514 "\"Wine44g\"=hex(2):25,50,4\\\n"
1516 "\"Wine44h\"=hex(2):25,50,41,\\;comment\n"
1519 "\"Wine44i\"=hex(2):25,50,41,\\;comment\n"
1522 "\"Wine44j\"=hex(2):25,50,41,\\;comment\n"
1525 "\"Wine44k\"=hex(2):25,50,41,\\;comment\n"
1526 " 54,48,\\#comment\n"
1528 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1529 todo_wine
verify_reg(hkey
, "Wine44a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1530 todo_wine
verify_reg(hkey
, "Wine44b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1531 todo_wine
verify_reg_nonexist(hkey
, "Wine44c");
1532 todo_wine
verify_reg_nonexist(hkey
, "Wine44d");
1533 todo_wine
verify_reg_nonexist(hkey
, "Wine44e");
1534 todo_wine
verify_reg_nonexist(hkey
, "Wine44f");
1535 todo_wine
verify_reg_nonexist(hkey
, "Wine44g");
1536 todo_wine
verify_reg(hkey
, "Wine44h", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1538 size
= sizeof(buffer
);
1539 err
= RegQueryValueExA(hkey
, "Wine44i", NULL
, &type
, (BYTE
*)&buffer
, &size
);
1540 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
1541 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
1542 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
1543 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
1545 size
= sizeof(buffer
);
1546 memset(buffer
, '-', size
);
1547 err
= RegQueryValueExA(hkey
, "Wine44j", NULL
, &type
, (BYTE
*)&buffer
, &size
);
1548 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
1549 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
1550 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
1551 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
1553 todo_wine
verify_reg_nonexist(hkey
, "Wine44k");
1555 test_import_str("REGEDIT4\n\n"
1556 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1557 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
1558 "\"Wine45b\"=hex:11,22,33,44,\\\n"
1560 "\"Wine45c\"=hex:11,22,33,44\\\n"
1562 "\"Wine45d\"=hex:11,22,33,44\\\n"
1564 "\"Wine45e\"=hex:11,22,33,44\\\n"
1566 "\"Wine45f\"=hex:11,22,33,4\\\n"
1568 "\"Wine45g\"=hex:11,22,33,4\\\n"
1570 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
1573 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
1576 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
1579 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
1580 " 44,55,66,\\#comment\n"
1582 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1583 hex
[0] = 0x11; hex
[1] = 0x22; hex
[2] = 0x33; hex
[3] = 0x44;
1584 hex
[4] = 0x55; hex
[5] = 0x66; hex
[6] = 0x77; hex
[7] = 0x88;
1585 todo_wine
verify_reg(hkey
, "Wine45a", REG_BINARY
, hex
, sizeof(hex
), 0);
1586 todo_wine
verify_reg(hkey
, "Wine45b", REG_BINARY
, hex
, sizeof(hex
), 0);
1587 todo_wine
verify_reg_nonexist(hkey
, "Wine45c");
1588 todo_wine
verify_reg_nonexist(hkey
, "Wine45d");
1589 todo_wine
verify_reg_nonexist(hkey
, "Wine45e");
1590 todo_wine
verify_reg_nonexist(hkey
, "Wine45f");
1591 todo_wine
verify_reg_nonexist(hkey
, "Wine45g");
1592 todo_wine
verify_reg(hkey
, "Wine45h", REG_BINARY
, hex
, sizeof(hex
), 0);
1593 todo_wine
verify_reg(hkey
, "Wine45i", REG_BINARY
, hex
, 6, 0);
1594 todo_wine
verify_reg(hkey
, "Wine45j", REG_BINARY
, hex
, 6, 0);
1595 todo_wine
verify_reg_nonexist(hkey
, "Wine45k");
1597 /* Test import with subkeys */
1598 test_import_str("REGEDIT4\n\n"
1599 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey\"1]\n"
1600 "\"Wine\\\\31\"=\"Test value\"\n\n", &r
);
1601 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1602 err
= RegOpenKeyExA(hkey
, "Subkey\"1", 0, KEY_READ
, &subkey
);
1603 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1604 todo_wine
verify_reg(subkey
, "Wine\\31", REG_SZ
, "Test value", 11, 0);
1605 err
= RegCloseKey(subkey
);
1606 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1607 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey\"1");
1608 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1610 test_import_str("REGEDIT4\n\n"
1611 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey/2]\n"
1612 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r
);
1613 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1614 err
= RegOpenKeyExA(hkey
, "Subkey/2", 0, KEY_READ
, &subkey
);
1615 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1616 todo_wine
verify_reg(subkey
, "123/\"4;'5", REG_SZ
, "Random value name", 18, 0);
1617 err
= RegCloseKey(subkey
);
1618 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1619 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey/2");
1620 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1622 /* Test key creation */
1623 test_import_str("REGEDIT4\n\n"
1624 "HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Opening_Bracket]\n", &r
);
1625 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1626 todo_wine
verify_key_nonexist(hkey
, "No_Opening_Bracket");
1628 test_import_str("REGEDIT4\n\n"
1629 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Closing_Bracket\n", &r
);
1630 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1631 todo_wine
verify_key_nonexist(hkey
, "No_Closing_Bracket");
1633 test_import_str("REGEDIT4\n\n"
1634 "[ HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1a]\n", &r
);
1635 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1636 todo_wine
verify_key_nonexist(hkey
, "Subkey1a");
1638 test_import_str("REGEDIT4\n\n"
1639 "[\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1b]\n", &r
);
1640 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1641 todo_wine
verify_key_nonexist(hkey
, "Subkey1b");
1643 test_import_str("REGEDIT4\n\n"
1644 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1c ]\n", &r
);
1645 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1646 todo_wine
verify_key_exist(hkey
, "Subkey1c ");
1647 err
= RegDeleteKeyA(hkey
, "Subkey1c ");
1648 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1650 test_import_str("REGEDIT4\n\n"
1651 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1d\t]\n", &r
);
1652 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1653 todo_wine
verify_key_exist(hkey
, "Subkey1d\t");
1654 err
= RegDeleteKeyA(hkey
, "Subkey1d\t");
1655 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1657 /* Test key deletion. We start by creating some registry keys. */
1658 test_import_str("REGEDIT4\n\n"
1659 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1660 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1661 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1662 todo_wine
verify_key_exist(hkey
, "Subkey2a");
1663 todo_wine
verify_key_exist(hkey
, "Subkey2b");
1665 test_import_str("REGEDIT4\n\n"
1666 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1667 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1668 todo_wine
verify_key_exist(hkey
, "Subkey2a");
1670 test_import_str("REGEDIT4\n\n"
1671 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1672 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1673 todo_wine
verify_key_exist(hkey
, "Subkey2b");
1675 test_import_str("REGEDIT4\n\n"
1676 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1677 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1678 todo_wine
verify_key_exist(hkey
, "Subkey2a");
1680 test_import_str("REGEDIT4\n\n"
1681 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1682 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1683 todo_wine
verify_key_exist(hkey
, "Subkey2b");
1685 test_import_str("REGEDIT4\n\n"
1686 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1687 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1688 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1689 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
1690 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
1692 /* Test case sensitivity when creating and deleting registry keys. */
1693 test_import_str("REGEDIT4\n\n"
1694 "[hkey_CURRENT_user\\" KEY_BASE
"\\Subkey3a]\n\n"
1695 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE
"\\SuBkEy3b]\n\n", &r
);
1696 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1697 todo_wine
verify_key_exist(hkey
, "Subkey3a");
1698 todo_wine
verify_key_exist(hkey
, "Subkey3b");
1700 test_import_str("REGEDIT4\n\n"
1701 "[-HKEY_current_USER\\" KEY_BASE
"\\sUBKEY3A]\n\n"
1702 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE
"\\sUbKeY3B]\n\n", &r
);
1703 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1704 todo_wine
verify_key_nonexist(hkey
, "Subkey3a");
1705 todo_wine
verify_key_nonexist(hkey
, "Subkey3b");
1707 /* Test value deletion. We start by creating some registry values. */
1708 test_import_str("REGEDIT4\n\n"
1709 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1710 "\"Wine46a\"=\"Test Value\"\n"
1711 "\"Wine46b\"=dword:00000008\n"
1712 "\"Wine46c\"=hex:11,22,33,44\n"
1713 "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n"
1714 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1715 "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n"
1716 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
1717 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1718 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
1719 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1720 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
1721 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1722 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1723 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1725 test_import_str("REGEDIT4\n\n"
1726 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1729 "\"Wine46c\"= \t-\t \n"
1730 "\"Wine46d\"=-\"Test\"\n"
1731 "\"Wine46e\"=- ;comment\n"
1732 "\"Wine46f\"=- #comment\n\n", &r
);
1733 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1734 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
1735 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
1736 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
1737 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1738 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
1739 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1741 /* Test the accepted range of the hex-based data types */
1742 test_import_str("REGEDIT4\n\n"
1743 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1744 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
1745 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
1746 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
1747 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
1748 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
1749 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
1750 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
1751 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
1752 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n\n", &r
);
1753 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1754 todo_wine
verify_reg(hkey
, "Wine47a", REG_NONE
, "Value", 6, 0);
1755 todo_wine
verify_reg(hkey
, "Wine47b", 0x10, "Value", 6, 0);
1756 todo_wine
verify_reg(hkey
, "Wine47c", 0x100, "Value", 6, 0);
1757 todo_wine
verify_reg(hkey
, "Wine47d", 0x1000, "Value", 6, 0);
1758 todo_wine
verify_reg(hkey
, "Wine47e", 0x7fff, "Value", 6, 0);
1759 todo_wine
verify_reg(hkey
, "Wine47f", 0xffff, "Value", 6, 0);
1760 todo_wine
verify_reg(hkey
, "Wine47g", 0x7fffffff, "Value", 6, 0);
1761 todo_wine
verify_reg(hkey
, "Wine47h", 0xffffffff, "Value", 6, 0);
1762 todo_wine
verify_reg_nonexist(hkey
, "Wine47i");
1764 test_import_str("REGEDIT4\n\n"
1765 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1766 "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n"
1767 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1768 "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n"
1769 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
1770 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1771 todo_wine
verify_reg(hkey
, "Wine48a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1772 todo_wine
verify_reg(hkey
, "Wine48b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1774 test_import_str("REGEDIT4\n\n"
1775 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1776 "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\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
, "Wine49", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1780 test_import_str("REGEDIT4\n\n"
1781 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1782 "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n"
1783 "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n"
1784 "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n"
1785 "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r
);
1786 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1787 todo_wine
verify_reg(hkey
, "Wine50a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1788 todo_wine
verify_reg(hkey
, "Wine50b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1789 todo_wine
verify_reg_nonexist(hkey
, "Wine50c");
1790 todo_wine
verify_reg_nonexist(hkey
, "Wine50d");
1792 /* Test support for characters greater than 0xff */
1793 test_import_str("REGEDIT4\n\n"
1794 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1795 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
1796 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r
);
1797 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1798 todo_wine
verify_reg_nonexist(hkey
, "Wine51a");
1799 todo_wine
verify_reg_nonexist(hkey
, "Wine51b");
1801 /* Test the effect of backslashes in hex data */
1802 test_import_str("REGEDIT4\n\n"
1803 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1804 "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n"
1805 "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n"
1806 "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n"
1807 "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n"
1808 "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n"
1809 "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n"
1810 "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n"
1811 "\"Wine52h\"=hex(2):25,48,4\\\n"
1813 "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n"
1814 "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n"
1815 " 25,50,41,54,48,25,00\n"
1816 "\"Wine52k\"=hex(2):,\\\n"
1817 " 25,48,4f,4d,45,25,00\n"
1818 "\"Wine52l\"=hex(2):\\\n"
1819 " 25,48,4f,4d,45,25,00\n\n", &r
);
1820 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1821 todo_wine
verify_reg_nonexist(hkey
, "Wine52a");
1822 todo_wine
verify_reg_nonexist(hkey
, "Wine52b");
1823 todo_wine
verify_reg_nonexist(hkey
, "Wine52c");
1824 todo_wine
verify_reg_nonexist(hkey
, "Wine52d");
1825 todo_wine
verify_reg_nonexist(hkey
, "Wine52e");
1826 todo_wine
verify_reg_nonexist(hkey
, "Wine52f");
1827 todo_wine
verify_reg_nonexist(hkey
, "Wine52g");
1828 todo_wine
verify_reg_nonexist(hkey
, "Wine52h");
1829 todo_wine
verify_reg_nonexist(hkey
, "Wine52i");
1830 todo_wine
verify_reg_nonexist(hkey
, "Wine52j");
1831 todo_wine
verify_reg_nonexist(hkey
, "Wine52k");
1832 todo_wine
verify_reg(hkey
, "Wine52l", REG_EXPAND_SZ
, "%HOME%", 7, 0);
1834 err
= RegCloseKey(hkey
);
1835 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1837 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
1838 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1840 /* Test file contents - Unicode */
1841 test_import_wstr("REGEDIT\n", &r
);
1842 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1843 "got exit code %d, expected 1\n", r
);
1845 test_import_wstr("REGEDIT4\n", &r
);
1846 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1847 "got exit code %d, expected 1\n", r
);
1849 test_import_wstr("\xef\xbb\xbfREGEDIT", &r
);
1850 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1852 test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r
);
1853 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1855 test_import_wstr("\xef\xbb\xbfREGEDIT4", &r
);
1856 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1858 test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r
);
1859 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1861 test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r
);
1862 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1864 test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r
);
1865 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1867 test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r
);
1868 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1869 "got exit code %d, expected 1\n", r
);
1871 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1872 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n", &r
);
1873 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1875 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
1876 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1878 test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n"
1879 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1880 "\"Test1\"=\"Value\"\n", &r
);
1881 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1882 todo_wine
verify_reg_nonexist(hkey
, "Test1");
1884 test_import_wstr("\xef\xbb\xbfregedit4\n\n"
1885 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1886 "\"Test2\"=\"Value\"\n", &r
);
1887 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1888 "got exit code %d, expected 1\n", r
);
1889 todo_wine
verify_reg_nonexist(hkey
, "Test2");
1891 test_import_wstr("\xef\xbb\xbfRegedit4\n\n"
1892 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1893 "\"Test3\"=\"Value\"\n", &r
);
1894 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1895 "got exit code %d, expected 1\n", r
);
1896 todo_wine
verify_reg_nonexist(hkey
, "Test3");
1898 test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n"
1899 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1900 "\"Test4\"=\"Value\"\n", &r
);
1901 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1902 todo_wine
verify_reg_nonexist(hkey
, "Test4");
1904 test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n"
1905 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1906 "\"Test5\"=\"Value\"\n", &r
);
1907 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1908 todo_wine
verify_reg_nonexist(hkey
, "Test5");
1910 test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n"
1911 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1912 "\"Test6\"=\"Value\"\n", &r
);
1913 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1914 todo_wine
verify_reg_nonexist(hkey
, "Test6");
1916 test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n"
1917 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1918 "\"Test7\"=\"Value\"\n", &r
);
1919 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1920 todo_wine
verify_reg_nonexist(hkey
, "Test7");
1922 test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n"
1923 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1924 "\"Test8\"=\"Value\"\n", &r
);
1925 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1926 todo_wine
verify_reg_nonexist(hkey
, "Test8");
1928 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1929 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1930 "\"Unicode1\"=\"Value1\"\n", &r
);
1931 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1932 todo_wine
verify_reg(hkey
, "Unicode1", REG_SZ
, "Value1", 7, 0);
1934 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1935 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1936 "\"Unicode2\"=\"Value2\"\n\n", &r
);
1937 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1938 todo_wine
verify_reg(hkey
, "Unicode2", REG_SZ
, "Value2", 7, 0);
1940 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1941 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1942 "\"Unicode3\"=\"Value3\"\n\n", &r
);
1943 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1944 todo_wine
verify_reg(hkey
, "Unicode3", REG_SZ
, "Value3", 7, 0);
1946 test_import_wstr("Windows Registry Editor Version 4.00\n", &r
);
1947 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1948 "got exit code %d, expected 1\n", r
);
1950 test_import_wstr("Windows Registry Editor Version 5.00\n", &r
);
1951 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1952 "got exit code %d, expected 1\n", r
);
1954 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r
);
1955 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1956 "got exit code %d, expected 1\n", r
);
1958 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r
);
1959 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1961 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r
);
1962 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1964 test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r
);
1965 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1966 "got exit code %d, expected 1\n", r
);
1968 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r
);
1969 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1971 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r
);
1972 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1974 test_import_wstr("\xef\xbb\xbf\nWindows Registry Editor Version 5.00\n", &r
);
1975 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1976 "got exit code %d, expected 1\n", r
);
1978 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n"
1979 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1980 "\"Test9\"=\"Value\"\n", &r
);
1981 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1982 "got exit code %d, expected 1\n", r
);
1983 todo_wine
verify_reg_nonexist(hkey
, "Test9");
1985 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n"
1986 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1987 "\"Test10\"=\"Value\"\n", &r
);
1988 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1989 "got exit code %d, expected 1\n", r
);
1990 todo_wine
verify_reg_nonexist(hkey
, "Test10");
1992 test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
1993 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1994 "\"Test11\"=\"Value\"\n", &r
);
1995 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1996 "got exit code %d, expected 1\n", r
);
1997 todo_wine
verify_reg_nonexist(hkey
, "Test11");
1999 test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n"
2000 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2001 "\"Test12\"=\"Value\"\n", &r
);
2002 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
2003 "got exit code %d, expected 1\n", r
);
2004 todo_wine
verify_reg_nonexist(hkey
, "Test12");
2006 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
2007 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2008 "\"Unicode4\"=\"Value4\"\n", &r
);
2009 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2010 todo_wine
verify_reg(hkey
, "Unicode4", REG_SZ
, "Value4", 7, 0);
2012 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
2013 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2014 "\"Unicode5\"=\"Value5\"\n\n", &r
);
2015 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2016 todo_wine
verify_reg(hkey
, "Unicode5", REG_SZ
, "Value5", 7, 0);
2018 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2019 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2020 "\"Unicode6\"=\"Value6\"\n\n", &r
);
2021 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2022 todo_wine
verify_reg(hkey
, "Unicode6", REG_SZ
, "Value6", 7, 0);
2024 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2025 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2026 "\"Line1\"=\"Value1\"\n\n"
2027 "\"Line2\"=\"Value2\"\n\n\n"
2028 "\"Line3\"=\"Value3\"\n\n\n\n"
2029 "\"Line4\"=\"Value4\"\n\n", &r
);
2030 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2031 todo_wine
verify_reg(hkey
, "Line1", REG_SZ
, "Value1", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2032 todo_wine
verify_reg(hkey
, "Line2", REG_SZ
, "Value2", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2033 todo_wine
verify_reg(hkey
, "Line3", REG_SZ
, "Value3", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2034 todo_wine
verify_reg(hkey
, "Line4", REG_SZ
, "Value4", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2036 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2037 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2038 "\"Wine1\"=dword:00000782\n\n"
2039 "\"Wine2\"=\"Test Value\"\n"
2040 "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2041 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2045 "\"Wine4\"=dword:12345678\n\n", &r
);
2046 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2048 todo_wine
verify_reg(hkey
, "Wine1", REG_DWORD
, &dword
, sizeof(dword
),
2049 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2050 todo_wine
verify_reg(hkey
, "Wine2", REG_SZ
, "Test Value", 11,
2051 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2052 todo_wine
verify_reg(hkey
, "Wine3", REG_MULTI_SZ
, "Line concatenation\0", 20,
2053 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2054 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test", 5,
2055 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2057 todo_wine
verify_reg(hkey
, "Wine4", REG_DWORD
, &dword
, sizeof(dword
),
2058 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2060 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2061 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2062 "\"Wine5\"=\"No newline\"", &r
);
2063 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2064 err
= RegQueryValueExA(hkey
, "Wine5", NULL
, NULL
, NULL
, NULL
);
2065 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
2066 "got %d, expected 0\n", err
);
2067 if (err
== ERROR_SUCCESS
)
2068 verify_reg(hkey
, "Wine5", REG_SZ
, "No newline", 11, 0);
2070 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2071 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2072 "\"Wine6\"=dword:00000050\n\n"
2073 "\"Wine7\"=\"No newline\"", &r
);
2074 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2076 todo_wine
verify_reg(hkey
, "Wine6", REG_DWORD
, &dword
, sizeof(dword
),
2077 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
2078 err
= RegQueryValueExA(hkey
, "Wine7", NULL
, NULL
, NULL
, NULL
);
2079 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
2080 "got %d, expected 0\n", err
);
2081 if (err
== ERROR_SUCCESS
)
2082 verify_reg(hkey
, "Wine7", REG_SZ
, "No newline", 11, 0);
2084 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2085 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2087 "\"Wine8\"=\"Line 1\"\n"
2089 "\"Wine9\"=\"Line 2\"\n\n", &r
);
2090 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2091 todo_wine
verify_reg(hkey
, "Wine8", REG_SZ
, "Line 1", 7, 0);
2092 todo_wine
verify_reg(hkey
, "Wine9", REG_SZ
, "Line 2", 7, 0);
2094 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2095 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2096 "\"Wine10\"=\"Value 1\"#comment\n"
2097 "\"Wine11\"=\"Value 2\";comment\n"
2098 "\"Wine12\"=dword:01020304 #comment\n"
2099 "\"Wine13\"=dword:02040608 ;comment\n\n", &r
);
2100 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2101 todo_wine
verify_reg_nonexist(hkey
, "Wine10");
2102 todo_wine
verify_reg(hkey
, "Wine11", REG_SZ
, "Value 2", 8, 0);
2103 todo_wine
verify_reg_nonexist(hkey
, "Wine12");
2105 todo_wine
verify_reg(hkey
, "Wine13", REG_DWORD
, &dword
, sizeof(dword
), 0);
2107 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2108 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2109 "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2111 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2112 "\"Wine15\"=\"A valid line\"\n"
2113 "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2115 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2116 "\"Wine17\"=\"Another valid line\"\n\n", &r
);
2117 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2118 todo_wine
verify_reg_nonexist(hkey
, "Wine14");
2119 todo_wine
verify_reg(hkey
, "Wine15", REG_SZ
, "A valid line", 13, 0);
2120 todo_wine
verify_reg(hkey
, "Wine16", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2121 todo_wine
verify_reg(hkey
, "Wine17", REG_SZ
, "Another valid line", 19, 0);
2123 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2124 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2125 "#\"Comment1\"=\"Value 1\"\n"
2126 ";\"Comment2\"=\"Value 2\"\n"
2127 " #\"Comment3\"=\"Value 3\"\n"
2128 " ;\"Comment4\"=\"Value 4\"\n"
2129 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
2130 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r
);
2131 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2132 todo_wine
verify_reg_nonexist(hkey
, "Comment1");
2133 todo_wine
verify_reg_nonexist(hkey
, "Comment2");
2134 todo_wine
verify_reg_nonexist(hkey
, "Comment3");
2135 todo_wine
verify_reg_nonexist(hkey
, "Comment4");
2136 todo_wine
verify_reg_nonexist(hkey
, "Wine18");
2137 todo_wine
verify_reg_nonexist(hkey
, "Comment5");
2138 todo_wine
verify_reg(hkey
, "Wine19", REG_SZ
, "Value 7", 8, TODO_REG_SIZE
|TODO_REG_DATA
);
2139 todo_wine
verify_reg_nonexist(hkey
, "Comment6");
2141 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2142 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2143 "\"Wine20\"=#\"Value 8\"\n"
2144 "\"Wine21\"=;\"Value 9\"\n"
2145 "\"Wine22\"=\"#comment1\"\n"
2146 "\"Wine23\"=\";comment2\"\n"
2147 "\"Wine24\"=\"Value#comment3\"\n"
2148 "\"Wine25\"=\"Value;comment4\"\n"
2149 "\"Wine26\"=\"Value #comment5\"\n"
2150 "\"Wine27\"=\"Value ;comment6\"\n"
2151 "\"Wine28\"=#dword:00000001\n"
2152 "\"Wine29\"=;dword:00000002\n"
2153 "\"Wine30\"=dword:00000003#comment\n"
2154 "\"Wine31\"=dword:00000004;comment\n\n", &r
);
2155 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2156 todo_wine
verify_reg_nonexist(hkey
, "Wine20");
2157 todo_wine
verify_reg_nonexist(hkey
, "Wine21");
2158 todo_wine
verify_reg(hkey
, "Wine22", REG_SZ
, "#comment1", 10, 0);
2159 todo_wine
verify_reg(hkey
, "Wine23", REG_SZ
, ";comment2", 10, 0);
2160 todo_wine
verify_reg(hkey
, "Wine24", REG_SZ
, "Value#comment3", 15, 0);
2161 todo_wine
verify_reg(hkey
, "Wine25", REG_SZ
, "Value;comment4", 15, 0);
2162 todo_wine
verify_reg(hkey
, "Wine26", REG_SZ
, "Value #comment5", 16, 0);
2163 todo_wine
verify_reg(hkey
, "Wine27", REG_SZ
, "Value ;comment6", 16, 0);
2164 todo_wine
verify_reg_nonexist(hkey
, "Wine28");
2165 todo_wine
verify_reg_nonexist(hkey
, "Wine29");
2166 todo_wine
verify_reg_nonexist(hkey
, "Wine30");
2168 todo_wine
verify_reg(hkey
, "Wine31", REG_DWORD
, &dword
, sizeof(dword
), 0);
2170 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2171 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2172 "\"Wine32a\"=dword:1\n"
2173 "\"Wine32b\"=dword:4444\n\n", &r
);
2174 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2176 todo_wine
verify_reg(hkey
, "Wine32a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2178 todo_wine
verify_reg(hkey
, "Wine32b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2180 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2181 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2182 "\"Wine33a\"=dword:\n"
2183 "\"Wine33b\"=dword:hello\n"
2184 "\"Wine33c\"=dword:123456789\n"
2185 "\"Wine33d\"=dword:012345678\n"
2186 "\"Wine33e\"=dword:000000001\n\n", &r
);
2187 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2188 todo_wine
verify_reg_nonexist(hkey
, "Wine33a");
2189 todo_wine
verify_reg_nonexist(hkey
, "Wine33b");
2190 todo_wine
verify_reg_nonexist(hkey
, "Wine33c");
2191 todo_wine
verify_reg_nonexist(hkey
, "Wine33d");
2192 todo_wine
verify_reg_nonexist(hkey
, "Wine33e");
2194 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2195 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2196 "\"Wine34a\"=dword:12345678abc\n"
2197 "\"Wine34b\"=dword:12345678 abc\n\n", &r
);
2198 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2199 todo_wine
verify_reg_nonexist(hkey
, "Wine34a");
2200 todo_wine
verify_reg_nonexist(hkey
, "Wine34b");
2202 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2203 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2204 "\"Wine35a\"=dword:0x123\n"
2205 "\"Wine35b\"=dword:123 456\n"
2206 "\"Wine35c\"=dword:1234 5678\n\n", &r
);
2207 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2208 todo_wine
verify_reg_nonexist(hkey
, "Wine35a");
2209 todo_wine
verify_reg_nonexist(hkey
, "Wine35b");
2210 todo_wine
verify_reg_nonexist(hkey
, "Wine35c");
2212 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2213 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2214 "\"Wine36a\"=dword:1234;5678\n"
2215 "\"Wine36b\"=dword:1234 ;5678\n"
2216 "\"Wine36c\"=dword:1234#5678\n"
2217 "\"Wine36d\"=dword:1234 #5678\n\n", &r
);
2218 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2220 todo_wine
verify_reg(hkey
, "Wine36a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2221 todo_wine
verify_reg(hkey
, "Wine36b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2222 todo_wine
verify_reg_nonexist(hkey
, "Wine36c");
2223 todo_wine
verify_reg_nonexist(hkey
, "Wine36d");
2225 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2226 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2227 "\"Wine37a\"=\"foo\"bar\"\n"
2228 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r
);
2229 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2230 todo_wine
verify_reg_nonexist(hkey
, "Wine37a");
2231 todo_wine
verify_reg_nonexist(hkey
, "Wine37b");
2233 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2234 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2235 "\"Empty string\"=\"\"\n"
2236 "\"\"=\"Default registry value\"\n\n", &r
);
2237 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2238 todo_wine
verify_reg(hkey
, "Empty string", REG_SZ
, "", 1, 0);
2239 todo_wine
verify_reg(hkey
, NULL
, REG_SZ
, "Default registry value", 23, 0);
2241 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2242 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2244 "\"Test38b\"=\\\"\n"
2245 "\"Test38c\"=\\\"Value\\\"\n"
2246 "\"Test38d\"=\\\"Value\"\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
, "Test38a");
2249 todo_wine
verify_reg_nonexist(hkey
, "Test38b");
2250 todo_wine
verify_reg_nonexist(hkey
, "Test38c");
2251 todo_wine
verify_reg_nonexist(hkey
, "Test38d");
2253 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2254 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2255 "\"Wine39a\"=\"Value1\" ;comment\n"
2256 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
2257 "\"Wine39c\"=\"Value3\" #comment\n"
2258 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r
);
2259 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2260 todo_wine
verify_reg(hkey
, "Wine39a", REG_SZ
, "Value1", 7, 0);
2261 todo_wine
verify_reg(hkey
, "Wine39b", REG_SZ
, "Value2", 7, 0);
2262 todo_wine
verify_reg_nonexist(hkey
, "Wine39c");
2263 todo_wine
verify_reg_nonexist(hkey
, "Wine39d");
2265 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2266 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2267 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r
);
2268 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2269 todo_wine
verify_reg_nonexist(hkey
, "TestNoBeginQuote");
2271 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2272 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2273 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r
);
2274 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2275 todo_wine
verify_reg_nonexist(hkey
, "TestNoEndQuote");
2277 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2278 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2279 "\"TestNoQuotes\"=Asdffdsa\n", &r
);
2280 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2281 todo_wine
verify_reg_nonexist(hkey
, "TestNoQuotes");
2283 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2284 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2285 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r
);
2286 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2287 todo_wine
verify_reg_nonexist(hkey
, "NameNoBeginQuote");
2289 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2290 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2291 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r
);
2292 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2293 todo_wine
verify_reg_nonexist(hkey
, "NameNoEndQuote");
2295 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2296 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2297 "NameNoQuotes=\"Asdffdsa\"\n", &r
);
2298 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2299 todo_wine
verify_reg_nonexist(hkey
, "NameNoQuotes");
2301 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2302 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2303 "\"MixedQuotes=Asdffdsa\"\n", &r
);
2304 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2305 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes");
2306 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes=Asdffdsa");
2308 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2309 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2310 "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n"
2311 "\"Wine40b\"=\"Value 1\"\n"
2312 "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n"
2313 "\"Wine40d\"=\"Value 2\"\n"
2314 "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n"
2315 "\"Wine40f\"=\"Value 3\"\n"
2316 "\"Wine40g\"=\"Value 4\"\n\n", &r
);
2317 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2318 todo_wine
verify_reg(hkey
, "Wine40a", REG_EXPAND_SZ
, "Line", 5, 0);
2319 todo_wine
verify_reg(hkey
, "Wine40b", REG_SZ
, "Value 1", 8, 0);
2320 todo_wine
verify_reg_nonexist(hkey
, "Wine40c");
2321 todo_wine
verify_reg(hkey
, "Wine40d", REG_SZ
, "Value 2", 8, 0);
2322 todo_wine
verify_reg_nonexist(hkey
, "Wine40e");
2323 todo_wine
verify_reg_nonexist(hkey
, "Wine40f");
2324 todo_wine
verify_reg(hkey
, "Wine40g", REG_SZ
, "Value 4", 8, 0);
2326 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2327 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2328 "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2329 " 63,00,6f,00,6e,00,\\;comment\n"
2330 " 63,00,61,00,74,00,\\;comment\n"
2331 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2332 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2333 todo_wine
verify_reg(hkey
, "Multi-Line1", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2335 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2336 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2337 "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2338 " 63,00,6f,00,6e,00,\\;comment\n"
2339 " 63,00,61,00,74,00,;comment\n"
2340 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2341 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2342 todo_wine
verify_reg(hkey
, "Multi-Line2", REG_MULTI_SZ
, "Line concat", 12, 0);
2344 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2345 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2346 "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
2347 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2348 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2349 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line3");
2351 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2352 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2353 "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
2354 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2355 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2356 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line4");
2358 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2359 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2360 "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
2361 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2362 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2363 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line5");
2365 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2366 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2367 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
2368 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2369 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2370 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line6");
2372 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2373 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2374 "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2375 " 65,00,20,00,\\;comment\n"
2376 " 63,00,6f,00,6e,00,\\;comment\n"
2377 " 63,00,61,00,74,00,\\;comment\n"
2378 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2379 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2380 todo_wine
verify_reg(hkey
, "Multi-Line7", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2382 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2383 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2384 "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n"
2385 " 65,00,20,00,\\;#comment\n"
2386 " 63,00,6f,00,6e,00,\\;#comment\n"
2387 " 63,00,61,00,74,00,\\;#comment\n"
2388 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2389 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2390 todo_wine
verify_reg(hkey
, "Multi-Line8", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2392 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2393 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2394 "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2395 " 65,00,20,00,\\;comment\n"
2396 " 63,00,6f,00,6e,00,\\;comment\n"
2397 " 63,00,61,00,74,00,\\#comment\n"
2398 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2399 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2400 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line9");
2402 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2403 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2404 "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2405 " 63,00,6f,00,6e,00,\\;comment\n"
2406 " 63,00,61,00,74,00,\\\n\n"
2407 " 65,00,6e,00,\\;comment\n\n"
2408 " 61,00,74,00,69,00,6f,00,6e,00,00,00,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(hkey
, "Multi-Line10", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2412 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2413 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2414 "\"Wine41a\"=dword:1234\\\n"
2416 "\"Wine41b\"=\"Test \\\n"
2418 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2419 todo_wine
verify_reg_nonexist(hkey
, "Wine41a");
2420 todo_wine
verify_reg_nonexist(hkey
, "Wine41b");
2422 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2423 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2424 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
2425 "\"single'quote\"=dword:00000008\n\n", &r
);
2426 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2427 todo_wine
verify_reg(hkey
, "double\"quote", REG_SZ
, "valid \"or\" not", 15, 0);
2429 todo_wine
verify_reg(hkey
, "single'quote", REG_DWORD
, &dword
, sizeof(dword
), 0);
2431 /* Test key name and value name concatenation */
2432 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2433 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\\n"
2435 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2436 err
= RegOpenKeyExA(hkey
, "Subkey1", 0, KEY_READ
, &subkey
);
2437 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
2439 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2440 "[HKEY_CURRENT_USER\\" KEY_BASE
"\n"
2441 "\\Subkey2]\n", &r
);
2442 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2443 err
= RegOpenKeyExA(hkey
, "Subkey2", 0, KEY_READ
, &subkey
);
2444 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
2446 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2447 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2449 "42a\"=\"Value 1\"\n"
2450 "\"Wine42b\"=\"Value 2\"\n"
2452 "\\42c\"=\"Value 3\"\n\n", &r
);
2453 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2454 todo_wine
verify_reg_nonexist(hkey
, "Wine42a");
2455 todo_wine
verify_reg(hkey
, "Wine42b", REG_SZ
, "Value 2", 8, 0);
2456 todo_wine
verify_reg_nonexist(hkey
, "Wine42c");
2458 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
2459 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2460 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2461 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
2462 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
2463 " 75,00,65,00,00,00\n"
2464 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
2465 ",75,00,65,00,00,00\n"
2466 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
2467 " ,75,00,65,00,00,00\n"
2468 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
2469 " 75,00,65,00,00,00\n"
2470 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
2471 "5,00,65,00,00,00\n"
2472 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
2473 " 5,00,65,00,00,00\n"
2474 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
2477 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
2480 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
2481 " 6c,00,75,00,;comment\n"
2483 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
2484 " 6c,00,75,00,\\#comment\n"
2485 " 65,00,00,00\n\n", &r
);
2486 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2487 todo_wine
verify_reg(hkey
, "Wine43a", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2488 todo_wine
verify_reg(hkey
, "Wine43b", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2489 todo_wine
verify_reg_nonexist(hkey
, "Wine43c");
2490 todo_wine
verify_reg_nonexist(hkey
, "Wine43d");
2491 todo_wine
verify_reg_nonexist(hkey
, "Wine43e");
2492 todo_wine
verify_reg_nonexist(hkey
, "Wine43f");
2493 todo_wine
verify_reg_nonexist(hkey
, "Wine43g");
2494 todo_wine
verify_reg(hkey
, "Wine43h", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2495 todo_wine
verify_reg(hkey
, "Wine43i", REG_NONE
, "V\0a\0l\0u", 8, 0);
2496 todo_wine
verify_reg(hkey
, "Wine43j", REG_NONE
, "V\0a\0l\0u", 8, 0);
2497 todo_wine
verify_reg_nonexist(hkey
, "Wine43k");
2499 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2500 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2501 "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2502 "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n"
2503 " 54,00,48,00,25,00,00,00\n"
2504 "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n"
2505 ",54,00,48,00,25,00,00,00\n"
2506 "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n"
2507 " ,54,00,48,00,25,00,00,00\n"
2508 "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n"
2509 " 54,00,48,00,25,00,00,00\n"
2510 "\"Wine44f\"=hex(2):25,00,50,00,4\\\n"
2511 "1,00,54,00,48,00,25,00,00,00\n"
2512 "\"Wine44g\"=hex(2):25,00,50,00,4\\\n"
2513 " 1,00,54,00,48,00,25,00,00,00\n"
2514 "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2517 "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2520 "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2521 " 54,00,48,00;comment\n"
2523 "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2524 " 54,00,48,00,\\#comment\n"
2525 " 25,00,00,00\n\n", &r
);
2526 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2527 todo_wine
verify_reg(hkey
, "Wine44a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2528 todo_wine
verify_reg(hkey
, "Wine44b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2529 todo_wine
verify_reg_nonexist(hkey
, "Wine44c");
2530 todo_wine
verify_reg_nonexist(hkey
, "Wine44d");
2531 todo_wine
verify_reg_nonexist(hkey
, "Wine44e");
2532 todo_wine
verify_reg_nonexist(hkey
, "Wine44f");
2533 todo_wine
verify_reg_nonexist(hkey
, "Wine44g");
2534 todo_wine
verify_reg(hkey
, "Wine44h", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2536 size
= sizeof(buffer
);
2537 err
= RegQueryValueExA(hkey
, "Wine44i", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2538 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2539 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2540 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2541 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2543 size
= sizeof(buffer
);
2544 memset(buffer
, '-', size
);
2545 err
= RegQueryValueExA(hkey
, "Wine44j", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2546 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2547 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2548 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2549 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2551 todo_wine
verify_reg_nonexist(hkey
, "Wine44k");
2553 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2554 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2555 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
2556 "\"Wine45b\"=hex:11,22,33,44,\\\n"
2558 "\"Wine45c\"=hex:11,22,33,44\\\n"
2560 "\"Wine45d\"=hex:11,22,33,44\\\n"
2562 "\"Wine45e\"=hex:11,22,33,44\\\n"
2564 "\"Wine45f\"=hex:11,22,33,4\\\n"
2566 "\"Wine45g\"=hex:11,22,33,4\\\n"
2568 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
2571 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
2574 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
2577 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
2578 " 44,55,66,\\#comment\n"
2580 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2581 hex
[0] = 0x11; hex
[1] = 0x22; hex
[2] = 0x33; hex
[3] = 0x44;
2582 hex
[4] = 0x55; hex
[5] = 0x66; hex
[6] = 0x77; hex
[7] = 0x88;
2583 todo_wine
verify_reg(hkey
, "Wine45a", REG_BINARY
, hex
, sizeof(hex
), 0);
2584 todo_wine
verify_reg(hkey
, "Wine45b", REG_BINARY
, hex
, sizeof(hex
), 0);
2585 todo_wine
verify_reg_nonexist(hkey
, "Wine45c");
2586 todo_wine
verify_reg_nonexist(hkey
, "Wine45d");
2587 todo_wine
verify_reg_nonexist(hkey
, "Wine45e");
2588 todo_wine
verify_reg_nonexist(hkey
, "Wine45f");
2589 todo_wine
verify_reg_nonexist(hkey
, "Wine45g");
2590 todo_wine
verify_reg(hkey
, "Wine45h", REG_BINARY
, hex
, sizeof(hex
), 0);
2591 todo_wine
verify_reg(hkey
, "Wine45i", REG_BINARY
, hex
, 6, 0);
2592 todo_wine
verify_reg(hkey
, "Wine45j", REG_BINARY
, hex
, 6, 0);
2593 todo_wine
verify_reg_nonexist(hkey
, "Wine45k");
2595 /* Test import with subkeys */
2596 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2597 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey\"1]\n"
2598 "\"Wine\\\\31\"=\"Test value\"\n\n", &r
);
2599 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2600 err
= RegOpenKeyExA(hkey
, "Subkey\"1", 0, KEY_READ
, &subkey
);
2601 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2602 todo_wine
verify_reg(subkey
, "Wine\\31", REG_SZ
, "Test value", 11, 0);
2603 err
= RegCloseKey(subkey
);
2604 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2605 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey\"1");
2606 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2608 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2609 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey/2]\n"
2610 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r
);
2611 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2612 err
= RegOpenKeyExA(hkey
, "Subkey/2", 0, KEY_READ
, &subkey
);
2613 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2614 todo_wine
verify_reg(subkey
, "123/\"4;'5", REG_SZ
, "Random value name", 18, 0);
2615 err
= RegCloseKey(subkey
);
2616 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2617 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey/2");
2618 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2620 /* Test key creation */
2621 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2622 "HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Opening_Bracket]\n", &r
);
2623 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2624 todo_wine
verify_key_nonexist(hkey
, "No_Opening_Bracket");
2626 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2627 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Closing_Bracket\n", &r
);
2628 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2629 todo_wine
verify_key_nonexist(hkey
, "No_Closing_Bracket");
2631 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2632 "[ HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1a]\n", &r
);
2633 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2634 todo_wine
verify_key_nonexist(hkey
, "Subkey1a");
2636 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2637 "[\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1b]\n", &r
);
2638 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2639 todo_wine
verify_key_nonexist(hkey
, "Subkey1b");
2641 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2642 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1c ]\n", &r
);
2643 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2644 todo_wine
verify_key_exist(hkey
, "Subkey1c ");
2645 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1c ");
2646 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2648 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2649 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1d\t]\n", &r
);
2650 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2651 todo_wine
verify_key_exist(hkey
, "Subkey1d\t");
2652 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1d\t");
2653 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2655 /* Test key deletion. We start by creating some registry keys. */
2656 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2657 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
2658 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
2659 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2660 todo_wine
verify_key_exist(hkey
, "Subkey2a");
2661 todo_wine
verify_key_exist(hkey
, "Subkey2b");
2663 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2664 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
2665 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2666 todo_wine
verify_key_exist(hkey
, "Subkey2a");
2668 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2669 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
2670 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2671 todo_wine
verify_key_exist(hkey
, "Subkey2b");
2673 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2674 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
2675 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2676 todo_wine
verify_key_exist(hkey
, "Subkey2a");
2678 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2679 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
2680 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2681 todo_wine
verify_key_exist(hkey
, "Subkey2b");
2683 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2684 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
2685 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
2686 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2687 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
2688 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
2690 /* Test case sensitivity when creating and deleting registry keys. */
2691 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2692 "[hkey_CURRENT_user\\" KEY_BASE
"\\Subkey3a]\n\n"
2693 "[HkEy_CuRrEnT_uSeR\\" KEY_BASE
"\\SuBkEy3b]\n\n", &r
);
2694 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2695 todo_wine
verify_key_exist(hkey
, "Subkey3a");
2696 todo_wine
verify_key_exist(hkey
, "Subkey3b");
2698 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2699 "[-HKEY_current_USER\\" KEY_BASE
"\\sUBKEY3A]\n\n"
2700 "[-hKeY_cUrReNt_UsEr\\" KEY_BASE
"\\sUbKeY3B]\n\n", &r
);
2701 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2702 todo_wine
verify_key_nonexist(hkey
, "Subkey3a");
2703 todo_wine
verify_key_nonexist(hkey
, "Subkey3b");
2705 /* Test value deletion. We start by creating some registry values. */
2706 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2707 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2708 "\"Wine46a\"=\"Test Value\"\n"
2709 "\"Wine46b\"=dword:00000008\n"
2710 "\"Wine46c\"=hex:11,22,33,44\n"
2711 "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2712 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2713 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2714 "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2715 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
2716 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2717 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
2718 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2719 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
2720 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2721 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2722 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2724 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2725 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2728 "\"Wine46c\"= \t-\t \n"
2729 "\"Wine46d\"=-\"Test\"\n"
2730 "\"Wine46e\"=- ;comment\n"
2731 "\"Wine46f\"=- #comment\n\n", &r
);
2732 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2733 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
2734 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
2735 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
2736 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2737 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
2738 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2740 /* Test the accepted range of the hex-based data types */
2741 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2742 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2743 "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
2744 "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
2745 "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
2746 "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
2747 "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
2748 "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
2749 "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
2750 "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
2751 "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n\n", &r
);
2752 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2753 todo_wine
verify_reg(hkey
, "Wine47a", REG_NONE
, "Value", 6, 0);
2754 todo_wine
verify_reg(hkey
, "Wine47b", 0x10, "Value", 6, 0);
2755 todo_wine
verify_reg(hkey
, "Wine47c", 0x100, "Value", 6, 0);
2756 todo_wine
verify_reg(hkey
, "Wine47d", 0x1000, "Value", 6, 0);
2757 todo_wine
verify_reg(hkey
, "Wine47e", 0x7fff, "Value", 6, 0);
2758 todo_wine
verify_reg(hkey
, "Wine47f", 0xffff, "Value", 6, 0);
2759 todo_wine
verify_reg(hkey
, "Wine47g", 0x7fffffff, "Value", 6, 0);
2760 todo_wine
verify_reg(hkey
, "Wine47h", 0xffffffff, "Value", 6, 0);
2761 todo_wine
verify_reg_nonexist(hkey
, "Wine47i");
2763 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2764 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2765 "\"Wine48a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00, \\\n"
2766 " 63,00,6f,00,6e,00,63,00,61,00,74,00, \\\n"
2767 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2768 "\"Wine48b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\t\\\n"
2769 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\t \t \\\n"
2770 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2771 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2772 todo_wine
verify_reg(hkey
, "Wine48a", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2773 todo_wine
verify_reg(hkey
, "Wine48b", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2775 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2776 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2777 "\"Wine49\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r
);
2778 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2779 todo_wine
verify_reg(hkey
, "Wine49", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2781 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2782 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2783 "\"Wine50a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 ;comment\n"
2784 "\"Wine50b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t;comment\n"
2785 "\"Wine50c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 #comment\n"
2786 "\"Wine50d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t#comment\n\n", &r
);
2787 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2788 todo_wine
verify_reg(hkey
, "Wine50a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2789 todo_wine
verify_reg(hkey
, "Wine50b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2790 todo_wine
verify_reg_nonexist(hkey
, "Wine50c");
2791 todo_wine
verify_reg_nonexist(hkey
, "Wine50d");
2793 /* Test support for characters greater than 0xff */
2794 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2795 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2796 "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
2797 "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r
);
2798 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2799 todo_wine
verify_reg_nonexist(hkey
, "Wine51a");
2800 todo_wine
verify_reg_nonexist(hkey
, "Wine51b");
2802 /* Test the effect of backslashes in hex data */
2803 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2804 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2805 "\"Wine52a\"=hex(2):25,00,48\\,00,4f,00,4d,00,45,00,25,00,00,00\n"
2806 "\"Wine52b\"=hex(2):25,00,48,00,\\4f,00,4d,00,45,00,25,00,00,00\n"
2807 "\"Wine52c\"=hex(2):25,00,48\\ ,00,4f,00,4d,00,45,00,25,00,00,00\n"
2808 "\"Wine52d\"=hex(2):25,00,48,00,\\ 4f,00,4d,00,45,00,25,00,00,00\n"
2809 "\"Wine52e\"=hex(2):\\25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2810 "\"Wine52f\"=hex(2):\\ 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2811 "\"Wine52g\"=hex(2):25,00,48,00,4\\f,00,4d,00,45,00,25,00,00,00\n"
2812 "\"Wine52h\"=hex(2):25,00,48,00,4\\\n"
2813 " f,00,4d,00,45,00,25,00,00,00\n"
2814 "\"Wine52i\"=hex(2):25,00,50,00,\\,41,00,54,00,48,00,25,00,00,00\n"
2815 "\"Wine52j\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\\\n"
2816 " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2817 "\"Wine52k\"=hex(2):,\\\n"
2818 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n"
2819 "\"Wine52l\"=hex(2):\\\n"
2820 " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n\n", &r
);
2821 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2822 todo_wine
verify_reg_nonexist(hkey
, "Wine52a");
2823 todo_wine
verify_reg_nonexist(hkey
, "Wine52b");
2824 todo_wine
verify_reg_nonexist(hkey
, "Wine52c");
2825 todo_wine
verify_reg_nonexist(hkey
, "Wine52d");
2826 todo_wine
verify_reg_nonexist(hkey
, "Wine52e");
2827 todo_wine
verify_reg_nonexist(hkey
, "Wine52f");
2828 todo_wine
verify_reg_nonexist(hkey
, "Wine52g");
2829 todo_wine
verify_reg_nonexist(hkey
, "Wine52h");
2830 todo_wine
verify_reg_nonexist(hkey
, "Wine52i");
2831 todo_wine
verify_reg_nonexist(hkey
, "Wine52j");
2832 todo_wine
verify_reg_nonexist(hkey
, "Wine52k");
2833 todo_wine
verify_reg(hkey
, "Wine52l", REG_EXPAND_SZ
, "%HOME%", 7, 0);
2835 err
= RegCloseKey(hkey
);
2836 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2838 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
2839 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2842 static void test_import_with_whitespace(void)
2848 test_import_str(" REGEDIT4\n\n"
2849 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
2850 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2852 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
2853 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
2855 test_import_str(" REGEDIT4\n\n"
2856 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2857 "\"Wine1a\"=\"Value\"\n\n", &r
);
2858 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2859 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
2861 test_import_str("\tREGEDIT4\n\n"
2862 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2863 "\"Wine1b\"=\"Value\"\n\n", &r
);
2864 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2865 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
2867 test_import_str(" \t REGEDIT4\n\n"
2868 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2869 "\"Wine1c\"=\"Value\"\n\n", &r
);
2870 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2871 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
2873 test_import_str("REGEDIT4\n\n"
2874 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2875 "\"Wine2a\"=\"Value\"\n\n", &r
);
2876 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2877 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
2879 test_import_str("REGEDIT4\n\n"
2880 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2881 "\"Wine2b\"=\"Value\"\n\n", &r
);
2882 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2883 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
2885 test_import_str("REGEDIT4\n\n"
2886 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2887 "\"Wine2c\"=\"Value\"\n\n", &r
);
2888 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2889 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
2891 test_import_str("REGEDIT4\n\n"
2892 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2893 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
2894 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2895 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
2897 test_import_str("REGEDIT4\n\n"
2898 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2899 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
2900 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2901 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
2903 test_import_str("REGEDIT4\n\n"
2904 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2905 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
2906 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2907 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
2909 test_import_str(" REGEDIT4\n\n"
2910 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2911 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
2912 " \"Wine4b\"=dword:00112233\n"
2913 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n"
2914 " 63,6f,6e,\\;comment\n"
2915 "\t\t\t\t63,61,74,\\;comment\n"
2916 " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2917 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2918 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
2920 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2921 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2923 test_import_str(" REGEDIT4\n\n"
2924 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2925 " \"Wine5a\"=\"Leading spaces\"\n"
2926 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
2927 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
2928 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
2929 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2930 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
2931 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
2932 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
2933 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
2935 test_import_str("REGEDIT4\n\n"
2936 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2937 "\" Wine6a\"=\"Leading spaces\"\n"
2938 "\"\t\tWine6b\"=\"Leading tabs\"\n"
2939 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
2940 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2941 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
2942 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
2943 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
2945 test_import_str("REGEDIT4\n\n"
2946 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2947 "\"Wine7a\"=\" Four spaces in the data\"\n"
2948 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
2949 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2950 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
2951 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
2953 test_import_str("REGEDIT4\n\n"
2954 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2955 "\"Wine8a\"=\"Trailing spaces\" \n"
2956 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
2957 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2958 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
2959 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
2961 test_import_str("REGEDIT4\n\n"
2962 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2963 "\"Wine9a\"=dword: 00000008\n"
2964 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
2965 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2967 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2968 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2970 test_import_str("REGEDIT4\n\n"
2971 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2972 "@ = \"Test Value\"\n\n", &r
);
2973 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2974 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
2976 test_import_str("REGEDIT4\n\n"
2977 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2978 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
2979 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2980 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
2982 err
= RegCloseKey(hkey
);
2983 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
2985 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
2986 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
2988 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
2989 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
2990 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2992 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
2993 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
2995 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
2996 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2997 "\"Wine1a\"=\"Value\"\n\n", &r
);
2998 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2999 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
3001 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n"
3002 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3003 "\"Wine1b\"=\"Value\"\n\n", &r
);
3004 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3005 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
3007 test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n"
3008 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3009 "\"Wine1c\"=\"Value\"\n\n", &r
);
3010 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3011 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
3013 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3014 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3015 "\"Wine2a\"=\"Value\"\n\n", &r
);
3016 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3017 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
3019 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3020 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3021 "\"Wine2b\"=\"Value\"\n\n", &r
);
3022 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3023 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
3025 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3026 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3027 "\"Wine2c\"=\"Value\"\n\n", &r
);
3028 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3029 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
3031 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3032 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3033 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
3034 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3035 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
3037 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3038 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3039 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
3040 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3041 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
3043 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3044 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3045 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
3046 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
3047 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
3049 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3050 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3051 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
3052 " \"Wine4b\"=dword:00112233\n"
3053 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
3054 " 63,00,6f,00,6e,00,\\;comment\n"
3055 "\t\t\t\t63,00,61,00,74,00,\\;comment\n"
3056 " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
3057 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3058 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
3060 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3061 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
3063 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
3064 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3065 " \"Wine5a\"=\"Leading spaces\"\n"
3066 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
3067 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
3068 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
3069 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3070 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
3071 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
3072 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
3073 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
3075 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3076 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3077 "\" Wine6a\"=\"Leading spaces\"\n"
3078 "\"\t\tWine6b\"=\"Leading tabs\"\n"
3079 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
3080 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3081 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
3082 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
3083 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
3085 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3086 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3087 "\"Wine7a\"=\" Four spaces in the data\"\n"
3088 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
3089 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3090 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
3091 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
3093 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3094 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3095 "\"Wine8a\"=\"Trailing spaces\" \n"
3096 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
3097 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3098 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
3099 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
3101 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3102 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3103 "\"Wine9a\"=dword: 00000008\n"
3104 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
3105 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3107 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
3108 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
3110 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3111 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3112 "@ = \"Test Value\"\n\n", &r
);
3113 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3114 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
3116 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
3117 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
3118 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
3119 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
3120 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
3122 err
= RegCloseKey(hkey
);
3123 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
3125 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
3126 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
3132 if (!run_reg_exe("reg.exe /?", &r
)) {
3133 win_skip("reg.exe not available, skipping reg.exe tests\n");
3142 test_import_with_whitespace();