From d728169d97a881f252fcac5e8d5de8e41cc2a71b Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Fri, 14 May 2010 15:48:18 -0700 Subject: [PATCH] crypt32: Implement CertAddCertificateLinkToStore on top of CertAddCertificateContextToStore. --- dlls/crypt32/cert.c | 9 ++++++--- dlls/crypt32/tests/store.c | 10 +--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index 3d4a34cb1c5..12c013e7a4a 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -113,10 +113,12 @@ BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pCertContext, DWORD dwAddDisposition, PCCERT_CONTEXT *ppCertContext) { + static int calls; PWINECRYPT_CERTSTORE store = (PWINECRYPT_CERTSTORE)hCertStore; - FIXME("(%p, %p, %08x, %p)\n", hCertStore, pCertContext, dwAddDisposition, - ppCertContext); + if (!(calls++)) + FIXME("(%p, %p, %08x, %p): semi-stub\n", hCertStore, pCertContext, + dwAddDisposition, ppCertContext); if (store->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) return FALSE; if (store->type == StoreTypeCollection) @@ -124,7 +126,8 @@ BOOL WINAPI CertAddCertificateLinkToStore(HCERTSTORE hCertStore, SetLastError(E_INVALIDARG); return FALSE; } - return FALSE; + return CertAddCertificateContextToStore(hCertStore, pCertContext, + dwAddDisposition, ppCertContext); } PCCERT_CONTEXT WINAPI CertCreateCertificateContext(DWORD dwCertEncodingType, diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index abc44e20876..cab74c60ba8 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -2078,7 +2078,6 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb, { ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE, CERT_STORE_SAVE_TO_MEMORY, &blob, 0); - ok(ret, "CertSaveStore failed: %08x\n", GetLastError()); ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name); HeapFree(GetProcessHeap(), 0, blob.pbData); } @@ -2151,19 +2150,16 @@ static void testAddCertificateLink(void) CERT_STORE_CREATE_NEW_FLAG, NULL); SetLastError(0xdeadbeef); ret = CertAddCertificateLinkToStore(store1, NULL, 0, NULL); - todo_wine ok(!ret && GetLastError() == E_INVALIDARG, "expected E_INVALIDARG, got %08x\n", GetLastError()); source = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert)); SetLastError(0xdeadbeef); ret = CertAddCertificateLinkToStore(store1, source, 0, NULL); - todo_wine ok(!ret && GetLastError() == E_INVALIDARG, "expected E_INVALIDARG, got %08x\n", GetLastError()); ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS, NULL); - todo_wine ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError()); if (0) { @@ -2179,7 +2175,6 @@ static void testAddCertificateLink(void) CERT_STORE_CREATE_NEW_FLAG, NULL); ret = CertAddCertificateLinkToStore(store1, source, CERT_STORE_ADD_ALWAYS, &linked); - todo_wine ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError()); if (ret) { @@ -2252,7 +2247,6 @@ static void testAddCertificateLink(void) CERT_STORE_CREATE_NEW_FLAG, NULL); ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS, &linked); - todo_wine ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError()); if (ret) { @@ -2313,7 +2307,6 @@ static void testAddCertificateLink(void) /* Test adding a link to a file store. */ ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS, &linked); - todo_wine ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError()); if (ret) { @@ -2381,13 +2374,13 @@ static void testAddCertificateLink(void) ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS, &linked); - todo_wine ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError()); if (ret) { ok(linked->hCertStore == store2, "unexpected store"); ret = pCertControlStore(store2, 0, CERT_STORE_CTRL_COMMIT, NULL); ok(ret, "CertControlStore failed: %d\n", ret); + todo_wine compareStore(store2, "file store -> system store", serializedStoreWithCertAndHash, sizeof(serializedStoreWithCertAndHash)); @@ -2405,7 +2398,6 @@ static void testAddCertificateLink(void) ok(store2 != NULL, "CertOpenStore failed: %08x\n", GetLastError()); ret = CertAddCertificateLinkToStore(store2, source, CERT_STORE_ADD_ALWAYS, &linked); - todo_wine ok(ret, "CertAddCertificateLinkToStore failed: %08x\n", GetLastError()); if (ret) { -- 2.11.4.GIT