Juan Lang : crypt32/tests: Test opening serialized stores.

Alexandre Julliard julliard at winehq.org
Wed Jun 16 13:23:20 CDT 2010


Module: wine
Branch: master
Commit: ecbb3c3f18f261aa4a1e5532af9267dbed6cef3a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ecbb3c3f18f261aa4a1e5532af9267dbed6cef3a

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue Jun 15 11:23:35 2010 -0700

crypt32/tests: Test opening serialized stores.

---

 dlls/crypt32/tests/store.c |   67 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c
index de5a9d4..652eac9 100644
--- a/dlls/crypt32/tests/store.c
+++ b/dlls/crypt32/tests/store.c
@@ -1764,6 +1764,72 @@ static void testMessageStore(void)
      "Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
 }
 
+static void testSerializedStore(void)
+{
+    HCERTSTORE store;
+    CRYPT_DATA_BLOB blob;
+
+    if (0)
+    {
+        /* Crash */
+        store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, NULL);
+        store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0,
+         CERT_STORE_DELETE_FLAG, NULL);
+    }
+    blob.cbData = sizeof(serializedStoreWithCert);
+    blob.pbData = (BYTE *)serializedStoreWithCert;
+    store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0,
+     CERT_STORE_DELETE_FLAG, &blob);
+    todo_wine
+    ok(!store && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED,
+     "Expected ERROR_CALL_NOT_IMPLEMENTED, got %08x\n", GetLastError());
+    store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, &blob);
+    todo_wine
+    ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    if (store)
+    {
+        PCCERT_CONTEXT cert;
+        PCCRL_CONTEXT crl;
+
+        cert = CertEnumCertificatesInStore(store, NULL);
+        ok(cert != NULL, "CertEnumCertificatesInStore failed: %08x\n",
+         GetLastError());
+        cert = CertEnumCertificatesInStore(store, cert);
+        ok(!cert, "Expected only one cert\n");
+        if (pCertEnumCRLsInStore)
+        {
+            crl = pCertEnumCRLsInStore(store, NULL);
+            ok(!crl, "Expected no CRLs\n");
+        }
+        CertCloseStore(store, 0);
+    }
+    blob.cbData = sizeof(serializedStoreWithCertAndCRL);
+    blob.pbData = (BYTE *)serializedStoreWithCertAndCRL;
+    store = CertOpenStore(CERT_STORE_PROV_SERIALIZED, 0, 0, 0, &blob);
+    todo_wine
+    ok(store != NULL, "CertOpenStore failed: %08x\n", GetLastError());
+    if (store)
+    {
+        PCCERT_CONTEXT cert;
+        PCCRL_CONTEXT crl;
+
+        cert = CertEnumCertificatesInStore(store, NULL);
+        ok(cert != NULL, "CertEnumCertificatesInStore failed: %08x\n",
+         GetLastError());
+        cert = CertEnumCertificatesInStore(store, cert);
+        ok(!cert, "Expected only one cert\n");
+        if (pCertEnumCRLsInStore)
+        {
+            crl = pCertEnumCRLsInStore(store, NULL);
+            ok(crl != NULL, "CertEnumCRLsInStore failed: %08x\n",
+             GetLastError());
+            crl = pCertEnumCRLsInStore(store, crl);
+            ok(!crl, "Expected only one CRL\n");
+        }
+        CertCloseStore(store, 0);
+    }
+}
+
 static void testCertOpenSystemStore(void)
 {
     HCERTSTORE store;
@@ -2520,6 +2586,7 @@ START_TEST(store)
     testFileStore();
     testFileNameStore();
     testMessageStore();
+    testSerializedStore();
 
     testCertOpenSystemStore();
     testCertEnumSystemStore();




More information about the wine-cvs mailing list