Commit 83026a71 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

crypt32: Use context_t in addContext.

parent c75af2b9
...@@ -169,7 +169,7 @@ BOOL WINAPI add_cert_to_store(WINECRYPT_CERTSTORE *store, const CERT_CONTEXT *ce ...@@ -169,7 +169,7 @@ BOOL WINAPI add_cert_to_store(WINECRYPT_CERTSTORE *store, const CERT_CONTEXT *ce
{ {
const CERT_CONTEXT *existing = NULL; const CERT_CONTEXT *existing = NULL;
BOOL ret = TRUE, inherit_props = FALSE; BOOL ret = TRUE, inherit_props = FALSE;
CERT_CONTEXT *new_context = NULL; context_t *new_context = NULL;
switch (add_disposition) switch (add_disposition)
{ {
...@@ -262,18 +262,20 @@ BOOL WINAPI add_cert_to_store(WINECRYPT_CERTSTORE *store, const CERT_CONTEXT *ce ...@@ -262,18 +262,20 @@ BOOL WINAPI add_cert_to_store(WINECRYPT_CERTSTORE *store, const CERT_CONTEXT *ce
return TRUE; return TRUE;
} }
ret = store->vtbl->certs.addContext(store, (void*)cert, (void*)existing, ret = store->vtbl->certs.addContext(store, context_from_ptr(cert), existing ? context_from_ptr(existing) : NULL,
(ret_context || inherit_props) ? (const void **)&new_context : NULL, use_link); (ret_context || inherit_props) ? &new_context : NULL, use_link);
if(!ret) if(!ret)
return FALSE; return FALSE;
if(inherit_props) if(inherit_props)
Context_CopyProperties(new_context, existing); Context_CopyProperties(context_ptr(new_context), existing);
if(ret_context) if(ret_context) {
*ret_context = CertDuplicateCertificateContext(new_context); Context_AddRef(new_context);
else if(new_context) *ret_context = context_ptr(new_context);
CertFreeCertificateContext(new_context); }else if(new_context) {
Context_Release(new_context);
}
TRACE("returning %d\n", ret); TRACE("returning %d\n", ret);
return ret; return ret;
......
...@@ -85,11 +85,11 @@ static context_t *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *s ...@@ -85,11 +85,11 @@ static context_t *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *s
} }
static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store, static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
unsigned int contextFuncsOffset, void *context, void *toReplace, unsigned int contextSize, unsigned int contextFuncsOffset, context_t *context, context_t *toReplace, unsigned int contextSize,
void **pChildContext) context_t **pChildContext)
{ {
BOOL ret; BOOL ret;
void *childContext = NULL; context_t *childContext = NULL;
WINE_STORE_LIST_ENTRY *storeEntry = NULL; WINE_STORE_LIST_ENTRY *storeEntry = NULL;
TRACE("(%p, %d, %p, %p, %d)\n", store, contextFuncsOffset, context, TRACE("(%p, %d, %p, %p, %d)\n", store, contextFuncsOffset, context,
...@@ -98,22 +98,21 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store, ...@@ -98,22 +98,21 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
ret = FALSE; ret = FALSE;
if (toReplace) if (toReplace)
{ {
context_t *existingLinked = context_from_ptr(toReplace)->linked; context_t *existingLinked = toReplace->linked;
CONTEXT_FUNCS *contextFuncs; CONTEXT_FUNCS *contextFuncs;
storeEntry = context_from_ptr(toReplace)->u.ptr; storeEntry = toReplace->u.ptr;
contextFuncs = (CONTEXT_FUNCS*)((LPBYTE)storeEntry->store->vtbl + contextFuncs = (CONTEXT_FUNCS*)((LPBYTE)storeEntry->store->vtbl +
contextFuncsOffset); contextFuncsOffset);
ret = contextFuncs->addContext(storeEntry->store, context, ret = contextFuncs->addContext(storeEntry->store, context,
context_ptr(existingLinked), (const void **)&childContext, TRUE); existingLinked, &childContext, TRUE);
} }
else else
{ {
WINE_STORE_LIST_ENTRY *entry, *next; WINE_STORE_LIST_ENTRY *entry, *next;
EnterCriticalSection(&store->cs); EnterCriticalSection(&store->cs);
LIST_FOR_EACH_ENTRY_SAFE(entry, next, &store->stores, LIST_FOR_EACH_ENTRY_SAFE(entry, next, &store->stores, WINE_STORE_LIST_ENTRY, entry)
WINE_STORE_LIST_ENTRY, entry)
{ {
if (entry->dwUpdateFlags & CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG) if (entry->dwUpdateFlags & CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG)
{ {
...@@ -121,8 +120,7 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store, ...@@ -121,8 +120,7 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
(LPBYTE)entry->store->vtbl + contextFuncsOffset); (LPBYTE)entry->store->vtbl + contextFuncsOffset);
storeEntry = entry; storeEntry = entry;
ret = contextFuncs->addContext(entry->store, context, NULL, ret = contextFuncs->addContext(entry->store, context, NULL, &childContext, TRUE);
(const void **)&childContext, TRUE);
break; break;
} }
} }
...@@ -197,24 +195,25 @@ static context_t *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store, ...@@ -197,24 +195,25 @@ static context_t *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
return ret; return ret;
} }
static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, void *cert, static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, context_t *cert,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
BOOL ret; BOOL ret;
void *childContext = NULL; context_t *childContext = NULL;
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, certs), ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, certs),
cert, toReplace, sizeof(CERT_CONTEXT), &childContext); cert, toReplace, sizeof(CERT_CONTEXT), &childContext);
if (ppStoreContext && childContext) if (ppStoreContext && childContext)
{ {
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr; WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr;
cert_t *context = (cert_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, cert_t *context = (cert_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry,
context_from_ptr(childContext), sizeof(CERT_CONTEXT)); childContext, sizeof(CERT_CONTEXT));
*ppStoreContext = &context->ctx; *ppStoreContext = &context->base;
} }
CertFreeCertificateContext(childContext); if (childContext)
Context_Release(childContext);
return ret; return ret;
} }
...@@ -270,24 +269,25 @@ static BOOL Collection_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context ...@@ -270,24 +269,25 @@ static BOOL Collection_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context
return ret; return ret;
} }
static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, void *crl, static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
BOOL ret; BOOL ret;
void *childContext = NULL; context_t *childContext = NULL;
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, crls), ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, crls),
crl, toReplace, sizeof(CRL_CONTEXT), &childContext); crl, toReplace, sizeof(CRL_CONTEXT), &childContext);
if (ppStoreContext && childContext) if (ppStoreContext && childContext)
{ {
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr; WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr;
crl_t *context = (crl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, crl_t *context = (crl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry,
context_from_ptr(childContext), sizeof(CRL_CONTEXT)); childContext, sizeof(CRL_CONTEXT));
*ppStoreContext = &context->ctx; *ppStoreContext = &context->base;
} }
CertFreeCRLContext(childContext); if (childContext)
Context_Release(childContext);
return ret; return ret;
} }
...@@ -341,24 +341,25 @@ static BOOL Collection_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) ...@@ -341,24 +341,25 @@ static BOOL Collection_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context)
return ret; return ret;
} }
static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, void *ctl, static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
BOOL ret; BOOL ret;
void *childContext = NULL; context_t *childContext = NULL;
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, ctls), ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, ctls),
ctl, toReplace, sizeof(CTL_CONTEXT), &childContext); ctl, toReplace, sizeof(CTL_CONTEXT), &childContext);
if (ppStoreContext && childContext) if (ppStoreContext && childContext)
{ {
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr; WINE_STORE_LIST_ENTRY *storeEntry = childContext->u.ptr;
ctl_t *context = (ctl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry, ctl_t *context = (ctl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry,
context_from_ptr(childContext), sizeof(CTL_CONTEXT)); childContext, sizeof(CTL_CONTEXT));
*ppStoreContext = &context->ctx; *ppStoreContext = &context->base;
} }
CertFreeCTLContext(childContext); if (childContext)
Context_Release(childContext);
return ret; return ret;
} }
......
...@@ -272,7 +272,7 @@ typedef struct _CONTEXT_FUNCS ...@@ -272,7 +272,7 @@ typedef struct _CONTEXT_FUNCS
* added if the store allows it. If ppStoreContext is not NULL, the added * added if the store allows it. If ppStoreContext is not NULL, the added
* context should be returned in *ppStoreContext. * context should be returned in *ppStoreContext.
*/ */
BOOL (*addContext)(struct WINE_CRYPTCERTSTORE*,void*,void*,const void**,BOOL); BOOL (*addContext)(struct WINE_CRYPTCERTSTORE*,context_t*,context_t*,context_t**,BOOL);
context_t *(*enumContext)(struct WINE_CRYPTCERTSTORE *store, context_t *prev); context_t *(*enumContext)(struct WINE_CRYPTCERTSTORE *store, context_t *prev);
BOOL (*delete)(struct WINE_CRYPTCERTSTORE*,context_t*); BOOL (*delete)(struct WINE_CRYPTCERTSTORE*,context_t*);
} CONTEXT_FUNCS; } CONTEXT_FUNCS;
......
...@@ -157,11 +157,16 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore, ...@@ -157,11 +157,16 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore,
if (toAdd) if (toAdd)
{ {
if (store) if (store) {
ret = store->vtbl->ctls.addContext(store, (void *)toAdd, context_t *ret_ctx;
(void *)existing, (const void **)ppStoreContext, TRUE);
else if (ppStoreContext) ret = store->vtbl->ctls.addContext(store, context_from_ptr(toAdd),
existing ? context_from_ptr(existing) : NULL, ppStoreContext ? &ret_ctx : NULL, TRUE);
if(ret && ppStoreContext)
*ppStoreContext = context_ptr(ret_ctx);
}else if (ppStoreContext) {
*ppStoreContext = CertDuplicateCTLContext(toAdd); *ppStoreContext = CertDuplicateCTLContext(toAdd);
}
CertFreeCTLContext(toAdd); CertFreeCTLContext(toAdd);
} }
CertFreeCTLContext(existing); CertFreeCTLContext(existing);
......
...@@ -68,8 +68,8 @@ static DWORD ProvStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags) ...@@ -68,8 +68,8 @@ static DWORD ProvStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, void *cert, static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret; BOOL ret;
...@@ -83,8 +83,7 @@ static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, void *cert, ...@@ -83,8 +83,7 @@ static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, void *cert,
{ {
ret = TRUE; ret = TRUE;
if (ps->provWriteCert) if (ps->provWriteCert)
ret = ps->provWriteCert(ps->hStoreProv, cert, ret = ps->provWriteCert(ps->hStoreProv, context_ptr(cert), CERT_STORE_PROV_WRITE_ADD_FLAG);
CERT_STORE_PROV_WRITE_ADD_FLAG);
if (ret) if (ret)
ret = ps->memStore->vtbl->certs.addContext(ps->memStore, cert, NULL, ret = ps->memStore->vtbl->certs.addContext(ps->memStore, cert, NULL,
ppStoreContext, TRUE); ppStoreContext, TRUE);
...@@ -93,7 +92,7 @@ static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, void *cert, ...@@ -93,7 +92,7 @@ static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, void *cert,
* store. * store.
*/ */
if (ret && ppStoreContext) if (ret && ppStoreContext)
(*(PCERT_CONTEXT *)ppStoreContext)->hCertStore = store; (*(cert_t**)ppStoreContext)->ctx.hCertStore = store;
return ret; return ret;
} }
...@@ -127,8 +126,8 @@ static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) ...@@ -127,8 +126,8 @@ static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
return ret; return ret;
} }
static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl, static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret; BOOL ret;
...@@ -149,7 +148,7 @@ static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl, ...@@ -149,7 +148,7 @@ static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
{ {
ret = TRUE; ret = TRUE;
if (ps->provWriteCrl) if (ps->provWriteCrl)
ret = ps->provWriteCrl(ps->hStoreProv, crl, ret = ps->provWriteCrl(ps->hStoreProv, context_ptr(crl),
CERT_STORE_PROV_WRITE_ADD_FLAG); CERT_STORE_PROV_WRITE_ADD_FLAG);
if (ret) if (ret)
ret = ps->memStore->vtbl->crls.addContext(ps->memStore, crl, NULL, ret = ps->memStore->vtbl->crls.addContext(ps->memStore, crl, NULL,
...@@ -160,7 +159,7 @@ static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl, ...@@ -160,7 +159,7 @@ static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
* store. * store.
*/ */
if (ret && ppStoreContext) if (ret && ppStoreContext)
(*(PCRL_CONTEXT *)ppStoreContext)->hCertStore = store; (*(crl_t**)ppStoreContext)->ctx.hCertStore = store;
return ret; return ret;
} }
...@@ -194,8 +193,8 @@ static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *crl) ...@@ -194,8 +193,8 @@ static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *crl)
return ret; return ret;
} }
static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl, static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store; WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret; BOOL ret;
...@@ -216,7 +215,7 @@ static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl, ...@@ -216,7 +215,7 @@ static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
{ {
ret = TRUE; ret = TRUE;
if (ps->provWriteCtl) if (ps->provWriteCtl)
ret = ps->provWriteCtl(ps->hStoreProv, ctl, ret = ps->provWriteCtl(ps->hStoreProv, context_ptr(ctl),
CERT_STORE_PROV_WRITE_ADD_FLAG); CERT_STORE_PROV_WRITE_ADD_FLAG);
if (ret) if (ret)
ret = ps->memStore->vtbl->ctls.addContext(ps->memStore, ctl, NULL, ret = ps->memStore->vtbl->ctls.addContext(ps->memStore, ctl, NULL,
...@@ -227,7 +226,7 @@ static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl, ...@@ -227,7 +226,7 @@ static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
* store. * store.
*/ */
if (ret && ppStoreContext) if (ret && ppStoreContext)
(*(PCTL_CONTEXT *)ppStoreContext)->hCertStore = store; (*(ctl_t**)ppStoreContext)->ctx.hCertStore = store;
return ret; return ret;
} }
......
...@@ -142,21 +142,21 @@ BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, ...@@ -142,21 +142,21 @@ BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0,
return TRUE; return TRUE;
} }
static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, void *cert, static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, context_t *cert,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
context_t *context; context_t *context;
TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext); TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext);
context = ContextList_Add(ms->certs, context_from_ptr(cert), toReplace ? context_from_ptr(toReplace) : NULL, store, use_link); context = ContextList_Add(ms->certs, cert, toReplace, store, use_link);
if (!context) if (!context)
return FALSE; return FALSE;
if (ppStoreContext) { if (ppStoreContext) {
Context_AddRef(context); Context_AddRef(context);
*ppStoreContext = context_ptr(context); *ppStoreContext = context;
} }
return TRUE; return TRUE;
} }
...@@ -186,21 +186,21 @@ static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context) ...@@ -186,21 +186,21 @@ static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
return TRUE; return TRUE;
} }
static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl, static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, context_t *crl,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
context_t *context; context_t *context;
TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext); TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext);
context = ContextList_Add(ms->crls, context_from_ptr(crl), toReplace ? context_from_ptr(toReplace) : NULL, store, use_link); context = ContextList_Add(ms->crls, crl, toReplace, store, use_link);
if (!context) if (!context)
return FALSE; return FALSE;
if (ppStoreContext) { if (ppStoreContext) {
Context_AddRef(context); Context_AddRef(context);
*ppStoreContext = context_ptr(context); *ppStoreContext = context;
} }
return TRUE; return TRUE;
} }
...@@ -230,21 +230,21 @@ static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context) ...@@ -230,21 +230,21 @@ static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *context)
return TRUE; return TRUE;
} }
static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl, static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, context_t *ctl,
void *toReplace, const void **ppStoreContext, BOOL use_link) context_t *toReplace, context_t **ppStoreContext, BOOL use_link)
{ {
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store; WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
context_t *context; context_t *context;
TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext); TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext);
context = ContextList_Add(ms->ctls, context_from_ptr(ctl), toReplace ? context_from_ptr(toReplace) : NULL, store, use_link); context = ContextList_Add(ms->ctls, ctl, toReplace, store, use_link);
if (!context) if (!context)
return FALSE; return FALSE;
if (ppStoreContext) { if (ppStoreContext) {
Context_AddRef(context); Context_AddRef(context);
*ppStoreContext = context_ptr(context); *ppStoreContext = context;
} }
return TRUE; return TRUE;
} }
...@@ -1026,13 +1026,19 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, ...@@ -1026,13 +1026,19 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
if (toAdd) if (toAdd)
{ {
if (store) if (store) {
ret = store->vtbl->crls.addContext(store, (void*)toAdd, (void*)existing, (const void **)ppStoreContext, TRUE); context_t *ret_context;
else if (ppStoreContext) ret = store->vtbl->crls.addContext(store, context_from_ptr(toAdd),
existing ? context_from_ptr(existing) : NULL, ppStoreContext ? &ret_context : NULL, TRUE);
if (ret && ppStoreContext)
*ppStoreContext = context_ptr(ret_context);
}else if (ppStoreContext) {
*ppStoreContext = CertDuplicateCRLContext(toAdd); *ppStoreContext = CertDuplicateCRLContext(toAdd);
}
CertFreeCRLContext(toAdd); CertFreeCRLContext(toAdd);
} }
CertFreeCRLContext(existing); if (existing)
CertFreeCRLContext(existing);
TRACE("returning %d\n", ret); TRACE("returning %d\n", ret);
return ret; return ret;
...@@ -1358,14 +1364,14 @@ static DWORD EmptyStore_release(WINECRYPT_CERTSTORE *store, DWORD flags) ...@@ -1358,14 +1364,14 @@ static DWORD EmptyStore_release(WINECRYPT_CERTSTORE *store, DWORD flags)
return E_UNEXPECTED; return E_UNEXPECTED;
} }
static BOOL EmptyStore_add(WINECRYPT_CERTSTORE *store, void *context, static BOOL EmptyStore_add(WINECRYPT_CERTSTORE *store, context_t *context,
void *replace, const void **ret_context, BOOL use_link) context_t *replace, context_t **ret_context, BOOL use_link)
{ {
TRACE("(%p, %p, %p, %p)\n", store, context, replace, ret_context); TRACE("(%p, %p, %p, %p)\n", store, context, replace, ret_context);
/* FIXME: We should clone the context */ /* FIXME: We should clone the context */
if(ret_context) { if(ret_context) {
Context_AddRef(context_from_ptr(context)); Context_AddRef(context);
*ret_context = context; *ret_context = context;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment