Commit 52b2add3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

crypt32: Moved store context functions to vtbl.

parent be023607
......@@ -105,7 +105,7 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
storeEntry = *(WINE_STORE_LIST_ENTRY **)Context_GetExtra(toReplace,
contextSize);
contextFuncs = (CONTEXT_FUNCS*)((LPBYTE)storeEntry->store +
contextFuncs = (CONTEXT_FUNCS*)((LPBYTE)storeEntry->store->vtbl +
contextFuncsOffset);
ret = contextFuncs->addContext(storeEntry->store, context,
existingLinked, (const void **)&childContext);
......@@ -121,7 +121,7 @@ static BOOL CRYPT_CollectionAddContext(WINE_COLLECTIONSTORE *store,
if (entry->dwUpdateFlags & CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG)
{
CONTEXT_FUNCS *contextFuncs = (CONTEXT_FUNCS*)(
(LPBYTE)entry->store + contextFuncsOffset);
(LPBYTE)entry->store->vtbl + contextFuncsOffset);
storeEntry = entry;
ret = contextFuncs->addContext(entry->store, context, NULL,
......@@ -178,11 +178,11 @@ static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
/* We always want the same function pointers (from certs, crls)
* in the next store, so use the same offset into the next store.
*/
size_t offset = (const BYTE *)contextFuncs - (LPBYTE)storeEntry->store;
size_t offset = (const BYTE *)contextFuncs - (LPBYTE)storeEntry->store->vtbl;
WINE_STORE_LIST_ENTRY *storeNextEntry =
LIST_ENTRY(storeNext, WINE_STORE_LIST_ENTRY, entry);
CONTEXT_FUNCS *storeNextContexts =
(CONTEXT_FUNCS*)((LPBYTE)storeNextEntry->store + offset);
(CONTEXT_FUNCS*)((LPBYTE)storeNextEntry->store->vtbl + offset);
ret = CRYPT_CollectionAdvanceEnum(store, storeNextEntry,
storeNextContexts, contextInterface, NULL, contextSize);
......@@ -197,14 +197,14 @@ static void *CRYPT_CollectionAdvanceEnum(WINE_COLLECTIONSTORE *store,
return ret;
}
static BOOL CRYPT_CollectionAddCert(WINECRYPT_CERTSTORE *store, void *cert,
static BOOL Collection_addCert(WINECRYPT_CERTSTORE *store, void *cert,
void *toReplace, const void **ppStoreContext)
{
BOOL ret;
void *childContext = NULL;
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
ret = CRYPT_CollectionAddContext(cs, offsetof(WINECRYPT_CERTSTORE, certs),
ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, certs),
cert, toReplace, sizeof(CERT_CONTEXT), &childContext);
if (ppStoreContext && childContext)
{
......@@ -222,7 +222,7 @@ static BOOL CRYPT_CollectionAddCert(WINECRYPT_CERTSTORE *store, void *cert,
return ret;
}
static void *CRYPT_CollectionEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *Collection_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
void *ret;
......@@ -237,7 +237,7 @@ static void *CRYPT_CollectionEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
sizeof(CERT_CONTEXT));
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
&storeEntry->store->certs, pCertInterface, pPrev,
&storeEntry->store->vtbl->certs, pCertInterface, pPrev,
sizeof(CERT_CONTEXT));
}
else
......@@ -248,7 +248,7 @@ static void *CRYPT_CollectionEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
WINE_STORE_LIST_ENTRY, entry);
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
&storeEntry->store->certs, pCertInterface, NULL,
&storeEntry->store->vtbl->certs, pCertInterface, NULL,
sizeof(CERT_CONTEXT));
}
else
......@@ -264,8 +264,7 @@ static void *CRYPT_CollectionEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_CollectionDeleteCert(WINECRYPT_CERTSTORE *store,
void *pCertContext)
static BOOL Collection_deleteCert(WINECRYPT_CERTSTORE *store, void *pCertContext)
{
BOOL ret;
PCCERT_CONTEXT linked;
......@@ -284,14 +283,14 @@ static BOOL CRYPT_CollectionDeleteCert(WINECRYPT_CERTSTORE *store,
return ret;
}
static BOOL CRYPT_CollectionAddCRL(WINECRYPT_CERTSTORE *store, void *crl,
static BOOL Collection_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
void *toReplace, const void **ppStoreContext)
{
BOOL ret;
void *childContext = NULL;
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
ret = CRYPT_CollectionAddContext(cs, offsetof(WINECRYPT_CERTSTORE, crls),
ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, crls),
crl, toReplace, sizeof(CRL_CONTEXT), &childContext);
if (ppStoreContext && childContext)
{
......@@ -309,7 +308,7 @@ static BOOL CRYPT_CollectionAddCRL(WINECRYPT_CERTSTORE *store, void *crl,
return ret;
}
static void *CRYPT_CollectionEnumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *Collection_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
void *ret;
......@@ -324,7 +323,7 @@ static void *CRYPT_CollectionEnumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
sizeof(CRL_CONTEXT));
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
&storeEntry->store->crls, pCRLInterface, pPrev, sizeof(CRL_CONTEXT));
&storeEntry->store->vtbl->crls, pCRLInterface, pPrev, sizeof(CRL_CONTEXT));
}
else
{
......@@ -334,7 +333,7 @@ static void *CRYPT_CollectionEnumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
WINE_STORE_LIST_ENTRY, entry);
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
&storeEntry->store->crls, pCRLInterface, NULL,
&storeEntry->store->vtbl->crls, pCRLInterface, NULL,
sizeof(CRL_CONTEXT));
}
else
......@@ -350,7 +349,7 @@ static void *CRYPT_CollectionEnumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_CollectionDeleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlContext)
static BOOL Collection_deleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlContext)
{
BOOL ret;
PCCRL_CONTEXT linked;
......@@ -368,14 +367,14 @@ static BOOL CRYPT_CollectionDeleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlCont
return ret;
}
static BOOL CRYPT_CollectionAddCTL(WINECRYPT_CERTSTORE *store, void *ctl,
static BOOL Collection_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
void *toReplace, const void **ppStoreContext)
{
BOOL ret;
void *childContext = NULL;
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
ret = CRYPT_CollectionAddContext(cs, offsetof(WINECRYPT_CERTSTORE, ctls),
ret = CRYPT_CollectionAddContext(cs, offsetof(store_vtbl_t, ctls),
ctl, toReplace, sizeof(CTL_CONTEXT), &childContext);
if (ppStoreContext && childContext)
{
......@@ -393,7 +392,7 @@ static BOOL CRYPT_CollectionAddCTL(WINECRYPT_CERTSTORE *store, void *ctl,
return ret;
}
static void *CRYPT_CollectionEnumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *Collection_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store;
void *ret;
......@@ -407,7 +406,7 @@ static void *CRYPT_CollectionEnumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
*(WINE_STORE_LIST_ENTRY **)Context_GetExtra(pPrev, sizeof(CTL_CONTEXT));
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
&storeEntry->store->ctls, pCTLInterface, pPrev, sizeof(CTL_CONTEXT));
&storeEntry->store->vtbl->ctls, pCTLInterface, pPrev, sizeof(CTL_CONTEXT));
}
else
{
......@@ -417,7 +416,7 @@ static void *CRYPT_CollectionEnumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
WINE_STORE_LIST_ENTRY, entry);
ret = CRYPT_CollectionAdvanceEnum(cs, storeEntry,
&storeEntry->store->ctls, pCTLInterface, NULL,
&storeEntry->store->vtbl->ctls, pCTLInterface, NULL,
sizeof(CTL_CONTEXT));
}
else
......@@ -433,7 +432,7 @@ static void *CRYPT_CollectionEnumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_CollectionDeleteCTL(WINECRYPT_CERTSTORE *store,
static BOOL Collection_deleteCTL(WINECRYPT_CERTSTORE *store,
void *pCtlContext)
{
BOOL ret;
......@@ -492,7 +491,20 @@ static BOOL Collection_control(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags,
static const store_vtbl_t CollectionStoreVtbl = {
Collection_addref,
Collection_release,
Collection_control
Collection_control,
{
Collection_addCert,
Collection_enumCert,
Collection_deleteCert
}, {
Collection_addCRL,
Collection_enumCRL,
Collection_deleteCRL
}, {
Collection_addCTL,
Collection_enumCTL,
Collection_deleteCTL
}
};
WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv,
......@@ -512,15 +524,6 @@ WINECRYPT_CERTSTORE *CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv,
{
memset(store, 0, sizeof(WINE_COLLECTIONSTORE));
CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeCollection, &CollectionStoreVtbl);
store->hdr.certs.addContext = CRYPT_CollectionAddCert;
store->hdr.certs.enumContext = CRYPT_CollectionEnumCert;
store->hdr.certs.deleteContext = CRYPT_CollectionDeleteCert;
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);
......
......@@ -249,6 +249,9 @@ typedef struct {
void (*addref)(struct WINE_CRYPTCERTSTORE*);
DWORD (*release)(struct WINE_CRYPTCERTSTORE*,DWORD);
BOOL (*control)(struct WINE_CRYPTCERTSTORE*,DWORD,DWORD,void const*);
CONTEXT_FUNCS certs;
CONTEXT_FUNCS crls;
CONTEXT_FUNCS ctls;
} store_vtbl_t;
typedef struct WINE_CRYPTCERTSTORE
......@@ -258,10 +261,6 @@ typedef struct WINE_CRYPTCERTSTORE
DWORD dwOpenFlags;
CertStoreType type;
const store_vtbl_t *vtbl;
/* FIXME: Move to vtbl (requires collections clean up) */
CONTEXT_FUNCS certs;
CONTEXT_FUNCS crls;
CONTEXT_FUNCS ctls;
CONTEXT_PROPERTY_LIST *properties;
} WINECRYPT_CERTSTORE;
......
......@@ -126,7 +126,7 @@ BOOL WINAPI CertAddCTLContextToStore(HCERTSTORE hCertStore,
if (toAdd)
{
if (store)
ret = store->ctls.addContext(store, (void *)toAdd,
ret = store->vtbl->ctls.addContext(store, (void *)toAdd,
(void *)existing, (const void **)ppStoreContext);
else if (ppStoreContext)
*ppStoreContext = CertDuplicateCTLContext(toAdd);
......@@ -173,7 +173,7 @@ PCCTL_CONTEXT WINAPI CertEnumCTLsInStore(HCERTSTORE hCertStore,
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = NULL;
else
ret = (PCCTL_CONTEXT)hcs->ctls.enumContext(hcs, (void *)pPrev);
ret = (PCCTL_CONTEXT)hcs->vtbl->ctls.enumContext(hcs, (void *)pPrev);
return ret;
}
......@@ -320,7 +320,7 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = FALSE;
else
ret = hcs->ctls.deleteContext(hcs, (void *)pCtlContext);
ret = hcs->vtbl->ctls.deleteContext(hcs, (void *)pCtlContext);
if (ret)
ret = CertFreeCTLContext(pCtlContext);
}
......
......@@ -69,7 +69,7 @@ static DWORD ProvStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags)
return ERROR_SUCCESS;
}
static BOOL CRYPT_ProvAddCert(WINECRYPT_CERTSTORE *store, void *cert,
static BOOL ProvStore_addCert(WINECRYPT_CERTSTORE *store, void *cert,
void *toReplace, const void **ppStoreContext)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
......@@ -78,7 +78,7 @@ static BOOL CRYPT_ProvAddCert(WINECRYPT_CERTSTORE *store, void *cert,
TRACE("(%p, %p, %p, %p)\n", store, cert, toReplace, ppStoreContext);
if (toReplace)
ret = ps->memStore->certs.addContext(ps->memStore, cert, toReplace,
ret = ps->memStore->vtbl->certs.addContext(ps->memStore, cert, toReplace,
ppStoreContext);
else
{
......@@ -87,7 +87,7 @@ static BOOL CRYPT_ProvAddCert(WINECRYPT_CERTSTORE *store, void *cert,
ret = ps->provWriteCert(ps->hStoreProv, cert,
CERT_STORE_PROV_WRITE_ADD_FLAG);
if (ret)
ret = ps->memStore->certs.addContext(ps->memStore, cert, NULL,
ret = ps->memStore->vtbl->certs.addContext(ps->memStore, cert, NULL,
ppStoreContext);
}
/* dirty trick: replace the returned context's hCertStore with
......@@ -98,12 +98,12 @@ static BOOL CRYPT_ProvAddCert(WINECRYPT_CERTSTORE *store, void *cert,
return ret;
}
static void *CRYPT_ProvEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *ProvStore_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
void *ret;
ret = ps->memStore->certs.enumContext(ps->memStore, pPrev);
ret = ps->memStore->vtbl->certs.enumContext(ps->memStore, pPrev);
if (ret)
{
/* same dirty trick: replace the returned context's hCertStore with
......@@ -114,7 +114,7 @@ static void *CRYPT_ProvEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_ProvDeleteCert(WINECRYPT_CERTSTORE *store, void *cert)
static BOOL ProvStore_deleteCert(WINECRYPT_CERTSTORE *store, void *cert)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret = TRUE;
......@@ -124,11 +124,11 @@ static BOOL CRYPT_ProvDeleteCert(WINECRYPT_CERTSTORE *store, void *cert)
if (ps->provDeleteCert)
ret = ps->provDeleteCert(ps->hStoreProv, cert, 0);
if (ret)
ret = ps->memStore->certs.deleteContext(ps->memStore, cert);
ret = ps->memStore->vtbl->certs.deleteContext(ps->memStore, cert);
return ret;
}
static BOOL CRYPT_ProvAddCRL(WINECRYPT_CERTSTORE *store, void *crl,
static BOOL ProvStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
void *toReplace, const void **ppStoreContext)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
......@@ -137,7 +137,7 @@ static BOOL CRYPT_ProvAddCRL(WINECRYPT_CERTSTORE *store, void *crl,
TRACE("(%p, %p, %p, %p)\n", store, crl, toReplace, ppStoreContext);
if (toReplace)
ret = ps->memStore->crls.addContext(ps->memStore, crl, toReplace,
ret = ps->memStore->vtbl->crls.addContext(ps->memStore, crl, toReplace,
ppStoreContext);
else
{
......@@ -153,7 +153,7 @@ static BOOL CRYPT_ProvAddCRL(WINECRYPT_CERTSTORE *store, void *crl,
ret = ps->provWriteCrl(ps->hStoreProv, crl,
CERT_STORE_PROV_WRITE_ADD_FLAG);
if (ret)
ret = ps->memStore->crls.addContext(ps->memStore, crl, NULL,
ret = ps->memStore->vtbl->crls.addContext(ps->memStore, crl, NULL,
ppStoreContext);
}
}
......@@ -165,12 +165,12 @@ static BOOL CRYPT_ProvAddCRL(WINECRYPT_CERTSTORE *store, void *crl,
return ret;
}
static void *CRYPT_ProvEnumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *ProvStore_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
void *ret;
ret = ps->memStore->crls.enumContext(ps->memStore, pPrev);
ret = ps->memStore->vtbl->crls.enumContext(ps->memStore, pPrev);
if (ret)
{
/* same dirty trick: replace the returned context's hCertStore with
......@@ -181,7 +181,7 @@ static void *CRYPT_ProvEnumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_ProvDeleteCRL(WINECRYPT_CERTSTORE *store, void *crl)
static BOOL ProvStore_deleteCRL(WINECRYPT_CERTSTORE *store, void *crl)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret = TRUE;
......@@ -191,11 +191,11 @@ static BOOL CRYPT_ProvDeleteCRL(WINECRYPT_CERTSTORE *store, void *crl)
if (ps->provDeleteCrl)
ret = ps->provDeleteCrl(ps->hStoreProv, crl, 0);
if (ret)
ret = ps->memStore->crls.deleteContext(ps->memStore, crl);
ret = ps->memStore->vtbl->crls.deleteContext(ps->memStore, crl);
return ret;
}
static BOOL CRYPT_ProvAddCTL(WINECRYPT_CERTSTORE *store, void *ctl,
static BOOL ProvStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
void *toReplace, const void **ppStoreContext)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
......@@ -204,7 +204,7 @@ static BOOL CRYPT_ProvAddCTL(WINECRYPT_CERTSTORE *store, void *ctl,
TRACE("(%p, %p, %p, %p)\n", store, ctl, toReplace, ppStoreContext);
if (toReplace)
ret = ps->memStore->ctls.addContext(ps->memStore, ctl, toReplace,
ret = ps->memStore->vtbl->ctls.addContext(ps->memStore, ctl, toReplace,
ppStoreContext);
else
{
......@@ -220,7 +220,7 @@ static BOOL CRYPT_ProvAddCTL(WINECRYPT_CERTSTORE *store, void *ctl,
ret = ps->provWriteCtl(ps->hStoreProv, ctl,
CERT_STORE_PROV_WRITE_ADD_FLAG);
if (ret)
ret = ps->memStore->ctls.addContext(ps->memStore, ctl, NULL,
ret = ps->memStore->vtbl->ctls.addContext(ps->memStore, ctl, NULL,
ppStoreContext);
}
}
......@@ -232,12 +232,12 @@ static BOOL CRYPT_ProvAddCTL(WINECRYPT_CERTSTORE *store, void *ctl,
return ret;
}
static void *CRYPT_ProvEnumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *ProvStore_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
void *ret;
ret = ps->memStore->ctls.enumContext(ps->memStore, pPrev);
ret = ps->memStore->vtbl->ctls.enumContext(ps->memStore, pPrev);
if (ret)
{
/* same dirty trick: replace the returned context's hCertStore with
......@@ -248,7 +248,7 @@ static void *CRYPT_ProvEnumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_ProvDeleteCTL(WINECRYPT_CERTSTORE *store, void *ctl)
static BOOL ProvStore_deleteCTL(WINECRYPT_CERTSTORE *store, void *ctl)
{
WINE_PROVIDERSTORE *ps = (WINE_PROVIDERSTORE*)store;
BOOL ret = TRUE;
......@@ -258,7 +258,7 @@ static BOOL CRYPT_ProvDeleteCTL(WINECRYPT_CERTSTORE *store, void *ctl)
if (ps->provDeleteCtl)
ret = ps->provDeleteCtl(ps->hStoreProv, ctl, 0);
if (ret)
ret = ps->memStore->ctls.deleteContext(ps->memStore, ctl);
ret = ps->memStore->vtbl->ctls.deleteContext(ps->memStore, ctl);
return ret;
}
......@@ -279,7 +279,20 @@ static BOOL ProvStore_control(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags, DW
static const store_vtbl_t ProvStoreVtbl = {
ProvStore_addref,
ProvStore_release,
ProvStore_control
ProvStore_control,
{
ProvStore_addCert,
ProvStore_enumCert,
ProvStore_deleteCert
}, {
ProvStore_addCRL,
ProvStore_enumCRL,
ProvStore_deleteCRL
}, {
ProvStore_addCTL,
ProvStore_enumCTL,
ProvStore_deleteCTL
}
};
WINECRYPT_CERTSTORE *CRYPT_ProvCreateStore(DWORD dwFlags,
......@@ -299,15 +312,6 @@ WINECRYPT_CERTSTORE *CRYPT_ProvCreateStore(DWORD dwFlags,
else
ret->memStore = memStore;
ret->hStoreProv = pProvInfo->hStoreProv;
ret->hdr.certs.addContext = CRYPT_ProvAddCert;
ret->hdr.certs.enumContext = CRYPT_ProvEnumCert;
ret->hdr.certs.deleteContext = CRYPT_ProvDeleteCert;
ret->hdr.crls.addContext = CRYPT_ProvAddCRL;
ret->hdr.crls.enumContext = CRYPT_ProvEnumCRL;
ret->hdr.crls.deleteContext = CRYPT_ProvDeleteCRL;
ret->hdr.ctls.addContext = CRYPT_ProvAddCTL;
ret->hdr.ctls.enumContext = CRYPT_ProvEnumCTL;
ret->hdr.ctls.deleteContext = CRYPT_ProvDeleteCTL;
if (pProvInfo->cStoreProvFunc > CERT_STORE_PROV_CLOSE_FUNC)
ret->provCloseStore =
pProvInfo->rgpvStoreProvFunc[CERT_STORE_PROV_CLOSE_FUNC];
......
......@@ -149,7 +149,7 @@ BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0,
return TRUE;
}
static BOOL CRYPT_MemAddCert(WINECRYPT_CERTSTORE *store, void *cert,
static BOOL MemStore_addCert(WINECRYPT_CERTSTORE *store, void *cert,
void *toReplace, const void **ppStoreContext)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
......@@ -168,7 +168,7 @@ static BOOL CRYPT_MemAddCert(WINECRYPT_CERTSTORE *store, void *cert,
return context != 0;
}
static void *CRYPT_MemEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *MemStore_enumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
void *ret;
......@@ -183,7 +183,7 @@ static void *CRYPT_MemEnumCert(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_MemDeleteCert(WINECRYPT_CERTSTORE *store, void *pCertContext)
static BOOL MemStore_deleteCert(WINECRYPT_CERTSTORE *store, void *pCertContext)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
BOOL ret;
......@@ -195,7 +195,7 @@ static BOOL CRYPT_MemDeleteCert(WINECRYPT_CERTSTORE *store, void *pCertContext)
return ret;
}
static BOOL CRYPT_MemAddCrl(WINECRYPT_CERTSTORE *store, void *crl,
static BOOL MemStore_addCRL(WINECRYPT_CERTSTORE *store, void *crl,
void *toReplace, const void **ppStoreContext)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
......@@ -213,7 +213,7 @@ static BOOL CRYPT_MemAddCrl(WINECRYPT_CERTSTORE *store, void *crl,
return context != 0;
}
static void *CRYPT_MemEnumCrl(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *MemStore_enumCRL(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
void *ret;
......@@ -228,7 +228,7 @@ static void *CRYPT_MemEnumCrl(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_MemDeleteCrl(WINECRYPT_CERTSTORE *store, void *pCrlContext)
static BOOL MemStore_deleteCRL(WINECRYPT_CERTSTORE *store, void *pCrlContext)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
BOOL ret;
......@@ -240,7 +240,7 @@ static BOOL CRYPT_MemDeleteCrl(WINECRYPT_CERTSTORE *store, void *pCrlContext)
return ret;
}
static BOOL CRYPT_MemAddCtl(WINECRYPT_CERTSTORE *store, void *ctl,
static BOOL MemStore_addCTL(WINECRYPT_CERTSTORE *store, void *ctl,
void *toReplace, const void **ppStoreContext)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
......@@ -258,7 +258,7 @@ static BOOL CRYPT_MemAddCtl(WINECRYPT_CERTSTORE *store, void *ctl,
return context != 0;
}
static void *CRYPT_MemEnumCtl(WINECRYPT_CERTSTORE *store, void *pPrev)
static void *MemStore_enumCTL(WINECRYPT_CERTSTORE *store, void *pPrev)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
void *ret;
......@@ -273,7 +273,7 @@ static void *CRYPT_MemEnumCtl(WINECRYPT_CERTSTORE *store, void *pPrev)
return ret;
}
static BOOL CRYPT_MemDeleteCtl(WINECRYPT_CERTSTORE *store, void *pCtlContext)
static BOOL MemStore_deleteCTL(WINECRYPT_CERTSTORE *store, void *pCtlContext)
{
WINE_MEMSTORE *ms = (WINE_MEMSTORE *)store;
BOOL ret;
......@@ -321,7 +321,20 @@ static BOOL MemStore_control(WINECRYPT_CERTSTORE *store, DWORD dwFlags,
static const store_vtbl_t MemStoreVtbl = {
MemStore_addref,
MemStore_release,
MemStore_control
MemStore_control,
{
MemStore_addCert,
MemStore_enumCert,
MemStore_deleteCert
}, {
MemStore_addCRL,
MemStore_enumCRL,
MemStore_deleteCRL
}, {
MemStore_addCTL,
MemStore_enumCTL,
MemStore_deleteCTL
}
};
static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv,
......@@ -343,15 +356,6 @@ static WINECRYPT_CERTSTORE *CRYPT_MemOpenStore(HCRYPTPROV hCryptProv,
{
memset(store, 0, sizeof(WINE_MEMSTORE));
CRYPT_InitStore(&store->hdr, dwFlags, StoreTypeMem, &MemStoreVtbl);
store->hdr.certs.addContext = CRYPT_MemAddCert;
store->hdr.certs.enumContext = CRYPT_MemEnumCert;
store->hdr.certs.deleteContext = CRYPT_MemDeleteCert;
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->certs = ContextList_Create(pCertInterface,
sizeof(CERT_CONTEXT));
store->crls = ContextList_Create(pCRLInterface,
......@@ -1010,7 +1014,7 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
if (toAdd)
{
if (store)
ret = store->certs.addContext(store, (void *)toAdd,
ret = store->vtbl->certs.addContext(store, (void *)toAdd,
(void *)existing, (const void **)ppStoreContext);
else if (ppStoreContext)
*ppStoreContext = CertDuplicateCertificateContext(toAdd);
......@@ -1034,7 +1038,7 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore,
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = NULL;
else
ret = (PCCERT_CONTEXT)hcs->certs.enumContext(hcs, (void *)pPrev);
ret = (PCCERT_CONTEXT)hcs->vtbl->certs.enumContext(hcs, (void *)pPrev);
return ret;
}
......@@ -1055,7 +1059,7 @@ BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = FALSE;
else
ret = hcs->certs.deleteContext(hcs, (void *)pCertContext);
ret = hcs->vtbl->certs.deleteContext(hcs, (void *)pCertContext);
if (ret)
ret = CertFreeCertificateContext(pCertContext);
}
......@@ -1168,7 +1172,7 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
if (toAdd)
{
if (store)
ret = store->crls.addContext(store, (void *)toAdd,
ret = store->vtbl->crls.addContext(store, (void *)toAdd,
(void *)existing, (const void **)ppStoreContext);
else if (ppStoreContext)
*ppStoreContext = CertDuplicateCRLContext(toAdd);
......@@ -1197,7 +1201,7 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = FALSE;
else
ret = hcs->crls.deleteContext(hcs, (void *)pCrlContext);
ret = hcs->vtbl->crls.deleteContext(hcs, (void *)pCrlContext);
if (ret)
ret = CertFreeCRLContext(pCrlContext);
}
......@@ -1216,7 +1220,7 @@ PCCRL_CONTEXT WINAPI CertEnumCRLsInStore(HCERTSTORE hCertStore,
else if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
ret = NULL;
else
ret = (PCCRL_CONTEXT)hcs->crls.enumContext(hcs, (void *)pPrev);
ret = (PCCRL_CONTEXT)hcs->vtbl->crls.enumContext(hcs, (void *)pPrev);
return ret;
}
......
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