https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d40c4ec10d0483810d2b1…
commit d40c4ec10d0483810d2b1f58f6cadb235f3ae3bf
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Jan 16 21:21:18 2022 +0100
Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com>
CommitDate: Sun Jun 19 13:06:35 2022 +0200
[WINESYNC] reg/tests: Add data tests for the 'copy' command.
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id bb609c6acbf53b822825e3077fe0996a85d5026d by Hugh McMaster
<hugh.mcmaster(a)outlook.com>
---
modules/rostests/winetests/reg/copy.c | 136 ++++++++++++++++++++++++++++++
modules/rostests/winetests/reg/export.c | 30 +++----
modules/rostests/winetests/reg/reg_test.h | 7 ++
sdk/tools/winesync/reg.cfg | 2 +-
4 files changed, 159 insertions(+), 16 deletions(-)
diff --git a/modules/rostests/winetests/reg/copy.c
b/modules/rostests/winetests/reg/copy.c
index 0d245dae4da..7126b00d50e 100644
--- a/modules/rostests/winetests/reg/copy.c
+++ b/modules/rostests/winetests/reg/copy.c
@@ -122,6 +122,140 @@ static void test_command_syntax(void)
ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
}
+static void test_copy_empty_key(void)
+{
+ DWORD r;
+
+ delete_tree(HKEY_CURRENT_USER, COPY_SRC);
+ verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC);
+
+ delete_tree(HKEY_CURRENT_USER, KEY_BASE);
+ verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
+
+ add_key(HKEY_CURRENT_USER, COPY_SRC, NULL);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE "
/f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", empty_key_test, 0),
"compare_export() failed\n");
+
+ todo_wine delete_key(HKEY_CURRENT_USER, KEY_BASE);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE
" /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", empty_key_test, 0),
"compare_export() failed\n");
+
+ todo_wine delete_key(HKEY_CURRENT_USER, KEY_BASE);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE
"\\ /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", empty_key_test, 0),
"compare_export() failed\n");
+
+ todo_wine delete_key(HKEY_CURRENT_USER, KEY_BASE);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE
"\\ /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", empty_key_test, 0),
"compare_export() failed\n");
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE "
/s /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", empty_key_test, 0),
"compare_export() failed\n");
+}
+
+static void test_copy_simple_data(void)
+{
+ HKEY hkey;
+ DWORD r, dword;
+
+ delete_tree(HKEY_CURRENT_USER, COPY_SRC);
+ verify_key_nonexist(HKEY_CURRENT_USER, COPY_SRC);
+
+ delete_tree(HKEY_CURRENT_USER, KEY_BASE);
+ verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE);
+
+ add_key(HKEY_CURRENT_USER, COPY_SRC, &hkey);
+
+ dword = 0x100;
+ add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword));
+ add_value(hkey, "String", REG_SZ, "Your text here...", 18);
+ close_key(hkey);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE "
/f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y",
&r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", simple_data_test, 0),
"compare_export() failed\n");
+
+ todo_wine delete_key(HKEY_CURRENT_USER, KEY_BASE);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE
" /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y",
&r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", simple_data_test, 0),
"compare_export() failed\n");
+
+ todo_wine delete_key(HKEY_CURRENT_USER, KEY_BASE);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE
"\\ /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y",
&r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", simple_data_test, 0),
"compare_export() failed\n");
+
+ todo_wine delete_key(HKEY_CURRENT_USER, KEY_BASE);
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC "\\ HKCU\\" KEY_BASE
"\\ /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y",
&r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", simple_data_test, 0),
"compare_export() failed\n");
+
+
+ run_reg_exe("reg copy HKCU\\" COPY_SRC " HKCU\\" KEY_BASE "
/s /f", &r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine verify_key(HKEY_CURRENT_USER, KEY_BASE);
+
+ run_reg_exe("reg export HKCU\\" KEY_BASE " file.reg /y",
&r);
+ todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
+ todo_wine ok(compare_export("file.reg", simple_data_test, 0),
"compare_export() failed\n");
+}
+
START_TEST(copy)
{
DWORD r;
@@ -132,4 +266,6 @@ START_TEST(copy)
}
test_command_syntax();
+ test_copy_empty_key();
+ test_copy_simple_data();
}
diff --git a/modules/rostests/winetests/reg/export.c
b/modules/rostests/winetests/reg/export.c
index daf42f66e3e..27d70b6a663 100644
--- a/modules/rostests/winetests/reg/export.c
+++ b/modules/rostests/winetests/reg/export.c
@@ -18,9 +18,8 @@
#include "reg_test.h"
-#define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo)
-static BOOL compare_export_(const char *file, unsigned line, const char *filename,
- const char *expected, DWORD todo)
+BOOL compare_export_(const char *file, unsigned line, const char *filename,
+ const char *expected, DWORD todo)
{
FILE *fp;
long file_size;
@@ -64,6 +63,17 @@ error:
return FALSE;
}
+const char *empty_key_test =
+ "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
+ "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n\r\n";
+
+const char *simple_data_test =
+ "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
+ "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
+ "\"DWORD\"=dword:00000100\r\n"
+ "\"String\"=\"Your text here...\"\r\n\r\n";
+
+
/* Unit tests */
static void test_export(void)
@@ -73,16 +83,6 @@ static void test_export(void)
HKEY hkey, subkey;
BYTE hex[4], buffer[8];
- const char *empty_key_test =
- "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
- "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n\r\n";
-
- const char *simple_test =
- "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
- "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
- "\"DWORD\"=dword:00000100\r\n"
- "\"String\"=\"Your text here...\"\r\n\r\n";
-
const char *complex_test =
"\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
@@ -243,12 +243,12 @@ static void test_export(void)
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg
/y", &r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- ok(compare_export("file.reg", simple_test, 0), "compare_export()
failed\n");
+ ok(compare_export("file.reg", simple_data_test, 0), "compare_export()
failed\n");
/* Test whether a .reg file extension is required when exporting */
run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " foo /y",
&r);
ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- ok(compare_export("foo", simple_test, 0), "compare_export()
failed\n");
+ ok(compare_export("foo", simple_data_test, 0), "compare_export()
failed\n");
/* Test registry export with a complex data structure */
add_key(hkey, "Subkey1", &subkey);
diff --git a/modules/rostests/winetests/reg/reg_test.h
b/modules/rostests/winetests/reg/reg_test.h
index 6718e91096f..3f4677a7a69 100644
--- a/modules/rostests/winetests/reg/reg_test.h
+++ b/modules/rostests/winetests/reg/reg_test.h
@@ -74,6 +74,13 @@ void add_value_(const char *file, unsigned line, HKEY hkey, const char
*name,
#define delete_value(k,n) delete_value_(__FILE__,__LINE__,k,n)
void delete_value_(const char *file, unsigned line, const HKEY hkey, const char *name);
+/* export.c */
+#define compare_export(f,e,todo) compare_export_(__FILE__,__LINE__,f,e,todo)
+BOOL compare_export_(const char *file, unsigned line, const char *filename,
+ const char *expected, DWORD todo);
+extern const char *empty_key_test;
+extern const char *simple_data_test;
+
/* import.c */
#define test_import_str(c,r) import_reg(__FILE__,__LINE__,c,FALSE,r)
#define test_import_wstr(c,r) import_reg(__FILE__,__LINE__,c,TRUE,r)
diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg
index caed52b5125..1a439434dd5 100644
--- a/sdk/tools/winesync/reg.cfg
+++ b/sdk/tools/winesync/reg.cfg
@@ -4,4 +4,4 @@ directories:
files:
programs/reg/resource.h: base/applications/cmdutils/reg/resource.h
tags:
- wine: c0619c092962d1c14725ac6cdc84b8e80ecb09bc
+ wine: bb609c6acbf53b822825e3077fe0996a85d5026d