Commit c51ea856 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

crypt32/tests: Enable compilation with long types.

parent cdc92a7b
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = crypt32.dll
IMPORTS = crypt32 advapi32 user32 shlwapi shell32 bcrypt
......
......@@ -115,18 +115,18 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
strLen = 0;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen == required, "Unexpected required length %u, expected %u.\n", required, strLen);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
ok(strLen == required, "Unexpected required length %lu, expected %lu.\n", required, strLen);
strLen2 = strLen;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen2);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen == strLen2, "Unexpected required length %u, expected %u.\n", strLen2, strLen);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Unexpected required length %lu, expected %lu.\n", strLen2, strLen);
strLen2 = strLen - 1;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, NULL, &strLen2);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen == strLen2, "Unexpected required length %u, expected %u.\n", strLen2, strLen);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Unexpected required length %lu, expected %lu.\n", strLen2, strLen);
str = heap_alloc(strLen);
......@@ -134,17 +134,17 @@ static void encodeAndCompareBase64_A(const BYTE *toEncode, DWORD toEncodeLen,
strLen2 = strLen - 1;
str[0] = 0x12;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str, &strLen2);
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringA failed %d, error %d.\n",
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringA failed %d, error %ld.\n",
ret, GetLastError());
ok(strLen2 == strLen || broken(strLen2 == strLen - 1), "Expected length %d, got %d\n", strLen, strLen2);
ok(strLen2 == strLen || broken(strLen2 == strLen - 1), "Expected length %ld, got %ld\n", strLen, strLen2);
if (header)
ok(str[0] == header[0], "Unexpected buffer contents %#x.\n", str[0]);
else
ok(str[0] == expected[0], "Unexpected buffer contents %#x.\n", str[0]);
strLen2 = strLen;
ret = CryptBinaryToStringA(toEncode, toEncodeLen, format, str, &strLen2);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen2 == strLen - 1, "Expected length %d, got %d\n", strLen - 1, strLen2);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
ok(strLen2 == strLen - 1, "Expected length %ld, got %ld\n", strLen - 1, strLen2);
ptr = str;
if (header)
......@@ -177,23 +177,23 @@ static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWO
strLen = 0;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(strLen == required, "Unexpected required length %u, expected %u.\n", strLen, required);
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == required, "Unexpected required length %lu, expected %u.\n", strLen, required);
/* Same call with non-zero length value. */
strLen2 = strLen;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen2);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Unexpected required length.\n");
strLen2 = strLen - 1;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen2);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Unexpected required length.\n");
strLen2 = strLen - 1;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, NULL, &strLen2);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Unexpected required length.\n");
strW = heap_alloc(strLen * sizeof(WCHAR));
......@@ -204,7 +204,7 @@ static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWO
strLen2 = strLen - 1;
strW[0] = 0x1234;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringW failed, %d, error %d\n",
ok((!ret && GetLastError() == ERROR_MORE_DATA) || broken(ret) /* XP */, "CryptBinaryToStringW failed, %d, error %ld\n",
ret, GetLastError());
if (headerW)
ok(strW[0] == 0x1234, "Unexpected buffer contents %#x.\n", strW[0]);
......@@ -213,9 +213,9 @@ static void encode_compare_base64_W(const BYTE *toEncode, DWORD toEncodeLen, DWO
strLen2 = strLen;
ret = CryptBinaryToStringW(toEncode, toEncodeLen, format, strW, &strLen2);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen2 == strLen - 1, "Expected length %d, got %d\n", strLen - 1, strLen);
ok(strLen2 == strLen - 1, "Expected length %ld, got %ld\n", strLen - 1, strLen);
ptr = strW;
if (headerW)
......@@ -271,12 +271,12 @@ static void test_CryptBinaryToString(void)
ret = CryptBinaryToStringA(NULL, 0, 0, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
strLen = 123;
ret = CryptBinaryToStringA(NULL, 0, 0, NULL, &strLen);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
ok(strLen == 123, "Unexpected length.\n");
if (0)
......@@ -284,7 +284,7 @@ static void test_CryptBinaryToString(void)
strLen = 123;
ret = CryptBinaryToStringW(NULL, 0, 0, NULL, &strLen);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected error %d\n", GetLastError());
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected error %ld\n", GetLastError());
ok(strLen == 123, "Unexpected length.\n");
for (i = 0; i < ARRAY_SIZE(tests); i++)
......@@ -295,27 +295,27 @@ static void test_CryptBinaryToString(void)
strLen = 0;
ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen == tests[i].toEncodeLen, "Unexpected required length %u.\n", strLen);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
ok(strLen == tests[i].toEncodeLen, "Unexpected required length %lu.\n", strLen);
strLen2 = strLen;
str = heap_alloc(strLen);
ret = CryptBinaryToStringA(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, str, &strLen2);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen == strLen2, "Expected length %u, got %u\n", strLen, strLen2);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Expected length %lu, got %lu\n", strLen, strLen2);
ok(!memcmp(str, tests[i].toEncode, tests[i].toEncodeLen), "Unexpected value\n");
heap_free(str);
strLen = 0;
ret = CryptBinaryToStringW(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(strLen == tests[i].toEncodeLen, "Unexpected required length %u.\n", strLen);
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == tests[i].toEncodeLen, "Unexpected required length %lu.\n", strLen);
strLen2 = strLen;
strW = heap_alloc(strLen);
ret = CryptBinaryToStringW(tests[i].toEncode, tests[i].toEncodeLen, CRYPT_STRING_BINARY, strW, &strLen2);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(strLen == strLen2, "Expected length %u, got %u\n", strLen, strLen2);
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Expected length %lu, got %lu\n", strLen, strLen2);
ok(!memcmp(strW, tests[i].toEncode, tests[i].toEncodeLen), "Unexpected value\n");
heap_free(strW);
......@@ -349,14 +349,14 @@ static void test_CryptBinaryToString(void)
ret = CryptBinaryToStringA(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
CRYPT_STRING_BINARY | CRYPT_STRING_NOCR, NULL, &strLen);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
strLen2 = strLen;
str = heap_alloc(strLen);
ret = CryptBinaryToStringA(testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen,
CRYPT_STRING_BINARY | CRYPT_STRING_NOCR, str, &strLen2);
ok(ret, "CryptBinaryToStringA failed: %d\n", GetLastError());
ok(strLen == strLen2, "Expected length %d, got %d\n", strLen, strLen2);
ok(ret, "CryptBinaryToStringA failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, strLen2);
ok(!memcmp(str, testsNoCR[i].toEncode, testsNoCR[i].toEncodeLen), "Unexpected value\n");
heap_free(str);
......@@ -390,7 +390,7 @@ static void test_CryptBinaryToString(void)
strLen = 0;
ret = CryptBinaryToStringW(input, 3, CRYPT_STRING_HEXRAW, NULL, &strLen);
ok(ret, "Failed to get string length.\n");
ok(strLen == 9 || broken(strLen == 7), "Unexpected string length %d.\n", strLen);
ok(strLen == 9 || broken(strLen == 7), "Unexpected string length %ld.\n", strLen);
if (strLen == 7)
{
win_skip("CryptBinaryToString(HEXRAW) not supported\n");
......@@ -404,13 +404,13 @@ static void test_CryptBinaryToString(void)
{
strLen = 0;
ret = CryptBinaryToStringW(input, sizeof(input), CRYPT_STRING_HEXRAW|flags[i], NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen > 0, "Unexpected string length.\n");
strLen = ~0;
ret = CryptBinaryToStringW(input, sizeof(input), CRYPT_STRING_HEXRAW|flags[i],
NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
if (flags[i] & CRYPT_STRING_NOCRLF)
strLen2 = 0;
else if (flags[i] & CRYPT_STRING_NOCR)
......@@ -418,7 +418,7 @@ static void test_CryptBinaryToString(void)
else
strLen2 = 2;
strLen2 += sizeof(input) * 2 + 1;
ok(strLen == strLen2, "Expected length %d, got %d\n", strLen2, strLen);
ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen2, strLen);
hex = heap_alloc(strLen * sizeof(WCHAR));
memset(hex, 0xcc, strLen * sizeof(WCHAR));
......@@ -440,17 +440,17 @@ static void test_CryptBinaryToString(void)
*ptr++ = 0;
ret = CryptBinaryToStringW(input, sizeof(input), CRYPT_STRING_HEXRAW|flags[i],
hex, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
strLen2--;
ok(strLen == strLen2, "Expected length %d, got %d\n", strLen, strLen2);
ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, strLen2);
ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "Unexpected value\n");
/* adjusts size if buffer too big */
strLen *= 2;
ret = CryptBinaryToStringW(input, sizeof(input), CRYPT_STRING_HEXRAW|flags[i],
hex, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(strLen == strLen2, "Expected length %d, got %d\n", strLen, strLen2);
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, strLen2);
/* no writes if buffer too small */
strLen /= 2;
......@@ -460,9 +460,9 @@ static void test_CryptBinaryToString(void)
SetLastError(0xdeadbeef);
ret = CryptBinaryToStringW(input, sizeof(input), CRYPT_STRING_HEXRAW|flags[i],
hex, &strLen);
ok(!ret && GetLastError() == ERROR_MORE_DATA,"Expected ERROR_MORE_DATA, got ret=%d le=%u\n",
ok(!ret && GetLastError() == ERROR_MORE_DATA,"Expected ERROR_MORE_DATA, got ret=%d le=%lu\n",
ret, GetLastError());
ok(strLen == strLen2, "Expected length %d, got %d\n", strLen, strLen2);
ok(strLen == strLen2, "Expected length %ld, got %ld\n", strLen, strLen2);
ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "Unexpected value\n");
heap_free(hex);
......@@ -474,14 +474,14 @@ static void test_CryptBinaryToString(void)
{
strLen = 0;
ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen > 0, "Unexpected string length.\n");
strLen = ~0;
ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], NULL, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
strLen2 = binary_to_hex_len(sizes[k], CRYPT_STRING_HEX | flags[i]);
ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen2, strLen);
ok(strLen == strLen2, "%lu: Expected length %ld, got %ld\n", i, strLen2, strLen);
hex = heap_alloc(strLen * sizeof(WCHAR) + 256);
memset(hex, 0xcc, strLen * sizeof(WCHAR));
......@@ -529,16 +529,16 @@ static void test_CryptBinaryToString(void)
*ptr++ = 0;
ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], hex, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
strLen2--;
ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen, strLen2);
ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "%u: got %s\n", i, wine_dbgstr_wn(hex, strLen));
ok(strLen == strLen2, "%lu: Expected length %ld, got %ld\n", i, strLen, strLen2);
ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "%lu: got %s\n", i, wine_dbgstr_wn(hex, strLen));
/* adjusts size if buffer too big */
strLen *= 2;
ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], hex, &strLen);
ok(ret, "CryptBinaryToStringW failed: %d\n", GetLastError());
ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen, strLen2);
ok(ret, "CryptBinaryToStringW failed: %ld\n", GetLastError());
ok(strLen == strLen2, "%lu: Expected length %ld, got %ld\n", i, strLen, strLen2);
/* no writes if buffer too small */
strLen /= 2;
......@@ -547,10 +547,10 @@ static void test_CryptBinaryToString(void)
memset(cmp, 0xcc, strLen * sizeof(WCHAR));
SetLastError(0xdeadbeef);
ret = CryptBinaryToStringW(input, sizes[k], CRYPT_STRING_HEX | flags[i], hex, &strLen);
ok(!ret && GetLastError() == ERROR_MORE_DATA,"Expected ERROR_MORE_DATA, got ret=%d le=%u\n",
ok(!ret && GetLastError() == ERROR_MORE_DATA,"Expected ERROR_MORE_DATA, got ret=%d le=%lu\n",
ret, GetLastError());
ok(strLen == strLen2, "%u: Expected length %d, got %d\n", i, strLen, strLen2);
ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "%u: got %s\n", i, wine_dbgstr_wn(hex, strLen));
ok(strLen == strLen2, "%lu: Expected length %ld, got %ld\n", i, strLen, strLen2);
ok(!memcmp(hex, cmp, strLen * sizeof(WCHAR)), "%lu: got %s\n", i, wine_dbgstr_wn(hex, strLen));
heap_free(hex);
heap_free(cmp);
......@@ -585,7 +585,7 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
strcat(str, trailer);
ret = CryptStringToBinaryA(str, 0, useFormat, NULL, &bufLen, NULL,
NULL);
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError());
buf = HeapAlloc(GetProcessHeap(), 0, bufLen);
if (buf)
{
......@@ -594,16 +594,16 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
/* check as normal, make sure last two parameters are optional */
ret = CryptStringToBinaryA(str, 0, useFormat, buf, &bufLen, NULL,
NULL);
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError());
ok(bufLen == expectedLen,
"Expected length %d, got %d\n", expectedLen, bufLen);
"Expected length %ld, got %ld\n", expectedLen, bufLen);
ok(!memcmp(buf, expected, bufLen), "Unexpected value\n");
/* check last two params */
ret = CryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
&skipped, &usedFormat);
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(skipped == 0, "Expected skipped 0, got %d\n", skipped);
ok(usedFormat == expectedFormat, "Expected format %d, got %d\n",
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError());
ok(skipped == 0, "Expected skipped 0, got %ld\n", skipped);
ok(usedFormat == expectedFormat, "Expected format %ld, got %ld\n",
expectedFormat, usedFormat);
HeapFree(GetProcessHeap(), 0, buf);
}
......@@ -619,10 +619,10 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
NULL);
/* expect failure with no header, and success with one */
if (header)
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError());
else
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected !ret and last error ERROR_INVALID_DATA, got ret=%d, error=%d\n", ret, GetLastError());
"Expected !ret and last error ERROR_INVALID_DATA, got ret=%d, error=%ld\n", ret, GetLastError());
if (ret)
{
buf = HeapAlloc(GetProcessHeap(), 0, bufLen);
......@@ -632,9 +632,9 @@ static void decodeAndCompareBase64_A(LPCSTR toDecode, LPCSTR header,
ret = CryptStringToBinaryA(str, 0, useFormat, buf, &bufLen,
&skipped, &usedFormat);
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError());
ok(skipped == strlen(garbage),
"Expected %d characters of \"%s\" skipped when trying format %08x, got %d (used format is %08x)\n",
"Expected %d characters of \"%s\" skipped when trying format %08lx, got %ld (used format is %08lx)\n",
lstrlenA(garbage), str, useFormat, skipped, usedFormat);
HeapFree(GetProcessHeap(), 0, buf);
}
......@@ -668,14 +668,14 @@ static void decodeBase64WithLenFmt(LPCSTR str, int len, DWORD fmt, LPCSTR expect
if (expected) {
BOOL correct = ret && strcmp(expected, (char*)buf) == 0;
ok(correct || (isBroken && broken(!ret)),
"base64 \"%s\" len %d: expected \"%s\", got \"%s\" (ret %d, le %d)\n",
"base64 \"%s\" len %d: expected \"%s\", got \"%s\" (ret %d, le %ld)\n",
str, len, expected, (char*)buf, ret, GetLastError());
if (correct)
ok(fmtUsed == fmt, "base64 \"%s\" len %d: expected fmt %d, used %d\n",
ok(fmtUsed == fmt, "base64 \"%s\" len %d: expected fmt %ld, used %ld\n",
str, len, fmt, fmtUsed);
} else {
ok(!ret && GetLastError() == le,
"base64 \"%s\" len %d: expected failure, got \"%s\" (ret %d, le %d)\n",
"base64 \"%s\" len %d: expected failure, got \"%s\" (ret %d, le %ld)\n",
str, len, (char*)buf, ret, GetLastError());
}
......@@ -715,20 +715,20 @@ static void testStringToBinaryA(void)
ret = CryptStringToBinaryA(NULL, 0, 0, NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got ret=%d le=%u\n", ret, GetLastError());
"Expected ERROR_INVALID_PARAMETER, got ret=%d le=%lu\n", ret, GetLastError());
ret = CryptStringToBinaryA(NULL, 0, 0, NULL, &bufLen, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got ret=%d le=%u\n", ret, GetLastError());
"Expected ERROR_INVALID_PARAMETER, got ret=%d le=%lu\n", ret, GetLastError());
/* Bogus format */
ret = CryptStringToBinaryA(tests[0].base64, 0, 0, NULL, &bufLen, NULL,
NULL);
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", ret, GetLastError());
"Expected ERROR_INVALID_DATA, got ret=%d le=%lu\n", ret, GetLastError());
/* Decoding doesn't expect the NOCR flag to be specified */
ret = CryptStringToBinaryA(tests[0].base64, 1,
CRYPT_STRING_BASE64 | CRYPT_STRING_NOCR, NULL, &bufLen, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", ret, GetLastError());
"Expected ERROR_INVALID_DATA, got ret=%d le=%lu\n", ret, GetLastError());
/* Bad strings */
for (i = 0; i < ARRAY_SIZE(badStrings); i++)
{
......@@ -736,7 +736,7 @@ static void testStringToBinaryA(void)
ret = CryptStringToBinaryA(badStrings[i].str, 0, badStrings[i].format,
NULL, &bufLen, NULL, NULL);
ok(!ret && GetLastError() == ERROR_INVALID_DATA,
"%d: Expected ERROR_INVALID_DATA, got ret=%d le=%u\n", i, ret, GetLastError());
"%ld: Expected ERROR_INVALID_DATA, got ret=%d le=%lu\n", i, ret, GetLastError());
}
/* Weird base64 strings (invalid padding, extra white-space etc.) */
decodeBase64WithLen("V=", 0, 0, ERROR_INVALID_DATA);
......@@ -793,7 +793,7 @@ static void testStringToBinaryA(void)
bufLen = 4;
ret = CryptStringToBinaryA("VVVVVVVV", 8, CRYPT_STRING_BASE64, (BYTE*)buf, &bufLen, NULL, NULL);
ok(!ret && bufLen == 4 && buf[0] == 0,
"Expected ret 0, bufLen 4, buf[0] '\\0', got ret %d, bufLen %d, buf[0] '%c'\n",
"Expected ret 0, bufLen 4, buf[0] '\\0', got ret %d, bufLen %ld, buf[0] '%c'\n",
ret, bufLen, buf[0]);
/* Good strings */
......@@ -805,7 +805,7 @@ static void testStringToBinaryA(void)
*/
ret = CryptStringToBinaryA(tests[i].base64, 1, CRYPT_STRING_BASE64,
NULL, &bufLen, NULL, NULL);
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError());
/* Check with the precise format */
decodeAndCompareBase64_A(tests[i].base64, NULL, NULL,
CRYPT_STRING_BASE64, CRYPT_STRING_BASE64, tests[i].toEncode,
......@@ -862,7 +862,7 @@ static void testStringToBinaryA(void)
*/
ret = CryptStringToBinaryA(testsNoCR[i].base64, 1, CRYPT_STRING_BASE64,
NULL, &bufLen, NULL, NULL);
ok(ret, "CryptStringToBinaryA failed: %d\n", GetLastError());
ok(ret, "CryptStringToBinaryA failed: %ld\n", GetLastError());
/* Check with the precise format */
decodeAndCompareBase64_A(testsNoCR[i].base64, NULL, NULL,
CRYPT_STRING_BASE64, CRYPT_STRING_BASE64, testsNoCR[i].toEncode,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -97,18 +97,18 @@ static void testCreateCertChainEngine(void)
*/
ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* Crashes
config.cbSize = sizeof(config);
ret = pCertCreateCertificateChainEngine(pConfig, NULL);
*/
config.cbSize = sizeof(config);
ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
ok(ret, "CertCreateCertificateChainEngine failed: %08lx\n", GetLastError());
pCertFreeCertificateChainEngine(engine);
config.dwFlags = 0xff000000;
ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
ok(ret, "CertCreateCertificateChainEngine failed: %08lx\n", GetLastError());
pCertFreeCertificateChainEngine(engine);
/* Creating a cert with no root certs at all is allowed.. */
......@@ -116,7 +116,7 @@ static void testCreateCertChainEngine(void)
CERT_STORE_CREATE_NEW_FLAG, NULL);
config.hRestrictedRoot = store;
ret = pCertCreateCertificateChainEngine(pConfig, &engine);
ok(ret, "CertCreateCertificateChainEngine failed: %08x\n", GetLastError());
ok(ret, "CertCreateCertificateChainEngine failed: %08lx\n", GetLastError());
pCertFreeCertificateChainEngine(engine);
/* but creating one with a restricted root with a cert that isn't a member
......@@ -128,7 +128,7 @@ static void testCreateCertChainEngine(void)
/* ERROR_FILE_NOT_FOUND used in Windows 10 */
ok(!ret && ((GetLastError() == CRYPT_E_NOT_FOUND) ||
(GetLastError() == ERROR_FILE_NOT_FOUND)),
"Expected CRYPT_E_NOT_FOUND or ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND or ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
CertCloseStore(store, 0);
}
......@@ -3380,7 +3380,7 @@ static PCCERT_CHAIN_CONTEXT getChain(HCERTCHAINENGINE engine,
ret = CertAddEncodedCertificateToStore(store,
X509_ASN_ENCODING, certArray->rgBlob[i].pbData,
certArray->rgBlob[i].cbData, CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "Chain %d: adding cert %d failed: %08x\n",
ok(ret, "Chain %ld: adding cert %ld failed: %08lx\n",
testIndex, i, GetLastError());
}
}
......@@ -3388,7 +3388,7 @@ static PCCERT_CHAIN_CONTEXT getChain(HCERTCHAINENGINE engine,
X509_ASN_ENCODING, certArray->rgBlob[certArray->cBlob - 1].pbData,
certArray->rgBlob[certArray->cBlob - 1].cbData, CERT_STORE_ADD_ALWAYS,
&endCert);
ok(ret, "Chain %d: adding end cert failed: %08x\n",
ok(ret, "Chain %ld: adding end cert failed: %08lx\n",
testIndex, GetLastError());
if (ret)
{
......@@ -3402,7 +3402,7 @@ static PCCERT_CHAIN_CONTEXT getChain(HCERTCHAINENGINE engine,
ret = pCertGetCertificateChain(engine, endCert, &fileTime,
includeStore ? store : NULL, &chainPara, flags, NULL, &chain);
todo_wine_if (todo & TODO_CHAIN)
ok(ret, "Chain %d: CertGetCertificateChain failed: %08x\n",
ok(ret, "Chain %ld: CertGetCertificateChain failed: %08lx\n",
testIndex, GetLastError());
CertFreeCertificateContext(endCert);
}
......@@ -3424,27 +3424,27 @@ static void checkElementStatus(const CERT_TRUST_STATUS *expected,
{
if (got->dwErrorStatus == expected->dwErrorStatus)
ok(got->dwErrorStatus == expected->dwErrorStatus,
"%s[%d], element [%d,%d]: expected error %08x, got %08x\n",
"%s[%ld], element [%ld,%ld]: expected error %08lx, got %08lx\n",
testName, testIndex, chainIndex, elementIndex, expected->dwErrorStatus,
got->dwErrorStatus);
else todo_wine_if (todo & TODO_ERROR)
ok(got->dwErrorStatus == expected->dwErrorStatus ||
broken((got->dwErrorStatus & ~ignore->dwErrorStatus) ==
(expected->dwErrorStatus & ~ignore->dwErrorStatus)),
"%s[%d], element [%d,%d]: expected error %08x, got %08x. %08x is "
"%s[%ld], element [%ld,%ld]: expected error %08lx, got %08lx. %08x is "
"expected if no valid root certificate is available.\n",
testName, testIndex, chainIndex, elementIndex, expected->dwErrorStatus,
got->dwErrorStatus, CERT_TRUST_IS_UNTRUSTED_ROOT);
if (got->dwInfoStatus == expected->dwInfoStatus)
ok(got->dwInfoStatus == expected->dwInfoStatus,
"%s[%d], element [%d,%d]: expected info %08x, got %08x\n",
"%s[%ld], element [%ld,%ld]: expected info %08lx, got %08lx\n",
testName, testIndex, chainIndex, elementIndex, expected->dwInfoStatus,
got->dwInfoStatus);
else todo_wine_if (todo & TODO_INFO)
ok(got->dwInfoStatus == expected->dwInfoStatus ||
broken((got->dwInfoStatus & ~ignore->dwInfoStatus) ==
(expected->dwInfoStatus & ~ignore->dwInfoStatus)),
"%s[%d], element [%d,%d]: expected info %08x, got %08x\n",
"%s[%ld], element [%ld,%ld]: expected info %08lx, got %08lx\n",
testName, testIndex, chainIndex, elementIndex, expected->dwInfoStatus,
got->dwInfoStatus);
}
......@@ -3456,7 +3456,7 @@ static void checkSimpleChainStatus(const CERT_SIMPLE_CHAIN *simpleChain,
{
todo_wine_if (todo & TODO_ELEMENTS)
ok(simpleChain->cElement == simpleChainStatus->cElement,
"%s[%d]: expected %d elements, got %d\n", testName, testIndex,
"%s[%ld]: expected %ld elements, got %ld\n", testName, testIndex,
simpleChainStatus->cElement, simpleChain->cElement);
if (simpleChain->cElement == simpleChainStatus->cElement)
{
......@@ -3482,7 +3482,7 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain,
DWORD testIndex)
{
ok(chain->cChain == chainStatus->cChain,
"%s[%d]: expected %d simple chains, got %d\n", testName, testIndex,
"%s[%ld]: expected %ld simple chains, got %ld\n", testName, testIndex,
chainStatus->cChain, chain->cChain);
todo_wine_if (todo & TODO_ERROR &&
chain->TrustStatus.dwErrorStatus != chainStatus->status.dwErrorStatus)
......@@ -3492,7 +3492,7 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain,
~chainStatus->statusToIgnore.dwErrorStatus) ==
(chainStatus->status.dwErrorStatus &
~chainStatus->statusToIgnore.dwErrorStatus)),
"%s[%d]: expected error %08x, got %08x. %08x is expected if no valid "
"%s[%ld]: expected error %08lx, got %08lx. %08x is expected if no valid "
"root certificate is available.\n",
testName, testIndex, chainStatus->status.dwErrorStatus,
chain->TrustStatus.dwErrorStatus, CERT_TRUST_IS_UNTRUSTED_ROOT);
......@@ -3504,7 +3504,7 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain,
~chainStatus->statusToIgnore.dwInfoStatus) ==
(chainStatus->status.dwInfoStatus &
~chainStatus->statusToIgnore.dwInfoStatus)),
"%s[%d]: expected info %08x, got %08x\n",
"%s[%ld]: expected info %08lx, got %08lx\n",
testName, testIndex, chainStatus->status.dwInfoStatus,
chain->TrustStatus.dwInfoStatus);
if (chain->cChain == chainStatus->cChain)
......@@ -4358,12 +4358,12 @@ static void testGetCertChain(void)
/* Crash on Vista */
ret = pCertGetCertificateChain(NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
}
ret = pCertGetCertificateChain(NULL, NULL, NULL, NULL, NULL, 0, NULL,
&chain);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* Crash
ret = pCertGetCertificateChain(NULL, NULL, NULL, NULL, &para, 0, NULL, NULL);
ret = pCertGetCertificateChain(NULL, NULL, NULL, NULL, &para, 0, NULL,
......@@ -4376,7 +4376,7 @@ static void testGetCertChain(void)
/* Crash on Vista */
ret = pCertGetCertificateChain(NULL, cert, NULL, NULL, NULL, 0, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
}
/* Crash
ret = pCertGetCertificateChain(NULL, cert, NULL, NULL, &para, 0, NULL, NULL);
......@@ -4389,7 +4389,7 @@ static void testGetCertChain(void)
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == CRYPT_E_ASN1_BADTAG /* Vista */,
"Expected ERROR_INVALID_DATA or CRYPT_E_ASN1_BADTAG, got %d\n", GetLastError());
"Expected ERROR_INVALID_DATA or CRYPT_E_ASN1_BADTAG, got %ld\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = pCertGetCertificateChain(NULL, cert, NULL, NULL, &para, 0, NULL,
......@@ -4397,7 +4397,7 @@ static void testGetCertChain(void)
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == CRYPT_E_ASN1_BADTAG /* Vista */,
"Expected ERROR_INVALID_DATA or CRYPT_E_ASN1_BADTAG, got %d\n", GetLastError());
"Expected ERROR_INVALID_DATA or CRYPT_E_ASN1_BADTAG, got %ld\n", GetLastError());
para.cbSize = 0;
SetLastError(0xdeadbeef);
......@@ -4406,7 +4406,7 @@ static void testGetCertChain(void)
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == CRYPT_E_ASN1_BADTAG, /* Vista and higher */
"Expected ERROR_INVALID_DATA or CRYPT_E_ASN1_BADTAG, got %d\n", GetLastError());
"Expected ERROR_INVALID_DATA or CRYPT_E_ASN1_BADTAG, got %ld\n", GetLastError());
CertFreeCertificateContext(cert);
......@@ -4428,7 +4428,7 @@ static void testGetCertChain(void)
para.RequestedUsage.Usage.cUsageIdentifier = 1;
ret = pCertGetCertificateChain(NULL, cert, &fileTime, store, &para,
0, NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %08x\n", GetLastError());
ok(ret, "CertGetCertificateChain failed: %08lx\n", GetLastError());
if (ret)
{
ok(chain->TrustStatus.dwErrorStatus & CERT_TRUST_IS_NOT_VALID_FOR_USAGE,
......@@ -4438,11 +4438,11 @@ static void testGetCertChain(void)
oids[0] = oid_server_auth;
ret = pCertGetCertificateChain(NULL, cert, &fileTime, store, &para,
0, NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %08x\n", GetLastError());
ok(ret, "CertGetCertificateChain failed: %08lx\n", GetLastError());
if (ret)
{
ok(!(chain->TrustStatus.dwErrorStatus & CERT_TRUST_IS_NOT_VALID_FOR_USAGE),
"didn't expect CERT_TRUST_IS_NOT_VALID_FOR_USAGE, got %x\n", chain->TrustStatus.dwErrorStatus);
"didn't expect CERT_TRUST_IS_NOT_VALID_FOR_USAGE, got %lx\n", chain->TrustStatus.dwErrorStatus);
pCertFreeCertificateChain(chain);
}
oids[1] = one_two_three;
......@@ -4450,7 +4450,7 @@ static void testGetCertChain(void)
para.RequestedUsage.dwType = USAGE_MATCH_TYPE_AND;
ret = pCertGetCertificateChain(NULL, cert, &fileTime, store, &para,
0, NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %08x\n", GetLastError());
ok(ret, "CertGetCertificateChain failed: %08lx\n", GetLastError());
if (ret)
{
ok(chain->TrustStatus.dwErrorStatus & CERT_TRUST_IS_NOT_VALID_FOR_USAGE,
......@@ -4460,7 +4460,7 @@ static void testGetCertChain(void)
para.RequestedUsage.dwType = USAGE_MATCH_TYPE_OR;
ret = pCertGetCertificateChain(NULL, cert, &fileTime, store, &para,
0, NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %08x\n", GetLastError());
ok(ret, "CertGetCertificateChain failed: %08lx\n", GetLastError());
if (ret)
{
ok(!(chain->TrustStatus.dwErrorStatus &
......@@ -4492,7 +4492,7 @@ static void testGetCertChain(void)
~incompleteOpensslChainCheck.status.statusToIgnore.dwErrorStatus) ==
(incompleteOpensslChainCheck.status.status.dwErrorStatus &
~incompleteOpensslChainCheck.status.statusToIgnore.dwErrorStatus)),
"unexpected chain error status %08x\n",
"unexpected chain error status %08lx\n",
chain->TrustStatus.dwErrorStatus);
if (opensslChainCheck.status.status.dwErrorStatus ==
chain->TrustStatus.dwErrorStatus)
......@@ -4525,7 +4525,7 @@ static void testGetCertChain(void)
~chainCheckEmbeddedNullBroken.status.statusToIgnore.dwErrorStatus) ==
(chainCheckEmbeddedNullBroken.status.status.dwErrorStatus &
~chainCheckEmbeddedNullBroken.status.statusToIgnore.dwErrorStatus)),
"unexpected chain error status %08x\n",
"unexpected chain error status %08lx\n",
chain->TrustStatus.dwErrorStatus);
if (chainCheckEmbeddedNull.status.status.dwErrorStatus ==
chain->TrustStatus.dwErrorStatus)
......@@ -4539,11 +4539,11 @@ static void testGetCertChain(void)
}
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %u\n", GetLastError());
ok(store != NULL, "CertOpenStore failed: %lu\n", GetLastError());
ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING, winehq_org, sizeof(winehq_org),
CERT_STORE_ADD_ALWAYS, &cert);
ok(ret, "CertAddEncodedCertificateToStore failed: %u\n", GetLastError());
ok(ret, "CertAddEncodedCertificateToStore failed: %lu\n", GetLastError());
oids[0] = oid_server_auth;
memset(&para, 0, sizeof(para));
......@@ -4554,7 +4554,7 @@ static void testGetCertChain(void)
/* Pass store that does not contain all certs in chain. */
ret = CertGetCertificateChain(NULL, cert, &fileTime, store, &para, 0, NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError());
ok(ret, "CertGetCertificateChain failed: %lu\n", GetLastError());
if(chain->TrustStatus.dwErrorStatus == CERT_TRUST_IS_PARTIAL_CHAIN) { /* win2k */
win_skip("winehq cert reported as partial chain, skipping its tests\n");
......@@ -4563,40 +4563,40 @@ static void testGetCertChain(void)
return;
}
ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "chain->TrustStatus.dwErrorStatus = %x\n",
ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "chain->TrustStatus.dwErrorStatus = %lx\n",
chain->TrustStatus.dwErrorStatus);
todo_wine
ok(chain->TrustStatus.dwInfoStatus == CERT_TRUST_HAS_PREFERRED_ISSUER, "chain->TrustStatus.dwInfoStatus = %x\n",
ok(chain->TrustStatus.dwInfoStatus == CERT_TRUST_HAS_PREFERRED_ISSUER, "chain->TrustStatus.dwInfoStatus = %lx\n",
chain->TrustStatus.dwInfoStatus);
ok(chain->cChain == 1, "chain->cChain = %d\n", chain->cChain);
ok(!chain->cLowerQualityChainContext, "chain->cLowerQualityChainContext = %x\n", chain->cLowerQualityChainContext);
ok(chain->cChain == 1, "chain->cChain = %ld\n", chain->cChain);
ok(!chain->cLowerQualityChainContext, "chain->cLowerQualityChainContext = %lx\n", chain->cLowerQualityChainContext);
ok(!chain->rgpLowerQualityChainContext, "chain->rgpLowerQualityChainContext = %p\n", chain->rgpLowerQualityChainContext);
simple_chain = *chain->rgpChain;
ok(simple_chain->cbSize == sizeof(*simple_chain), "simple_chain->cbSize = %u\n", simple_chain->cbSize);
ok(simple_chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "simple_chain->TrustStatus.dwErrorStatus = %x\n",
ok(simple_chain->cbSize == sizeof(*simple_chain), "simple_chain->cbSize = %lu\n", simple_chain->cbSize);
ok(simple_chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "simple_chain->TrustStatus.dwErrorStatus = %lx\n",
simple_chain->TrustStatus.dwErrorStatus);
todo_wine
ok(simple_chain->TrustStatus.dwInfoStatus == CERT_TRUST_HAS_PREFERRED_ISSUER,
"simple_chain->TrustStatus.dwInfoStatus = %x\n", simple_chain->TrustStatus.dwInfoStatus);
ok(simple_chain->cElement == 3, "simple_chain->cElement = %u\n", simple_chain->cElement);
"simple_chain->TrustStatus.dwInfoStatus = %lx\n", simple_chain->TrustStatus.dwInfoStatus);
ok(simple_chain->cElement == 3, "simple_chain->cElement = %lu\n", simple_chain->cElement);
for(i=0; i < simple_chain->cElement; i++) {
chain_elem = simple_chain->rgpElement[i];
ok(chain_elem->cbSize == sizeof(*chain_elem), "chain_elem->cbSize = %u\n", chain_elem->cbSize);
ok(chain_elem->cbSize == sizeof(*chain_elem), "chain_elem->cbSize = %lu\n", chain_elem->cbSize);
if (!i)
ok(chain_elem->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER,
"chain_elem->TrustStatus.dwErrorStatus = %x\n", chain_elem->TrustStatus.dwErrorStatus);
"chain_elem->TrustStatus.dwErrorStatus = %lx\n", chain_elem->TrustStatus.dwErrorStatus);
else if (i == 1)
todo_wine ok(!chain_elem->TrustStatus.dwErrorStatus, "chain_elem->TrustStatus.dwErrorStatus = %x\n",
todo_wine ok(!chain_elem->TrustStatus.dwErrorStatus, "chain_elem->TrustStatus.dwErrorStatus = %lx\n",
chain_elem->TrustStatus.dwErrorStatus);
else
ok(!chain_elem->TrustStatus.dwErrorStatus, "chain_elem->TrustStatus.dwErrorStatus = %x\n",
ok(!chain_elem->TrustStatus.dwErrorStatus, "chain_elem->TrustStatus.dwErrorStatus = %lx\n",
chain_elem->TrustStatus.dwErrorStatus);
trace("info[%u] = %x\n", i, chain_elem->TrustStatus.dwInfoStatus);
trace("info[%lu] = %lx\n", i, chain_elem->TrustStatus.dwInfoStatus);
ok(chain_elem->pCertContext->dwCertEncodingType == CRYPT_ASN_ENCODING,
"chain_elem->pCertContext->dwCertEncodingType = %x\n",
"chain_elem->pCertContext->dwCertEncodingType = %lx\n",
chain_elem->pCertContext->dwCertEncodingType);
}
......@@ -4615,28 +4615,28 @@ static void testGetCertChain(void)
/* Test revocation flags */
ret = CertGetCertificateChain(NULL, cert, &fileTime, store, &para, CERT_CHAIN_REVOCATION_CHECK_END_CERT, NULL,
&chain);
ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError());
ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "chain->TrustStatus.dwErrorStatus = %x\n",
ok(ret, "CertGetCertificateChain failed: %lu\n", GetLastError());
ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "chain->TrustStatus.dwErrorStatus = %lx\n",
chain->TrustStatus.dwErrorStatus);
pCertFreeCertificateChain(chain);
ret = CertGetCertificateChain(NULL, cert, &fileTime, store, &para, CERT_CHAIN_REVOCATION_CHECK_CHAIN, NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError());
ok(ret, "CertGetCertificateChain failed: %lu\n", GetLastError());
ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER ||
broken(chain->TrustStatus.dwErrorStatus == (CERT_TRUST_IS_NOT_TIME_VALID|CERT_TRUST_REVOCATION_STATUS_UNKNOWN)), /* XP */
"chain->TrustStatus.dwErrorStatus = %x\n", chain->TrustStatus.dwErrorStatus);
"chain->TrustStatus.dwErrorStatus = %lx\n", chain->TrustStatus.dwErrorStatus);
pCertFreeCertificateChain(chain);
ret = CertGetCertificateChain(NULL, cert, &fileTime, store, &para, CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT,
NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError());
ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "chain->TrustStatus.dwErrorStatus = %x\n",
ok(ret, "CertGetCertificateChain failed: %lu\n", GetLastError());
ok(chain->TrustStatus.dwErrorStatus == CERT_TRUST_HAS_EXACT_MATCH_ISSUER, "chain->TrustStatus.dwErrorStatus = %lx\n",
chain->TrustStatus.dwErrorStatus);
pCertFreeCertificateChain(chain);
/* Test HCCE_LOCAL_MACHINE */
ret = CertGetCertificateChain(HCCE_LOCAL_MACHINE, cert, &fileTime, store, &para, 0, NULL, &chain);
ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError());
ok(ret, "CertGetCertificateChain failed: %lu\n", GetLastError());
pCertFreeCertificateChain(chain);
CertFreeCertificateContext(cert);
......@@ -4658,11 +4658,11 @@ static void test_CERT_CHAIN_PARA_cbSize(void)
ret = CertAddEncodedCertificateToStore(store,
X509_ASN_ENCODING, chain0_0, sizeof(chain0_0),
CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
ret = CertAddEncodedCertificateToStore(store,
X509_ASN_ENCODING, chain0_1, sizeof(chain0_1),
CERT_STORE_ADD_ALWAYS, &cert);
ok(ret, "CertAddEncodedCertificateToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n", GetLastError());
for (i = 0; i < sizeof(CERT_CHAIN_PARA) + 2; i++)
{
......@@ -4673,7 +4673,7 @@ static void test_CERT_CHAIN_PARA_cbSize(void)
para.cbSize = i;
ret = pCertGetCertificateChain(NULL, cert, &fileTime,
NULL, &para, 0, NULL, &chain);
ok(ret, "CertGetCertificateChain failed %u\n", GetLastError());
ok(ret, "CertGetCertificateChain failed %lu\n", GetLastError());
pCertFreeCertificateChain(chain);
}
......@@ -5001,7 +5001,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
if (check->todo & TODO_POLICY)
todo_wine ok(ret,
"%s[%d](%s): CertVerifyCertificateChainPolicy failed: %08x\n",
"%s[%ld](%s): CertVerifyCertificateChainPolicy failed: %08lx\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
GetLastError());
......@@ -5009,13 +5009,13 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
{
if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
{
skip("%s[%d]: missing policy %s, skipping test\n",
skip("%s[%ld]: missing policy %s, skipping test\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy);
pCertFreeCertificateChain(chain);
return;
}
ok(ret, "%s[%d](%s): CertVerifyCertificateChainPolicy failed: %08x\n",
ok(ret, "%s[%ld](%s): CertVerifyCertificateChainPolicy failed: %08lx\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
GetLastError());
......@@ -5027,13 +5027,13 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
broken(policyStatus.dwError == CERT_TRUST_NO_ERROR) ||
(check->brokenStatus && broken(policyStatus.dwError ==
check->brokenStatus->dwError)),
"%s[%d](%s): expected %08x, got %08x\n",
"%s[%ld](%s): expected %08lx, got %08lx\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.dwError, policyStatus.dwError);
if (policyStatus.dwError != check->status.dwError)
{
skip("%s[%d](%s): error %08x doesn't match expected %08x, not checking indexes\n",
skip("%s[%ld](%s): error %08lx doesn't match expected %08lx, not checking indexes\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
policyStatus.dwError, check->status.dwError);
......@@ -5044,7 +5044,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
ok(policyStatus.lChainIndex == check->status.lChainIndex ||
(check->brokenStatus && broken(policyStatus.lChainIndex ==
check->brokenStatus->lChainIndex)),
"%s[%d](%s): expected %d, got %d\n",
"%s[%ld](%s): expected %ld, got %ld\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lChainIndex, policyStatus.lChainIndex);
......@@ -5052,7 +5052,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
ok(policyStatus.lElementIndex == check->status.lElementIndex ||
(check->brokenStatus && broken(policyStatus.lElementIndex ==
check->brokenStatus->lElementIndex)),
"%s[%d](%s): expected %d, got %d\n",
"%s[%ld](%s): expected %ld, got %ld\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lElementIndex, policyStatus.lElementIndex);
......@@ -5369,7 +5369,7 @@ static void testVerifyCertChainPolicy(void)
SetLastError(0xdeadbeef);
ret = pCertVerifyCertificateChainPolicy(NULL, NULL, NULL, &policyStatus);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
/* Crashes
ret = pCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_BASE, NULL, NULL,
&policyStatus);
......@@ -5388,21 +5388,21 @@ static void testVerifyCertChainPolicy(void)
/* Size of policy status is apparently ignored, as is pChainPolicyPara */
ret = pCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_BASE, chain, NULL,
&policyStatus);
ok(ret, "CertVerifyCertificateChainPolicy failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCertificateChainPolicy failed: %08lx\n", GetLastError());
ok(policyStatus.dwError == CERT_E_UNTRUSTEDROOT ||
policyStatus.dwError == TRUST_E_CERT_SIGNATURE, /* win7 + win8 */
"Expected CERT_E_UNTRUSTEDROOT or TRUST_E_CERT_SIGNATURE, got %08x\n", policyStatus.dwError);
"Expected CERT_E_UNTRUSTEDROOT or TRUST_E_CERT_SIGNATURE, got %08lx\n", policyStatus.dwError);
ok(policyStatus.lChainIndex == 0 && policyStatus.lElementIndex == 0,
"Expected both indexes 0, got %d, %d\n", policyStatus.lChainIndex,
"Expected both indexes 0, got %ld, %ld\n", policyStatus.lChainIndex,
policyStatus.lElementIndex);
ret = pCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_BASE, chain,
&policyPara, &policyStatus);
ok(ret, "CertVerifyCertificateChainPolicy failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCertificateChainPolicy failed: %08lx\n", GetLastError());
ok(policyStatus.dwError == CERT_E_UNTRUSTEDROOT ||
policyStatus.dwError == TRUST_E_CERT_SIGNATURE, /* win7 + win8 */
"Expected CERT_E_UNTRUSTEDROOT or TRUST_E_CERT_SIGNATURE, got %08x\n", policyStatus.dwError);
"Expected CERT_E_UNTRUSTEDROOT or TRUST_E_CERT_SIGNATURE, got %08lx\n", policyStatus.dwError);
ok(policyStatus.lChainIndex == 0 && policyStatus.lElementIndex == 0,
"Expected both indexes 0, got %d, %d\n", policyStatus.lChainIndex,
"Expected both indexes 0, got %ld, %ld\n", policyStatus.lChainIndex,
policyStatus.lElementIndex);
pCertFreeCertificateChain(chain);
CertFreeCertificateContext(cert);
......
......@@ -96,11 +96,11 @@ static void testCreateCRL(void)
context = CertCreateCRLContext(0, NULL, 0);
ok(!context && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
context = CertCreateCRLContext(X509_ASN_ENCODING, NULL, 0);
GLE = GetLastError();
ok(!context && (GLE == CRYPT_E_ASN1_EOD || GLE == OSS_MORE_INPUT),
"Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08x\n", GLE);
"Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08lx\n", GLE);
context = CertCreateCRLContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
ok(!context, "Expected failure\n");
context = CertCreateCRLContext(X509_ASN_ENCODING, signedCRL,
......@@ -108,11 +108,11 @@ static void testCreateCRL(void)
ok(!context, "Expected failure\n");
context = CertCreateCRLContext(X509_ASN_ENCODING, signedCRL,
sizeof(signedCRL));
ok(context != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError());
ok(context != NULL, "CertCreateCRLContext failed: %08lx\n", GetLastError());
if (context)
CertFreeCRLContext(context);
context = CertCreateCRLContext(X509_ASN_ENCODING, CRL, sizeof(CRL));
ok(context != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError());
ok(context != NULL, "CertCreateCRLContext failed: %08lx\n", GetLastError());
if (context)
CertFreeCRLContext(context);
}
......@@ -148,41 +148,41 @@ static void testAddCRL(void)
BOOL ret;
DWORD GLE;
ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
if (!store) return;
/* Bad CRL encoding type */
ret = CertAddEncodedCRLToStore(0, 0, NULL, 0, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, 0, NULL, 0, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(0, 0, signedCRL, sizeof(signedCRL), 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, 0, signedCRL, sizeof(signedCRL), 0,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(0, 0, signedCRL, sizeof(signedCRL),
CERT_STORE_ADD_ALWAYS, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, 0, signedCRL, sizeof(signedCRL),
CERT_STORE_ADD_ALWAYS, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* No CRL */
ret = CertAddEncodedCRLToStore(0, X509_ASN_ENCODING, NULL, 0, 0, NULL);
GLE = GetLastError();
ok(!ret && (GLE == CRYPT_E_ASN1_EOD || GLE == OSS_MORE_INPUT),
"Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08x\n", GLE);
"Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08lx\n", GLE);
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, NULL, 0, 0, NULL);
GLE = GetLastError();
ok(!ret && (GLE == CRYPT_E_ASN1_EOD || GLE == OSS_MORE_INPUT),
"Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08x\n", GLE);
"Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08lx\n", GLE);
/* Weird--bad add disposition leads to an access violation in Windows.
* Both tests crash on some win9x boxes.
......@@ -193,12 +193,12 @@ static void testAddCRL(void)
sizeof(signedCRL), 0, NULL);
ok(!ret && (GetLastError() == STATUS_ACCESS_VIOLATION ||
GetLastError() == E_INVALIDARG /* Vista */),
"Expected STATUS_ACCESS_VIOLATION or E_INVALIDARG, got %08x\n", GetLastError());
"Expected STATUS_ACCESS_VIOLATION or E_INVALIDARG, got %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, signedCRL,
sizeof(signedCRL), 0, NULL);
ok(!ret && (GetLastError() == STATUS_ACCESS_VIOLATION ||
GetLastError() == E_INVALIDARG /* Vista */),
"Expected STATUS_ACCESS_VIOLATION or E_INVALIDARG, got %08x\n", GetLastError());
"Expected STATUS_ACCESS_VIOLATION or E_INVALIDARG, got %08lx\n", GetLastError());
}
/* Weird--can add a CRL to the NULL store (does this have special meaning?)
......@@ -206,28 +206,28 @@ static void testAddCRL(void)
context = NULL;
ret = CertAddEncodedCRLToStore(0, X509_ASN_ENCODING, signedCRL,
sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, &context);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
if (context)
CertFreeCRLContext(context);
/* Normal cases: a "signed" CRL is okay.. */
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, signedCRL,
sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
/* and an unsigned one is too. */
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, CRL, sizeof(CRL),
CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, newerCRL,
sizeof(newerCRL), CERT_STORE_ADD_NEW, NULL);
ok(!ret && GetLastError() == CRYPT_E_EXISTS,
"Expected CRYPT_E_EXISTS, got %08x\n", GetLastError());
"Expected CRYPT_E_EXISTS, got %08lx\n", GetLastError());
/* This should replace (one of) the existing CRL(s). */
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, newerCRL,
sizeof(newerCRL), CERT_STORE_ADD_NEWER, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
CertCloseStore(store, 0);
......@@ -441,12 +441,12 @@ static void testFindCRL(void)
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
if (!store) return;
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, signedCRL,
sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
/* Crashes
context = pCertFindCRLInStore(NULL, 0, 0, 0, NULL, NULL);
......@@ -477,7 +477,7 @@ static void testFindCRL(void)
/* Try to match an issuer that isn't in the store */
cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert2,
sizeof(bigCert2));
ok(cert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
context = pCertFindCRLInStore(store, 0, 0, CRL_FIND_ISSUED_BY, cert, NULL);
ok(context == NULL, "Expected no matching context\n");
......@@ -486,7 +486,7 @@ static void testFindCRL(void)
/* Match an issuer that is in the store */
cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
sizeof(bigCert));
ok(cert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
context = pCertFindCRLInStore(store, 0, 0, CRL_FIND_ISSUED_BY, cert, NULL);
ok(context != NULL, "Expected a context\n");
......@@ -522,7 +522,7 @@ static void testFindCRL(void)
if (context)
{
ok(context->cbCrlEncoded == sizeof(signedCRL),
"unexpected CRL size %d\n", context->cbCrlEncoded);
"unexpected CRL size %ld\n", context->cbCrlEncoded);
ok(!memcmp(context->pbCrlEncoded, signedCRL, context->cbCrlEncoded),
"unexpected CRL data\n");
CertFreeCRLContext(context);
......@@ -531,14 +531,14 @@ static void testFindCRL(void)
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING,
v1CRLWithIssuerAndEntry, sizeof(v1CRLWithIssuerAndEntry),
CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING,
v2CRLWithIssuingDistPoint, sizeof(v2CRLWithIssuingDistPoint),
CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING,
verisignCRL, sizeof(verisignCRL), CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
issuedForPara.pSubjectCert = cert;
issuedForPara.pIssuerCert = cert;
context = NULL;
......@@ -561,19 +561,19 @@ static void testFindCRL(void)
* is 0.
*/
ok(count == 3 || broken(count == 0 /* NT4, Win9x */),
"expected 3 matching CRLs, got %d\n", count);
"expected 3 matching CRLs, got %ld\n", count);
/* Only v1CRLWithIssuerAndEntry and v2CRLWithIssuingDistPoint contain
* entries, so the count of CRL entries that match cert is 2.
*/
ok(revoked_count == 2 || broken(revoked_count == 0 /* NT4, Win9x */),
"expected 2 matching CRL entries, got %d\n", revoked_count);
"expected 2 matching CRL entries, got %ld\n", revoked_count);
CertFreeCertificateContext(cert);
/* Try again with a cert that doesn't match any CRLs in the store */
cert = CertCreateCertificateContext(X509_ASN_ENCODING,
bigCertWithDifferentIssuer, sizeof(bigCertWithDifferentIssuer));
ok(cert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
issuedForPara.pSubjectCert = cert;
issuedForPara.pIssuerCert = cert;
......@@ -592,8 +592,8 @@ static void testFindCRL(void)
revoked_count++;
}
} while (context);
ok(count == 0, "expected 0 matching CRLs, got %d\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %d\n",
ok(count == 0, "expected 0 matching CRLs, got %ld\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %ld\n",
revoked_count);
CertFreeCertificateContext(cert);
......@@ -602,7 +602,7 @@ static void testFindCRL(void)
*/
cert = CertCreateCertificateContext(X509_ASN_ENCODING,
verisignCommercialSoftPubCA, sizeof(verisignCommercialSoftPubCA));
ok(cert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
issuedForPara.pIssuerCert = cert;
issuedForPara.pSubjectCert = cert;
......@@ -622,8 +622,8 @@ static void testFindCRL(void)
}
} while (context);
ok(count == 1 || broken(count == 0 /* Win9x, NT4 */),
"expected 1 matching CRLs, got %d\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %d\n",
"expected 1 matching CRLs, got %ld\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %ld\n",
revoked_count);
CertFreeCertificateContext(cert);
......@@ -662,9 +662,9 @@ static void testFindCRL(void)
}
} while (context);
ok(count == 1 || broken(count == 0 /* Win9x, NT4 */),
"expected 1 matching CRLs, got %d\n", count);
"expected 1 matching CRLs, got %ld\n", count);
ok(revoked_count == 1 || broken(revoked_count == 0 /* Win9x, NT4 */),
"expected 1 matching CRL entries, got %d\n", revoked_count);
"expected 1 matching CRL entries, got %ld\n", revoked_count);
/* Test CRL_FIND_ISSUED_BY flags */
count = revoked_count = 0;
......@@ -681,8 +681,8 @@ static void testFindCRL(void)
revoked_count++;
}
} while (context);
ok(count == 0, "expected 0 matching CRLs, got %d\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %d\n",
ok(count == 0, "expected 0 matching CRLs, got %ld\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %ld\n",
revoked_count);
count = revoked_count = 0;
do {
......@@ -698,8 +698,8 @@ static void testFindCRL(void)
revoked_count++;
}
} while (context);
ok(count == 1, "expected 1 matching CRLs, got %d\n", count);
ok(revoked_count == 1, "expected 1 matching CRL entries, got %d\n",
ok(count == 1, "expected 1 matching CRLs, got %ld\n", count);
ok(revoked_count == 1, "expected 1 matching CRL entries, got %ld\n",
revoked_count);
count = revoked_count = 0;
do {
......@@ -715,8 +715,8 @@ static void testFindCRL(void)
revoked_count++;
}
} while (context);
ok(count == 0, "expected 0 matching CRLs, got %d\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %d\n",
ok(count == 0, "expected 0 matching CRLs, got %ld\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %ld\n",
revoked_count);
count = revoked_count = 0;
do {
......@@ -733,8 +733,8 @@ static void testFindCRL(void)
}
} while (context);
ok(count == 0 || broken(count == 1 /* Win9x */),
"expected 0 matching CRLs, got %d\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %d\n",
"expected 0 matching CRLs, got %ld\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %ld\n",
revoked_count);
count = revoked_count = 0;
do {
......@@ -751,8 +751,8 @@ static void testFindCRL(void)
revoked_count++;
}
} while (context);
ok(count == 0, "expected 0 matching CRLs, got %d\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %d\n",
ok(count == 0, "expected 0 matching CRLs, got %ld\n", count);
ok(revoked_count == 0, "expected 0 matching CRL entries, got %ld\n",
revoked_count);
count = revoked_count = 0;
do {
......@@ -769,8 +769,8 @@ static void testFindCRL(void)
revoked_count++;
}
} while (context);
ok(count == 1, "expected 1 matching CRLs, got %d\n", count);
ok(revoked_count == 1, "expected 1 matching CRL entries, got %d\n",
ok(count == 1, "expected 1 matching CRLs, got %ld\n", count);
ok(revoked_count == 1, "expected 1 matching CRL entries, got %ld\n",
revoked_count);
CertFreeCertificateContext(rootCert);
CertFreeCertificateContext(endCert);
......@@ -787,7 +787,7 @@ static void testGetCRLFromStore(void)
DWORD flags;
BOOL ret;
ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
if (!store) return;
/* Crash
......@@ -799,17 +799,17 @@ static void testGetCRLFromStore(void)
flags = 0xffffffff;
context = CertGetCRLFromStore(store, NULL, NULL, &flags);
ok(!context && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* Test an empty store */
flags = 0;
context = CertGetCRLFromStore(store, NULL, NULL, &flags);
ok(context == NULL && GetLastError() == CRYPT_E_NOT_FOUND,
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, signedCRL,
sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
/* NULL matches any CRL */
flags = 0;
......@@ -820,17 +820,17 @@ static void testGetCRLFromStore(void)
/* This cert's issuer isn't in */
cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert2,
sizeof(bigCert2));
ok(cert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
context = CertGetCRLFromStore(store, cert, NULL, &flags);
ok(context == NULL && GetLastError() == CRYPT_E_NOT_FOUND,
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
CertFreeCertificateContext(cert);
/* But this one is */
cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
sizeof(bigCert));
ok(cert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
context = CertGetCRLFromStore(store, cert, NULL, &flags);
ok(context != NULL, "Expected a context\n");
......@@ -851,10 +851,10 @@ static void checkCRLHash(const BYTE *data, DWORD dataLen, ALG_ID algID,
memset(hashProperty, 0, sizeof(hashProperty));
size = sizeof(hash);
ret = CryptHashCertificate(0, algID, 0, data, dataLen, hash, &size);
ok(ret, "CryptHashCertificate failed: %08x\n", GetLastError());
ok(ret, "CryptHashCertificate failed: %08lx\n", GetLastError());
ret = CertGetCRLContextProperty(context, propID, hashProperty, &size);
ok(ret, "CertGetCRLContextProperty failed: %08x\n", GetLastError());
ok(!memcmp(hash, hashProperty, size), "Unexpected hash for property %d\n",
ok(ret, "CertGetCRLContextProperty failed: %08lx\n", GetLastError());
ok(!memcmp(hash, hashProperty, size), "Unexpected hash for property %ld\n",
propID);
}
......@@ -863,7 +863,7 @@ static void testCRLProperties(void)
PCCRL_CONTEXT context = CertCreateCRLContext(X509_ASN_ENCODING,
CRL, sizeof(CRL));
ok(context != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError());
ok(context != NULL, "CertCreateCRLContext failed: %08lx\n", GetLastError());
if (context)
{
DWORD propID, numProps, access, size;
......@@ -882,12 +882,12 @@ static void testCRLProperties(void)
if (propID)
numProps++;
} while (propID != 0);
ok(numProps == 0, "Expected 0 properties, got %d\n", numProps);
ok(numProps == 0, "Expected 0 properties, got %ld\n", numProps);
/* Tests with a NULL cert context. Prop ID 0 fails.. */
ret = CertSetCRLContextProperty(NULL, 0, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* while this just crashes.
ret = CertSetCRLContextProperty(NULL, CERT_KEY_PROV_HANDLE_PROP_ID, 0,
NULL);
......@@ -895,7 +895,7 @@ static void testCRLProperties(void)
ret = CertSetCRLContextProperty(context, 0, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* Can't set the cert property directly, this crashes.
ret = CertSetCRLContextProperty(context, CERT_CRL_PROP_ID, 0, CRL);
*/
......@@ -912,14 +912,14 @@ static void testCRLProperties(void)
ret = CertGetCRLContextProperty(context, CERT_KEY_PROV_INFO_PROP_ID,
NULL, &size);
ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND,
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
/* And, an implicit property */
ret = CertGetCRLContextProperty(context, CERT_ACCESS_STATE_PROP_ID,
NULL, &size);
ok(ret, "CertGetCRLContextProperty failed: %08x\n", GetLastError());
ok(ret, "CertGetCRLContextProperty failed: %08lx\n", GetLastError());
ret = CertGetCRLContextProperty(context, CERT_ACCESS_STATE_PROP_ID,
&access, &size);
ok(ret, "CertGetCRLContextProperty failed: %08x\n", GetLastError());
ok(ret, "CertGetCRLContextProperty failed: %08lx\n", GetLastError());
ok(!(access & CERT_ACCESS_STATE_WRITE_PERSIST_FLAG),
"Didn't expect a persisted crl\n");
/* Trying to set this "read only" property crashes.
......@@ -932,16 +932,16 @@ static void testCRLProperties(void)
blob.pbData = hash;
blob.cbData = sizeof(hash);
ret = CertSetCRLContextProperty(context, CERT_HASH_PROP_ID, 0, &blob);
ok(ret, "CertSetCRLContextProperty failed: %08x\n",
ok(ret, "CertSetCRLContextProperty failed: %08lx\n",
GetLastError());
size = sizeof(hashProperty);
ret = CertGetCRLContextProperty(context, CERT_HASH_PROP_ID,
hashProperty, &size);
ok(ret, "CertSetCRLContextProperty failed: %08x\n", GetLastError());
ok(ret, "CertSetCRLContextProperty failed: %08lx\n", GetLastError());
ok(!memcmp(hashProperty, hash, sizeof(hash)), "Unexpected hash\n");
/* Delete the (bogus) hash, and get the real one */
ret = CertSetCRLContextProperty(context, CERT_HASH_PROP_ID, 0, NULL);
ok(ret, "CertSetCRLContextProperty failed: %08x\n", GetLastError());
ok(ret, "CertSetCRLContextProperty failed: %08lx\n", GetLastError());
checkCRLHash(CRL, sizeof(CRL), CALG_SHA1, context, CERT_HASH_PROP_ID);
/* Now that the hash property is set, we should get one property when
......@@ -954,7 +954,7 @@ static void testCRLProperties(void)
if (propID)
numProps++;
} while (propID != 0);
ok(numProps == 1, "Expected 1 properties, got %d\n", numProps);
ok(numProps == 1, "Expected 1 properties, got %ld\n", numProps);
/* Check a few other implicit properties */
checkCRLHash(CRL, sizeof(CRL), CALG_MD5, context,
......@@ -989,10 +989,10 @@ static void testIsValidCRLForCert(void)
crl = CertCreateCRLContext(X509_ASN_ENCODING, v1CRLWithIssuerAndEntry,
sizeof(v1CRLWithIssuerAndEntry));
ok(crl != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError());
ok(crl != NULL, "CertCreateCRLContext failed: %08lx\n", GetLastError());
cert1 = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
sizeof(bigCert));
ok(cert1 != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert1 != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
/* Crash
......@@ -1002,15 +1002,15 @@ static void testIsValidCRLForCert(void)
/* Curiously, any CRL is valid for the NULL certificate */
ret = pCertIsValidCRLForCertificate(NULL, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
/* Same issuer for both cert and CRL, this CRL is valid for that cert */
ret = pCertIsValidCRLForCertificate(cert1, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
cert2 = CertCreateCertificateContext(X509_ASN_ENCODING,
bigCertWithDifferentIssuer, sizeof(bigCertWithDifferentIssuer));
ok(cert2 != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert2 != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
/* Yet more curious: different issuers for these, yet the CRL is valid for
......@@ -1018,7 +1018,7 @@ static void testIsValidCRLForCert(void)
* CRL has a CRL_ISSUING_DIST_POINT extension.
*/
ret = pCertIsValidCRLForCertificate(cert2, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
CertFreeCRLContext(crl);
......@@ -1027,38 +1027,38 @@ static void testIsValidCRLForCert(void)
*/
crl = CertCreateCRLContext(X509_ASN_ENCODING, v2CRLWithIssuingDistPoint,
sizeof(v2CRLWithIssuingDistPoint));
ok(crl != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError());
ok(crl != NULL, "CertCreateCRLContext failed: %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert1, crl, 0, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert2, crl, 0, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
/* With a CRL_ISSUING_DIST_POINT in the CRL, it matches the cert containing
* a CRL_DIST_POINTS_INFO extension.
*/
cert3 = CertCreateCertificateContext(X509_ASN_ENCODING,
bigCertWithCRLDistPoints, sizeof(bigCertWithCRLDistPoints));
ok(cert3 != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert3 != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
ret = pCertIsValidCRLForCertificate(cert3, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
CertFreeCRLContext(crl);
/* And again, with a real CRL, the CRL is valid for all three certs. */
crl = CertCreateCRLContext(X509_ASN_ENCODING, verisignCRL,
sizeof(verisignCRL));
ok(crl != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError());
ok(crl != NULL, "CertCreateCRLContext failed: %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert1, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert2, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert3, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
CertFreeCRLContext(crl);
......@@ -1067,18 +1067,18 @@ static void testIsValidCRLForCert(void)
*/
store = CertOpenStore(CERT_STORE_PROV_MEMORY, X509_ASN_ENCODING, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
ok(store != NULL, "CertOpenStore failed: %08lx\n", GetLastError());
ret = CertAddEncodedCRLToStore(store, X509_ASN_ENCODING, verisignCRL,
sizeof(verisignCRL), CERT_STORE_ADD_ALWAYS, &crl);
ok(ret, "CertAddEncodedCRLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCRLToStore failed: %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert1, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert2, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
ret = pCertIsValidCRLForCertificate(cert3, crl, 0, NULL);
ok(ret, "CertIsValidCRLForCertificate failed: %08x\n", GetLastError());
ok(ret, "CertIsValidCRLForCertificate failed: %08lx\n", GetLastError());
CertFreeCRLContext(crl);
......@@ -1111,7 +1111,7 @@ static void testFindCertInCRL(void)
cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
sizeof(bigCert));
ok(cert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(cert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
/* Crash
......@@ -1127,14 +1127,14 @@ static void testFindCertInCRL(void)
crl = CertCreateCRLContext(X509_ASN_ENCODING, verisignCRL,
sizeof(verisignCRL));
ret = pCertFindCertificateInCRL(cert, crl, 0, NULL, &entry);
ok(ret, "CertFindCertificateInCRL failed: %08x\n", GetLastError());
ok(ret, "CertFindCertificateInCRL failed: %08lx\n", GetLastError());
ok(entry == NULL, "Expected not to find an entry in CRL\n");
CertFreeCRLContext(crl);
crl = CertCreateCRLContext(X509_ASN_ENCODING, v1CRLWithIssuerAndEntry,
sizeof(v1CRLWithIssuerAndEntry));
ret = pCertFindCertificateInCRL(cert, crl, 0, NULL, &entry);
ok(ret, "CertFindCertificateInCRL failed: %08x\n", GetLastError());
ok(ret, "CertFindCertificateInCRL failed: %08lx\n", GetLastError());
ok(entry != NULL, "Expected to find an entry in CRL\n");
CertFreeCRLContext(crl);
......@@ -1142,7 +1142,7 @@ static void testFindCertInCRL(void)
crl = CertCreateCRLContext(X509_ASN_ENCODING, crlWithDifferentIssuer,
sizeof(crlWithDifferentIssuer));
ret = pCertFindCertificateInCRL(cert, crl, 0, NULL, &entry);
ok(ret, "CertFindCertificateInCRL failed: %08x\n", GetLastError());
ok(ret, "CertFindCertificateInCRL failed: %08lx\n", GetLastError());
ok(entry != NULL, "Expected to find an entry in CRL\n");
CertFreeCRLContext(crl);
......@@ -1156,18 +1156,18 @@ static void testVerifyCRLRevocation(void)
PCCRL_CONTEXT crl;
ret = CertVerifyCRLRevocation(0, NULL, 0, NULL);
ok(ret, "CertVerifyCRLRevocation failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCRLRevocation failed: %08lx\n", GetLastError());
ret = CertVerifyCRLRevocation(X509_ASN_ENCODING, NULL, 0, NULL);
ok(ret, "CertVerifyCRLRevocation failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCRLRevocation failed: %08lx\n", GetLastError());
cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert,
sizeof(bigCert));
/* Check against no CRL */
ret = CertVerifyCRLRevocation(0, cert->pCertInfo, 0, NULL);
ok(ret, "CertVerifyCRLRevocation failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCRLRevocation failed: %08lx\n", GetLastError());
ret = CertVerifyCRLRevocation(X509_ASN_ENCODING, cert->pCertInfo, 0, NULL);
ok(ret, "CertVerifyCRLRevocation failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCRLRevocation failed: %08lx\n", GetLastError());
/* Check against CRL with entry for the cert */
crl = CertCreateCRLContext(X509_ASN_ENCODING, v1CRLWithIssuerAndEntry,
......@@ -1183,7 +1183,7 @@ static void testVerifyCRLRevocation(void)
/* Check against CRL with different issuer and entry for the cert */
crl = CertCreateCRLContext(X509_ASN_ENCODING, crlWithDifferentIssuer,
sizeof(crlWithDifferentIssuer));
ok(crl != NULL, "CertCreateCRLContext failed: %08x\n", GetLastError());
ok(crl != NULL, "CertCreateCRLContext failed: %08lx\n", GetLastError());
ret = CertVerifyCRLRevocation(X509_ASN_ENCODING, cert->pCertInfo, 1,
(PCRL_INFO *)&crl->pCrlInfo);
ok(!ret, "CertVerifyCRLRevocation should have been revoked\n");
......@@ -1194,10 +1194,10 @@ static void testVerifyCRLRevocation(void)
sizeof(verisignCRL));
ret = CertVerifyCRLRevocation(0, cert->pCertInfo, 1,
(PCRL_INFO *)&crl->pCrlInfo);
ok(ret, "CertVerifyCRLRevocation failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCRLRevocation failed: %08lx\n", GetLastError());
ret = CertVerifyCRLRevocation(X509_ASN_ENCODING, cert->pCertInfo, 1,
(PCRL_INFO *)&crl->pCrlInfo);
ok(ret, "CertVerifyCRLRevocation failed: %08x\n", GetLastError());
ok(ret, "CertVerifyCRLRevocation failed: %08lx\n", GetLastError());
CertFreeCRLContext(crl);
CertFreeCertificateContext(cert);
......
......@@ -114,13 +114,13 @@ static void testCreateCTL(void)
SetLastError(0xdeadbeef);
ctl = CertCreateCTLContext(0, NULL, 0);
ok(!ctl && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ctl = CertCreateCTLContext(X509_ASN_ENCODING, NULL, 0);
ok(!ctl &&
(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == OSS_MORE_INPUT), /* win9x */
"expected ERROR_INVALID_DATA, got %d (0x%08x)\n", GetLastError(),
"expected ERROR_INVALID_DATA, got %ld (0x%08lx)\n", GetLastError(),
GetLastError());
/* An empty CTL can't be created.. */
SetLastError(0xdeadbeef);
......@@ -128,7 +128,7 @@ static void testCreateCTL(void)
ok(!ctl &&
(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == OSS_DATA_ERROR), /* win9x */
"expected ERROR_INVALID_DATA, got %d (0x%08x)\n", GetLastError(),
"expected ERROR_INVALID_DATA, got %ld (0x%08lx)\n", GetLastError(),
GetLastError());
/* Nor can any of these "signed" CTLs whose inner content OID isn't
* szOID_CTL.
......@@ -139,7 +139,7 @@ static void testCreateCTL(void)
(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == CRYPT_E_UNEXPECTED_MSG_TYPE /* win9x */ ||
GetLastError() == ERROR_SUCCESS /* some win98 */),
"expected ERROR_INVALID_DATA, CRYPT_E_UNEXPECTED_MSG_TYPE, or ERROR_SUCCESS, got %d (0x%08x)\n", GetLastError(),
"expected ERROR_INVALID_DATA, CRYPT_E_UNEXPECTED_MSG_TYPE, or ERROR_SUCCESS, got %ld (0x%08lx)\n", GetLastError(),
GetLastError());
SetLastError(0xdeadbeef);
ctl = CertCreateCTLContext(X509_ASN_ENCODING, ctlWithOneEntry,
......@@ -149,7 +149,7 @@ static void testCreateCTL(void)
GetLastError() == CRYPT_E_UNEXPECTED_MSG_TYPE /* win9x */ ||
GetLastError() == OSS_DATA_ERROR /* some win98 */ ||
GetLastError() == ERROR_SUCCESS /* some win98 */),
"expected ERROR_INVALID_DATA, CRYPT_E_UNEXPECTED_MSG_TYPE, OSS_DATA_ERROR, or ERROR_SUCCESS, got %d (0x%08x)\n", GetLastError(),
"expected ERROR_INVALID_DATA, CRYPT_E_UNEXPECTED_MSG_TYPE, OSS_DATA_ERROR, or ERROR_SUCCESS, got %ld (0x%08lx)\n", GetLastError(),
GetLastError());
SetLastError(0xdeadbeef);
ctl = CertCreateCTLContext(X509_ASN_ENCODING,
......@@ -158,13 +158,13 @@ static void testCreateCTL(void)
(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == CRYPT_E_UNEXPECTED_MSG_TYPE /* win9x */ ||
GetLastError() == ERROR_SUCCESS /* some win98 */),
"expected ERROR_INVALID_DATA, got %d (0x%08x)\n", GetLastError(),
"expected ERROR_INVALID_DATA, got %ld (0x%08lx)\n", GetLastError(),
GetLastError());
/* This signed CTL with the appropriate inner content type can be decoded.
*/
ctl = CertCreateCTLContext(X509_ASN_ENCODING,
signedCTLWithCTLInnerContent, sizeof(signedCTLWithCTLInnerContent));
ok(ctl != NULL, "CertCreateCTLContext failed: %08x\n", GetLastError());
ok(ctl != NULL, "CertCreateCTLContext failed: %08lx\n", GetLastError());
if (ctl)
{
/* Even though the CTL was decoded with X509_ASN_ENCODING, the
......@@ -172,7 +172,7 @@ static void testCreateCTL(void)
*/
ok(ctl->dwMsgAndCertEncodingType ==
(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING),
"expected X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, got %08x\n",
"expected X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, got %08lx\n",
ctl->dwMsgAndCertEncodingType);
CertFreeCTLContext(ctl);
}
......@@ -182,7 +182,7 @@ static void testCreateCTL(void)
ctl = CertCreateCTLContext(X509_ASN_ENCODING,
signedCTLWithCTLInnerContentAndBadSig,
sizeof(signedCTLWithCTLInnerContentAndBadSig));
ok(ctl != NULL, "CertCreateCTLContext failed: %08x\n", GetLastError());
ok(ctl != NULL, "CertCreateCTLContext failed: %08lx\n", GetLastError());
if (ctl)
CertFreeCTLContext(ctl);
}
......@@ -221,12 +221,12 @@ static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID,
memset(hashProperty, 0, sizeof(hashProperty));
size = sizeof(hash);
ret = CryptHashCertificate(0, algID, 0, data, dataLen, hash, &size);
ok(ret, "CryptHashCertificate failed: %08x\n", GetLastError());
ok(ret, "CryptHashCertificate failed: %08lx\n", GetLastError());
ret = CertGetCTLContextProperty(context, propID, hashProperty, &size);
ok(ret, "CertGetCTLContextProperty failed: %08x\n", GetLastError());
ok(ret, "CertGetCTLContextProperty failed: %08lx\n", GetLastError());
if (ret)
ok(!memcmp(hash, hashProperty, size),
"Unexpected hash for property %d\n", propID);
"Unexpected hash for property %ld\n", propID);
}
static void testCTLProperties(void)
......@@ -239,7 +239,7 @@ static void testCTLProperties(void)
signedCTLWithCTLInnerContent, sizeof(signedCTLWithCTLInnerContent));
if (!ctl)
{
skip("CertCreateCTLContext failed: %08x\n", GetLastError());
skip("CertCreateCTLContext failed: %08lx\n", GetLastError());
return;
}
......@@ -251,17 +251,17 @@ static void testCTLProperties(void)
if (propID)
numProps++;
} while (propID != 0);
ok(numProps == 0, "Expected 0 properties, got %d\n", numProps);
ok(numProps == 0, "Expected 0 properties, got %ld\n", numProps);
/* An implicit property */
ret = CertGetCTLContextProperty(ctl, CERT_ACCESS_STATE_PROP_ID, NULL,
&size);
ok(ret || broken(GetLastError() == CRYPT_E_NOT_FOUND /* some win98 */),
"CertGetCTLContextProperty failed: %08x\n", GetLastError());
"CertGetCTLContextProperty failed: %08lx\n", GetLastError());
ret = CertGetCTLContextProperty(ctl, CERT_ACCESS_STATE_PROP_ID, &access,
&size);
ok(ret || broken(GetLastError() == CRYPT_E_NOT_FOUND /* some win98 */),
"CertGetCTLContextProperty failed: %08x\n", GetLastError());
"CertGetCTLContextProperty failed: %08lx\n", GetLastError());
if (ret)
ok(!(access & CERT_ACCESS_STATE_WRITE_PERSIST_FLAG),
"Didn't expect a persisted cert\n");
......@@ -279,7 +279,7 @@ static void testCTLProperties(void)
if (propID)
numProps++;
} while (propID != 0);
ok(numProps == 1, "Expected 1 properties, got %d\n", numProps);
ok(numProps == 1, "Expected 1 properties, got %ld\n", numProps);
checkHash(signedCTLWithCTLInnerContent,
sizeof(signedCTLWithCTLInnerContent), CALG_MD5, ctl,
......@@ -360,12 +360,12 @@ static void testAddCTLToStore(void)
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithCTLInnerContent, sizeof(signedCTLWithCTLInnerContent),
CERT_STORE_ADD_ALWAYS, NULL);
ok(ret, "CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCTLToStore failed: %08lx\n", GetLastError());
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithCTLInnerContentAndBadSig,
sizeof(signedCTLWithCTLInnerContentAndBadSig), CERT_STORE_ADD_ALWAYS,
NULL);
ok(ret, "CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCTLToStore failed: %08lx\n", GetLastError());
/* Check that two exist */
numCTLs = 0;
ctl = NULL;
......@@ -374,7 +374,7 @@ static void testAddCTLToStore(void)
if (ctl)
numCTLs++;
} while (ctl);
ok(numCTLs == 2, "expected 2 CTLs, got %d\n", numCTLs);
ok(numCTLs == 2, "expected 2 CTLs, got %ld\n", numCTLs);
CertCloseStore(store, 0);
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
......@@ -383,7 +383,7 @@ static void testAddCTLToStore(void)
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithCTLInnerContent, sizeof(signedCTLWithCTLInnerContent),
CERT_STORE_ADD_NEW, NULL);
ok(ret, "CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCTLToStore failed: %08lx\n", GetLastError());
/* so adding the second CTL fails. */
SetLastError(0xdeadbeef);
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
......@@ -391,7 +391,7 @@ static void testAddCTLToStore(void)
sizeof(signedCTLWithCTLInnerContentAndBadSig), CERT_STORE_ADD_NEW,
NULL);
ok(!ret && (GetLastError() == CRYPT_E_EXISTS || GetLastError() == OSS_DATA_ERROR),
"expected CRYPT_E_EXISTS or OSS_DATA_ERROR, got %d %08x\n", ret, GetLastError());
"expected CRYPT_E_EXISTS or OSS_DATA_ERROR, got %d %08lx\n", ret, GetLastError());
CertCloseStore(store, 0);
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
......@@ -402,13 +402,13 @@ static void testAddCTLToStore(void)
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithCTLInnerContent, sizeof(signedCTLWithCTLInnerContent),
CERT_STORE_ADD_NEW, NULL);
ok(ret, "CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCTLToStore failed: %08lx\n", GetLastError());
expectedCTLs = 1;
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithUsage, sizeof(signedCTLWithUsage), CERT_STORE_ADD_NEW,
NULL);
ok(ret || broken(GetLastError() == OSS_DATA_ERROR /* some win98 */),
"CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
"CertAddEncodedCTLToStore failed: %08lx\n", GetLastError());
if (ret)
expectedCTLs++;
/* Check that two exist */
......@@ -419,7 +419,7 @@ static void testAddCTLToStore(void)
if (ctl)
numCTLs++;
} while (ctl);
ok(numCTLs == expectedCTLs, "expected %d CTLs, got %d\n", expectedCTLs,
ok(numCTLs == expectedCTLs, "expected %ld CTLs, got %ld\n", expectedCTLs,
numCTLs);
CertCloseStore(store, 0);
......@@ -436,11 +436,11 @@ static void testAddCTLToStore(void)
skip("adding a CTL with an empty usage not supported\n");
return;
}
ok(ret, "CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCTLToStore failed: %08lx\n", GetLastError());
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithListID2, sizeof(signedCTLWithListID2), CERT_STORE_ADD_NEW,
NULL);
ok(ret, "CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
ok(ret, "CertAddEncodedCTLToStore failed: %08lx\n", GetLastError());
/* Check that two exist */
numCTLs = 0;
ctl = NULL;
......@@ -449,7 +449,7 @@ static void testAddCTLToStore(void)
if (ctl)
numCTLs++;
} while (ctl);
ok(numCTLs == 2, "expected 2 CTLs, got %d\n", numCTLs);
ok(numCTLs == 2, "expected 2 CTLs, got %ld\n", numCTLs);
CertCloseStore(store, 0);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -42,7 +42,7 @@ static void test_findAttribute(void)
SetLastError(0xdeadbeef);
ret = CertFindAttribute(NULL, 0, NULL);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
if (0)
{
......@@ -54,25 +54,25 @@ static void test_findAttribute(void)
SetLastError(0xdeadbeef);
ret = CertFindAttribute(NULL, 1, &attr);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d (%08x)\n", GetLastError(),
"Expected ERROR_INVALID_PARAMETER, got %ld (%08lx)\n", GetLastError(),
GetLastError());
}
/* returns NULL, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindAttribute("bogus", 1, &attr);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
/* returns NULL, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindAttribute("1.2.4", 1, &attr);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
/* succeeds, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindAttribute("1.2.3", 1, &attr);
ok(ret != NULL, "CertFindAttribute failed: %08x\n", GetLastError());
ok(ret != NULL, "CertFindAttribute failed: %08lx\n", GetLastError());
}
static void test_findExtension(void)
......@@ -86,7 +86,7 @@ static void test_findExtension(void)
SetLastError(0xdeadbeef);
ret = CertFindExtension(NULL, 0, NULL);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
if (0)
{
......@@ -99,25 +99,25 @@ static void test_findExtension(void)
SetLastError(0xdeadbeef);
ret = CertFindExtension(NULL, 1, &ext);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d (%08x)\n", GetLastError(),
"Expected ERROR_INVALID_PARAMETER, got %ld (%08lx)\n", GetLastError(),
GetLastError());
}
/* returns NULL, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindExtension("bogus", 1, &ext);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
/* returns NULL, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindExtension("1.2.4", 1, &ext);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
/* succeeds, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindExtension("1.2.3", 1, &ext);
ok(ret != NULL, "CertFindExtension failed: %08x\n", GetLastError());
ok(ret != NULL, "CertFindExtension failed: %08lx\n", GetLastError());
}
static void test_findRDNAttr(void)
......@@ -142,25 +142,25 @@ static void test_findRDNAttr(void)
SetLastError(0xdeadbeef);
ret = CertFindRDNAttr(NULL, &nameInfo);
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d (%08x)\n", GetLastError(),
"Expected ERROR_INVALID_PARAMETER, got %ld (%08lx)\n", GetLastError(),
GetLastError());
}
/* returns NULL, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindRDNAttr("bogus", &nameInfo);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
/* returns NULL, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindRDNAttr("1.2.4", &nameInfo);
ok(ret == NULL, "Expected failure\n");
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08x\n",
ok(GetLastError() == 0xdeadbeef, "Last error was set to %08lx\n",
GetLastError());
/* succeeds, last error not set */
SetLastError(0xdeadbeef);
ret = CertFindRDNAttr("1.2.3", &nameInfo);
ok(ret != NULL, "CertFindRDNAttr failed: %08x\n", GetLastError());
ok(ret != NULL, "CertFindRDNAttr failed: %08lx\n", GetLastError());
}
static void test_verifyTimeValidity(void)
......@@ -178,16 +178,16 @@ static void test_verifyTimeValidity(void)
*/
/* Check with 0 NotBefore and NotAfter */
ret = CertVerifyTimeValidity(&fileTime, &info);
ok(ret == 1, "Expected 1, got %d\n", ret);
ok(ret == 1, "Expected 1, got %ld\n", ret);
info.NotAfter = fileTime;
/* Check with NotAfter equal to comparison time */
ret = CertVerifyTimeValidity(&fileTime, &info);
ok(ret == 0, "Expected 0, got %d\n", ret);
ok(ret == 0, "Expected 0, got %ld\n", ret);
/* Check with NotBefore after comparison time */
info.NotBefore = fileTime;
info.NotBefore.dwLowDateTime += 5000;
ret = CertVerifyTimeValidity(&fileTime, &info);
ok(ret == -1, "Expected -1, got %d\n", ret);
ok(ret == -1, "Expected -1, got %ld\n", ret);
}
static void test_cryptAllocate(void)
......@@ -195,12 +195,12 @@ static void test_cryptAllocate(void)
LPVOID buf;
buf = CryptMemAlloc(0);
ok(buf != NULL, "CryptMemAlloc failed: %08x\n", GetLastError());
ok(buf != NULL, "CryptMemAlloc failed: %08lx\n", GetLastError());
CryptMemFree(buf);
/* CryptMemRealloc(NULL, 0) fails pre-Vista */
buf = CryptMemAlloc(0);
buf = CryptMemRealloc(buf, 1);
ok(buf != NULL, "CryptMemRealloc failed: %08x\n", GetLastError());
ok(buf != NULL, "CryptMemRealloc failed: %08lx\n", GetLastError());
CryptMemFree(buf);
}
......@@ -223,7 +223,7 @@ static void test_cryptTls(void)
/* One normal pass */
index = pI_CryptAllocTls();
ok(index, "I_CryptAllocTls failed: %08x\n", GetLastError());
ok(index, "I_CryptAllocTls failed: %08lx\n", GetLastError());
if (index)
{
LPVOID ptr;
......@@ -231,22 +231,22 @@ static void test_cryptTls(void)
ptr = pI_CryptGetTls(index);
ok(!ptr, "Expected NULL\n");
ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef);
ok(ret, "I_CryptSetTls failed: %08x\n", GetLastError());
ok(ret, "I_CryptSetTls failed: %08lx\n", GetLastError());
ptr = pI_CryptGetTls(index);
ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr);
/* This crashes
ret = pI_CryptFreeTls(index, 1);
*/
ret = pI_CryptFreeTls(index, 0);
ok(ret, "I_CryptFreeTls failed: %08x\n", GetLastError());
ok(ret, "I_CryptFreeTls failed: %08lx\n", GetLastError());
ret = pI_CryptFreeTls(index, 0);
ok(!ret, "I_CryptFreeTls succeeded\n");
ok(GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
}
/* Similar pass, check I_CryptDetachTls */
index = pI_CryptAllocTls();
ok(index, "I_CryptAllocTls failed: %08x\n", GetLastError());
ok(index, "I_CryptAllocTls failed: %08lx\n", GetLastError());
if (index)
{
LPVOID ptr;
......@@ -254,7 +254,7 @@ static void test_cryptTls(void)
ptr = pI_CryptGetTls(index);
ok(!ptr, "Expected NULL\n");
ret = pI_CryptSetTls(index, (LPVOID)0xdeadbeef);
ok(ret, "I_CryptSetTls failed: %08x\n", GetLastError());
ok(ret, "I_CryptSetTls failed: %08lx\n", GetLastError());
ptr = pI_CryptGetTls(index);
ok(ptr == (LPVOID)0xdeadbeef, "Expected 0xdeadbeef, got %p\n", ptr);
ptr = pI_CryptDetachTls(index);
......@@ -299,7 +299,7 @@ static void test_readTrustedPublisherDWORD(void)
ret = pReadDWORD(authenticodeFlags, &returnedFlags);
ok(ret == exists, "Unexpected return value\n");
ok(readFlags == returnedFlags,
"Expected flags %08x, got %08x\n", readFlags, returnedFlags);
"Expected flags %08lx, got %08lx\n", readFlags, returnedFlags);
}
}
......@@ -337,28 +337,28 @@ static void test_getDefaultCryptProv(void)
prov = pI_CryptGetDefaultCryptProv(0xdeadbeef);
ok(prov == 0 && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
prov = pI_CryptGetDefaultCryptProv(PROV_RSA_FULL);
ok(prov == 0 && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
prov = pI_CryptGetDefaultCryptProv(1);
ok(prov == 0 && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
prov = pI_CryptGetDefaultCryptProv(0);
ok(prov != 0, "I_CryptGetDefaultCryptProv failed: %08x\n", GetLastError());
ok(prov != 0, "I_CryptGetDefaultCryptProv failed: %08lx\n", GetLastError());
CryptReleaseContext(prov, 0);
for (i = 0; i < ARRAY_SIZE(test_prov); i++)
{
if (winetest_debug > 1)
trace("%u: algid %#x (%s): class %u, type %u, sid %u\n", i, test_prov[i].algid, test_prov[i].name,
trace("%lu: algid %#x (%s): class %u, type %u, sid %u\n", i, test_prov[i].algid, test_prov[i].name,
GET_ALG_CLASS(test_prov[i].algid) >> 13, GET_ALG_TYPE(test_prov[i].algid) >> 9, GET_ALG_SID(test_prov[i].algid));
prov = pI_CryptGetDefaultCryptProv(test_prov[i].algid);
if (!prov)
{
todo_wine_if(test_prov[i].algid == CALG_DSS_SIGN || test_prov[i].algid == CALG_NO_SIGN)
ok(test_prov[i].optional, "%u: I_CryptGetDefaultCryptProv(%#x) failed\n", i, test_prov[i].algid);
ok(test_prov[i].optional, "%lu: I_CryptGetDefaultCryptProv(%#x) failed\n", i, test_prov[i].algid);
continue;
}
......@@ -367,9 +367,9 @@ static void test_getDefaultCryptProv(void)
{
name = CryptMemAlloc(size);
ret = CryptGetProvParam(prov, PP_NAME, (BYTE *)name, &size, 0);
ok(ret, "%u: CryptGetProvParam failed %#x\n", i, GetLastError());
ok(ret, "%lu: CryptGetProvParam failed %#lx\n", i, GetLastError());
if (winetest_debug > 1)
trace("%u: algid %#x, name %s\n", i, test_prov[i].algid, name);
trace("%lu: algid %#x, name %s\n", i, test_prov[i].algid, name);
CryptMemFree(name);
}
......@@ -417,7 +417,7 @@ static void test_format_object(void)
SetLastError(0xdeadbeef);
ret = CryptFormatObject(0, 0, 0, NULL, NULL, NULL, 0, NULL, &size);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError());
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError());
/* When called with the default encoding type for any undefined struct type
* (including none), it succeeds: the default encoding is a hex string
......@@ -425,38 +425,38 @@ static void test_format_object(void)
*/
SetLastError(0xdeadbeef);
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL, NULL, NULL, 0, NULL, &size);
ok(ret, "CryptFormatObject failed: %d\n", GetLastError());
ok(size == sizeof(WCHAR) || broken(!size) /* Win10 1709+ */, "wrong size %d\n", size);
ok(ret, "CryptFormatObject failed: %ld\n", GetLastError());
ok(size == sizeof(WCHAR) || broken(!size) /* Win10 1709+ */, "wrong size %ld\n", size);
SetLastError(0xdeadbeef);
size = 0;
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL, NULL, NULL, 0, str, &size);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_MORE_DATA, "wrong error %u\n", GetLastError());
ok(GetLastError() == ERROR_MORE_DATA, "wrong error %lu\n", GetLastError());
size = sizeof(WCHAR);
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL, NULL, NULL, 0, str, &size);
ok(ret, "CryptFormatObject failed, error %u\n", GetLastError());
ok(ret, "CryptFormatObject failed, error %lu\n", GetLastError());
ok(!str[0], "expected empty string\n");
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL, NULL, encodedInt,
sizeof(encodedInt), NULL, &size);
ok(ret, "CryptFormatObject failed, error %u\n", GetLastError());
ok(size >= sizeof(L"02 01 01"), "wrong size %u\n", size);
ok(ret, "CryptFormatObject failed, error %lu\n", GetLastError());
ok(size >= sizeof(L"02 01 01"), "wrong size %lu\n", size);
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL, NULL, encodedInt,
sizeof(encodedInt), str, &size);
ok(ret, "CryptFormatObject failed, error %u\n", GetLastError());
ok(ret, "CryptFormatObject failed, error %lu\n", GetLastError());
ok(!wcscmp(str, L"02 01 01"), "wrong string %s\n", wine_dbgstr_w(str));
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL, NULL, encodedBigInt,
sizeof(encodedBigInt), NULL, &size);
ok(ret, "CryptFormatObject failed, error %u\n", GetLastError());
ok(size >= sizeof(encodedBigIntStr), "wrong size %u\n", size);
ok(ret, "CryptFormatObject failed, error %lu\n", GetLastError());
ok(size >= sizeof(encodedBigIntStr), "wrong size %lu\n", size);
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL, NULL,
encodedBigInt, sizeof(encodedBigInt), str, &size);
ok(ret, "CryptFormatObject failed: %d\n", GetLastError());
ok(ret, "CryptFormatObject failed: %ld\n", GetLastError());
ok(!wcsicmp(str, encodedBigIntStr), "wrong string %s\n", wine_dbgstr_w(str));
/* When called with the default encoding type for any undefined struct
......@@ -469,7 +469,7 @@ static void test_format_object(void)
ok(!ret, "CryptFormatObject succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND
|| GetLastError() == 0xdeadbeef, /* Vista, W2K8 */
"wrong error %u\n", GetLastError());
"wrong error %lu\n", GetLastError());
/* When called to format an AUTHORITY_KEY_ID2_INFO, it fails when no
* data are given.
......@@ -478,7 +478,7 @@ static void test_format_object(void)
ret = CryptFormatObject(X509_ASN_ENCODING, 0, 0, NULL,
szOID_AUTHORITY_KEY_IDENTIFIER2, NULL, 0, NULL, &size);
ok(!ret, "expected failure\n");
ok(GetLastError() == E_INVALIDARG, "wrong error %u\n", GetLastError());
ok(GetLastError() == E_INVALIDARG, "wrong error %lu\n", GetLastError());
}
START_TEST(main)
......
......@@ -53,40 +53,40 @@ static void test_msg_get_signer_count(void)
SetLastError(0xdeadbeef);
count = CryptGetMessageSignerCount(0, NULL, 0);
ok(count == -1, "Expected -1, got %d\n", count);
ok(GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n",
ok(count == -1, "Expected -1, got %ld\n", count);
ok(GetLastError() == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n",
GetLastError());
SetLastError(0xdeadbeef);
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING, NULL, 0);
ok(count == -1, "Expected -1, got %d\n", count);
ok(count == -1, "Expected -1, got %ld\n", count);
ok(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG, /* win9x */
"Expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
dataEmptyBareContent, sizeof(dataEmptyBareContent));
ok(count == -1, "Expected -1, got %d\n", count);
ok(count == -1, "Expected -1, got %ld\n", count);
ok(GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == OSS_PDU_MISMATCH, /* win9x */
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
dataEmptyContent, sizeof(dataEmptyContent));
ok(count == -1, "Expected -1, got %d\n", count);
ok(count == -1, "Expected -1, got %ld\n", count);
ok(GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
signedEmptyBareContent, sizeof(signedEmptyBareContent));
ok(count == -1, "Expected -1, got %d\n", count);
ok(count == -1, "Expected -1, got %ld\n", count);
ok(GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == OSS_DATA_ERROR, /* win9x */
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
count = CryptGetMessageSignerCount(PKCS_7_ASN_ENCODING,
signedEmptyContent, sizeof(signedEmptyContent));
ok(count == 1 ||
broken(count == -1), /* win9x */
"Expected 1, got %d\n", count);
"Expected 1, got %ld\n", count);
}
static BYTE detachedHashContent[] = {
......@@ -115,13 +115,13 @@ static void test_verify_detached_message_hash(void)
ret = CryptVerifyDetachedMessageHash(&para, NULL, 0, 0, NULL, NULL, NULL,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageHash(&para, NULL, 0, 0, NULL, NULL, NULL,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
para.dwMsgEncodingType = PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageHash(&para, NULL, 0, 0, NULL, NULL, NULL,
......@@ -129,13 +129,13 @@ static void test_verify_detached_message_hash(void)
ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG), /* win9x */
"expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
"expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
para.dwMsgEncodingType = X509_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageHash(&para, NULL, 0, 0, NULL, NULL, NULL,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
para.dwMsgEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageHash(&para, NULL, 0, 0, NULL, NULL, NULL,
......@@ -143,18 +143,18 @@ static void test_verify_detached_message_hash(void)
ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG), /* win9x */
"expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
"expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
/* Curiously, passing no data to hash succeeds.. */
ret = CryptVerifyDetachedMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), 0, NULL, NULL, NULL, NULL);
todo_wine
ok(ret, "CryptVerifyDetachedMessageHash failed: %08x\n", GetLastError());
ok(ret, "CryptVerifyDetachedMessageHash failed: %08lx\n", GetLastError());
/* as does passing the actual content of the message to hash.. */
size = sizeof(msgData);
pMsgData = msgData;
ret = CryptVerifyDetachedMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), 1, &pMsgData, &size, NULL, NULL);
ok(ret, "CryptVerifyDetachedMessageHash failed: %08x\n", GetLastError());
ok(ret, "CryptVerifyDetachedMessageHash failed: %08lx\n", GetLastError());
/* while passing data to hash that isn't the content of the message fails.
*/
size = sizeof(detachedHashContent);
......@@ -163,7 +163,7 @@ static void test_verify_detached_message_hash(void)
ret = CryptVerifyDetachedMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), 1, &pMsgData, &size, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_HASH_VALUE,
"expected CRYPT_E_HASH_VALUE, got %08x\n", GetLastError());
"expected CRYPT_E_HASH_VALUE, got %08lx\n", GetLastError());
/* Getting the size of the hash while passing no hash data causes the
* hash to be checked (and fail.)
*/
......@@ -171,23 +171,23 @@ static void test_verify_detached_message_hash(void)
ret = CryptVerifyDetachedMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), 0, NULL, NULL, NULL, &hashSize);
ok(!ret && GetLastError() == CRYPT_E_HASH_VALUE,
"expected CRYPT_E_HASH_VALUE, got %08x\n", GetLastError());
"expected CRYPT_E_HASH_VALUE, got %08lx\n", GetLastError());
size = sizeof(msgData);
pMsgData = msgData;
ret = CryptVerifyDetachedMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), 1, &pMsgData, &size, NULL, &hashSize);
ok(ret, "CryptVerifyDetachedMessageHash failed: %08x\n", GetLastError());
ok(hashSize == sizeof(hash), "unexpected size %d\n", hashSize);
ok(ret, "CryptVerifyDetachedMessageHash failed: %08lx\n", GetLastError());
ok(hashSize == sizeof(hash), "unexpected size %ld\n", hashSize);
hashSize = 1;
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), 1, &pMsgData, &size, hash, &hashSize);
ok(!ret && GetLastError() == ERROR_MORE_DATA,
"expected ERROR_MORE_DATA, got %08x\n", GetLastError());
"expected ERROR_MORE_DATA, got %08lx\n", GetLastError());
hashSize = sizeof(hash);
ret = CryptVerifyDetachedMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), 1, &pMsgData, &size, hash, &hashSize);
ok(ret, "CryptVerifyDetachedMessageHash failed: %08x\n", GetLastError());
ok(ret, "CryptVerifyDetachedMessageHash failed: %08lx\n", GetLastError());
}
static BYTE hashContent[] = {
......@@ -211,31 +211,31 @@ static void test_verify_message_hash(void)
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageHash(&para, NULL, 0, NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageHash(&para, NULL, 0, NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
para.dwMsgEncodingType = PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageHash(&para, NULL, 0, NULL, NULL, NULL, NULL);
ok(!ret, "Expected 0, got %d\n", ret);
ok(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG, /* win98 */
"Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08lx\n", GetLastError());
/* Verifying the hash of a detached message succeeds? */
ret = CryptVerifyMessageHash(&para, detachedHashContent,
sizeof(detachedHashContent), NULL, NULL, NULL, NULL);
todo_wine
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
ok(ret, "CryptVerifyMessageHash failed: %08lx\n", GetLastError());
/* As does verifying the hash of a regular message. */
ret = CryptVerifyMessageHash(&para, hashContent, sizeof(hashContent),
NULL, NULL, NULL, NULL);
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
ok(ret, "CryptVerifyMessageHash failed: %08lx\n", GetLastError());
ret = CryptVerifyMessageHash(&para, hashContent, sizeof(hashContent),
NULL, &size, NULL, NULL);
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
ok(ret, "CryptVerifyMessageHash failed: %08lx\n", GetLastError());
if (ret)
buf = CryptMemAlloc(size);
if (buf)
......@@ -244,11 +244,11 @@ static void test_verify_message_hash(void)
ret = CryptVerifyMessageHash(&para, hashContent, sizeof(hashContent),
buf, &size, NULL, NULL);
ok(!ret && GetLastError() == ERROR_MORE_DATA,
"expected ERROR_MORE_DATA, got %08x\n", GetLastError());
"expected ERROR_MORE_DATA, got %08lx\n", GetLastError());
ret = CryptVerifyMessageHash(&para, hashContent, sizeof(hashContent),
buf, &size, NULL, NULL);
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
ok(size == sizeof(msgData), "unexpected size %d\n", size);
ok(ret, "CryptVerifyMessageHash failed: %08lx\n", GetLastError());
ok(size == sizeof(msgData), "unexpected size %ld\n", size);
ok(!memcmp(buf, msgData, size), "unexpected value\n");
CryptMemFree(buf);
}
......@@ -338,24 +338,24 @@ static void test_verify_detached_message_signature(void)
ret = CryptVerifyDetachedMessageSignature(NULL, 0, NULL, 0, 0, NULL,
NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageSignature(&para, 0, NULL, 0, 0, NULL,
NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageSignature(&para, 0, NULL, 0, 0, NULL,
NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
para.dwMsgAndCertEncodingType = X509_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageSignature(&para, 0, NULL, 0, 0, NULL,
NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
para.dwMsgAndCertEncodingType = PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageSignature(&para, 0, NULL, 0, 0, NULL,
......@@ -363,7 +363,7 @@ static void test_verify_detached_message_signature(void)
ok(!ret, "Expected 0, got %d\n", ret);
ok(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG, /* win98 */
"Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08lx\n", GetLastError());
/* None of these messages contains a cert in the message itself, so the
* default callback isn't able to verify their signature.
*/
......@@ -374,21 +374,21 @@ static void test_verify_detached_message_signature(void)
todo_wine
ok(GetLastError() == CRYPT_E_NOT_FOUND ||
GetLastError() == OSS_DATA_ERROR, /* win98 */
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageSignature(&para, 0, signedContent,
sizeof(signedContent), 0, NULL, NULL, NULL);
ok(!ret, "Expected 0, got %d\n", ret);
ok(GetLastError() == CRYPT_E_NOT_FOUND ||
GetLastError() == OSS_DATA_ERROR, /* win98 */
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptVerifyDetachedMessageSignature(&para, 0, detachedSignedContent,
sizeof(detachedSignedContent), 0, NULL, NULL, NULL);
ok(!ret, "Expected 0, got %d\n", ret);
ok(GetLastError() == CRYPT_E_NOT_FOUND ||
GetLastError() == OSS_DATA_ERROR, /* win98 */
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
pContent = msgData;
cbContent = sizeof(msgData);
......@@ -397,14 +397,14 @@ static void test_verify_detached_message_signature(void)
ok(!ret, "Expected 0, got %d\n", ret);
ok(GetLastError() == CRYPT_E_NOT_FOUND ||
GetLastError() == OSS_DATA_ERROR, /* win98 */
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND or OSS_DATA_ERROR, got %08lx\n", GetLastError());
/* Passing the correct callback results in success */
para.pfnGetSignerCertificate = msg_get_signer_callback;
ret = CryptVerifyDetachedMessageSignature(&para, 0, detachedSignedContent,
sizeof(detachedSignedContent), 1, &pContent, &cbContent, NULL);
ok(ret ||
broken(!ret), /* win98 */
"CryptVerifyDetachedMessageSignature failed: %08x\n",
"CryptVerifyDetachedMessageSignature failed: %08lx\n",
GetLastError());
/* Not passing the correct data to be signed results in the signature not
* matching.
......@@ -415,7 +415,7 @@ static void test_verify_detached_message_signature(void)
ok(!ret, "Expected 0, got %d\n", ret);
ok(GetLastError() == NTE_BAD_SIGNATURE ||
GetLastError() == OSS_DATA_ERROR, /* win98 */
"Expected NTE_BAD_SIGNATURE or OSS_DATA_ERROR, got %08x\n", GetLastError());
"Expected NTE_BAD_SIGNATURE or OSS_DATA_ERROR, got %08lx\n", GetLastError());
}
static const BYTE signedWithCertEmptyContent[] = {
......@@ -493,42 +493,42 @@ static void test_verify_message_signature(void)
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(NULL, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* Is cbDecoded set when invalid parameters are passed? */
cbDecoded = 0xdeadbeef;
ret = CryptVerifyMessageSignature(NULL, 0, NULL, 0, NULL, &cbDecoded,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
ok(cbDecoded == 0, "expected 0, got %08x\n", cbDecoded);
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
ok(cbDecoded == 0, "expected 0, got %08lx\n", cbDecoded);
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
para.cbSize = 0;
para.dwMsgAndCertEncodingType = PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, NULL, 0, NULL, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
para.cbSize = sizeof(para);
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, NULL, 0, NULL, 0, NULL);
ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG), /* win9x */
"Expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
/* Check whether cert is set on error */
cert = (PCCERT_CONTEXT)0xdeadbeef;
ret = CryptVerifyMessageSignature(&para, 0, NULL, 0, NULL, 0, &cert);
ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG /* NT40 */),
"Expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
ok(cert == NULL, "Expected NULL cert\n");
/* Check whether cbDecoded is set on error */
cbDecoded = 0xdeadbeef;
......@@ -536,43 +536,43 @@ static void test_verify_message_signature(void)
NULL);
ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG /* NT40 */),
"Expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_EOD, got %08lx\n", GetLastError());
ok(!cbDecoded, "Expected 0\n");
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, dataEmptyBareContent,
sizeof(dataEmptyBareContent), NULL, 0, NULL);
ok(!ret && (GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == OSS_PDU_MISMATCH /* NT40 */),
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
ok(GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == OSS_PDU_MISMATCH, /* win9x */
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, dataEmptyContent,
sizeof(dataEmptyContent), NULL, 0, NULL);
ok(!ret && GetLastError() == CRYPT_E_UNEXPECTED_MSG_TYPE,
"Expected CRYPT_E_UNEXPECTED_MSG_TYPE, got %08x\n", GetLastError());
"Expected CRYPT_E_UNEXPECTED_MSG_TYPE, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, signedEmptyBareContent,
sizeof(signedEmptyBareContent), NULL, 0, NULL);
ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == OSS_DATA_ERROR), /* win9x */
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
"Expected CRYPT_E_ASN1_BADTAG, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, signedEmptyContent,
sizeof(signedEmptyContent), NULL, 0, NULL);
ok(!ret &&
(GetLastError() == CRYPT_E_NOT_FOUND ||
GetLastError() == OSS_DATA_ERROR), /* win9x */
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptVerifyMessageSignature(&para, 0, signedContent,
sizeof(signedContent), NULL, 0, NULL);
ok(!ret &&
(GetLastError() == CRYPT_E_NOT_FOUND ||
GetLastError() == OSS_DATA_ERROR), /* win9x */
"Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError());
"Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
/* FIXME: Windows fails with CRYPT_E_NOT_FOUND for these messages, but
* their signer certs have invalid public keys that fail to decode. In
* Wine therefore the failure is an ASN error. Need some messages with
......@@ -599,22 +599,22 @@ static void test_verify_message_signature(void)
ret = CryptVerifyMessageSignature(&para, 0,
signedWithCertWithValidPubKeyContent,
sizeof(signedWithCertWithValidPubKeyContent), NULL, &cbDecoded, NULL);
ok(ret, "CryptVerifyMessageSignature failed: %08x\n", GetLastError());
ok(cbDecoded == sizeof(msgData), "expected 4, got %d\n", cbDecoded);
ok(ret, "CryptVerifyMessageSignature failed: %08lx\n", GetLastError());
ok(cbDecoded == sizeof(msgData), "expected 4, got %ld\n", cbDecoded);
cbDecoded = 0;
ret = CryptVerifyMessageSignature(&para, 0,
signedWithCertWithValidPubKeyContent,
sizeof(signedWithCertWithValidPubKeyContent), NULL, &cbDecoded, NULL);
/* Setting cbDecoded to 0 succeeds when a NULL buffer is provided */
ok(ret, "CryptVerifyMessageSignature failed: %08x\n", GetLastError());
ok(cbDecoded == sizeof(msgData), "expected 4, got %d\n", cbDecoded);
ok(ret, "CryptVerifyMessageSignature failed: %08lx\n", GetLastError());
ok(cbDecoded == sizeof(msgData), "expected 4, got %ld\n", cbDecoded);
cbDecoded = 0;
ret = CryptVerifyMessageSignature(&para, 0,
signedWithCertWithValidPubKeyContent,
sizeof(signedWithCertWithValidPubKeyContent), decoded, &cbDecoded, NULL);
/* When a non-NULL buffer is provided, cbDecoded must not be too small */
ok(!ret && GetLastError() == ERROR_MORE_DATA,
"expected ERROR_MORE_DATA, got %d (%08x)\n", GetLastError(),
"expected ERROR_MORE_DATA, got %ld (%08lx)\n", GetLastError(),
GetLastError());
}
......@@ -653,38 +653,38 @@ static void test_hash_message(void)
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 0, NULL, NULL, NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got 0x%08x\n", GetLastError());
"expected E_INVALIDARG, got 0x%08lx\n", GetLastError());
para.cbSize = sizeof(para);
/* Not quite sure what "success" means in this case, but it does succeed */
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 0, NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
/* With a bogus encoding type it "succeeds" */
para.dwMsgEncodingType = 0xdeadbeef;
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 0, NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
/* According to MSDN, the third parameter (cToBeHashed) must be 1 if the
* second parameter (fDetached) is FALSE, but again it "succeeds."
*/
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 2, NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
/* Even passing parameters to hash results in "success." */
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 2, toHash, hashSize, NULL, NULL, NULL,
NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
/* Try again with a valid encoding type */
para.dwMsgEncodingType = PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 2, NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
/* And with valid data to hash */
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 2, toHash, hashSize, NULL, NULL, NULL,
NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
/* But requesting the size of the hashed blob and indicating there's data
* to hash results in a crash
*/
......@@ -702,7 +702,7 @@ static void test_hash_message(void)
ok(!ret &&
(GetLastError() == CRYPT_E_UNKNOWN_ALGO ||
GetLastError() == CRYPT_E_OID_FORMAT), /* Vista */
"expected CRYPT_E_UNKNOWN_ALGO or CRYPT_E_OID_FORMAT, got 0x%08x (%d)\n",
"expected CRYPT_E_UNKNOWN_ALGO or CRYPT_E_OID_FORMAT, got 0x%08lx (%ld)\n",
GetLastError(), GetLastError());
para.HashAlgorithm.pszObjId = oid_rsa_md5;
/* With a valid hash algorithm, this succeeds, even though fDetached is
......@@ -712,7 +712,7 @@ static void test_hash_message(void)
ret = CryptHashMessage(&para, FALSE, 2, toHash, hashSize, NULL,
&hashedBlobSize, NULL, NULL);
todo_wine
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
if (ret)
{
/* Actually attempting to get the hashed data fails, perhaps because
......@@ -723,7 +723,7 @@ static void test_hash_message(void)
ret = CryptHashMessage(&para, FALSE, 2, toHash, hashSize, hashedBlob,
&hashedBlobSize, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_MSG_ERROR,
"expected CRYPT_E_MSG_ERROR, got 0x%08x (%d)\n", GetLastError(),
"expected CRYPT_E_MSG_ERROR, got 0x%08lx (%ld)\n", GetLastError(),
GetLastError());
HeapFree(GetProcessHeap(), 0, hashedBlob);
}
......@@ -731,16 +731,16 @@ static void test_hash_message(void)
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, TRUE, 2, toHash, hashSize, NULL,
&hashedBlobSize, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
if (ret)
{
hashedBlob = HeapAlloc(GetProcessHeap(), 0, hashedBlobSize);
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, TRUE, 2, toHash, hashSize, hashedBlob,
&hashedBlobSize, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
ok(hashedBlobSize == sizeof(detachedHashBlob),
"unexpected size of detached blob %d\n", hashedBlobSize);
"unexpected size of detached blob %ld\n", hashedBlobSize);
ok(!memcmp(hashedBlob, detachedHashBlob, hashedBlobSize),
"unexpected detached blob value\n");
HeapFree(GetProcessHeap(), 0, hashedBlob);
......@@ -749,15 +749,15 @@ static void test_hash_message(void)
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, FALSE, 1, toHash, hashSize, NULL,
&hashedBlobSize, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
if (ret)
{
hashedBlob = HeapAlloc(GetProcessHeap(), 0, hashedBlobSize);
ret = CryptHashMessage(&para, FALSE, 1, toHash, hashSize, hashedBlob,
&hashedBlobSize, NULL, NULL);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
ok(hashedBlobSize == sizeof(hashBlob),
"unexpected size of detached blob %d\n", hashedBlobSize);
"unexpected size of detached blob %ld\n", hashedBlobSize);
ok(!memcmp(hashedBlob, hashBlob, hashedBlobSize),
"unexpected detached blob value\n");
HeapFree(GetProcessHeap(), 0, hashedBlob);
......@@ -768,8 +768,8 @@ static void test_hash_message(void)
computedHashSize = 0xdeadbeef;
ret = CryptHashMessage(&para, TRUE, 2, toHash, hashSize, NULL,
&hashedBlobSize, NULL, &computedHashSize);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(computedHashSize == 16, "expected hash size of 16, got %d\n",
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
ok(computedHashSize == 16, "expected hash size of 16, got %ld\n",
computedHashSize);
if (ret)
{
......@@ -777,9 +777,9 @@ static void test_hash_message(void)
SetLastError(0xdeadbeef);
ret = CryptHashMessage(&para, TRUE, 2, toHash, hashSize, NULL,
&hashedBlobSize, computedHash, &computedHashSize);
ok(ret, "CryptHashMessage failed: 0x%08x\n", GetLastError());
ok(ret, "CryptHashMessage failed: 0x%08lx\n", GetLastError());
ok(computedHashSize == sizeof(hashVal),
"unexpected size of hash value %d\n", computedHashSize);
"unexpected size of hash value %ld\n", computedHashSize);
ok(!memcmp(computedHash, hashVal, computedHashSize),
"unexpected value\n");
HeapFree(GetProcessHeap(), 0, computedHash);
......@@ -996,7 +996,7 @@ static void test_sign_message(void)
ok(!ret &&
(GetLastError() == E_INVALIDARG ||
GetLastError() == ERROR_ARITHMETIC_OVERFLOW), /* Win7 */
"expected E_INVALIDARG or ERROR_ARITHMETIC_OVERFLOW, got %08x\n",
"expected E_INVALIDARG or ERROR_ARITHMETIC_OVERFLOW, got %08lx\n",
GetLastError());
para.cbSize = sizeof(para);
para.dwMsgEncodingType = X509_ASN_ENCODING;
......@@ -1004,20 +1004,20 @@ static void test_sign_message(void)
signedBlobSize = 255;
ret = CryptSignMessage(&para, FALSE, 0, NULL, NULL, NULL, &signedBlobSize);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
ok(!signedBlobSize, "unexpected size %d\n", signedBlobSize);
"expected E_INVALIDARG, got %08lx\n", GetLastError());
ok(!signedBlobSize, "unexpected size %ld\n", signedBlobSize);
para.dwMsgEncodingType = PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
signedBlobSize = 0;
ret = CryptSignMessage(&para, FALSE, 0, NULL, NULL, NULL, &signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
todo_wine
ok(signedBlobSize, "bad size\n");
SetLastError(0xdeadbeef);
ret = CryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
ok(ret, "CryptAcquireContextA failed: %08x\n", GetLastError());
ok(ret, "CryptAcquireContextA failed: %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptImportKey(hCryptProv, publicPrivateKeyPair,
sizeof(publicPrivateKeyPair), 0, 0, &hKey);
......@@ -1028,13 +1028,13 @@ static void test_sign_message(void)
CryptReleaseContext(hCryptProv, 0);
return;
}
ok(ret, "CryptImportKey failed: %08x\n", GetLastError());
ok(ret, "CryptImportKey failed: %08lx\n", GetLastError());
para.dwMsgEncodingType = X509_ASN_ENCODING | PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
para.pSigningCert = CertCreateCertificateContext(X509_ASN_ENCODING |
PKCS_7_ASN_ENCODING, cert1, sizeof(cert1));
ok(para.pSigningCert != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(para.pSigningCert != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
para.HashAlgorithm.pszObjId = oid_rsa_md5;
......@@ -1045,21 +1045,21 @@ static void test_sign_message(void)
SetLastError(0xdeadbeef);
ret = CertSetCertificateContextProperty(para.pSigningCert,
CERT_KEY_CONTEXT_PROP_ID, 0, &keyContext);
ok(ret, "CertSetCertificateContextProperty failed: %08x\n", GetLastError());
ok(ret, "CertSetCertificateContextProperty failed: %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
signedBlobSize = 0;
ret = CryptSignMessage(&para, TRUE, 0, NULL, NULL, NULL, &signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
signedBlob = CryptMemAlloc(signedBlobSize);
if (signedBlob)
{
SetLastError(0xdeadbeef);
ret = CryptSignMessage(&para, TRUE, 0, NULL, NULL, signedBlob,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
ok(signedBlobSize == sizeof(signedHashForEmptyMessage),
"unexpected size %d\n", signedBlobSize);
"unexpected size %ld\n", signedBlobSize);
ok(!memcmp(signedBlob, signedHashForEmptyMessage, signedBlobSize),
"unexpected value\n");
CryptMemFree(signedBlob);
......@@ -1068,15 +1068,15 @@ static void test_sign_message(void)
SetLastError(0xdeadbeef);
signedBlobSize = 0;
ret = CryptSignMessage(&para, FALSE, 0, NULL, NULL, NULL, &signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
signedBlob = CryptMemAlloc(signedBlobSize);
if (signedBlob)
{
SetLastError(0xdeadbeef);
ret = CryptSignMessage(&para, FALSE, 0, NULL, NULL, signedBlob,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(signedBlobSize == sizeof(signedEmptyMessage), "unexpected size %d\n",
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
ok(signedBlobSize == sizeof(signedEmptyMessage), "unexpected size %ld\n",
signedBlobSize);
ok(!memcmp(signedBlob, signedEmptyMessage, signedBlobSize),
"unexpected value\n");
......@@ -1087,16 +1087,16 @@ static void test_sign_message(void)
signedBlobSize = 0;
ret = CryptSignMessage(&para, TRUE, 2, toSign, signSize, NULL,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
signedBlob = CryptMemAlloc(signedBlobSize);
if (signedBlob)
{
SetLastError(0xdeadbeef);
ret = CryptSignMessage(&para, TRUE, 2, toSign, signSize, signedBlob,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
ok(signedBlobSize == sizeof(signedHash),
"unexpected size of signed blob %d\n", signedBlobSize);
"unexpected size of signed blob %ld\n", signedBlobSize);
ok(!memcmp(signedBlob, signedHash, signedBlobSize),
"unexpected value\n");
CryptMemFree(signedBlob);
......@@ -1109,16 +1109,16 @@ static void test_sign_message(void)
signedBlobSize = 0;
ret = CryptSignMessage(&para, TRUE, 2, toSign, signSize, NULL,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
signedBlob = CryptMemAlloc(signedBlobSize);
if (signedBlob)
{
SetLastError(0xdeadbeef);
ret = CryptSignMessage(&para, TRUE, 2, toSign, signSize, signedBlob,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
ok(signedBlobSize == sizeof(signedHashWithCert),
"unexpected size of signed blob %d\n", signedBlobSize);
"unexpected size of signed blob %ld\n", signedBlobSize);
ok(!memcmp(signedBlob, signedHashWithCert, signedBlobSize),
"unexpected value\n");
CryptMemFree(signedBlob);
......@@ -1130,7 +1130,7 @@ static void test_sign_message(void)
SetLastError(0xdeadbeef);
crlContext = CertCreateCRLContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
crl, sizeof(crl));
ok(crlContext != NULL, "CertCreateCRLContext failed: %08x\n",
ok(crlContext != NULL, "CertCreateCRLContext failed: %08lx\n",
GetLastError());
para.rgpMsgCrl = &crlContext;
......@@ -1138,16 +1138,16 @@ static void test_sign_message(void)
signedBlobSize = 0;
ret = CryptSignMessage(&para, TRUE, 2, toSign, signSize, NULL,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
signedBlob = CryptMemAlloc(signedBlobSize);
if (signedBlob)
{
SetLastError(0xdeadbeef);
ret = CryptSignMessage(&para, TRUE, 2, toSign, signSize, signedBlob,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
ok(signedBlobSize == sizeof(signedHashWithCRL),
"unexpected size of signed blob %d\n", signedBlobSize);
"unexpected size of signed blob %ld\n", signedBlobSize);
ok(!memcmp(signedBlob, signedHashWithCRL, signedBlobSize),
"unexpected value\n");
CryptMemFree(signedBlob);
......@@ -1161,16 +1161,16 @@ static void test_sign_message(void)
signedBlobSize = 0;
ret = CryptSignMessage(&para, FALSE, 1, toSign, signSize, NULL,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
signedBlob = CryptMemAlloc(signedBlobSize);
if (signedBlob)
{
SetLastError(0xdeadbeef);
ret = CryptSignMessage(&para, FALSE, 1, toSign, signSize, signedBlob,
&signedBlobSize);
ok(ret, "CryptSignMessage failed: %08x\n", GetLastError());
ok(ret, "CryptSignMessage failed: %08lx\n", GetLastError());
ok(signedBlobSize == sizeof(signedData),
"unexpected size of signed blob %d\n", signedBlobSize);
"unexpected size of signed blob %ld\n", signedBlobSize);
ok(!memcmp(signedBlob, signedData, signedBlobSize),
"unexpected value\n");
CryptMemFree(signedBlob);
......@@ -1204,17 +1204,17 @@ static void test_encrypt_message(void)
SetLastError(0xdeadbeef);
ret = CryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
ok(ret, "CryptAcquireContextA failed: %08x\n", GetLastError());
ok(ret, "CryptAcquireContextA failed: %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
certs[0] = CertCreateCertificateContext(X509_ASN_ENCODING |
PKCS_7_ASN_ENCODING, cert1, sizeof(cert1));
ok(certs[0] != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(certs[0] != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
SetLastError(0xdeadbeef);
certs[1] = CertCreateCertificateContext(X509_ASN_ENCODING |
PKCS_7_ASN_ENCODING, cert2, sizeof(cert2));
ok(certs[1] != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(certs[1] != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
memset(&para, 0, sizeof(para));
......@@ -1223,8 +1223,8 @@ static void test_encrypt_message(void)
ret = CryptEncryptMessage(&para, 0, NULL, NULL, 0, NULL,
&encryptedBlobSize);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
ok(!encryptedBlobSize, "unexpected size %d\n", encryptedBlobSize);
"expected E_INVALIDARG, got %08lx\n", GetLastError());
ok(!encryptedBlobSize, "unexpected size %ld\n", encryptedBlobSize);
para.cbSize = sizeof(para);
para.dwMsgEncodingType = X509_ASN_ENCODING;
SetLastError(0xdeadbeef);
......@@ -1232,8 +1232,8 @@ static void test_encrypt_message(void)
ret = CryptEncryptMessage(&para, 0, NULL, NULL, 0, NULL,
&encryptedBlobSize);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
ok(!encryptedBlobSize, "unexpected size %d\n", encryptedBlobSize);
"expected E_INVALIDARG, got %08lx\n", GetLastError());
ok(!encryptedBlobSize, "unexpected size %ld\n", encryptedBlobSize);
para.dwMsgEncodingType = PKCS_7_ASN_ENCODING;
SetLastError(0xdeadbeef);
encryptedBlobSize = 255;
......@@ -1242,9 +1242,9 @@ static void test_encrypt_message(void)
ok(!ret &&
(GetLastError() == CRYPT_E_UNKNOWN_ALGO ||
GetLastError() == E_INVALIDARG), /* Win9x */
"expected CRYPT_E_UNKNOWN_ALGO or E_INVALIDARG, got %08x\n",
"expected CRYPT_E_UNKNOWN_ALGO or E_INVALIDARG, got %08lx\n",
GetLastError());
ok(!encryptedBlobSize, "unexpected size %d\n", encryptedBlobSize);
ok(!encryptedBlobSize, "unexpected size %ld\n", encryptedBlobSize);
para.hCryptProv = hCryptProv;
para.ContentEncryptionAlgorithm.pszObjId = oid_rsa_rc4;
......@@ -1255,7 +1255,7 @@ static void test_encrypt_message(void)
&encryptedBlobSize);
ok(ret ||
broken(!ret) /* Win9x */,
"CryptEncryptMessage failed: %08x\n", GetLastError());
"CryptEncryptMessage failed: %08lx\n", GetLastError());
if (ret)
{
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
......@@ -1264,9 +1264,9 @@ static void test_encrypt_message(void)
SetLastError(0xdeadbeef);
ret = CryptEncryptMessage(&para, 0, NULL, NULL, 0, encryptedBlob,
&encryptedBlobSize);
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
ok(ret, "CryptEncryptMessage failed: %08lx\n", GetLastError());
ok(encryptedBlobSize == sizeof(encryptedMessage),
"unexpected size of encrypted blob %d\n", encryptedBlobSize);
"unexpected size of encrypted blob %ld\n", encryptedBlobSize);
ok(!memcmp(encryptedBlob, encryptedMessage, encryptedBlobSize),
"unexpected value\n");
CryptMemFree(encryptedBlob);
......@@ -1277,7 +1277,7 @@ static void test_encrypt_message(void)
encryptedBlobSize = 0;
ret = CryptEncryptMessage(&para, 2, certs, NULL, 0, NULL,
&encryptedBlobSize);
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
ok(ret, "CryptEncryptMessage failed: %08lx\n", GetLastError());
if (ret)
{
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
......@@ -1286,7 +1286,7 @@ static void test_encrypt_message(void)
SetLastError(0xdeadbeef);
ret = CryptEncryptMessage(&para, 2, certs, NULL, 0, encryptedBlob,
&encryptedBlobSize);
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
ok(ret, "CryptEncryptMessage failed: %08lx\n", GetLastError());
CryptMemFree(encryptedBlob);
}
}
......@@ -1297,7 +1297,7 @@ static void test_encrypt_message(void)
&encryptedBlobSize);
ok(ret ||
broken(!ret) /* Win9x */,
"CryptEncryptMessage failed: %08x\n", GetLastError());
"CryptEncryptMessage failed: %08lx\n", GetLastError());
if (ret)
{
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
......@@ -1308,11 +1308,11 @@ static void test_encrypt_message(void)
encryptedBlob, &encryptedBlobSize);
ok(ret ||
broken(!ret && GetLastError() == NTE_PERM), /* some NT4 */
"CryptEncryptMessage failed: %08x\n", GetLastError());
"CryptEncryptMessage failed: %08lx\n", GetLastError());
if (ret)
{
ok(encryptedBlobSize == 55,
"unexpected size of encrypted blob %d\n", encryptedBlobSize);
"unexpected size of encrypted blob %ld\n", encryptedBlobSize);
}
CryptMemFree(encryptedBlob);
}
......@@ -1322,7 +1322,7 @@ static void test_encrypt_message(void)
encryptedBlobSize = 0;
ret = CryptEncryptMessage(&para, 2, certs, blob, sizeof(blob), NULL,
&encryptedBlobSize);
ok(ret, "CryptEncryptMessage failed: %08x\n", GetLastError());
ok(ret, "CryptEncryptMessage failed: %08lx\n", GetLastError());
if (ret)
{
encryptedBlob = CryptMemAlloc(encryptedBlobSize);
......@@ -1333,7 +1333,7 @@ static void test_encrypt_message(void)
encryptedBlob, &encryptedBlobSize);
ok(ret ||
broken(!ret), /* some Win95 and some NT4 */
"CryptEncryptMessage failed: %08x\n", GetLastError());
"CryptEncryptMessage failed: %08lx\n", GetLastError());
CryptMemFree(encryptedBlob);
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -134,12 +134,12 @@ static void test_query_object(void)
ret = pCryptQueryObject(0, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, NULL, 0, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
"expected E_INVALIDARG, got %08lx\n", GetLastError());
/* Test with a simple cert */
blob.pbData = bigCert;
blob.cbData = sizeof(bigCert);
......@@ -147,7 +147,7 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* The same cert, base64-encoded */
blob.pbData = (BYTE *)bigCertBase64;
blob.cbData = sizeof(bigCertBase64);
......@@ -155,19 +155,19 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* The same base64-encoded cert, restricting the format types */
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* The same cert, base64-encoded but as a wide character string */
blob.pbData = (BYTE *)bigCertBase64W;
blob.cbData = sizeof(bigCertBase64W);
......@@ -176,7 +176,7 @@ static void test_query_object(void)
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
/* For brevity, not tested here, but tested on Windows: same failure
* (CRYPT_E_NO_MATCH) when the wide character base64-encoded cert
* is written to a file and queried.
......@@ -188,14 +188,14 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
blob.pbData = (BYTE *)signedWithCertWithValidPubKeyContentBase64;
blob.cbData = sizeof(signedWithCertWithValidPubKeyContentBase64);
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
/* A valid signed message, encoded as a wide character base64 string, can
* be queried successfully.
*/
......@@ -205,18 +205,18 @@ static void test_query_object(void)
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_ALL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
ok(!ret && GetLastError() == CRYPT_E_NO_MATCH,
"expected CRYPT_E_NO_MATCH, got %08x\n", GetLastError());
"expected CRYPT_E_NO_MATCH, got %08lx\n", GetLastError());
SetLastError(0xdeadbeef);
ret = pCryptQueryObject(CERT_QUERY_OBJECT_BLOB, &blob,
CERT_QUERY_CONTENT_FLAG_ALL, CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
ok(ret, "CryptQueryObject failed: %08x\n", GetLastError());
ok(ret, "CryptQueryObject failed: %08lx\n", GetLastError());
}
START_TEST(object)
......
......@@ -105,13 +105,13 @@ static void testOIDToAlgID(void)
/* Test with a bogus one */
alg = CertOIDToAlgId("1.2.3");
ok(!alg, "Expected failure, got %d\n", alg);
ok(!alg, "Expected failure, got %ld\n", alg);
for (i = 0; i < ARRAY_SIZE(oidToAlgID); i++)
{
alg = CertOIDToAlgId(oidToAlgID[i].oid);
ok(alg == oidToAlgID[i].algID || (oidToAlgID[i].altAlgID && alg == oidToAlgID[i].altAlgID),
"Expected %d, got %d\n", oidToAlgID[i].algID, alg);
"Expected %ld, got %ld\n", oidToAlgID[i].algID, alg);
}
}
......@@ -124,7 +124,7 @@ static void testAlgIDToOID(void)
SetLastError(0xdeadbeef);
oid = CertAlgIdToOID(ALG_CLASS_SIGNATURE | ALG_TYPE_ANY | 80);
ok(!oid && GetLastError() == 0xdeadbeef,
"Didn't expect last error (%08x) to be set\n", GetLastError());
"Didn't expect last error (%08lx) to be set\n", GetLastError());
for (i = 0; i < ARRAY_SIZE(algIDToOID); i++)
{
oid = CertAlgIdToOID(algIDToOID[i].algID);
......@@ -166,7 +166,7 @@ static void test_oidFunctionSet(void)
/* The name doesn't mean much */
set1 = CryptInitOIDFunctionSet("funky", 0);
ok(set1 != 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
ok(set1 != 0, "CryptInitOIDFunctionSet failed: %08lx\n", GetLastError());
if (set1)
{
/* These crash
......@@ -175,14 +175,14 @@ static void test_oidFunctionSet(void)
*/
size = 0;
ret = CryptGetDefaultOIDDllList(set1, 0, NULL, &size);
ok(ret, "CryptGetDefaultOIDDllList failed: %08x\n", GetLastError());
ok(ret, "CryptGetDefaultOIDDllList failed: %08lx\n", GetLastError());
if (ret)
{
buf = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
if (buf)
{
ret = CryptGetDefaultOIDDllList(set1, 0, buf, &size);
ok(ret, "CryptGetDefaultOIDDllList failed: %08x\n",
ok(ret, "CryptGetDefaultOIDDllList failed: %08lx\n",
GetLastError());
ok(!*buf, "Expected empty DLL list\n");
HeapFree(GetProcessHeap(), 0, buf);
......@@ -192,9 +192,9 @@ static void test_oidFunctionSet(void)
/* MSDN says flags must be 0, but it's not checked */
set1 = CryptInitOIDFunctionSet("", 1);
ok(set1 != 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
ok(set1 != 0, "CryptInitOIDFunctionSet failed: %08lx\n", GetLastError());
set2 = CryptInitOIDFunctionSet("", 0);
ok(set2 != 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
ok(set2 != 0, "CryptInitOIDFunctionSet failed: %08lx\n", GetLastError());
/* There isn't a free function, so there must be only one set per name to
* limit leaks. (I guess the sets are freed when crypt32 is unloaded.)
*/
......@@ -208,7 +208,7 @@ static void test_oidFunctionSet(void)
/* There's no installed function for a built-in encoding. */
set1 = CryptInitOIDFunctionSet("CryptDllEncodeObject", 0);
ok(set1 != 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
ok(set1 != 0, "CryptInitOIDFunctionSet failed: %08lx\n", GetLastError());
if (set1)
{
void *funcAddr;
......@@ -218,7 +218,7 @@ static void test_oidFunctionSet(void)
&funcAddr, &hFuncAddr);
ok((!ret && GetLastError() == ERROR_FILE_NOT_FOUND) ||
broken(ret) /* some Win98 */,
"Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
}
}
......@@ -243,21 +243,21 @@ static void test_installOIDFunctionAddress(void)
SetLastError(0xdeadbeef);
ret = CryptInstallOIDFunctionAddress(NULL, 0, "CryptDllEncodeObject", 0,
NULL, 0);
ok(ret && GetLastError() == 0xdeadbeef, "Expected success, got %08x\n",
ok(ret && GetLastError() == 0xdeadbeef, "Expected success, got %08lx\n",
GetLastError());
/* The function name doesn't much matter */
SetLastError(0xdeadbeef);
ret = CryptInstallOIDFunctionAddress(NULL, 0, "OhSoFunky", 0, NULL, 0);
ok(ret && GetLastError() == 0xdeadbeef, "Expected success, got %08x\n",
ok(ret && GetLastError() == 0xdeadbeef, "Expected success, got %08lx\n",
GetLastError());
SetLastError(0xdeadbeef);
entry.pszOID = X509_CERT;
ret = CryptInstallOIDFunctionAddress(NULL, 0, "OhSoFunky", 1, &entry, 0);
ok(ret && GetLastError() == 0xdeadbeef, "Expected success, got %08x\n",
ok(ret && GetLastError() == 0xdeadbeef, "Expected success, got %08lx\n",
GetLastError());
set = CryptInitOIDFunctionSet("OhSoFunky", 0);
ok(set != 0, "CryptInitOIDFunctionSet failed: %08x\n", GetLastError());
ok(set != 0, "CryptInitOIDFunctionSet failed: %08lx\n", GetLastError());
if (set)
{
funcY funcAddr = NULL;
......@@ -271,15 +271,15 @@ static void test_installOIDFunctionAddress(void)
(void **)&funcAddr, &hFuncAddr);
ok(!ret && (GetLastError() == ERROR_FILE_NOT_FOUND ||
GetLastError() == E_INVALIDARG /* some Win98 */),
"Expected ERROR_FILE_NOT_FOUND or E_INVALIDARG, got %d\n",
"Expected ERROR_FILE_NOT_FOUND or E_INVALIDARG, got %ld\n",
GetLastError());
ret = CryptGetOIDFunctionAddress(set, X509_ASN_ENCODING, X509_CERT, 0,
(void **)&funcAddr, &hFuncAddr);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
ret = CryptGetOIDFunctionAddress(set, 0, X509_CERT, 0,
(void **)&funcAddr, &hFuncAddr);
ok(ret, "CryptGetOIDFunctionAddress failed: %d\n", GetLastError());
ok(ret, "CryptGetOIDFunctionAddress failed: %ld\n", GetLastError());
if (funcAddr)
{
int y = funcAddr(0xabadc0da);
......@@ -306,11 +306,11 @@ static void test_registerOIDFunction(void)
ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "foo", NULL, bogusDll,
NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG: %d\n", GetLastError());
"Expected E_INVALIDARG: %ld\n", GetLastError());
/* This has no effect, but "succeeds" on XP */
ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "foo",
"1.2.3.4.5.6.7.8.9.10", NULL, NULL);
ok(ret, "Expected pseudo-success, got %d\n", GetLastError());
ok(ret, "Expected pseudo-success, got %ld\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10", bogusDll, NULL);
......@@ -319,16 +319,16 @@ static void test_registerOIDFunction(void)
skip("Need admin rights\n");
return;
}
ok(ret, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptRegisterOIDFunction failed: %ld\n", GetLastError());
ret = CryptUnregisterOIDFunction(X509_ASN_ENCODING, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10");
ok(ret, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptUnregisterOIDFunction failed: %ld\n", GetLastError());
ret = CryptRegisterOIDFunction(X509_ASN_ENCODING, "bogus",
"1.2.3.4.5.6.7.8.9.10", bogusDll, NULL);
ok(ret, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptRegisterOIDFunction failed: %ld\n", GetLastError());
ret = CryptUnregisterOIDFunction(X509_ASN_ENCODING, "bogus",
"1.2.3.4.5.6.7.8.9.10");
ok(ret, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptUnregisterOIDFunction failed: %ld\n", GetLastError());
/* Unwanted Cryptography\OID\EncodingType 1\bogus\ will still be there */
ok(!RegDeleteKeyA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Cryptography\\OID\\EncodingType 1\\bogus"),
......@@ -336,17 +336,17 @@ static void test_registerOIDFunction(void)
/* Shouldn't have effect but registry keys are created */
ret = CryptRegisterOIDFunction(PKCS_7_ASN_ENCODING, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10", bogusDll, NULL);
ok(ret, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptRegisterOIDFunction failed: %ld\n", GetLastError());
ret = CryptUnregisterOIDFunction(PKCS_7_ASN_ENCODING, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10");
ok(ret, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptUnregisterOIDFunction failed: %ld\n", GetLastError());
/* Check with bogus encoding type. Registry keys are still created */
ret = CryptRegisterOIDFunction(0, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10", bogusDll, NULL);
ok(ret, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptRegisterOIDFunction failed: %ld\n", GetLastError());
ret = CryptUnregisterOIDFunction(0, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10");
ok(ret, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptUnregisterOIDFunction failed: %ld\n", GetLastError());
/* Unwanted Cryptography\OID\EncodingType 0\CryptDllEncodeObject\
* will still be there
*/
......@@ -358,10 +358,10 @@ static void test_registerOIDFunction(void)
*/
ret = CryptRegisterOIDFunction(3, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10", bogusDll, NULL);
ok(ret, "CryptRegisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptRegisterOIDFunction failed: %ld\n", GetLastError());
ret = CryptUnregisterOIDFunction(3, "CryptDllEncodeObject",
"1.2.3.4.5.6.7.8.9.10");
ok(ret, "CryptUnregisterOIDFunction failed: %d\n", GetLastError());
ok(ret, "CryptUnregisterOIDFunction failed: %ld\n", GetLastError());
/* Unwanted Cryptography\OID\EncodingType 3\CryptDllEncodeObject
* will still be there.
*/
......@@ -385,7 +385,7 @@ static void test_registerDefaultOIDFunction(void)
ret = CryptRegisterDefaultOIDFunction(0, NULL, 0, NULL);
ok(!ret && GetLastError() == E_INVALIDARG,
"Expected E_INVALIDARG, got %08x\n", GetLastError());
"Expected E_INVALIDARG, got %08lx\n", GetLastError());
/* This succeeds on WinXP, although the bogus entry is unusable.
ret = CryptRegisterDefaultOIDFunction(0, NULL, 0, bogusDll);
*/
......@@ -398,24 +398,24 @@ static void test_registerDefaultOIDFunction(void)
skip("Need admin rights\n");
return;
}
ok(ret, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError());
ok(ret, "CryptRegisterDefaultOIDFunction failed: %08lx\n", GetLastError());
/* Reregistering should fail */
ret = CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 0,
bogusDll);
ok(!ret && GetLastError() == ERROR_FILE_EXISTS,
"Expected ERROR_FILE_EXISTS, got %08x\n", GetLastError());
"Expected ERROR_FILE_EXISTS, got %08lx\n", GetLastError());
/* Registering the same one at index 1 should also fail */
ret = CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 1,
bogusDll);
ok(!ret && GetLastError() == ERROR_FILE_EXISTS,
"Expected ERROR_FILE_EXISTS, got %08x\n", GetLastError());
"Expected ERROR_FILE_EXISTS, got %08lx\n", GetLastError());
/* Registering a different one at index 1 succeeds */
ret = CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 1,
bogus2Dll);
ok(ret, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError());
ok(ret, "CryptRegisterDefaultOIDFunction failed: %08lx\n", GetLastError());
sprintf(buf, fmt, 0, func);
rc = RegOpenKeyA(HKEY_LOCAL_MACHINE, buf, &key);
ok(rc == 0, "Expected key to exist, RegOpenKeyA failed: %d\n", rc);
ok(rc == 0, "Expected key to exist, RegOpenKeyA failed: %ld\n", rc);
if (rc == 0)
{
static const CHAR dllA[] = "Dll";
......@@ -428,8 +428,8 @@ static void test_registerDefaultOIDFunction(void)
size = ARRAY_SIZE(dllBuf);
rc = RegQueryValueExA(key, dllA, NULL, &type, (LPBYTE)dllBuf, &size);
ok(rc == 0,
"Expected Dll value to exist, RegQueryValueExA failed: %d\n", rc);
ok(type == REG_MULTI_SZ, "Expected type REG_MULTI_SZ, got %d\n", type);
"Expected Dll value to exist, RegQueryValueExA failed: %ld\n", rc);
ok(type == REG_MULTI_SZ, "Expected type REG_MULTI_SZ, got %ld\n", type);
/* bogusDll was registered first, so that should be first */
ptr = dllBuf;
ok(!lstrcmpiA(ptr, bogusDll_A), "Unexpected dll\n");
......@@ -440,17 +440,17 @@ static void test_registerDefaultOIDFunction(void)
/* Unregister both of them */
ret = CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv",
bogusDll);
ok(ret, "CryptUnregisterDefaultOIDFunction failed: %08x\n",
ok(ret, "CryptUnregisterDefaultOIDFunction failed: %08lx\n",
GetLastError());
ret = CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv",
bogus2Dll);
ok(ret, "CryptUnregisterDefaultOIDFunction failed: %08x\n",
ok(ret, "CryptUnregisterDefaultOIDFunction failed: %08lx\n",
GetLastError());
/* Now that they're both unregistered, unregistering should fail */
ret = CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv",
bogusDll);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
/* Repeat a few tests on the normal encoding type */
ret = CryptRegisterDefaultOIDFunction(X509_ASN_ENCODING,
......@@ -462,7 +462,7 @@ static void test_registerDefaultOIDFunction(void)
ret = CryptUnregisterDefaultOIDFunction(X509_ASN_ENCODING,
"CertDllOpenStoreProv", bogusDll);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
}
static void test_getDefaultOIDFunctionAddress(void)
......@@ -480,20 +480,20 @@ static void test_getDefaultOIDFunctionAddress(void)
&hFuncAddr);
*/
set = CryptInitOIDFunctionSet("CertDllOpenStoreProv", 0);
ok(set != 0, "CryptInitOIDFunctionSet failed: %d\n", GetLastError());
ok(set != 0, "CryptInitOIDFunctionSet failed: %ld\n", GetLastError());
/* This crashes if hFuncAddr is not 0 to begin with */
hFuncAddr = 0;
ret = CryptGetDefaultOIDFunctionAddress(set, 0, NULL, 0, &funcAddr,
&hFuncAddr);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
/* This fails with the normal encoding too, so built-in functions aren't
* returned.
*/
ret = CryptGetDefaultOIDFunctionAddress(set, X509_ASN_ENCODING, NULL, 0,
&funcAddr, &hFuncAddr);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
/* Even with a registered dll, this fails (since the dll doesn't exist) */
SetLastError(0xdeadbeef);
......@@ -502,11 +502,11 @@ static void test_getDefaultOIDFunctionAddress(void)
if (!ret && GetLastError() == ERROR_ACCESS_DENIED)
skip("Need admin rights\n");
else
ok(ret, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError());
ok(ret, "CryptRegisterDefaultOIDFunction failed: %08lx\n", GetLastError());
ret = CryptGetDefaultOIDFunctionAddress(set, 0, NULL, 0, &funcAddr,
&hFuncAddr);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv", bogusDll);
}
......@@ -591,20 +591,20 @@ static void test_findOIDInfo(void)
{
DWORD *data;
ok(info->cbSize == sizeof(*info), "Unexpected structure size %d.\n", info->cbSize);
ok(info->cbSize == sizeof(*info), "Unexpected structure size %ld.\n", info->cbSize);
ok(!strcmp(info->pszOID, oid_ecdsa_sha256), "Expected %s, got %s\n", oid_ecdsa_sha256, info->pszOID);
ok(!lstrcmpW(info->pwszName, sha256ECDSA), "Expected %s, got %s\n",
wine_dbgstr_w(sha256ECDSA), wine_dbgstr_w(info->pwszName));
ok(info->dwGroupId == CRYPT_SIGN_ALG_OID_GROUP_ID,
"Expected CRYPT_SIGN_ALG_OID_GROUP_ID, got %u\n", info->dwGroupId);
"Expected CRYPT_SIGN_ALG_OID_GROUP_ID, got %lu\n", info->dwGroupId);
ok(U(*info).Algid == CALG_OID_INFO_CNG_ONLY,
"Expected CALG_OID_INFO_CNG_ONLY, got %d\n", U(*info).Algid);
data = (DWORD *)info->ExtraInfo.pbData;
ok(info->ExtraInfo.cbData == 8, "Expected 8, got %d\n", info->ExtraInfo.cbData);
ok(data[0] == CALG_OID_INFO_PARAMETERS, "Expected CALG_OID_INFO_PARAMETERS, got %x\n", data[0]);
ok(info->ExtraInfo.cbData == 8, "Expected 8, got %ld\n", info->ExtraInfo.cbData);
ok(data[0] == CALG_OID_INFO_PARAMETERS, "Expected CALG_OID_INFO_PARAMETERS, got %lx\n", data[0]);
ok(data[1] == CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG,
"Expected CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG, got %x\n", data[1]);
"Expected CRYPT_OID_NO_NULL_ALGORITHM_PARA_FLAG, got %lx\n", data[1]);
ok(!lstrcmpW(info->pwszCNGAlgid, BCRYPT_SHA256_ALGORITHM), "Expected %s, got %s\n",
wine_dbgstr_w(BCRYPT_SHA256_ALGORITHM), wine_dbgstr_w(info->pwszCNGAlgid));
......@@ -628,26 +628,26 @@ static void test_registerOIDInfo(void)
SetLastError(0xdeadbeef);
ret = CryptUnregisterOIDInfo(NULL);
ok(!ret, "should fail\n");
ok(GetLastError() == E_INVALIDARG, "got %#x\n", GetLastError());
ok(GetLastError() == E_INVALIDARG, "got %#lx\n", GetLastError());
memset(&info1, 0, sizeof(info1));
SetLastError(0xdeadbeef);
ret = CryptUnregisterOIDInfo(&info1);
ok(!ret, "should fail\n");
ok(GetLastError() == E_INVALIDARG, "got %#x\n", GetLastError());
ok(GetLastError() == E_INVALIDARG, "got %#lx\n", GetLastError());
info1.cbSize = sizeof(info1);
SetLastError(0xdeadbeef);
ret = CryptUnregisterOIDInfo(&info1);
ok(!ret, "should fail\n");
ok(GetLastError() == E_INVALIDARG, "got %#x\n", GetLastError());
ok(GetLastError() == E_INVALIDARG, "got %#lx\n", GetLastError());
info1.pszOID = test_oid;
SetLastError(0xdeadbeef);
ret = CryptUnregisterOIDInfo(&info1);
ok(!ret, "should fail\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
GetLastError() == ERROR_ACCESS_DENIED, "got %u\n", GetLastError());
GetLastError() == ERROR_ACCESS_DENIED, "got %lu\n", GetLastError());
info2 = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (void *)test_oid, 0);
ok(!info2, "should fail\n");
......@@ -657,10 +657,10 @@ static void test_registerOIDInfo(void)
* registry on Windows because dwGroupId == 0.
*/
ret = CryptRegisterOIDInfo(&info1, 0);
ok(ret, "got %u\n", GetLastError());
ok(ret, "got %lu\n", GetLastError());
ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptDllFindOIDInfo\\1.2.3.4.5.6.7.8.9.10!1", &key);
ok(ret == ERROR_FILE_NOT_FOUND, "got %u\n", ret);
ok(ret == ERROR_FILE_NOT_FOUND, "got %lu\n", ret);
info2 = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, (void *)test_oid, 0);
ok(!info2, "should fail\n");
......@@ -674,7 +674,7 @@ static void test_registerOIDInfo(void)
skip("Need admin rights\n");
return;
}
ok(ret, "got %u\n", GetLastError());
ok(ret, "got %lu\n", GetLastError());
/* It looks like crypt32 reads the OID info from registry only on load,
* and CryptFindOIDInfo will find the registered OID on next run
......@@ -683,28 +683,28 @@ static void test_registerOIDInfo(void)
ok(!info2, "should fail\n");
ret = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptDllFindOIDInfo\\1.2.3.4.5.6.7.8.9.10!1", &key);
ok(!ret, "got %u\n", ret);
ok(!ret, "got %lu\n", ret);
memset(buf, 0, sizeof(buf));
size = sizeof(buf);
ret = RegQueryValueExA(key, "Name", NULL, &type, (BYTE *)buf, &size);
ok(!ret, "got %u\n", ret);
ok(type == REG_SZ, "got %u\n", type);
ok(!ret, "got %lu\n", ret);
ok(type == REG_SZ, "got %lu\n", type);
ok(!strcmp(buf, "winetest"), "got %s\n", buf);
value = 0xdeadbeef;
size = sizeof(value);
ret = RegQueryValueExA(key, "Flags", NULL, &type, (BYTE *)&value, &size);
ok(!ret, "got %u\n", ret);
ok(type == REG_DWORD, "got %u\n", type);
ok(value == 1, "got %u\n", value);
ok(!ret, "got %lu\n", ret);
ok(type == REG_DWORD, "got %lu\n", type);
ok(value == 1, "got %lu\n", value);
RegCloseKey(key);
CryptUnregisterOIDInfo(&info1);
ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\OID\\EncodingType 0\\CryptDllFindOIDInfo\\1.2.3.4.5.6.7.8.9.10!1", &key);
ok(ret == ERROR_FILE_NOT_FOUND, "got %u\n", ret);
ok(ret == ERROR_FILE_NOT_FOUND, "got %lu\n", ret);
}
START_TEST(oid)
......
......@@ -55,13 +55,13 @@ static void test_cryptprotectdata(void)
protected = pCryptProtectData(NULL,desc,NULL,NULL,NULL,0,&cipher);
ok(!protected, "Encrypting without plain data source.\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
SetLastError(0xDEADBEEF);
protected = pCryptProtectData(&plain,desc,NULL,NULL,NULL,0,NULL);
ok(!protected, "Encrypting without cipher destination.\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
cipher.pbData=NULL;
cipher.cbData=0;
......@@ -77,7 +77,7 @@ static void test_cryptprotectdata(void)
r = GetLastError();
ok(r == ERROR_SUCCESS ||
r == ERROR_IO_PENDING, /* win2k */
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %d\n",r);
"Expected ERROR_SUCCESS or ERROR_IO_PENDING, got %ld\n",r);
}
cipher_entropy.pbData=NULL;
......@@ -102,7 +102,7 @@ static void test_cryptprotectdata(void)
{
/* fails in win2k */
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
}
}
......@@ -131,13 +131,13 @@ static void test_cryptunprotectdata(void)
okay = pCryptUnprotectData(&cipher,NULL,NULL,NULL,NULL,0,NULL);
ok(!okay,"Decrypting without destination\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
SetLastError(0xDEADBEEF);
okay = pCryptUnprotectData(NULL,NULL,NULL,NULL,NULL,0,&plain);
ok(!okay,"Decrypting without source\n");
r = GetLastError();
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_PARAMETER, "Wrong (%lu) GetLastError seen\n",r);
plain.pbData=NULL;
plain.cbData=0;
......@@ -146,7 +146,7 @@ static void test_cryptunprotectdata(void)
okay = pCryptUnprotectData(&cipher_entropy,NULL,NULL,NULL,NULL,0,&plain);
ok(!okay,"Decrypting without needed entropy\n");
r = GetLastError();
ok(r == ERROR_INVALID_DATA, "Wrong (%u) GetLastError seen\n", r);
ok(r == ERROR_INVALID_DATA, "Wrong (%lu) GetLastError seen\n", r);
plain.pbData=NULL;
plain.cbData=0;
......@@ -175,7 +175,7 @@ static void test_cryptunprotectdata(void)
okay = pCryptUnprotectData(&cipher_entropy,&data_desc,&cipher_entropy,NULL,NULL,0,&plain);
ok(!okay,"Decrypting with wrong entropy\n");
r = GetLastError();
ok(r == ERROR_INVALID_DATA, "Wrong (%u) GetLastError seen\n",r);
ok(r == ERROR_INVALID_DATA, "Wrong (%lu) GetLastError seen\n",r);
/* with entropy */
SetLastError(0xDEADBEEF);
......@@ -234,8 +234,8 @@ static void test_simpleroundtrip(const char *plaintext)
}
res = pCryptUnprotectData(&encrypted, NULL, NULL, NULL, NULL, 0, &output);
ok(res != 0, "can't unprotect; last error %u\n", GetLastError());
ok(output.cbData == strlen(plaintext), "output wrong length %d for input '%s', wanted %d\n", output.cbData, plaintext, lstrlenA(plaintext));
ok(res != 0, "can't unprotect; last error %lu\n", GetLastError());
ok(output.cbData == strlen(plaintext), "output wrong length %ld for input '%s', wanted %d\n", output.cbData, plaintext, lstrlenA(plaintext));
ok(!memcmp(plaintext, (char *)output.pbData, output.cbData), "output wrong contents for input '%s'\n", plaintext);
LocalFree(output.pbData);
LocalFree(encrypted.pbData);
......
......@@ -49,7 +49,7 @@ static void test_AddRemoveProvider(void)
ret = CryptSIPRemoveProvider(NULL);
ok (!ret, "Expected CryptSIPRemoveProvider to fail.\n");
ok (GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d.\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld.\n", GetLastError());
/* nonexistent provider should result in a registry error */
SetLastError(0xdeadbeef);
......@@ -68,7 +68,7 @@ static void test_AddRemoveProvider(void)
*/
if (!ret)
ok (GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld.\n", GetLastError());
}
/* Everything OK, pwszIsFunctionName and pwszIsFunctionNameFmt2 are left NULL
......@@ -90,7 +90,7 @@ static void test_AddRemoveProvider(void)
skip("Need admin rights\n");
return;
}
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %d\n", GetLastError());
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %ld\n", GetLastError());
/* Dummy provider will be deleted, but the function still fails because
* pwszIsFunctionName and pwszIsFunctionNameFmt2 are not present in the
......@@ -105,7 +105,7 @@ static void test_AddRemoveProvider(void)
*/
if (!ret)
ok (GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %d.\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %ld.\n", GetLastError());
/* Everything OK */
memset(&newprov, 0, sizeof(SIP_ADD_NEWPROVIDER));
......@@ -124,12 +124,12 @@ static void test_AddRemoveProvider(void)
SetLastError(0xdeadbeef);
ret = CryptSIPAddProvider(&newprov);
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %d\n", GetLastError());
ok ( ret, "CryptSIPAddProvider should have succeeded, last error %ld\n", GetLastError());
/* Dummy provider should be deleted */
SetLastError(0xdeadbeef);
ret = CryptSIPRemoveProvider(&actionid);
ok ( ret, "CryptSIPRemoveProvider should have succeeded, last error %d\n", GetLastError());
ok ( ret, "CryptSIPRemoveProvider should have succeeded, last error %ld\n", GetLastError());
}
static const BYTE cabFileData[] = {
......@@ -164,7 +164,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ret = CryptSIPRetrieveSubjectGuid(NULL, NULL, NULL);
ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
ok (GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d.\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got %ld.\n", GetLastError());
/* Test with a nonexistent file (hopefully) */
SetLastError(0xdeadbeef);
......@@ -174,7 +174,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
ok (GetLastError() == ERROR_FILE_NOT_FOUND ||
GetLastError() == ERROR_PATH_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, got %d.\n",
"Expected ERROR_FILE_NOT_FOUND or ERROR_PATH_NOT_FOUND, got %ld.\n",
GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for c:\\deadbeef.dbf, not %s\n", wine_dbgstr_guid(&subject));
......@@ -184,7 +184,7 @@ static void test_SIPRetrieveSubjectGUID(void)
* Use A-functions where possible as that should be available on all platforms
*/
ret = GetEnvironmentVariableA(windir, regeditPath, MAX_PATH);
ok (ret > 0, "expected GEVA(windir) to succeed, last error %d\n", GetLastError());
ok (ret > 0, "expected GEVA(windir) to succeed, last error %ld\n", GetLastError());
strcat(regeditPath, "\\");
strcat(regeditPath, regeditExe);
MultiByteToWideChar(CP_ACP, 0, regeditPath, strlen(regeditPath)+1, regeditPathW,
......@@ -230,7 +230,7 @@ static void test_SIPRetrieveSubjectGUID(void)
GetLastError() == ERROR_INVALID_PARAMETER /* Vista */ ||
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some Win98 */,
"Expected ERROR_FILE_INVALID, ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
"Expected ERROR_FILE_INVALID, ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
......@@ -246,7 +246,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ok ( GetLastError() == ERROR_INVALID_PARAMETER ||
GetLastError() == ERROR_SUCCESS /* most Win98 */ ||
GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN /* some Win98 */,
"Expected ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, ERROR_SUCCESS or TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
......@@ -261,7 +261,7 @@ static void test_SIPRetrieveSubjectGUID(void)
ok ( !ret, "Expected CryptSIPRetrieveSubjectGuid to fail\n");
ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN ||
GetLastError() == ERROR_SUCCESS /* Win98 */,
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08x\n", GetLastError());
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN or ERROR_SUCCESS, got 0x%08lx\n", GetLastError());
ok(IsEqualGUID(&subject, &nullSubject),
"Expected a NULL GUID for empty file %s, not %s\n", tempfile, wine_dbgstr_guid(&subject));
......@@ -271,14 +271,14 @@ static void test_SIPRetrieveSubjectGUID(void)
/* Create a file with just the .cab header 'MSCF' */
SetLastError(0xdeadbeef);
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "failed with %u\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "failed with %lu\n", GetLastError());
WriteFile(file, cabFileData, 4, &written, NULL);
CloseHandle(file);
SetLastError(0xdeadbeef);
memset(&subject, 1, sizeof(GUID));
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %ld (0x%08lx)\n",
GetLastError(), GetLastError() );
ok(IsEqualGUID(&subject, &cabGUID),
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
......@@ -289,14 +289,14 @@ static void test_SIPRetrieveSubjectGUID(void)
/* Create a .cab file */
SetLastError(0xdeadbeef);
file = CreateFileA(tempfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "failed with %u\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "failed with %lu\n", GetLastError());
WriteFile(file, cabFileData, sizeof(cabFileData), &written, NULL);
CloseHandle(file);
SetLastError(0xdeadbeef);
memset(&subject, 1, sizeof(GUID));
ret = CryptSIPRetrieveSubjectGuid(tempfileW, NULL, &subject);
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %d (0x%08x)\n",
ok( ret, "CryptSIPRetrieveSubjectGuid failed: %ld (0x%08lx)\n",
GetLastError(), GetLastError() );
ok(IsEqualGUID(&subject, &cabGUID),
"Expected GUID %s for cabinet file, not %s\n", wine_dbgstr_guid(&cabGUID), wine_dbgstr_guid(&subject));
......@@ -322,14 +322,14 @@ static void test_SIPLoad(void)
ret = CryptSIPLoad(NULL, 0, NULL);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
/* Only pSipDispatch NULL */
SetLastError(0xdeadbeef);
ret = CryptSIPLoad(&subject, 0, NULL);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
/* No NULLs, but nonexistent pgSubject */
SetLastError(0xdeadbeef);
......@@ -339,7 +339,7 @@ static void test_SIPLoad(void)
ret = CryptSIPLoad(&dummySubject, 0, &sdi);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == TRUST_E_SUBJECT_FORM_UNKNOWN,
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08x\n", GetLastError());
"Expected TRUST_E_SUBJECT_FORM_UNKNOWN, got 0x%08lx\n", GetLastError());
ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
hCrypt = GetModuleHandleA("crypt32.dll");
......@@ -430,7 +430,7 @@ static void test_SIPLoad(void)
ret = CryptSIPLoad(&unknown, 1, &sdi);
ok ( !ret, "Expected CryptSIPLoad to fail\n");
ok ( GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got 0x%08x\n", GetLastError());
"Expected ERROR_INVALID_PARAMETER, got 0x%08lx\n", GetLastError());
ok( sdi.pfGet == (pCryptSIPGetSignedDataMsg)0xdeadbeef, "Expected no change to the function pointer\n");
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -256,7 +256,7 @@ static void test_CertRDNValueToStrA(void)
buffer, sizeof(buffer));
todo_wine_if (attrs[i].todo)
{
ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %d\n",
ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %ld\n",
lstrlenA(attrs[i].str) + 1, ret);
ok(!strcmp(buffer, attrs[i].str), "Expected %s, got %s\n",
attrs[i].str, buffer);
......@@ -267,7 +267,7 @@ static void test_CertRDNValueToStrA(void)
ret = pCertRDNValueToStrA(CERT_RDN_UTF8_STRING, &blob, buffer,
sizeof(buffer));
ok(ret == strlen(ePKI) + 1 || broken(ret != strlen(ePKI) + 1),
"Expected length %d, got %d\n", lstrlenA(ePKI), ret);
"Expected length %d, got %ld\n", lstrlenA(ePKI), ret);
if (ret == strlen(ePKI) + 1)
ok(!strcmp(buffer, ePKI), "Expected %s, got %s\n", ePKI, buffer);
}
......@@ -351,7 +351,7 @@ static void test_CertRDNValueToStrW(void)
todo_wine_if (attrs[i].todo)
{
ok(ret == lstrlenW(attrs[i].str) + 1,
"Expected length %d, got %d\n", lstrlenW(attrs[i].str) + 1, ret);
"Expected length %d, got %ld\n", lstrlenW(attrs[i].str) + 1, ret);
ok(!lstrcmpW(buffer, attrs[i].str), "Expected %s, got %s\n",
wine_dbgstr_w(attrs[i].str), wine_dbgstr_w(buffer));
}
......@@ -361,7 +361,7 @@ static void test_CertRDNValueToStrW(void)
ret = pCertRDNValueToStrW(CERT_RDN_UTF8_STRING, &blob, buffer,
sizeof(buffer));
ok(ret == lstrlenW(ePKIW) + 1 || broken(ret != lstrlenW(ePKIW) + 1),
"Expected length %d, got %d\n", lstrlenW(ePKIW), ret);
"Expected length %d, got %ld\n", lstrlenW(ePKIW), ret);
if (ret == lstrlenW(ePKIW) + 1)
ok(!lstrcmpW(buffer, ePKIW), "Expected %s, got %s\n",
wine_dbgstr_w(ePKIW), wine_dbgstr_w(buffer));
......@@ -375,12 +375,12 @@ static void test_NameToStrConversionA(PCERT_NAME_BLOB pName, DWORD dwStrType,
i = pCertNameToStrA(X509_ASN_ENCODING, pName, dwStrType, NULL, 0);
todo_wine_if (todo)
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
ok(i == strlen(expected) + 1, "Expected %d chars, got %ld\n",
lstrlenA(expected) + 1, i);
i = pCertNameToStrA(X509_ASN_ENCODING,pName, dwStrType, buffer,
sizeof(buffer));
todo_wine_if (todo)
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
ok(i == strlen(expected) + 1, "Expected %d chars, got %ld\n",
lstrlenA(expected) + 1, i);
todo_wine_if (todo)
ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected,
......@@ -441,7 +441,7 @@ static void test_CertNameToStrA(void)
context = CertCreateCertificateContext(X509_ASN_ENCODING, cert,
sizeof(cert));
ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
if (context)
{
......@@ -454,13 +454,13 @@ static void test_CertNameToStrA(void)
SetLastError(0xdeadbeef);
ret = pCertNameToStrA(0, &context->pCertInfo->Issuer, 0, NULL, 0);
ok(ret == 1 && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected retval 1 and ERROR_FILE_NOT_FOUND, got %d - %08x\n",
"Expected retval 1 and ERROR_FILE_NOT_FOUND, got %ld - %08lx\n",
ret, GetLastError());
SetLastError(0xdeadbeef);
ret = pCertNameToStrA(X509_ASN_ENCODING, &context->pCertInfo->Issuer,
0, NULL, 0);
ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected positive return and ERROR_SUCCESS, got %d - %08x\n",
"Expected positive return and ERROR_SUCCESS, got %ld - %08lx\n",
ret, GetLastError());
test_NameToStrConversionA(&context->pCertInfo->Issuer,
......@@ -546,11 +546,11 @@ static void test_NameToStrConversionW(PCERT_NAME_BLOB pName, DWORD dwStrType,
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, NULL, 0);
todo_wine_if (todo)
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %ld\n",
lstrlenW(expected) + 1, i);
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, buffer, ARRAY_SIZE(buffer));
todo_wine_if (todo)
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %ld\n",
lstrlenW(expected) + 1, i);
todo_wine_if (todo)
ok(!lstrcmpW(buffer, expected), "Expected %s, got %s\n",
......@@ -594,7 +594,7 @@ static void test_CertNameToStrW(void)
context = CertCreateCertificateContext(X509_ASN_ENCODING, cert,
sizeof(cert));
ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
if (context)
{
......@@ -607,13 +607,13 @@ static void test_CertNameToStrW(void)
SetLastError(0xdeadbeef);
ret = pCertNameToStrW(0, &context->pCertInfo->Issuer, 0, NULL, 0);
ok(ret == 1 && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected retval 1 and ERROR_FILE_NOT_FOUND, got %d - %08x\n",
"Expected retval 1 and ERROR_FILE_NOT_FOUND, got %ld - %08lx\n",
ret, GetLastError());
SetLastError(0xdeadbeef);
ret = pCertNameToStrW(X509_ASN_ENCODING, &context->pCertInfo->Issuer,
0, NULL, 0);
ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected positive return and ERROR_SUCCESS, got %d - %08x\n",
"Expected positive return and ERROR_SUCCESS, got %ld - %08lx\n",
ret, GetLastError());
test_NameToStrConversionW(&context->pCertInfo->Issuer,
......@@ -746,61 +746,61 @@ static void test_CertStrToNameA(void)
ok(!ret, "Expected failure\n");
ret = pCertStrToNameA(0, "bogus", 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameA(0, "foo=1", 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameA(0, "CN=1", 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1", 0, NULL, NULL, &size, NULL);
ok(ret, "CertStrToNameA failed: %08x\n", GetLastError());
ok(ret, "CertStrToNameA failed: %08lx\n", GetLastError());
size = sizeof(buf);
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"\"1\"\"", 0, NULL, buf, &size,
NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1+2", 0, NULL, buf,
&size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1+2", CERT_NAME_STR_NO_PLUS_FLAG, NULL, buf,
&size, NULL);
ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
"Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=1,2", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
&size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"1,2;3,4\"", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
&size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=abc", 0, NULL, buf,
&size, NULL);
ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
"Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=abc", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
&size, NULL);
ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
"Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"abc\"", 0, NULL, buf,
&size, NULL);
ok(ret && GetLastError() == ERROR_SUCCESS,
"Expected ERROR_SUCCESS, got %08x\n", GetLastError());
"Expected ERROR_SUCCESS, got %08lx\n", GetLastError());
ret = pCertStrToNameA(X509_ASN_ENCODING, "CN=\"abc\"", CERT_NAME_STR_NO_QUOTING_FLAG, NULL, buf,
&size, NULL);
ok(!ret && GetLastError() == ERROR_MORE_DATA,
"Expected ERROR_MORE_DATA, got %08x\n", GetLastError());
"Expected ERROR_MORE_DATA, got %08lx\n", GetLastError());
for (i = 0; i < ARRAY_SIZE(namesA); i++)
{
size = sizeof(buf);
ret = pCertStrToNameA(X509_ASN_ENCODING, namesA[i].x500, 0, NULL, buf,
&size, NULL);
ok(ret, "CertStrToNameA failed on string %s: %08x\n", namesA[i].x500,
ok(ret, "CertStrToNameA failed on string %s: %08lx\n", namesA[i].x500,
GetLastError());
ok(size == namesA[i].encodedSize,
"Expected size %d, got %d\n", namesA[i].encodedSize, size);
"Expected size %ld, got %ld\n", namesA[i].encodedSize, size);
if (ret)
ok(!memcmp(buf, namesA[i].encoded, namesA[i].encodedSize),
"Unexpected value for string %s\n", namesA[i].x500);
......@@ -866,38 +866,38 @@ static void test_CertStrToNameW(void)
ok(!ret, "Expected failure\n");
ret = pCertStrToNameW(0, bogusW, 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameW(0, fooW, 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameW(0, simpleCN_W, 0, NULL, NULL, &size, NULL);
ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND,
"Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError());
"Expected ERROR_FILE_NOT_FOUND, got %08lx\n", GetLastError());
ret = pCertStrToNameW(X509_ASN_ENCODING, simpleCN_W, 0, NULL, NULL, &size,
NULL);
ok(ret, "CertStrToNameW failed: %08x\n", GetLastError());
ok(ret, "CertStrToNameW failed: %08lx\n", GetLastError());
size = sizeof(buf);
ret = pCertStrToNameW(X509_ASN_ENCODING, badlyQuotedCN_W, 0, NULL, buf,
&size, NULL);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ret = pCertStrToNameW(X509_ASN_ENCODING, badlyQuotedCN_W, 0, NULL, buf,
&size, &errorPtr);
ok(!ret && GetLastError() == CRYPT_E_INVALID_X500_STRING,
"Expected CRYPT_E_INVALID_X500_STRING, got %08x\n", GetLastError());
"Expected CRYPT_E_INVALID_X500_STRING, got %08lx\n", GetLastError());
ok(errorPtr && *errorPtr == '1', "Expected first error character was 1\n");
for (i = 0; i < ARRAY_SIZE(namesW); i++)
{
size = sizeof(buf);
ret = pCertStrToNameW(X509_ASN_ENCODING, namesW[i].x500, 0, NULL, buf,
&size, NULL);
ok(ret, "Index %d: CertStrToNameW failed: %08x\n", i, GetLastError());
ok(ret, "Index %ld: CertStrToNameW failed: %08lx\n", i, GetLastError());
ok(size == namesW[i].encodedSize,
"Index %d: expected size %d, got %d\n", i, namesW[i].encodedSize,
"Index %ld: expected size %ld, got %ld\n", i, namesW[i].encodedSize,
size);
if (ret)
ok(!memcmp(buf, namesW[i].encoded, size),
"Index %d: unexpected value for string %s\n", i, wine_dbgstr_w(namesW[i].x500));
"Index %ld: unexpected value for string %s\n", i, wine_dbgstr_w(namesW[i].x500));
}
}
......@@ -913,7 +913,7 @@ static void test_CertGetNameStringA(void)
context = CertCreateCertificateContext(X509_ASN_ENCODING, cert,
sizeof(cert));
ok(context != NULL, "CertCreateCertificateContext failed: %08x\n",
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
if (context)
{
......@@ -924,16 +924,16 @@ static void test_CertGetNameStringA(void)
/* Bad string types/types missing from the cert */
len = pCertGetNameStringA(NULL, 0, 0, NULL, NULL, 0);
ok(len == 1, "expected 1, got %d\n", len);
ok(len == 1, "expected 1, got %ld\n", len);
len = pCertGetNameStringA(context, 0, 0, NULL, NULL, 0);
ok(len == 1, "expected 1, got %d\n", len);
ok(len == 1, "expected 1, got %ld\n", len);
len = pCertGetNameStringA(context, CERT_NAME_URL_TYPE, 0, NULL, NULL,
0);
ok(len == 1, "expected 1, got %d\n", len);
ok(len == 1, "expected 1, got %ld\n", len);
len = pCertGetNameStringA(context, CERT_NAME_EMAIL_TYPE, 0, NULL, NULL,
0);
ok(len == strlen(aric) + 1, "unexpected length %d\n", len);
ok(len == strlen(aric) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -945,7 +945,7 @@ static void test_CertGetNameStringA(void)
len = pCertGetNameStringA(context, CERT_NAME_RDN_TYPE, 0, NULL, NULL,
0);
ok(len == strlen(issuerStr) + 1, "unexpected length %d\n", len);
ok(len == strlen(issuerStr) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -957,7 +957,7 @@ static void test_CertGetNameStringA(void)
type = 0;
len = pCertGetNameStringA(context, CERT_NAME_RDN_TYPE, 0, &type, NULL,
0);
ok(len == strlen(issuerStr) + 1, "unexpected length %d\n", len);
ok(len == strlen(issuerStr) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -969,7 +969,7 @@ static void test_CertGetNameStringA(void)
type = CERT_OID_NAME_STR;
len = pCertGetNameStringA(context, CERT_NAME_RDN_TYPE, 0, &type, NULL,
0);
ok(len == strlen(subjectStr) + 1, "unexpected length %d\n", len);
ok(len == strlen(subjectStr) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -981,7 +981,7 @@ static void test_CertGetNameStringA(void)
len = pCertGetNameStringA(context, CERT_NAME_ATTR_TYPE, 0, NULL, NULL,
0);
ok(len == strlen(aric) + 1, "unexpected length %d\n", len);
ok(len == strlen(aric) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -992,7 +992,7 @@ static void test_CertGetNameStringA(void)
}
len = pCertGetNameStringA(context, CERT_NAME_ATTR_TYPE, 0,
(void *)szOID_RSA_emailAddr, NULL, 0);
ok(len == strlen(aric) + 1, "unexpected length %d\n", len);
ok(len == strlen(aric) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -1003,7 +1003,7 @@ static void test_CertGetNameStringA(void)
}
len = pCertGetNameStringA(context, CERT_NAME_ATTR_TYPE, 0,
(void *)szOID_COMMON_NAME, NULL, 0);
ok(len == strlen(localhost) + 1, "unexpected length %d\n", len);
ok(len == strlen(localhost) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -1015,7 +1015,7 @@ static void test_CertGetNameStringA(void)
len = pCertGetNameStringA(context, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0,
NULL, NULL, 0);
ok(len == strlen(localhost) + 1, "unexpected length %d\n", len);
ok(len == strlen(localhost) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -1027,7 +1027,7 @@ static void test_CertGetNameStringA(void)
len = pCertGetNameStringA(context, CERT_NAME_FRIENDLY_DISPLAY_TYPE, 0,
NULL, NULL, 0);
ok(len == strlen(localhost) + 1, "unexpected length %d\n", len);
ok(len == strlen(localhost) + 1, "unexpected length %ld\n", len);
str = HeapAlloc(GetProcessHeap(), 0, len);
if (str)
{
......@@ -1040,7 +1040,7 @@ static void test_CertGetNameStringA(void)
len = pCertGetNameStringA(context, CERT_NAME_DNS_TYPE, 0, NULL, NULL,
0);
ok(len == strlen(localhost) + 1 || broken(len == 1) /* NT4 */,
"unexpected length %d\n", len);
"unexpected length %ld\n", len);
if (len > 1)
{
str = HeapAlloc(GetProcessHeap(), 0, len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment