Juan Lang : crypt32: Add CTLs to the collection store.
Alexandre Julliard
julliard at winehq.org
Tue Sep 2 08:32:50 CDT 2008
Module: wine
Branch: master
Commit: 3614bb7b4d812d6b1e447477d83a36e1343da2d2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3614bb7b4d812d6b1e447477d83a36e1343da2d2
Author: Juan Lang <juan.lang at gmail.com>
Date: Fri Aug 29 07:32:17 2008 -0700
crypt32: Add CTLs to the collection store.
---
dlls/crypt32/collectionstore.c | 81 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/collectionstore.c b/dlls/crypt32/collectionstore.c
index 9bf6d1d..41b644a 100644
--- a/dlls/crypt32/collectionstore.c
+++ b/dlls/crypt32/collectionstore.c
@@ -341,6 +341,84 @@ static BOOL CRYPT_CollectionDeleteCRL(PWINECRYPT_CERTSTORE store,
return ret;
}
+static BOOL CRYPT_CollectionAddCTL(PWINECRYPT_CERTSTORE store, void *ctl,
+ void *toReplace, const void **ppStoreContext)
+{
+ BOOL ret;
+ void *childContext = NULL;
+ PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store;
+
+ ret = CRYPT_CollectionAddContext(cs, offsetof(WINECRYPT_CERTSTORE, ctls),
+ ctl, toReplace, sizeof(CTL_CONTEXT), &childContext);
+ if (ppStoreContext && childContext)
+ {
+ PWINE_STORE_LIST_ENTRY storeEntry = *(PWINE_STORE_LIST_ENTRY *)
+ Context_GetExtra(childContext, sizeof(CTL_CONTEXT));
+ PCTL_CONTEXT context =
+ CRYPT_CollectionCreateContextFromChild(cs, storeEntry, childContext,
+ sizeof(CTL_CONTEXT), TRUE);
+
+ if (context)
+ context->hCertStore = store;
+ *ppStoreContext = context;
+ }
+ CertFreeCTLContext((PCCTL_CONTEXT)childContext);
+ return ret;
+}
+
+static void *CRYPT_CollectionEnumCTL(PWINECRYPT_CERTSTORE store, void *pPrev)
+{
+ PWINE_COLLECTIONSTORE cs = (PWINE_COLLECTIONSTORE)store;
+ void *ret;
+
+ TRACE("(%p, %p)\n", store, pPrev);
+
+ EnterCriticalSection(&cs->cs);
+ if (pPrev)
+ {
+ PWINE_STORE_LIST_ENTRY storeEntry =
+ *(PWINE_STORE_LIST_ENTRY *)Context_GetExtra(pPrev,
+ sizeof(CTL_CONTEXT));
+
+ ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
+ &storeEntry->store->ctls, pCTLInterface, pPrev, sizeof(CTL_CONTEXT));
+ }
+ else
+ {
+ if (!list_empty(&cs->stores))
+ {
+ PWINE_STORE_LIST_ENTRY storeEntry = LIST_ENTRY(cs->stores.next,
+ WINE_STORE_LIST_ENTRY, entry);
+
+ ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
+ &storeEntry->store->ctls, pCTLInterface, NULL,
+ sizeof(CTL_CONTEXT));
+ }
+ else
+ {
+ SetLastError(CRYPT_E_NOT_FOUND);
+ ret = NULL;
+ }
+ }
+ LeaveCriticalSection(&cs->cs);
+ if (ret)
+ ((PCTL_CONTEXT)ret)->hCertStore = store;
+ TRACE("returning %p\n", ret);
+ return ret;
+}
+
+static BOOL CRYPT_CollectionDeleteCTL(PWINECRYPT_CERTSTORE store,
+ void *pCtlContext)
+{
+ BOOL ret;
+
+ TRACE("(%p, %p)\n", store, pCtlContext);
+
+ ret = CertDeleteCTLFromStore((PCCTL_CONTEXT)
+ Context_GetLinkedContext(pCtlContext, sizeof(CTL_CONTEXT)));
+ return ret;
+}
+
PWINECRYPT_CERTSTORE CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv,
DWORD dwFlags, const void *pvPara)
{
@@ -365,6 +443,9 @@ PWINECRYPT_CERTSTORE CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv,
store->hdr.crls.addContext = CRYPT_CollectionAddCRL;
store->hdr.crls.enumContext = CRYPT_CollectionEnumCRL;
store->hdr.crls.deleteContext = CRYPT_CollectionDeleteCRL;
+ store->hdr.ctls.addContext = CRYPT_CollectionAddCTL;
+ store->hdr.ctls.enumContext = CRYPT_CollectionEnumCTL;
+ store->hdr.ctls.deleteContext = CRYPT_CollectionDeleteCTL;
InitializeCriticalSection(&store->cs);
store->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PWINE_COLLECTIONSTORE->cs");
list_init(&store->stores);
More information about the wine-cvs
mailing list