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",
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\n", &r
);
1324 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1325 todo_wine
verify_reg(hkey
, "Empty string", REG_SZ
, "", 1, 0);
1327 test_import_str("REGEDIT4\n\n"
1328 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1330 "\"Test38b\"=\\\"\n"
1331 "\"Test38c\"=\\\"Value\\\"\n"
1332 "\"Test38d\"=\\\"Value\"\n\n", &r
);
1333 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1334 todo_wine
verify_reg_nonexist(hkey
, "Test38a");
1335 todo_wine
verify_reg_nonexist(hkey
, "Test38b");
1336 todo_wine
verify_reg_nonexist(hkey
, "Test38c");
1337 todo_wine
verify_reg_nonexist(hkey
, "Test38d");
1339 test_import_str("REGEDIT4\n\n"
1340 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1341 "\"Wine39a\"=\"Value1\" ;comment\n"
1342 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
1343 "\"Wine39c\"=\"Value3\" #comment\n"
1344 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r
);
1345 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1346 todo_wine
verify_reg(hkey
, "Wine39a", REG_SZ
, "Value1", 7, 0);
1347 todo_wine
verify_reg(hkey
, "Wine39b", REG_SZ
, "Value2", 7, 0);
1348 todo_wine
verify_reg_nonexist(hkey
, "Wine39c");
1349 todo_wine
verify_reg_nonexist(hkey
, "Wine39d");
1351 test_import_str("REGEDIT4\n\n"
1352 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1353 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r
);
1354 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1355 todo_wine
verify_reg_nonexist(hkey
, "TestNoBeginQuote");
1357 test_import_str("REGEDIT4\n\n"
1358 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1359 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r
);
1360 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1361 todo_wine
verify_reg_nonexist(hkey
, "TestNoEndQuote");
1363 test_import_str("REGEDIT4\n\n"
1364 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1365 "\"TestNoQuotes\"=Asdffdsa\n", &r
);
1366 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1367 todo_wine
verify_reg_nonexist(hkey
, "TestNoQuotes");
1369 test_import_str("REGEDIT4\n\n"
1370 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1371 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r
);
1372 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1373 todo_wine
verify_reg_nonexist(hkey
, "NameNoBeginQuote");
1375 test_import_str("REGEDIT4\n\n"
1376 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1377 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r
);
1378 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1379 todo_wine
verify_reg_nonexist(hkey
, "NameNoEndQuote");
1381 test_import_str("REGEDIT4\n\n"
1382 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1383 "NameNoQuotes=\"Asdffdsa\"\n", &r
);
1384 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1385 todo_wine
verify_reg_nonexist(hkey
, "NameNoQuotes");
1387 test_import_str("REGEDIT4\n\n"
1388 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1389 "\"MixedQuotes=Asdffdsa\"\n", &r
);
1390 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1391 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes");
1392 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes=Asdffdsa");
1394 test_import_str("REGEDIT4\n\n"
1395 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1396 "\"Wine40a\"=hex(2):4c,69,6e,65,00\n"
1397 "\"Wine40b\"=\"Value 1\"\n"
1398 "\"Wine40c\"=hex(2):4c,69,6e,65\\\n"
1399 "\"Wine40d\"=\"Value 2\"\n"
1400 "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n"
1401 "\"Wine40f\"=\"Value 3\"\n"
1402 "\"Wine40g\"=\"Value 4\"\n\n", &r
);
1403 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1404 todo_wine
verify_reg(hkey
, "Wine40a", REG_EXPAND_SZ
, "Line", 5, 0);
1405 todo_wine
verify_reg(hkey
, "Wine40b", REG_SZ
, "Value 1", 8, 0);
1406 todo_wine
verify_reg_nonexist(hkey
, "Wine40c");
1407 todo_wine
verify_reg(hkey
, "Wine40d", REG_SZ
, "Value 2", 8, 0);
1408 todo_wine
verify_reg_nonexist(hkey
, "Wine40e");
1409 todo_wine
verify_reg_nonexist(hkey
, "Wine40f");
1410 todo_wine
verify_reg(hkey
, "Wine40g", REG_SZ
, "Value 4", 8, 0);
1412 test_import_str("REGEDIT4\n\n"
1413 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1414 "\"Wine41a\"=dword:1234\\\n"
1416 "\"Wine41b\"=\"Test \\\n"
1418 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1419 todo_wine
verify_reg_nonexist(hkey
, "Wine41a");
1420 todo_wine
verify_reg_nonexist(hkey
, "Wine41b");
1422 test_import_str("REGEDIT4\n\n"
1423 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1424 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
1425 "\"single'quote\"=dword:00000008\n\n", &r
);
1426 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1427 todo_wine
verify_reg(hkey
, "double\"quote", REG_SZ
, "valid \"or\" not", 15, 0);
1429 todo_wine
verify_reg(hkey
, "single'quote", REG_DWORD
, &dword
, sizeof(dword
), 0);
1431 /* Test key name and value name concatenation */
1432 test_import_str("REGEDIT4\n\n"
1433 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\\n"
1435 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1436 err
= RegOpenKeyExA(hkey
, "Subkey1", 0, KEY_READ
, &subkey
);
1437 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
1439 test_import_str("REGEDIT4\n\n"
1440 "[HKEY_CURRENT_USER\\" KEY_BASE
"\n"
1441 "\\Subkey2]\n", &r
);
1442 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1443 err
= RegOpenKeyExA(hkey
, "Subkey2", 0, KEY_READ
, &subkey
);
1444 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
1446 test_import_str("REGEDIT4\n\n"
1447 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1449 "42a\"=\"Value 1\"\n"
1450 "\"Wine42b\"=\"Value 2\"\n"
1452 "\\42c\"=\"Value 3\"\n\n", &r
);
1453 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1454 todo_wine
verify_reg_nonexist(hkey
, "Wine42a");
1455 todo_wine
verify_reg(hkey
, "Wine42b", REG_SZ
, "Value 2", 8, 0);
1456 todo_wine
verify_reg_nonexist(hkey
, "Wine42c");
1458 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
1459 test_import_str("REGEDIT4\n\n"
1460 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1461 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
1462 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
1463 " 75,00,65,00,00,00\n"
1464 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
1465 ",75,00,65,00,00,00\n"
1466 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
1467 " ,75,00,65,00,00,00\n"
1468 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
1469 " 75,00,65,00,00,00\n"
1470 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
1471 "5,00,65,00,00,00\n"
1472 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
1473 " 5,00,65,00,00,00\n"
1474 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
1477 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
1480 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
1481 " 6c,00,75,00,;comment\n"
1483 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
1484 " 6c,00,75,00,\\#comment\n"
1485 " 65,00,00,00\n\n", &r
);
1486 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1487 todo_wine
verify_reg(hkey
, "Wine43a", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1488 todo_wine
verify_reg(hkey
, "Wine43b", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1489 todo_wine
verify_reg_nonexist(hkey
, "Wine43c");
1490 todo_wine
verify_reg_nonexist(hkey
, "Wine43d");
1491 todo_wine
verify_reg_nonexist(hkey
, "Wine43e");
1492 todo_wine
verify_reg_nonexist(hkey
, "Wine43f");
1493 todo_wine
verify_reg_nonexist(hkey
, "Wine43g");
1494 todo_wine
verify_reg(hkey
, "Wine43h", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1495 todo_wine
verify_reg(hkey
, "Wine43i", REG_NONE
, "V\0a\0l\0u", 8, 0);
1496 todo_wine
verify_reg(hkey
, "Wine43j", REG_NONE
, "V\0a\0l\0u", 8, 0);
1497 todo_wine
verify_reg_nonexist(hkey
, "Wine43k");
1499 test_import_str("REGEDIT4\n\n"
1500 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1501 "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n"
1502 "\"Wine44b\"=hex(2):25,50,41,\\\n"
1504 "\"Wine44c\"=hex(2):25,50,41\\\n"
1506 "\"Wine44d\"=hex(2):25,50,41\\\n"
1508 "\"Wine44e\"=hex(2):25,50,41\\\n"
1510 "\"Wine44f\"=hex(2):25,50,4\\\n"
1512 "\"Wine44g\"=hex(2):25,50,4\\\n"
1514 "\"Wine44h\"=hex(2):25,50,41,\\;comment\n"
1517 "\"Wine44i\"=hex(2):25,50,41,\\;comment\n"
1520 "\"Wine44j\"=hex(2):25,50,41,\\;comment\n"
1523 "\"Wine44k\"=hex(2):25,50,41,\\;comment\n"
1524 " 54,48,\\#comment\n"
1526 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1527 todo_wine
verify_reg(hkey
, "Wine44a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1528 todo_wine
verify_reg(hkey
, "Wine44b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1529 todo_wine
verify_reg_nonexist(hkey
, "Wine44c");
1530 todo_wine
verify_reg_nonexist(hkey
, "Wine44d");
1531 todo_wine
verify_reg_nonexist(hkey
, "Wine44e");
1532 todo_wine
verify_reg_nonexist(hkey
, "Wine44f");
1533 todo_wine
verify_reg_nonexist(hkey
, "Wine44g");
1534 todo_wine
verify_reg(hkey
, "Wine44h", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1536 size
= sizeof(buffer
);
1537 err
= RegQueryValueExA(hkey
, "Wine44i", NULL
, &type
, (BYTE
*)&buffer
, &size
);
1538 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
1539 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
1540 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
1541 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
1543 size
= sizeof(buffer
);
1544 memset(buffer
, '-', size
);
1545 err
= RegQueryValueExA(hkey
, "Wine44j", NULL
, &type
, (BYTE
*)&buffer
, &size
);
1546 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
1547 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
1548 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
1549 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
1551 todo_wine
verify_reg_nonexist(hkey
, "Wine44k");
1553 test_import_str("REGEDIT4\n\n"
1554 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1555 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
1556 "\"Wine45b\"=hex:11,22,33,44,\\\n"
1558 "\"Wine45c\"=hex:11,22,33,44\\\n"
1560 "\"Wine45d\"=hex:11,22,33,44\\\n"
1562 "\"Wine45e\"=hex:11,22,33,44\\\n"
1564 "\"Wine45f\"=hex:11,22,33,4\\\n"
1566 "\"Wine45g\"=hex:11,22,33,4\\\n"
1568 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
1571 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
1574 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
1577 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
1578 " 44,55,66,\\#comment\n"
1580 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1581 hex
[0] = 0x11; hex
[1] = 0x22; hex
[2] = 0x33; hex
[3] = 0x44;
1582 hex
[4] = 0x55; hex
[5] = 0x66; hex
[6] = 0x77; hex
[7] = 0x88;
1583 todo_wine
verify_reg(hkey
, "Wine45a", REG_BINARY
, hex
, sizeof(hex
), 0);
1584 todo_wine
verify_reg(hkey
, "Wine45b", REG_BINARY
, hex
, sizeof(hex
), 0);
1585 todo_wine
verify_reg_nonexist(hkey
, "Wine45c");
1586 todo_wine
verify_reg_nonexist(hkey
, "Wine45d");
1587 todo_wine
verify_reg_nonexist(hkey
, "Wine45e");
1588 todo_wine
verify_reg_nonexist(hkey
, "Wine45f");
1589 todo_wine
verify_reg_nonexist(hkey
, "Wine45g");
1590 todo_wine
verify_reg(hkey
, "Wine45h", REG_BINARY
, hex
, sizeof(hex
), 0);
1591 todo_wine
verify_reg(hkey
, "Wine45i", REG_BINARY
, hex
, 6, 0);
1592 todo_wine
verify_reg(hkey
, "Wine45j", REG_BINARY
, hex
, 6, 0);
1593 todo_wine
verify_reg_nonexist(hkey
, "Wine45k");
1595 /* Test import with subkeys */
1596 test_import_str("REGEDIT4\n\n"
1597 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey\"1]\n"
1598 "\"Wine\\\\31\"=\"Test value\"\n\n", &r
);
1599 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1600 err
= RegOpenKeyExA(hkey
, "Subkey\"1", 0, KEY_READ
, &subkey
);
1601 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1602 todo_wine
verify_reg(subkey
, "Wine\\31", REG_SZ
, "Test value", 11, 0);
1603 err
= RegCloseKey(subkey
);
1604 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1605 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey\"1");
1606 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1608 test_import_str("REGEDIT4\n\n"
1609 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey/2]\n"
1610 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r
);
1611 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1612 err
= RegOpenKeyExA(hkey
, "Subkey/2", 0, KEY_READ
, &subkey
);
1613 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1614 todo_wine
verify_reg(subkey
, "123/\"4;'5", REG_SZ
, "Random value name", 18, 0);
1615 err
= RegCloseKey(subkey
);
1616 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1617 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey/2");
1618 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1620 /* Test key creation */
1621 test_import_str("REGEDIT4\n\n"
1622 "HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Opening_Bracket]\n", &r
);
1623 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1624 todo_wine
verify_key_nonexist(hkey
, "No_Opening_Bracket");
1626 test_import_str("REGEDIT4\n\n"
1627 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Closing_Bracket\n", &r
);
1628 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1629 todo_wine
verify_key_nonexist(hkey
, "No_Closing_Bracket");
1631 test_import_str("REGEDIT4\n\n"
1632 "[ HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1a]\n", &r
);
1633 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1634 todo_wine
verify_key_nonexist(hkey
, "Subkey1a");
1636 test_import_str("REGEDIT4\n\n"
1637 "[\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1b]\n", &r
);
1638 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1639 todo_wine
verify_key_nonexist(hkey
, "Subkey1b");
1641 test_import_str("REGEDIT4\n\n"
1642 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1c ]\n", &r
);
1643 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1644 todo_wine
verify_key_exist(hkey
, "Subkey1c ");
1645 err
= RegDeleteKeyA(hkey
, "Subkey1c ");
1646 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1648 test_import_str("REGEDIT4\n\n"
1649 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1d\t]\n", &r
);
1650 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1651 todo_wine
verify_key_exist(hkey
, "Subkey1d\t");
1652 err
= RegDeleteKeyA(hkey
, "Subkey1d\t");
1653 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1655 /* Test key deletion. We start by creating some registry keys. */
1656 test_import_str("REGEDIT4\n\n"
1657 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1658 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1659 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1660 todo_wine
verify_key_exist(hkey
, "Subkey2a");
1661 todo_wine
verify_key_exist(hkey
, "Subkey2b");
1663 test_import_str("REGEDIT4\n\n"
1664 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1665 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1666 todo_wine
verify_key_exist(hkey
, "Subkey2a");
1668 test_import_str("REGEDIT4\n\n"
1669 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1670 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1671 todo_wine
verify_key_exist(hkey
, "Subkey2b");
1673 test_import_str("REGEDIT4\n\n"
1674 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
1675 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1676 todo_wine
verify_key_exist(hkey
, "Subkey2a");
1678 test_import_str("REGEDIT4\n\n"
1679 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
1680 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1681 todo_wine
verify_key_exist(hkey
, "Subkey2b");
1683 test_import_str("REGEDIT4\n\n"
1684 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
1685 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
1686 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1687 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
1688 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
1690 /* Test value deletion. We start by creating some registry values. */
1691 test_import_str("REGEDIT4\n\n"
1692 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1693 "\"Wine46a\"=\"Test Value\"\n"
1694 "\"Wine46b\"=dword:00000008\n"
1695 "\"Wine46c\"=hex:11,22,33,44\n"
1696 "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n"
1697 " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1698 "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n"
1699 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
1700 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1701 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
1702 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
1703 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
1704 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1705 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
1706 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1708 test_import_str("REGEDIT4\n\n"
1709 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1712 "\"Wine46c\"= \t-\t \n"
1713 "\"Wine46d\"=-\"Test\"\n"
1714 "\"Wine46e\"=- ;comment\n"
1715 "\"Wine46f\"=- #comment\n\n", &r
);
1716 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1717 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
1718 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
1719 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
1720 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
1721 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
1722 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
1724 err
= RegCloseKey(hkey
);
1725 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1727 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
1728 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1730 /* Test file contents - Unicode */
1731 test_import_wstr("REGEDIT\n", &r
);
1732 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1733 "got exit code %d, expected 1\n", r
);
1735 test_import_wstr("REGEDIT4\n", &r
);
1736 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1737 "got exit code %d, expected 1\n", r
);
1739 test_import_wstr("\xef\xbb\xbfREGEDIT", &r
);
1740 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1742 test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r
);
1743 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1745 test_import_wstr("\xef\xbb\xbfREGEDIT4", &r
);
1746 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1748 test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r
);
1749 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1751 test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r
);
1752 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1754 test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r
);
1755 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1757 test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r
);
1758 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1759 "got exit code %d, expected 1\n", r
);
1761 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1762 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n", &r
);
1763 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1765 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
1766 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
1768 test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n"
1769 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1770 "\"Test1\"=\"Value\"\n", &r
);
1771 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1772 todo_wine
verify_reg_nonexist(hkey
, "Test1");
1774 test_import_wstr("\xef\xbb\xbfregedit4\n\n"
1775 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1776 "\"Test2\"=\"Value\"\n", &r
);
1777 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1778 "got exit code %d, expected 1\n", r
);
1779 todo_wine
verify_reg_nonexist(hkey
, "Test2");
1781 test_import_wstr("\xef\xbb\xbfRegedit4\n\n"
1782 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1783 "\"Test3\"=\"Value\"\n", &r
);
1784 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1785 "got exit code %d, expected 1\n", r
);
1786 todo_wine
verify_reg_nonexist(hkey
, "Test3");
1788 test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n"
1789 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1790 "\"Test4\"=\"Value\"\n", &r
);
1791 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1792 todo_wine
verify_reg_nonexist(hkey
, "Test4");
1794 test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n"
1795 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1796 "\"Test5\"=\"Value\"\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
, "Test5");
1800 test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n"
1801 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1802 "\"Test6\"=\"Value\"\n", &r
);
1803 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1804 todo_wine
verify_reg_nonexist(hkey
, "Test6");
1806 test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n"
1807 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1808 "\"Test7\"=\"Value\"\n", &r
);
1809 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1810 todo_wine
verify_reg_nonexist(hkey
, "Test7");
1812 test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n"
1813 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1814 "\"Test8\"=\"Value\"\n", &r
);
1815 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1816 todo_wine
verify_reg_nonexist(hkey
, "Test8");
1818 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1819 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1820 "\"Unicode1\"=\"Value1\"\n", &r
);
1821 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1822 todo_wine
verify_reg(hkey
, "Unicode1", REG_SZ
, "Value1", 7, 0);
1824 test_import_wstr("\xef\xbb\xbfREGEDIT4\n"
1825 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1826 "\"Unicode2\"=\"Value2\"\n\n", &r
);
1827 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1828 todo_wine
verify_reg(hkey
, "Unicode2", REG_SZ
, "Value2", 7, 0);
1830 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1831 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1832 "\"Unicode3\"=\"Value3\"\n\n", &r
);
1833 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1834 todo_wine
verify_reg(hkey
, "Unicode3", REG_SZ
, "Value3", 7, 0);
1836 test_import_wstr("Windows Registry Editor Version 4.00\n", &r
);
1837 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1838 "got exit code %d, expected 1\n", r
);
1840 test_import_wstr("Windows Registry Editor Version 5.00\n", &r
);
1841 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1842 "got exit code %d, expected 1\n", r
);
1844 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r
);
1845 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1846 "got exit code %d, expected 1\n", r
);
1848 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r
);
1849 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1851 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r
);
1852 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1854 test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r
);
1855 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1856 "got exit code %d, expected 1\n", r
);
1858 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\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\tWindows Registry Editor Version 5.00\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\nWindows Registry Editor Version 5.00\n", &r
);
1865 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1866 "got exit code %d, expected 1\n", r
);
1868 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n"
1869 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1870 "\"Test9\"=\"Value\"\n", &r
);
1871 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1872 "got exit code %d, expected 1\n", r
);
1873 todo_wine
verify_reg_nonexist(hkey
, "Test9");
1875 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n"
1876 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1877 "\"Test10\"=\"Value\"\n", &r
);
1878 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1879 "got exit code %d, expected 1\n", r
);
1880 todo_wine
verify_reg_nonexist(hkey
, "Test10");
1882 test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
1883 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1884 "\"Test11\"=\"Value\"\n", &r
);
1885 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1886 "got exit code %d, expected 1\n", r
);
1887 todo_wine
verify_reg_nonexist(hkey
, "Test11");
1889 test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n"
1890 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1891 "\"Test12\"=\"Value\"\n", &r
);
1892 ok(r
== REG_EXIT_FAILURE
|| broken(r
== REG_EXIT_SUCCESS
) /* WinXP */,
1893 "got exit code %d, expected 1\n", r
);
1894 todo_wine
verify_reg_nonexist(hkey
, "Test12");
1896 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
1897 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1898 "\"Unicode4\"=\"Value4\"\n", &r
);
1899 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1900 todo_wine
verify_reg(hkey
, "Unicode4", REG_SZ
, "Value4", 7, 0);
1902 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n"
1903 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1904 "\"Unicode5\"=\"Value5\"\n\n", &r
);
1905 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1906 todo_wine
verify_reg(hkey
, "Unicode5", REG_SZ
, "Value5", 7, 0);
1908 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1909 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1910 "\"Unicode6\"=\"Value6\"\n\n", &r
);
1911 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1912 todo_wine
verify_reg(hkey
, "Unicode6", REG_SZ
, "Value6", 7, 0);
1914 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1915 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1916 "\"Line1\"=\"Value1\"\n\n"
1917 "\"Line2\"=\"Value2\"\n\n\n"
1918 "\"Line3\"=\"Value3\"\n\n\n\n"
1919 "\"Line4\"=\"Value4\"\n\n", &r
);
1920 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1921 todo_wine
verify_reg(hkey
, "Line1", REG_SZ
, "Value1", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1922 todo_wine
verify_reg(hkey
, "Line2", REG_SZ
, "Value2", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1923 todo_wine
verify_reg(hkey
, "Line3", REG_SZ
, "Value3", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1924 todo_wine
verify_reg(hkey
, "Line4", REG_SZ
, "Value4", 7, TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1926 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1927 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1928 "\"Wine1\"=dword:00000782\n\n"
1929 "\"Wine2\"=\"Test Value\"\n"
1930 "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
1931 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
1935 "\"Wine4\"=dword:12345678\n\n", &r
);
1936 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1938 todo_wine
verify_reg(hkey
, "Wine1", REG_DWORD
, &dword
, sizeof(dword
),
1939 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1940 todo_wine
verify_reg(hkey
, "Wine2", REG_SZ
, "Test Value", 11,
1941 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1942 todo_wine
verify_reg(hkey
, "Wine3", REG_MULTI_SZ
, "Line concatenation\0", 20,
1943 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1944 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test", 5,
1945 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1947 todo_wine
verify_reg(hkey
, "Wine4", REG_DWORD
, &dword
, sizeof(dword
),
1948 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1950 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1951 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1952 "\"Wine5\"=\"No newline\"", &r
);
1953 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1954 err
= RegQueryValueExA(hkey
, "Wine5", NULL
, NULL
, NULL
, NULL
);
1955 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
1956 "got %d, expected 0\n", err
);
1957 if (err
== ERROR_SUCCESS
)
1958 verify_reg(hkey
, "Wine5", REG_SZ
, "No newline", 11, 0);
1960 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
1961 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1962 "\"Wine6\"=dword:00000050\n\n"
1963 "\"Wine7\"=\"No newline\"", &r
);
1964 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1966 todo_wine
verify_reg(hkey
, "Wine6", REG_DWORD
, &dword
, sizeof(dword
),
1967 TODO_REG_TYPE
|TODO_REG_SIZE
|TODO_REG_DATA
);
1968 err
= RegQueryValueExA(hkey
, "Wine7", NULL
, NULL
, NULL
, NULL
);
1969 todo_wine
ok(err
== ERROR_SUCCESS
|| broken(err
== ERROR_FILE_NOT_FOUND
/* WinXP */),
1970 "got %d, expected 0\n", err
);
1971 if (err
== ERROR_SUCCESS
)
1972 verify_reg(hkey
, "Wine7", REG_SZ
, "No newline", 11, 0);
1974 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1975 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1977 "\"Wine8\"=\"Line 1\"\n"
1979 "\"Wine9\"=\"Line 2\"\n\n", &r
);
1980 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1981 todo_wine
verify_reg(hkey
, "Wine8", REG_SZ
, "Line 1", 7, 0);
1982 todo_wine
verify_reg(hkey
, "Wine9", REG_SZ
, "Line 2", 7, 0);
1984 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1985 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1986 "\"Wine10\"=\"Value 1\"#comment\n"
1987 "\"Wine11\"=\"Value 2\";comment\n"
1988 "\"Wine12\"=dword:01020304 #comment\n"
1989 "\"Wine13\"=dword:02040608 ;comment\n\n", &r
);
1990 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
1991 todo_wine
verify_reg_nonexist(hkey
, "Wine10");
1992 todo_wine
verify_reg(hkey
, "Wine11", REG_SZ
, "Value 2", 8, 0);
1993 todo_wine
verify_reg_nonexist(hkey
, "Wine12");
1995 todo_wine
verify_reg(hkey
, "Wine13", REG_DWORD
, &dword
, sizeof(dword
), 0);
1997 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
1998 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
1999 "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2001 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2002 "\"Wine15\"=\"A valid line\"\n"
2003 "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n"
2005 " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2006 "\"Wine17\"=\"Another valid line\"\n\n", &r
);
2007 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2008 todo_wine
verify_reg_nonexist(hkey
, "Wine14");
2009 todo_wine
verify_reg(hkey
, "Wine15", REG_SZ
, "A valid line", 13, 0);
2010 todo_wine
verify_reg(hkey
, "Wine16", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2011 todo_wine
verify_reg(hkey
, "Wine17", REG_SZ
, "Another valid line", 19, 0);
2013 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2014 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2015 "#\"Comment1\"=\"Value 1\"\n"
2016 ";\"Comment2\"=\"Value 2\"\n"
2017 " #\"Comment3\"=\"Value 3\"\n"
2018 " ;\"Comment4\"=\"Value 4\"\n"
2019 "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
2020 "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r
);
2021 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2022 todo_wine
verify_reg_nonexist(hkey
, "Comment1");
2023 todo_wine
verify_reg_nonexist(hkey
, "Comment2");
2024 todo_wine
verify_reg_nonexist(hkey
, "Comment3");
2025 todo_wine
verify_reg_nonexist(hkey
, "Comment4");
2026 todo_wine
verify_reg_nonexist(hkey
, "Wine18");
2027 todo_wine
verify_reg_nonexist(hkey
, "Comment5");
2028 todo_wine
verify_reg(hkey
, "Wine19", REG_SZ
, "Value 7", 8, TODO_REG_SIZE
|TODO_REG_DATA
);
2029 todo_wine
verify_reg_nonexist(hkey
, "Comment6");
2031 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2032 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2033 "\"Wine20\"=#\"Value 8\"\n"
2034 "\"Wine21\"=;\"Value 9\"\n"
2035 "\"Wine22\"=\"#comment1\"\n"
2036 "\"Wine23\"=\";comment2\"\n"
2037 "\"Wine24\"=\"Value#comment3\"\n"
2038 "\"Wine25\"=\"Value;comment4\"\n"
2039 "\"Wine26\"=\"Value #comment5\"\n"
2040 "\"Wine27\"=\"Value ;comment6\"\n"
2041 "\"Wine28\"=#dword:00000001\n"
2042 "\"Wine29\"=;dword:00000002\n"
2043 "\"Wine30\"=dword:00000003#comment\n"
2044 "\"Wine31\"=dword:00000004;comment\n\n", &r
);
2045 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2046 todo_wine
verify_reg_nonexist(hkey
, "Wine20");
2047 todo_wine
verify_reg_nonexist(hkey
, "Wine21");
2048 todo_wine
verify_reg(hkey
, "Wine22", REG_SZ
, "#comment1", 10, 0);
2049 todo_wine
verify_reg(hkey
, "Wine23", REG_SZ
, ";comment2", 10, 0);
2050 todo_wine
verify_reg(hkey
, "Wine24", REG_SZ
, "Value#comment3", 15, 0);
2051 todo_wine
verify_reg(hkey
, "Wine25", REG_SZ
, "Value;comment4", 15, 0);
2052 todo_wine
verify_reg(hkey
, "Wine26", REG_SZ
, "Value #comment5", 16, 0);
2053 todo_wine
verify_reg(hkey
, "Wine27", REG_SZ
, "Value ;comment6", 16, 0);
2054 todo_wine
verify_reg_nonexist(hkey
, "Wine28");
2055 todo_wine
verify_reg_nonexist(hkey
, "Wine29");
2056 todo_wine
verify_reg_nonexist(hkey
, "Wine30");
2058 todo_wine
verify_reg(hkey
, "Wine31", REG_DWORD
, &dword
, sizeof(dword
), 0);
2060 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2061 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2062 "\"Wine32a\"=dword:1\n"
2063 "\"Wine32b\"=dword:4444\n\n", &r
);
2064 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2066 todo_wine
verify_reg(hkey
, "Wine32a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2068 todo_wine
verify_reg(hkey
, "Wine32b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2070 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2071 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2072 "\"Wine33a\"=dword:\n"
2073 "\"Wine33b\"=dword:hello\n"
2074 "\"Wine33c\"=dword:123456789\n"
2075 "\"Wine33d\"=dword:012345678\n"
2076 "\"Wine33e\"=dword:000000001\n\n", &r
);
2077 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2078 todo_wine
verify_reg_nonexist(hkey
, "Wine33a");
2079 todo_wine
verify_reg_nonexist(hkey
, "Wine33b");
2080 todo_wine
verify_reg_nonexist(hkey
, "Wine33c");
2081 todo_wine
verify_reg_nonexist(hkey
, "Wine33d");
2082 todo_wine
verify_reg_nonexist(hkey
, "Wine33e");
2084 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2085 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2086 "\"Wine34a\"=dword:12345678abc\n"
2087 "\"Wine34b\"=dword:12345678 abc\n\n", &r
);
2088 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2089 todo_wine
verify_reg_nonexist(hkey
, "Wine34a");
2090 todo_wine
verify_reg_nonexist(hkey
, "Wine34b");
2092 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2093 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2094 "\"Wine35a\"=dword:0x123\n"
2095 "\"Wine35b\"=dword:123 456\n"
2096 "\"Wine35c\"=dword:1234 5678\n\n", &r
);
2097 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2098 todo_wine
verify_reg_nonexist(hkey
, "Wine35a");
2099 todo_wine
verify_reg_nonexist(hkey
, "Wine35b");
2100 todo_wine
verify_reg_nonexist(hkey
, "Wine35c");
2102 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2103 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2104 "\"Wine36a\"=dword:1234;5678\n"
2105 "\"Wine36b\"=dword:1234 ;5678\n"
2106 "\"Wine36c\"=dword:1234#5678\n"
2107 "\"Wine36d\"=dword:1234 #5678\n\n", &r
);
2108 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2110 todo_wine
verify_reg(hkey
, "Wine36a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2111 todo_wine
verify_reg(hkey
, "Wine36b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2112 todo_wine
verify_reg_nonexist(hkey
, "Wine36c");
2113 todo_wine
verify_reg_nonexist(hkey
, "Wine36d");
2115 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2116 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2117 "\"Wine37a\"=\"foo\"bar\"\n"
2118 "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r
);
2119 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2120 todo_wine
verify_reg_nonexist(hkey
, "Wine37a");
2121 todo_wine
verify_reg_nonexist(hkey
, "Wine37b");
2123 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2124 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2125 "\"Empty string\"=\"\"\n\n", &r
);
2126 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2127 todo_wine
verify_reg(hkey
, "Empty string", REG_SZ
, "", 1, 0);
2129 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2130 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2132 "\"Test38b\"=\\\"\n"
2133 "\"Test38c\"=\\\"Value\\\"\n"
2134 "\"Test38d\"=\\\"Value\"\n\n", &r
);
2135 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2136 todo_wine
verify_reg_nonexist(hkey
, "Test38a");
2137 todo_wine
verify_reg_nonexist(hkey
, "Test38b");
2138 todo_wine
verify_reg_nonexist(hkey
, "Test38c");
2139 todo_wine
verify_reg_nonexist(hkey
, "Test38d");
2141 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2142 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2143 "\"Wine39a\"=\"Value1\" ;comment\n"
2144 "\"Wine39b\"=\"Value2\"\t\t;comment\n"
2145 "\"Wine39c\"=\"Value3\" #comment\n"
2146 "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r
);
2147 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2148 todo_wine
verify_reg(hkey
, "Wine39a", REG_SZ
, "Value1", 7, 0);
2149 todo_wine
verify_reg(hkey
, "Wine39b", REG_SZ
, "Value2", 7, 0);
2150 todo_wine
verify_reg_nonexist(hkey
, "Wine39c");
2151 todo_wine
verify_reg_nonexist(hkey
, "Wine39d");
2153 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2154 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2155 "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r
);
2156 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2157 todo_wine
verify_reg_nonexist(hkey
, "TestNoBeginQuote");
2159 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2160 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2161 "\"TestNoEndQuote\"=\"Asdffdsa\n", &r
);
2162 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2163 todo_wine
verify_reg_nonexist(hkey
, "TestNoEndQuote");
2165 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2166 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2167 "\"TestNoQuotes\"=Asdffdsa\n", &r
);
2168 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2169 todo_wine
verify_reg_nonexist(hkey
, "TestNoQuotes");
2171 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2172 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2173 "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r
);
2174 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2175 todo_wine
verify_reg_nonexist(hkey
, "NameNoBeginQuote");
2177 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2178 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2179 "\"NameNoEndQuote=\"Asdffdsa\"\n", &r
);
2180 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2181 todo_wine
verify_reg_nonexist(hkey
, "NameNoEndQuote");
2183 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2184 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2185 "NameNoQuotes=\"Asdffdsa\"\n", &r
);
2186 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2187 todo_wine
verify_reg_nonexist(hkey
, "NameNoQuotes");
2189 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2190 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2191 "\"MixedQuotes=Asdffdsa\"\n", &r
);
2192 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2193 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes");
2194 todo_wine
verify_reg_nonexist(hkey
, "MixedQuotes=Asdffdsa");
2196 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2197 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2198 "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n"
2199 "\"Wine40b\"=\"Value 1\"\n"
2200 "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n"
2201 "\"Wine40d\"=\"Value 2\"\n"
2202 "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n"
2203 "\"Wine40f\"=\"Value 3\"\n"
2204 "\"Wine40g\"=\"Value 4\"\n\n", &r
);
2205 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2206 todo_wine
verify_reg(hkey
, "Wine40a", REG_EXPAND_SZ
, "Line", 5, 0);
2207 todo_wine
verify_reg(hkey
, "Wine40b", REG_SZ
, "Value 1", 8, 0);
2208 todo_wine
verify_reg_nonexist(hkey
, "Wine40c");
2209 todo_wine
verify_reg(hkey
, "Wine40d", REG_SZ
, "Value 2", 8, 0);
2210 todo_wine
verify_reg_nonexist(hkey
, "Wine40e");
2211 todo_wine
verify_reg_nonexist(hkey
, "Wine40f");
2212 todo_wine
verify_reg(hkey
, "Wine40g", REG_SZ
, "Value 4", 8, 0);
2214 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2215 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2216 "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2217 " 63,00,6f,00,6e,00,\\;comment\n"
2218 " 63,00,61,00,74,00,\\;comment\n"
2219 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2220 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2221 todo_wine
verify_reg(hkey
, "Multi-Line1", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2223 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2224 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2225 "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2226 " 63,00,6f,00,6e,00,\\;comment\n"
2227 " 63,00,61,00,74,00,;comment\n"
2228 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2229 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2230 todo_wine
verify_reg(hkey
, "Multi-Line2", REG_MULTI_SZ
, "Line concat", 12, 0);
2232 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2233 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2234 "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
2235 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2236 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2237 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line3");
2239 test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n"
2240 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2241 "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
2242 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2243 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2244 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line4");
2246 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2247 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2248 "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
2249 ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2250 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2251 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line5");
2253 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2254 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2255 "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
2256 " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2257 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2258 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line6");
2260 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2261 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2262 "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2263 " 65,00,20,00,\\;comment\n"
2264 " 63,00,6f,00,6e,00,\\;comment\n"
2265 " 63,00,61,00,74,00,\\;comment\n"
2266 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2267 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2268 todo_wine
verify_reg(hkey
, "Multi-Line7", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2270 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2271 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2272 "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n"
2273 " 65,00,20,00,\\;#comment\n"
2274 " 63,00,6f,00,6e,00,\\;#comment\n"
2275 " 63,00,61,00,74,00,\\;#comment\n"
2276 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2277 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2278 todo_wine
verify_reg(hkey
, "Multi-Line8", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2280 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2281 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2282 "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n"
2283 " 65,00,20,00,\\;comment\n"
2284 " 63,00,6f,00,6e,00,\\;comment\n"
2285 " 63,00,61,00,74,00,\\#comment\n"
2286 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2287 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2288 todo_wine
verify_reg_nonexist(hkey
, "Multi-Line9");
2290 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2291 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2292 "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2293 " 63,00,6f,00,6e,00,\\;comment\n"
2294 " 63,00,61,00,74,00,\\\n\n"
2295 " 65,00,6e,00,\\;comment\n\n"
2296 " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2297 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2298 todo_wine
verify_reg(hkey
, "Multi-Line10", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2300 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2301 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2302 "\"Wine41a\"=dword:1234\\\n"
2304 "\"Wine41b\"=\"Test \\\n"
2306 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2307 todo_wine
verify_reg_nonexist(hkey
, "Wine41a");
2308 todo_wine
verify_reg_nonexist(hkey
, "Wine41b");
2310 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2311 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2312 "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
2313 "\"single'quote\"=dword:00000008\n\n", &r
);
2314 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2315 todo_wine
verify_reg(hkey
, "double\"quote", REG_SZ
, "valid \"or\" not", 15, 0);
2317 todo_wine
verify_reg(hkey
, "single'quote", REG_DWORD
, &dword
, sizeof(dword
), 0);
2319 /* Test key name and value name concatenation */
2320 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2321 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\\n"
2323 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2324 err
= RegOpenKeyExA(hkey
, "Subkey1", 0, KEY_READ
, &subkey
);
2325 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
2327 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2328 "[HKEY_CURRENT_USER\\" KEY_BASE
"\n"
2329 "\\Subkey2]\n", &r
);
2330 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2331 err
= RegOpenKeyExA(hkey
, "Subkey2", 0, KEY_READ
, &subkey
);
2332 todo_wine
ok(err
== ERROR_FILE_NOT_FOUND
, "got %d, expected 2\n", err
);
2334 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2335 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2337 "42a\"=\"Value 1\"\n"
2338 "\"Wine42b\"=\"Value 2\"\n"
2340 "\\42c\"=\"Value 3\"\n\n", &r
);
2341 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2342 todo_wine
verify_reg_nonexist(hkey
, "Wine42a");
2343 todo_wine
verify_reg(hkey
, "Wine42b", REG_SZ
, "Value 2", 8, 0);
2344 todo_wine
verify_reg_nonexist(hkey
, "Wine42c");
2346 /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
2347 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2348 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2349 "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
2350 "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
2351 " 75,00,65,00,00,00\n"
2352 "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
2353 ",75,00,65,00,00,00\n"
2354 "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
2355 " ,75,00,65,00,00,00\n"
2356 "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
2357 " 75,00,65,00,00,00\n"
2358 "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
2359 "5,00,65,00,00,00\n"
2360 "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
2361 " 5,00,65,00,00,00\n"
2362 "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
2365 "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
2368 "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
2369 " 6c,00,75,00,;comment\n"
2371 "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
2372 " 6c,00,75,00,\\#comment\n"
2373 " 65,00,00,00\n\n", &r
);
2374 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2375 todo_wine
verify_reg(hkey
, "Wine43a", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2376 todo_wine
verify_reg(hkey
, "Wine43b", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2377 todo_wine
verify_reg_nonexist(hkey
, "Wine43c");
2378 todo_wine
verify_reg_nonexist(hkey
, "Wine43d");
2379 todo_wine
verify_reg_nonexist(hkey
, "Wine43e");
2380 todo_wine
verify_reg_nonexist(hkey
, "Wine43f");
2381 todo_wine
verify_reg_nonexist(hkey
, "Wine43g");
2382 todo_wine
verify_reg(hkey
, "Wine43h", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2383 todo_wine
verify_reg(hkey
, "Wine43i", REG_NONE
, "V\0a\0l\0u", 8, 0);
2384 todo_wine
verify_reg(hkey
, "Wine43j", REG_NONE
, "V\0a\0l\0u", 8, 0);
2385 todo_wine
verify_reg_nonexist(hkey
, "Wine43k");
2387 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2388 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2389 "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2390 "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n"
2391 " 54,00,48,00,25,00,00,00\n"
2392 "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n"
2393 ",54,00,48,00,25,00,00,00\n"
2394 "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n"
2395 " ,54,00,48,00,25,00,00,00\n"
2396 "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n"
2397 " 54,00,48,00,25,00,00,00\n"
2398 "\"Wine44f\"=hex(2):25,00,50,00,4\\\n"
2399 "1,00,54,00,48,00,25,00,00,00\n"
2400 "\"Wine44g\"=hex(2):25,00,50,00,4\\\n"
2401 " 1,00,54,00,48,00,25,00,00,00\n"
2402 "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2405 "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2408 "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2409 " 54,00,48,00;comment\n"
2411 "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n"
2412 " 54,00,48,00,\\#comment\n"
2413 " 25,00,00,00\n\n", &r
);
2414 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2415 todo_wine
verify_reg(hkey
, "Wine44a", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2416 todo_wine
verify_reg(hkey
, "Wine44b", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2417 todo_wine
verify_reg_nonexist(hkey
, "Wine44c");
2418 todo_wine
verify_reg_nonexist(hkey
, "Wine44d");
2419 todo_wine
verify_reg_nonexist(hkey
, "Wine44e");
2420 todo_wine
verify_reg_nonexist(hkey
, "Wine44f");
2421 todo_wine
verify_reg_nonexist(hkey
, "Wine44g");
2422 todo_wine
verify_reg(hkey
, "Wine44h", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2424 size
= sizeof(buffer
);
2425 err
= RegQueryValueExA(hkey
, "Wine44i", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2426 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2427 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2428 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2429 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2431 size
= sizeof(buffer
);
2432 memset(buffer
, '-', size
);
2433 err
= RegQueryValueExA(hkey
, "Wine44j", NULL
, &type
, (BYTE
*)&buffer
, &size
);
2434 todo_wine
ok(err
== ERROR_SUCCESS
, "RegQueryValueExA failed: %d\n", err
);
2435 todo_wine
ok(type
== REG_EXPAND_SZ
, "got wrong type %u, expected %u\n", type
, REG_EXPAND_SZ
);
2436 todo_wine
ok(size
== 6 || broken(size
== 5) /* WinXP */, "got wrong size %u, expected 6\n", size
);
2437 todo_wine
ok(memcmp(buffer
, "%PATH", size
) == 0, "got wrong data\n");
2439 todo_wine
verify_reg_nonexist(hkey
, "Wine44k");
2441 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2442 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2443 "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
2444 "\"Wine45b\"=hex:11,22,33,44,\\\n"
2446 "\"Wine45c\"=hex:11,22,33,44\\\n"
2448 "\"Wine45d\"=hex:11,22,33,44\\\n"
2450 "\"Wine45e\"=hex:11,22,33,44\\\n"
2452 "\"Wine45f\"=hex:11,22,33,4\\\n"
2454 "\"Wine45g\"=hex:11,22,33,4\\\n"
2456 "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
2459 "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
2462 "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
2465 "\"Wine45k\"=hex:11,22,33,\\;comment\n"
2466 " 44,55,66,\\#comment\n"
2468 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2469 hex
[0] = 0x11; hex
[1] = 0x22; hex
[2] = 0x33; hex
[3] = 0x44;
2470 hex
[4] = 0x55; hex
[5] = 0x66; hex
[6] = 0x77; hex
[7] = 0x88;
2471 todo_wine
verify_reg(hkey
, "Wine45a", REG_BINARY
, hex
, sizeof(hex
), 0);
2472 todo_wine
verify_reg(hkey
, "Wine45b", REG_BINARY
, hex
, sizeof(hex
), 0);
2473 todo_wine
verify_reg_nonexist(hkey
, "Wine45c");
2474 todo_wine
verify_reg_nonexist(hkey
, "Wine45d");
2475 todo_wine
verify_reg_nonexist(hkey
, "Wine45e");
2476 todo_wine
verify_reg_nonexist(hkey
, "Wine45f");
2477 todo_wine
verify_reg_nonexist(hkey
, "Wine45g");
2478 todo_wine
verify_reg(hkey
, "Wine45h", REG_BINARY
, hex
, sizeof(hex
), 0);
2479 todo_wine
verify_reg(hkey
, "Wine45i", REG_BINARY
, hex
, 6, 0);
2480 todo_wine
verify_reg(hkey
, "Wine45j", REG_BINARY
, hex
, 6, 0);
2481 todo_wine
verify_reg_nonexist(hkey
, "Wine45k");
2483 /* Test import with subkeys */
2484 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2485 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey\"1]\n"
2486 "\"Wine\\\\31\"=\"Test value\"\n\n", &r
);
2487 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2488 err
= RegOpenKeyExA(hkey
, "Subkey\"1", 0, KEY_READ
, &subkey
);
2489 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2490 todo_wine
verify_reg(subkey
, "Wine\\31", REG_SZ
, "Test value", 11, 0);
2491 err
= RegCloseKey(subkey
);
2492 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2493 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey\"1");
2494 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2496 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2497 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey/2]\n"
2498 "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r
);
2499 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2500 err
= RegOpenKeyExA(hkey
, "Subkey/2", 0, KEY_READ
, &subkey
);
2501 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2502 todo_wine
verify_reg(subkey
, "123/\"4;'5", REG_SZ
, "Random value name", 18, 0);
2503 err
= RegCloseKey(subkey
);
2504 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2505 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
"\\Subkey/2");
2506 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2508 /* Test key creation */
2509 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2510 "HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Opening_Bracket]\n", &r
);
2511 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2512 todo_wine
verify_key_nonexist(hkey
, "No_Opening_Bracket");
2514 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2515 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\No_Closing_Bracket\n", &r
);
2516 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2517 todo_wine
verify_key_nonexist(hkey
, "No_Closing_Bracket");
2519 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2520 "[ HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1a]\n", &r
);
2521 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2522 todo_wine
verify_key_nonexist(hkey
, "Subkey1a");
2524 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2525 "[\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1b]\n", &r
);
2526 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2527 todo_wine
verify_key_nonexist(hkey
, "Subkey1b");
2529 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2530 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1c ]\n", &r
);
2531 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2532 todo_wine
verify_key_exist(hkey
, "Subkey1c ");
2533 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1c ");
2534 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2536 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2537 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey1d\t]\n", &r
);
2538 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2539 todo_wine
verify_key_exist(hkey
, "Subkey1d\t");
2540 todo_wine err
= RegDeleteKeyA(hkey
, "Subkey1d\t");
2541 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2543 /* Test key deletion. We start by creating some registry keys. */
2544 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2545 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
2546 "[HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
2547 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2548 todo_wine
verify_key_exist(hkey
, "Subkey2a");
2549 todo_wine
verify_key_exist(hkey
, "Subkey2b");
2551 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2552 "[ -HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
2553 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2554 todo_wine
verify_key_exist(hkey
, "Subkey2a");
2556 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2557 "[\t-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
2558 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2559 todo_wine
verify_key_exist(hkey
, "Subkey2b");
2561 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2562 "[- HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n", &r
);
2563 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2564 todo_wine
verify_key_exist(hkey
, "Subkey2a");
2566 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2567 "[-\tHKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n", &r
);
2568 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2569 todo_wine
verify_key_exist(hkey
, "Subkey2b");
2571 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2572 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2a]\n\n"
2573 "[-HKEY_CURRENT_USER\\" KEY_BASE
"\\Subkey2b]\n\n", &r
);
2574 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2575 todo_wine
verify_key_nonexist(hkey
, "Subkey2a");
2576 todo_wine
verify_key_nonexist(hkey
, "Subkey2b");
2578 /* Test value deletion. We start by creating some registry values. */
2579 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2580 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2581 "\"Wine46a\"=\"Test Value\"\n"
2582 "\"Wine46b\"=dword:00000008\n"
2583 "\"Wine46c\"=hex:11,22,33,44\n"
2584 "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2585 " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n"
2586 " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n"
2587 "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n"
2588 "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r
);
2589 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2590 todo_wine
verify_reg(hkey
, "Wine46a", REG_SZ
, "Test Value", 11, 0);
2591 todo_wine
verify_reg(hkey
, "Wine46b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2592 todo_wine
verify_reg(hkey
, "Wine46c", REG_BINARY
, hex
, 4, 0);
2593 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2594 todo_wine
verify_reg(hkey
, "Wine46e", REG_EXPAND_SZ
, "%PATH%", 7, 0);
2595 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2597 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2598 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2601 "\"Wine46c\"= \t-\t \n"
2602 "\"Wine46d\"=-\"Test\"\n"
2603 "\"Wine46e\"=- ;comment\n"
2604 "\"Wine46f\"=- #comment\n\n", &r
);
2605 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2606 todo_wine
verify_reg_nonexist(hkey
, "Wine46a");
2607 todo_wine
verify_reg_nonexist(hkey
, "Wine46b");
2608 todo_wine
verify_reg_nonexist(hkey
, "Wine46c");
2609 todo_wine
verify_reg(hkey
, "Wine46d", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2610 todo_wine
verify_reg_nonexist(hkey
, "Wine46e");
2611 todo_wine
verify_reg(hkey
, "Wine46f", REG_NONE
, "V\0a\0l\0u\0e\0\0", 12, 0);
2613 err
= RegCloseKey(hkey
);
2614 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2616 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
2617 todo_wine
ok(err
== ERROR_SUCCESS
, "got %d, expected 0\n", err
);
2620 static void test_import_with_whitespace(void)
2626 test_import_str(" REGEDIT4\n\n"
2627 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
2628 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2630 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
2631 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
2633 test_import_str(" REGEDIT4\n\n"
2634 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2635 "\"Wine1a\"=\"Value\"\n\n", &r
);
2636 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2637 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
2639 test_import_str("\tREGEDIT4\n\n"
2640 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2641 "\"Wine1b\"=\"Value\"\n\n", &r
);
2642 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2643 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
2645 test_import_str(" \t REGEDIT4\n\n"
2646 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2647 "\"Wine1c\"=\"Value\"\n\n", &r
);
2648 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2649 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
2651 test_import_str("REGEDIT4\n\n"
2652 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2653 "\"Wine2a\"=\"Value\"\n\n", &r
);
2654 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2655 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
2657 test_import_str("REGEDIT4\n\n"
2658 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2659 "\"Wine2b\"=\"Value\"\n\n", &r
);
2660 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2661 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
2663 test_import_str("REGEDIT4\n\n"
2664 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2665 "\"Wine2c\"=\"Value\"\n\n", &r
);
2666 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2667 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
2669 test_import_str("REGEDIT4\n\n"
2670 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2671 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
2672 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2673 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
2675 test_import_str("REGEDIT4\n\n"
2676 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2677 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
2678 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2679 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
2681 test_import_str("REGEDIT4\n\n"
2682 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2683 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
2684 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2685 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
2687 test_import_str(" REGEDIT4\n\n"
2688 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2689 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
2690 " \"Wine4b\"=dword:00112233\n"
2691 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n"
2692 " 63,6f,6e,\\;comment\n"
2693 "\t\t\t\t63,61,74,\\;comment\n"
2694 " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r
);
2695 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2696 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
2698 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2699 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2701 test_import_str(" REGEDIT4\n\n"
2702 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2703 " \"Wine5a\"=\"Leading spaces\"\n"
2704 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
2705 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
2706 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
2707 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2708 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
2709 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
2710 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
2711 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
2713 test_import_str("REGEDIT4\n\n"
2714 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2715 "\" Wine6a\"=\"Leading spaces\"\n"
2716 "\"\t\tWine6b\"=\"Leading tabs\"\n"
2717 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
2718 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2719 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
2720 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
2721 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
2723 test_import_str("REGEDIT4\n\n"
2724 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2725 "\"Wine7a\"=\" Four spaces in the data\"\n"
2726 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
2727 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2728 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
2729 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
2731 test_import_str("REGEDIT4\n\n"
2732 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2733 "\"Wine8a\"=\"Trailing spaces\" \n"
2734 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
2735 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2736 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
2737 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
2739 test_import_str("REGEDIT4\n\n"
2740 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2741 "\"Wine9a\"=dword: 00000008\n"
2742 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
2743 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2745 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2746 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2748 test_import_str("REGEDIT4\n\n"
2749 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2750 "@ = \"Test Value\"\n\n", &r
);
2751 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2752 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
2754 test_import_str("REGEDIT4\n\n"
2755 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2756 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
2757 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2758 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
2760 err
= RegCloseKey(hkey
);
2761 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
2763 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
2764 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
2766 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
2767 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n\n", &r
);
2768 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2770 err
= RegOpenKeyExA(HKEY_CURRENT_USER
, KEY_BASE
, 0, KEY_READ
, &hkey
);
2771 todo_wine
ok(err
== ERROR_SUCCESS
, "RegOpenKeyExA failed: got %d, expected 0\n", err
);
2773 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
2774 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2775 "\"Wine1a\"=\"Value\"\n\n", &r
);
2776 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2777 todo_wine
verify_reg(hkey
, "Wine1a", REG_SZ
, "Value", 6, 0);
2779 test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n"
2780 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2781 "\"Wine1b\"=\"Value\"\n\n", &r
);
2782 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2783 todo_wine
verify_reg(hkey
, "Wine1b", REG_SZ
, "Value", 6, 0);
2785 test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n"
2786 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2787 "\"Wine1c\"=\"Value\"\n\n", &r
);
2788 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2789 todo_wine
verify_reg(hkey
, "Wine1c", REG_SZ
, "Value", 6, 0);
2791 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2792 " [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2793 "\"Wine2a\"=\"Value\"\n\n", &r
);
2794 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2795 todo_wine
verify_reg(hkey
, "Wine2a", REG_SZ
, "Value", 6, 0);
2797 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2798 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2799 "\"Wine2b\"=\"Value\"\n\n", &r
);
2800 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2801 todo_wine
verify_reg(hkey
, "Wine2b", REG_SZ
, "Value", 6, 0);
2803 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2804 " \t [HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2805 "\"Wine2c\"=\"Value\"\n\n", &r
);
2806 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2807 todo_wine
verify_reg(hkey
, "Wine2c", REG_SZ
, "Value", 6, 0);
2809 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2810 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2811 " \"Wine3a\"=\"Two leading spaces\"\n\n", &r
);
2812 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2813 todo_wine
verify_reg(hkey
, "Wine3a", REG_SZ
, "Two leading spaces", 19, 0);
2815 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2816 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2817 "\t\"Wine3b\"=\"One leading tab\"\n\n", &r
);
2818 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2819 todo_wine
verify_reg(hkey
, "Wine3b", REG_SZ
, "One leading tab", 16, 0);
2821 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2822 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2823 " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r
);
2824 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %u, expected 0\n", r
);
2825 todo_wine
verify_reg(hkey
, "Wine3c", REG_SZ
, "Space, tab, space", 18, 0);
2827 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
2828 "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2829 "\t \"Wine4a\"=\"Tab and four spaces\"\n"
2830 " \"Wine4b\"=dword:00112233\n"
2831 "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
2832 " 63,00,6f,00,6e,00,\\;comment\n"
2833 "\t\t\t\t63,00,61,00,74,00,\\;comment\n"
2834 " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r
);
2835 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2836 todo_wine
verify_reg(hkey
, "Wine4a", REG_SZ
, "Tab and four spaces", 20, 0);
2838 todo_wine
verify_reg(hkey
, "Wine4b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2839 todo_wine
verify_reg(hkey
, "Wine4c", REG_MULTI_SZ
, "Line concatenation\0", 20, 0);
2841 test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n"
2842 "\t[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2843 " \"Wine5a\"=\"Leading spaces\"\n"
2844 "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n"
2845 "\t \"Wine5c\"=\t \"Tabs and spaces\"\n"
2846 " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r
);
2847 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2848 todo_wine
verify_reg(hkey
, "Wine5a", REG_SZ
, "Leading spaces", 15, 0);
2849 todo_wine
verify_reg(hkey
, "Wine5b", REG_SZ
, "Leading tabs", 13, 0);
2850 todo_wine
verify_reg(hkey
, "Wine5c", REG_SZ
, "Tabs and spaces", 16, 0);
2851 todo_wine
verify_reg(hkey
, "Wine5d", REG_SZ
, "More whitespace", 16, 0);
2853 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2854 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2855 "\" Wine6a\"=\"Leading spaces\"\n"
2856 "\"\t\tWine6b\"=\"Leading tabs\"\n"
2857 " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r
);
2858 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2859 todo_wine
verify_reg(hkey
, " Wine6a", REG_SZ
, "Leading spaces", 15, 0);
2860 todo_wine
verify_reg(hkey
, "\t\tWine6b", REG_SZ
, "Leading tabs", 13, 0);
2861 todo_wine
verify_reg(hkey
, " Wine6c ", REG_SZ
, " Spaces everywhere ", 22, 0);
2863 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2864 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2865 "\"Wine7a\"=\" Four spaces in the data\"\n"
2866 "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r
);
2867 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2868 todo_wine
verify_reg(hkey
, "Wine7a", REG_SZ
, " Four spaces in the data", 28, 0);
2869 todo_wine
verify_reg(hkey
, "Wine7b", REG_SZ
, "\t\tTwo tabs in the data", 23, 0);
2871 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2872 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2873 "\"Wine8a\"=\"Trailing spaces\" \n"
2874 "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r
);
2875 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2876 todo_wine
verify_reg(hkey
, "Wine8a", REG_SZ
, "Trailing spaces", 16, 0);
2877 todo_wine
verify_reg(hkey
, "Wine8b", REG_SZ
, "Trailing tabs and spaces", 25, 0);
2879 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2880 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2881 "\"Wine9a\"=dword: 00000008\n"
2882 "\"Wine9b\"=dword:\t\t00000008\n\n", &r
);
2883 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2885 todo_wine
verify_reg(hkey
, "Wine9a", REG_DWORD
, &dword
, sizeof(dword
), 0);
2886 todo_wine
verify_reg(hkey
, "Wine9b", REG_DWORD
, &dword
, sizeof(dword
), 0);
2888 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2889 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2890 "@ = \"Test Value\"\n\n", &r
);
2891 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2892 todo_wine
verify_reg(hkey
, "", REG_SZ
, "Test Value", 11, 0);
2894 test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
2895 "[HKEY_CURRENT_USER\\" KEY_BASE
"]\n"
2896 "\t@\t=\tdword:\t00000008\t\n\n", &r
);
2897 todo_wine
ok(r
== REG_EXIT_SUCCESS
, "got exit code %d, expected 0\n", r
);
2898 todo_wine
verify_reg(hkey
, "", REG_DWORD
, &dword
, sizeof(DWORD
), 0);
2900 err
= RegCloseKey(hkey
);
2901 todo_wine
ok(err
== ERROR_SUCCESS
, "RegCloseKey failed: got %d, expected 0\n", err
);
2903 err
= RegDeleteKeyA(HKEY_CURRENT_USER
, KEY_BASE
);
2904 todo_wine
ok(err
== ERROR_SUCCESS
, "RegDeleteKeyA failed: got %d, expected 0\n", err
);
2910 if (!run_reg_exe("reg.exe /?", &r
)) {
2911 win_skip("reg.exe not available, skipping reg.exe tests\n");
2920 test_import_with_whitespace();