[PATCH 1/2] crypt32/tests: Detect missing HEXRAW support by output.
Nikolay Sivov
nsivov at codeweavers.com
Tue Feb 11 03:25:39 CST 2020
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/crypt32/tests/base64.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/crypt32/tests/base64.c b/dlls/crypt32/tests/base64.c
index ac41d5c86d..874f8e432d 100644
--- a/dlls/crypt32/tests/base64.c
+++ b/dlls/crypt32/tests/base64.c
@@ -363,11 +363,16 @@ static void test_CryptBinaryToString(void)
heap_free(encodedW);
}
- /* winxp and win2k3 are documented as not handling HEXRAW but do not return failure */
- GetVersionExA(&ver);
- if (ver.dwMajorVersion <= 5)
+ /* Systems that don't support HEXRAW format convert to BASE64 instead - 3 bytes in -> 4 chars + crlf + 1 null out. */
+ strLen = 0;
+ ret = CryptBinaryToStringW(input, 3, CRYPT_STRING_HEXRAW, NULL, &strLen);
+todo_wine {
+ ok(ret, "Failed to get string length.\n");
+ ok(strLen == 9 || broken(strLen == 7), "Unexpected string length %d.\n", strLen);
+}
+ if (strLen == 7)
{
- win_skip("CryptBinaryToString(HEX) not supported\n");
+ win_skip("CryptBinaryToString(HEXRAW) not supported\n");
return;
}
@@ -376,6 +381,12 @@ static void test_CryptBinaryToString(void)
for (i = 0; i < ARRAY_SIZE(flags); i++)
{
+ strLen = 0;
+ ret = CryptBinaryToStringW(input, sizeof(input), CRYPT_STRING_HEXRAW|flags[i], NULL, &strLen);
+todo_wine {
+ ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
+ ok(strLen > 0, "Unexpected string length.\n");
+}
strLen = ~0;
ret = CryptBinaryToStringW(input, sizeof(input), CRYPT_STRING_HEXRAW|flags[i],
NULL, &strLen);
--
2.25.0
More information about the wine-devel
mailing list