crypt32: Reduce indent level of tests.

This commit is contained in:
Juan Lang 2006-09-25 20:24:44 -07:00 committed by Alexandre Julliard
parent 581c24ef4e
commit 09765f7db4
1 changed files with 460 additions and 465 deletions

View File

@ -132,15 +132,15 @@ static const BYTE certWithUsage[] = { 0x30, 0x81, 0x93, 0x02, 0x01, 0x01, 0x30,
static void testAddCert(void)
{
HCERTSTORE store;
HCERTSTORE collection;
PCCERT_CONTEXT context;
BOOL ret;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store != NULL)
{
HCERTSTORE collection;
PCCERT_CONTEXT context;
BOOL ret;
if (!store)
return;
/* Weird--bad add disposition leads to an access violation in Windows.
*/
@ -288,7 +288,6 @@ static void testAddCert(void)
CertCloseStore(store, 0);
}
}
static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID,
PCCERT_CONTEXT context, DWORD propID)
@ -317,11 +316,6 @@ static void testCertProperties(void)
{
PCCERT_CONTEXT context = CertCreateCertificateContext(X509_ASN_ENCODING,
bigCert, sizeof(bigCert));
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
if (context)
{
DWORD propID, numProps, access, size;
BOOL ret;
BYTE hash[20] = { 0 }, hashProperty[20];
@ -329,6 +323,11 @@ static void testCertProperties(void)
CERT_KEY_CONTEXT keyContext;
HCRYPTPROV csp;
ok(context != NULL, "CertCreateCertificateContext failed: %08lx\n",
GetLastError());
if (!context)
return;
/* This crashes
propID = CertEnumCertificateContextProperties(NULL, 0);
*/
@ -498,19 +497,18 @@ static void testCertProperties(void)
CertFreeCertificateContext(context);
}
}
static void testDupCert(void)
{
HCERTSTORE store;
PCCERT_CONTEXT context, dupContext;
BOOL ret;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store != NULL)
{
PCCERT_CONTEXT context, dupContext;
BOOL ret;
if (!store)
return;
ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &context);
@ -536,22 +534,21 @@ static void testDupCert(void)
}
CertCloseStore(store, 0);
}
}
static void testFindCert(void)
{
HCERTSTORE store;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store)
{
PCCERT_CONTEXT context = NULL;
BOOL ret;
CERT_INFO certInfo = { 0 };
CRYPT_HASH_BLOB blob;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (!store)
return;
ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
bigCert, sizeof(bigCert), CERT_STORE_ADD_NEW, NULL);
ok(ret, "CertAddEncodedCertificateToStore failed: %08lx\n",
@ -602,7 +599,7 @@ static void testFindCert(void)
if (context)
{
context = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
CERT_FIND_ISSUER_NAME, &certInfo.Subject, context);
CERT_FIND_SUBJECT_NAME, &certInfo.Subject, context);
ok(context == NULL, "Expected one cert only\n");
}
@ -623,7 +620,7 @@ static void testFindCert(void)
if (context)
{
context = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
CERT_FIND_ISSUER_NAME, &certInfo.Subject, context);
CERT_FIND_SUBJECT_CERT, &certInfo.Subject, context);
ok(context == NULL, "Expected one cert only\n");
}
@ -637,26 +634,25 @@ static void testFindCert(void)
if (context)
{
context = CertFindCertificateInStore(store, X509_ASN_ENCODING, 0,
CERT_FIND_ISSUER_NAME, &certInfo.Subject, context);
CERT_FIND_SHA1_HASH, &certInfo.Subject, context);
ok(context == NULL, "Expected one cert only\n");
}
CertCloseStore(store, 0);
}
}
static void testGetSubjectCert(void)
{
HCERTSTORE store;
PCCERT_CONTEXT context1, context2;
CERT_INFO info = { 0 };
BOOL ret;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed: %ld\n", GetLastError());
if (store != NULL)
{
PCCERT_CONTEXT context1, context2;
CERT_INFO info = { 0 };
BOOL ret;
if (!store)
return;
ret = CertAddEncodedCertificateToStore(store, X509_ASN_ENCODING,
bigCert, sizeof(bigCert), CERT_STORE_ADD_ALWAYS, NULL);
@ -701,7 +697,6 @@ static void testGetSubjectCert(void)
CertFreeCertificateContext(context1);
CertCloseStore(store, 0);
}
}
/* This expires in 1970 or so */
static const BYTE expiredCert[] = { 0x30, 0x82, 0x01, 0x33, 0x30, 0x81, 0xe2,