reg/tests: Modify delete_key() to support use of RegDeleteKeyEx().
[wine.git] / programs / reg / tests / add.c
blobd2548c7d1709c8274b2f04b73d127301e8d3ec67
1 /*
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
19 #include "reg_test.h"
21 BOOL run_reg_exe_(const char *file, unsigned line, const char *cmd, DWORD *rc)
23 STARTUPINFOA si = {sizeof(STARTUPINFOA)};
24 PROCESS_INFORMATION pi;
25 BOOL bret;
26 DWORD ret;
27 char cmdline[256];
29 si.dwFlags = STARTF_USESTDHANDLES;
30 si.hStdInput = INVALID_HANDLE_VALUE;
31 si.hStdOutput = INVALID_HANDLE_VALUE;
32 si.hStdError = INVALID_HANDLE_VALUE;
34 strcpy(cmdline, cmd);
35 if (!CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
36 return FALSE;
38 ret = WaitForSingleObject(pi.hProcess, 10000);
39 if (ret == WAIT_TIMEOUT)
40 TerminateProcess(pi.hProcess, 1);
42 bret = GetExitCodeProcess(pi.hProcess, rc);
43 lok(bret, "GetExitCodeProcess failed: %d\n", GetLastError());
45 CloseHandle(pi.hThread);
46 CloseHandle(pi.hProcess);
47 return bret;
50 void verify_reg_(const char *file, unsigned line, HKEY hkey, const char *value,
51 DWORD exp_type, const void *exp_data, DWORD exp_size, DWORD todo)
53 DWORD type, size;
54 BYTE data[256];
55 LONG err;
57 size = sizeof(data);
58 memset(data, 0xdd, size);
59 err = RegQueryValueExA(hkey, value, NULL, &type, data, &size);
60 lok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got error %d\n", err);
61 if (err != ERROR_SUCCESS)
62 return;
64 todo_wine_if (todo & TODO_REG_TYPE)
65 lok(type == exp_type, "got registry type %d, expected %d\n", type, exp_type);
66 todo_wine_if (todo & TODO_REG_SIZE)
67 lok(size == exp_size, "got data size %d, expected %d\n", size, exp_size);
68 if (exp_data)
70 todo_wine_if (todo & TODO_REG_DATA)
71 lok(memcmp(data, exp_data, size) == 0, "registry data does not match\n");
75 void verify_reg_nonexist_(const char *file, unsigned line, HKEY hkey, const char *value)
77 LONG err;
79 err = RegQueryValueExA(hkey, value, NULL, NULL, NULL, NULL);
80 lok(err == ERROR_FILE_NOT_FOUND, "registry value '%s' shouldn't exist; got %d, expected 2\n",
81 (value && *value) ? value : "(Default)", err);
84 void open_key_(const char *file, unsigned line, const HKEY base, const char *path,
85 const DWORD sam, HKEY *hkey)
87 LONG err;
89 err = RegOpenKeyExA(base, path, 0, KEY_READ|sam, hkey);
90 lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: got error %d\n", err);
93 void close_key_(const char *file, unsigned line, HKEY hkey)
95 LONG err;
97 err = RegCloseKey(hkey);
98 lok(err == ERROR_SUCCESS, "RegCloseKey failed: got error %d\n", err);
101 void verify_key_(const char *file, unsigned line, HKEY key_base, const char *subkey)
103 HKEY hkey;
104 LONG err;
106 err = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey);
107 lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: got error %d\n", err);
109 if (hkey)
110 RegCloseKey(hkey);
113 void verify_key_nonexist_(const char *file, unsigned line, HKEY key_base, const char *subkey)
115 HKEY hkey;
116 LONG err;
118 err = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey);
119 lok(err == ERROR_FILE_NOT_FOUND, "registry key '%s' shouldn't exist; got %d, expected 2\n",
120 subkey, err);
122 if (hkey)
123 RegCloseKey(hkey);
126 void add_key_(const char *file, unsigned line, const HKEY hkey, const char *path, HKEY *subkey)
128 LONG err;
129 HKEY new_key;
131 err = RegCreateKeyExA(hkey, path, 0, NULL, REG_OPTION_NON_VOLATILE,
132 KEY_READ|KEY_WRITE, NULL, &new_key, NULL);
133 lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: got error %d\n", err);
135 if (subkey)
136 *subkey = new_key;
137 else
138 RegCloseKey(new_key);
141 void delete_key_(const char *file, unsigned line, HKEY root, const char *path, REGSAM sam)
143 LONG err;
145 if (!path) return;
147 if (!sam)
149 err = RegDeleteKeyA(root, path);
150 lok(err == ERROR_SUCCESS, "RegDeleteKeyA failed: got error %d\n", err);
152 else
154 err = RegDeleteKeyExA(root, path, sam, 0);
155 lok(err == ERROR_SUCCESS, "RegDeleteKeyExA failed: got error %d\n", err);
159 LONG delete_tree(const HKEY key, const char *subkey)
161 HKEY hkey;
162 LONG ret;
163 char *subkey_name = NULL;
164 DWORD max_subkey_len, subkey_len;
165 static const char empty[1];
167 ret = RegOpenKeyExA(key, subkey, 0, KEY_READ, &hkey);
168 if (ret) return ret;
170 ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &max_subkey_len,
171 NULL, NULL, NULL, NULL, NULL, NULL);
172 if (ret) goto cleanup;
174 max_subkey_len++;
176 subkey_name = HeapAlloc(GetProcessHeap(), 0, max_subkey_len);
177 if (!subkey_name)
179 ret = ERROR_NOT_ENOUGH_MEMORY;
180 goto cleanup;
183 for (;;)
185 subkey_len = max_subkey_len;
186 ret = RegEnumKeyExA(hkey, 0, subkey_name, &subkey_len, NULL, NULL, NULL, NULL);
187 if (ret == ERROR_NO_MORE_ITEMS) break;
188 if (ret) goto cleanup;
189 ret = delete_tree(hkey, subkey_name);
190 if (ret) goto cleanup;
193 ret = RegDeleteKeyA(hkey, empty);
195 cleanup:
196 HeapFree(GetProcessHeap(), 0, subkey_name);
197 RegCloseKey(hkey);
198 return ret;
201 void add_value_(const char *file, unsigned line, HKEY hkey, const char *name,
202 DWORD type, const void *data, size_t size)
204 LONG err;
206 err = RegSetValueExA(hkey, name, 0, type, (const BYTE *)data, size);
207 lok(err == ERROR_SUCCESS, "RegSetValueExA failed: got error %d\n", err);
210 void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name)
212 LONG err;
214 err = RegDeleteValueA(hkey, name);
215 lok(err == ERROR_SUCCESS, "RegDeleteValueA failed: got error %d\n", err);
218 /* Unit tests */
220 static void test_command_syntax(void)
222 DWORD r;
224 delete_tree(HKEY_CURRENT_USER, KEY_BASE);
225 verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
227 run_reg_exe("reg add", &r);
228 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
230 run_reg_exe("reg add /?", &r);
231 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
233 run_reg_exe("reg add /h", &r);
234 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
236 run_reg_exe("reg add -H", &r);
237 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
239 /* Duplicate switches */
240 run_reg_exe("reg add HKCU\\" KEY_BASE " /v Wine /t REG_DWORD /d 0x1 /v Test /f", &r);
241 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
243 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup1 /t REG_DWORD /d 123 /f /t REG_SZ", &r);
244 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
245 "got exit code %d, expected 1\n", r);
247 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup2 /t REG_DWORD /d 123 /f /d 456", &r);
248 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
250 run_reg_exe("reg add HKCU\\" KEY_BASE " /f /f", &r);
251 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
253 run_reg_exe("reg add HKCU\\" KEY_BASE " /v Wine /ve", &r);
254 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
256 /* No /v argument */
257 run_reg_exe("reg add HKCU\\" KEY_BASE " /v", &r);
258 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
260 run_reg_exe("reg add HKCU\\" KEY_BASE " /d Test /f /v", &r);
261 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
263 /* Test invalid switches */
264 run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid1 /a", &r);
265 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
267 run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid2 /ae", &r);
268 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
270 run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid3 /", &r);
271 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
273 run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid4 -", &r);
274 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
276 /* Test empty type */
277 run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r);
278 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
281 static void test_key_formats(void)
283 HKEY hkey;
284 DWORD r;
285 LONG err;
287 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
289 run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r);
290 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
291 verify_key_nonexist(hkey, "keytest0");
293 run_reg_exe("reg add \\\\HKCU\\" KEY_BASE "\\keytest1 /f", &r);
294 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
295 verify_key_nonexist(hkey, "keytest1");
297 run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r);
298 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
299 "got exit code %u, expected 1\n", r);
300 err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2");
301 ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */),
302 "got exit code %d, expected 2\n", err);
304 run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r);
305 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
306 verify_key(hkey, "keytest3");
308 run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest4 /f", &r);
309 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
310 verify_key(hkey, "keytest4");
312 run_reg_exe("reg add HKCU\\" KEY_BASE "\\https://winehq.org /f", &r);
313 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
314 verify_key(hkey, "https://winehq.org");
316 close_key(hkey);
317 delete_tree(HKEY_CURRENT_USER, KEY_BASE);
319 /* Test validity of trailing backslash after system key */
320 run_reg_exe("reg add HKCU\\ /v Value1 /t REG_SZ /d foo /f", &r);
321 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
322 verify_reg_nonexist(HKEY_CURRENT_USER, "Value1");
324 run_reg_exe("reg add HKEY_CURRENT_USER\\ /v Value2 /t REG_SZ /d bar /f", &r);
325 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
326 verify_reg_nonexist(HKEY_CURRENT_USER, "Value2");
329 static void test_add(void)
331 HKEY hkey;
332 DWORD r, dword;
334 run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r);
335 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
337 open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_WRITE, &hkey);
339 /* The Default value is initialized if no parameters are specified */
340 verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
341 delete_value(hkey, NULL);
343 /* This also occurs when specifying a registry type and passing data */
344 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /d 0x5 /f", &r);
345 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
346 dword = 0x5;
347 verify_reg(hkey, NULL, REG_DWORD, &dword, sizeof(dword), 0);
349 /* The Default value can also be overwritten as an empty string */
350 run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r);
351 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
352 verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
354 close_key(hkey);
355 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
357 /* Specifying a value name doesn't initialize the Default value in a new key */
358 run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test /t REG_SZ /d \"Just me here\" /f", &r);
359 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
361 open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
363 verify_reg(hkey, "Test", REG_SZ, "Just me here", 13, 0);
364 verify_reg_nonexist(hkey, NULL);
366 close_key(hkey);
367 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
369 /* Adding a registry key via WinAPI doesn't initialize the Default value... */
370 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
371 verify_reg_nonexist(hkey, NULL);
373 /* ... but we can add it without passing [/f] to reg.exe */
374 run_reg_exe("reg add HKCU\\" KEY_BASE, &r);
375 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
376 verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
377 delete_value(hkey, NULL);
379 /* Test whether overwriting a registry key modifies existing keys and values */
380 add_key(hkey, "Subkey", NULL);
381 add_value(hkey, "Test1", REG_SZ, "Value1", 7);
382 dword = 0x123;
383 add_value(hkey, "Test2", REG_DWORD, &dword, sizeof(dword));
385 run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r);
386 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
388 verify_key(HKEY_CURRENT_USER, KEY_BASE);
389 verify_key(hkey, "Subkey");
390 verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0);
391 verify_reg(hkey, "Test2", REG_DWORD, &dword, sizeof(dword), 0);
392 verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
394 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_NONE /d Test /f", &r);
395 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
397 verify_key(HKEY_CURRENT_USER, KEY_BASE);
398 verify_key(hkey, "Subkey");
399 verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0);
400 verify_reg(hkey, "Test2", REG_DWORD, &dword, sizeof(dword), 0);
401 verify_reg(hkey, NULL, REG_NONE, "T\0e\0s\0t\0\0", 10, 0);
403 close_key(hkey);
404 delete_tree(HKEY_CURRENT_USER, KEY_BASE);
407 static void test_reg_none(void)
409 HKEY hkey;
410 DWORD r;
412 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
414 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_NONE /f", &r);
415 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
416 verify_reg(hkey, NULL, REG_NONE, "\0", 2, 0);
418 delete_value(hkey, NULL);
420 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_NONE /f", &r);
421 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
422 verify_reg(hkey, NULL, REG_NONE, "\0", 2, 0);
424 run_reg_exe("reg add HKCU\\" KEY_BASE " /v none0 /d deadbeef /t REG_NONE /f", &r);
425 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
426 verify_reg(hkey, "none0", REG_NONE, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0);
428 run_reg_exe("reg add HKCU\\" KEY_BASE " /v none1 /t REG_NONE /f", &r);
429 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
430 verify_reg(hkey, "none1", REG_NONE, "\0", 2, 0);
432 close_key(hkey);
433 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
436 static void test_reg_sz(void)
438 HKEY hkey;
439 DWORD r;
441 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
443 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /f", &r);
444 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
445 verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
447 run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r);
448 ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),
449 "got exit code %d, expected 0\n", r);
450 if (r == REG_EXIT_SUCCESS)
451 verify_reg(hkey, "", REG_SZ, "WineTest", 9, 0);
452 else
453 win_skip("broken reg.exe detected\n");
455 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /f", &r);
456 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
457 verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
459 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /f /ve", &r);
460 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
462 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r);
463 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
464 verify_reg(hkey, "", REG_SZ, "WineTEST", 9, 0);
466 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_SZ /f", &r);
467 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
468 verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
470 run_reg_exe("reg add HKCU\\" KEY_BASE " /v test0 /d deadbeef /f", &r);
471 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
472 verify_reg(hkey, "test0", REG_SZ, "deadbeef", 9, 0);
474 run_reg_exe("reg add HKCU\\" KEY_BASE " /v test0 /f", &r);
475 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
476 verify_reg(hkey, "test0", REG_SZ, "", 1, 0);
478 run_reg_exe("reg add HKCU\\" KEY_BASE " /v test1 /t REG_SZ /f /d", &r);
479 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
481 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test2 /f", &r);
482 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
483 verify_reg(hkey, "test2", REG_SZ, "", 1, 0);
485 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test3 /f /d \"\"", &r);
486 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
487 verify_reg(hkey, "test3", REG_SZ, "", 1, 0);
489 run_reg_exe("reg add HKCU\\" KEY_BASE " /v string\\04 /t REG_SZ /d \"Value\" /f", &r);
490 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
491 verify_reg(hkey, "string\\04", REG_SZ, "Value", 6, 0);
493 run_reg_exe("reg add HKCU\\" KEY_BASE " /v string5 /t REG_SZ /d \"foo\\0bar\" /f", &r);
494 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
495 verify_reg(hkey, "string5", REG_SZ, "foo\\0bar", 9, 0);
497 run_reg_exe("reg add HKCU\\" KEY_BASE " /v \\0 /t REG_SZ /d \"Value\" /f", &r);
498 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
499 verify_reg(hkey, "\\0", REG_SZ, "Value", 6, 0);
501 /* Test support for forward and back slashes in value names */
502 run_reg_exe("reg add HKCU\\" KEY_BASE " /v count/up /d one/two/three /f", &r);
503 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
504 verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0);
506 run_reg_exe("reg add HKCU\\" KEY_BASE " /v \\foo\\bar /f", &r);
507 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
508 verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0);
510 close_key(hkey);
511 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
514 static void test_reg_expand_sz(void)
516 HKEY hkey;
517 DWORD r;
519 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
521 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /f", &r);
522 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
523 verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, 0);
525 delete_value(hkey, NULL);
527 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_EXPAND_SZ /f", &r);
528 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
529 verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, 0);
531 run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r);
532 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
533 verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0);
535 run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r);
536 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
537 verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, 0);
539 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r);
540 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
541 verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, 0);
543 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r);
544 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
545 verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, 0);
547 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r);
548 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
549 verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0);
551 close_key(hkey);
552 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
555 static void test_reg_binary(void)
557 HKEY hkey;
558 DWORD r, dword, type, size;
559 char buffer[22];
560 LONG err;
562 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
564 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /f", &r);
565 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
566 verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0);
568 delete_value(hkey, NULL);
570 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_BINARY /f", &r);
571 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
572 verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0);
574 run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_BINARY /d deadbeef /f", &r);
575 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
576 dword = 0xefbeadde;
577 verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), 0);
579 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r);
580 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
581 verify_reg(hkey, "bin0", REG_BINARY, buffer, 0, 0);
583 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r);
584 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
586 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin2 /f /d x01", &r);
587 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
589 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin3 /f /d 01x", &r);
590 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
592 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r);
593 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
594 /* Remaining nibble prefixed */
595 buffer[0] = 0x0d; buffer[1] = 0xea; buffer[2] = 0xdb;
596 buffer[3] = 0xee; buffer[4] = 0xf0; buffer[5] = 0xdd;
597 /* Remaining nibble suffixed on WinXP */
598 buffer[6] = 0xde; buffer[7] = 0xad; buffer[8] = 0xbe;
599 buffer[9] = 0xef; buffer[10] = 0x0d; buffer[11] = 0xd0;
600 size = 6;
601 err = RegQueryValueExA(hkey, "bin4", NULL, &type, (void *) (buffer+12), &size);
602 ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err);
603 ok(type == REG_BINARY, "got wrong type %u\n", type);
604 ok(size == 6, "got wrong size %u\n", size);
605 ok(memcmp(buffer, buffer+12, 6) == 0 ||
606 broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n");
608 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin5 /d \"\" /f", &r);
609 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
610 verify_reg(hkey, "bin5", REG_BINARY, buffer, 0, 0);
612 run_reg_exe("reg add HKCU\\" KEY_BASE " /v bin6 /t REG_BINARY /f /d", &r);
613 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
615 close_key(hkey);
616 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
619 static void test_reg_dword(void)
621 HKEY hkey;
622 DWORD r, dword, type, size;
623 LONG err;
625 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
627 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r);
628 ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),
629 "got exit code %d, expected 0\n", r);
630 dword = 12345678;
631 if (r == REG_EXIT_SUCCESS)
632 verify_reg(hkey, "", REG_DWORD, &dword, sizeof(dword), 0);
633 else
634 win_skip("broken reg.exe detected\n");
636 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_DWORD /f", &r);
637 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r);
639 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword0 /t REG_DWORD /f /d", &r);
640 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
642 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r);
643 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
644 "got exit code %d, expected 1\n", r);
646 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r);
647 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
649 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword3 /t REG_DWORD /d deadbeef /f", &r);
650 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
652 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword4 /t REG_DWORD /d 123xyz /f", &r);
653 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
655 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword5 /t reg_dword /d 12345678 /f", &r);
656 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
657 dword = 12345678;
658 verify_reg(hkey, "dword5", REG_DWORD, &dword, sizeof(dword), 0);
660 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword6 /t REG_DWORD /D 0123 /f", &r);
661 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
662 size = sizeof(dword);
663 err = RegQueryValueExA(hkey, "dword6", NULL, &type, (LPBYTE)&dword, &size);
664 ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err);
665 ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD);
666 ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD));
667 ok(dword == 123 || broken(dword == 0123 /* WinXP */), "got wrong data %d, expected 123\n", dword);
669 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r);
670 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
672 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r);
673 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
674 dword = 0xdeadbeef;
675 verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), 0);
677 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r);
678 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r);
680 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r);
681 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r);
683 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword11 /t REG_dword /d 0x01ffffffff /f", &r);
684 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r);
686 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword12 /t REG_DWORD /d 0xffffffff /f", &r);
687 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
688 dword = ~0u;
689 verify_reg(hkey, "dword12", REG_DWORD, &dword, sizeof(dword), 0);
691 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword13 /t REG_DWORD /d 00x123 /f", &r);
692 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
694 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword14 /t REG_DWORD /d 0X123 /f", &r);
695 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
696 dword = 0x123;
697 verify_reg(hkey, "dword14", REG_DWORD, &dword, sizeof(dword), 0);
699 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword15 /t REG_DWORD /d 4294967296 /f", &r);
700 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u, expected 1\n", r);
702 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword16 /t REG_DWORD /d 456 /f", &r);
703 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
704 dword = 456;
705 verify_reg(hkey, "dword16", REG_DWORD, &dword, sizeof(dword), 0);
707 run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword17 /t REG_DWORD /d 0x456 /f", &r);
708 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
709 dword = 0x456;
710 verify_reg(hkey, "dword17", REG_DWORD, &dword, sizeof(dword), 0);
712 /* REG_DWORD_LITTLE_ENDIAN */
713 run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r);
714 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
715 dword = 456;
716 verify_reg(hkey, "DWORD_LE", REG_DWORD_LITTLE_ENDIAN, &dword, sizeof(dword), 0);
718 close_key(hkey);
719 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
722 /* REG_DWORD_BIG_ENDIAN is broken in every version of Windows. It behaves
723 * like an ordinary REG_DWORD, which is little endian.
725 static void test_reg_dword_big_endian(void)
727 HKEY hkey;
728 DWORD r, dword;
730 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_DWORD_BIG_ENDIAN /f", &r);
731 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r);
733 run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test1 /t REG_DWORD_BIG_ENDIAN /f /d", &r);
734 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
736 run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test2 /t REG_DWORD_BIG_ENDIAN /f", &r);
737 ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 1\n", r);
739 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
741 run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test3 /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r);
742 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
743 dword = 456;
744 verify_reg(hkey, "Test3", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0);
746 run_reg_exe("reg add HKCU\\" KEY_BASE " /v Test4 /t REG_DWORD_BIG_ENDIAN /d 0x456 /f", &r);
747 ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
748 dword = 0x456;
749 verify_reg(hkey, "Test4", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0);
751 close_key(hkey);
752 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
755 static void test_reg_multi_sz(void)
757 HKEY hkey;
758 DWORD r;
760 add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey);
762 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /f", &r);
763 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
764 verify_reg(hkey, NULL, REG_MULTI_SZ, "", 1, 0);
766 delete_value(hkey, NULL);
768 run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_MULTI_SZ /f", &r);
769 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
770 verify_reg(hkey, NULL, REG_MULTI_SZ, "", 1, 0);
772 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r);
773 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
774 verify_reg(hkey, "multi0", REG_MULTI_SZ, "three\0little\0strings\0", 22, 0);
776 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r);
777 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
778 verify_reg(hkey, "multi1", REG_MULTI_SZ, "three\0little\0strings\0", 22, 0);
780 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r);
781 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
782 verify_reg(hkey, "multi2", REG_MULTI_SZ, "", 1, 0);
784 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r);
785 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
786 verify_reg(hkey, "multi3", REG_MULTI_SZ, "", 1, 0);
788 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r);
789 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
790 verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0);
792 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r);
793 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
795 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r);
796 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
798 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r);
799 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
801 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r);
802 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
804 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r);
805 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
807 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r);
808 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
810 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r);
811 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
812 verify_reg(hkey, "multi11", REG_MULTI_SZ, "a\0", 3, 0);
814 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi12 /t REG_MULTI_SZ /f /d", &r);
815 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
817 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi13 /t REG_MULTI_SZ /f /s", &r);
818 ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
820 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi14 /t REG_MULTI_SZ /d \"\\0a\" /f", &r);
821 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
823 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi15 /t REG_MULTI_SZ /d \"a\\0\" /f", &r);
824 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
825 verify_reg(hkey, "multi15", REG_MULTI_SZ, "a\0", 3, 0);
827 run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi16 /d \"two\\0\\0strings\" /f", &r);
828 ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
830 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi17 /t REG_MULTI_SZ /s \"#\" /d \"#\" /f", &r);
831 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
832 verify_reg(hkey, "multi17", REG_MULTI_SZ, "\0", 2, 0);
834 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi18 /t REG_MULTI_SZ /d \"\\0\" /f", &r);
835 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
836 verify_reg(hkey, "multi18", REG_MULTI_SZ, "\0", 2, 0);
838 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi19 /t REG_MULTI_SZ /s \"#\" /d \"two\\0#strings\" /f", &r);
839 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
840 verify_reg(hkey, "multi19", REG_MULTI_SZ, "two\\0\0strings\0", 15, 0);
842 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi20 /t REG_MULTI_SZ /s \"#\" /d \"two#\\0strings\" /f", &r);
843 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
844 verify_reg(hkey, "multi20", REG_MULTI_SZ, "two\0\\0strings\0", 15, 0);
846 run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi21 /t REG_MULTI_SZ /s \"#\" /d \"two\\0\\0strings\" /f", &r);
847 ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
848 verify_reg(hkey, "multi21", REG_MULTI_SZ, "two\\0\\0strings\0", 16, 0);
850 close_key(hkey);
851 delete_key(HKEY_CURRENT_USER, KEY_BASE, 0);
854 START_TEST(add)
856 DWORD r;
858 if (!run_reg_exe("reg.exe /?", &r)) {
859 win_skip("reg.exe not available, skipping 'add' tests\n");
860 return;
863 test_command_syntax();
864 test_key_formats();
865 test_add();
866 test_reg_none();
867 test_reg_sz();
868 test_reg_expand_sz();
869 test_reg_binary();
870 test_reg_dword();
871 test_reg_dword_big_endian();
872 test_reg_multi_sz();