crypt32: Simplify I_CertUpdateStore.

oldstable
Juan Lang 2007-10-19 21:22:58 -07:00 committed by Alexandre Julliard
parent 9568cead65
commit a762ffbe14
1 changed files with 37 additions and 49 deletions

View File

@ -117,6 +117,43 @@ void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store)
CryptMemFree(store);
}
BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0,
DWORD unk1)
{
static BOOL warned = FALSE;
const WINE_CONTEXT_INTERFACE * const interfaces[] = { pCertInterface,
pCRLInterface, pCTLInterface };
DWORD i;
TRACE("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1);
if (!warned)
{
FIXME("semi-stub\n");
warned = TRUE;
}
/* Poor-man's resync: empty first store, then add everything from second
* store to it.
*/
for (i = 0; i < sizeof(interfaces) / sizeof(interfaces[0]); i++)
{
const void *context;
do {
context = interfaces[i]->enumContextsInStore(store1, NULL);
if (context)
interfaces[i]->deleteFromStore(context);
} while (context);
do {
context = interfaces[i]->enumContextsInStore(store2, context);
if (context)
interfaces[i]->addContextToStore(store1, context,
CERT_STORE_ADD_ALWAYS, NULL);
} while (context);
}
return TRUE;
}
static BOOL CRYPT_MemAddCert(PWINECRYPT_CERTSTORE store, void *cert,
void *toReplace, const void **ppStoreContext)
{
@ -199,55 +236,6 @@ static BOOL CRYPT_MemDeleteCrl(PWINECRYPT_CERTSTORE store, void *pCrlContext)
return TRUE;
}
static void CRYPT_EmptyStore(HCERTSTORE store)
{
PCCERT_CONTEXT cert;
PCCRL_CONTEXT crl;
do {
cert = CertEnumCertificatesInStore(store, NULL);
if (cert)
CertDeleteCertificateFromStore(cert);
} while (cert);
do {
crl = CertEnumCRLsInStore(store, NULL);
if (crl)
CertDeleteCRLFromStore(crl);
} while (crl);
}
BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0,
DWORD unk1)
{
static BOOL warned = FALSE;
PCCERT_CONTEXT cert = NULL;
PCCRL_CONTEXT crl = NULL;
TRACE("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1);
if (!warned)
{
FIXME("semi-stub\n");
warned = TRUE;
}
/* Poor-man's resync: empty first store, then add everything from second
* store to it.
*/
CRYPT_EmptyStore(store1);
do {
cert = CertEnumCertificatesInStore(store2, cert);
if (cert)
CertAddCertificateContextToStore(store1, cert,
CERT_STORE_ADD_ALWAYS, NULL);
} while (cert);
do {
crl = CertEnumCRLsInStore(store2, crl);
if (crl)
CertAddCRLContextToStore(store1, crl, CERT_STORE_ADD_ALWAYS, NULL);
} while (crl);
return TRUE;
}
static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
{
WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore;