crypt32(5/13): Use public APIs to empty a store

Juan Lang juan.lang at gmail.com
Wed Aug 15 18:47:32 CDT 2007


--Juan
-------------- next part --------------
From bef0dfb7d6e781109485c7af8b2ae65c1652d6b7 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Wed, 15 Aug 2007 16:33:01 -0700
Subject: [PATCH] Use public APIs to empty a store
---
 dlls/crypt32/store.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index 3a57c06..8de31f4 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -262,10 +262,21 @@ static BOOL CRYPT_MemDeleteCrl(PWINECRYP
     return TRUE;
 }
 
-static void CRYPT_MemEmptyStore(PWINE_MEMSTORE store)
+static void CRYPT_EmptyStore(HCERTSTORE store)
 {
-    ContextList_Empty(store->certs);
-    ContextList_Empty(store->crls);
+    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);
 }
 
 static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
@@ -1305,7 +1316,7 @@ static BOOL WINAPI CRYPT_RegControl(HCER
     {
     case CERT_STORE_CTRL_RESYNC:
         CRYPT_RegFlushStore(store, FALSE);
-        CRYPT_MemEmptyStore((PWINE_MEMSTORE)store->memStore);
+        CRYPT_EmptyStore(store->memStore);
         CRYPT_RegReadFromReg(store);
         ret = TRUE;
         break;
@@ -1703,7 +1714,7 @@ static BOOL WINAPI CRYPT_FileControl(HCE
     switch (dwCtrlType)
     {
     case CERT_STORE_CTRL_RESYNC:
-        CRYPT_MemEmptyStore((PWINE_MEMSTORE)store->memStore);
+        CRYPT_EmptyStore(store->memStore);
         CRYPT_ReadSerializedFile(store->file, store);
         ret = TRUE;
         break;
-- 
1.4.1


More information about the wine-patches mailing list