winehq.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
2025
February
January
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
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
December 2016
----- 2025 -----
February 2025
January 2025
----- 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
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
342 discussions
Start a n
N
ew thread
Hugh McMaster : reg/tests: Fix copy/paste errors in some tests.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: a4d892e244943844f7af7ca91a5f8c2a5c7349e8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a4d892e244943844f7af7ca91…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Wed Dec 7 08:48:33 2016 +0000 reg/tests: Fix copy/paste errors in some tests. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/reg/tests/reg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index f19f6f7..e8a9d80 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -124,19 +124,19 @@ static void test_add(void) run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest0"); - ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); + ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", err); run_reg_exe("reg add \\\\HKCU\\" KEY_BASE "\\keytest1 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest1"); - ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); + ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", err); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r); ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2"); ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), - "got exit code %d\n", r); + "got exit code %d\n", err); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -144,7 +144,7 @@ static void test_add(void) ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); RegCloseKey(subkey); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3"); - ok(err == ERROR_SUCCESS, "got exit code %d\n", r); + ok(err == ERROR_SUCCESS, "got exit code %d\n", err); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest4 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -152,7 +152,7 @@ static void test_add(void) ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); RegCloseKey(subkey); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4"); - ok(err == ERROR_SUCCESS, "got exit code %d\n", r); + ok(err == ERROR_SUCCESS, "got exit code %d\n", err); /* REG_NONE */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v none0 /d deadbeef /t REG_NONE /f", &r);
1
0
0
0
Hugh McMaster : reg/tests: Add Unicode tests for comment parsing.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: 896c5205d96c7f4b62e507ebeb974cd7d5f372e4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=896c5205d96c7f4b62e507ebe…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Wed Dec 7 08:48:22 2016 +0000 reg/tests: Add Unicode tests for comment parsing. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/reg/tests/reg.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index b9d446d..f19f6f7 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -1246,6 +1246,82 @@ static void test_import(void) todo_wine verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0); todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine10"); + todo_wine verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0); + todo_wine verify_reg_nonexist(hkey, "Wine12"); + dword = 0x2040608; + todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine14"); + todo_wine verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0); + todo_wine verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Comment1"); + todo_wine verify_reg_nonexist(hkey, "Comment2"); + todo_wine verify_reg_nonexist(hkey, "Comment3"); + todo_wine verify_reg_nonexist(hkey, "Comment4"); + todo_wine verify_reg_nonexist(hkey, "Wine18"); + todo_wine verify_reg_nonexist(hkey, "Comment5"); + todo_wine verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, TODO_REG_SIZE|TODO_REG_DATA); + todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine20"); + todo_wine verify_reg_nonexist(hkey, "Wine21"); + todo_wine verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0); + todo_wine verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0); + todo_wine verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0); + todo_wine verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0); + todo_wine verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0); + todo_wine verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0); + todo_wine verify_reg_nonexist(hkey, "Wine28"); + todo_wine verify_reg_nonexist(hkey, "Wine29"); + todo_wine verify_reg_nonexist(hkey, "Wine30"); + dword = 0x00000004; + todo_wine verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0); + err = RegCloseKey(hkey); todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
1
0
0
0
Hugh McMaster : reg/tests: Add tests for parsing comments.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: 0a827326b03c87d3542528cc3c70b1ee178c9c3b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0a827326b03c87d3542528cc3…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Wed Dec 7 08:48:10 2016 +0000 reg/tests: Add tests for parsing comments. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/reg/tests/reg.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index cbd4149..b9d446d 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -988,6 +988,82 @@ static void test_import(void) todo_wine verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0); todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine10"); + todo_wine verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0); + todo_wine verify_reg_nonexist(hkey, "Wine12"); + dword = 0x2040608; + todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine14"); + todo_wine verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0); + todo_wine verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Comment1"); + todo_wine verify_reg_nonexist(hkey, "Comment2"); + todo_wine verify_reg_nonexist(hkey, "Comment3"); + todo_wine verify_reg_nonexist(hkey, "Comment4"); + todo_wine verify_reg_nonexist(hkey, "Wine18"); + todo_wine verify_reg_nonexist(hkey, "Comment5"); + todo_wine verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, TODO_REG_SIZE|TODO_REG_DATA); + todo_wine 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); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + todo_wine verify_reg_nonexist(hkey, "Wine20"); + todo_wine verify_reg_nonexist(hkey, "Wine21"); + todo_wine verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0); + todo_wine verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0); + todo_wine verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0); + todo_wine verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0); + todo_wine verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0); + todo_wine verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0); + todo_wine verify_reg_nonexist(hkey, "Wine28"); + todo_wine verify_reg_nonexist(hkey, "Wine29"); + todo_wine verify_reg_nonexist(hkey, "Wine30"); + dword = 0x00000004; + todo_wine verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0); + err = RegCloseKey(hkey); todo_wine ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
1
0
0
0
Hugh McMaster : reg/tests: Add verify_reg_nonexist helper function.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: be3a4c26137dcfe81c80de7aca834f96dea45515 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=be3a4c26137dcfe81c80de7ac…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Wed Dec 7 08:47:58 2016 +0000 reg/tests: Add verify_reg_nonexist helper function. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/reg/tests/reg.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 6447d45..cbd4149 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -81,6 +81,16 @@ static void verify_reg_(unsigned line, HKEY hkey, const char* value, lok(memcmp(data, exp_data, size) == 0, "got wrong data\n"); } +#define verify_reg_nonexist(k,v) verify_reg_nonexist_(__LINE__,k,v) +static void verify_reg_nonexist_(unsigned line, HKEY hkey, const char *value) +{ + LONG err; + + err = RegQueryValueExA(hkey, value, NULL, NULL, NULL, NULL); + lok(err == ERROR_FILE_NOT_FOUND, "registry value '%s' shouldn't exist; got %d, expected 2\n", + value, err); +} + static void test_add(void) { HKEY hkey, subkey; @@ -499,18 +509,15 @@ static void test_delete(void) 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); - err = RegQueryValueExA(hkey, "bar", NULL, NULL, NULL, NULL); - ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + 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); - err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL); - ok(err == ERROR_FILE_NOT_FOUND, "got %d, expected 2\n", err); + 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); - err = RegQueryValueExA(hkey, "foo", NULL, NULL, NULL, NULL); - ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + verify_reg_nonexist(hkey, "foo"); err = RegOpenKeyExA(hkey, "subkey", 0, KEY_READ, &hsubkey); ok(err == ERROR_SUCCESS, "got %d\n", err); RegCloseKey(hsubkey);
1
0
0
0
Nikolay Sivov : scrrun: Added IProvideClassInfo support for filesystem objects.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: eda5d61c543522c637682a40bb461fab44c9c0ca URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eda5d61c543522c637682a40b…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Dec 7 13:33:59 2016 +0300 scrrun: Added IProvideClassInfo support for filesystem objects. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/scrrun/filesystem.c | 110 ++++++++++++++++++++++++++++++++--------- dlls/scrrun/tests/filesystem.c | 36 ++++++++++++++ 2 files changed, 122 insertions(+), 24 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=eda5d61c543522c637682…
1
0
0
0
Nikolay Sivov : scrrun: Added IProvideClassInfo support for dictionary.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: ba2e6fb2bec63a0ecb23c29b4f0d61ba57dc8c33 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ba2e6fb2bec63a0ecb23c29b4…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Dec 7 13:33:58 2016 +0300 scrrun: Added IProvideClassInfo support for dictionary. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/scrrun/dictionary.c | 8 ++++- dlls/scrrun/scrrun.c | 77 ++++++++++++++++++++++++++++++++++++++++-- dlls/scrrun/scrrun_private.h | 8 +++++ dlls/scrrun/tests/dictionary.c | 27 +++++++++++++++ 4 files changed, 116 insertions(+), 4 deletions(-) diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c index 3c8fc82..7ebf4a4 100644 --- a/dlls/scrrun/dictionary.c +++ b/dlls/scrrun/dictionary.c @@ -65,6 +65,7 @@ struct keyitem_pair { typedef struct { + struct provideclassinfo classinfo; IDictionary IDictionary_iface; LONG ref; @@ -386,6 +387,10 @@ static HRESULT WINAPI dictionary_QueryInterface(IDictionary *iface, REFIID riid, { *obj = &This->IDictionary_iface; } + else if (IsEqualIID(riid, &IID_IProvideClassInfo)) + { + *obj = &This->classinfo.IProvideClassInfo_iface; + } else if ( IsEqualGUID( riid, &IID_IDispatchEx )) { TRACE("Interface IDispatchEx not supported - returning NULL\n"); @@ -404,7 +409,7 @@ static HRESULT WINAPI dictionary_QueryInterface(IDictionary *iface, REFIID riid, return E_NOINTERFACE; } - IDictionary_AddRef(iface); + IUnknown_AddRef((IUnknown*)*obj); return S_OK; } @@ -901,6 +906,7 @@ HRESULT WINAPI Dictionary_CreateInstance(IClassFactory *factory,IUnknown *outer, list_init(&This->notifier); memset(This->buckets, 0, sizeof(This->buckets)); + init_classinfo(&CLSID_Dictionary, (IUnknown *)&This->IDictionary_iface, &This->classinfo); *obj = &This->IDictionary_iface; return S_OK; diff --git a/dlls/scrrun/scrrun.c b/dlls/scrrun/scrrun.c index 5201f1f..42b62b6 100644 --- a/dlls/scrrun/scrrun.c +++ b/dlls/scrrun/scrrun.c @@ -23,6 +23,7 @@ #include "windef.h" #include "winbase.h" #include "ole2.h" +#include "olectl.h" #include "rpcproxy.h" #include <initguid.h> @@ -35,6 +36,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(scrrun); static HINSTANCE scrrun_instance; +static inline struct provideclassinfo *impl_from_IProvideClassInfo(IProvideClassInfo *iface) +{ + return CONTAINING_RECORD(iface, struct provideclassinfo, IProvideClassInfo_iface); +} + typedef HRESULT (*fnCreateInstance)(LPVOID *ppObj); static HRESULT WINAPI scrruncf_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppv ) @@ -118,6 +124,9 @@ static HRESULT load_typelib(void) HRESULT hres; ITypeLib *tl; + if(typelib) + return S_OK; + hres = LoadRegTypeLib(&LIBID_Scripting, 1, 0, LOCALE_SYSTEM_DEFAULT, &tl); if(FAILED(hres)) { ERR("LoadRegTypeLib failed: %08x\n", hres); @@ -129,13 +138,21 @@ static HRESULT load_typelib(void) return hres; } +static HRESULT get_typeinfo_of_guid(const GUID *guid, ITypeInfo **tinfo) +{ + HRESULT hres; + + if(FAILED(hres = load_typelib())) + return hres; + + return ITypeLib_GetTypeInfoOfGuid(typelib, guid, tinfo); +} + HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) { HRESULT hres; - if (!typelib) - hres = load_typelib(); - if (!typelib) + if (FAILED(hres = load_typelib())) return hres; if(!typeinfos[tid]) { @@ -170,6 +187,60 @@ static void release_typelib(void) ITypeLib_Release(typelib); } +static HRESULT WINAPI provideclassinfo_QueryInterface(IProvideClassInfo *iface, REFIID riid, void **obj) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IProvideClassInfo)) { + *obj = iface; + IProvideClassInfo_AddRef(iface); + return S_OK; + } + else + return IUnknown_QueryInterface(This->outer, riid, obj); + + *obj = NULL; + WARN("interface %s not supported\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI provideclassinfo_AddRef(IProvideClassInfo *iface) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + return IUnknown_AddRef(This->outer); +} + +static ULONG WINAPI provideclassinfo_Release(IProvideClassInfo *iface) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + return IUnknown_Release(This->outer); +} + +static HRESULT WINAPI provideclassinfo_GetClassInfo(IProvideClassInfo *iface, ITypeInfo **ti) +{ + struct provideclassinfo *This = impl_from_IProvideClassInfo(iface); + + TRACE("(%p)->(%p)\n", This, ti); + + return get_typeinfo_of_guid(This->guid, ti); +} + +static const IProvideClassInfoVtbl provideclassinfovtbl = { + provideclassinfo_QueryInterface, + provideclassinfo_AddRef, + provideclassinfo_Release, + provideclassinfo_GetClassInfo +}; + +void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo) +{ + classinfo->IProvideClassInfo_iface.lpVtbl = &provideclassinfovtbl; + classinfo->outer = outer; + classinfo->guid = guid; +} + BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { TRACE("%p, %u, %p\n", hinst, reason, reserved); diff --git a/dlls/scrrun/scrrun_private.h b/dlls/scrrun/scrrun_private.h index 43b20a9..e2023f9 100644 --- a/dlls/scrrun/scrrun_private.h +++ b/dlls/scrrun/scrrun_private.h @@ -38,6 +38,14 @@ typedef enum tid_t HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN; +struct provideclassinfo { + IProvideClassInfo IProvideClassInfo_iface; + IUnknown *outer; + const GUID *guid; +}; + +extern void init_classinfo(const GUID *guid, IUnknown *outer, struct provideclassinfo *classinfo) DECLSPEC_HIDDEN; + static inline void *heap_alloc(size_t len) { return HeapAlloc(GetProcessHeap(), 0, len); diff --git a/dlls/scrrun/tests/dictionary.c b/dlls/scrrun/tests/dictionary.c index a94782f..78922b7 100644 --- a/dlls/scrrun/tests/dictionary.c +++ b/dlls/scrrun/tests/dictionary.c @@ -30,6 +30,31 @@ #include "scrrun.h" +#define test_provideclassinfo(a, b) _test_provideclassinfo((IDispatch*)a, b, __LINE__) +static void _test_provideclassinfo(IDispatch *disp, const GUID *guid, int line) +{ + IProvideClassInfo *classinfo; + TYPEATTR *attr; + ITypeInfo *ti; + HRESULT hr; + + hr = IDispatch_QueryInterface(disp, &IID_IProvideClassInfo, (void **)&classinfo); + ok_(__FILE__,line) (hr == S_OK, "Failed to get IProvideClassInfo, %#x.\n", hr); + + hr = IProvideClassInfo_GetClassInfo(classinfo, &ti); + ok_(__FILE__,line) (hr == S_OK, "GetClassInfo() failed, %#x.\n", hr); + + hr = ITypeInfo_GetTypeAttr(ti, &attr); + ok_(__FILE__,line) (hr == S_OK, "GetTypeAttr() failed, %#x.\n", hr); + + ok_(__FILE__,line) (IsEqualGUID(&attr->guid, guid), "Unexpected typeinfo %s, expected %s\n", wine_dbgstr_guid(&attr->guid), + wine_dbgstr_guid(guid)); + + IProvideClassInfo_Release(classinfo); + ITypeInfo_ReleaseTypeAttr(ti, attr); + ITypeInfo_Release(ti); +} + static void test_interfaces(void) { static const WCHAR key_add[] = {'a', 0}; @@ -60,6 +85,8 @@ static void test_interfaces(void) hr = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); ok(hr == E_NOINTERFACE, "got 0x%08x, expected 0x%08x\n", hr, E_NOINTERFACE); + test_provideclassinfo(disp, &CLSID_Dictionary); + V_VT(&key) = VT_BSTR; V_BSTR(&key) = SysAllocString(key_add); V_VT(&value) = VT_BSTR;
1
0
0
0
Nikolay Sivov : scrrun: Improved tracing of IDictionary methods.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: 62cb1f8d6fea65259425363ea25fc332d403535f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=62cb1f8d6fea65259425363ea…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Dec 7 13:33:57 2016 +0300 scrrun: Improved tracing of IDictionary methods. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/scrrun/dictionary.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c index 844b4d1..3c8fc82 100644 --- a/dlls/scrrun/dictionary.c +++ b/dlls/scrrun/dictionary.c @@ -240,19 +240,19 @@ static HRESULT WINAPI dict_enum_QueryInterface(IEnumVARIANT *iface, REFIID riid, static ULONG WINAPI dict_enum_AddRef(IEnumVARIANT *iface) { struct dictionary_enum *This = impl_from_IEnumVARIANT(iface); - TRACE("(%p)\n", This); - return InterlockedIncrement(&This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%u)\n", This, ref); + return ref; } static ULONG WINAPI dict_enum_Release(IEnumVARIANT *iface) { struct dictionary_enum *This = impl_from_IEnumVARIANT(iface); - LONG ref; + LONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p)\n", This); + TRACE("(%p)->(%u)\n", This, ref); - ref = InterlockedDecrement(&This->ref); - if(ref == 0) { + if (!ref) { list_remove(&This->notify); IDictionary_Release(&This->dict->IDictionary_iface); heap_free(This); @@ -411,20 +411,21 @@ static HRESULT WINAPI dictionary_QueryInterface(IDictionary *iface, REFIID riid, static ULONG WINAPI dictionary_AddRef(IDictionary *iface) { dictionary *This = impl_from_IDictionary(iface); - TRACE("(%p)\n", This); + ULONG ref = InterlockedIncrement(&This->ref); - return InterlockedIncrement(&This->ref); + TRACE("(%p)->(%u)\n", This, ref); + + return ref; } static ULONG WINAPI dictionary_Release(IDictionary *iface) { dictionary *This = impl_from_IDictionary(iface); - LONG ref; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p)\n", This); + TRACE("(%p)->(%u)\n", This, ref); - ref = InterlockedDecrement(&This->ref); - if(ref == 0) { + if (!ref) { IDictionary_RemoveAll(iface); heap_free(This); } @@ -436,7 +437,7 @@ static HRESULT WINAPI dictionary_GetTypeInfoCount(IDictionary *iface, UINT *pcti { dictionary *This = impl_from_IDictionary(iface); - TRACE("(%p)->()\n", This); + TRACE("(%p)->(%p)\n", This, pctinfo); *pctinfo = 1; return S_OK; @@ -885,7 +886,7 @@ HRESULT WINAPI Dictionary_CreateInstance(IClassFactory *factory,IUnknown *outer, { dictionary *This; - TRACE("(%p)\n", obj); + TRACE("(%p, %p, %s, %p)\n", factory, outer, debugstr_guid(riid), obj); *obj = NULL;
1
0
0
0
Hans Leidekker : setupapi/tests: Clean up properly after each device test.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: c84080fb5977284bfd1429ce6ea602fdd33ecab6 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c84080fb5977284bfd1429ce6…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Dec 7 11:03:01 2016 +0100 setupapi/tests: Clean up properly after each device test. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/setupapi/tests/devinst.c | 405 +++++++++++------------------------------- 1 file changed, 100 insertions(+), 305 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=c84080fb5977284bfd142…
1
0
0
0
Hans Leidekker : setupapi: Add a stub implementation of SetupDiRemoveDeviceInterface.
by Alexandre Julliard
07 Dec '16
07 Dec '16
Module: wine Branch: master Commit: cdb72f3997174afeb9bc6a8ecafc5de7b5d25afa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cdb72f3997174afeb9bc6a8ec…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Wed Dec 7 11:03:00 2016 +0100 setupapi: Add a stub implementation of SetupDiRemoveDeviceInterface. Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/setupapi/devinst.c | 10 ++++++++++ dlls/setupapi/setupapi.spec | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index ef1a6b7..63e578c 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -1561,6 +1561,16 @@ BOOL WINAPI SetupDiRemoveDevice( } /*********************************************************************** + * SetupDiRemoveDeviceInterface (SETUPAPI.@) + */ +BOOL WINAPI SetupDiRemoveDeviceInterface(HDEVINFO info, PSP_DEVICE_INTERFACE_DATA data) +{ + FIXME("(%p, %p): stub\n", info, data); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** * SetupDiEnumDeviceInfo (SETUPAPI.@) */ BOOL WINAPI SetupDiEnumDeviceInfo( diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec index da6bf5d..0eb8359 100644 --- a/dlls/setupapi/setupapi.spec +++ b/dlls/setupapi/setupapi.spec @@ -381,7 +381,7 @@ @ stdcall SetupDiOpenDeviceInterfaceW(ptr wstr long ptr) @ stdcall SetupDiRegisterDeviceInfo(ptr ptr long ptr ptr ptr) @ stdcall SetupDiRemoveDevice(ptr ptr) -@ stub SetupDiRemoveDeviceInterface +@ stdcall SetupDiRemoveDeviceInterface(ptr ptr) @ stdcall SetupDiSelectBestCompatDrv(ptr ptr) @ stub SetupDiSelectDevice @ stub SetupDiSelectOEMDrv
1
0
0
0
Hans Leidekker : bcrypt/tests: Add BcryptEncrypt/Decrypt tests.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: fd8f32aa8e0c34b8960246c41915874ce6316f71 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fd8f32aa8e0c34b8960246c41…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Dec 2 18:36:43 2016 -0200 bcrypt/tests: Add BcryptEncrypt/Decrypt tests. Signed-off-by: Bruno Jesus <00cpxxx(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/tests/bcrypt.c | 173 +++++++++++++++++++++++++++++++++++++++++++++ include/bcrypt.h | 3 + 2 files changed, 176 insertions(+) diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index ae7432e..3e41335 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -916,6 +916,177 @@ static void test_BCryptGenerateSymmetricKey(void) ok(ret == STATUS_SUCCESS, "got %08x\n", ret); } +static void test_BCryptEncrypt(void) +{ + static UCHAR secret[] = + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; + static UCHAR iv[] = + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; + static UCHAR data[] = + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10}; + static UCHAR expected[] = + {0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79}; + static UCHAR expected2[] = + {0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79, + 0x28,0x73,0x3d,0xef,0x84,0x8f,0xb0,0xa6,0x5d,0x1a,0x51,0xb7,0xec,0x8f,0xea,0xe9}; + BCRYPT_ALG_HANDLE aes; + BCRYPT_KEY_HANDLE key; + UCHAR *buf, ciphertext[32], ivbuf[16]; + ULONG size, len, i; + NTSTATUS ret; + + ret = pBCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0); + if (ret != STATUS_SUCCESS) /* remove whole IF when Wine is fixed */ + { + todo_wine ok(0, "AES provider not available\n"); + return; + } + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + len = 0xdeadbeef; + size = sizeof(len); + ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); + ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + /* input size is a multiple of block size */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, NULL, 0, &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(size == 16, "got %u\n", size); + + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + memset(ciphertext, 0, sizeof(ciphertext)); + ret = pBCryptEncrypt(key, data, 16, NULL, ivbuf, 16, ciphertext, 16, &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(size == 16, "got %u\n", size); + ok(!memcmp(ciphertext, expected, sizeof(expected)), "wrong data\n"); + for (i = 0; i < 16; i++) + ok(ciphertext[i] == expected[i], "%u: %02x != %02x\n", i, ciphertext[i], expected[i]); + + /* input size is not a multiple of block size */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, NULL, 0, &size, 0); + ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret); + ok(size == 17, "got %u\n", size); + + /* input size is not a multiple of block size, block padding set */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(size == 32, "got %u\n", size); + + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + memset(ciphertext, 0, sizeof(ciphertext)); + ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, ciphertext, 32, &size, BCRYPT_BLOCK_PADDING); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(size == 32, "got %u\n", size); + ok(!memcmp(ciphertext, expected2, sizeof(expected2)), "wrong data\n"); + for (i = 0; i < 32; i++) + ok(ciphertext[i] == expected2[i], "%u: %02x != %02x\n", i, ciphertext[i], expected2[i]); + + /* output size too small */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + memset(ciphertext, 0, sizeof(ciphertext)); + ret = pBCryptEncrypt(key, data, 17, NULL, ivbuf, 16, ciphertext, 31, &size, BCRYPT_BLOCK_PADDING); + ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret); + ok(size == 32, "got %u\n", size); + + ret = pBCryptDestroyKey(key); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + HeapFree(GetProcessHeap(), 0, buf); + + ret = pBCryptCloseAlgorithmProvider(aes, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); +} + +static void test_BCryptDecrypt(void) +{ + static UCHAR secret[] = + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; + static UCHAR iv[] = + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; + static UCHAR expected[] = + {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f}; + static UCHAR ciphertext[32] = + {0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79, + 0x28,0x73,0x3d,0xef,0x84,0x8f,0xb0,0xa6,0x5d,0x1a,0x51,0xb7,0xec,0x8f,0xea,0xe9}; + BCRYPT_ALG_HANDLE aes; + BCRYPT_KEY_HANDLE key; + UCHAR *buf, plaintext[32], ivbuf[16]; + ULONG size, len; + NTSTATUS ret; + + ret = pBCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0); + if (ret != STATUS_SUCCESS) /* remove whole IF when Wine is fixed */ + { + todo_wine ok(0, "AES provider not available\n"); + return; + } + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + len = 0xdeadbeef; + size = sizeof(len); + ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); + ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + /* input size is a multiple of block size */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, NULL, 0, &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(size == 32, "got %u\n", size); + + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + memset(plaintext, 0, sizeof(plaintext)); + ret = pBCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, plaintext, 32, &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(size == 32, "got %u\n", size); + ok(!memcmp(plaintext, expected, sizeof(expected)), "wrong data\n"); + + /* output size too small */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptDecrypt(key, ciphertext, 32, NULL, ivbuf, 16, plaintext, 31, &size, 0); + ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret); + ok(size == 32, "got %u\n", size); + + /* input size is not a multiple of block size */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptDecrypt(key, ciphertext, 17, NULL, ivbuf, 16, NULL, 0, &size, 0); + ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret); + ok(size == 17 || broken(size == 0 /* Win < 7 */), "got %u\n", size); + + /* input size is not a multiple of block size, block padding set */ + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptDecrypt(key, ciphertext, 17, NULL, ivbuf, 16, NULL, 0, &size, BCRYPT_BLOCK_PADDING); + ok(ret == STATUS_INVALID_BUFFER_SIZE, "got %08x\n", ret); + ok(size == 17 || broken(size == 0 /* Win < 7 */), "got %u\n", size); + + ret = pBCryptDestroyKey(key); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + HeapFree(GetProcessHeap(), 0, buf); + + ret = pBCryptCloseAlgorithmProvider(aes, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); +} + START_TEST(bcrypt) { HMODULE module; @@ -953,6 +1124,8 @@ START_TEST(bcrypt) test_rng(); test_aes(); test_BCryptGenerateSymmetricKey(); + test_BCryptEncrypt(); + test_BCryptDecrypt(); if (pBCryptHash) /* >= Win 10 */ test_BcryptHash(); diff --git a/include/bcrypt.h b/include/bcrypt.h index e327a65..05d0691 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -94,6 +94,9 @@ typedef PVOID BCRYPT_HASH_HANDLE; /* Flags for BCryptOpenAlgorithmProvider */ #define BCRYPT_ALG_HANDLE_HMAC_FLAG 0x00000008 +/* Flags for BCryptEncrypt/BCryptDecrypt */ +#define BCRYPT_BLOCK_PADDING 0x00000001 + NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG); NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
1
0
0
0
← Newer
1
...
22
23
24
25
26
27
28
...
35
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
25
26
27
28
29
30
31
32
33
34
35
Results per page:
10
25
50
100
200