Juan Lang : crypt32: Add CTLs to the memory store.

Alexandre Julliard julliard at winehq.org
Tue Sep 2 08:32:50 CDT 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Aug 29 07:31:53 2008 -0700

crypt32: Add CTLs to the memory store.

---

 dlls/crypt32/crypt32_private.h |    1 +
 dlls/crypt32/store.c           |   48 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h
index c080540..46bc8c5 100644
--- a/dlls/crypt32/crypt32_private.h
+++ b/dlls/crypt32/crypt32_private.h
@@ -227,6 +227,7 @@ typedef struct WINE_CRYPTCERTSTORE
     PFN_CERT_STORE_PROV_CLOSE   closeStore;
     CONTEXT_FUNCS               certs;
     CONTEXT_FUNCS               crls;
+    CONTEXT_FUNCS               ctls;
     PFN_CERT_STORE_PROV_CONTROL control; /* optional */
     PCONTEXT_PROPERTY_LIST      properties;
 } WINECRYPT_CERTSTORE, *PWINECRYPT_CERTSTORE;
diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index 803fd40..998f548 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -91,6 +91,7 @@ typedef struct _WINE_MEMSTORE
     WINECRYPT_CERTSTORE hdr;
     struct ContextList *certs;
     struct ContextList *crls;
+    struct ContextList *ctls;
 } WINE_MEMSTORE, *PWINE_MEMSTORE;
 
 void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags,
@@ -229,6 +230,47 @@ static BOOL CRYPT_MemDeleteCrl(PWINECRYPT_CERTSTORE store, void *pCrlContext)
     return TRUE;
 }
 
+static BOOL CRYPT_MemAddCtl(PWINECRYPT_CERTSTORE store, void *ctl,
+ void *toReplace, const void **ppStoreContext)
+{
+    WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
+    PCTL_CONTEXT context;
+
+    TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext);
+
+    context = (PCTL_CONTEXT)ContextList_Add(ms->ctls, ctl, toReplace);
+    if (context)
+    {
+        context->hCertStore = store;
+        if (ppStoreContext)
+            *ppStoreContext = CertDuplicateCTLContext(context);
+    }
+    return context ? TRUE : FALSE;
+}
+
+static void *CRYPT_MemEnumCtl(PWINECRYPT_CERTSTORE store, void *pPrev)
+{
+    WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
+    void *ret;
+
+    TRACE("(%p, %p)\n", store, pPrev);
+
+    ret = ContextList_Enum(ms->ctls, pPrev);
+    if (!ret)
+        SetLastError(CRYPT_E_NOT_FOUND);
+
+    TRACE("returning %p\n", ret);
+    return ret;
+}
+
+static BOOL CRYPT_MemDeleteCtl(PWINECRYPT_CERTSTORE store, void *pCtlContext)
+{
+    WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
+
+    ContextList_Delete(ms->ctls, pCtlContext);
+    return TRUE;
+}
+
 static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
 {
     WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore;
@@ -239,6 +281,7 @@ static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
 
     ContextList_Free(store->certs);
     ContextList_Free(store->crls);
+    ContextList_Free(store->ctls);
     CRYPT_FreeStore((PWINECRYPT_CERTSTORE)store);
 }
 
@@ -268,11 +311,16 @@ static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv,
             store->hdr.crls.addContext     = CRYPT_MemAddCrl;
             store->hdr.crls.enumContext    = CRYPT_MemEnumCrl;
             store->hdr.crls.deleteContext  = CRYPT_MemDeleteCrl;
+            store->hdr.ctls.addContext     = CRYPT_MemAddCtl;
+            store->hdr.ctls.enumContext    = CRYPT_MemEnumCtl;
+            store->hdr.ctls.deleteContext  = CRYPT_MemDeleteCtl;
             store->hdr.control             = NULL;
             store->certs = ContextList_Create(pCertInterface,
              sizeof(CERT_CONTEXT));
             store->crls = ContextList_Create(pCRLInterface,
              sizeof(CRL_CONTEXT));
+            store->ctls = ContextList_Create(pCTLInterface,
+             sizeof(CTL_CONTEXT));
             /* Mem store doesn't need crypto provider, so close it */
             if (hCryptProv && !(dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG))
                 CryptReleaseContext(hCryptProv, 0);




More information about the wine-cvs mailing list