crypt32: Fix test failures on some Windows 98 systems.

This commit is contained in:
Juan Lang 2009-02-11 17:32:49 -08:00 committed by Alexandre Julliard
parent 44ab73e289
commit 1137d630a6

View File

@ -135,21 +135,21 @@ static void testCreateCTL(void)
*/
SetLastError(0xdeadbeef);
ctl = CertCreateCTLContext(X509_ASN_ENCODING, signedCTL, sizeof(signedCTL));
ok((!ctl &&
ok(!ctl &&
(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == CRYPT_E_UNEXPECTED_MSG_TYPE /* win9x */)) ||
broken(ctl != NULL /* some win98 */),
"expected ERROR_INVALID_DATA, got %d (0x%08x)\n", GetLastError(),
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(),
GetLastError());
SetLastError(0xdeadbeef);
ctl = CertCreateCTLContext(X509_ASN_ENCODING, ctlWithOneEntry,
sizeof(ctlWithOneEntry));
ok((!ctl &&
ok(!ctl &&
(GetLastError() == ERROR_INVALID_DATA ||
GetLastError() == CRYPT_E_UNEXPECTED_MSG_TYPE /* win9x */ ||
GetLastError() == OSS_DATA_ERROR /* some win98 */)) ||
broken(ctl != NULL /* some win98 */),
"expected ERROR_INVALID_DATA, got %d (0x%08x)\n", GetLastError(),
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(),
GetLastError());
SetLastError(0xdeadbeef);
ctl = CertCreateCTLContext(X509_ASN_ENCODING,
@ -373,8 +373,10 @@ static void testAddCTLToStore(void)
}
else
{
ok(!ret && GetLastError() == CRYPT_E_EXISTS,
"expected CRYPT_E_EXISTS, got %d %08x\n", ret, GetLastError());
ok(!ret && (GetLastError() == CRYPT_E_EXISTS ||
GetLastError() == OSS_DATA_ERROR),
"expected CRYPT_E_EXISTS or OSS_DATA_ERROR, got %d %08x\n", ret,
GetLastError());
}
CertCloseStore(store, 0);
@ -399,7 +401,8 @@ static void testAddCTLToStore(void)
if (ctl)
numCTLs++;
} while (ctl);
ok(numCTLs == 2, "expected 2 CTLs, got %d\n", numCTLs);
ok(numCTLs == 2 || broken(numCTLs == 1 /* some Win98 */),
"expected 2 CTLs, got %d\n", numCTLs);
CertCloseStore(store, 0);
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
@ -410,6 +413,11 @@ static void testAddCTLToStore(void)
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithListID1, sizeof(signedCTLWithListID1), CERT_STORE_ADD_NEW,
NULL);
if (!ret)
{
skip("adding a CTL with an empty usage not supported\n");
return;
}
ok(ret, "CertAddEncodedCTLToStore failed: %08x\n", GetLastError());
ret = CertAddEncodedCTLToStore(store, X509_ASN_ENCODING,
signedCTLWithListID2, sizeof(signedCTLWithListID2), CERT_STORE_ADD_NEW,