crypt32: Added support for CERT_CLOSE_STORE_CHECK_FLAG flag in MemStore_release.

oldstable
Jacek Caban 2013-10-14 14:45:53 +02:00 committed by Alexandre Julliard
parent 2256a728fe
commit be023607cc
2 changed files with 34 additions and 2 deletions

View File

@ -296,13 +296,13 @@ static DWORD MemStore_release(WINECRYPT_CERTSTORE *cert_store, DWORD flags)
WINE_MEMSTORE *store = (WINE_MEMSTORE*)cert_store;
LONG ref;
if(flags)
if(flags & ~CERT_CLOSE_STORE_CHECK_FLAG)
FIXME("Unimplemented flags %x\n", flags);
ref = InterlockedDecrement(&store->hdr.ref);
TRACE("(%p) ref=%d\n", store, ref);
if(ref)
return ERROR_SUCCESS;
return (flags & CERT_CLOSE_STORE_CHECK_FLAG) ? CRYPT_E_PENDING_CLOSE : ERROR_SUCCESS;
ContextList_Free(store->certs);
ContextList_Free(store->crls);

View File

@ -2557,10 +2557,41 @@ static void testEmptyStore(void)
CertCloseStore(store, 0);
res = CertCloseStore(cert->hCertStore, CERT_CLOSE_STORE_CHECK_FLAG);
ok(!res && GetLastError() == E_UNEXPECTED, "CertCloseStore returned: %x(%x)\n", res, GetLastError());
res = CertCloseStore(cert->hCertStore, 0);
ok(!res && GetLastError() == E_UNEXPECTED, "CertCloseStore returned: %x(%x)\n", res, GetLastError());
CertFreeCertificateContext(cert2);
CertFreeCertificateContext(cert);
}
static void testCloseStore(void)
{
HCERTSTORE store, store2;
BOOL res;
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed\n");
res = CertCloseStore(store, CERT_CLOSE_STORE_CHECK_FLAG);
ok(res, "CertCloseStore failed\n");
store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL);
ok(store != NULL, "CertOpenStore failed\n");
store2 = CertDuplicateStore(store);
ok(store2 != NULL, "CertCloneStore failed\n");
ok(store2 == store, "unexpected store2\n");
res = CertCloseStore(store, CERT_CLOSE_STORE_CHECK_FLAG);
ok(!res && GetLastError() == CRYPT_E_PENDING_CLOSE, "CertCloseStore failed\n");
res = CertCloseStore(store2, CERT_CLOSE_STORE_CHECK_FLAG);
ok(res, "CertCloseStore failed\n");
}
static void test_I_UpdateStore(void)
{
HMODULE lib = GetModuleHandleA("crypt32");
@ -2659,6 +2690,7 @@ START_TEST(store)
testFileNameStore();
testMessageStore();
testSerializedStore();
testCloseStore();
testCertOpenSystemStore();
testCertEnumSystemStore();