From: Dmitry Timoshkov <dmitry@baikal.ru> This prevents closing a not owned provider handle. Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> --- dlls/crypt32/store.c | 4 ++-- dlls/crypt32/tests/store.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 54b16ab8fa1..ac17a3d4768 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -948,7 +948,7 @@ HCERTSTORE WINAPI CertOpenSystemStoreA(HCRYPTPROV_LEGACY hProv, return 0; } return CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, hProv, - CERT_SYSTEM_STORE_CURRENT_USER, szSubSystemProtocol); + CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_NO_CRYPT_RELEASE_FLAG, szSubSystemProtocol); } HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv, @@ -960,7 +960,7 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv, return 0; } return CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, hProv, - CERT_SYSTEM_STORE_CURRENT_USER, szSubSystemProtocol); + CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_NO_CRYPT_RELEASE_FLAG, szSubSystemProtocol); } PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_CONTEXT pPrev) diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index f14611d7e41..33e4e34a9e8 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -2092,14 +2092,11 @@ static void testCertOpenSystemStore(void) size = sizeof(pp_type); pp_type = 0xdeadbeef; ret = CryptGetProvParam(prov, PP_PROVTYPE, (BYTE *)&pp_type, &size, 0); - todo_wine ok(ret, "CryptGetProvParam failed: %08lx\n", GetLastError()); - todo_wine ok(pp_type == PROV_RSA_FULL, "got %lu\n", pp_type); CertCloseStore(store, 0); ret = CryptReleaseContext(prov, 0); - todo_wine ok(ret, "CryptReleaseContext: %08lx\n", GetLastError()); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10530