crypt32: Pass contexts as context_t to CONTEXT_FUNCS->delete.

This commit is contained in:
Jacek Caban 2013-10-15 16:53:38 +02:00 committed by Alexandre Julliard
parent 03ff35c270
commit 05f248e968
6 changed files with 48 additions and 53 deletions

View File

@ -258,16 +258,17 @@ static void *Collection_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL Collection_deleteCert(WINECRYPT_CERTSTORE *store, void *pCertContext)
static BOOL Collection_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
{
cert_t *cert = (cert_t*)context;
BOOL ret;
PCCERT_CONTEXT linked;
TRACE("(%p, %p)\n", store, pCertContext);
TRACE("(%p, %p)\n", store, cert);
linked = Context_GetLinkedContext(pCertContext);
linked = Context_GetLinkedContext(&cert->ctx);
ret = CertDeleteCertificateFromStore(linked);
CertFreeCertificateContext(pCertContext);
Context_Release(&cert->base);
return ret;
}
@ -333,16 +334,17 @@ static void *Collection_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL Collection_deleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlContext)
static BOOL Collection_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context)
{
crl_t *crl = (crl_t*)context;
BOOL ret;
PCCRL_CONTEXT linked;
TRACE("(%p, %p)\n", store, pCrlContext);
TRACE("(%p, %p)\n", store, crl);
linked = Context_GetLinkedContext(pCrlContext);
linked = Context_GetLinkedContext(&crl->ctx);
ret = CertDeleteCRLFromStore(linked);
CertFreeCRLContext(pCrlContext);
Context_Release(&crl->base);
return ret;
}
@ -408,16 +410,17 @@ static void *Collection_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL Collection_deleteCTL(WINECRYPT_CERTSTORE *store, void *pCtlContext)
static BOOL Collection_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context)
{
ctl_t *ctl = (ctl_t*)context;
BOOL ret;
PCCTL_CONTEXT linked;
TRACE("(%p, %p)\n", store, pCtlContext);
TRACE("(%p, %p)\n", store, ctl);
linked = Context_GetLinkedContext(pCtlContext);
linked = Context_GetLinkedContext(&ctl->ctx);
ret = CertDeleteCTLFromStore(linked);
CertFreeCTLContext(pCtlContext);
Context_Release(&ctl->base);
return ret;
}

View File

