Module: wine Branch: master Commit: b3b1135d8433e0fb2c580668fd09197e326adb4d URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3b1135d8433e0fb2c580668fd...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Oct 14 14:45:28 2013 +0200
crypt32: Added addref to store vtbl and use it instead of directly accessing ref.
---
dlls/crypt32/collectionstore.c | 7 +++++++ dlls/crypt32/crypt32_private.h | 1 + dlls/crypt32/provstore.c | 7 +++++++ dlls/crypt32/rootstore.c | 2 +- dlls/crypt32/store.c | 9 ++++++++- 5 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/crypt32/collectionstore.c b/dlls/crypt32/collectionstore.c index c60ca20..2278c4d 100644 --- a/dlls/crypt32/collectionstore.c +++ b/dlls/crypt32/collectionstore.c @@ -40,6 +40,12 @@ typedef struct _WINE_COLLECTIONSTORE struct list stores; } WINE_COLLECTIONSTORE;
+static void Collection_addref(WINECRYPT_CERTSTORE *store) +{ + LONG ref = InterlockedIncrement(&store->ref); + TRACE("ref = %d\n", ref); +} + static void Collection_closeStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags) { WINE_COLLECTIONSTORE *cs = (WINE_COLLECTIONSTORE*)store; @@ -477,6 +483,7 @@ static BOOL Collection_control(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags, }
static const store_vtbl_t CollectionStoreVtbl = { + Collection_addref, Collection_closeStore, Collection_control }; diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index 3fa5d98..c939c5d 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -246,6 +246,7 @@ typedef struct _CONTEXT_PROPERTY_LIST CONTEXT_PROPERTY_LIST; */
typedef struct { + void (*addref)(struct WINE_CRYPTCERTSTORE*); void (*closeStore)(struct WINE_CRYPTCERTSTORE*,DWORD); BOOL (*control)(struct WINE_CRYPTCERTSTORE*,DWORD,DWORD,void const*); } store_vtbl_t; diff --git a/dlls/crypt32/provstore.c b/dlls/crypt32/provstore.c index 38f0eab..06cfbc8 100644 --- a/dlls/crypt32/provstore.c +++ b/dlls/crypt32/provstore.c @@ -41,6 +41,12 @@ typedef struct _WINE_PROVIDERSTORE PFN_CERT_STORE_PROV_CONTROL provControl; } WINE_PROVIDERSTORE;
+static void ProvStore_addref(WINECRYPT_CERTSTORE *store) +{ + LONG ref = InterlockedIncrement(&store->ref); + TRACE("ref = %d\n", ref); +} + static void ProvStore_closeStore(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags) { WINE_PROVIDERSTORE *store = (WINE_PROVIDERSTORE*)cert_store; @@ -262,6 +268,7 @@ static BOOL ProvStore_control(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags, DW }
static const store_vtbl_t ProvStoreVtbl = { + ProvStore_addref, ProvStore_closeStore, ProvStore_control }; diff --git a/dlls/crypt32/rootstore.c b/dlls/crypt32/rootstore.c index ef0a0f7..efe8340 100644 --- a/dlls/crypt32/rootstore.c +++ b/dlls/crypt32/rootstore.c @@ -832,7 +832,7 @@ WINECRYPT_CERTSTORE *CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) if (CRYPT_rootStore != root) CertCloseStore(root, 0); } - CertDuplicateStore(CRYPT_rootStore); + CRYPT_rootStore->vtbl->addref(CRYPT_rootStore); return CRYPT_rootStore; }
diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index 0042d92..9623094 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -284,6 +284,12 @@ static BOOL CRYPT_MemDeleteCtl(WINECRYPT_CERTSTORE *store, void *pCtlContext) return ret; }
+static void MemStore_addref(WINECRYPT_CERTSTORE *store) +{ + LONG ref = InterlockedIncrement(&store->ref); + TRACE("ref = %d\n", ref); +} + static void MemStore_closeStore(WINECRYPT_CERTSTORE *cert_store, DWORD dwFlags) { WINE_MEMSTORE *store = (WINE_MEMSTORE*)cert_store; @@ -306,6 +312,7 @@ static BOOL MemStore_control(WINECRYPT_CERTSTORE *store, DWORD dwFlags, }
static const store_vtbl_t MemStoreVtbl = { + MemStore_addref, MemStore_closeStore, MemStore_control }; @@ -1213,7 +1220,7 @@ HCERTSTORE WINAPI CertDuplicateStore(HCERTSTORE hCertStore) TRACE("(%p)\n", hCertStore);
if (hcs && hcs->dwMagic == WINE_CRYPTCERTSTORE_MAGIC) - InterlockedIncrement(&hcs->ref); + hcs->vtbl->addref(hcs); return hCertStore; }