crypt32: Use context_t in enumContext.
This commit is contained in:
parent
8d4b288f59
commit
c75af2b9e0
|
@ -71,7 +71,7 @@ static DWORD Collection_release(WINECRYPT_CERTSTORE *store, DWORD flags)
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *store,
|
static context_t *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *store,
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry, context_t *child, size_t contextSize)
|
WINE_STORE_LIST_ENTRY *storeEntry, context_t *child, size_t contextSize)
|
||||||
{
|
{
|
||||||
context_t *ret;
|
context_t *ret;
|
||||||
|
@ -81,7 +81,7 @@ static void *CRYPT_CollectionCreateContextFromChild(WINE_COLLECTIONSTORE *store,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret->u.ptr = storeEntry;
|
ret->u.ptr = storeEntry;
|
||||||
return context_ptr(ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
|
static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
|
||||||
|
@ -143,32 +143,29 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
|
||||||
* Returns NULL if the collection contains no more items or on error.
|
* Returns NULL if the collection contains no more items or on error.
|
||||||
* Assumes the collection store's lock is held.
|
* Assumes the collection store's lock is held.
|
||||||
*/
|
*/
|
||||||
static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
|
static context_t *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry, const CONTEXT_FUNCS *contextFuncs,
|
WINE_STORE_LIST_ENTRY *storeEntry, const CONTEXT_FUNCS *contextFuncs,
|
||||||
const WINE_CONTEXT_INTERFACE *contextInterface, void *pPrev, size_t contextSize)
|
const WINE_CONTEXT_INTERFACE *contextInterface, context_t *prev, size_t contextSize)
|
||||||
{
|
{
|
||||||
context_t *child;
|
context_t *child, *ret;
|
||||||
void *ret, *tmp;
|
|
||||||
struct list *storeNext = list_next(&store->stores, &storeEntry->entry);
|
struct list *storeNext = list_next(&store->stores, &storeEntry->entry);
|
||||||
|
|
||||||
TRACE("(%p, %p, %p)\n", store, storeEntry, pPrev);
|
TRACE("(%p, %p, %p)\n", store, storeEntry, prev);
|
||||||
|
|
||||||
if (pPrev)
|
if (prev)
|
||||||
{
|
{
|
||||||
/* Ref-counting funny business: "duplicate" (addref) the child, because
|
/* Ref-counting funny business: "duplicate" (addref) the child, because
|
||||||
* the free(pPrev) below can cause the ref count to become negative.
|
* the free(pPrev) below can cause the ref count to become negative.
|
||||||
*/
|
*/
|
||||||
child = context_from_ptr(pPrev)->linked;
|
child = prev->linked;
|
||||||
Context_AddRef(child);
|
Context_AddRef(child);
|
||||||
tmp = contextFuncs->enumContext(storeEntry->store, context_ptr(child));
|
child = contextFuncs->enumContext(storeEntry->store, child);
|
||||||
child = tmp ? context_from_ptr(tmp) : NULL;
|
Context_Release(prev);
|
||||||
Context_Release(context_from_ptr(pPrev));
|
prev = NULL;
|
||||||
pPrev = NULL;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp = contextFuncs->enumContext(storeEntry->store, NULL);
|
child = contextFuncs->enumContext(storeEntry->store, NULL);
|
||||||
child = tmp ? context_from_ptr(tmp) : NULL;
|
|
||||||
}
|
}
|
||||||
if (child) {
|
if (child) {
|
||||||
ret = CRYPT_CollectionCreateContextFromChild(store, storeEntry, child, contextSize);
|
ret = CRYPT_CollectionCreateContextFromChild(store, storeEntry, child, contextSize);
|
||||||
|
@ -212,29 +209,29 @@ static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, void *cert,
|
||||||
if (ppStoreContext && childContext)
|
if (ppStoreContext && childContext)
|
||||||
{
|
{
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr;
|
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr;
|
||||||
PCERT_CONTEXT context =
|
cert_t *context = (cert_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry,
|
||||||
CRYPT_CollectionCreateContextFromChild(cs, storeEntry, context_from_ptr(childContext), sizeof(CERT_CONTEXT));
|
context_from_ptr(childContext), sizeof(CERT_CONTEXT));
|
||||||
|
|
||||||
*ppStoreContext = context;
|
*ppStoreContext = &context->ctx;
|
||||||
}
|
}
|
||||||
CertFreeCertificateContext(childContext);
|
CertFreeCertificateContext(childContext);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *Collection_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *Collection_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
|
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
|
||||||
void *ret;
|
context_t *ret;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", store, pPrev);
|
TRACE("(%p, %p)\n", store, prev);
|
||||||
|
|
||||||
EnterCriticalSection(&cs->cs);
|
EnterCriticalSection(&cs->cs);
|
||||||
if (pPrev)
|
if (prev)
|
||||||
{
|
{
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(pPrev)->u.ptr;
|
WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr;
|
||||||
|
|
||||||
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
|
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
|
||||||
&storeEntry->store->vtbl->certs, pCertInterface, pPrev,
|
&storeEntry->store->vtbl->certs, pCertInterface, prev,
|
||||||
sizeof(CERT_CONTEXT));
|
sizeof(CERT_CONTEXT));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -285,29 +282,29 @@ static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
|
||||||
if (ppStoreContext && childContext)
|
if (ppStoreContext && childContext)
|
||||||
{
|
{
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr;
|
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr;
|
||||||
PCRL_CONTEXT context =
|
crl_t *context = (crl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry,
|
||||||
CRYPT_CollectionCreateContextFromChild(cs, storeEntry, context_from_ptr(childContext), sizeof(CRL_CONTEXT));
|
context_from_ptr(childContext), sizeof(CRL_CONTEXT));
|
||||||
|
|
||||||
*ppStoreContext = context;
|
*ppStoreContext = &context->ctx;
|
||||||
}
|
}
|
||||||
CertFreeCRLContext(childContext);
|
CertFreeCRLContext(childContext);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *Collection_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *Collection_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
|
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
|
||||||
void *ret;
|
context_t *ret;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", store, pPrev);
|
TRACE("(%p, %p)\n", store, prev);
|
||||||
|
|
||||||
EnterCriticalSection(&cs->cs);
|
EnterCriticalSection(&cs->cs);
|
||||||
if (pPrev)
|
if (prev)
|
||||||
{
|
{
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(pPrev)->u.ptr;
|
WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr;
|
||||||
|
|
||||||
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
|
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
|
||||||
&storeEntry->store->vtbl->crls, pCRLInterface, pPrev, sizeof(CRL_CONTEXT));
|
&storeEntry->store->vtbl->crls, pCRLInterface, prev, sizeof(CRL_CONTEXT));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -356,29 +353,29 @@ static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
|
||||||
if (ppStoreContext && childContext)
|
if (ppStoreContext && childContext)
|
||||||
{
|
{
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr;
|
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(childContext)->u.ptr;
|
||||||
PCTL_CONTEXT context =
|
ctl_t *context = (ctl_t*)CRYPT_CollectionCreateContextFromChild(cs, storeEntry,
|
||||||
CRYPT_CollectionCreateContextFromChild(cs, storeEntry, context_from_ptr(childContext), sizeof(CTL_CONTEXT));
|
context_from_ptr(childContext), sizeof(CTL_CONTEXT));
|
||||||
|
|
||||||
*ppStoreContext = context;
|
*ppStoreContext = &context->ctx;
|
||||||
}
|
}
|
||||||
CertFreeCTLContext(childContext);
|
CertFreeCTLContext(childContext);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *Collection_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *Collection_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
|
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", store, pPrev);
|
TRACE("(%p, %p)\n", store, prev);
|
||||||
|
|
||||||
EnterCriticalSection(&cs->cs);
|
EnterCriticalSection(&cs->cs);
|
||||||
if (pPrev)
|
if (prev)
|
||||||
{
|
{
|
||||||
WINE_STORE_LIST_ENTRY *storeEntry = context_from_ptr(pPrev)->u.ptr;
|
WINE_STORE_LIST_ENTRY *storeEntry = prev->u.ptr;
|
||||||
|
|
||||||
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
|
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
|
||||||
&storeEntry->store->vtbl->ctls, pCTLInterface, pPrev, sizeof(CTL_CONTEXT));
|
&storeEntry->store->vtbl->ctls, pCTLInterface, prev, sizeof(CTL_CONTEXT));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,16 +164,16 @@ context_t *ContextList_Add(struct ContextList *list, context_t *toLink, context_
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *ContextList_Enum(struct ContextList *list, void *pPrev)
|
context_t *ContextList_Enum(struct ContextList *list, context_t *prev)
|
||||||
{
|
{
|
||||||
struct list *listNext;
|
struct list *listNext;
|
||||||
void *ret;
|
context_t *ret;
|
||||||
|
|
||||||
EnterCriticalSection(&list->cs);
|
EnterCriticalSection(&list->cs);
|
||||||
if (pPrev)
|
if (prev)
|
||||||
{
|
{
|
||||||
listNext = list_next(&list->contexts, &context_from_ptr(pPrev)->u.entry);
|
listNext = list_next(&list->contexts, &prev->u.entry);
|
||||||
Context_Release(context_from_ptr(pPrev));
|
Context_Release(prev);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
listNext = list_next(&list->contexts, &list->contexts);
|
listNext = list_next(&list->contexts, &list->contexts);
|
||||||
|
@ -181,8 +181,8 @@ void *ContextList_Enum(struct ContextList *list, void *pPrev)
|
||||||
|
|
||||||
if (listNext)
|
if (listNext)
|
||||||
{
|
{
|
||||||
ret = CONTEXT_FROM_BASE_CONTEXT(LIST_ENTRY(listNext, context_t, u.entry));
|
ret = LIST_ENTRY(listNext, context_t, u.entry);
|
||||||
Context_AddRef(context_from_ptr(ret));
|
Context_AddRef(ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
|
|
@ -264,9 +264,6 @@ extern const WINE_CONTEXT_INTERFACE *pCTLInterface DECLSPEC_HIDDEN;
|
||||||
typedef struct WINE_CRYPTCERTSTORE * (*StoreOpenFunc)(HCRYPTPROV hCryptProv,
|
typedef struct WINE_CRYPTCERTSTORE * (*StoreOpenFunc)(HCRYPTPROV hCryptProv,
|
||||||
DWORD dwFlags, const void *pvPara);
|
DWORD dwFlags, const void *pvPara);
|
||||||
|
|
||||||
/* Called to enumerate the next context in a store. */
|
|
||||||
typedef void * (*EnumFunc)(struct WINE_CRYPTCERTSTORE *store, void *pPrev);
|
|
||||||
|
|
||||||
typedef struct _CONTEXT_FUNCS
|
typedef struct _CONTEXT_FUNCS
|
||||||
{
|
{
|
||||||
/* Called to add a context to a store. If toReplace is not NULL,
|
/* Called to add a context to a store. If toReplace is not NULL,
|
||||||
|
@ -276,7 +273,7 @@ typedef struct _CONTEXT_FUNCS
|
||||||
* 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*,void*,void*,const void**,BOOL);
|
||||||
EnumFunc enumContext;
|
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;
|
||||||
|
|
||||||
|
@ -447,7 +444,7 @@ struct ContextList *ContextList_Create(
|
||||||
context_t *ContextList_Add(struct ContextList *list, context_t *toLink, context_t *toReplace,
|
context_t *ContextList_Add(struct ContextList *list, context_t *toLink, context_t *toReplace,
|
||||||
struct WINE_CRYPTCERTSTORE *store, BOOL use_link) DECLSPEC_HIDDEN;
|
struct WINE_CRYPTCERTSTORE *store, BOOL use_link) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
void *ContextList_Enum(struct ContextList *list, void *pPrev) DECLSPEC_HIDDEN;
|
context_t *ContextList_Enum(struct ContextList *list, context_t *prev) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* Removes a context from the list. Returns TRUE if the context was removed,
|
/* Removes a context from the list. Returns TRUE if the context was removed,
|
||||||
* or FALSE if not. (The context may have been duplicated, so subsequent
|
* or FALSE if not. (The context may have been duplicated, so subsequent
|
||||||
|
|
|
@ -193,11 +193,10 @@ BOOL WINAPI CertAddEncodedCTLToStore(HCERTSTORE hCertStore,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore,
|
PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore, PCCTL_CONTEXT pPrev)
|
||||||
PCCTL_CONTEXT pPrev)
|
|
||||||
{
|
{
|
||||||
|
ctl_t *prev = pPrev ? ctl_from_ptr(pPrev) : NULL, *ret;
|
||||||
WINECRYPT_CERTSTORE *hcs = hCertStore;
|
WINECRYPT_CERTSTORE *hcs = hCertStore;
|
||||||
PCCTL_CONTEXT ret;
|
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", hCertStore, pPrev);
|
TRACE("(%p, %p)\n", hCertStore, pPrev);
|
||||||
if (!hCertStore)
|
if (!hCertStore)
|
||||||
|
@ -205,8 +204,8 @@ PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore,
|
||||||
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
|
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
else
|
else
|
||||||
ret = (PCCTL_CONTEXT)hcs->vtbl->ctls.enumContext(hcs, (void *)pPrev);
|
ret = (ctl_t*)hcs->vtbl->ctls.enumContext(hcs, prev ? &prev->base : NULL);
|
||||||
return ret;
|
return ret ? &ret->ctx : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef BOOL (*CtlCompareFunc)(PCCTL_CONTEXT pCtlContext, DWORD dwType,
|
typedef BOOL (*CtlCompareFunc)(PCCTL_CONTEXT pCtlContext, DWORD dwType,
|
||||||
|
|
|
@ -97,20 +97,20 @@ static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, void *cert,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *ProvStore_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *ProvStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
|
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
|
||||||
void *ret;
|
cert_t *ret;
|
||||||
|
|
||||||
ret = ps->memStore->vtbl->certs.enumContext(ps->memStore, pPrev);
|
ret = (cert_t*)ps->memStore->vtbl->certs.enumContext(ps->memStore, prev);
|
||||||
if (ret)
|
if (!ret)
|
||||||
{
|
return NULL;
|
||||||
/* same dirty trick: replace the returned context's hCertStore with
|
|
||||||
* store.
|
/* same dirty trick: replace the returned context's hCertStore with
|
||||||
*/
|
* store.
|
||||||
((PCERT_CONTEXT)ret)->hCertStore = store;
|
*/
|
||||||
}
|
ret->ctx.hCertStore = store;
|
||||||
return ret;
|
return &ret->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
|
static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, context_t *context)
|
||||||
|
@ -164,20 +164,20 @@ static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *ProvStore_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *ProvStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
|
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
|
||||||
void *ret;
|
crl_t *ret;
|
||||||
|
|
||||||
ret = ps->memStore->vtbl->crls.enumContext(ps->memStore, pPrev);
|
ret = (crl_t*)ps->memStore->vtbl->crls.enumContext(ps->memStore, prev);
|
||||||
if (ret)
|
if (!ret)
|
||||||
{
|
return NULL;
|
||||||
/* same dirty trick: replace the returned context's hCertStore with
|
|
||||||
* store.
|
/* same dirty trick: replace the returned context's hCertStore with
|
||||||
*/
|
* store.
|
||||||
((PCRL_CONTEXT)ret)->hCertStore = store;
|
*/
|
||||||
}
|
ret->ctx.hCertStore = store;
|
||||||
return ret;
|
return &ret->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *crl)
|
static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, context_t *crl)
|
||||||
|
@ -231,20 +231,20 @@ static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *ProvStore_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *ProvStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
|
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
|
||||||
void *ret;
|
ctl_t *ret;
|
||||||
|
|
||||||
ret = ps->memStore->vtbl->ctls.enumContext(ps->memStore, pPrev);
|
ret = (ctl_t*)ps->memStore->vtbl->ctls.enumContext(ps->memStore, prev);
|
||||||
if (ret)
|
if (!ret)
|
||||||
{
|
return NULL;
|
||||||
/* same dirty trick: replace the returned context's hCertStore with
|
|
||||||
* store.
|
/* same dirty trick: replace the returned context's hCertStore with
|
||||||
*/
|
* store.
|
||||||
((PCTL_CONTEXT)ret)->hCertStore = store;
|
*/
|
||||||
}
|
ret->ctx.hCertStore = store;
|
||||||
return ret;
|
return &ret->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ProvStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *ctl)
|
static BOOL ProvStore_deleteCTL(WINECRYPT_CERTSTORE *store, context_t *ctl)
|
||||||
|
|
|
@ -161,14 +161,14 @@ static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, void *cert,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *MemStore_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *MemStore_enumCert(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
|
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
|
||||||
void *ret;
|
context_t *ret;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", store, pPrev);
|
TRACE("(%p, %p)\n", store, prev);
|
||||||
|
|
||||||
ret = ContextList_Enum(ms->certs, pPrev);
|
ret = ContextList_Enum(ms->certs, prev);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
SetLastError(CRYPT_E_NOT_FOUND);
|
SetLastError(CRYPT_E_NOT_FOUND);
|
||||||
|
|
||||||
|
@ -205,14 +205,14 @@ static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
|
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
|
||||||
void *ret;
|
context_t *ret;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", store, pPrev);
|
TRACE("(%p, %p)\n", store, prev);
|
||||||
|
|
||||||
ret = ContextList_Enum(ms->crls, pPrev);
|
ret = ContextList_Enum(ms->crls, prev);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
SetLastError(CRYPT_E_NOT_FOUND);
|
SetLastError(CRYPT_E_NOT_FOUND);
|
||||||
|
|
||||||
|
@ -249,14 +249,14 @@ static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
|
static context_t *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
|
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
|
||||||
void *ret;
|
context_t *ret;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", store, pPrev);
|
TRACE("(%p, %p)\n", store, prev);
|
||||||
|
|
||||||
ret = ContextList_Enum(ms->ctls, pPrev);
|
ret = ContextList_Enum(ms->ctls, prev);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
SetLastError(CRYPT_E_NOT_FOUND);
|
SetLastError(CRYPT_E_NOT_FOUND);
|
||||||
|
|
||||||
|
@ -887,11 +887,10 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv,
|
||||||
CERT_SYSTEM_STORE_CURRENT_USER, szSubSystemProtocol);
|
CERT_SYSTEM_STORE_CURRENT_USER, szSubSystemProtocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore,
|
PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev)
|
||||||
PCCERT_CONTEXT pPrev)
|
|
||||||
{
|
{
|
||||||
|
cert_t *prev = pPrev ? cert_from_ptr(pPrev) : NULL, *ret;
|
||||||
WINECRYPT_CERTSTORE *hcs = hCertStore;
|
WINECRYPT_CERTSTORE *hcs = hCertStore;
|
||||||
PCCERT_CONTEXT ret;
|
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", hCertStore, pPrev);
|
TRACE("(%p, %p)\n", hCertStore, pPrev);
|
||||||
if (!hCertStore)
|
if (!hCertStore)
|
||||||
|
@ -899,8 +898,8 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore,
|
||||||
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
|
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
else
|
else
|
||||||
ret = (PCCERT_CONTEXT)hcs->vtbl->certs.enumContext(hcs, (void *)pPrev);
|
ret = (cert_t*)hcs->vtbl->certs.enumContext(hcs, prev ? &prev->base : NULL);
|
||||||
return ret;
|
return ret ? &ret->ctx : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
|
BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
|
||||||
|
@ -1063,11 +1062,10 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore,
|
PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore, PCCRL_CONTEXT pPrev)
|
||||||
PCCRL_CONTEXT pPrev)
|
|
||||||
{
|
{
|
||||||
|
crl_t *ret, *prev = pPrev ? crl_from_ptr(pPrev) : NULL;
|
||||||
WINECRYPT_CERTSTORE *hcs = hCertStore;
|
WINECRYPT_CERTSTORE *hcs = hCertStore;
|
||||||
PCCRL_CONTEXT ret;
|
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", hCertStore, pPrev);
|
TRACE("(%p, %p)\n", hCertStore, pPrev);
|
||||||
if (!hCertStore)
|
if (!hCertStore)
|
||||||
|
@ -1075,8 +1073,8 @@ PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore,
|
||||||
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
|
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
else
|
else
|
||||||
ret = (PCCRL_CONTEXT)hcs->vtbl->crls.enumContext(hcs, (void *)pPrev);
|
ret = (crl_t*)hcs->vtbl->crls.enumContext(hcs, prev ? &prev->base : NULL);
|
||||||
return ret;
|
return ret ? &ret->ctx : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore)
|
HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore)
|
||||||
|
@ -1374,12 +1372,12 @@ static BOOL EmptyStore_add(WINECRYPT_CERTSTORE *store, void *context,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *EmptyStore_enum(WINECRYPT_CERTSTORE *store, void *prev)
|
static context_t *EmptyStore_enum(WINECRYPT_CERTSTORE *store, context_t *prev)
|
||||||
{
|
{
|
||||||
TRACE("(%p, %p)\n", store, prev);
|
TRACE("(%p, %p)\n", store, prev);
|
||||||
|
|
||||||
SetLastError(CRYPT_E_NOT_FOUND);
|
SetLastError(CRYPT_E_NOT_FOUND);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL EmptyStore_delete(WINECRYPT_CERTSTORE *store, context_t *context)
|
static BOOL EmptyStore_delete(WINECRYPT_CERTSTORE *store, context_t *context)
|
||||||
|
|
Loading…
Reference in New Issue