@ -216,9 +216,8 @@ void *ContextList_Enum(struct ContextList *list, void *pPrev)
return ret;
}
BOOL ContextList_Remove(struct ContextList *list, void *ctx)
BOOL ContextList_Remove(struct ContextList *list, context_t *context)
{
context_t *context = context_from_ptr(ctx);
BOOL inList = FALSE;
EnterCriticalSection(&list->cs);

View File

@ -275,13 +275,11 @@ typedef void * (*EnumFunc)(struct WINE_CRYPTCERTSTORE *store, void *pPrev);
typedef BOOL (*AddFunc)(struct WINE_CRYPTCERTSTORE *store, void *context,
void *toReplace, const void **ppStoreContext);
typedef BOOL (*DeleteFunc)(struct WINE_CRYPTCERTSTORE *store, void *context);
typedef struct _CONTEXT_FUNCS
{
AddFunc addContext;
EnumFunc enumContext;
DeleteFunc deleteContext;
BOOL (*delete)(struct WINE_CRYPTCERTSTORE*,context_t*);
} CONTEXT_FUNCS;
typedef enum _CertStoreType {
@ -464,7 +462,7 @@ void *ContextList_Enum(struct ContextList *list, void *pPrev) DECLSPEC_HIDDEN;
* or FALSE if not. (The context may have been duplicated, so subsequent
* removes have no effect.)
*/
BOOL ContextList_Remove(struct ContextList *list, void *context) DECLSPEC_HIDDEN;
BOOL ContextList_Remove(struct ContextList *list, context_t *context) DECLSPEC_HIDDEN;
void ContextList_Free(struct ContextList *list) DECLSPEC_HIDDEN;

View File

@ -330,11 +330,12 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
else
{
WINECRYPT_CERTSTORE *hcs = pCtlContext->hCertStore;
ctl_t *ctl = ctl_from_ptr(pCtlContext);
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = FALSE;
else
ret = hcs->vtbl->ctls.deleteContext(hcs, (void *)pCtlContext);
ret = hcs->vtbl->ctls.delete(hcs, &ctl->base);
if (ret)
ret = CertFreeCTLContext(pCtlContext);
}

View File

@ -113,17 +113,17 @@ static void *ProvStore_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, void *cert)
static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret = TRUE;
TRACE("(%p, %p)\n", store, cert);
TRACE("(%p, %p)\n", store, context);
if (ps->provDeleteCert)
ret = ps->provDeleteCert(ps->hStoreProv, cert, 0);
ret = ps->provDeleteCert(ps->hStoreProv, context_ptr(context), 0);
if (ret)
ret = ps->memStore->vtbl->certs.deleteContext(ps->memStore, cert);
ret = ps->memStore->vtbl->certs.delete(ps->memStore, context);
return ret;
}
@ -180,7 +180,7 @@ static void *ProvStore_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, void *crl)
static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *crl)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret = TRUE;
@ -188,9 +188,9 @@ static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, void *crl)
TRACE("(%p, %p)\n", store, crl);
if (ps->provDeleteCrl)
ret = ps->provDeleteCrl(ps->hStoreProv, crl, 0);
ret = ps->provDeleteCrl(ps->hStoreProv, context_ptr(crl), 0);
if (ret)
ret = ps->memStore->vtbl->crls.deleteContext(ps->memStore, crl);
ret = ps->memStore->vtbl->crls.delete(ps->memStore, crl);
return ret;
}
@ -247,7 +247,7 @@ static void *ProvStore_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL ProvStore_deleteCTL(WINECRYPT_CERTSTORE *store, void *ctl)
static BOOL ProvStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *ctl)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret = TRUE;
@ -255,9 +255,9 @@ static BOOL ProvStore_deleteCTL(WINECRYPT_CERTSTORE *store, void *ctl)
TRACE("(%p, %p)\n", store, ctl);
if (ps->provDeleteCtl)
ret = ps->provDeleteCtl(ps->hStoreProv, ctl, 0);
ret = ps->provDeleteCtl(ps->hStoreProv, context_ptr(ctl), 0);
if (ret)
ret = ps->memStore->vtbl->ctls.deleteContext(ps->memStore, ctl);
ret = ps->memStore->vtbl->ctls.delete(ps->memStore, ctl);
return ret;
}

View File

@ -176,16 +176,14 @@ static void *MemStore_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, void *pCertContext)
static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
BOOL ret;
if (ContextList_Remove(ms->certs, pCertContext))
ret = CertFreeCertificateContext(pCertContext);
else
ret = TRUE;
return ret;
if (ContextList_Remove(ms->certs, context))
Context_Release(context);
return TRUE;
}
static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
@ -221,16 +219,14 @@ static void *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlContext)
static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
BOOL ret;
if (ContextList_Remove(ms->crls, pCrlContext))
ret = CertFreeCRLContext(pCrlContext);
else
ret = TRUE;
return ret;
if (!ContextList_Remove(ms->crls, context))
Context_Release(context);
return TRUE;
}
static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
@ -266,16 +262,14 @@ static void *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, void *pCtlContext)
static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *context)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
BOOL ret;
if (ContextList_Remove(ms->ctls, pCtlContext))
ret = CertFreeCTLContext(pCtlContext);
else
ret = TRUE;
return ret;
if (!ContextList_Remove(ms->ctls, context))
Context_Release(context);
return TRUE;
}
static void MemStore_addref(WINECRYPT_CERTSTORE *store)
@ -924,7 +918,7 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = FALSE;
else
ret = hcs->vtbl->certs.deleteContext(hcs, (void *)pCertContext);
ret = hcs->vtbl->certs.delete(hcs, &cert_from_ptr(pCertContext)->base);
}
return ret;
}
@ -1061,7 +1055,7 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = FALSE;
else
ret = hcs->vtbl->crls.deleteContext(hcs, (void *)pCrlContext);
ret = hcs->vtbl->crls.delete(hcs, &crl_from_ptr(pCrlContext)->base);
if (ret)
ret = CertFreeCRLContext(pCrlContext);
}
@ -1387,7 +1381,7 @@ static void *EmptyStore_enum(WINECRYPT_CERTSTORE *store, void *prev)
return FALSE;
}
static BOOL EmptyStore_delete(WINECRYPT_CERTSTORE *store, void *context)
static BOOL EmptyStore_delete(WINECRYPT_CERTSTORE *store, context_t *context)
{
return TRUE;
}