Commit b3b1135d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

crypt32: Added addref to store vtbl and use it instead of directly accessing ref.

parent a804cc71
......@@ -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
};
......
......@@ -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;
......
......@@ -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
};
......
......@@ -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;
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment