Juan Lang : crypt32: Fix system stores and a memory leak.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Feb 16 05:34:20 CST 2006
Module: wine
Branch: refs/heads/master
Commit: e9c44cc0c48203ab239d70af2af9788010eda8f6
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=e9c44cc0c48203ab239d70af2af9788010eda8f6
Author: Juan Lang <juan_lang at yahoo.com>
Date: Thu Feb 16 12:18:37 2006 +0100
crypt32: Fix system stores and a memory leak.
- system stores open both HKLM and HKCU for "current user" locations
- fix a memory leak in certificate properties
---
dlls/crypt32/cert.c | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c
index c48a5dd..6b6a08d 100644
--- a/dlls/crypt32/cert.c
+++ b/dlls/crypt32/cert.c
@@ -1718,12 +1718,27 @@ static PWINECRYPT_CERTSTORE CRYPT_SysOpe
{
store = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
- if (store)
+ CertAddStoreToCollection(store, regStore,
+ dwFlags & CERT_STORE_READONLY_FLAG ? 0 :
+ CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
+ CertCloseStore(regStore, 0);
+ /* CERT_SYSTEM_STORE_CURRENT_USER returns both the HKCU and HKLM
+ * stores.
+ */
+ if ((dwFlags & CERT_SYSTEM_STORE_LOCATION_MASK) ==
+ CERT_SYSTEM_STORE_CURRENT_USER)
{
- CertAddStoreToCollection(store, regStore,
- dwFlags & CERT_STORE_READONLY_FLAG ? 0 :
- CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
- CertCloseStore(regStore, 0);
+ dwFlags &= ~CERT_SYSTEM_STORE_CURRENT_USER;
+ dwFlags |= CERT_SYSTEM_STORE_LOCAL_MACHINE;
+ regStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_W, 0,
+ hCryptProv, dwFlags, pvPara);
+ if (regStore)
+ {
+ CertAddStoreToCollection(store, regStore,
+ dwFlags & CERT_STORE_READONLY_FLAG ? 0 :
+ CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG, 0);
+ CertCloseStore(regStore, 0);
+ }
}
}
}
@@ -2227,15 +2242,19 @@ static BOOL CRYPT_SaveCertificateContext
if (!cbData || data)
{
PWINE_CERT_PROPERTY prop;
+ BOOL found = FALSE;
EnterCriticalSection(&context->cs);
LIST_FOR_EACH_ENTRY(prop, &context->extendedProperties,
WINE_CERT_PROPERTY, entry)
{
if (prop->hdr.propID == dwPropId)
+ {
+ found = TRUE;
break;
+ }
}
- if (prop && prop->entry.next != &context->extendedProperties)
+ if (found)
{
CryptMemFree(prop->pbData);
prop->hdr.cb = cbData;
More information about the wine-cvs
mailing list