From 1137d630a6d8a16bb2b645751972fd4e98c956cd Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Wed, 11 Feb 2009 17:32:49 -0800 Subject: [PATCH] crypt32: Fix test failures on some Windows 98 systems. --- dlls/crypt32/tests/ctl.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/dlls/crypt32/tests/ctl.c b/dlls/crypt32/tests/ctl.c index fea7b979728..2b80bf0e887 100644 --- a/dlls/crypt32/tests/ctl.c +++ b/dlls/crypt32/tests/ctl.c @@ -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,