ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
17 participants
236 discussions
Start a n
N
ew thread
[reactos] 18/158: [WINESYNC] reg/tests: Split 'export' tests from reg.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=15a1b9ab1692df08122e5…
commit 15a1b9ab1692df08122e5f61181edd2bd556abc8 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:07:57 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Split 'export' tests from reg.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 60701b02981980dbd821b59f46c102b6f80a79cb by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/export.c | 416 ++++++++++++++++++++++++++++++++ modules/rostests/winetests/reg/reg.c | 383 ----------------------------- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 417 insertions(+), 384 deletions(-) diff --git a/modules/rostests/winetests/reg/export.c b/modules/rostests/winetests/reg/export.c new file mode 100644 index 00000000000..e03b1f3db25 --- /dev/null +++ b/modules/rostests/winetests/reg/export.c @@ -0,0 +1,416 @@ +/* + * Copyright 2017-2018, 2021 Hugh McMaster + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "reg_test.h" + +#define TODO_REG_COMPARE (0x0008u) + +#define compare_export(f,e,todo) compare_export_(__LINE__,f,e,todo) +static BOOL compare_export_(unsigned line, const char *filename, const char *expected, DWORD todo) +{ + FILE *fp; + long file_size; + WCHAR *fbuf = NULL, *wstr = NULL; + size_t len; + BOOL ret = FALSE; + + fp = fopen(filename, "rb"); + if (!fp) return FALSE; + + if (fseek(fp, 0, SEEK_END)) goto error; + file_size = ftell(fp); + if (file_size == -1) goto error; + rewind(fp); + + fbuf = HeapAlloc(GetProcessHeap(), 0, file_size + sizeof(WCHAR)); + if (!fbuf) goto error; + + fread(fbuf, file_size, 1, fp); + fbuf[file_size/sizeof(WCHAR)] = 0; + fclose(fp); + + len = MultiByteToWideChar(CP_UTF8, 0, expected, -1, NULL, 0); + wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!wstr) goto exit; + MultiByteToWideChar(CP_UTF8, 0, expected, -1, wstr, len); + + todo_wine_if (todo & TODO_REG_COMPARE) + lok(!lstrcmpW(fbuf, wstr), "export data does not match expected data\n"); + + ret = DeleteFileA(filename); + lok(ret, "DeleteFile failed: %u\n", GetLastError()); + +exit: + HeapFree(GetProcessHeap(), 0, fbuf); + HeapFree(GetProcessHeap(), 0, wstr); + return ret; + +error: + fclose(fp); + return FALSE; +} + +/* Unit tests */ + +static void test_export(void) +{ + LONG err; + DWORD r, dword, type, size; + 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" + "\"DWORD\"=dword:00000100\r\n" + "\"String\"=\"Your text here...\"\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\r\n" + "\"Binary\"=hex:11,22,33,44\r\n" + "\"Undefined hex\"=hex(100):25,50,41,54,48,25,00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\r\n" + "\"double\\\"quote\"=\"\\\"Hello, World!\\\"\"\r\n" + "\"single'quote\"=dword:00000008\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a\\Subkey2b]\r\n" + "@=\"Default value name\"\r\n" + "\"Multiple strings\"=hex(7):4c,00,69,00,6e,00,65,00,31,00,00,00,4c,00,69,00,6e,\\\r\n" + " 00,65,00,32,00,00,00,4c,00,69,00,6e,00,65,00,33,00,00,00,00,00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a]\r\n" + "\"Backslash\"=\"Use \\\\\\\\ to escape a backslash\"\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a\\Subkey3b]\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a\\Subkey3b\\Subkey3c]\r\n" + "\"String expansion\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,25,00,50,\\\r\n" + " 00,41,00,54,00,48,00,25,00,00,00\r\n" + "\"Zero data type\"=hex(0):56,61,6c,75,65,00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4]\r\n" + "@=dword:12345678\r\n" + "\"43981\"=hex(abcd):56,61,6c,75,65,00\r\n\r\n"; + + const char *key_order_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\r\n\r\n"; + + const char *value_order_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"Value 2\"=\"I was added first!\"\r\n" + "\"Value 1\"=\"I was added second!\"\r\n\r\n"; + + const char *empty_hex_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"Wine1a\"=hex(0):\r\n" + "\"Wine1b\"=\"\"\r\n" + "\"Wine1c\"=hex(2):\r\n" + "\"Wine1d\"=hex:\r\n" + "\"Wine1e\"=hex(4):\r\n" + "\"Wine1f\"=hex(7):\r\n" + "\"Wine1g\"=hex(100):\r\n" + "\"Wine1h\"=hex(abcd):\r\n\r\n"; + + const char *empty_hex_test2 = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"Wine2a\"=\"\"\r\n" + "\"Wine2b\"=hex:\r\n" + "\"Wine2c\"=hex(4):\r\n\r\n"; + + const char *hex_types_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"Wine3a\"=\"Value\"\r\n" + "\"Wine3b\"=hex:12,34,56,78\r\n" + "\"Wine3c\"=dword:10203040\r\n\r\n"; + + const char *embedded_null_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"Wine4a\"=dword:00000005\r\n" + "\"Wine4b\"=\"\"\r\n" + "\"Wine4c\"=\"Value\"\r\n" + "\"Wine4d\"=\"\"\r\n" + "\"Wine4e\"=dword:00000100\r\n" + "\"Wine4f\"=\"\"\r\n" + "\"Wine4g\"=\"Value2\"\r\n" + "\"Wine4h\"=\"abc\"\r\n\r\n"; + + const char *slashes_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"count/up\"=\"one/two/three\"\r\n" + "\"\\\\foo\\\\bar\"=\"\"\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\r\n\r\n"; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + run_reg_exe("reg export", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export /?", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg export /h", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg export -H", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg export \\\\remote-pc\\HKLM\\Wine file.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKEY_DYN_DATA file.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKDD file.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export file.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export file.reg HKEY_CURRENT_USER\\" KEY_BASE, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg file2.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* Test registry export with an empty key */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + + run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); + + run_reg_exe("reg export /y HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " /y file.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); + ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE), /* winxp */ + "got exit code %d, expected 0\n", r); + ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); + + /* Test registry export with a simple data structure */ + dword = 0x100; + add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); + add_value(hkey, "String", REG_SZ, "Your text here...", 18); + + 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"); + + /* Test registry export with a complex data structure */ + add_key(hkey, "Subkey1", &subkey); + add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); + add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); + close_key(subkey); + + add_key(hkey, "Subkey2a", &subkey); + add_value(subkey, "double\"quote", REG_SZ, "\"Hello, World!\"", 16); + dword = 0x8; + add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); + close_key(subkey); + + add_key(hkey, "Subkey2a\\Subkey2b", &subkey); + add_value(subkey, NULL, REG_SZ, "Default value name", 19); + add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); + close_key(subkey); + + add_key(hkey, "Subkey3a", &subkey); + add_value(subkey, "Backslash", REG_SZ, "Use \\\\ to escape a backslash", 29); + close_key(subkey); + + add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", &subkey); + add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); + add_value(subkey, "Zero data type", REG_NONE, "Value", 6); + close_key(subkey); + + add_key(hkey, "Subkey4", &subkey); + dword = 0x12345678; + add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); + add_value(subkey, "43981", 0xabcd, "Value", 6); + close_key(subkey); + + close_key(hkey); + + 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", complex_test, 0), "compare_export() failed\n"); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + + /* Test the export order of registry keys */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(hkey, "Subkey2", &subkey); + close_key(subkey); + add_key(hkey, "Subkey1", &subkey); + close_key(subkey); + + 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", key_order_test, 0), "compare_export() failed\n"); + delete_key(hkey, "Subkey1"); + delete_key(hkey, "Subkey2"); + + /* Test the export order of registry values. Windows exports registry values + * in order of creation; Wine uses alphabetical order. + */ + add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); + add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20); + close_key(hkey); + + 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", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n"); + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Test registry export with empty hex data */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_value(hkey, "Wine1a", REG_NONE, NULL, 0); + add_value(hkey, "Wine1b", REG_SZ, NULL, 0); + add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0); + add_value(hkey, "Wine1d", REG_BINARY, NULL, 0); + add_value(hkey, "Wine1e", REG_DWORD, NULL, 0); + add_value(hkey, "Wine1f", REG_MULTI_SZ, NULL, 0); + add_value(hkey, "Wine1g", 0x100, NULL, 0); + add_value(hkey, "Wine1h", 0xabcd, NULL, 0); + close_key(hkey); + + 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", empty_hex_test, 0), "compare_export() failed\n"); + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Test registry export after importing alternative registry data types */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine2a\"=hex(1):\n" + "\"Wine2b\"=hex(3):\n" + "\"Wine2c\"=hex(4):\n\n", &r); + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + verify_reg(hkey, "Wine2a", REG_SZ, NULL, 0, 0); + verify_reg(hkey, "Wine2b", REG_BINARY, NULL, 0, 0); + verify_reg(hkey, "Wine2c", REG_DWORD, NULL, 0, 0); + close_key(hkey); + + 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", empty_hex_test2, 0), "compare_export() failed\n"); + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine3a\"=hex(1):56,00,61,00,6c,00,75,00,65,00,00,00\n" + "\"Wine3b\"=hex(3):12,34,56,78\n" + "\"Wine3c\"=hex(4):40,30,20,10\n\n", &r); + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + verify_reg(hkey, "Wine3a", REG_SZ, "Value", 6, 0); + memcpy(hex, "\x12\x34\x56\x78", 4); + verify_reg(hkey, "Wine3b", REG_BINARY, hex, 4, 0); + dword = 0x10203040; + verify_reg(hkey, "Wine3c", REG_DWORD, &dword, sizeof(dword), 0); + close_key(hkey); + + 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", hex_types_test, 0), "compare_export() failed\n"); + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Test registry export with embedded null characters */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine4a\"=dword:00000005\n" + "\"Wine4b\"=hex(1):00,00,00,00,00,00,00,00\n" + "\"Wine4c\"=\"Value\"\n" + "\"Wine4d\"=hex(1):00,00,61,00,62,00,63,00\n" + "\"Wine4e\"=dword:00000100\n" + "\"Wine4f\"=hex(1):00,00,56,00,61,00,6c,00,75,00,65,00,00,00\n" + "\"Wine4g\"=\"Value2\"\n" + "\"Wine4h\"=hex(1):61,00,62,00,63,00,00,00, \\\n" + " 64,00,65,00,66,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + dword = 0x5; + verify_reg(hkey, "Wine4a", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine4b", REG_SZ, "\0\0\0\0\0\0\0", 4, 0); + verify_reg(hkey, "Wine4c", REG_SZ, "Value", 6, 0); + /* Wine4d */ + size = sizeof(buffer); + err = RegQueryValueExA(hkey, "Wine4d", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_SZ, "got wrong type %u, expected %u\n", type, REG_SZ); + ok(size == 5 || broken(size == 4) /* WinXP */, "got wrong size %u, expected 5\n", size); + ok(memcmp(buffer, "\0abc", size) == 0, "got wrong data\n"); + dword = 0x100; + verify_reg(hkey, "Wine4e", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine4f", REG_SZ, "\0Value", 7, 0); + verify_reg(hkey, "Wine4g", REG_SZ, "Value2", 7, 0); + verify_reg(hkey, "Wine4h", REG_SZ, "abc\0def", 8, 0); + close_key(hkey); + + 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", embedded_null_test, 0), "compare_export() failed\n"); + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Test registry export with forward and back slashes */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(hkey, "
https://winehq.org
", &subkey); + close_key(subkey); + add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); + add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); + close_key(hkey); + + 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", slashes_test, TODO_REG_COMPARE), "compare_export() failed\n"); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); +} + +START_TEST(export) +{ + DWORD r; + + if (!run_reg_exe("reg.exe /?", &r)) { + win_skip("reg.exe not available, skipping reg.exe tests\n"); + return; + } + + test_export(); +} diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 8e98ab6379f..d8a281548a5 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -21,7 +21,6 @@ #define TODO_REG_TYPE (0x0001u) #define TODO_REG_SIZE (0x0002u) #define TODO_REG_DATA (0x0004u) -#define TODO_REG_COMPARE (0x0008u) BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc) { @@ -614,387 +613,6 @@ static void test_add(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } -#define compare_export(f,e,todo) compare_export_(__LINE__,f,e,todo) -static BOOL compare_export_(unsigned line, const char *filename, const char *expected, DWORD todo) -{ - FILE *fp; - long file_size; - WCHAR *fbuf = NULL, *wstr = NULL; - size_t len; - BOOL ret = FALSE; - - fp = fopen(filename, "rb"); - if (!fp) return FALSE; - - if (fseek(fp, 0, SEEK_END)) goto error; - file_size = ftell(fp); - if (file_size == -1) goto error; - rewind(fp); - - fbuf = HeapAlloc(GetProcessHeap(), 0, file_size + sizeof(WCHAR)); - if (!fbuf) goto error; - - fread(fbuf, file_size, 1, fp); - fbuf[file_size/sizeof(WCHAR)] = 0; - fclose(fp); - - len = MultiByteToWideChar(CP_UTF8, 0, expected, -1, NULL, 0); - wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (!wstr) goto exit; - MultiByteToWideChar(CP_UTF8, 0, expected, -1, wstr, len); - - todo_wine_if (todo & TODO_REG_COMPARE) - lok(!lstrcmpW(fbuf, wstr), "export data does not match expected data\n"); - - ret = DeleteFileA(filename); - lok(ret, "DeleteFile failed: %u\n", GetLastError()); - -exit: - HeapFree(GetProcessHeap(), 0, fbuf); - HeapFree(GetProcessHeap(), 0, wstr); - return ret; - -error: - fclose(fp); - return FALSE; -} - -static void test_export(void) -{ - LONG err; - DWORD r, dword, type, size; - 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" - "\"DWORD\"=dword:00000100\r\n" - "\"String\"=\"Your text here...\"\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\r\n" - "\"Binary\"=hex:11,22,33,44\r\n" - "\"Undefined hex\"=hex(100):25,50,41,54,48,25,00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\r\n" - "\"double\\\"quote\"=\"\\\"Hello, World!\\\"\"\r\n" - "\"single'quote\"=dword:00000008\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a\\Subkey2b]\r\n" - "@=\"Default value name\"\r\n" - "\"Multiple strings\"=hex(7):4c,00,69,00,6e,00,65,00,31,00,00,00,4c,00,69,00,6e,\\\r\n" - " 00,65,00,32,00,00,00,4c,00,69,00,6e,00,65,00,33,00,00,00,00,00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a]\r\n" - "\"Backslash\"=\"Use \\\\\\\\ to escape a backslash\"\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a\\Subkey3b]\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a\\Subkey3b\\Subkey3c]\r\n" - "\"String expansion\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,25,00,50,\\\r\n" - " 00,41,00,54,00,48,00,25,00,00,00\r\n" - "\"Zero data type\"=hex(0):56,61,6c,75,65,00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4]\r\n" - "@=dword:12345678\r\n" - "\"43981\"=hex(abcd):56,61,6c,75,65,00\r\n\r\n"; - - const char *key_order_test = - "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\r\n\r\n"; - - const char *value_order_test = - "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" - "\"Value 2\"=\"I was added first!\"\r\n" - "\"Value 1\"=\"I was added second!\"\r\n\r\n"; - - const char *empty_hex_test = - "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" - "\"Wine1a\"=hex(0):\r\n" - "\"Wine1b\"=\"\"\r\n" - "\"Wine1c\"=hex(2):\r\n" - "\"Wine1d\"=hex:\r\n" - "\"Wine1e\"=hex(4):\r\n" - "\"Wine1f\"=hex(7):\r\n" - "\"Wine1g\"=hex(100):\r\n" - "\"Wine1h\"=hex(abcd):\r\n\r\n"; - - const char *empty_hex_test2 = - "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" - "\"Wine2a\"=\"\"\r\n" - "\"Wine2b\"=hex:\r\n" - "\"Wine2c\"=hex(4):\r\n\r\n"; - - const char *hex_types_test = - "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" - "\"Wine3a\"=\"Value\"\r\n" - "\"Wine3b\"=hex:12,34,56,78\r\n" - "\"Wine3c\"=dword:10203040\r\n\r\n"; - - const char *embedded_null_test = - "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" - "\"Wine4a\"=dword:00000005\r\n" - "\"Wine4b\"=\"\"\r\n" - "\"Wine4c\"=\"Value\"\r\n" - "\"Wine4d\"=\"\"\r\n" - "\"Wine4e\"=dword:00000100\r\n" - "\"Wine4f\"=\"\"\r\n" - "\"Wine4g\"=\"Value2\"\r\n" - "\"Wine4h\"=\"abc\"\r\n\r\n"; - - const char *slashes_test = - "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" - "\"count/up\"=\"one/two/three\"\r\n" - "\"\\\\foo\\\\bar\"=\"\"\r\n\r\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\r\n\r\n"; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - run_reg_exe("reg export", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export /?", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg export /h", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg export -H", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg export \\\\remote-pc\\HKLM\\Wine file.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKEY_DYN_DATA file.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKDD file.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE, &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export file.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export file.reg HKEY_CURRENT_USER\\" KEY_BASE, &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE, &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg file2.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - /* Test registry export with an empty key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - - run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); - - run_reg_exe("reg export /y HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " /y file.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r); - ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE), /* winxp */ - "got exit code %d, expected 0\n", r); - ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n"); - - /* Test registry export with a simple data structure */ - dword = 0x100; - add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword)); - add_value(hkey, "String", REG_SZ, "Your text here...", 18); - - 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"); - - /* Test registry export with a complex data structure */ - add_key(hkey, "Subkey1", &subkey); - add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); - add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); - close_key(subkey); - - add_key(hkey, "Subkey2a", &subkey); - add_value(subkey, "double\"quote", REG_SZ, "\"Hello, World!\"", 16); - dword = 0x8; - add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); - close_key(subkey); - - add_key(hkey, "Subkey2a\\Subkey2b", &subkey); - add_value(subkey, NULL, REG_SZ, "Default value name", 19); - add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); - close_key(subkey); - - add_key(hkey, "Subkey3a", &subkey); - add_value(subkey, "Backslash", REG_SZ, "Use \\\\ to escape a backslash", 29); - close_key(subkey); - - add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", &subkey); - add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); - add_value(subkey, "Zero data type", REG_NONE, "Value", 6); - close_key(subkey); - - add_key(hkey, "Subkey4", &subkey); - dword = 0x12345678; - add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); - add_value(subkey, "43981", 0xabcd, "Value", 6); - close_key(subkey); - - close_key(hkey); - - 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", complex_test, 0), "compare_export() failed\n"); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - - /* Test the export order of registry keys */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "Subkey2", &subkey); - close_key(subkey); - add_key(hkey, "Subkey1", &subkey); - close_key(subkey); - - 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", key_order_test, 0), "compare_export() failed\n"); - delete_key(hkey, "Subkey1"); - delete_key(hkey, "Subkey2"); - - /* Test the export order of registry values. Windows exports registry values - * in order of creation; Wine uses alphabetical order. - */ - add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); - add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20); - close_key(hkey); - - 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", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); - - /* Test registry export with empty hex data */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_value(hkey, "Wine1a", REG_NONE, NULL, 0); - add_value(hkey, "Wine1b", REG_SZ, NULL, 0); - add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0); - add_value(hkey, "Wine1d", REG_BINARY, NULL, 0); - add_value(hkey, "Wine1e", REG_DWORD, NULL, 0); - add_value(hkey, "Wine1f", REG_MULTI_SZ, NULL, 0); - add_value(hkey, "Wine1g", 0x100, NULL, 0); - add_value(hkey, "Wine1h", 0xabcd, NULL, 0); - close_key(hkey); - - 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", empty_hex_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); - - /* Test registry export after importing alternative registry data types */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine2a\"=hex(1):\n" - "\"Wine2b\"=hex(3):\n" - "\"Wine2c\"=hex(4):\n\n", &r); - open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); - verify_reg(hkey, "Wine2a", REG_SZ, NULL, 0, 0); - verify_reg(hkey, "Wine2b", REG_BINARY, NULL, 0, 0); - verify_reg(hkey, "Wine2c", REG_DWORD, NULL, 0, 0); - close_key(hkey); - - 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", empty_hex_test2, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine3a\"=hex(1):56,00,61,00,6c,00,75,00,65,00,00,00\n" - "\"Wine3b\"=hex(3):12,34,56,78\n" - "\"Wine3c\"=hex(4):40,30,20,10\n\n", &r); - open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); - verify_reg(hkey, "Wine3a", REG_SZ, "Value", 6, 0); - memcpy(hex, "\x12\x34\x56\x78", 4); - verify_reg(hkey, "Wine3b", REG_BINARY, hex, 4, 0); - dword = 0x10203040; - verify_reg(hkey, "Wine3c", REG_DWORD, &dword, sizeof(dword), 0); - close_key(hkey); - - 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", hex_types_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); - - /* Test registry export with embedded null characters */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine4a\"=dword:00000005\n" - "\"Wine4b\"=hex(1):00,00,00,00,00,00,00,00\n" - "\"Wine4c\"=\"Value\"\n" - "\"Wine4d\"=hex(1):00,00,61,00,62,00,63,00\n" - "\"Wine4e\"=dword:00000100\n" - "\"Wine4f\"=hex(1):00,00,56,00,61,00,6c,00,75,00,65,00,00,00\n" - "\"Wine4g\"=\"Value2\"\n" - "\"Wine4h\"=hex(1):61,00,62,00,63,00,00,00, \\\n" - " 64,00,65,00,66,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); - dword = 0x5; - verify_reg(hkey, "Wine4a", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine4b", REG_SZ, "\0\0\0\0\0\0\0", 4, 0); - verify_reg(hkey, "Wine4c", REG_SZ, "Value", 6, 0); - /* Wine4d */ - size = sizeof(buffer); - err = RegQueryValueExA(hkey, "Wine4d", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_SZ, "got wrong type %u, expected %u\n", type, REG_SZ); - ok(size == 5 || broken(size == 4) /* WinXP */, "got wrong size %u, expected 5\n", size); - ok(memcmp(buffer, "\0abc", size) == 0, "got wrong data\n"); - dword = 0x100; - verify_reg(hkey, "Wine4e", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine4f", REG_SZ, "\0Value", 7, 0); - verify_reg(hkey, "Wine4g", REG_SZ, "Value2", 7, 0); - verify_reg(hkey, "Wine4h", REG_SZ, "abc\0def", 8, 0); - close_key(hkey); - - 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", embedded_null_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); - - /* Test registry export with forward and back slashes */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_key(hkey, "
https://winehq.org
", &subkey); - close_key(subkey); - add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); - add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); - close_key(hkey); - - 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", slashes_test, TODO_REG_COMPARE), "compare_export() failed\n"); - delete_tree(HKEY_CURRENT_USER, KEY_BASE); -} - #define COPY_DEST KEY_WINE "\\reg_copy" static void test_copy(void) @@ -1084,6 +702,5 @@ START_TEST(reg) } test_add(); - test_export(); test_copy(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 3fcc91f3e9f..1ad6743f521 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: fc5816a61e1f203b5c004d9fd25b43043954f386 + wine: 60701b02981980dbd821b59f46c102b6f80a79cb
2 years, 6 months
1
0
0
0
[reactos] 17/158: [WINESYNC] reg/tests: Split Windows 3.1 'import' tests from reg.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=22af0f3d732233a344934…
commit 22af0f3d732233a344934dc7ad40374c9f4bb0a1 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:07:57 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Split Windows 3.1 'import' tests from reg.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id fc5816a61e1f203b5c004d9fd25b43043954f386 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/import.c | 116 ++++++++++++++++++++++++++++++++ modules/rostests/winetests/reg/reg.c | 116 -------------------------------- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 117 insertions(+), 117 deletions(-) diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index 2ed949944a3..5b520f11d5f 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -3464,6 +3464,121 @@ static void test_unicode_import_with_whitespace(void) delete_key(HKEY_CURRENT_USER, KEY_BASE); } +static void test_import_win31(void) +{ + LONG err; + HKEY hkey; + DWORD dispos, r; + + /* Check if reg.exe is running with elevated privileges */ + err = RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE, + KEY_READ|KEY_SET_VALUE, NULL, &hkey, &dispos); + if (err == ERROR_ACCESS_DENIED) + { + win_skip("reg.exe is not running with elevated privileges; " + "skipping Windows 3.1 import tests\n"); + return; + } + + if (dispos == REG_OPENED_EXISTING_KEY) + delete_value(hkey, NULL); + + /* Test simple value */ + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "Value0", 7, 0); + + /* Test proper handling of spaces and equals signs */ + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " =Value1\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "Value1", 7, 0); + + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, " Value2", 8, 0); + + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value3 \r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "Value3 ", 8, 0); + + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " Value4\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "Value4", 7, 0); + + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " Value5\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "Value5", 7, 0); + + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE "\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "", 1, 0); + + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " \r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "", 1, 0); + + test_import_str("REGEDIT\r\n" + "HKEY_CLASSES_ROOT\\" KEY_BASE " = No newline", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "No newline", 11, 0); + + delete_value(hkey, NULL); + + /* Test character validity at the start of the line */ + test_import_str("REGEDIT\r\n" + " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1a\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + test_import_str("REGEDIT\r\n" + " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1b\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + test_import_str("REGEDIT\r\n" + "\tHKEY_CLASSES_ROOT\\" KEY_BASE " = Value1c\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + test_import_str("REGEDIT\r\n" + ";HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2a\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + test_import_str("REGEDIT\r\n" + "#HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2b\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + /* Test case sensitivity */ + test_import_str("REGEDIT\r\n" + "hkey_classes_root\\" KEY_BASE " = Value3a\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + test_import_str("REGEDIT\r\n" + "hKEY_CLASSES_ROOT\\" KEY_BASE " = Value3b\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + test_import_str("REGEDIT\r\n" + "Hkey_Classes_Root\\" KEY_BASE " = Value3c\r\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + close_key(hkey); + + delete_key(HKEY_CLASSES_ROOT, KEY_BASE); +} + START_TEST(import) { DWORD r; @@ -3477,4 +3592,5 @@ START_TEST(import) test_unicode_import(); test_import_with_whitespace(); test_unicode_import_with_whitespace(); + test_import_win31(); } diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 9576106fda4..8e98ab6379f 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -614,121 +614,6 @@ static void test_add(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } -static void test_import_31(void) -{ - LONG err; - HKEY hkey; - DWORD dispos, r; - - /* Check if reg.exe is running with elevated privileges */ - err = RegCreateKeyExA(HKEY_CLASSES_ROOT, KEY_BASE, 0, NULL, REG_OPTION_NON_VOLATILE, - KEY_READ|KEY_SET_VALUE, NULL, &hkey, &dispos); - if (err == ERROR_ACCESS_DENIED) - { - win_skip("reg.exe is not running with elevated privileges; " - "skipping Windows 3.1 import tests\n"); - return; - } - - if (dispos == REG_OPENED_EXISTING_KEY) - delete_value(hkey, NULL); - - /* Test simple value */ - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "Value0", 7, 0); - - /* Test proper handling of spaces and equals signs */ - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " =Value1\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "Value1", 7, 0); - - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, " Value2", 8, 0); - - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value3 \r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "Value3 ", 8, 0); - - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " Value4\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "Value4", 7, 0); - - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " Value5\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "Value5", 7, 0); - - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE "\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "", 1, 0); - - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " \r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "", 1, 0); - - test_import_str("REGEDIT\r\n" - "HKEY_CLASSES_ROOT\\" KEY_BASE " = No newline", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "No newline", 11, 0); - - delete_value(hkey, NULL); - - /* Test character validity at the start of the line */ - test_import_str("REGEDIT\r\n" - " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1a\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - test_import_str("REGEDIT\r\n" - " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1b\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - test_import_str("REGEDIT\r\n" - "\tHKEY_CLASSES_ROOT\\" KEY_BASE " = Value1c\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - test_import_str("REGEDIT\r\n" - ";HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2a\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - test_import_str("REGEDIT\r\n" - "#HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2b\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - /* Test case sensitivity */ - test_import_str("REGEDIT\r\n" - "hkey_classes_root\\" KEY_BASE " = Value3a\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - test_import_str("REGEDIT\r\n" - "hKEY_CLASSES_ROOT\\" KEY_BASE " = Value3b\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - test_import_str("REGEDIT\r\n" - "Hkey_Classes_Root\\" KEY_BASE " = Value3c\r\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - close_key(hkey); - - delete_key(HKEY_CLASSES_ROOT, KEY_BASE); -} - #define compare_export(f,e,todo) compare_export_(__LINE__,f,e,todo) static BOOL compare_export_(unsigned line, const char *filename, const char *expected, DWORD todo) { @@ -1199,7 +1084,6 @@ START_TEST(reg) } test_add(); - test_import_31(); test_export(); test_copy(); } diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index fcd66610114..3fcc91f3e9f 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: 56d9d0f791046aeab85466e2ebadac63ce457f86 + wine: fc5816a61e1f203b5c004d9fd25b43043954f386
2 years, 6 months
1
0
0
0
[reactos] 16/158: [WINESYNC] reg/tests: Split whitespace 'import' tests from reg.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b3c65718660e928a2ea94…
commit b3c65718660e928a2ea946009ceedcc0cba3edd9 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:07:57 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Split whitespace 'import' tests from reg.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 56d9d0f791046aeab85466e2ebadac63ce457f86 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/import.c | 294 ++++++++++++++++++++++++++++++++ modules/rostests/winetests/reg/reg.c | 294 -------------------------------- sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 295 insertions(+), 295 deletions(-) diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index 8ea436839f2..2ed949944a3 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -3172,6 +3172,298 @@ static void test_unicode_import(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } +static void test_import_with_whitespace(void) +{ + HKEY hkey; + DWORD r, dword; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + test_import_str(" REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + + test_import_str(" REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1a\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0); + + test_import_str("\tREGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1b\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0); + + test_import_str(" \t REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1c\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0); + + test_import_str("REGEDIT4\n\n" + " [HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine2a\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0); + + test_import_str("REGEDIT4\n\n" + "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine2b\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0); + + test_import_str("REGEDIT4\n\n" + " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine2c\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + " \"Wine3a\"=\"Two leading spaces\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\t\"Wine3b\"=\"One leading tab\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0); + + test_import_str(" REGEDIT4\n\n" + "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\t \"Wine4a\"=\"Tab and four spaces\"\n" + " \"Wine4b\"=dword:00112233\n" + "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,\\;comment\n" + "\t\t\t\t63,61,74,\\;comment\n" + " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0); + dword = 0x112233; + verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str(" REGEDIT4\n\n" + "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + " \"Wine5a\"=\"Leading spaces\"\n" + "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n" + "\t \"Wine5c\"=\t \"Tabs and spaces\"\n" + " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0); + verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0); + verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0); + verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\" Wine6a\"=\"Leading spaces\"\n" + "\"\t\tWine6b\"=\"Leading tabs\"\n" + " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0); + verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0); + verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine7a\"=\" Four spaces in the data\"\n" + "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0); + verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine8a\"=\"Trailing spaces\" \n" + "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0); + verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine9a\"=dword: 00000008\n" + "\"Wine9b\"=dword:\t\t00000008\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x00000008; + verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "@ = \"Test Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\t@\t=\tdword:\t00000008\t\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0); + + close_key(hkey); + + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} + +static void test_unicode_import_with_whitespace(void) +{ + HKEY hkey; + DWORD r, dword; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); + + test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1a\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0); + + test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1b\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0); + + test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1c\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + " [HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine2a\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine2b\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine2c\"=\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + " \"Wine3a\"=\"Two leading spaces\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\t\"Wine3b\"=\"One leading tab\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0); + + test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" + "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\t \"Wine4a\"=\"Tab and four spaces\"\n" + " \"Wine4b\"=dword:00112233\n" + "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,\\;comment\n" + "\t\t\t\t63,00,61,00,74,00,\\;comment\n" + " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0); + dword = 0x112233; + verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" + "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + " \"Wine5a\"=\"Leading spaces\"\n" + "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n" + "\t \"Wine5c\"=\t \"Tabs and spaces\"\n" + " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0); + verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0); + verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0); + verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\" Wine6a\"=\"Leading spaces\"\n" + "\"\t\tWine6b\"=\"Leading tabs\"\n" + " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0); + verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0); + verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine7a\"=\" Four spaces in the data\"\n" + "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0); + verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine8a\"=\"Trailing spaces\" \n" + "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0); + verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine9a\"=dword: 00000008\n" + "\"Wine9b\"=dword:\t\t00000008\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x00000008; + verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "@ = \"Test Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\t@\t=\tdword:\t00000008\t\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0); + + close_key(hkey); + + delete_key(HKEY_CURRENT_USER, KEY_BASE); +} + START_TEST(import) { DWORD r; @@ -3183,4 +3475,6 @@ START_TEST(import) test_import(); test_unicode_import(); + test_import_with_whitespace(); + test_unicode_import_with_whitespace(); } diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 6dcea506766..9576106fda4 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -614,298 +614,6 @@ static void test_add(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } -static void test_import_with_whitespace(void) -{ - HKEY hkey; - DWORD r, dword; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - test_import_str(" REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - - open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); - - test_import_str(" REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1a\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0); - - test_import_str("\tREGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1b\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0); - - test_import_str(" \t REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1c\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0); - - test_import_str("REGEDIT4\n\n" - " [HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine2a\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0); - - test_import_str("REGEDIT4\n\n" - "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine2b\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0); - - test_import_str("REGEDIT4\n\n" - " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine2c\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - " \"Wine3a\"=\"Two leading spaces\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\t\"Wine3b\"=\"One leading tab\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0); - - test_import_str(" REGEDIT4\n\n" - "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\t \"Wine4a\"=\"Tab and four spaces\"\n" - " \"Wine4b\"=dword:00112233\n" - "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,\\;comment\n" - "\t\t\t\t63,61,74,\\;comment\n" - " \t65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0); - dword = 0x112233; - verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str(" REGEDIT4\n\n" - "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - " \"Wine5a\"=\"Leading spaces\"\n" - "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n" - "\t \"Wine5c\"=\t \"Tabs and spaces\"\n" - " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0); - verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0); - verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0); - verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\" Wine6a\"=\"Leading spaces\"\n" - "\"\t\tWine6b\"=\"Leading tabs\"\n" - " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0); - verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0); - verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine7a\"=\" Four spaces in the data\"\n" - "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0); - verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine8a\"=\"Trailing spaces\" \n" - "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0); - verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine9a\"=dword: 00000008\n" - "\"Wine9b\"=dword:\t\t00000008\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x00000008; - verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "@ = \"Test Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\t@\t=\tdword:\t00000008\t\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0); - - close_key(hkey); - - delete_key(HKEY_CURRENT_USER, KEY_BASE); -} - -static void test_unicode_import_with_whitespace(void) -{ - HKEY hkey; - DWORD r, dword; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - - open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey); - - test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1a\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine1a", REG_SZ, "Value", 6, 0); - - test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1b\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine1b", REG_SZ, "Value", 6, 0); - - test_import_wstr("\xef\xbb\xbf \t Windows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1c\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine1c", REG_SZ, "Value", 6, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - " [HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine2a\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine2a", REG_SZ, "Value", 6, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine2b\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine2b", REG_SZ, "Value", 6, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - " \t [HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine2c\"=\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine2c", REG_SZ, "Value", 6, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - " \"Wine3a\"=\"Two leading spaces\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine3a", REG_SZ, "Two leading spaces", 19, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\t\"Wine3b\"=\"One leading tab\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine3b", REG_SZ, "One leading tab", 16, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - " \t \"Wine3c\"=\"Space, tab, space\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); - verify_reg(hkey, "Wine3c", REG_SZ, "Space, tab, space", 18, 0); - - test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" - "\t\t\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\t \"Wine4a\"=\"Tab and four spaces\"\n" - " \"Wine4b\"=dword:00112233\n" - "\t \t \t \t \t \t \"Wine4c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,\\;comment\n" - "\t\t\t\t63,00,61,00,74,00,\\;comment\n" - " \t65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine4a", REG_SZ, "Tab and four spaces", 20, 0); - dword = 0x112233; - verify_reg(hkey, "Wine4b", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine4c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n\n" - "\t[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - " \"Wine5a\"=\"Leading spaces\"\n" - "\t\t\"Wine5b\"\t\t=\"Leading tabs\"\n" - "\t \"Wine5c\"=\t \"Tabs and spaces\"\n" - " \"Wine5d\" \t = \t \"More whitespace\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine5a", REG_SZ, "Leading spaces", 15, 0); - verify_reg(hkey, "Wine5b", REG_SZ, "Leading tabs", 13, 0); - verify_reg(hkey, "Wine5c", REG_SZ, "Tabs and spaces", 16, 0); - verify_reg(hkey, "Wine5d", REG_SZ, "More whitespace", 16, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\" Wine6a\"=\"Leading spaces\"\n" - "\"\t\tWine6b\"=\"Leading tabs\"\n" - " \" Wine6c \" = \" Spaces everywhere \" \n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, " Wine6a", REG_SZ, "Leading spaces", 15, 0); - verify_reg(hkey, "\t\tWine6b", REG_SZ, "Leading tabs", 13, 0); - verify_reg(hkey, " Wine6c ", REG_SZ, " Spaces everywhere ", 22, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine7a\"=\" Four spaces in the data\"\n" - "\"Wine7b\"=\"\t\tTwo tabs in the data\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine7a", REG_SZ, " Four spaces in the data", 28, 0); - verify_reg(hkey, "Wine7b", REG_SZ, "\t\tTwo tabs in the data", 23, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine8a\"=\"Trailing spaces\" \n" - "\"Wine8b\"=\"Trailing tabs and spaces\"\t \t\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0); - verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine9a\"=dword: 00000008\n" - "\"Wine9b\"=dword:\t\t00000008\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x00000008; - verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "@ = \"Test Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_SZ, "Test Value", 11, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\t@\t=\tdword:\t00000008\t\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0); - - close_key(hkey); - - delete_key(HKEY_CURRENT_USER, KEY_BASE); -} - static void test_import_31(void) { LONG err; @@ -1491,8 +1199,6 @@ START_TEST(reg) } test_add(); - test_import_with_whitespace(); - test_unicode_import_with_whitespace(); test_import_31(); test_export(); test_copy(); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index c2921b0ac3c..fcd66610114 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: 2e33ab5559419655584716669505e7943613d3bb + wine: 56d9d0f791046aeab85466e2ebadac63ce457f86
2 years, 6 months
1
0
0
0
[reactos] 15/158: [WINESYNC] reg/tests: Split first sequence of Unicode 'import' tests from reg.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c67c2bb20aba351f8d6ba…
commit c67c2bb20aba351f8d6ba851694fe9c352c9548f Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:07:57 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Split first sequence of Unicode 'import' tests from reg.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 2e33ab5559419655584716669505e7943613d3bb by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/import.c | 1550 ++++++++++++++++++++++++++++++ modules/rostests/winetests/reg/reg.c | 1551 +------------------------------ sdk/tools/winesync/reg.cfg | 2 +- 3 files changed, 1552 insertions(+), 1551 deletions(-) diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c index 8b9ce4d285e..8ea436839f2 100644 --- a/modules/rostests/winetests/reg/import.c +++ b/modules/rostests/winetests/reg/import.c @@ -69,6 +69,7 @@ BOOL import_reg(unsigned line, const char *contents, BOOL unicode, DWORD *rc) } /* Unit tests */ + static void test_import(void) { DWORD r, dword = 0x123, type, size; @@ -1622,6 +1623,1554 @@ static void test_import(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } +static void test_unicode_import(void) +{ + DWORD r, dword = 0x123, type, size; + HKEY hkey, subkey; + LONG err; + char buffer[24]; + BYTE hex[8]; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + test_import_wstr("REGEDIT\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("REGEDIT4\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("\xef\xbb\xbfREGEDIT", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbfREGEDIT4", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey); + + test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test1\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test1"); + + test_import_wstr("\xef\xbb\xbfregedit4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test2\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test2"); + + test_import_wstr("\xef\xbb\xbfRegedit4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test3\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test3"); + + test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test4\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test4"); + + test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test5\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test5"); + + test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test6\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test6"); + + test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test7\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test7"); + + test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test8\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test8"); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Unicode1\"=\"Value1\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Unicode1", REG_SZ, "Value1", 7, 0); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Unicode2\"=\"Value2\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Unicode2", REG_SZ, "Value2", 7, 0); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Unicode3\"=\"Value3\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Unicode3", REG_SZ, "Value3", 7, 0); + + test_import_wstr("Windows Registry Editor Version 4.00\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("Windows Registry Editor Version 5.00\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_wstr("\xef\xbb\xbf\nWindows Registry Editor Version 5.00\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test9\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test9"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test10\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test10"); + + test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test11\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test11"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test12\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test12"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine\"=dword:00000123\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "@=\"Test string\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Unicode4\"=\"Value4\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Unicode4", REG_SZ, "Value4", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Unicode5\"=\"Value5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Unicode5", REG_SZ, "Value5", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Unicode6\"=\"Value6\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Unicode6", REG_SZ, "Value6", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Line1\"=\"Value1\"\n\n" + "\"Line2\"=\"Value2\"\n\n\n" + "\"Line3\"=\"Value3\"\n\n\n\n" + "\"Line4\"=\"Value4\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0); + verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0); + verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0); + verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1\"=dword:00000782\n\n" + "\"Wine2\"=\"Test Value\"\n" + "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n" + " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "#comment\n" + "@=\"Test\"\n" + ";comment\n\n" + "\"Wine4\"=dword:12345678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x782; + verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + dword = 0x12345678; + verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine5\"=\"No newline\"", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine6\"=dword:00000050\n\n" + "\"Wine7\"=\"No newline\"", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x50; + verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0); + err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "#comment\\\n" + "\"Wine8\"=\"Line 1\"\n" + ";comment\\\n" + "\"Wine9\"=\"Line 2\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0); + verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine10\"=\"Value 1\"#comment\n" + "\"Wine11\"=\"Value 2\";comment\n" + "\"Wine12\"=dword:01020304 #comment\n" + "\"Wine13\"=dword:02040608 ;comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine10"); + verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0); + verify_reg_nonexist(hkey, "Wine12"); + dword = 0x2040608; + verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n" + " #comment\n" + " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine15\"=\"A valid line\"\n" + "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n" + " ;comment\n" + " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine17\"=\"Another valid line\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine14"); + verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0); + verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "#\"Comment1\"=\"Value 1\"\n" + ";\"Comment2\"=\"Value 2\"\n" + " #\"Comment3\"=\"Value 3\"\n" + " ;\"Comment4\"=\"Value 4\"\n" + "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n" + "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Comment1"); + verify_reg_nonexist(hkey, "Comment2"); + verify_reg_nonexist(hkey, "Comment3"); + verify_reg_nonexist(hkey, "Comment4"); + verify_reg_nonexist(hkey, "Wine18"); + verify_reg_nonexist(hkey, "Comment5"); + verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0); + verify_reg_nonexist(hkey, "Comment6"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine20\"=#\"Value 8\"\n" + "\"Wine21\"=;\"Value 9\"\n" + "\"Wine22\"=\"#comment1\"\n" + "\"Wine23\"=\";comment2\"\n" + "\"Wine24\"=\"Value#comment3\"\n" + "\"Wine25\"=\"Value;comment4\"\n" + "\"Wine26\"=\"Value #comment5\"\n" + "\"Wine27\"=\"Value ;comment6\"\n" + "\"Wine28\"=#dword:00000001\n" + "\"Wine29\"=;dword:00000002\n" + "\"Wine30\"=dword:00000003#comment\n" + "\"Wine31\"=dword:00000004;comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine20"); + verify_reg_nonexist(hkey, "Wine21"); + verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0); + verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0); + verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0); + verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0); + verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0); + verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0); + verify_reg_nonexist(hkey, "Wine28"); + verify_reg_nonexist(hkey, "Wine29"); + verify_reg_nonexist(hkey, "Wine30"); + dword = 0x00000004; + verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine32a\"=dword:1\n" + "\"Wine32b\"=dword:4444\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x1; + verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0); + dword = 0x4444; + verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine33a\"=dword:\n" + "\"Wine33b\"=dword:hello\n" + "\"Wine33c\"=dword:123456789\n" + "\"Wine33d\"=dword:012345678\n" + "\"Wine33e\"=dword:000000001\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine33a"); + verify_reg_nonexist(hkey, "Wine33b"); + verify_reg_nonexist(hkey, "Wine33c"); + verify_reg_nonexist(hkey, "Wine33d"); + verify_reg_nonexist(hkey, "Wine33e"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine34a\"=dword:12345678abc\n" + "\"Wine34b\"=dword:12345678 abc\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine34a"); + verify_reg_nonexist(hkey, "Wine34b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine35a\"=dword:0x123\n" + "\"Wine35b\"=dword:123 456\n" + "\"Wine35c\"=dword:1234 5678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine35a"); + verify_reg_nonexist(hkey, "Wine35b"); + verify_reg_nonexist(hkey, "Wine35c"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine36a\"=dword:1234;5678\n" + "\"Wine36b\"=dword:1234 ;5678\n" + "\"Wine36c\"=dword:1234#5678\n" + "\"Wine36d\"=dword:1234 #5678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x1234; + verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg_nonexist(hkey, "Wine36c"); + verify_reg_nonexist(hkey, "Wine36d"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine37a\"=\"foo\"bar\"\n" + "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine37a"); + verify_reg_nonexist(hkey, "Wine37b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Empty string\"=\"\"\n" + "\"\"=\"Default registry value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0); + verify_reg(hkey, NULL, REG_SZ, "Default registry value", 23, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test38a\"=\n" + "\"Test38b\"=\\\"\n" + "\"Test38c\"=\\\"Value\\\"\n" + "\"Test38d\"=\\\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test38a"); + verify_reg_nonexist(hkey, "Test38b"); + verify_reg_nonexist(hkey, "Test38c"); + verify_reg_nonexist(hkey, "Test38d"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine39a\"=\"Value1\" ;comment\n" + "\"Wine39b\"=\"Value2\"\t\t;comment\n" + "\"Wine39c\"=\"Value3\" #comment\n" + "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0); + verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0); + verify_reg_nonexist(hkey, "Wine39c"); + verify_reg_nonexist(hkey, "Wine39d"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "TestNoBeginQuote"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"TestNoEndQuote\"=\"Asdffdsa\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "TestNoEndQuote"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"TestNoQuotes\"=Asdffdsa\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "TestNoQuotes"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "NameNoBeginQuote"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"NameNoEndQuote=\"Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "NameNoEndQuote"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "NameNoQuotes=\"Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "NameNoQuotes"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"MixedQuotes=Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "MixedQuotes"); + verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n" + "\"Wine40b\"=\"Value 1\"\n" + "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n" + "\"Wine40d\"=\"Value 2\"\n" + "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n" + "\"Wine40f\"=\"Value 3\"\n" + "\"Wine40g\"=\"Value 4\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0); + verify_reg_nonexist(hkey, "Wine40c"); + verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0); + verify_reg_nonexist(hkey, "Wine40e"); + verify_reg_nonexist(hkey, "Wine40f"); + verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,\\;comment\n" + " 63,00,61,00,74,00,\\;comment\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,\\;comment\n" + " 63,00,61,00,74,00,;comment\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n" + ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line3"); + + test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n" + " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line4"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n" + ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line5"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n" + " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line6"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n" + " 65,00,20,00,\\;comment\n" + " 63,00,6f,00,6e,00,\\;comment\n" + " 63,00,61,00,74,00,\\;comment\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n" + " 65,00,20,00,\\;#comment\n" + " 63,00,6f,00,6e,00,\\;#comment\n" + " 63,00,61,00,74,00,\\;#comment\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n" + " 65,00,20,00,\\;comment\n" + " 63,00,6f,00,6e,00,\\;comment\n" + " 63,00,61,00,74,00,\\#comment\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line9"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,\\;comment\n" + " 63,00,61,00,74,00,\\\n\n" + " 65,00,6e,00,\\;comment\n\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine41a\"=dword:1234\\\n" + "5678\n" + "\"Wine41b\"=\"Test \\\n" + "Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine41a"); + verify_reg_nonexist(hkey, "Wine41b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n" + "\"single'quote\"=dword:00000008\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0); + dword = 0x00000008; + verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0); + + /* Test key name and value name concatenation */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n" + "Subkey1]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey1"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\n" + "\\Subkey2]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey2"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine\\\n" + "42a\"=\"Value 1\"\n" + "\"Wine42b\"=\"Value 2\"\n" + "\"Wine\n" + "\\42c\"=\"Value 3\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine42a"); + verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0); + verify_reg_nonexist(hkey, "Wine42c"); + + /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n" + "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n" + " 75,00,65,00,00,00\n" + "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n" + ",75,00,65,00,00,00\n" + "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n" + " ,75,00,65,00,00,00\n" + "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n" + " 75,00,65,00,00,00\n" + "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n" + "5,00,65,00,00,00\n" + "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n" + " 5,00,65,00,00,00\n" + "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,\\\n" + " 65,00,00,00\n" + "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,\n" + " 65,00,00,00\n" + "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,;comment\n" + " 65,00,00,00\n" + "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,\\#comment\n" + " 65,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + verify_reg_nonexist(hkey, "Wine43c"); + verify_reg_nonexist(hkey, "Wine43d"); + verify_reg_nonexist(hkey, "Wine43e"); + verify_reg_nonexist(hkey, "Wine43f"); + verify_reg_nonexist(hkey, "Wine43g"); + verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0); + verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0); + verify_reg_nonexist(hkey, "Wine43k"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n" + " 54,00,48,00,25,00,00,00\n" + "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n" + ",54,00,48,00,25,00,00,00\n" + "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n" + " ,54,00,48,00,25,00,00,00\n" + "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n" + " 54,00,48,00,25,00,00,00\n" + "\"Wine44f\"=hex(2):25,00,50,00,4\\\n" + "1,00,54,00,48,00,25,00,00,00\n" + "\"Wine44g\"=hex(2):25,00,50,00,4\\\n" + " 1,00,54,00,48,00,25,00,00,00\n" + "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n" + " 54,00,48,00,\\\n" + " 25,00,00,00\n" + "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n" + " 54,00,48,00\n" + " 25,00,00,00\n" + "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n" + " 54,00,48,00;comment\n" + " 25,00,00,00\n" + "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n" + " 54,00,48,00,\\#comment\n" + " 25,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg_nonexist(hkey, "Wine44c"); + verify_reg_nonexist(hkey, "Wine44d"); + verify_reg_nonexist(hkey, "Wine44e"); + verify_reg_nonexist(hkey, "Wine44f"); + verify_reg_nonexist(hkey, "Wine44g"); + verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0); + /* Wine44i */ + size = sizeof(buffer); + err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); + ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); + ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); + /* Wine44j */ + size = sizeof(buffer); + memset(buffer, '-', size); + err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); + ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); + ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); + /* Wine44k */ + verify_reg_nonexist(hkey, "Wine44k"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n" + "\"Wine45b\"=hex:11,22,33,44,\\\n" + " 55,66,77,88\n" + "\"Wine45c\"=hex:11,22,33,44\\\n" + ",55,66,77,88\n" + "\"Wine45d\"=hex:11,22,33,44\\\n" + " ,55,66,77,88\n" + "\"Wine45e\"=hex:11,22,33,44\\\n" + " 55,66,77,88\n" + "\"Wine45f\"=hex:11,22,33,4\\\n" + "4,55,66,77,88\n" + "\"Wine45g\"=hex:11,22,33,4\\\n" + " 4,55,66,77,88\n" + "\"Wine45h\"=hex:11,22,33,44,\\;comment\n" + " 55,66,\\\n" + " 77,88\n" + "\"Wine45i\"=hex:11,22,33,44,\\;comment\n" + " 55,66,\n" + " 77,88\n" + "\"Wine45j\"=hex:11,22,33,44,\\;comment\n" + " 55,66,;comment\n" + " 77,88\n" + "\"Wine45k\"=hex:11,22,33,\\;comment\n" + " 44,55,66,\\#comment\n" + " 77,88\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44; + hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88; + verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0); + verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0); + verify_reg_nonexist(hkey, "Wine45c"); + verify_reg_nonexist(hkey, "Wine45d"); + verify_reg_nonexist(hkey, "Wine45e"); + verify_reg_nonexist(hkey, "Wine45f"); + verify_reg_nonexist(hkey, "Wine45g"); + verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0); + verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0); + verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0); + verify_reg_nonexist(hkey, "Wine45k"); + + /* Test import with subkeys */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n" + "\"Wine\\\\31\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + open_key(hkey, "Subkey\"1", 0, &subkey); + verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n" + "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + open_key(hkey, "Subkey/2", 0, &subkey); + verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0); + close_key(subkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2"); + + /* Test key creation */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "No_Opening_Bracket"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "No_Closing_Bracket"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey1a"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey1b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1c "); + delete_key(hkey, "Subkey1c "); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1d\t"); + delete_key(hkey, "Subkey1d\t"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n" + "\"Wine\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1e\\"); + verify_key(hkey, "Subkey1e"); + open_key(hkey, "Subkey1e", 0, &subkey); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(hkey, "Subkey1e"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n" + "\"Wine\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1f\\\\"); + verify_key(hkey, "Subkey1f\\"); + verify_key(hkey, "Subkey1f"); + open_key(hkey, "Subkey1f\\\\", 0, &subkey); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(hkey, "Subkey1f\\\\"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n" + "\"Wine\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1g\\\\\\\\"); + verify_key(hkey, "Subkey1g\\\\"); + verify_key(hkey, "Subkey1g\\"); + verify_key(hkey, "Subkey1g"); + open_key(hkey, "Subkey1g\\\\", 0, &subkey); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(hkey, "Subkey1g\\\\"); + + /* Test key deletion. We start by creating some registry keys. */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2a"); + verify_key(hkey, "Subkey2b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2a"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2a"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" + "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey2a"); + verify_key_nonexist(hkey, "Subkey2b"); + + /* Test case sensitivity when creating and deleting registry keys. */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n" + "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey3a"); + verify_key(hkey, "Subkey3b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n" + "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey3a"); + verify_key_nonexist(hkey, "Subkey3b"); + + /* Test mixed key creation and deletion. We start by creating a subkey. */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey4a"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" + "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n" + "\"Wine46a\"=dword:12345678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey4a"); + verify_reg_nonexist(hkey, "Wine46a"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" + "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n" + "\"Wine46b\"=dword:12345678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey4b"); + verify_reg_nonexist(hkey, "Wine46b"); + + /* Test value deletion. We start by creating some registry values. */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine46a\"=\"Test Value\"\n" + "\"Wine46b\"=dword:00000008\n" + "\"Wine46c\"=hex:11,22,33,44\n" + "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0); + verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine46a\"=-\n" + "\"Wine46b\"= -\n" + "\"Wine46c\"= \t-\t \n" + "\"Wine46d\"=-\"Test\"\n" + "\"Wine46e\"=- ;comment\n" + "\"Wine46f\"=- #comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine46a"); + verify_reg_nonexist(hkey, "Wine46b"); + verify_reg_nonexist(hkey, "Wine46c"); + verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg_nonexist(hkey, "Wine46e"); + verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + + /* Test the accepted range of the hex-based data types */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n" + "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n" + "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n" + "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n" + "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n" + "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n" + "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n" + "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n" + "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n" + "\"Wine47j\"=hex(0x2):56,00,61,00,6c,00,75,00,65,00,00,00\n" + "\"Wine47k\"=hex(0X2):56,00,61,00,6c,00,75,00,65,00,00,00\n" + "\"Wine47l\"=hex(x2):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0); + verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0); + verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0); + verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0); + verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0); + verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0); + verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0); + verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0); + verify_reg_nonexist(hkey, "Wine47i"); + verify_reg_nonexist(hkey, "Wine47j"); + verify_reg_nonexist(hkey, "Wine47k"); + verify_reg_nonexist(hkey, "Wine47l"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine48a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00, \\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00, \\\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine48b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\t\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\t \t \\\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine49\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine50a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 ;comment\n" + "\"Wine50b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t;comment\n" + "\"Wine50c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 #comment\n" + "\"Wine50d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t#comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg_nonexist(hkey, "Wine50c"); + verify_reg_nonexist(hkey, "Wine50d"); + + /* Test support for characters greater than 0xff */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n" + "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine51a"); + verify_reg_nonexist(hkey, "Wine51b"); + + /* Test the effect of backslashes in hex data */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine52a\"=hex(2):25,00,48\\,00,4f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52b\"=hex(2):25,00,48,00,\\4f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52c\"=hex(2):25,00,48\\ ,00,4f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52d\"=hex(2):25,00,48,00,\\ 4f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52e\"=hex(2):\\25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52f\"=hex(2):\\ 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52g\"=hex(2):25,00,48,00,4\\f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52h\"=hex(2):25,00,48,00,4\\\n" + " f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52i\"=hex(2):25,00,50,00,\\,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine52j\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\\\n" + " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine52k\"=hex(2):,\\\n" + " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n" + "\"Wine52l\"=hex(2):\\\n" + " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine52a"); + verify_reg_nonexist(hkey, "Wine52b"); + verify_reg_nonexist(hkey, "Wine52c"); + verify_reg_nonexist(hkey, "Wine52d"); + verify_reg_nonexist(hkey, "Wine52e"); + verify_reg_nonexist(hkey, "Wine52f"); + verify_reg_nonexist(hkey, "Wine52g"); + verify_reg_nonexist(hkey, "Wine52h"); + verify_reg_nonexist(hkey, "Wine52i"); + verify_reg_nonexist(hkey, "Wine52j"); + verify_reg_nonexist(hkey, "Wine52k"); + verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine53a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" + " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine53b\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n" + " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine53c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00, \\ ;comment\n" + " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine53d\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00 \\ ;comment\n" + " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine53e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\t ;comment\n" + " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine53f\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\t ;comment\n" + " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); + verify_reg_nonexist(hkey, "Wine53b"); + verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); + verify_reg_nonexist(hkey, "Wine53d"); + verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); + verify_reg_nonexist(hkey, "Wine53f"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine54a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine54a"); + verify_key_nonexist(hkey, "Subkey1"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine54b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine54b"); + verify_key(hkey, "Subkey2"); + + delete_key(hkey, "Subkey2"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine55a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + "\"Wine55b\"=\"Test value\"\n" + + "\"Wine55c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + ";comment\n" + "\"Wine55d\"=\"Test value\"\n" + + "\"Wine55e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + "#comment\n" + "\"Wine55f\"=\"Test value\"\n" + + "\"Wine55g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n" + "\"Wine55h\"=\"Test value\"\n" + + "\"Wine55i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" + "\"Wine55j\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine55a"); + verify_reg_nonexist(hkey, "Wine55b"); + verify_reg_nonexist(hkey, "Wine55c"); + verify_reg_nonexist(hkey, "Wine55d"); + verify_reg_nonexist(hkey, "Wine55e"); + verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0); + verify_reg_nonexist(hkey, "Wine55g"); + verify_reg_nonexist(hkey, "Wine55h"); + verify_reg_nonexist(hkey, "Wine55i"); + verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine56a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + "\"Wine56b\"=dword:00000008\n" + + "\"Wine56c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + ";comment\n" + "\"Wine56d\"=dword:00000008\n" + + "\"Wine56e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + "#comment\n" + "\"Wine56f\"=dword:00000008\n" + + "\"Wine56g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n" + "\"Wine56h\"=dword:00000008\n" + + "\"Wine56i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" + "\"Wine56j\"=dword:00000008\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine56a"); + verify_reg_nonexist(hkey, "Wine56b"); + verify_reg_nonexist(hkey, "Wine56c"); + verify_reg_nonexist(hkey, "Wine56d"); + verify_reg_nonexist(hkey, "Wine56e"); + verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg_nonexist(hkey, "Wine56g"); + verify_reg_nonexist(hkey, "Wine56h"); + verify_reg_nonexist(hkey, "Wine56i"); + verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine57a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" + "\"Wine57b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + + "\"Wine57c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" + ";comment\n" + "\"Wine57d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + + "\"Wine57e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" + "#comment\n" + "\"Wine57f\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + + "\"Wine57g\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n\n" + "\"Wine57h\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + + "\"Wine57i\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n" + "\"Wine57j\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine57a"); + verify_reg_nonexist(hkey, "Wine57b"); + verify_reg_nonexist(hkey, "Wine57c"); + verify_reg_nonexist(hkey, "Wine57d"); + verify_reg_nonexist(hkey, "Wine57e"); + verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg_nonexist(hkey, "Wine57g"); + verify_reg_nonexist(hkey, "Wine57h"); + verify_reg_nonexist(hkey, "Wine57i"); + verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0); + + delete_value(hkey, NULL); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + "@=\"Default value 1\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58a"); + verify_reg_nonexist(hkey, NULL); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + ";comment\n" + "@=\"Default value 2\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58b"); + verify_reg_nonexist(hkey, NULL); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" + "#comment\n" + "@=\"Default value 3\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58c"); + verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0); + + delete_value(hkey, NULL); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58d\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n" + "@=\"Default value 4\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58d"); + verify_reg_nonexist(hkey, NULL); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" + "@=\"Default value 5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58e"); + verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine59a\"=hex:11,22,33,\\\n" + "\\\n" + " 44,55,66\n" + "\"Wine59b\"=hex:11,22,33,\\\n" + " \\\n" + " 44,55,66\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine59a"); + verify_reg_nonexist(hkey, "Wine59b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" + ";comment\n" + " 65,00,6e,00,\\;comment\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" + " ;comment\n" + " 65,00,6e,00,\\;comment\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" + "#comment\n" + " 65,00,6e,00,\\;comment\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine60c"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" + " #comment\n" + " 65,00,6e,00,\\;comment\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine60d"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,\\\n\n" + " 63,00,61,00,74,00,\\\n\n\n" + " 65,00,6e,00,\\\n\n\n\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,\\\n \n" + " 63,00,61,00,74,00,\\\n\t\n\t\n" + " 65,00,6e,00,\\\n\t \t\n\t \t\n\t \t\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n" + " 25,50,41,54,48,25,00\n" + "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n" + " 25,50,41,54,48,25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine61a"); + verify_reg_nonexist(hkey, "Wine61b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62c\"=hex:11,22,33,44,55,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62d\"=hex(7):4c,00,69,00,6e,00,65,00,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine62f"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine63a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " ,63,00,6f,00,6e,00,\\\n" + " 63,00,61,00,74,00,\\\n" + " 65,00,6e,00,\\\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine63b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,,00,6f,00,6e,00,\\\n" + " 63,00,61,00,74,00,\\\n" + " 65,00,6e,00,\\\n" + " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine63a"); + verify_reg_nonexist(hkey, "Wine63b"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine64a\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n" + "\"Wine64b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine64c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine64d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" + "\"Wine64e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" + " 63,00,6f,00,6e,00,63,00,61,00,74,00,;comment\n" + " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0); + verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + /* Wine64d */ + size = sizeof(buffer); + err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); + ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); + ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); + /* Wine64e */ + size = sizeof(buffer); + err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); + ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); + ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n" + "\"Wine65b\"=hex(100):25,50,41,\\\n" + " 54,48,25,00\n" + "\"Wine65c\"=hex(100):25,50,41,\\;comment\n" + " 54,48,\\\n" + " 25,00\n" + "\"Wine65d\"=hex(100):25,50,41,\\;comment\n" + " 54,48,\n" + " 25,00\n" + "\"Wine65e\"=hex(100):25,50,41,\\;comment\n" + " 54,48,;comment\n" + " 25,00\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0); + verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0); + verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0); + verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0); + verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0); + + /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine66a\"=hex(7):4c,00,69,00,6e,00,65,00\n" + "\"Wine66b\"=hex(7):4c,00,69,00,6e,00,65,00,\n" + "\"Wine66c\"=hex(7):4c,00,69,00,6e,00,65,00,00,00\n" + "\"Wine66d\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,\n" + "\"Wine66e\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n" + "\"Wine66f\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00,\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0); + verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine67a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00\n" + "\"Wine67b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\n" + "\"Wine67c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" + "\"Wine67d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine68a\"=hex(1):\n" + "\"Wine68b\"=hex(2):\n" + "\"Wine68c\"=hex(3):\n" + "\"Wine68d\"=hex(4):\n" + "\"Wine68e\"=hex(7):\n" + "\"Wine68f\"=hex(100):\n" + "\"Wine68g\"=hex(abcd):\n" + "\"Wine68h\"=hex:\n" + "\"Wine68i\"=hex(0):\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0); + verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0); + verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0); + verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0); + verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0); + verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0); + verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0); + verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0); + verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0); + + /* Test with embedded null characters */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine69a\"=\"\\0\n" + "\"Wine69b\"=\"\\0\\0\n" + "\"Wine69c\"=\"Value1\\0\n" + "\"Wine69d\"=\"Value2\\0\\0\\0\\0\n" + "\"Wine69e\"=\"Value3\\0Value4\n" + "\"Wine69f\"=\"\\0Value5\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine69a"); + verify_reg_nonexist(hkey, "Wine69b"); + verify_reg_nonexist(hkey, "Wine69c"); + verify_reg_nonexist(hkey, "Wine69d"); + verify_reg_nonexist(hkey, "Wine69e"); + verify_reg_nonexist(hkey, "Wine69f"); + + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine70a\"=\"\\0\"\n" + "\"Wine70b\"=\"\\0\\0\"\n" + "\"Wine70c\"=\"Value1\\0\"\n" + "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n" + "\"Wine70e\"=\"Value3\\0Value4\"\n" + "\"Wine70f\"=\"\\0Value5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine70a"); + todo_wine verify_reg_nonexist(hkey, "Wine70b"); + todo_wine verify_reg_nonexist(hkey, "Wine70c"); + todo_wine verify_reg_nonexist(hkey, "Wine70d"); + todo_wine verify_reg_nonexist(hkey, "Wine70e"); + todo_wine verify_reg_nonexist(hkey, "Wine70f"); + + /* Test forward and back slashes */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"count/up\"=\"one/two/three\"\n" + "\"\\\\foo\\\\bar\"=\"\"\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); + verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); + verify_key(hkey, "
https://winehq.org
"); + + close_key(hkey); + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); +} START_TEST(import) { @@ -1633,4 +3182,5 @@ START_TEST(import) } test_import(); + test_unicode_import(); } diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 407af68c769..6dcea506766 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -206,6 +206,7 @@ void delete_value_(unsigned line, const HKEY hkey, const char *name) } /* Unit tests */ + static void test_add(void) { HKEY hkey; @@ -613,1555 +614,6 @@ static void test_add(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } -static void test_unicode_import(void) -{ - DWORD r, dword = 0x123, type, size; - HKEY hkey, subkey; - LONG err; - char buffer[24]; - BYTE hex[8]; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - test_import_wstr("REGEDIT\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("REGEDIT4\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("\xef\xbb\xbfREGEDIT", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbfREGEDIT\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbfREGEDIT4", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbf REGEDIT4\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbf\tREGEDIT4\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbf\nREGEDIT4\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey); - - test_import_wstr("\xef\xbb\xbfREGEDIT3\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test1\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test1"); - - test_import_wstr("\xef\xbb\xbfregedit4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test2\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test2"); - - test_import_wstr("\xef\xbb\xbfRegedit4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test3\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test3"); - - test_import_wstr("\xef\xbb\xbfREGEDIT 4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test4\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test4"); - - test_import_wstr("\xef\xbb\xbfREGEDIT4FOO\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test5\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test5"); - - test_import_wstr("\xef\xbb\xbfREGEDIT4 FOO\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test6\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test6"); - - test_import_wstr("\xef\xbb\xbfREGEDIT5\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test7\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test7"); - - test_import_wstr("\xef\xbb\xbfREGEDIT9\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test8\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test8"); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Unicode1\"=\"Value1\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Unicode1", REG_SZ, "Value1", 7, 0); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Unicode2\"=\"Value2\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Unicode2", REG_SZ, "Value2", 7, 0); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Unicode3\"=\"Value3\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Unicode3", REG_SZ, "Value3", 7, 0); - - test_import_wstr("Windows Registry Editor Version 4.00\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("Windows Registry Editor Version 5.00\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbfWINDOWS Registry Editor Version 5.00\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("\xef\xbb\xbf Windows Registry Editor Version 5.00\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbf\tWindows Registry Editor Version 5.00\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_wstr("\xef\xbb\xbf\nWindows Registry Editor Version 5.00\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 4.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test9\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test9"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test10\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test10"); - - test_import_wstr("\xef\xbb\xbfWINDOWS REGISTRY EDITOR VERSION 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test11\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test11"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test12\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test12"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine\"=dword:00000123\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "@=\"Test string\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Unicode4\"=\"Value4\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Unicode4", REG_SZ, "Value4", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Unicode5\"=\"Value5\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Unicode5", REG_SZ, "Value5", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Unicode6\"=\"Value6\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Unicode6", REG_SZ, "Value6", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Line1\"=\"Value1\"\n\n" - "\"Line2\"=\"Value2\"\n\n\n" - "\"Line3\"=\"Value3\"\n\n\n\n" - "\"Line4\"=\"Value4\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0); - verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0); - verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0); - verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1\"=dword:00000782\n\n" - "\"Wine2\"=\"Test Value\"\n" - "\"Wine3\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n" - " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "#comment\n" - "@=\"Test\"\n" - ";comment\n\n" - "\"Wine4\"=dword:12345678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x782; - verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); - verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "", REG_SZ, "Test", 5, 0); - dword = 0x12345678; - verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine5\"=\"No newline\"", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), - "got %d, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine6\"=dword:00000050\n\n" - "\"Wine7\"=\"No newline\"", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x50; - verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0); - err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), - "got %d, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "#comment\\\n" - "\"Wine8\"=\"Line 1\"\n" - ";comment\\\n" - "\"Wine9\"=\"Line 2\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0); - verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine10\"=\"Value 1\"#comment\n" - "\"Wine11\"=\"Value 2\";comment\n" - "\"Wine12\"=dword:01020304 #comment\n" - "\"Wine13\"=dword:02040608 ;comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine10"); - verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0); - verify_reg_nonexist(hkey, "Wine12"); - dword = 0x2040608; - verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine14\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n" - " #comment\n" - " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine15\"=\"A valid line\"\n" - "\"Wine16\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,63,00,6f,00,6e,00,63,00,\\\n" - " ;comment\n" - " 61,00,74,00,65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine17\"=\"Another valid line\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine14"); - verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0); - verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "#\"Comment1\"=\"Value 1\"\n" - ";\"Comment2\"=\"Value 2\"\n" - " #\"Comment3\"=\"Value 3\"\n" - " ;\"Comment4\"=\"Value 4\"\n" - "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n" - "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Comment1"); - verify_reg_nonexist(hkey, "Comment2"); - verify_reg_nonexist(hkey, "Comment3"); - verify_reg_nonexist(hkey, "Comment4"); - verify_reg_nonexist(hkey, "Wine18"); - verify_reg_nonexist(hkey, "Comment5"); - verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0); - verify_reg_nonexist(hkey, "Comment6"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine20\"=#\"Value 8\"\n" - "\"Wine21\"=;\"Value 9\"\n" - "\"Wine22\"=\"#comment1\"\n" - "\"Wine23\"=\";comment2\"\n" - "\"Wine24\"=\"Value#comment3\"\n" - "\"Wine25\"=\"Value;comment4\"\n" - "\"Wine26\"=\"Value #comment5\"\n" - "\"Wine27\"=\"Value ;comment6\"\n" - "\"Wine28\"=#dword:00000001\n" - "\"Wine29\"=;dword:00000002\n" - "\"Wine30\"=dword:00000003#comment\n" - "\"Wine31\"=dword:00000004;comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine20"); - verify_reg_nonexist(hkey, "Wine21"); - verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0); - verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0); - verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0); - verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0); - verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0); - verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0); - verify_reg_nonexist(hkey, "Wine28"); - verify_reg_nonexist(hkey, "Wine29"); - verify_reg_nonexist(hkey, "Wine30"); - dword = 0x00000004; - verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine32a\"=dword:1\n" - "\"Wine32b\"=dword:4444\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x1; - verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0); - dword = 0x4444; - verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine33a\"=dword:\n" - "\"Wine33b\"=dword:hello\n" - "\"Wine33c\"=dword:123456789\n" - "\"Wine33d\"=dword:012345678\n" - "\"Wine33e\"=dword:000000001\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine33a"); - verify_reg_nonexist(hkey, "Wine33b"); - verify_reg_nonexist(hkey, "Wine33c"); - verify_reg_nonexist(hkey, "Wine33d"); - verify_reg_nonexist(hkey, "Wine33e"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine34a\"=dword:12345678abc\n" - "\"Wine34b\"=dword:12345678 abc\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine34a"); - verify_reg_nonexist(hkey, "Wine34b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine35a\"=dword:0x123\n" - "\"Wine35b\"=dword:123 456\n" - "\"Wine35c\"=dword:1234 5678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine35a"); - verify_reg_nonexist(hkey, "Wine35b"); - verify_reg_nonexist(hkey, "Wine35c"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine36a\"=dword:1234;5678\n" - "\"Wine36b\"=dword:1234 ;5678\n" - "\"Wine36c\"=dword:1234#5678\n" - "\"Wine36d\"=dword:1234 #5678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x1234; - verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg_nonexist(hkey, "Wine36c"); - verify_reg_nonexist(hkey, "Wine36d"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine37a\"=\"foo\"bar\"\n" - "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine37a"); - verify_reg_nonexist(hkey, "Wine37b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Empty string\"=\"\"\n" - "\"\"=\"Default registry value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0); - verify_reg(hkey, NULL, REG_SZ, "Default registry value", 23, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test38a\"=\n" - "\"Test38b\"=\\\"\n" - "\"Test38c\"=\\\"Value\\\"\n" - "\"Test38d\"=\\\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test38a"); - verify_reg_nonexist(hkey, "Test38b"); - verify_reg_nonexist(hkey, "Test38c"); - verify_reg_nonexist(hkey, "Test38d"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine39a\"=\"Value1\" ;comment\n" - "\"Wine39b\"=\"Value2\"\t\t;comment\n" - "\"Wine39c\"=\"Value3\" #comment\n" - "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0); - verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0); - verify_reg_nonexist(hkey, "Wine39c"); - verify_reg_nonexist(hkey, "Wine39d"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "TestNoBeginQuote"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"TestNoEndQuote\"=\"Asdffdsa\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "TestNoEndQuote"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"TestNoQuotes\"=Asdffdsa\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "TestNoQuotes"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "NameNoBeginQuote"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"NameNoEndQuote=\"Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "NameNoEndQuote"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "NameNoQuotes=\"Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "NameNoQuotes"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"MixedQuotes=Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "MixedQuotes"); - verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine40a\"=hex(2):4c,00,69,00,6e,00,65,00,00,00\n" - "\"Wine40b\"=\"Value 1\"\n" - "\"Wine40c\"=hex(2):4c,00,69,00,6e,00,65,00\\\n" - "\"Wine40d\"=\"Value 2\"\n" - "\"Wine40e\"=hex(2):4c,00,69,00,6e,00,65,00,\\\n" - "\"Wine40f\"=\"Value 3\"\n" - "\"Wine40g\"=\"Value 4\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0); - verify_reg_nonexist(hkey, "Wine40c"); - verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0); - verify_reg_nonexist(hkey, "Wine40e"); - verify_reg_nonexist(hkey, "Wine40f"); - verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,\\;comment\n" - " 63,00,61,00,74,00,\\;comment\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line2\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,\\;comment\n" - " 63,00,61,00,74,00,;comment\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n" - ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line3"); - - test_import_wstr("\xef\xbb\xbfREGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n" - " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line4"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n" - ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line5"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n" - " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line6"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line7\"=hex(7):4c,00,69,00,6e,00,\\;comment\n" - " 65,00,20,00,\\;comment\n" - " 63,00,6f,00,6e,00,\\;comment\n" - " 63,00,61,00,74,00,\\;comment\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line8\"=hex(7):4c,00,69,00,6e,00,\\;#comment\n" - " 65,00,20,00,\\;#comment\n" - " 63,00,6f,00,6e,00,\\;#comment\n" - " 63,00,61,00,74,00,\\;#comment\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line9\"=hex(7):4c,00,69,00,6e,00,\\;comment\n" - " 65,00,20,00,\\;comment\n" - " 63,00,6f,00,6e,00,\\;comment\n" - " 63,00,61,00,74,00,\\#comment\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line9"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line10\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,\\;comment\n" - " 63,00,61,00,74,00,\\\n\n" - " 65,00,6e,00,\\;comment\n\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine41a\"=dword:1234\\\n" - "5678\n" - "\"Wine41b\"=\"Test \\\n" - "Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine41a"); - verify_reg_nonexist(hkey, "Wine41b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n" - "\"single'quote\"=dword:00000008\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0); - dword = 0x00000008; - verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0); - - /* Test key name and value name concatenation */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n" - "Subkey1]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\n" - "\\Subkey2]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine\\\n" - "42a\"=\"Value 1\"\n" - "\"Wine42b\"=\"Value 2\"\n" - "\"Wine\n" - "\\42c\"=\"Value 3\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine42a"); - verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0); - verify_reg_nonexist(hkey, "Wine42c"); - - /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n" - "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n" - " 75,00,65,00,00,00\n" - "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n" - ",75,00,65,00,00,00\n" - "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n" - " ,75,00,65,00,00,00\n" - "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n" - " 75,00,65,00,00,00\n" - "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n" - "5,00,65,00,00,00\n" - "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n" - " 5,00,65,00,00,00\n" - "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,\\\n" - " 65,00,00,00\n" - "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,\n" - " 65,00,00,00\n" - "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,;comment\n" - " 65,00,00,00\n" - "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,\\#comment\n" - " 65,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - verify_reg_nonexist(hkey, "Wine43c"); - verify_reg_nonexist(hkey, "Wine43d"); - verify_reg_nonexist(hkey, "Wine43e"); - verify_reg_nonexist(hkey, "Wine43f"); - verify_reg_nonexist(hkey, "Wine43g"); - verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0); - verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0); - verify_reg_nonexist(hkey, "Wine43k"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine44a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine44b\"=hex(2):25,00,50,00,41,00,\\\n" - " 54,00,48,00,25,00,00,00\n" - "\"Wine44c\"=hex(2):25,00,50,00,41,00\\\n" - ",54,00,48,00,25,00,00,00\n" - "\"Wine44d\"=hex(2):25,00,50,00,41,00\\\n" - " ,54,00,48,00,25,00,00,00\n" - "\"Wine44e\"=hex(2):25,00,50,00,41,00\\\n" - " 54,00,48,00,25,00,00,00\n" - "\"Wine44f\"=hex(2):25,00,50,00,4\\\n" - "1,00,54,00,48,00,25,00,00,00\n" - "\"Wine44g\"=hex(2):25,00,50,00,4\\\n" - " 1,00,54,00,48,00,25,00,00,00\n" - "\"Wine44h\"=hex(2):25,00,50,00,41,00,\\;comment\n" - " 54,00,48,00,\\\n" - " 25,00,00,00\n" - "\"Wine44i\"=hex(2):25,00,50,00,41,00,\\;comment\n" - " 54,00,48,00\n" - " 25,00,00,00\n" - "\"Wine44j\"=hex(2):25,00,50,00,41,00,\\;comment\n" - " 54,00,48,00;comment\n" - " 25,00,00,00\n" - "\"Wine44k\"=hex(2):25,00,50,00,41,00,\\;comment\n" - " 54,00,48,00,\\#comment\n" - " 25,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg_nonexist(hkey, "Wine44c"); - verify_reg_nonexist(hkey, "Wine44d"); - verify_reg_nonexist(hkey, "Wine44e"); - verify_reg_nonexist(hkey, "Wine44f"); - verify_reg_nonexist(hkey, "Wine44g"); - verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0); - /* Wine44i */ - size = sizeof(buffer); - err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); - ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); - ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); - /* Wine44j */ - size = sizeof(buffer); - memset(buffer, '-', size); - err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); - ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); - ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); - /* Wine44k */ - verify_reg_nonexist(hkey, "Wine44k"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n" - "\"Wine45b\"=hex:11,22,33,44,\\\n" - " 55,66,77,88\n" - "\"Wine45c\"=hex:11,22,33,44\\\n" - ",55,66,77,88\n" - "\"Wine45d\"=hex:11,22,33,44\\\n" - " ,55,66,77,88\n" - "\"Wine45e\"=hex:11,22,33,44\\\n" - " 55,66,77,88\n" - "\"Wine45f\"=hex:11,22,33,4\\\n" - "4,55,66,77,88\n" - "\"Wine45g\"=hex:11,22,33,4\\\n" - " 4,55,66,77,88\n" - "\"Wine45h\"=hex:11,22,33,44,\\;comment\n" - " 55,66,\\\n" - " 77,88\n" - "\"Wine45i\"=hex:11,22,33,44,\\;comment\n" - " 55,66,\n" - " 77,88\n" - "\"Wine45j\"=hex:11,22,33,44,\\;comment\n" - " 55,66,;comment\n" - " 77,88\n" - "\"Wine45k\"=hex:11,22,33,\\;comment\n" - " 44,55,66,\\#comment\n" - " 77,88\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44; - hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88; - verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0); - verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0); - verify_reg_nonexist(hkey, "Wine45c"); - verify_reg_nonexist(hkey, "Wine45d"); - verify_reg_nonexist(hkey, "Wine45e"); - verify_reg_nonexist(hkey, "Wine45f"); - verify_reg_nonexist(hkey, "Wine45g"); - verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0); - verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0); - verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0); - verify_reg_nonexist(hkey, "Wine45k"); - - /* Test import with subkeys */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n" - "\"Wine\\\\31\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - open_key(hkey, "Subkey\"1", 0, &subkey); - verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n" - "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - open_key(hkey, "Subkey/2", 0, &subkey); - verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0); - close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2"); - - /* Test key creation */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Opening_Bracket"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Closing_Bracket"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1a"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1c "); - delete_key(hkey, "Subkey1c "); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1d\t"); - delete_key(hkey, "Subkey1d\t"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n" - "\"Wine\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1e\\"); - verify_key(hkey, "Subkey1e"); - open_key(hkey, "Subkey1e", 0, &subkey); - verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(hkey, "Subkey1e"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n" - "\"Wine\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1f\\\\"); - verify_key(hkey, "Subkey1f\\"); - verify_key(hkey, "Subkey1f"); - open_key(hkey, "Subkey1f\\\\", 0, &subkey); - verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(hkey, "Subkey1f\\\\"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n" - "\"Wine\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1g\\\\\\\\"); - verify_key(hkey, "Subkey1g\\\\"); - verify_key(hkey, "Subkey1g\\"); - verify_key(hkey, "Subkey1g"); - open_key(hkey, "Subkey1g\\\\", 0, &subkey); - verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(hkey, "Subkey1g\\\\"); - - /* Test key deletion. We start by creating some registry keys. */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - verify_key(hkey, "Subkey2b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" - "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2a"); - verify_key_nonexist(hkey, "Subkey2b"); - - /* Test case sensitivity when creating and deleting registry keys. */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n" - "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey3a"); - verify_key(hkey, "Subkey3b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n" - "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey3a"); - verify_key_nonexist(hkey, "Subkey3b"); - - /* Test mixed key creation and deletion. We start by creating a subkey. */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey4a"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" - "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n" - "\"Wine46a\"=dword:12345678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4a"); - verify_reg_nonexist(hkey, "Wine46a"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" - "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n" - "\"Wine46b\"=dword:12345678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4b"); - verify_reg_nonexist(hkey, "Wine46b"); - - /* Test value deletion. We start by creating some registry values. */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine46a\"=\"Test Value\"\n" - "\"Wine46b\"=dword:00000008\n" - "\"Wine46c\"=hex:11,22,33,44\n" - "\"Wine46d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine46e\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0); - verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0); - verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine46a\"=-\n" - "\"Wine46b\"= -\n" - "\"Wine46c\"= \t-\t \n" - "\"Wine46d\"=-\"Test\"\n" - "\"Wine46e\"=- ;comment\n" - "\"Wine46f\"=- #comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine46a"); - verify_reg_nonexist(hkey, "Wine46b"); - verify_reg_nonexist(hkey, "Wine46c"); - verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg_nonexist(hkey, "Wine46e"); - verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - - /* Test the accepted range of the hex-based data types */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n" - "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n" - "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n" - "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n" - "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n" - "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n" - "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n" - "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n" - "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n" - "\"Wine47j\"=hex(0x2):56,00,61,00,6c,00,75,00,65,00,00,00\n" - "\"Wine47k\"=hex(0X2):56,00,61,00,6c,00,75,00,65,00,00,00\n" - "\"Wine47l\"=hex(x2):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0); - verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0); - verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0); - verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0); - verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0); - verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0); - verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0); - verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0); - verify_reg_nonexist(hkey, "Wine47i"); - verify_reg_nonexist(hkey, "Wine47j"); - verify_reg_nonexist(hkey, "Wine47k"); - verify_reg_nonexist(hkey, "Wine47l"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine48a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00, \\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00, \\\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine48b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\t\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\t \t \\\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine49\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine50a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 ;comment\n" - "\"Wine50b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t;comment\n" - "\"Wine50c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00 #comment\n" - "\"Wine50d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\t#comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg_nonexist(hkey, "Wine50c"); - verify_reg_nonexist(hkey, "Wine50d"); - - /* Test support for characters greater than 0xff */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n" - "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine51a"); - verify_reg_nonexist(hkey, "Wine51b"); - - /* Test the effect of backslashes in hex data */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine52a\"=hex(2):25,00,48\\,00,4f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52b\"=hex(2):25,00,48,00,\\4f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52c\"=hex(2):25,00,48\\ ,00,4f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52d\"=hex(2):25,00,48,00,\\ 4f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52e\"=hex(2):\\25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52f\"=hex(2):\\ 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52g\"=hex(2):25,00,48,00,4\\f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52h\"=hex(2):25,00,48,00,4\\\n" - " f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52i\"=hex(2):25,00,50,00,\\,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine52j\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\\\n" - " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine52k\"=hex(2):,\\\n" - " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n" - "\"Wine52l\"=hex(2):\\\n" - " 25,00,48,00,4f,00,4d,00,45,00,25,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine52a"); - verify_reg_nonexist(hkey, "Wine52b"); - verify_reg_nonexist(hkey, "Wine52c"); - verify_reg_nonexist(hkey, "Wine52d"); - verify_reg_nonexist(hkey, "Wine52e"); - verify_reg_nonexist(hkey, "Wine52f"); - verify_reg_nonexist(hkey, "Wine52g"); - verify_reg_nonexist(hkey, "Wine52h"); - verify_reg_nonexist(hkey, "Wine52i"); - verify_reg_nonexist(hkey, "Wine52j"); - verify_reg_nonexist(hkey, "Wine52k"); - verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine53a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" - " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine53b\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n" - " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine53c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00, \\ ;comment\n" - " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine53d\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00 \\ ;comment\n" - " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine53e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\t ;comment\n" - " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine53f\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\t ;comment\n" - " 25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); - verify_reg_nonexist(hkey, "Wine53b"); - verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); - verify_reg_nonexist(hkey, "Wine53d"); - verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); - verify_reg_nonexist(hkey, "Wine53f"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine54a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine54a"); - verify_key_nonexist(hkey, "Subkey1"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine54b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine54b"); - verify_key(hkey, "Subkey2"); - - delete_key(hkey, "Subkey2"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine55a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - "\"Wine55b\"=\"Test value\"\n" - - "\"Wine55c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - ";comment\n" - "\"Wine55d\"=\"Test value\"\n" - - "\"Wine55e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - "#comment\n" - "\"Wine55f\"=\"Test value\"\n" - - "\"Wine55g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n" - "\"Wine55h\"=\"Test value\"\n" - - "\"Wine55i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" - "\"Wine55j\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine55a"); - verify_reg_nonexist(hkey, "Wine55b"); - verify_reg_nonexist(hkey, "Wine55c"); - verify_reg_nonexist(hkey, "Wine55d"); - verify_reg_nonexist(hkey, "Wine55e"); - verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0); - verify_reg_nonexist(hkey, "Wine55g"); - verify_reg_nonexist(hkey, "Wine55h"); - verify_reg_nonexist(hkey, "Wine55i"); - verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine56a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - "\"Wine56b\"=dword:00000008\n" - - "\"Wine56c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - ";comment\n" - "\"Wine56d\"=dword:00000008\n" - - "\"Wine56e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - "#comment\n" - "\"Wine56f\"=dword:00000008\n" - - "\"Wine56g\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n" - "\"Wine56h\"=dword:00000008\n" - - "\"Wine56i\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" - "\"Wine56j\"=dword:00000008\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine56a"); - verify_reg_nonexist(hkey, "Wine56b"); - verify_reg_nonexist(hkey, "Wine56c"); - verify_reg_nonexist(hkey, "Wine56d"); - verify_reg_nonexist(hkey, "Wine56e"); - verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg_nonexist(hkey, "Wine56g"); - verify_reg_nonexist(hkey, "Wine56h"); - verify_reg_nonexist(hkey, "Wine56i"); - verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine57a\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" - "\"Wine57b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - - "\"Wine57c\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" - ";comment\n" - "\"Wine57d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - - "\"Wine57e\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n" - "#comment\n" - "\"Wine57f\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - - "\"Wine57g\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,\\\n\n" - "\"Wine57h\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - - "\"Wine57i\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00\\\n" - "\"Wine57j\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine57a"); - verify_reg_nonexist(hkey, "Wine57b"); - verify_reg_nonexist(hkey, "Wine57c"); - verify_reg_nonexist(hkey, "Wine57d"); - verify_reg_nonexist(hkey, "Wine57e"); - verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg_nonexist(hkey, "Wine57g"); - verify_reg_nonexist(hkey, "Wine57h"); - verify_reg_nonexist(hkey, "Wine57i"); - verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0); - - delete_value(hkey, NULL); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58a\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - "@=\"Default value 1\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58a"); - verify_reg_nonexist(hkey, NULL); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58b\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - ";comment\n" - "@=\"Default value 2\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58b"); - verify_reg_nonexist(hkey, NULL); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58c\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n" - "#comment\n" - "@=\"Default value 3\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58c"); - verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0); - - delete_value(hkey, NULL); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58d\"=hex(2):4c,00,69,00,6e,00,65,00,20,00,\\\n\n" - "@=\"Default value 4\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58d"); - verify_reg_nonexist(hkey, NULL); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58e\"=hex(2):4c,00,69,00,6e,00,65,00,20,00\\\n" - "@=\"Default value 5\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58e"); - verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine59a\"=hex:11,22,33,\\\n" - "\\\n" - " 44,55,66\n" - "\"Wine59b\"=hex:11,22,33,\\\n" - " \\\n" - " 44,55,66\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine59a"); - verify_reg_nonexist(hkey, "Wine59b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" - ";comment\n" - " 65,00,6e,00,\\;comment\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" - " ;comment\n" - " 65,00,6e,00,\\;comment\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" - "#comment\n" - " 65,00,6e,00,\\;comment\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine60c"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" - " #comment\n" - " 65,00,6e,00,\\;comment\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine60d"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,\\\n\n" - " 63,00,61,00,74,00,\\\n\n\n" - " 65,00,6e,00,\\\n\n\n\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,\\\n \n" - " 63,00,61,00,74,00,\\\n\t\n\t\n" - " 65,00,6e,00,\\\n\t \t\n\t \t\n\t \t\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n" - " 25,50,41,54,48,25,00\n" - "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n" - " 25,50,41,54,48,25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine61a"); - verify_reg_nonexist(hkey, "Wine61b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62c\"=hex:11,22,33,44,55,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62d\"=hex(7):4c,00,69,00,6e,00,65,00,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62f\"=hex(7):4c,00,69,00,6e,00,65,00,20,00\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine62f"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine63a\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " ,63,00,6f,00,6e,00,\\\n" - " 63,00,61,00,74,00,\\\n" - " 65,00,6e,00,\\\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine63b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,,00,6f,00,6e,00,\\\n" - " 63,00,61,00,74,00,\\\n" - " 65,00,6e,00,\\\n" - " 61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine63a"); - verify_reg_nonexist(hkey, "Wine63b"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine64a\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n" - "\"Wine64b\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine64c\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\\\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine64d\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\;comment\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n" - "\"Wine64e\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n" - " 63,00,6f,00,6e,00,63,00,61,00,74,00,;comment\n" - " 65,00,6e,00,61,00,74,00,69,00,6f,00,6e,00,00,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0); - verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - /* Wine64d */ - size = sizeof(buffer); - err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); - ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); - ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); - /* Wine64e */ - size = sizeof(buffer); - err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); - ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); - ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n" - "\"Wine65b\"=hex(100):25,50,41,\\\n" - " 54,48,25,00\n" - "\"Wine65c\"=hex(100):25,50,41,\\;comment\n" - " 54,48,\\\n" - " 25,00\n" - "\"Wine65d\"=hex(100):25,50,41,\\;comment\n" - " 54,48,\n" - " 25,00\n" - "\"Wine65e\"=hex(100):25,50,41,\\;comment\n" - " 54,48,;comment\n" - " 25,00\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0); - verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0); - verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0); - verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0); - verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0); - - /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine66a\"=hex(7):4c,00,69,00,6e,00,65,00\n" - "\"Wine66b\"=hex(7):4c,00,69,00,6e,00,65,00,\n" - "\"Wine66c\"=hex(7):4c,00,69,00,6e,00,65,00,00,00\n" - "\"Wine66d\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,\n" - "\"Wine66e\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00\n" - "\"Wine66f\"=hex(7):4c,00,69,00,6e,00,65,00,00,00,00,00,\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0); - verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine67a\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00\n" - "\"Wine67b\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,\n" - "\"Wine67c\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00\n" - "\"Wine67d\"=hex(2):25,00,50,00,41,00,54,00,48,00,25,00,00,00,\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine68a\"=hex(1):\n" - "\"Wine68b\"=hex(2):\n" - "\"Wine68c\"=hex(3):\n" - "\"Wine68d\"=hex(4):\n" - "\"Wine68e\"=hex(7):\n" - "\"Wine68f\"=hex(100):\n" - "\"Wine68g\"=hex(abcd):\n" - "\"Wine68h\"=hex:\n" - "\"Wine68i\"=hex(0):\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0); - verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0); - verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0); - verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0); - verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0); - verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0); - verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0); - verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0); - verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0); - - /* Test with embedded null characters */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine69a\"=\"\\0\n" - "\"Wine69b\"=\"\\0\\0\n" - "\"Wine69c\"=\"Value1\\0\n" - "\"Wine69d\"=\"Value2\\0\\0\\0\\0\n" - "\"Wine69e\"=\"Value3\\0Value4\n" - "\"Wine69f\"=\"\\0Value5\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine69a"); - verify_reg_nonexist(hkey, "Wine69b"); - verify_reg_nonexist(hkey, "Wine69c"); - verify_reg_nonexist(hkey, "Wine69d"); - verify_reg_nonexist(hkey, "Wine69e"); - verify_reg_nonexist(hkey, "Wine69f"); - - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine70a\"=\"\\0\"\n" - "\"Wine70b\"=\"\\0\\0\"\n" - "\"Wine70c\"=\"Value1\\0\"\n" - "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n" - "\"Wine70e\"=\"Value3\\0Value4\"\n" - "\"Wine70f\"=\"\\0Value5\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, "Wine70a"); - todo_wine verify_reg_nonexist(hkey, "Wine70b"); - todo_wine verify_reg_nonexist(hkey, "Wine70c"); - todo_wine verify_reg_nonexist(hkey, "Wine70d"); - todo_wine verify_reg_nonexist(hkey, "Wine70e"); - todo_wine verify_reg_nonexist(hkey, "Wine70f"); - - /* Test forward and back slashes */ - test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"count/up\"=\"one/two/three\"\n" - "\"\\\\foo\\\\bar\"=\"\"\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); - verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); - verify_key(hkey, "
https://winehq.org
"); - - close_key(hkey); - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); -} - static void test_import_with_whitespace(void) { HKEY hkey; @@ -3039,7 +1491,6 @@ START_TEST(reg) } test_add(); - test_unicode_import(); test_import_with_whitespace(); test_unicode_import_with_whitespace(); test_import_31(); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index ca45d41d0c3..c2921b0ac3c 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: 58863f53316d2d88654d3a18c9481441dfabcb1a + wine: 2e33ab5559419655584716669505e7943613d3bb
2 years, 6 months
1
0
0
0
[reactos] 14/158: [WINESYNC] reg/tests: Split first sequence of 'import' tests from reg.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6498aac70cc4a1c0f7193…
commit 6498aac70cc4a1c0f7193f945f5b3af179afe5cc Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 20:03:14 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Split first sequence of 'import' tests from reg.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 58863f53316d2d88654d3a18c9481441dfabcb1a by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/import.c | 1636 +++++++++++++++++++++++++++++ modules/rostests/winetests/reg/reg.c | 1620 +--------------------------- modules/rostests/winetests/reg/reg_test.h | 16 + sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 1658 insertions(+), 1616 deletions(-) diff --git a/modules/rostests/winetests/reg/import.c b/modules/rostests/winetests/reg/import.c new file mode 100644 index 00000000000..8b9ce4d285e --- /dev/null +++ b/modules/rostests/winetests/reg/import.c @@ -0,0 +1,1636 @@ +/* + * Copyright 2016-2018, 2021 Hugh McMaster + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "reg_test.h" + +static BOOL write_file(const void *str, DWORD size) +{ + HANDLE file; + BOOL ret; + DWORD written; + + file = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError()); + if (file == INVALID_HANDLE_VALUE) + return FALSE; + + ret = WriteFile(file, str, size, &written, NULL); + ok(ret, "WriteFile failed: %u\n", GetLastError()); + CloseHandle(file); + + return ret; +} + +BOOL import_reg(unsigned line, const char *contents, BOOL unicode, DWORD *rc) +{ + int lenA; + BOOL ret; + + lenA = strlen(contents); + + if (unicode) + { + int len = MultiByteToWideChar(CP_UTF8, 0, contents, lenA, NULL, 0); + int size = len * sizeof(WCHAR); + WCHAR *wstr = HeapAlloc(GetProcessHeap(), 0, size); + if (!wstr) return FALSE; + MultiByteToWideChar(CP_UTF8, 0, contents, lenA, wstr, len); + + ret = write_file(wstr, size); + HeapFree(GetProcessHeap(), 0, wstr); + } + else + ret = write_file(contents, lenA); + + if (!ret) return FALSE; + + run_reg_exe("reg import test.reg", rc); + + ret = DeleteFileA("test.reg"); + lok(ret, "DeleteFile failed: %u\n", GetLastError()); + + return ret; +} + +/* Unit tests */ +static void test_import(void) +{ + DWORD r, dword = 0x123, type, size; + char buffer[24]; + HKEY hkey, subkey = NULL; + LONG err; + BYTE hex[8]; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + run_reg_exe("reg import", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg import /?", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import /h", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import -H", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg import missing.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg import a.reg b.reg", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* Test file contents */ + test_import_str("regedit\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_str("regedit4\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_str("REGEDIT", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("REGEDIT\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("REGEDIT4\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str(" REGEDIT4\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("\tREGEDIT4\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("\nREGEDIT4\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_str("AREGEDIT4\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_str("1REGEDIT4\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_str("REGEDIT3\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("REGEDIT5\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("REGEDIT9\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("REGEDIT 4\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("REGEDIT4 FOO\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("REGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey); + + test_import_str("REGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine\"=dword:00000123\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_str("REGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "@=\"Test string\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0); + + test_import_str("REGEDIT3\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test1\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test1"); + + test_import_str("regedit4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test2\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test2"); + + test_import_str("Regedit4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test3\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test3"); + + test_import_str("REGEDIT 4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test4\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test4"); + + test_import_str("REGEDIT4FOO\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test5\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test5"); + + test_import_str("REGEDIT4 FOO\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test6\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test6"); + + test_import_str("REGEDIT5\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test7\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test7"); + + test_import_str("REGEDIT9\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test8\"=\"Value\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test8"); + + test_import_str("Windows Registry Editor Version 4.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test9\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test9"); + + test_import_str("Windows Registry Editor Version 5\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test10\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test10"); + + test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test11\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test11"); + + test_import_str("Windows Registry Editor version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test12\"=\"Value\"\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + verify_reg_nonexist(hkey, "Test12"); + + test_import_str("REGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test1\"=\"Value1\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0); + + test_import_str("REGEDIT4\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test2\"=\"Value2\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Test2", REG_SZ, "Value2", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test3\"=\"Value3\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Test3", REG_SZ, "Value3", 7, 0); + + test_import_str("Windows Registry Editor Version 4.00\n", &r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, + "got exit code %d, expected 1\n", r); + + test_import_str("Windows Registry Editor Version 5.00\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + test_import_str("Windows Registry Editor Version 5.00\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test4\"=\"Value4\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Test4", REG_SZ, "Value4", 7, 0); + + test_import_str("Windows Registry Editor Version 5.00\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test5\"=\"Value5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Test5", REG_SZ, "Value5", 7, 0); + + test_import_str("Windows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test6\"=\"Value6\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Test6", REG_SZ, "Value6", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Line1\"=\"Value1\"\n\n" + "\"Line2\"=\"Value2\"\n\n\n" + "\"Line3\"=\"Value3\"\n\n\n\n" + "\"Line4\"=\"Value4\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0); + verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0); + verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0); + verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine1\"=dword:00000782\n\n" + "\"Wine2\"=\"Test Value\"\n" + "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "#comment\n" + "@=\"Test\"\n" + ";comment\n\n" + "\"Wine4\"=dword:12345678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x782; + verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "", REG_SZ, "Test", 5, 0); + dword = 0x12345678; + verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine5\"=\"No newline\"", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine6\"=dword:00000050\n\n" + "\"Wine7\"=\"No newline\"", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x50; + verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0); + err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "#comment\\\n" + "\"Wine8\"=\"Line 1\"\n" + ";comment\\\n" + "\"Wine9\"=\"Line 2\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0); + verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine10\"=\"Value 1\"#comment\n" + "\"Wine11\"=\"Value 2\";comment\n" + "\"Wine12\"=dword:01020304 #comment\n" + "\"Wine13\"=dword:02040608 ;comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine10"); + verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0); + verify_reg_nonexist(hkey, "Wine12"); + dword = 0x2040608; + verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine14\"=hex(7):4c,69,6e,65,20,\\\n" + " #comment\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine15\"=\"A valid line\"\n" + "\"Wine16\"=hex(7):4c,69,6e,65,20,\\\n" + " ;comment\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine17\"=\"Another valid line\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine14"); + verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0); + verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "#\"Comment1\"=\"Value 1\"\n" + ";\"Comment2\"=\"Value 2\"\n" + " #\"Comment3\"=\"Value 3\"\n" + " ;\"Comment4\"=\"Value 4\"\n" + "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n" + "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Comment1"); + verify_reg_nonexist(hkey, "Comment2"); + verify_reg_nonexist(hkey, "Comment3"); + verify_reg_nonexist(hkey, "Comment4"); + verify_reg_nonexist(hkey, "Wine18"); + verify_reg_nonexist(hkey, "Comment5"); + verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0); + verify_reg_nonexist(hkey, "Comment6"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine20\"=#\"Value 8\"\n" + "\"Wine21\"=;\"Value 9\"\n" + "\"Wine22\"=\"#comment1\"\n" + "\"Wine23\"=\";comment2\"\n" + "\"Wine24\"=\"Value#comment3\"\n" + "\"Wine25\"=\"Value;comment4\"\n" + "\"Wine26\"=\"Value #comment5\"\n" + "\"Wine27\"=\"Value ;comment6\"\n" + "\"Wine28\"=#dword:00000001\n" + "\"Wine29\"=;dword:00000002\n" + "\"Wine30\"=dword:00000003#comment\n" + "\"Wine31\"=dword:00000004;comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine20"); + verify_reg_nonexist(hkey, "Wine21"); + verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0); + verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0); + verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0); + verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0); + verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0); + verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0); + verify_reg_nonexist(hkey, "Wine28"); + verify_reg_nonexist(hkey, "Wine29"); + verify_reg_nonexist(hkey, "Wine30"); + dword = 0x00000004; + verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line1\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,\\;comment\n" + " 63,61,74,\\;comment\n" + " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line2\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,\\;comment\n" + " 63,61,74,;comment\n" + " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n" + ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line3"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n" + " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line4"); + + test_import_str("Windows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n" + ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line5"); + + test_import_str("Windows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n" + " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line6"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line7\"=hex(7):4c,69,6e,\\;comment\n" + " 65,20,\\;comment\n" + " 63,6f,6e,\\;comment\n" + " 63,61,74,\\;comment\n" + " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line8\"=hex(7):4c,69,6e,\\;#comment\n" + " 65,20,\\;#comment\n" + " 63,6f,6e,\\;#comment\n" + " 63,61,74,\\;#comment\n" + " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line9\"=hex(7):4c,69,6e,\\;comment\n" + " 65,20,\\;comment\n" + " 63,6f,6e,\\;comment\n" + " 63,61,74,\\#comment\n" + " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Multi-Line9"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Multi-Line10\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,\\;comment\n" + " 63,61,74,\\\n\n" + " 65,6e,\\;comment\n\n" + " 61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine32a\"=dword:1\n" + "\"Wine32b\"=dword:4444\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x1; + verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0); + dword = 0x4444; + verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine33a\"=dword:\n" + "\"Wine33b\"=dword:hello\n" + "\"Wine33c\"=dword:123456789\n" + "\"Wine33d\"=dword:012345678\n" + "\"Wine33e\"=dword:000000001\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine33a"); + verify_reg_nonexist(hkey, "Wine33b"); + verify_reg_nonexist(hkey, "Wine33c"); + verify_reg_nonexist(hkey, "Wine33d"); + verify_reg_nonexist(hkey, "Wine33e"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine34a\"=dword:12345678abc\n" + "\"Wine34b\"=dword:12345678 abc\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine34a"); + verify_reg_nonexist(hkey, "Wine34b"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine35a\"=dword:0x123\n" + "\"Wine35b\"=dword:123 456\n" + "\"Wine35c\"=dword:1234 5678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine35a"); + verify_reg_nonexist(hkey, "Wine35b"); + verify_reg_nonexist(hkey, "Wine35c"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine36a\"=dword:1234;5678\n" + "\"Wine36b\"=dword:1234 ;5678\n" + "\"Wine36c\"=dword:1234#5678\n" + "\"Wine36d\"=dword:1234 #5678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + dword = 0x1234; + verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg_nonexist(hkey, "Wine36c"); + verify_reg_nonexist(hkey, "Wine36d"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine37a\"=\"foo\"bar\"\n" + "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine37a"); + verify_reg_nonexist(hkey, "Wine37b"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Empty string\"=\"\"\n" + "\"\"=\"Default Value Name\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0); + verify_reg(hkey, NULL, REG_SZ, "Default Value Name", 19, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Test38a\"=\n" + "\"Test38b\"=\\\"\n" + "\"Test38c\"=\\\"Value\\\"\n" + "\"Test38d\"=\\\"Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Test38a"); + verify_reg_nonexist(hkey, "Test38b"); + verify_reg_nonexist(hkey, "Test38c"); + verify_reg_nonexist(hkey, "Test38d"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine39a\"=\"Value1\" ;comment\n" + "\"Wine39b\"=\"Value2\"\t\t;comment\n" + "\"Wine39c\"=\"Value3\" #comment\n" + "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0); + verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0); + verify_reg_nonexist(hkey, "Wine39c"); + verify_reg_nonexist(hkey, "Wine39d"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "TestNoBeginQuote"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"TestNoEndQuote\"=\"Asdffdsa\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "TestNoEndQuote"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"TestNoQuotes\"=Asdffdsa\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "TestNoQuotes"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "NameNoBeginQuote"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"NameNoEndQuote=\"Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "NameNoEndQuote"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "NameNoQuotes=\"Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "NameNoQuotes"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"MixedQuotes=Asdffdsa\"\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "MixedQuotes"); + verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine40a\"=hex(2):4c,69,6e,65,00\n" + "\"Wine40b\"=\"Value 1\"\n" + "\"Wine40c\"=hex(2):4c,69,6e,65\\\n" + "\"Wine40d\"=\"Value 2\"\n" + "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n" + "\"Wine40f\"=\"Value 3\"\n" + "\"Wine40g\"=\"Value 4\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0); + verify_reg_nonexist(hkey, "Wine40c"); + verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0); + verify_reg_nonexist(hkey, "Wine40e"); + verify_reg_nonexist(hkey, "Wine40f"); + verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine41a\"=dword:1234\\\n" + "5678\n" + "\"Wine41b\"=\"Test \\\n" + "Value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine41a"); + verify_reg_nonexist(hkey, "Wine41b"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n" + "\"single'quote\"=dword:00000008\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0); + dword = 0x00000008; + verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0); + + /* Test key name and value name concatenation */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n" + "Subkey1]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey1"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\n" + "\\Subkey2]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey2"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine\\\n" + "42a\"=\"Value 1\"\n" + "\"Wine42b\"=\"Value 2\"\n" + "\"Wine\n" + "\\42c\"=\"Value 3\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine42a"); + verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0); + verify_reg_nonexist(hkey, "Wine42c"); + + /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n" + "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n" + " 75,00,65,00,00,00\n" + "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n" + ",75,00,65,00,00,00\n" + "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n" + " ,75,00,65,00,00,00\n" + "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n" + " 75,00,65,00,00,00\n" + "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n" + "5,00,65,00,00,00\n" + "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n" + " 5,00,65,00,00,00\n" + "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,\\\n" + " 65,00,00,00\n" + "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,\n" + " 65,00,00,00\n" + "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,;comment\n" + " 65,00,00,00\n" + "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n" + " 6c,00,75,00,\\#comment\n" + " 65,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + verify_reg_nonexist(hkey, "Wine43c"); + verify_reg_nonexist(hkey, "Wine43d"); + verify_reg_nonexist(hkey, "Wine43e"); + verify_reg_nonexist(hkey, "Wine43f"); + verify_reg_nonexist(hkey, "Wine43g"); + verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0); + verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0); + verify_reg_nonexist(hkey, "Wine43k"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n" + "\"Wine44b\"=hex(2):25,50,41,\\\n" + " 54,48,25,00\n" + "\"Wine44c\"=hex(2):25,50,41\\\n" + ",54,48,25,00\n" + "\"Wine44d\"=hex(2):25,50,41\\\n" + " ,54,48,25,00\n" + "\"Wine44e\"=hex(2):25,50,41\\\n" + " 54,48,25,00\n" + "\"Wine44f\"=hex(2):25,50,4\\\n" + "1,54,48,25,00\n" + "\"Wine44g\"=hex(2):25,50,4\\\n" + " 1,54,48,25,00\n" + "\"Wine44h\"=hex(2):25,50,41,\\;comment\n" + " 54,48,\\\n" + " 25,00\n" + "\"Wine44i\"=hex(2):25,50,41,\\;comment\n" + " 54,48,\n" + " 25,00\n" + "\"Wine44j\"=hex(2):25,50,41,\\;comment\n" + " 54,48,;comment\n" + " 25,00\n" + "\"Wine44k\"=hex(2):25,50,41,\\;comment\n" + " 54,48,\\#comment\n" + " 25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg_nonexist(hkey, "Wine44c"); + verify_reg_nonexist(hkey, "Wine44d"); + verify_reg_nonexist(hkey, "Wine44e"); + verify_reg_nonexist(hkey, "Wine44f"); + verify_reg_nonexist(hkey, "Wine44g"); + verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0); + /* Wine44i */ + size = sizeof(buffer); + err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); + ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); + ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); + /* Wine44j */ + size = sizeof(buffer); + memset(buffer, '-', size); + err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); + ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); + ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); + /* Wine44k */ + verify_reg_nonexist(hkey, "Wine44k"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n" + "\"Wine45b\"=hex:11,22,33,44,\\\n" + " 55,66,77,88\n" + "\"Wine45c\"=hex:11,22,33,44\\\n" + ",55,66,77,88\n" + "\"Wine45d\"=hex:11,22,33,44\\\n" + " ,55,66,77,88\n" + "\"Wine45e\"=hex:11,22,33,44\\\n" + " 55,66,77,88\n" + "\"Wine45f\"=hex:11,22,33,4\\\n" + "4,55,66,77,88\n" + "\"Wine45g\"=hex:11,22,33,4\\\n" + " 4,55,66,77,88\n" + "\"Wine45h\"=hex:11,22,33,44,\\;comment\n" + " 55,66,\\\n" + " 77,88\n" + "\"Wine45i\"=hex:11,22,33,44,\\;comment\n" + " 55,66,\n" + " 77,88\n" + "\"Wine45j\"=hex:11,22,33,44,\\;comment\n" + " 55,66,;comment\n" + " 77,88\n" + "\"Wine45k\"=hex:11,22,33,\\;comment\n" + " 44,55,66,\\#comment\n" + " 77,88\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44; + hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88; + verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0); + verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0); + verify_reg_nonexist(hkey, "Wine45c"); + verify_reg_nonexist(hkey, "Wine45d"); + verify_reg_nonexist(hkey, "Wine45e"); + verify_reg_nonexist(hkey, "Wine45f"); + verify_reg_nonexist(hkey, "Wine45g"); + verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0); + verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0); + verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0); + verify_reg_nonexist(hkey, "Wine45k"); + + /* Test import with subkeys */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n" + "\"Wine\\\\31\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + open_key(hkey, "Subkey\"1", 0, &subkey); + verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n" + "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + open_key(hkey, "Subkey/2", 0, &subkey); + verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0); + close_key(subkey); + delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2"); + + /* Test key creation */ + test_import_str("REGEDIT4\n\n" + "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "No_Opening_Bracket"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "No_Closing_Bracket"); + + test_import_str("REGEDIT4\n\n" + "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey1a"); + + test_import_str("REGEDIT4\n\n" + "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey1b"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1c "); + delete_key(hkey, "Subkey1c "); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1d\t"); + delete_key(hkey, "Subkey1d\t"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n" + "\"Wine\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1e\\"); + verify_key(hkey, "Subkey1e"); + open_key(hkey, "Subkey1e", 0, &subkey); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(hkey, "Subkey1e"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n" + "\"Wine\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1f\\\\"); + verify_key(hkey, "Subkey1f\\"); + verify_key(hkey, "Subkey1f"); + open_key(hkey, "Subkey1f\\\\", 0, &subkey); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(hkey, "Subkey1f\\\\"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n" + "\"Wine\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey1g\\\\\\\\"); + verify_key(hkey, "Subkey1g\\\\"); + verify_key(hkey, "Subkey1g\\"); + verify_key(hkey, "Subkey1g"); + open_key(hkey, "Subkey1g\\\\", 0, &subkey); + verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); + close_key(subkey); + delete_key(hkey, "Subkey1g\\\\"); + + /* Test key deletion. We start by creating some registry keys. */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2a"); + verify_key(hkey, "Subkey2b"); + + test_import_str("REGEDIT4\n\n" + "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2a"); + + test_import_str("REGEDIT4\n\n" + "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2b"); + + test_import_str("REGEDIT4\n\n" + "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2a"); + + test_import_str("REGEDIT4\n\n" + "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey2b"); + + test_import_str("REGEDIT4\n\n" + "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" + "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey2a"); + verify_key_nonexist(hkey, "Subkey2b"); + + /* Test case sensitivity when creating and deleting registry keys. */ + test_import_str("REGEDIT4\n\n" + "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n" + "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey3a"); + verify_key(hkey, "Subkey3b"); + + test_import_str("REGEDIT4\n\n" + "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n" + "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey3a"); + verify_key_nonexist(hkey, "Subkey3b"); + + /* Test mixed key creation and deletion. We start by creating a subkey. */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "Subkey4a"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" + "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n" + "\"Wine46a\"=dword:12345678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey4a"); + verify_reg_nonexist(hkey, "Wine46a"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" + "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n" + "\"Wine46b\"=dword:12345678\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "Subkey4b"); + verify_reg_nonexist(hkey, "Wine46b"); + + /* Test value deletion. We start by creating some registry values. */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine46a\"=\"Test Value\"\n" + "\"Wine46b\"=dword:00000008\n" + "\"Wine46c\"=hex:11,22,33,44\n" + "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n" + "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0); + verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0); + verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine46a\"=-\n" + "\"Wine46b\"= -\n" + "\"Wine46c\"= \t-\t \n" + "\"Wine46d\"=-\"Test\"\n" + "\"Wine46e\"=- ;comment\n" + "\"Wine46f\"=- #comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine46a"); + verify_reg_nonexist(hkey, "Wine46b"); + verify_reg_nonexist(hkey, "Wine46c"); + verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg_nonexist(hkey, "Wine46e"); + verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); + + /* Test the accepted range of the hex-based data types */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n" + "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n" + "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n" + "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n" + "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n" + "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n" + "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n" + "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n" + "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n" + "\"Wine47j\"=hex(0x2):56,61,6c,75,65,00\n" + "\"Wine47k\"=hex(0X2):56,61,6c,75,65,00\n" + "\"Wine47l\"=hex(x2):56,61,6c,75,65,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0); + verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0); + verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0); + verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0); + verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0); + verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0); + verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0); + verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0); + verify_reg_nonexist(hkey, "Wine47i"); + verify_reg_nonexist(hkey, "Wine47j"); + verify_reg_nonexist(hkey, "Wine47k"); + verify_reg_nonexist(hkey, "Wine47l"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n" + "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n" + "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n" + "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg_nonexist(hkey, "Wine50c"); + verify_reg_nonexist(hkey, "Wine50d"); + + /* Test support for characters greater than 0xff */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n" + "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine51a"); + verify_reg_nonexist(hkey, "Wine51b"); + + /* Test the effect of backslashes in hex data */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n" + "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n" + "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n" + "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n" + "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n" + "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n" + "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n" + "\"Wine52h\"=hex(2):25,48,4\\\n" + " f,4d,45,25,00\n" + "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n" + "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n" + " 25,50,41,54,48,25,00\n" + "\"Wine52k\"=hex(2):,\\\n" + " 25,48,4f,4d,45,25,00\n" + "\"Wine52l\"=hex(2):\\\n" + " 25,48,4f,4d,45,25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine52a"); + verify_reg_nonexist(hkey, "Wine52b"); + verify_reg_nonexist(hkey, "Wine52c"); + verify_reg_nonexist(hkey, "Wine52d"); + verify_reg_nonexist(hkey, "Wine52e"); + verify_reg_nonexist(hkey, "Wine52f"); + verify_reg_nonexist(hkey, "Wine52g"); + verify_reg_nonexist(hkey, "Wine52h"); + verify_reg_nonexist(hkey, "Wine52i"); + verify_reg_nonexist(hkey, "Wine52j"); + verify_reg_nonexist(hkey, "Wine52k"); + verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine53a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" + " 25,50,41,54,48,25,00\n" + "\"Wine53b\"=hex(2):25,48,4f,4d,45,25,5c\\\n" + " 25,50,41,54,48,25,00\n" + "\"Wine53c\"=hex(2):25,48,4f,4d,45,25,5c, \\ ;comment\n" + " 25,50,41,54,48,25,00\n" + "\"Wine53d\"=hex(2):25,48,4f,4d,45,25,5c \\ ;comment\n" + " 25,50,41,54,48,25,00\n" + "\"Wine53e\"=hex(2):25,48,4f,4d,45,25,5c,\\\t ;comment\n" + " 25,50,41,54,48,25,00\n" + "\"Wine53f\"=hex(2):25,48,4f,4d,45,25,5c\\\t ;comment\n" + " 25,50,41,54,48,25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); + verify_reg_nonexist(hkey, "Wine53b"); + verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); + verify_reg_nonexist(hkey, "Wine53d"); + verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); + verify_reg_nonexist(hkey, "Wine53f"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine54a\"=hex(2):4c,69,6e,65,20,\\\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine54a"); + verify_key_nonexist(hkey, "Subkey1"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine54b\"=hex(2):4c,69,6e,65,20\\\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine54b"); + verify_key(hkey, "Subkey2"); + + delete_key(hkey, "Subkey2"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine55a\"=hex(2):4c,69,6e,65,20,\\\n" + "\"Wine55b\"=\"Test value\"\n" + + "\"Wine55c\"=hex(2):4c,69,6e,65,20,\\\n" + ";comment\n" + "\"Wine55d\"=\"Test value\"\n" + + "\"Wine55e\"=hex(2):4c,69,6e,65,20,\\\n" + "#comment\n" + "\"Wine55f\"=\"Test value\"\n" + + "\"Wine55g\"=hex(2):4c,69,6e,65,20,\\\n\n" + "\"Wine55h\"=\"Test value\"\n" + + "\"Wine55i\"=hex(2):4c,69,6e,65,20\\\n" + "\"Wine55j\"=\"Test value\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine55a"); + verify_reg_nonexist(hkey, "Wine55b"); + verify_reg_nonexist(hkey, "Wine55c"); + verify_reg_nonexist(hkey, "Wine55d"); + verify_reg_nonexist(hkey, "Wine55e"); + verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0); + verify_reg_nonexist(hkey, "Wine55g"); + verify_reg_nonexist(hkey, "Wine55h"); + verify_reg_nonexist(hkey, "Wine55i"); + verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine56a\"=hex(2):4c,69,6e,65,20,\\\n" + "\"Wine56b\"=dword:00000008\n" + + "\"Wine56c\"=hex(2):4c,69,6e,65,20,\\\n" + ";comment\n" + "\"Wine56d\"=dword:00000008\n" + + "\"Wine56e\"=hex(2):4c,69,6e,65,20,\\\n" + "#comment\n" + "\"Wine56f\"=dword:00000008\n" + + "\"Wine56g\"=hex(2):4c,69,6e,65,20,\\\n\n" + "\"Wine56h\"=dword:00000008\n" + + "\"Wine56i\"=hex(2):4c,69,6e,65,20\\\n" + "\"Wine56j\"=dword:00000008\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine56a"); + verify_reg_nonexist(hkey, "Wine56b"); + verify_reg_nonexist(hkey, "Wine56c"); + verify_reg_nonexist(hkey, "Wine56d"); + verify_reg_nonexist(hkey, "Wine56e"); + verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0); + verify_reg_nonexist(hkey, "Wine56g"); + verify_reg_nonexist(hkey, "Wine56h"); + verify_reg_nonexist(hkey, "Wine56i"); + verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine57a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" + "\"Wine57b\"=hex(2):25,50,41,54,48,25,00\n" + + "\"Wine57c\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" + ";comment\n" + "\"Wine57d\"=hex(2):25,50,41,54,48,25,00\n" + + "\"Wine57e\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" + "#comment\n" + "\"Wine57f\"=hex(2):25,50,41,54,48,25,00\n" + + "\"Wine57g\"=hex(2):25,48,4f,4d,45,25,5c,\\\n\n" + "\"Wine57h\"=hex(2):25,50,41,54,48,25,00\n" + + "\"Wine57i\"=hex(2):25,48,4f,4d,45,25,5c\\\n" + "\"Wine57j\"=hex(2):25,50,41,54,48,25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine57a"); + verify_reg_nonexist(hkey, "Wine57b"); + verify_reg_nonexist(hkey, "Wine57c"); + verify_reg_nonexist(hkey, "Wine57d"); + verify_reg_nonexist(hkey, "Wine57e"); + verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg_nonexist(hkey, "Wine57g"); + verify_reg_nonexist(hkey, "Wine57h"); + verify_reg_nonexist(hkey, "Wine57i"); + verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0); + + delete_value(hkey, NULL); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58a\"=hex(2):4c,69,6e,65,20,\\\n" + "@=\"Default value 1\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58a"); + verify_reg_nonexist(hkey, NULL); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58b\"=hex(2):4c,69,6e,65,20,\\\n" + ";comment\n" + "@=\"Default value 2\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58b"); + verify_reg_nonexist(hkey, NULL); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58c\"=hex(2):4c,69,6e,65,20,\\\n" + "#comment\n" + "@=\"Default value 3\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58c"); + verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0); + + delete_value(hkey, NULL); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58d\"=hex(2):4c,69,6e,65,20,\\\n\n" + "@=\"Default value 4\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58d"); + verify_reg_nonexist(hkey, NULL); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine58e\"=hex(2):4c,69,6e,65,20\\\n" + "@=\"Default value 5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine58e"); + verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine59a\"=hex:11,22,33,\\\n" + "\\\n" + " 44,55,66\n" + "\"Wine59b\"=hex:11,22,33,\\\n" + " \\\n" + " 44,55,66\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine59a"); + verify_reg_nonexist(hkey, "Wine59b"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60a\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,\\\n" + ";comment\n" + " 65,6e,\\;comment\n" + " 61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60b\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,\\\n" + " ;comment\n" + " 65,6e,\\;comment\n" + " 61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,\\\n" + "#comment\n" + " 65,6e,\\;comment\n" + " 61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine60c"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60d\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,\\\n" + " #comment\n" + " 65,6e,\\;comment\n" + " 61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine60d"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60e\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,\\\n\n" + " 63,61,74,\\\n\n\n" + " 65,6e,\\\n\n\n\n" + " 61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine60f\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,\\\n \n" + " 63,61,74,\\\n\t\n\t\n" + " 65,6e,\\\n\t \t\n\t \t\n\t \t\n" + " 61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n" + " 25,50,41,54,48,25,00\n" + "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n" + " 25,50,41,54,48,25,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine61a"); + verify_reg_nonexist(hkey, "Wine61b"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62b\"=hex(2):25,50,41,54,48,25,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62c\"=hex:11,22,33,44,55,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62d\"=hex(7):4c,69,6e,65,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL); + ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, + "got exit code %d, expected 0\n", err); + if (err == ERROR_SUCCESS) + verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine62f\"=hex(7):4c,69,6e,65,20\\", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine62f"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine63a\"=hex(7):4c,69,6e,65,20,\\\n" + " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine63b\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine63a"); + verify_reg_nonexist(hkey, "Wine63b"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine64a\"=hex(7):4c,69,6e,65,00,00\n" + "\"Wine64b\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine64c\"=hex(7):4c,69,6e,65,20,\\;comment\n" + " 63,6f,6e,63,61,74,\\\n" + " 65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine64d\"=hex(7):4c,69,6e,65,20,\\;comment\n" + " 63,6f,6e,63,61,74,\n" + " 65,6e,61,74,69,6f,6e,00,00\n" + "\"Wine64e\"=hex(7):4c,69,6e,65,20,\\\n" + " 63,6f,6e,63,61,74,;comment\n" + " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0); + verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + /* Wine64d */ + size = sizeof(buffer); + err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); + ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); + ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); + /* Wine64e */ + size = sizeof(buffer); + err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size); + ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); + ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); + ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); + ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n" + "\"Wine65b\"=hex(100):25,50,41,\\\n" + " 54,48,25,00\n" + "\"Wine65c\"=hex(100):25,50,41,\\;comment\n" + " 54,48,\\\n" + " 25,00\n" + "\"Wine65d\"=hex(100):25,50,41,\\;comment\n" + " 54,48,\n" + " 25,00\n" + "\"Wine65e\"=hex(100):25,50,41,\\;comment\n" + " 54,48,;comment\n" + " 25,00\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0); + verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0); + verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0); + verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0); + verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0); + + /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine66a\"=hex(7):4c,69,6e,65\n" + "\"Wine66b\"=hex(7):4c,69,6e,65,\n" + "\"Wine66c\"=hex(7):4c,69,6e,65,00\n" + "\"Wine66d\"=hex(7):4c,69,6e,65,00,\n" + "\"Wine66e\"=hex(7):4c,69,6e,65,00,00\n" + "\"Wine66f\"=hex(7):4c,69,6e,65,00,00,\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0); + verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0); + verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine67a\"=hex(2):25,50,41,54,48,25\n" + "\"Wine67b\"=hex(2):25,50,41,54,48,25,\n" + "\"Wine67c\"=hex(2):25,50,41,54,48,25,00\n" + "\"Wine67d\"=hex(2):25,50,41,54,48,25,00,\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0); + verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine68a\"=hex(1):\n" + "\"Wine68b\"=hex(2):\n" + "\"Wine68c\"=hex(3):\n" + "\"Wine68d\"=hex(4):\n" + "\"Wine68e\"=hex(7):\n" + "\"Wine68f\"=hex(100):\n" + "\"Wine68g\"=hex(abcd):\n" + "\"Wine68h\"=hex:\n" + "\"Wine68i\"=hex(0):\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0); + verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0); + verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0); + verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0); + verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0); + verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0); + verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0); + verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0); + verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0); + + /* Test with embedded null characters */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine69a\"=\"\\0\n" + "\"Wine69b\"=\"\\0\\0\n" + "\"Wine69c\"=\"Value1\\0\n" + "\"Wine69d\"=\"Value2\\0\\0\\0\\0\n" + "\"Wine69e\"=\"Value3\\0Value4\n" + "\"Wine69f\"=\"\\0Value5\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "Wine69a"); + verify_reg_nonexist(hkey, "Wine69b"); + verify_reg_nonexist(hkey, "Wine69c"); + verify_reg_nonexist(hkey, "Wine69d"); + verify_reg_nonexist(hkey, "Wine69e"); + verify_reg_nonexist(hkey, "Wine69f"); + + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine70a\"=\"\\0\"\n" + "\"Wine70b\"=\"\\0\\0\"\n" + "\"Wine70c\"=\"Value1\\0\"\n" + "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n" + "\"Wine70e\"=\"Value3\\0Value4\"\n" + "\"Wine70f\"=\"\\0Value5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine70a"); + todo_wine verify_reg_nonexist(hkey, "Wine70b"); + todo_wine verify_reg_nonexist(hkey, "Wine70c"); + todo_wine verify_reg_nonexist(hkey, "Wine70d"); + todo_wine verify_reg_nonexist(hkey, "Wine70e"); + todo_wine verify_reg_nonexist(hkey, "Wine70f"); + + /* Test forward and back slashes */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"count/up\"=\"one/two/three\"\n" + "\"\\\\foo\\\\bar\"=\"\"\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); + verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); + verify_key(hkey, "
https://winehq.org
"); + + close_key(hkey); + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); +} + + +START_TEST(import) +{ + DWORD r; + + if (!run_reg_exe("reg.exe /?", &r)) { + win_skip("reg.exe not available, skipping 'query' tests\n"); + return; + } + + test_import(); +} diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 11dea0d0e28..407af68c769 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -18,7 +18,6 @@ #include "reg_test.h" -#define lok ok_(__FILE__,line) #define TODO_REG_TYPE (0x0001u) #define TODO_REG_SIZE (0x0002u) #define TODO_REG_DATA (0x0004u) @@ -53,9 +52,8 @@ BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc) return bret; } -#define verify_reg(k,v,t,d,s,todo) verify_reg_(__LINE__,k,v,t,d,s,todo) -static void verify_reg_(unsigned line, HKEY hkey, const char* value, - DWORD exp_type, const void *exp_data, DWORD exp_size, DWORD todo) +void verify_reg_(unsigned line, HKEY hkey, const char* value, DWORD exp_type, + const void *exp_data, DWORD exp_size, DWORD todo) { DWORD type, size; BYTE data[256]; @@ -88,8 +86,7 @@ void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value) (value && *value) ? value : "(Default)", err); } -#define open_key(b,p,s,k) open_key_(__LINE__,b,p,s,k) -static void open_key_(unsigned line, const HKEY base, const char *path, const DWORD sam, HKEY *hkey) +void open_key_(unsigned line, const HKEY base, const char *path, const DWORD sam, HKEY *hkey) { LONG err; @@ -200,8 +197,7 @@ void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const vo lok(err == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", err); } -#define delete_value(k,n) delete_value_(__LINE__,k,n) -static void delete_value_(unsigned line, const HKEY hkey, const char *name) +void delete_value_(unsigned line, const HKEY hkey, const char *name) { LONG err; @@ -209,6 +205,7 @@ static void delete_value_(unsigned line, const HKEY hkey, const char *name) lok(err == ERROR_SUCCESS, "RegDeleteValueA failed: %d\n", err); } +/* Unit tests */ static void test_add(void) { HKEY hkey; @@ -616,1612 +613,6 @@ static void test_add(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } -static BOOL write_file(const void *str, DWORD size) -{ - HANDLE file; - BOOL ret; - DWORD written; - - file = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); - ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError()); - if (file == INVALID_HANDLE_VALUE) - return FALSE; - - ret = WriteFile(file, str, size, &written, NULL); - ok(ret, "WriteFile failed: %u\n", GetLastError()); - CloseHandle(file); - - return ret; -} - -#define test_import_str(c,r) import_reg(__LINE__,c,FALSE,r) -#define test_import_wstr(c,r) import_reg(__LINE__,c,TRUE,r) - -static BOOL import_reg(unsigned line, const char *contents, BOOL unicode, DWORD *rc) -{ - int lenA; - BOOL ret; - - lenA = strlen(contents); - - if (unicode) - { - int len = MultiByteToWideChar(CP_UTF8, 0, contents, lenA, NULL, 0); - int size = len * sizeof(WCHAR); - WCHAR *wstr = HeapAlloc(GetProcessHeap(), 0, size); - if (!wstr) return FALSE; - MultiByteToWideChar(CP_UTF8, 0, contents, lenA, wstr, len); - - ret = write_file(wstr, size); - HeapFree(GetProcessHeap(), 0, wstr); - } - else - ret = write_file(contents, lenA); - - if (!ret) return FALSE; - - run_reg_exe("reg import test.reg", rc); - - ret = DeleteFileA("test.reg"); - lok(ret, "DeleteFile failed: %u\n", GetLastError()); - - return ret; -} - -static void test_import(void) -{ - DWORD r, dword = 0x123, type, size; - char buffer[24]; - HKEY hkey, subkey = NULL; - LONG err; - BYTE hex[8]; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - run_reg_exe("reg import", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg import /?", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg import /h", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg import -H", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg import missing.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg import a.reg b.reg", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - /* Test file contents */ - test_import_str("regedit\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_str("regedit4\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_str("REGEDIT", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("REGEDIT\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("REGEDIT4\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str(" REGEDIT4\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("\tREGEDIT4\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("\nREGEDIT4\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_str("AREGEDIT4\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_str("1REGEDIT4\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_str("REGEDIT3\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("REGEDIT5\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("REGEDIT9\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("REGEDIT 4\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("REGEDIT4 FOO\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("REGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - open_key(HKEY_CURRENT_USER, KEY_BASE, KEY_SET_VALUE, &hkey); - - test_import_str("REGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine\"=dword:00000123\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_str("REGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "@=\"Test string\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0); - - test_import_str("REGEDIT3\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test1\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test1"); - - test_import_str("regedit4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test2\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test2"); - - test_import_str("Regedit4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test3\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test3"); - - test_import_str("REGEDIT 4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test4\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test4"); - - test_import_str("REGEDIT4FOO\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test5\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test5"); - - test_import_str("REGEDIT4 FOO\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test6\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test6"); - - test_import_str("REGEDIT5\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test7\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test7"); - - test_import_str("REGEDIT9\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test8\"=\"Value\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test8"); - - test_import_str("Windows Registry Editor Version 4.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test9\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test9"); - - test_import_str("Windows Registry Editor Version 5\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test10\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test10"); - - test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test11\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test11"); - - test_import_str("Windows Registry Editor version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test12\"=\"Value\"\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - verify_reg_nonexist(hkey, "Test12"); - - test_import_str("REGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test1\"=\"Value1\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0); - - test_import_str("REGEDIT4\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test2\"=\"Value2\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Test2", REG_SZ, "Value2", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test3\"=\"Value3\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Test3", REG_SZ, "Value3", 7, 0); - - test_import_str("Windows Registry Editor Version 4.00\n", &r); - ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */, - "got exit code %d, expected 1\n", r); - - test_import_str("Windows Registry Editor Version 5.00\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - test_import_str("Windows Registry Editor Version 5.00\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test4\"=\"Value4\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Test4", REG_SZ, "Value4", 7, 0); - - test_import_str("Windows Registry Editor Version 5.00\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test5\"=\"Value5\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Test5", REG_SZ, "Value5", 7, 0); - - test_import_str("Windows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test6\"=\"Value6\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Test6", REG_SZ, "Value6", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Line1\"=\"Value1\"\n\n" - "\"Line2\"=\"Value2\"\n\n\n" - "\"Line3\"=\"Value3\"\n\n\n\n" - "\"Line4\"=\"Value4\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0); - verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0); - verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0); - verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine1\"=dword:00000782\n\n" - "\"Wine2\"=\"Test Value\"\n" - "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" - "#comment\n" - "@=\"Test\"\n" - ";comment\n\n" - "\"Wine4\"=dword:12345678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x782; - verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0); - verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "", REG_SZ, "Test", 5, 0); - dword = 0x12345678; - verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine5\"=\"No newline\"", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), - "got %d, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine6\"=dword:00000050\n\n" - "\"Wine7\"=\"No newline\"", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x50; - verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0); - err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */), - "got %d, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "#comment\\\n" - "\"Wine8\"=\"Line 1\"\n" - ";comment\\\n" - "\"Wine9\"=\"Line 2\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0); - verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine10\"=\"Value 1\"#comment\n" - "\"Wine11\"=\"Value 2\";comment\n" - "\"Wine12\"=dword:01020304 #comment\n" - "\"Wine13\"=dword:02040608 ;comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine10"); - verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0); - verify_reg_nonexist(hkey, "Wine12"); - dword = 0x2040608; - verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine14\"=hex(7):4c,69,6e,65,20,\\\n" - " #comment\n" - " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine15\"=\"A valid line\"\n" - "\"Wine16\"=hex(7):4c,69,6e,65,20,\\\n" - " ;comment\n" - " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine17\"=\"Another valid line\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine14"); - verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0); - verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "#\"Comment1\"=\"Value 1\"\n" - ";\"Comment2\"=\"Value 2\"\n" - " #\"Comment3\"=\"Value 3\"\n" - " ;\"Comment4\"=\"Value 4\"\n" - "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n" - "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Comment1"); - verify_reg_nonexist(hkey, "Comment2"); - verify_reg_nonexist(hkey, "Comment3"); - verify_reg_nonexist(hkey, "Comment4"); - verify_reg_nonexist(hkey, "Wine18"); - verify_reg_nonexist(hkey, "Comment5"); - verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0); - verify_reg_nonexist(hkey, "Comment6"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine20\"=#\"Value 8\"\n" - "\"Wine21\"=;\"Value 9\"\n" - "\"Wine22\"=\"#comment1\"\n" - "\"Wine23\"=\";comment2\"\n" - "\"Wine24\"=\"Value#comment3\"\n" - "\"Wine25\"=\"Value;comment4\"\n" - "\"Wine26\"=\"Value #comment5\"\n" - "\"Wine27\"=\"Value ;comment6\"\n" - "\"Wine28\"=#dword:00000001\n" - "\"Wine29\"=;dword:00000002\n" - "\"Wine30\"=dword:00000003#comment\n" - "\"Wine31\"=dword:00000004;comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine20"); - verify_reg_nonexist(hkey, "Wine21"); - verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0); - verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0); - verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0); - verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0); - verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0); - verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0); - verify_reg_nonexist(hkey, "Wine28"); - verify_reg_nonexist(hkey, "Wine29"); - verify_reg_nonexist(hkey, "Wine30"); - dword = 0x00000004; - verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line1\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,\\;comment\n" - " 63,61,74,\\;comment\n" - " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line2\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,\\;comment\n" - " 63,61,74,;comment\n" - " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n" - ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line3"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n" - " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line4"); - - test_import_str("Windows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n" - ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line5"); - - test_import_str("Windows Registry Editor Version 5.00\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n" - " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line6"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line7\"=hex(7):4c,69,6e,\\;comment\n" - " 65,20,\\;comment\n" - " 63,6f,6e,\\;comment\n" - " 63,61,74,\\;comment\n" - " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line8\"=hex(7):4c,69,6e,\\;#comment\n" - " 65,20,\\;#comment\n" - " 63,6f,6e,\\;#comment\n" - " 63,61,74,\\;#comment\n" - " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line9\"=hex(7):4c,69,6e,\\;comment\n" - " 65,20,\\;comment\n" - " 63,6f,6e,\\;comment\n" - " 63,61,74,\\#comment\n" - " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Multi-Line9"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Multi-Line10\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,\\;comment\n" - " 63,61,74,\\\n\n" - " 65,6e,\\;comment\n\n" - " 61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine32a\"=dword:1\n" - "\"Wine32b\"=dword:4444\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x1; - verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0); - dword = 0x4444; - verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine33a\"=dword:\n" - "\"Wine33b\"=dword:hello\n" - "\"Wine33c\"=dword:123456789\n" - "\"Wine33d\"=dword:012345678\n" - "\"Wine33e\"=dword:000000001\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine33a"); - verify_reg_nonexist(hkey, "Wine33b"); - verify_reg_nonexist(hkey, "Wine33c"); - verify_reg_nonexist(hkey, "Wine33d"); - verify_reg_nonexist(hkey, "Wine33e"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine34a\"=dword:12345678abc\n" - "\"Wine34b\"=dword:12345678 abc\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine34a"); - verify_reg_nonexist(hkey, "Wine34b"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine35a\"=dword:0x123\n" - "\"Wine35b\"=dword:123 456\n" - "\"Wine35c\"=dword:1234 5678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine35a"); - verify_reg_nonexist(hkey, "Wine35b"); - verify_reg_nonexist(hkey, "Wine35c"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine36a\"=dword:1234;5678\n" - "\"Wine36b\"=dword:1234 ;5678\n" - "\"Wine36c\"=dword:1234#5678\n" - "\"Wine36d\"=dword:1234 #5678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - dword = 0x1234; - verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg_nonexist(hkey, "Wine36c"); - verify_reg_nonexist(hkey, "Wine36d"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine37a\"=\"foo\"bar\"\n" - "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine37a"); - verify_reg_nonexist(hkey, "Wine37b"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Empty string\"=\"\"\n" - "\"\"=\"Default Value Name\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0); - verify_reg(hkey, NULL, REG_SZ, "Default Value Name", 19, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Test38a\"=\n" - "\"Test38b\"=\\\"\n" - "\"Test38c\"=\\\"Value\\\"\n" - "\"Test38d\"=\\\"Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Test38a"); - verify_reg_nonexist(hkey, "Test38b"); - verify_reg_nonexist(hkey, "Test38c"); - verify_reg_nonexist(hkey, "Test38d"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine39a\"=\"Value1\" ;comment\n" - "\"Wine39b\"=\"Value2\"\t\t;comment\n" - "\"Wine39c\"=\"Value3\" #comment\n" - "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0); - verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0); - verify_reg_nonexist(hkey, "Wine39c"); - verify_reg_nonexist(hkey, "Wine39d"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "TestNoBeginQuote"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"TestNoEndQuote\"=\"Asdffdsa\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "TestNoEndQuote"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"TestNoQuotes\"=Asdffdsa\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "TestNoQuotes"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "NameNoBeginQuote"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"NameNoEndQuote=\"Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "NameNoEndQuote"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "NameNoQuotes=\"Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "NameNoQuotes"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"MixedQuotes=Asdffdsa\"\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "MixedQuotes"); - verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine40a\"=hex(2):4c,69,6e,65,00\n" - "\"Wine40b\"=\"Value 1\"\n" - "\"Wine40c\"=hex(2):4c,69,6e,65\\\n" - "\"Wine40d\"=\"Value 2\"\n" - "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n" - "\"Wine40f\"=\"Value 3\"\n" - "\"Wine40g\"=\"Value 4\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0); - verify_reg_nonexist(hkey, "Wine40c"); - verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0); - verify_reg_nonexist(hkey, "Wine40e"); - verify_reg_nonexist(hkey, "Wine40f"); - verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine41a\"=dword:1234\\\n" - "5678\n" - "\"Wine41b\"=\"Test \\\n" - "Value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine41a"); - verify_reg_nonexist(hkey, "Wine41b"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n" - "\"single'quote\"=dword:00000008\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0); - dword = 0x00000008; - verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0); - - /* Test key name and value name concatenation */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n" - "Subkey1]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\n" - "\\Subkey2]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine\\\n" - "42a\"=\"Value 1\"\n" - "\"Wine42b\"=\"Value 2\"\n" - "\"Wine\n" - "\\42c\"=\"Value 3\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine42a"); - verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0); - verify_reg_nonexist(hkey, "Wine42c"); - - /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n" - "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n" - " 75,00,65,00,00,00\n" - "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n" - ",75,00,65,00,00,00\n" - "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n" - " ,75,00,65,00,00,00\n" - "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n" - " 75,00,65,00,00,00\n" - "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n" - "5,00,65,00,00,00\n" - "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n" - " 5,00,65,00,00,00\n" - "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,\\\n" - " 65,00,00,00\n" - "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,\n" - " 65,00,00,00\n" - "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,;comment\n" - " 65,00,00,00\n" - "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n" - " 6c,00,75,00,\\#comment\n" - " 65,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - verify_reg_nonexist(hkey, "Wine43c"); - verify_reg_nonexist(hkey, "Wine43d"); - verify_reg_nonexist(hkey, "Wine43e"); - verify_reg_nonexist(hkey, "Wine43f"); - verify_reg_nonexist(hkey, "Wine43g"); - verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0); - verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0); - verify_reg_nonexist(hkey, "Wine43k"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n" - "\"Wine44b\"=hex(2):25,50,41,\\\n" - " 54,48,25,00\n" - "\"Wine44c\"=hex(2):25,50,41\\\n" - ",54,48,25,00\n" - "\"Wine44d\"=hex(2):25,50,41\\\n" - " ,54,48,25,00\n" - "\"Wine44e\"=hex(2):25,50,41\\\n" - " 54,48,25,00\n" - "\"Wine44f\"=hex(2):25,50,4\\\n" - "1,54,48,25,00\n" - "\"Wine44g\"=hex(2):25,50,4\\\n" - " 1,54,48,25,00\n" - "\"Wine44h\"=hex(2):25,50,41,\\;comment\n" - " 54,48,\\\n" - " 25,00\n" - "\"Wine44i\"=hex(2):25,50,41,\\;comment\n" - " 54,48,\n" - " 25,00\n" - "\"Wine44j\"=hex(2):25,50,41,\\;comment\n" - " 54,48,;comment\n" - " 25,00\n" - "\"Wine44k\"=hex(2):25,50,41,\\;comment\n" - " 54,48,\\#comment\n" - " 25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg_nonexist(hkey, "Wine44c"); - verify_reg_nonexist(hkey, "Wine44d"); - verify_reg_nonexist(hkey, "Wine44e"); - verify_reg_nonexist(hkey, "Wine44f"); - verify_reg_nonexist(hkey, "Wine44g"); - verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0); - /* Wine44i */ - size = sizeof(buffer); - err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); - ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); - ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); - /* Wine44j */ - size = sizeof(buffer); - memset(buffer, '-', size); - err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ); - ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size); - ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n"); - /* Wine44k */ - verify_reg_nonexist(hkey, "Wine44k"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n" - "\"Wine45b\"=hex:11,22,33,44,\\\n" - " 55,66,77,88\n" - "\"Wine45c\"=hex:11,22,33,44\\\n" - ",55,66,77,88\n" - "\"Wine45d\"=hex:11,22,33,44\\\n" - " ,55,66,77,88\n" - "\"Wine45e\"=hex:11,22,33,44\\\n" - " 55,66,77,88\n" - "\"Wine45f\"=hex:11,22,33,4\\\n" - "4,55,66,77,88\n" - "\"Wine45g\"=hex:11,22,33,4\\\n" - " 4,55,66,77,88\n" - "\"Wine45h\"=hex:11,22,33,44,\\;comment\n" - " 55,66,\\\n" - " 77,88\n" - "\"Wine45i\"=hex:11,22,33,44,\\;comment\n" - " 55,66,\n" - " 77,88\n" - "\"Wine45j\"=hex:11,22,33,44,\\;comment\n" - " 55,66,;comment\n" - " 77,88\n" - "\"Wine45k\"=hex:11,22,33,\\;comment\n" - " 44,55,66,\\#comment\n" - " 77,88\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44; - hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88; - verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0); - verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0); - verify_reg_nonexist(hkey, "Wine45c"); - verify_reg_nonexist(hkey, "Wine45d"); - verify_reg_nonexist(hkey, "Wine45e"); - verify_reg_nonexist(hkey, "Wine45f"); - verify_reg_nonexist(hkey, "Wine45g"); - verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0); - verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0); - verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0); - verify_reg_nonexist(hkey, "Wine45k"); - - /* Test import with subkeys */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n" - "\"Wine\\\\31\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - open_key(hkey, "Subkey\"1", 0, &subkey); - verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n" - "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - open_key(hkey, "Subkey/2", 0, &subkey); - verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0); - close_key(subkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2"); - - /* Test key creation */ - test_import_str("REGEDIT4\n\n" - "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Opening_Bracket"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "No_Closing_Bracket"); - - test_import_str("REGEDIT4\n\n" - "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1a"); - - test_import_str("REGEDIT4\n\n" - "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey1b"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1c "); - delete_key(hkey, "Subkey1c "); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1d\t"); - delete_key(hkey, "Subkey1d\t"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n" - "\"Wine\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1e\\"); - verify_key(hkey, "Subkey1e"); - open_key(hkey, "Subkey1e", 0, &subkey); - verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(hkey, "Subkey1e"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n" - "\"Wine\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1f\\\\"); - verify_key(hkey, "Subkey1f\\"); - verify_key(hkey, "Subkey1f"); - open_key(hkey, "Subkey1f\\\\", 0, &subkey); - verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(hkey, "Subkey1f\\\\"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n" - "\"Wine\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey1g\\\\\\\\"); - verify_key(hkey, "Subkey1g\\\\"); - verify_key(hkey, "Subkey1g\\"); - verify_key(hkey, "Subkey1g"); - open_key(hkey, "Subkey1g\\\\", 0, &subkey); - verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - close_key(subkey); - delete_key(hkey, "Subkey1g\\\\"); - - /* Test key deletion. We start by creating some registry keys. */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - verify_key(hkey, "Subkey2b"); - - test_import_str("REGEDIT4\n\n" - "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - - test_import_str("REGEDIT4\n\n" - "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); - - test_import_str("REGEDIT4\n\n" - "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2a"); - - test_import_str("REGEDIT4\n\n" - "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey2b"); - - test_import_str("REGEDIT4\n\n" - "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n" - "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey2a"); - verify_key_nonexist(hkey, "Subkey2b"); - - /* Test case sensitivity when creating and deleting registry keys. */ - test_import_str("REGEDIT4\n\n" - "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n" - "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey3a"); - verify_key(hkey, "Subkey3b"); - - test_import_str("REGEDIT4\n\n" - "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n" - "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey3a"); - verify_key_nonexist(hkey, "Subkey3b"); - - /* Test mixed key creation and deletion. We start by creating a subkey. */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key(hkey, "Subkey4a"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" - "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n" - "\"Wine46a\"=dword:12345678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4a"); - verify_reg_nonexist(hkey, "Wine46a"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n" - "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n" - "\"Wine46b\"=dword:12345678\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "Subkey4b"); - verify_reg_nonexist(hkey, "Wine46b"); - - /* Test value deletion. We start by creating some registry values. */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine46a\"=\"Test Value\"\n" - "\"Wine46b\"=dword:00000008\n" - "\"Wine46c\"=hex:11,22,33,44\n" - "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n" - "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0); - verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0); - verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine46a\"=-\n" - "\"Wine46b\"= -\n" - "\"Wine46c\"= \t-\t \n" - "\"Wine46d\"=-\"Test\"\n" - "\"Wine46e\"=- ;comment\n" - "\"Wine46f\"=- #comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine46a"); - verify_reg_nonexist(hkey, "Wine46b"); - verify_reg_nonexist(hkey, "Wine46c"); - verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg_nonexist(hkey, "Wine46e"); - verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0); - - /* Test the accepted range of the hex-based data types */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n" - "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n" - "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n" - "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n" - "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n" - "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n" - "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n" - "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n" - "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n" - "\"Wine47j\"=hex(0x2):56,61,6c,75,65,00\n" - "\"Wine47k\"=hex(0X2):56,61,6c,75,65,00\n" - "\"Wine47l\"=hex(x2):56,61,6c,75,65,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0); - verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0); - verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0); - verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0); - verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0); - verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0); - verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0); - verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0); - verify_reg_nonexist(hkey, "Wine47i"); - verify_reg_nonexist(hkey, "Wine47j"); - verify_reg_nonexist(hkey, "Wine47k"); - verify_reg_nonexist(hkey, "Wine47l"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n" - " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n" - " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n" - "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n" - "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n" - "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg_nonexist(hkey, "Wine50c"); - verify_reg_nonexist(hkey, "Wine50d"); - - /* Test support for characters greater than 0xff */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n" - "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine51a"); - verify_reg_nonexist(hkey, "Wine51b"); - - /* Test the effect of backslashes in hex data */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n" - "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n" - "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n" - "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n" - "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n" - "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n" - "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n" - "\"Wine52h\"=hex(2):25,48,4\\\n" - " f,4d,45,25,00\n" - "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n" - "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n" - " 25,50,41,54,48,25,00\n" - "\"Wine52k\"=hex(2):,\\\n" - " 25,48,4f,4d,45,25,00\n" - "\"Wine52l\"=hex(2):\\\n" - " 25,48,4f,4d,45,25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine52a"); - verify_reg_nonexist(hkey, "Wine52b"); - verify_reg_nonexist(hkey, "Wine52c"); - verify_reg_nonexist(hkey, "Wine52d"); - verify_reg_nonexist(hkey, "Wine52e"); - verify_reg_nonexist(hkey, "Wine52f"); - verify_reg_nonexist(hkey, "Wine52g"); - verify_reg_nonexist(hkey, "Wine52h"); - verify_reg_nonexist(hkey, "Wine52i"); - verify_reg_nonexist(hkey, "Wine52j"); - verify_reg_nonexist(hkey, "Wine52k"); - verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine53a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" - " 25,50,41,54,48,25,00\n" - "\"Wine53b\"=hex(2):25,48,4f,4d,45,25,5c\\\n" - " 25,50,41,54,48,25,00\n" - "\"Wine53c\"=hex(2):25,48,4f,4d,45,25,5c, \\ ;comment\n" - " 25,50,41,54,48,25,00\n" - "\"Wine53d\"=hex(2):25,48,4f,4d,45,25,5c \\ ;comment\n" - " 25,50,41,54,48,25,00\n" - "\"Wine53e\"=hex(2):25,48,4f,4d,45,25,5c,\\\t ;comment\n" - " 25,50,41,54,48,25,00\n" - "\"Wine53f\"=hex(2):25,48,4f,4d,45,25,5c\\\t ;comment\n" - " 25,50,41,54,48,25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); - verify_reg_nonexist(hkey, "Wine53b"); - verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); - verify_reg_nonexist(hkey, "Wine53d"); - verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0); - verify_reg_nonexist(hkey, "Wine53f"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine54a\"=hex(2):4c,69,6e,65,20,\\\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine54a"); - verify_key_nonexist(hkey, "Subkey1"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine54b\"=hex(2):4c,69,6e,65,20\\\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine54b"); - verify_key(hkey, "Subkey2"); - - delete_key(hkey, "Subkey2"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine55a\"=hex(2):4c,69,6e,65,20,\\\n" - "\"Wine55b\"=\"Test value\"\n" - - "\"Wine55c\"=hex(2):4c,69,6e,65,20,\\\n" - ";comment\n" - "\"Wine55d\"=\"Test value\"\n" - - "\"Wine55e\"=hex(2):4c,69,6e,65,20,\\\n" - "#comment\n" - "\"Wine55f\"=\"Test value\"\n" - - "\"Wine55g\"=hex(2):4c,69,6e,65,20,\\\n\n" - "\"Wine55h\"=\"Test value\"\n" - - "\"Wine55i\"=hex(2):4c,69,6e,65,20\\\n" - "\"Wine55j\"=\"Test value\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine55a"); - verify_reg_nonexist(hkey, "Wine55b"); - verify_reg_nonexist(hkey, "Wine55c"); - verify_reg_nonexist(hkey, "Wine55d"); - verify_reg_nonexist(hkey, "Wine55e"); - verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0); - verify_reg_nonexist(hkey, "Wine55g"); - verify_reg_nonexist(hkey, "Wine55h"); - verify_reg_nonexist(hkey, "Wine55i"); - verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine56a\"=hex(2):4c,69,6e,65,20,\\\n" - "\"Wine56b\"=dword:00000008\n" - - "\"Wine56c\"=hex(2):4c,69,6e,65,20,\\\n" - ";comment\n" - "\"Wine56d\"=dword:00000008\n" - - "\"Wine56e\"=hex(2):4c,69,6e,65,20,\\\n" - "#comment\n" - "\"Wine56f\"=dword:00000008\n" - - "\"Wine56g\"=hex(2):4c,69,6e,65,20,\\\n\n" - "\"Wine56h\"=dword:00000008\n" - - "\"Wine56i\"=hex(2):4c,69,6e,65,20\\\n" - "\"Wine56j\"=dword:00000008\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine56a"); - verify_reg_nonexist(hkey, "Wine56b"); - verify_reg_nonexist(hkey, "Wine56c"); - verify_reg_nonexist(hkey, "Wine56d"); - verify_reg_nonexist(hkey, "Wine56e"); - verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0); - verify_reg_nonexist(hkey, "Wine56g"); - verify_reg_nonexist(hkey, "Wine56h"); - verify_reg_nonexist(hkey, "Wine56i"); - verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine57a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" - "\"Wine57b\"=hex(2):25,50,41,54,48,25,00\n" - - "\"Wine57c\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" - ";comment\n" - "\"Wine57d\"=hex(2):25,50,41,54,48,25,00\n" - - "\"Wine57e\"=hex(2):25,48,4f,4d,45,25,5c,\\\n" - "#comment\n" - "\"Wine57f\"=hex(2):25,50,41,54,48,25,00\n" - - "\"Wine57g\"=hex(2):25,48,4f,4d,45,25,5c,\\\n\n" - "\"Wine57h\"=hex(2):25,50,41,54,48,25,00\n" - - "\"Wine57i\"=hex(2):25,48,4f,4d,45,25,5c\\\n" - "\"Wine57j\"=hex(2):25,50,41,54,48,25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine57a"); - verify_reg_nonexist(hkey, "Wine57b"); - verify_reg_nonexist(hkey, "Wine57c"); - verify_reg_nonexist(hkey, "Wine57d"); - verify_reg_nonexist(hkey, "Wine57e"); - verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg_nonexist(hkey, "Wine57g"); - verify_reg_nonexist(hkey, "Wine57h"); - verify_reg_nonexist(hkey, "Wine57i"); - verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0); - - delete_value(hkey, NULL); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58a\"=hex(2):4c,69,6e,65,20,\\\n" - "@=\"Default value 1\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58a"); - verify_reg_nonexist(hkey, NULL); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58b\"=hex(2):4c,69,6e,65,20,\\\n" - ";comment\n" - "@=\"Default value 2\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58b"); - verify_reg_nonexist(hkey, NULL); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58c\"=hex(2):4c,69,6e,65,20,\\\n" - "#comment\n" - "@=\"Default value 3\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58c"); - verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0); - - delete_value(hkey, NULL); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58d\"=hex(2):4c,69,6e,65,20,\\\n\n" - "@=\"Default value 4\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58d"); - verify_reg_nonexist(hkey, NULL); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine58e\"=hex(2):4c,69,6e,65,20\\\n" - "@=\"Default value 5\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine58e"); - verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine59a\"=hex:11,22,33,\\\n" - "\\\n" - " 44,55,66\n" - "\"Wine59b\"=hex:11,22,33,\\\n" - " \\\n" - " 44,55,66\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine59a"); - verify_reg_nonexist(hkey, "Wine59b"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60a\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,\\\n" - ";comment\n" - " 65,6e,\\;comment\n" - " 61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60b\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,\\\n" - " ;comment\n" - " 65,6e,\\;comment\n" - " 61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,\\\n" - "#comment\n" - " 65,6e,\\;comment\n" - " 61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine60c"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60d\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,\\\n" - " #comment\n" - " 65,6e,\\;comment\n" - " 61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine60d"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60e\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,\\\n\n" - " 63,61,74,\\\n\n\n" - " 65,6e,\\\n\n\n\n" - " 61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine60f\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,\\\n \n" - " 63,61,74,\\\n\t\n\t\n" - " 65,6e,\\\n\t \t\n\t \t\n\t \t\n" - " 61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n" - " 25,50,41,54,48,25,00\n" - "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n" - " 25,50,41,54,48,25,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine61a"); - verify_reg_nonexist(hkey, "Wine61b"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62b\"=hex(2):25,50,41,54,48,25,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62c\"=hex:11,22,33,44,55,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62d\"=hex(7):4c,69,6e,65,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL); - ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */, - "got %u, expected 0\n", err); - if (err == ERROR_SUCCESS) - verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine62f\"=hex(7):4c,69,6e,65,20\\", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine62f"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine63a\"=hex(7):4c,69,6e,65,20,\\\n" - " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine63b\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine63a"); - verify_reg_nonexist(hkey, "Wine63b"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine64a\"=hex(7):4c,69,6e,65,00,00\n" - "\"Wine64b\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine64c\"=hex(7):4c,69,6e,65,20,\\;comment\n" - " 63,6f,6e,63,61,74,\\\n" - " 65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine64d\"=hex(7):4c,69,6e,65,20,\\;comment\n" - " 63,6f,6e,63,61,74,\n" - " 65,6e,61,74,69,6f,6e,00,00\n" - "\"Wine64e\"=hex(7):4c,69,6e,65,20,\\\n" - " 63,6f,6e,63,61,74,;comment\n" - " 65,6e,61,74,69,6f,6e,00,00\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0); - verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0); - /* Wine64d */ - size = sizeof(buffer); - err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); - ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); - ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); - /* Wine64e */ - size = sizeof(buffer); - err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size); - ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err); - ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ); - ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size); - ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n" - "\"Wine65b\"=hex(100):25,50,41,\\\n" - " 54,48,25,00\n" - "\"Wine65c\"=hex(100):25,50,41,\\;comment\n" - " 54,48,\\\n" - " 25,00\n" - "\"Wine65d\"=hex(100):25,50,41,\\;comment\n" - " 54,48,\n" - " 25,00\n" - "\"Wine65e\"=hex(100):25,50,41,\\;comment\n" - " 54,48,;comment\n" - " 25,00\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0); - verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0); - verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0); - verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0); - verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0); - - /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine66a\"=hex(7):4c,69,6e,65\n" - "\"Wine66b\"=hex(7):4c,69,6e,65,\n" - "\"Wine66c\"=hex(7):4c,69,6e,65,00\n" - "\"Wine66d\"=hex(7):4c,69,6e,65,00,\n" - "\"Wine66e\"=hex(7):4c,69,6e,65,00,00\n" - "\"Wine66f\"=hex(7):4c,69,6e,65,00,00,\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0); - verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0); - verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine67a\"=hex(2):25,50,41,54,48,25\n" - "\"Wine67b\"=hex(2):25,50,41,54,48,25,\n" - "\"Wine67c\"=hex(2):25,50,41,54,48,25,00\n" - "\"Wine67d\"=hex(2):25,50,41,54,48,25,00,\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0); - verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine68a\"=hex(1):\n" - "\"Wine68b\"=hex(2):\n" - "\"Wine68c\"=hex(3):\n" - "\"Wine68d\"=hex(4):\n" - "\"Wine68e\"=hex(7):\n" - "\"Wine68f\"=hex(100):\n" - "\"Wine68g\"=hex(abcd):\n" - "\"Wine68h\"=hex:\n" - "\"Wine68i\"=hex(0):\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0); - verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0); - verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0); - verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0); - verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0); - verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0); - verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0); - verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0); - verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0); - - /* Test with embedded null characters */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine69a\"=\"\\0\n" - "\"Wine69b\"=\"\\0\\0\n" - "\"Wine69c\"=\"Value1\\0\n" - "\"Wine69d\"=\"Value2\\0\\0\\0\\0\n" - "\"Wine69e\"=\"Value3\\0Value4\n" - "\"Wine69f\"=\"\\0Value5\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "Wine69a"); - verify_reg_nonexist(hkey, "Wine69b"); - verify_reg_nonexist(hkey, "Wine69c"); - verify_reg_nonexist(hkey, "Wine69d"); - verify_reg_nonexist(hkey, "Wine69e"); - verify_reg_nonexist(hkey, "Wine69f"); - - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"Wine70a\"=\"\\0\"\n" - "\"Wine70b\"=\"\\0\\0\"\n" - "\"Wine70c\"=\"Value1\\0\"\n" - "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n" - "\"Wine70e\"=\"Value3\\0Value4\"\n" - "\"Wine70f\"=\"\\0Value5\"\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - todo_wine verify_reg_nonexist(hkey, "Wine70a"); - todo_wine verify_reg_nonexist(hkey, "Wine70b"); - todo_wine verify_reg_nonexist(hkey, "Wine70c"); - todo_wine verify_reg_nonexist(hkey, "Wine70d"); - todo_wine verify_reg_nonexist(hkey, "Wine70e"); - todo_wine verify_reg_nonexist(hkey, "Wine70f"); - - /* Test forward and back slashes */ - test_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "\"count/up\"=\"one/two/three\"\n" - "\"\\\\foo\\\\bar\"=\"\"\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); - verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); - verify_key(hkey, "
https://winehq.org
"); - - close_key(hkey); - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); -} - static void test_unicode_import(void) { DWORD r, dword = 0x123, type, size; @@ -4648,7 +3039,6 @@ START_TEST(reg) } test_add(); - test_import(); test_unicode_import(); test_import_with_whitespace(); test_unicode_import_with_whitespace(); diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index cd48904066f..73457f0ee37 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -24,6 +24,7 @@ #include "wine/test.h" /* Common #defines */ +#define lok ok_(__FILE__,line) #define KEY_WINE "Software\\Wine" #define KEY_BASE KEY_WINE "\\reg_test" #define REG_EXIT_SUCCESS 0 @@ -33,9 +34,16 @@ #define run_reg_exe(c,r) run_reg_exe_(__LINE__,c,r) BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc); +#define verify_reg(k,v,t,d,s,todo) verify_reg_(__LINE__,k,v,t,d,s,todo) +void verify_reg_(unsigned line, HKEY hkey, const char* value, DWORD exp_type, + const void *exp_data, DWORD exp_size, DWORD todo); + #define verify_reg_nonexist(k,v) verify_reg_nonexist_(__LINE__,k,v) void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value); +#define open_key(b,p,s,k) open_key_(__LINE__,b,p,s,k) +void open_key_(unsigned line, const HKEY base, const char *path, const DWORD sam, HKEY *hkey); + #define close_key(k) close_key_(__LINE__,k) void close_key_(unsigned line, HKEY hkey); @@ -56,4 +64,12 @@ LONG delete_tree(const HKEY key, const char *subkey); #define add_value(k,n,t,d,s) add_value_(__LINE__,k,n,t,d,s) void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size); +#define delete_value(k,n) delete_value_(__LINE__,k,n) +void delete_value_(unsigned line, const HKEY hkey, const char *name); + +/* import.c */ +#define test_import_str(c,r) import_reg(__LINE__,c,FALSE,r) +#define test_import_wstr(c,r) import_reg(__LINE__,c,TRUE,r) +BOOL import_reg(unsigned line, const char *contents, BOOL unicode, DWORD *rc); + #endif /* __REG_TEST_H__ */ diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 5eb53bfa131..ca45d41d0c3 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: 81a8938fa31de3d5a7a4c741582b4e5d9a2d1818 + wine: 58863f53316d2d88654d3a18c9481441dfabcb1a
2 years, 6 months
1
0
0
0
[reactos] 13/158: [WINESYNC] reg/tests: Split 'query' tests from reg.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7fcb8aca931ebbe627fe2…
commit 7fcb8aca931ebbe627fe271212d9325b0ee34c69 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 19:59:50 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Split 'query' tests from reg.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 81a8938fa31de3d5a7a4c741582b4e5d9a2d1818 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/query.c | 136 ++++++++++++++++++++++++++++++ modules/rostests/winetests/reg/reg.c | 108 +----------------------- modules/rostests/winetests/reg/reg_test.h | 3 + sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 141 insertions(+), 108 deletions(-) diff --git a/modules/rostests/winetests/reg/query.c b/modules/rostests/winetests/reg/query.c new file mode 100644 index 00000000000..afa655f8d74 --- /dev/null +++ b/modules/rostests/winetests/reg/query.c @@ -0,0 +1,136 @@ +/* + * Copyright 2014 Akihiro Sagawa + * Copyright 2016-2018, 2021 Hugh McMaster + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "reg_test.h" + +static void test_query(void) +{ + DWORD r; + HKEY key, subkey; + const char hello[] = "Hello"; + const char world[] = "World"; + const char empty1[] = "Empty1"; + const char empty2[] = "Empty2"; + const DWORD dword1 = 0x123; + const DWORD dword2 = 0xabc; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + run_reg_exe("reg query", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query /?", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query /h", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query -H", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + /* Create a test key */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &key); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); + ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), + "got exit code %d, expected 0\n", r); + + add_value(key, "Test", REG_SZ, hello, sizeof(hello)); + add_value(key, "Wine", REG_DWORD, &dword1, sizeof(dword1)); + add_value(key, NULL, REG_SZ, empty1, sizeof(empty1)); + + run_reg_exe("reg query HKCU\\" KEY_BASE, &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Missing", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Wine", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + /* Create a test subkey */ + add_key(key, "Subkey", &subkey); + add_value(subkey, "Test", REG_SZ, world, sizeof(world)); + add_value(subkey, "Wine", REG_DWORD, &dword2, sizeof(dword2)); + add_value(subkey, NULL, REG_SZ, empty2, sizeof(empty2)); + + close_key(subkey); + + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Wine", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /ve", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + /* Test recursion */ + run_reg_exe("reg query HKCU\\" KEY_BASE " /s", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test /s", &r); + ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, + "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /v Wine /s", &r); + ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, + "got exit code %d, expected 0\n", r); + + run_reg_exe("reg query HKCU\\" KEY_BASE " /ve /s", &r); + ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, + "got exit code %d, expected 0\n", r); + + /* Clean-up, then query */ + delete_key(key, "subkey"); + close_key(key); + + run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + delete_key(HKEY_CURRENT_USER, KEY_BASE); + + run_reg_exe("reg query HKCU\\" KEY_BASE, &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); +} + +START_TEST(query) +{ + DWORD r; + + if (!run_reg_exe("reg.exe /?", &r)) { + win_skip("reg.exe not available, skipping 'query' tests\n"); + return; + } + + test_query(); +} diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 97766e191fa..11dea0d0e28 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -139,8 +139,7 @@ void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey) lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: %d\n", err); } -#define delete_key(k,p) delete_key_(__LINE__,k,p) -static void delete_key_(unsigned line, const HKEY hkey, const char *path) +void delete_key_(unsigned line, const HKEY hkey, const char *path) { if (path && *path) { @@ -617,110 +616,6 @@ static void test_add(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } -static void test_query(void) -{ - DWORD r; - HKEY key, subkey; - const char hello[] = "Hello"; - const char world[] = "World"; - const char empty1[] = "Empty1"; - const char empty2[] = "Empty2"; - const DWORD dword1 = 0x123; - const DWORD dword2 = 0xabc; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - run_reg_exe("reg query", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg query /?", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query /h", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query -H", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - /* Create a test key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &key); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); - ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), - "got exit code %d, expected 0\n", r); - - add_value(key, "Test", REG_SZ, hello, sizeof(hello)); - add_value(key, "Wine", REG_DWORD, &dword1, sizeof(dword1)); - add_value(key, NULL, REG_SZ, empty1, sizeof(empty1)); - - run_reg_exe("reg query HKCU\\" KEY_BASE, &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Missing", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Wine", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /ve", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - /* Create a test subkey */ - add_key(key, "Subkey", &subkey); - add_value(subkey, "Test", REG_SZ, world, sizeof(world)); - add_value(subkey, "Wine", REG_DWORD, &dword2, sizeof(dword2)); - add_value(subkey, NULL, REG_SZ, empty2, sizeof(empty2)); - - close_key(subkey); - - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Test", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /v Wine", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey /ve", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - /* Test recursion */ - run_reg_exe("reg query HKCU\\" KEY_BASE " /s", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Test /s", &r); - ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, - "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /v Wine /s", &r); - ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, - "got exit code %d, expected 0\n", r); - - run_reg_exe("reg query HKCU\\" KEY_BASE " /ve /s", &r); - ok(r == REG_EXIT_SUCCESS || r == REG_EXIT_FAILURE /* WinXP */, - "got exit code %d, expected 0\n", r); - - /* Clean-up, then query */ - delete_key(key, "subkey"); - close_key(key); - - run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - delete_key(HKEY_CURRENT_USER, KEY_BASE); - - run_reg_exe("reg query HKCU\\" KEY_BASE, &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); -} - static BOOL write_file(const void *str, DWORD size) { HANDLE file; @@ -4753,7 +4648,6 @@ START_TEST(reg) } test_add(); - test_query(); test_import(); test_unicode_import(); test_import_with_whitespace(); diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h index 78d1098499a..cd48904066f 100644 --- a/modules/rostests/winetests/reg/reg_test.h +++ b/modules/rostests/winetests/reg/reg_test.h @@ -48,6 +48,9 @@ void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey); #define add_key(k,p,s) add_key_(__LINE__,k,p,s) void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey); +#define delete_key(k,p) delete_key_(__LINE__,k,p) +void delete_key_(unsigned line, const HKEY hkey, const char *path); + LONG delete_tree(const HKEY key, const char *subkey); #define add_value(k,n,t,d,s) add_value_(__LINE__,k,n,t,d,s) diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 98f8a2da505..5eb53bfa131 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: d3f9eaeb54cd272cb34f2863c74b47e414c87bee + wine: 81a8938fa31de3d5a7a4c741582b4e5d9a2d1818
2 years, 6 months
1
0
0
0
[reactos] 12/158: [WINESYNC] reg/tests: Split 'delete' tests from reg.c.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bcfd09deb74450bf27a3a…
commit bcfd09deb74450bf27a3a8ae368a59752e910b0c Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 14:51:46 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Split 'delete' tests from reg.c. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id d3f9eaeb54cd272cb34f2863c74b47e414c87bee by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/delete.c | 123 +++++++++++++++++++++++++++++ modules/rostests/winetests/reg/reg.c | 125 +++--------------------------- modules/rostests/winetests/reg/reg_test.h | 56 +++++++++++++ sdk/tools/winesync/reg.cfg | 2 +- 4 files changed, 190 insertions(+), 116 deletions(-) diff --git a/modules/rostests/winetests/reg/delete.c b/modules/rostests/winetests/reg/delete.c new file mode 100644 index 00000000000..fff3c5348b8 --- /dev/null +++ b/modules/rostests/winetests/reg/delete.c @@ -0,0 +1,123 @@ +/* + * Copyright 2014 Akihiro Sagawa + * Copyright 2016-2018, 2021 Hugh McMaster + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "reg_test.h" + +static void test_delete(void) +{ + HKEY hkey, hsubkey; + DWORD r; + const DWORD deadbeef = 0xdeadbeef; + + delete_tree(HKEY_CURRENT_USER, KEY_BASE); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + run_reg_exe("reg delete", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete /?", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg delete /h", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + run_reg_exe("reg delete -H", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + /* Multiple /v* switches */ + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v Wine /ve", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v Wine /va", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /va", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v Wine /v Test /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* No /v argument */ + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /f /v", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + + /* Create a test key */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_value(hkey, "foo", REG_DWORD, &deadbeef, sizeof(deadbeef)); + add_value(hkey, "bar", REG_DWORD, &deadbeef, sizeof(deadbeef)); + add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef)); + + add_key(hkey, "subkey", &hsubkey); + close_key(hsubkey); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v bar /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "bar"); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, ""); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "foo"); + verify_key(hkey, "subkey"); + + /* Test forward and back slashes */ + add_key(hkey, "
https://winehq.org
", &hsubkey); + close_key(hsubkey); + add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); + add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); + + run_reg_exe("reg delete HKCU\\" KEY_BASE "\\https://winehq.org /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "
https://winehq.org
"); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v count/up /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "count/up"); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v \\foo\\bar /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "\\foo\\bar"); + + close_key(hkey); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); +} + +START_TEST(delete) +{ + DWORD r; + + if (!run_reg_exe("reg.exe /?", &r)) { + win_skip("reg.exe not available, skipping 'delete' tests\n"); + return; + } + + test_delete(); +} diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 538a274d54f..97766e191fa 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -16,22 +16,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include <stdio.h> -#include <windows.h> -#include "wine/test.h" +#include "reg_test.h" #define lok ok_(__FILE__,line) -#define KEY_WINE "Software\\Wine" -#define KEY_BASE KEY_WINE "\\reg_test" -#define REG_EXIT_SUCCESS 0 -#define REG_EXIT_FAILURE 1 #define TODO_REG_TYPE (0x0001u) #define TODO_REG_SIZE (0x0002u) #define TODO_REG_DATA (0x0004u) #define TODO_REG_COMPARE (0x0008u) -#define run_reg_exe(c,r) run_reg_exe_(__LINE__,c,r) -static BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc) +BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc) { STARTUPINFOA si = {sizeof(STARTUPINFOA)}; PROCESS_INFORMATION pi; @@ -86,8 +79,7 @@ static void verify_reg_(unsigned line, HKEY hkey, const char* value, } } -#define verify_reg_nonexist(k,v) verify_reg_nonexist_(__LINE__,k,v) -static void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value) +void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value) { LONG err; @@ -105,8 +97,7 @@ static void open_key_(unsigned line, const HKEY base, const char *path, const DW lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", err); } -#define close_key(k) close_key_(__LINE__,k) -static void close_key_(unsigned line, HKEY hkey) +void close_key_(unsigned line, HKEY hkey) { LONG err; @@ -114,8 +105,7 @@ static void close_key_(unsigned line, HKEY hkey) lok(err == ERROR_SUCCESS, "RegCloseKey failed: %d\n", err); } -#define verify_key(k,s) verify_key_(__LINE__,k,s) -static void verify_key_(unsigned line, HKEY key_base, const char *subkey) +void verify_key_(unsigned line, HKEY key_base, const char *subkey) { HKEY hkey; LONG err; @@ -127,8 +117,7 @@ static void verify_key_(unsigned line, HKEY key_base, const char *subkey) RegCloseKey(hkey); } -#define verify_key_nonexist(k,s) verify_key_nonexist_(__LINE__,k,s) -static void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey) +void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey) { HKEY hkey; LONG err; @@ -141,8 +130,7 @@ static void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subke RegCloseKey(hkey); } -#define add_key(k,p,s) add_key_(__LINE__,k,p,s) -static void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey) +void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey) { LONG err; @@ -163,7 +151,7 @@ static void delete_key_(unsigned line, const HKEY hkey, const char *path) } } -static LONG delete_tree(const HKEY key, const char *subkey) +LONG delete_tree(const HKEY key, const char *subkey) { HKEY hkey; LONG ret; @@ -205,9 +193,7 @@ cleanup: return ret; } -#define add_value(k,n,t,d,s) add_value_(__LINE__,k,n,t,d,s) -static void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, - const void *data, size_t size) +void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size) { LONG err; @@ -631,97 +617,6 @@ static void test_add(void) delete_tree(HKEY_CURRENT_USER, KEY_BASE); } -static void test_delete(void) -{ - HKEY hkey, hsubkey; - DWORD r; - const DWORD deadbeef = 0xdeadbeef; - - delete_tree(HKEY_CURRENT_USER, KEY_BASE); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - run_reg_exe("reg delete", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete /?", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg delete /h", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - run_reg_exe("reg delete -H", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - /* Multiple /v* switches */ - run_reg_exe("reg delete HKCU\\" KEY_BASE " /v Wine /ve", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /v Wine /va", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /va", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /v Wine /v Test /f", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - /* No /v argument */ - run_reg_exe("reg delete HKCU\\" KEY_BASE " /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /f /v", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); - - /* Create a test key */ - add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); - add_value(hkey, "foo", REG_DWORD, &deadbeef, sizeof(deadbeef)); - add_value(hkey, "bar", REG_DWORD, &deadbeef, sizeof(deadbeef)); - add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef)); - - add_key(hkey, "subkey", &hsubkey); - close_key(hsubkey); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /v bar /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "bar"); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, ""); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "foo"); - verify_key(hkey, "subkey"); - - /* Test forward and back slashes */ - add_key(hkey, "
https://winehq.org
", &hsubkey); - close_key(hsubkey); - add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); - add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); - - run_reg_exe("reg delete HKCU\\" KEY_BASE "\\https://winehq.org /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(hkey, "
https://winehq.org
"); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /v count/up /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "count/up"); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /v \\foo\\bar /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg_nonexist(hkey, "\\foo\\bar"); - - close_key(hkey); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); - - run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); - ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); -} - static void test_query(void) { DWORD r; @@ -4851,13 +4746,13 @@ static void test_copy(void) START_TEST(reg) { DWORD r; + if (!run_reg_exe("reg.exe /?", &r)) { win_skip("reg.exe not available, skipping reg.exe tests\n"); return; } test_add(); - test_delete(); test_query(); test_import(); test_unicode_import(); diff --git a/modules/rostests/winetests/reg/reg_test.h b/modules/rostests/winetests/reg/reg_test.h new file mode 100644 index 00000000000..78d1098499a --- /dev/null +++ b/modules/rostests/winetests/reg/reg_test.h @@ -0,0 +1,56 @@ +/* + * Copyright 2021 Hugh McMaster + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __REG_TEST_H__ +#define __REG_TEST_H__ + +#include <stdio.h> +#include <windows.h> +#include "wine/test.h" + +/* Common #defines */ +#define KEY_WINE "Software\\Wine" +#define KEY_BASE KEY_WINE "\\reg_test" +#define REG_EXIT_SUCCESS 0 +#define REG_EXIT_FAILURE 1 + +/* Helper functions */ +#define run_reg_exe(c,r) run_reg_exe_(__LINE__,c,r) +BOOL run_reg_exe_(unsigned line, const char *cmd, DWORD *rc); + +#define verify_reg_nonexist(k,v) verify_reg_nonexist_(__LINE__,k,v) +void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value); + +#define close_key(k) close_key_(__LINE__,k) +void close_key_(unsigned line, HKEY hkey); + +#define verify_key(k,s) verify_key_(__LINE__,k,s) +void verify_key_(unsigned line, HKEY key_base, const char *subkey); + +#define verify_key_nonexist(k,s) verify_key_nonexist_(__LINE__,k,s) +void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subkey); + +#define add_key(k,p,s) add_key_(__LINE__,k,p,s) +void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *subkey); + +LONG delete_tree(const HKEY key, const char *subkey); + +#define add_value(k,n,t,d,s) add_value_(__LINE__,k,n,t,d,s) +void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size); + +#endif /* __REG_TEST_H__ */ diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index e2467a17a35..98f8a2da505 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: 3fd57fd995c1af3770fd72effcec874529f17b6c + wine: d3f9eaeb54cd272cb34f2863c74b47e414c87bee
2 years, 6 months
1
0
0
0
[reactos] 11/158: [WINESYNC] reg/tests: Add tests for forward and back slashes in key and value names.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1b41b722d0f6d60affc4a…
commit 1b41b722d0f6d60affc4a20446a0f20eaf2c8fc6 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 14:51:45 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Add tests for forward and back slashes in key and value names. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 3fd57fd995c1af3770fd72effcec874529f17b6c by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/reg.c | 89 +++++++++++++++++++++++++++++++----- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index db02fc770e2..538a274d54f 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -578,6 +578,19 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, 0); + /* Test forward and back slashes */ + run_reg_exe("reg add HKCU\\" KEY_BASE "\\https://winehq.org /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key(hkey, "
https://winehq.org
"); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v count/up /d one/two/three /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); + + run_reg_exe("reg add HKCU\\" KEY_BASE " /v \\foo\\bar /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); + close_key(hkey); /* Test duplicate switches */ @@ -615,7 +628,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid4 -", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); } static void test_delete(void) @@ -681,6 +694,24 @@ static void test_delete(void) verify_reg_nonexist(hkey, "foo"); verify_key(hkey, "subkey"); + /* Test forward and back slashes */ + add_key(hkey, "
https://winehq.org
", &hsubkey); + close_key(hsubkey); + add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); + add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); + + run_reg_exe("reg delete HKCU\\" KEY_BASE "\\https://winehq.org /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_key_nonexist(hkey, "
https://winehq.org
"); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v count/up /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "count/up"); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /v \\foo\\bar /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg_nonexist(hkey, "\\foo\\bar"); + close_key(hkey); run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); @@ -2385,9 +2416,20 @@ static void test_import(void) todo_wine verify_reg_nonexist(hkey, "Wine70e"); todo_wine verify_reg_nonexist(hkey, "Wine70f"); + /* Test forward and back slashes */ + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"count/up\"=\"one/two/three\"\n" + "\"\\\\foo\\\\bar\"=\"\"\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); + verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); + verify_key(hkey, "
https://winehq.org
"); + close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); } static void test_unicode_import(void) @@ -3923,9 +3965,20 @@ static void test_unicode_import(void) todo_wine verify_reg_nonexist(hkey, "Wine70e"); todo_wine verify_reg_nonexist(hkey, "Wine70f"); + /* Test forward and back slashes */ + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"count/up\"=\"one/two/three\"\n" + "\"\\\\foo\\\\bar\"=\"\"\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + verify_reg(hkey, "count/up", REG_SZ, "one/two/three", 14, 0); + verify_reg(hkey, "\\foo\\bar", REG_SZ, "", 1, 0); + verify_key(hkey, "
https://winehq.org
"); + close_key(hkey); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); } static void test_import_with_whitespace(void) @@ -4473,6 +4526,13 @@ static void test_export(void) "\"Wine4g\"=\"Value2\"\r\n" "\"Wine4h\"=\"abc\"\r\n\r\n"; + const char *slashes_test = + "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n" + "\"count/up\"=\"one/two/three\"\r\n" + "\"\\\\foo\\\\bar\"=\"\"\r\n\r\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "\\https://winehq.org]\r\n\r\n"; + delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -4579,9 +4639,7 @@ 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", complex_test, 0), "compare_export() failed\n"); - - err = delete_tree(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS, "delete_tree() failed: %d\n", err); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); /* Test the export order of registry keys */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); @@ -4593,7 +4651,6 @@ 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", key_order_test, 0), "compare_export() failed\n"); - delete_key(hkey, "Subkey1"); delete_key(hkey, "Subkey2"); @@ -4607,7 +4664,6 @@ 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", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); /* Test registry export with empty hex data */ @@ -4625,7 +4681,6 @@ 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", empty_hex_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); /* Test registry export after importing alternative registry data types */ @@ -4643,7 +4698,6 @@ 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", empty_hex_test2, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -4662,7 +4716,6 @@ 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", hex_types_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); /* Test registry export with embedded null characters */ @@ -4700,8 +4753,20 @@ 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", embedded_null_test, 0), "compare_export() failed\n"); - delete_key(HKEY_CURRENT_USER, KEY_BASE); + + /* Test registry export with forward and back slashes */ + add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); + add_key(hkey, "
https://winehq.org
", &subkey); + close_key(subkey); + add_value(hkey, "count/up", REG_SZ, "one/two/three", 14); + add_value(hkey, "\\foo\\bar", REG_SZ, "", 1); + close_key(hkey); + + 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", slashes_test, TODO_REG_COMPARE), "compare_export() failed\n"); + delete_tree(HKEY_CURRENT_USER, KEY_BASE); } #define COPY_DEST KEY_WINE "\\reg_copy" diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 9f7a030d3e3..e2467a17a35 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: 6c62ffeca7f381199bef1969452fcef46b979f0f + wine: 3fd57fd995c1af3770fd72effcec874529f17b6c
2 years, 6 months
1
0
0
0
[reactos] 10/158: [WINESYNC] reg/tests: Add additional tests with embedded NUL characters.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d4dc3ccab177845c22737…
commit d4dc3ccab177845c227372614fd0dc34b0d32f90 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 14:51:45 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:28 2022 +0200 [WINESYNC] reg/tests: Add additional tests with embedded NUL characters. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 6c62ffeca7f381199bef1969452fcef46b979f0f by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/reg.c | 36 ++++++++++++++++++++++++++++++++++-- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 471c6ad8d46..db02fc770e2 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -2360,7 +2360,7 @@ static void test_import(void) "\"Wine69c\"=\"Value1\\0\n" "\"Wine69d\"=\"Value2\\0\\0\\0\\0\n" "\"Wine69e\"=\"Value3\\0Value4\n" - "\"Wine69f\"=\"\\0Value4\n\n", &r); + "\"Wine69f\"=\"\\0Value5\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine69a"); verify_reg_nonexist(hkey, "Wine69b"); @@ -2369,6 +2369,22 @@ static void test_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f"); + test_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine70a\"=\"\\0\"\n" + "\"Wine70b\"=\"\\0\\0\"\n" + "\"Wine70c\"=\"Value1\\0\"\n" + "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n" + "\"Wine70e\"=\"Value3\\0Value4\"\n" + "\"Wine70f\"=\"\\0Value5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine70a"); + todo_wine verify_reg_nonexist(hkey, "Wine70b"); + todo_wine verify_reg_nonexist(hkey, "Wine70c"); + todo_wine verify_reg_nonexist(hkey, "Wine70d"); + todo_wine verify_reg_nonexist(hkey, "Wine70e"); + todo_wine verify_reg_nonexist(hkey, "Wine70f"); + close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); @@ -3882,7 +3898,7 @@ static void test_unicode_import(void) "\"Wine69c\"=\"Value1\\0\n" "\"Wine69d\"=\"Value2\\0\\0\\0\\0\n" "\"Wine69e\"=\"Value3\\0Value4\n" - "\"Wine69f\"=\"\\0Value4\n\n", &r); + "\"Wine69f\"=\"\\0Value5\n\n", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, "Wine69a"); verify_reg_nonexist(hkey, "Wine69b"); @@ -3891,6 +3907,22 @@ static void test_unicode_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f"); + test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine70a\"=\"\\0\"\n" + "\"Wine70b\"=\"\\0\\0\"\n" + "\"Wine70c\"=\"Value1\\0\"\n" + "\"Wine70d\"=\"Value2\\0\\0\\0\\0\"\n" + "\"Wine70e\"=\"Value3\\0Value4\"\n" + "\"Wine70f\"=\"\\0Value5\"\n\n", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine70a"); + todo_wine verify_reg_nonexist(hkey, "Wine70b"); + todo_wine verify_reg_nonexist(hkey, "Wine70c"); + todo_wine verify_reg_nonexist(hkey, "Wine70d"); + todo_wine verify_reg_nonexist(hkey, "Wine70e"); + todo_wine verify_reg_nonexist(hkey, "Wine70f"); + close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 00bfa0dfb33..9f7a030d3e3 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: 93fbe09ed098f6356485c6390a533e04f6ff3959 + wine: 6c62ffeca7f381199bef1969452fcef46b979f0f
2 years, 6 months
1
0
0
0
[reactos] 09/158: [WINESYNC] reg/tests: Replace RegCloseKey() with the helper function close_key().
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f3c6b93bb6ffa12741f50…
commit f3c6b93bb6ffa12741f50eb0789410997f452c43 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Jan 16 14:51:45 2022 +0100 Commit: Thomas Csovcsity <thc.fr13nd(a)gmail.com> CommitDate: Sun Jun 19 13:06:27 2022 +0200 [WINESYNC] reg/tests: Replace RegCloseKey() with the helper function close_key(). Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> wine commit id 93fbe09ed098f6356485c6390a533e04f6ff3959 by Hugh McMaster <hugh.mcmaster(a)outlook.com> --- modules/rostests/winetests/reg/reg.c | 92 +++++++++++++++++------------------- sdk/tools/winesync/reg.cfg | 2 +- 2 files changed, 44 insertions(+), 50 deletions(-) diff --git a/modules/rostests/winetests/reg/reg.c b/modules/rostests/winetests/reg/reg.c index 9dd3a2afe81..471c6ad8d46 100644 --- a/modules/rostests/winetests/reg/reg.c +++ b/modules/rostests/winetests/reg/reg.c @@ -105,6 +105,15 @@ static void open_key_(unsigned line, const HKEY base, const char *path, const DW lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", err); } +#define close_key(k) close_key_(__LINE__,k) +static void close_key_(unsigned line, HKEY hkey) +{ + LONG err; + + err = RegCloseKey(hkey); + lok(err == ERROR_SUCCESS, "RegCloseKey failed: %d\n", err); +} + #define verify_key(k,s) verify_key_(__LINE__,k,s) static void verify_key_(unsigned line, HKEY key_base, const char *subkey) { @@ -569,7 +578,7 @@ static void test_add(void) ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r); verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, 0); - RegCloseKey(hkey); + close_key(hkey); /* Test duplicate switches */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v Wine /t REG_DWORD /d 0x1 /v Test /f", &r); @@ -657,7 +666,7 @@ static void test_delete(void) add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef)); add_key(hkey, "subkey", &hsubkey); - RegCloseKey(hsubkey); + close_key(hsubkey); run_reg_exe("reg delete HKCU\\" KEY_BASE " /v bar /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -672,7 +681,7 @@ static void test_delete(void) verify_reg_nonexist(hkey, "foo"); verify_key(hkey, "subkey"); - RegCloseKey(hkey); + close_key(hkey); run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -686,7 +695,6 @@ static void test_query(void) { DWORD r; HKEY key, subkey; - LONG err; const char hello[] = "Hello"; const char world[] = "World"; const char empty1[] = "Empty1"; @@ -744,8 +752,7 @@ static void test_query(void) add_value(subkey, "Wine", REG_DWORD, &dword2, sizeof(dword2)); add_value(subkey, NULL, REG_SZ, empty2, sizeof(empty2)); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -777,9 +784,7 @@ static void test_query(void) /* Clean-up, then query */ delete_key(key, "subkey"); - - err = RegCloseKey(key); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(key); run_reg_exe("reg query HKCU\\" KEY_BASE "\\subkey", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -1632,8 +1637,7 @@ static void test_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey\"1", 0, &subkey); verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1"); test_import_str("REGEDIT4\n\n" @@ -1642,8 +1646,7 @@ static void test_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey/2", 0, &subkey); verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2"); /* Test key creation */ @@ -1687,7 +1690,7 @@ static void test_import(void) verify_key(hkey, "Subkey1e"); open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1e"); test_import_str("REGEDIT4\n\n" @@ -1699,7 +1702,7 @@ static void test_import(void) verify_key(hkey, "Subkey1f"); open_key(hkey, "Subkey1f\\\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1f\\\\"); test_import_str("REGEDIT4\n\n" @@ -1712,7 +1715,7 @@ static void test_import(void) verify_key(hkey, "Subkey1g"); open_key(hkey, "Subkey1g\\\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1g\\\\"); /* Test key deletion. We start by creating some registry keys. */ @@ -2366,8 +2369,7 @@ static void test_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f"); - err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -3147,8 +3149,7 @@ static void test_unicode_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey\"1", 0, &subkey); verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1"); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -3157,8 +3158,7 @@ static void test_unicode_import(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); open_key(hkey, "Subkey/2", 0, &subkey); verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0); - err = RegCloseKey(subkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(subkey); delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2"); /* Test key creation */ @@ -3202,7 +3202,7 @@ static void test_unicode_import(void) verify_key(hkey, "Subkey1e"); open_key(hkey, "Subkey1e", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1e"); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -3214,7 +3214,7 @@ static void test_unicode_import(void) verify_key(hkey, "Subkey1f"); open_key(hkey, "Subkey1f\\\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1f\\\\"); test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n" @@ -3227,7 +3227,7 @@ static void test_unicode_import(void) verify_key(hkey, "Subkey1g"); open_key(hkey, "Subkey1g\\\\", 0, &subkey); verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0); - RegCloseKey(subkey); + close_key(subkey); delete_key(hkey, "Subkey1g\\\\"); /* Test key deletion. We start by creating some registry keys. */ @@ -3891,8 +3891,7 @@ static void test_unicode_import(void) verify_reg_nonexist(hkey, "Wine69e"); verify_reg_nonexist(hkey, "Wine69f"); - err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err); + close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -3901,7 +3900,6 @@ static void test_import_with_whitespace(void) { HKEY hkey; DWORD r, dword; - LONG err; delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -4039,8 +4037,7 @@ static void test_import_with_whitespace(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0); - err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", err); + close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -4049,7 +4046,6 @@ static void test_unicode_import_with_whitespace(void) { HKEY hkey; DWORD r, dword; - LONG err; delete_tree(HKEY_CURRENT_USER, KEY_BASE); verify_key_nonexist(HKEY_CURRENT_USER, KEY_BASE); @@ -4187,8 +4183,7 @@ static void test_unicode_import_with_whitespace(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg(hkey, "", REG_DWORD, &dword, sizeof(DWORD), 0); - err = RegCloseKey(hkey); - ok(err == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", err); + close_key(hkey); delete_key(HKEY_CURRENT_USER, KEY_BASE); } @@ -4303,7 +4298,7 @@ static void test_import_31(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); verify_reg_nonexist(hkey, ""); - RegCloseKey(hkey); + close_key(hkey); delete_key(HKEY_CLASSES_ROOT, KEY_BASE); } @@ -4519,35 +4514,35 @@ static void test_export(void) add_key(hkey, "Subkey1", &subkey); add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4); add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7); - RegCloseKey(subkey); + close_key(subkey); add_key(hkey, "Subkey2a", &subkey); add_value(subkey, "double\"quote", REG_SZ, "\"Hello, World!\"", 16); dword = 0x8; add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword)); - RegCloseKey(subkey); + close_key(subkey); add_key(hkey, "Subkey2a\\Subkey2b", &subkey); add_value(subkey, NULL, REG_SZ, "Default value name", 19); add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19); - RegCloseKey(subkey); + close_key(subkey); add_key(hkey, "Subkey3a", &subkey); add_value(subkey, "Backslash", REG_SZ, "Use \\\\ to escape a backslash", 29); - RegCloseKey(subkey); + close_key(subkey); add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", &subkey); add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14); add_value(subkey, "Zero data type", REG_NONE, "Value", 6); - RegCloseKey(subkey); + close_key(subkey); add_key(hkey, "Subkey4", &subkey); dword = 0x12345678; add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword)); add_value(subkey, "43981", 0xabcd, "Value", 6); - RegCloseKey(subkey); + close_key(subkey); - RegCloseKey(hkey); + close_key(hkey); 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); @@ -4559,9 +4554,9 @@ static void test_export(void) /* Test the export order of registry keys */ add_key(HKEY_CURRENT_USER, KEY_BASE, &hkey); add_key(hkey, "Subkey2", &subkey); - RegCloseKey(subkey); + close_key(subkey); add_key(hkey, "Subkey1", &subkey); - RegCloseKey(subkey); + close_key(subkey); 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); @@ -4575,8 +4570,7 @@ static void test_export(void) */ add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19); add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20); - - RegCloseKey(hkey); + close_key(hkey); 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); @@ -4594,7 +4588,7 @@ static void test_export(void) add_value(hkey, "Wine1f", REG_MULTI_SZ, NULL, 0); add_value(hkey, "Wine1g", 0x100, NULL, 0); add_value(hkey, "Wine1h", 0xabcd, NULL, 0); - RegCloseKey(hkey); + close_key(hkey); 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); @@ -4612,7 +4606,7 @@ static void test_export(void) verify_reg(hkey, "Wine2a", REG_SZ, NULL, 0, 0); verify_reg(hkey, "Wine2b", REG_BINARY, NULL, 0, 0); verify_reg(hkey, "Wine2c", REG_DWORD, NULL, 0, 0); - RegCloseKey(hkey); + close_key(hkey); 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); @@ -4631,7 +4625,7 @@ static void test_export(void) verify_reg(hkey, "Wine3b", REG_BINARY, hex, 4, 0); dword = 0x10203040; verify_reg(hkey, "Wine3c", REG_DWORD, &dword, sizeof(dword), 0); - RegCloseKey(hkey); + close_key(hkey); 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); @@ -4669,7 +4663,7 @@ static void test_export(void) verify_reg(hkey, "Wine4f", REG_SZ, "\0Value", 7, 0); verify_reg(hkey, "Wine4g", REG_SZ, "Value2", 7, 0); verify_reg(hkey, "Wine4h", REG_SZ, "abc\0def", 8, 0); - RegCloseKey(hkey); + close_key(hkey); 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); diff --git a/sdk/tools/winesync/reg.cfg b/sdk/tools/winesync/reg.cfg index 2aaad5127fa..00bfa0dfb33 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: 5cacd496a14b8f83c8e0209bb00bf2ea4ce90e01 + wine: 93fbe09ed098f6356485c6390a533e04f6ff3959
2 years, 6 months
1
0
0
0
← Newer
1
...
15
16
17
18
19
20
21
...
24
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Results per page:
10
25
50
100
200