Juan Lang : crypt32: Implement I_CertUpdateStore.
Alexandre Julliard
julliard at winehq.org
Fri Oct 19 08:35:46 CDT 2007
Module: wine
Branch: master
Commit: e857f383a428f07e7b0f1e0dbbec7ffa62d5e54b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e857f383a428f07e7b0f1e0dbbec7ffa62d5e54b
Author: Juan Lang <juan.lang at gmail.com>
Date: Thu Oct 18 11:10:55 2007 -0700
crypt32: Implement I_CertUpdateStore.
---
dlls/crypt32/main.c | 10 ----------
dlls/crypt32/store.c | 32 ++++++++++++++++++++++++++++++++
dlls/crypt32/tests/store.c | 11 -----------
3 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c
index fa8b782..12f2885 100644
--- a/dlls/crypt32/main.c
+++ b/dlls/crypt32/main.c
@@ -60,16 +60,6 @@ HCRYPTPROV CRYPT_GetDefaultProvider(void)
return hDefProv;
}
-/* Appears to be called to update the contents of store1 with those in store2.
- * The second two parameters are unknown.
- */
-BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0,
- DWORD unk1)
-{
- FIXME("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1);
- return FALSE;
-}
-
typedef void * HLRUCACHE;
/* this function is called by Internet Explorer when it is about to verify a
diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index c32ae62..28c37d2 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -216,6 +216,38 @@ void CRYPT_EmptyStore(HCERTSTORE store)
} 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;
diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c
index 99fac18..05ea5e0 100644
--- a/dlls/crypt32/tests/store.c
+++ b/dlls/crypt32/tests/store.c
@@ -1840,32 +1840,25 @@ static void test_I_UpdateStore(void)
ret = pI_CertUpdatestore(NULL, store2, 0, 0);
*/
ret = pI_CertUpdatestore(store1, store2, 0, 0);
- todo_wine
ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
CertAddEncodedCertificateToStore(store2, X509_ASN_ENCODING, bigCert,
sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &cert);
/* I_CertUpdateStore adds the contexts from store2 to store1 */
ret = pI_CertUpdatestore(store1, store2, 0, 0);
- todo_wine
ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
certs = countCertsInStore(store1);
- todo_wine
ok(certs == 1, "Expected 1 cert, got %d\n", certs);
/* Calling it a second time has no effect */
ret = pI_CertUpdatestore(store1, store2, 0, 0);
- todo_wine
ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
certs = countCertsInStore(store1);
- todo_wine
ok(certs == 1, "Expected 1 cert, got %d\n", certs);
/* The last parameters to I_CertUpdateStore appear to be ignored */
ret = pI_CertUpdatestore(store1, store2, 1, 0);
- todo_wine
ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
ret = pI_CertUpdatestore(store1, store2, 0, 1);
- todo_wine
ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
CertAddEncodedCRLToStore(store2, X509_ASN_ENCODING, signedCRL,
@@ -1873,13 +1866,10 @@ static void test_I_UpdateStore(void)
/* I_CertUpdateStore also adds the CRLs from store2 to store1 */
ret = pI_CertUpdatestore(store1, store2, 0, 0);
- todo_wine
ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
certs = countCertsInStore(store1);
- todo_wine
ok(certs == 1, "Expected 1 cert, got %d\n", certs);
certs = countCRLsInStore(store1);
- todo_wine
ok(certs == 1, "Expected 1 CRL, got %d\n", certs);
CertDeleteCertificateFromStore(cert);
@@ -1887,7 +1877,6 @@ static void test_I_UpdateStore(void)
* from store1
*/
ret = pI_CertUpdatestore(store1, store2, 0, 0);
- todo_wine
ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError());
certs = countCertsInStore(store1);
ok(certs == 0, "Expected 0 certs, got %d\n", certs);
More information about the wine-cvs
mailing list