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
Hans Leidekker : bcrypt/tests: Add BCryptGenerateSymmetricKey tests.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: 63852e6ac48ccd712acdc9deeefa62e06b654911 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=63852e6ac48ccd712acdc9dee…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Dec 2 18:36:42 2016 -0200 bcrypt/tests: Add BCryptGenerateSymmetricKey tests. Signed-off-by: Bruno Jesus <00cpxxx(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/tests/bcrypt.c | 103 ++++++++++++++++++++++++++++++++++++++++++++- include/bcrypt.h | 9 ++++ 2 files changed, 111 insertions(+), 1 deletion(-) diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 2de1bb3..ae7432e 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -29,13 +29,22 @@ static NTSTATUS (WINAPI *pBCryptOpenAlgorithmProvider)(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG); static NTSTATUS (WINAPI *pBCryptCloseAlgorithmProvider)(BCRYPT_ALG_HANDLE, ULONG); static NTSTATUS (WINAPI *pBCryptGetFipsAlgorithmMode)(BOOLEAN *); -static NTSTATUS (WINAPI *pBCryptCreateHash)(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG); +static NTSTATUS (WINAPI *pBCryptCreateHash)(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, + ULONG, ULONG); static NTSTATUS (WINAPI *pBCryptHash)(BCRYPT_ALG_HANDLE, UCHAR *, ULONG, UCHAR *, ULONG, UCHAR *, ULONG); static NTSTATUS (WINAPI *pBCryptHashData)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); static NTSTATUS (WINAPI *pBCryptFinishHash)(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); static NTSTATUS (WINAPI *pBCryptDestroyHash)(BCRYPT_HASH_HANDLE); static NTSTATUS (WINAPI *pBCryptGenRandom)(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG); static NTSTATUS (WINAPI *pBCryptGetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG); +static NTSTATUS (WINAPI *pBCryptSetProperty)(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG); +static NTSTATUS (WINAPI *pBCryptGenerateSymmetricKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, + PUCHAR, ULONG, ULONG); +static NTSTATUS (WINAPI *pBCryptEncrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, + ULONG *, ULONG); +static NTSTATUS (WINAPI *pBCryptDecrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, + ULONG *, ULONG); +static NTSTATUS (WINAPI *pBCryptDestroyKey)(BCRYPT_KEY_HANDLE); static void test_BCryptGenRandom(void) { @@ -821,6 +830,92 @@ todo_wine { } } +static void test_BCryptGenerateSymmetricKey(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}; + static UCHAR expected[] = + {0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79}; + BCRYPT_ALG_HANDLE aes; + BCRYPT_KEY_HANDLE key; + UCHAR *buf, ciphertext[16], plaintext[16], 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 = size = 0xdeadbeef; + ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + key = NULL; + 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); + ok(key != NULL, "key not set\n"); + + ret = pBCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC, + sizeof(BCRYPT_CHAIN_MODE_CBC), 0); + todo_wine ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + + size = 0xdeadbeef; + ret = pBCryptEncrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(!size, "got %u\n", 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]); + + size = 0xdeadbeef; + ret = pBCryptDecrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(!size, "got %u\n", size); + + size = 0; + memcpy(ivbuf, iv, sizeof(iv)); + ret = pBCryptDecrypt(key, ciphertext, 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(plaintext, 0, sizeof(plaintext)); + ret = pBCryptDecrypt(key, ciphertext, 16, NULL, ivbuf, 16, plaintext, 16, &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(size == 16, "got %u\n", size); + ok(!memcmp(plaintext, data, sizeof(data)), "wrong data\n"); + + 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; @@ -842,6 +937,11 @@ START_TEST(bcrypt) pBCryptDestroyHash = (void *)GetProcAddress(module, "BCryptDestroyHash"); pBCryptGenRandom = (void *)GetProcAddress(module, "BCryptGenRandom"); pBCryptGetProperty = (void *)GetProcAddress(module, "BCryptGetProperty"); + pBCryptSetProperty = (void *)GetProcAddress(module, "BCryptSetProperty"); + pBCryptGenerateSymmetricKey = (void *)GetProcAddress(module, "BCryptGenerateSymmetricKey"); + pBCryptEncrypt = (void *)GetProcAddress(module, "BCryptEncrypt"); + pBCryptDecrypt = (void *)GetProcAddress(module, "BCryptDecrypt"); + pBCryptDestroyKey = (void *)GetProcAddress(module, "BCryptDestroyKey"); test_BCryptGenRandom(); test_BCryptGetFipsAlgorithmMode(); @@ -852,6 +952,7 @@ START_TEST(bcrypt) test_md5(); test_rng(); test_aes(); + test_BCryptGenerateSymmetricKey(); if (pBCryptHash) /* >= Win 10 */ test_BcryptHash(); diff --git a/include/bcrypt.h b/include/bcrypt.h index e7c6280..e327a65 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -83,23 +83,32 @@ typedef struct _BCRYPT_ALGORITHM_IDENTIFIER } BCRYPT_ALGORITHM_IDENTIFIER; typedef PVOID BCRYPT_ALG_HANDLE; +typedef PVOID BCRYPT_KEY_HANDLE; typedef PVOID BCRYPT_HANDLE; typedef PVOID BCRYPT_HASH_HANDLE; +/* Flags for BCryptGenRandom */ #define BCRYPT_RNG_USE_ENTROPY_IN_BUFFER 0x00000001 #define BCRYPT_USE_SYSTEM_PREFERRED_RNG 0x00000002 + +/* Flags for BCryptOpenAlgorithmProvider */ #define BCRYPT_ALG_HANDLE_HMAC_FLAG 0x00000008 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); NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE); +NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE); +NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG); NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG); NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); +NTSTATUS WINAPI BCryptGenerateSymmetricKey(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *); NTSTATUS WINAPI BCryptGetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG); NTSTATUS WINAPI BCryptHash(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCHAR, ULONG); NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG); NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG); +NTSTATUS WINAPI BCryptSetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG); #endif /* __WINE_BCRYPT_H */
1
0
0
0
Hans Leidekker : bcrypt/tests: Add AES provider tests.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: 9fcdc5ec7538dd92598291520fe5b8ea19b8b100 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=9fcdc5ec7538dd92598291520…
Author: Hans Leidekker <hans(a)codeweavers.com> Date: Fri Dec 2 18:36:41 2016 -0200 bcrypt/tests: Add AES provider tests. Signed-off-by: Bruno Jesus <00cpxxx(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/tests/bcrypt.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++ include/bcrypt.h | 5 ++++ 2 files changed, 62 insertions(+) diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 42a20be..2de1bb3 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -765,6 +765,62 @@ static void test_rng(void) ok(ret == STATUS_SUCCESS, "got %08x\n", ret); } +static void test_aes(void) +{ + BCRYPT_ALG_HANDLE alg; + ULONG size, len; + UCHAR mode[64]; + NTSTATUS ret; +todo_wine { + alg = NULL; + ret = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_AES_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(alg != NULL, "alg not set\n"); + + len = size = 0; + ret = pBCryptGetProperty(alg, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + if (sizeof(void *) == 4) + { + ok(len == 618 /* >= Win 8 */ + || broken(len == 610) /* Win 7 */ + || broken(len == 582) /* < Win 7 */, + "got %u\n", len); + ok(size == sizeof(len), "got %u\n", size); + } + else + { + ok(len == 654 /* >= Win 8 */ + || broken(len == 622) /* Win 7 */ + || broken(len == 598) /* < Win 7 */, + "got %u\n", len); + ok(size == sizeof(len), "got %u\n", size); + } + + len = size = 0; + ret = pBCryptGetProperty(alg, BCRYPT_BLOCK_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(len == 16, "got %u\n", len); + ok(size == sizeof(len), "got %u\n", size); + + size = 0; + ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, 0, &size, 0); + ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret); + ok(size == 64, "got %u\n", size); + + size = 0; + ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); + ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "got %s\n", mode); + ok(size == 64, "got %u\n", size); + + test_alg_name(alg, "AES"); + + ret = pBCryptCloseAlgorithmProvider(alg, 0); + ok(ret == STATUS_SUCCESS, "got %08x\n", ret); +} +} + START_TEST(bcrypt) { HMODULE module; @@ -795,6 +851,7 @@ START_TEST(bcrypt) test_sha512(); test_md5(); test_rng(); + test_aes(); if (pBCryptHash) /* >= Win 10 */ test_BcryptHash(); diff --git a/include/bcrypt.h b/include/bcrypt.h index c521bcc..e7c6280 100644 --- a/include/bcrypt.h +++ b/include/bcrypt.h @@ -63,6 +63,7 @@ typedef LONG NTSTATUS; #define MS_PLATFORM_CRYPTO_PROVIDER (const WCHAR [])\ {'M','i','c','r','o','s','o','f','t',' ','P','l','a','t','f','o','r','m',' ','C','r','y','p','t','o',' ','P','r','o','v','i','d','e','r',0} +#define BCRYPT_AES_ALGORITHM (const WCHAR []){'A','E','S',0} #define BCRYPT_MD5_ALGORITHM (const WCHAR []){'M','D','5',0} #define BCRYPT_RNG_ALGORITHM (const WCHAR []){'R','N','G',0} #define BCRYPT_SHA1_ALGORITHM (const WCHAR []){'S','H','A','1',0} @@ -70,6 +71,10 @@ typedef LONG NTSTATUS; #define BCRYPT_SHA384_ALGORITHM (const WCHAR []){'S','H','A','3','8','4',0} #define BCRYPT_SHA512_ALGORITHM (const WCHAR []){'S','H','A','5','1','2',0} +#define BCRYPT_CHAIN_MODE_NA (const WCHAR []){'C','h','a','i','n','i','n','g','M','o','d','e','N','/','A',0} +#define BCRYPT_CHAIN_MODE_CBC (const WCHAR []){'C','h','a','i','n','i','n','g','M','o','d','e','C','B','C',0} +#define BCRYPT_CHAIN_MODE_ECB (const WCHAR []){'C','h','a','i','n','i','n','g','M','o','d','e','E','C','B',0} + typedef struct _BCRYPT_ALGORITHM_IDENTIFIER { LPWSTR pszName;
1
0
0
0
Bruno Jesus : bcrypt/tests: Normalize all tests to use function pointers.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: 8d8936cbb6fea3cac862e059e814527f5361f48b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8d8936cbb6fea3cac862e059e…
Author: Bruno Jesus <00cpxxx(a)gmail.com> Date: Fri Dec 2 18:36:40 2016 -0200 bcrypt/tests: Normalize all tests to use function pointers. Signed-off-by: Bruno Jesus <00cpxxx(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/tests/bcrypt.c | 267 ++++++++++++++++++++++++--------------------- 1 file changed, 145 insertions(+), 122 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=8d8936cbb6fea3cac862e…
1
0
0
0
Bruno Jesus : bcrypt/tests: Workaround RegGetValueW not being present in XP.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: b5e5be13d20adff5d7b784e71c7a48fb95fde2c8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b5e5be13d20adff5d7b784e71…
Author: Bruno Jesus <00cpxxx(a)gmail.com> Date: Fri Dec 2 18:36:39 2016 -0200 bcrypt/tests: Workaround RegGetValueW not being present in XP. Signed-off-by: Bruno Jesus <00cpxxx(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/tests/bcrypt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 5cdb065..4466179 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -75,18 +75,19 @@ static void test_BCryptGetFipsAlgorithmMode(void) 'L','s','a',0}; static const WCHAR policyValueXPW[] = { 'F','I','P','S','A','l','g','o','r','i','t','h','m','P','o','l','i','c','y',0}; + HKEY hkey = NULL; BOOLEAN expected; BOOLEAN enabled; DWORD value, count[2] = {sizeof(value), sizeof(value)}; NTSTATUS ret; - if (!RegGetValueW(HKEY_LOCAL_MACHINE, policyKeyVistaW, policyValueVistaW, - RRF_RT_REG_DWORD, NULL, &value, &count[0])) + if (RegOpenKeyW(HKEY_LOCAL_MACHINE, policyKeyVistaW, &hkey) == ERROR_SUCCESS && + RegQueryValueExW(hkey, policyValueVistaW, NULL, NULL, (void *)&value, &count[0]) == ERROR_SUCCESS) { expected = !!value; } - else if (!RegGetValueW(HKEY_LOCAL_MACHINE, policyKeyXPW, policyValueXPW, - RRF_RT_REG_DWORD, NULL, &value, &count[1])) + else if (RegOpenKeyW(HKEY_LOCAL_MACHINE, policyKeyXPW, &hkey) == ERROR_SUCCESS && + RegQueryValueExW(hkey, policyValueXPW, NULL, NULL, (void *)&value, &count[0]) == ERROR_SUCCESS) { expected = !!value; } @@ -96,6 +97,7 @@ static void test_BCryptGetFipsAlgorithmMode(void) todo_wine ok(0, "Neither XP or Vista key is present\n"); } + RegCloseKey(hkey); ret = BCryptGetFipsAlgorithmMode(&enabled); ok(ret == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%x\n", ret);
1
0
0
0
VRan Liu : shell32/tests: Simple test for KF_FLAG_DEFAULT_PATH.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: c64cdc1fe608faf01ca21708787839df849c0a55 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c64cdc1fe608faf01ca217087…
Author: VRan Liu <gliuwr(a)gmail.com> Date: Sun Dec 4 23:33:09 2016 +0300 shell32/tests: Simple test for KF_FLAG_DEFAULT_PATH. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/shell32/tests/shellpath.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index fa391c2..3c757ec 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -860,6 +860,12 @@ if (0) { /* crashes */ ok(path == NULL, "got %p\n", path); path = NULL; + hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, KF_FLAG_DEFAULT_PATH, NULL, &path); + ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); + ok(path != NULL, "expected path != NULL\n"); + CoTaskMemFree(path); + + path = NULL; hr = pSHGetKnownFolderPath(&FOLDERID_Desktop, 0, NULL, &path); ok(hr == S_OK, "expected S_OK, got 0x%08x\n", hr); ok(path != NULL, "expected path != NULL\n");
1
0
0
0
Nikolay Sivov : shell32: Move retrieving folder path logic to SHGetKnownFolderPath().
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: a0c259cf562b32268df86053a5e0785b1ad78cc1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a0c259cf562b32268df86053a…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Sun Dec 4 23:33:08 2016 +0300 shell32: Move retrieving folder path logic to SHGetKnownFolderPath(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/shell32/shellpath.c | 137 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 113 insertions(+), 24 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index aa2742d..1fa5f23 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -4704,45 +4704,134 @@ static int csidl_from_id( const KNOWNFOLDERID *id ) /************************************************************************* * SHGetKnownFolderPath [SHELL32.@] */ -HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, PWSTR *path) +HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE token, WCHAR **ret_path) { - HRESULT hr; - WCHAR folder[MAX_PATH]; - int index = csidl_from_id( rfid ); + WCHAR pathW[MAX_PATH], tempW[MAX_PATH]; + HRESULT hr; + CSIDL_Type type; + int ret; + int folder = csidl_from_id(rfid), shgfp_flags; - TRACE("%s, 0x%08x, %p, %p\n", debugstr_guid(rfid), flags, token, path); + TRACE("%s, 0x%08x, %p, %p\n", debugstr_guid(rfid), flags, token, ret_path); - *path = NULL; + *ret_path = NULL; - if (index < 0) + if (folder < 0) return HRESULT_FROM_WIN32( ERROR_FILE_NOT_FOUND ); - if (flags & KF_FLAG_CREATE) - index |= CSIDL_FLAG_CREATE; + if (flags & ~(KF_FLAG_CREATE|KF_FLAG_DONT_VERIFY|KF_FLAG_NO_ALIAS| + KF_FLAG_INIT|KF_FLAG_DEFAULT_PATH)) + { + FIXME("flags 0x%08x not supported\n", flags); + return E_INVALIDARG; + } + + shgfp_flags = flags & KF_FLAG_DEFAULT_PATH ? SHGFP_TYPE_DEFAULT : SHGFP_TYPE_CURRENT; + + type = CSIDL_Data[folder].type; + switch (type) + { + case CSIDL_Type_Disallowed: + hr = E_INVALIDARG; + break; + case CSIDL_Type_NonExistent: + hr = S_FALSE; + break; + case CSIDL_Type_WindowsPath: + GetWindowsDirectoryW(tempW, MAX_PATH); + if (CSIDL_Data[folder].szDefaultPath && + !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) && + *CSIDL_Data[folder].szDefaultPath) + { + PathAddBackslashW(tempW); + strcatW(tempW, CSIDL_Data[folder].szDefaultPath); + } + hr = S_OK; + break; + case CSIDL_Type_SystemPath: + GetSystemDirectoryW(tempW, MAX_PATH); + if (CSIDL_Data[folder].szDefaultPath && + !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) && + *CSIDL_Data[folder].szDefaultPath) + { + PathAddBackslashW(tempW); + strcatW(tempW, CSIDL_Data[folder].szDefaultPath); + } + hr = S_OK; + break; + case CSIDL_Type_SystemX86Path: + if (!GetSystemWow64DirectoryW(tempW, MAX_PATH)) GetSystemDirectoryW(tempW, MAX_PATH); + if (CSIDL_Data[folder].szDefaultPath && + !IS_INTRESOURCE(CSIDL_Data[folder].szDefaultPath) && + *CSIDL_Data[folder].szDefaultPath) + { + PathAddBackslashW(tempW); + strcatW(tempW, CSIDL_Data[folder].szDefaultPath); + } + hr = S_OK; + break; + case CSIDL_Type_CurrVer: + hr = _SHGetCurrentVersionPath(shgfp_flags, folder, tempW); + break; + case CSIDL_Type_User: + hr = _SHGetUserProfilePath(token, shgfp_flags, folder, tempW); + break; + case CSIDL_Type_AllUsers: + hr = _SHGetAllUsersProfilePath(shgfp_flags, folder, tempW); + break; + default: + FIXME("bogus type %d, please fix\n", type); + hr = E_INVALIDARG; + break; + } + + /* Expand environment strings if necessary */ + if (*tempW == '%') + hr = _SHExpandEnvironmentStrings(tempW, pathW); + else + strcpyW(pathW, tempW); - if (flags & KF_FLAG_DONT_VERIFY) - index |= CSIDL_FLAG_DONT_VERIFY; + if (FAILED(hr)) + goto failed; - if (flags & KF_FLAG_NO_ALIAS) - index |= CSIDL_FLAG_NO_ALIAS; + /* if we don't care about existing directories we are ready */ + if (flags & KF_FLAG_DONT_VERIFY) goto done; - if (flags & KF_FLAG_INIT) - index |= CSIDL_FLAG_PER_USER_INIT; + if (PathFileExistsW(pathW)) goto done; - if (flags & ~(KF_FLAG_CREATE|KF_FLAG_DONT_VERIFY|KF_FLAG_NO_ALIAS|KF_FLAG_INIT)) + /* Does not exist but we are not allowed to create it. The return value + * is verified against shell32 version 6.0. + */ + if (!(flags & KF_FLAG_CREATE)) { - FIXME("flags 0x%08x not supported\n", flags); - return E_INVALIDARG; + hr = HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); + goto done; } - hr = SHGetFolderPathW( NULL, index, token, 0, folder ); - if (SUCCEEDED(hr)) + /* create directory/directories */ + ret = SHCreateDirectoryExW(NULL, pathW, NULL); + if (ret && ret != ERROR_ALREADY_EXISTS) { - *path = CoTaskMemAlloc( (strlenW( folder ) + 1) * sizeof(WCHAR) ); - if (!*path) - return E_OUTOFMEMORY; - strcpyW( *path, folder ); + ERR("Failed to create directory %s.\n", debugstr_w(pathW)); + hr = E_FAIL; + goto failed; } + + TRACE("Created missing system directory %s\n", debugstr_w(pathW)); + +done: + TRACE("Final path is %s, %#x\n", debugstr_w(pathW), hr); + + *ret_path = CoTaskMemAlloc((strlenW(pathW) + 1) * sizeof(WCHAR)); + if (!*ret_path) + return E_OUTOFMEMORY; + strcpyW(*ret_path, pathW); + + return hr; + +failed: + TRACE("Failed to get folder path, %#x.\n", hr); + return hr; }
1
0
0
0
Lauri Kenttä : cmd: Fix copying when the dest is one of the sources.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: 064508c0dd7bb331d581de77bebec62db2025e57 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=064508c0dd7bb331d581de77b…
Author: Lauri Kenttä <lauri.kentta(a)gmail.com> Date: Mon Dec 5 18:53:23 2016 +0200 cmd: Fix copying when the dest is one of the sources. "COPY a+b a" appends b to a. "COPY a+b b" skips b from the sources. Signed-off-by: Lauri Kenttä <lauri.kentta(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/cmd/builtins.c | 44 ++++++++++++++++++++++++++++++-- programs/cmd/tests/test_builtins.cmd | 16 ++++++++++++ programs/cmd/tests/test_builtins.cmd.exp | 3 +++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index f82f15a..cd319f8 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -460,6 +460,36 @@ static BOOL WCMD_AppendEOF(WCHAR *filename) } /**************************************************************************** + * WCMD_IsSameFile + * + * Checks if the two paths reference to the same file + */ +static BOOL WCMD_IsSameFile(const WCHAR *name1, const WCHAR *name2) +{ + BOOL ret = FALSE; + HANDLE file1 = INVALID_HANDLE_VALUE, file2 = INVALID_HANDLE_VALUE; + BY_HANDLE_FILE_INFORMATION info1, info2; + + file1 = CreateFileW(name1, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); + if (file1 == INVALID_HANDLE_VALUE || !GetFileInformationByHandle(file1, &info1)) + goto end; + + file2 = CreateFileW(name2, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); + if (file2 == INVALID_HANDLE_VALUE || !GetFileInformationByHandle(file2, &info2)) + goto end; + + ret = info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber + && info1.nFileIndexHigh == info2.nFileIndexHigh + && info1.nFileIndexLow == info2.nFileIndexLow; +end: + if (file1 != INVALID_HANDLE_VALUE) + CloseHandle(file1); + if (file2 != INVALID_HANDLE_VALUE) + CloseHandle(file2); + return ret; +} + +/**************************************************************************** * WCMD_ManualCopy * * Copies from a file @@ -922,6 +952,7 @@ void WCMD_copy(WCHAR * args) { do { WCHAR outname[MAX_PATH]; BOOL overwrite; + BOOL appendtofirstfile = FALSE; /* Skip . and .., and directories */ if (!srcisdevice && fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { @@ -946,8 +977,14 @@ void WCMD_copy(WCHAR * args) { WINE_TRACE("Flags: srcbinary(%d), dstbinary(%d), over(%d), prompt(%d)\n", thiscopy->binarycopy, destination->binarycopy, overwrite, prompt); + if (!writtenoneconcat) { + appendtofirstfile = anyconcats && WCMD_IsSameFile(srcpath, outname); + } + /* Prompt before overwriting */ - if (!overwrite) { + if (appendtofirstfile) { + overwrite = TRUE; + } else if (!overwrite) { DWORD attributes = GetFileAttributesW(outname); if (attributes != INVALID_FILE_ATTRIBUTES) { WCHAR* question; @@ -969,7 +1006,10 @@ void WCMD_copy(WCHAR * args) { /* Do the copy as appropriate */ if (overwrite) { - if (anyconcats && writtenoneconcat) { + if (anyconcats && WCMD_IsSameFile(srcpath, outname)) { + /* Silently skip if the destination file is also a source file */ + status = TRUE; + } else if (anyconcats && writtenoneconcat) { if (thiscopy->binarycopy) { status = WCMD_ManualCopy(srcpath, outname, FALSE, TRUE); } else { diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index b49f90a..02d9750 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -2584,6 +2584,22 @@ rem Concat 2 files, default mode - (one EOF on the end 5+8+1) copy ..\file1+..\file2 file12_eof2 >nul 2>&1 call :CheckFileSize file12_eof2 14 +rem Test copying when destination is one of the sources. +rem Concat file1+file2+file3 into file1, should produce file1+file2+file3 = 24 +copy /y ..\file? .\ >nul 2>&1 +copy /y /b file1+file2+file3 file1 >nul 2>&1 +call :CheckFileSize file1 24 + +rem Concat file1+file2+file3 into file2, should produce file1+file3 = 16 +copy /y ..\file? .\ >nul 2>&1 +copy /y /b file1+file2+file3 file2 >nul 2>&1 +call :CheckFileSize file2 16 + +rem Concat file1+file2+file3 into file3, should produce file1+file2 = 13 +copy /y ..\file? .\ >nul 2>&1 +copy /y /b file1+file2+file3 file3 >nul 2>&1 +call :CheckFileSize file3 13 + rem -------------------------------------------------------------- rem Show ascii source copy stops at first EOF, binary does the lot rem -------------------------------------------------------------- diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index e81fbcb..796550e 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -1462,6 +1462,9 @@ Passed: file size check on file3_plus_eof [12]@or_broken@Skipping file size chec Passed: file size check on file12_plus_eof [14]@or_broken@Skipping file size check on NT4 Passed: file size check on file12_no_eof [13]@or_broken@Skipping file size check on NT4 Passed: file size check on file12_eof2 [14]@or_broken@Skipping file size check on NT4 +Passed: file size check on file1 [24]@or_broken@Skipping file size check on NT4 +Passed: file size check on file2 [16]@or_broken@Skipping file size check on NT4 +Passed: file size check on file3 [13]@or_broken@Skipping file size check on NT4 Passed: file size check on file1_binary_srccopy [6]@or_broken@Skipping file size check on NT4 Passed: file size check on file1_ascii_srccopy [5]@or_broken@Skipping file size check on NT4 Passed: file size check on file123_default_copy [25]@or_broken@Skipping file size check on NT4
1
0
0
0
Andrew Eikum : msacm32: Support conversion from 24-bit PCM.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: 6cc673477dd4a0749a292a6d6f604749d548fb6b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=6cc673477dd4a0749a292a6d6…
Author: Andrew Eikum <aeikum(a)codeweavers.com> Date: Mon Dec 5 11:28:25 2016 -0600 msacm32: Support conversion from 24-bit PCM. Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msacm32/pcmconverter.c | 320 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 299 insertions(+), 21 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=6cc673477dd4a0749a292…
1
0
0
0
Hugh McMaster : regedit/tests: Add more tests for parsing comments.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: eb3c4f43f66b62d17f44b21952ba0d707cac0603 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=eb3c4f43f66b62d17f44b2195…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Tue Dec 6 12:07:42 2016 +0000 regedit/tests: Add more tests for parsing comments. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/tests/regedit.c | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c index 54558b1..e09d188 100644 --- a/programs/regedit/tests/regedit.c +++ b/programs/regedit/tests/regedit.c @@ -340,6 +340,7 @@ static void test_comments(void) { LONG lr; HKEY hkey; + DWORD dword; lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); ok(lr == ERROR_SUCCESS || lr == ERROR_FILE_NOT_FOUND, "RegDeleteKeyA failed: %d\n", lr); @@ -354,6 +355,78 @@ static void test_comments(void) verify_reg(hkey, "Wine1", REG_SZ, "Line 1", 7, 0); verify_reg(hkey, "Wine2", REG_SZ, "Line 2", 7, 0); + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine3\"=\"Value 1\"#comment\n" + "\"Wine4\"=\"Value 2\";comment\n" + "\"Wine5\"=dword:01020304 #comment\n" + "\"Wine6\"=dword:02040608 ;comment\n\n"); + verify_reg_nonexist(hkey, "Wine3"); + todo_wine verify_reg(hkey, "Wine4", REG_SZ, "Value 2", 8, 0); + verify_reg_nonexist(hkey, "Wine5"); + dword = 0x2040608; + todo_wine verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0); + + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine7\"=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" + "\"Wine8\"=\"A valid line\"\n" + "\"Wine9\"=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" + "\"Wine10\"=\"Another valid line\"\n\n"); + verify_reg_nonexist(hkey, "Wine7"); + verify_reg(hkey, "Wine8", REG_SZ, "A valid line", 13, 0); + todo_wine verify_reg(hkey, "Wine9", REG_MULTI_SZ, "Line concatenation\0", 20, 0); + verify_reg(hkey, "Wine10", REG_SZ, "Another valid line", 19, 0); + + exec_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" + "\"Wine11\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n" + "\"Wine12\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n"); + verify_reg_nonexist(hkey, "Comment1"); + verify_reg_nonexist(hkey, "Comment2"); + verify_reg_nonexist(hkey, "Comment3"); + verify_reg_nonexist(hkey, "Comment4"); + todo_wine verify_reg_nonexist(hkey, "Wine11"); + verify_reg_nonexist(hkey, "Comment5"); + verify_reg(hkey, "Wine12", REG_SZ, "Value 7", 8, TODO_REG_SIZE|TODO_REG_DATA); + verify_reg_nonexist(hkey, "Comment6"); + + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "\"Wine13\"=#\"Value 8\"\n" + "\"Wine14\"=;\"Value 9\"\n" + "\"Wine15\"=\"#comment1\"\n" + "\"Wine16\"=\";comment2\"\n" + "\"Wine17\"=\"Value#comment3\"\n" + "\"Wine18\"=\"Value;comment4\"\n" + "\"Wine19\"=\"Value #comment5\"\n" + "\"Wine20\"=\"Value ;comment6\"\n" + "\"Wine21\"=#dword:00000001\n" + "\"Wine22\"=;dword:00000002\n" + "\"Wine23\"=dword:00000003#comment\n" + "\"Wine24\"=dword:00000004;comment\n\n"); + verify_reg_nonexist(hkey, "Wine13"); + verify_reg_nonexist(hkey, "Wine14"); + verify_reg(hkey, "Wine15", REG_SZ, "#comment1", 10, 0); + verify_reg(hkey, "Wine16", REG_SZ, ";comment2", 10, 0); + verify_reg(hkey, "Wine17", REG_SZ, "Value#comment3", 15, 0); + verify_reg(hkey, "Wine18", REG_SZ, "Value;comment4", 15, 0); + verify_reg(hkey, "Wine19", REG_SZ, "Value #comment5", 16, 0); + verify_reg(hkey, "Wine20", REG_SZ, "Value ;comment6", 16, 0); + verify_reg_nonexist(hkey, "Wine21"); + verify_reg_nonexist(hkey, "Wine22"); + verify_reg_nonexist(hkey, "Wine23"); + dword = 0x00000004; + todo_wine verify_reg(hkey, "Wine24", REG_DWORD, &dword, sizeof(dword), 0); + RegCloseKey(hkey); lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE);
1
0
0
0
Hugh McMaster : regedit/tests: Move existing comment tests to a separate function.
by Alexandre Julliard
06 Dec '16
06 Dec '16
Module: wine Branch: master Commit: ced6d4618be73182b5df5c54ee803283666662d8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ced6d4618be73182b5df5c54e…
Author: Hugh McMaster <hugh.mcmaster(a)outlook.com> Date: Tue Dec 6 12:07:29 2016 +0000 regedit/tests: Move existing comment tests to a separate function. Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/regedit/tests/regedit.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/programs/regedit/tests/regedit.c b/programs/regedit/tests/regedit.c index 23ea4f9..54558b1 100644 --- a/programs/regedit/tests/regedit.c +++ b/programs/regedit/tests/regedit.c @@ -278,14 +278,6 @@ static void test_basic_import(void) verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0); todo_wine verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0); - exec_import_str("REGEDIT4\n\n" - "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" - "#comment\\\n" - "\"Wine8\"=\"Line 1\"\n" - ";comment \\\n" - "\"Wine9\"=\"Line 2\"\n\n"); - verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0); - verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0); RegCloseKey(hkey); lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); @@ -344,6 +336,30 @@ static void test_invalid_import(void) ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: %d\n", lr); } +static void test_comments(void) +{ + LONG lr; + HKEY hkey; + + lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); + ok(lr == ERROR_SUCCESS || lr == ERROR_FILE_NOT_FOUND, "RegDeleteKeyA failed: %d\n", lr); + + exec_import_str("REGEDIT4\n\n" + "[HKEY_CURRENT_USER\\" KEY_BASE "]\n" + "#comment\\\n" + "\"Wine1\"=\"Line 1\"\n" + ";comment\\\n" + "\"Wine2\"=\"Line 2\"\n\n"); + lr = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); + verify_reg(hkey, "Wine1", REG_SZ, "Line 1", 7, 0); + verify_reg(hkey, "Wine2", REG_SZ, "Line 2", 7, 0); + + RegCloseKey(hkey); + + lr = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); + ok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: %d\n", lr); +} + START_TEST(regedit) { WCHAR wchar_test[] = {0xFEFF,'W','i','n','d','o','w','s',' ','R','e','g', @@ -359,4 +375,5 @@ START_TEST(regedit) test_basic_import(); test_invalid_import(); + test_comments(); }
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
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