crypt32: Don't store a redundant copy of data in the message store.

oldstable
Juan Lang 2007-11-02 12:23:06 -07:00 committed by Alexandre Julliard
parent 8b17846d6a
commit 3d1ba2ab9d
1 changed files with 13 additions and 33 deletions

View File

@ -93,13 +93,6 @@ typedef struct _WINE_MEMSTORE
struct ContextList *crls;
} WINE_MEMSTORE, *PWINE_MEMSTORE;
typedef struct _WINE_MSGSTOREINFO
{
DWORD dwOpenFlags;
HCERTSTORE memStore;
HCRYPTMSG msg;
} WINE_MSGSTOREINFO, *PWINE_MSGSTOREINFO;
void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags,
CertStoreType type)
{
@ -528,12 +521,10 @@ static PWINECRYPT_CERTSTORE CRYPT_SysOpenStoreA(HCRYPTPROV hCryptProv,
static void WINAPI CRYPT_MsgCloseStore(HCERTSTORE hCertStore, DWORD dwFlags)
{
PWINE_MSGSTOREINFO store = (PWINE_MSGSTOREINFO)hCertStore;
HCRYPTMSG msg = (HCRYPTMSG)hCertStore;
TRACE("(%p, %08x)\n", store, dwFlags);
CertCloseStore(store->memStore, dwFlags);
CryptMsgClose(store->msg);
CryptMemFree(store);
TRACE("(%p, %08x)\n", msg, dwFlags);
CryptMsgClose(msg);
}
static void *msgProvFuncs[] = {
@ -613,28 +604,17 @@ static PWINECRYPT_CERTSTORE CRYPT_MsgOpenStore(HCRYPTPROV hCryptProv,
}
if (ret)
{
PWINE_MSGSTOREINFO info = CryptMemAlloc(sizeof(WINE_MSGSTOREINFO));
CERT_STORE_PROV_INFO provInfo = { 0 };
if (info)
{
CERT_STORE_PROV_INFO provInfo = { 0 };
info->dwOpenFlags = dwFlags;
info->memStore = memStore;
info->msg = CryptMsgDuplicate(msg);
provInfo.cbSize = sizeof(provInfo);
provInfo.cStoreProvFunc = sizeof(msgProvFuncs) /
sizeof(msgProvFuncs[0]);
provInfo.rgpvStoreProvFunc = msgProvFuncs;
provInfo.hStoreProv = info;
store = CRYPT_ProvCreateStore(dwFlags, memStore,
&provInfo);
/* Msg store doesn't need crypto provider, so close it */
if (hCryptProv && !(dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG))
CryptReleaseContext(hCryptProv, 0);
}
else
CertCloseStore(memStore, 0);
provInfo.cbSize = sizeof(provInfo);
provInfo.cStoreProvFunc = sizeof(msgProvFuncs) /
sizeof(msgProvFuncs[0]);
provInfo.rgpvStoreProvFunc = msgProvFuncs;
provInfo.hStoreProv = CryptMsgDuplicate(msg);
store = CRYPT_ProvCreateStore(dwFlags, memStore, &provInfo);
/* Msg store doesn't need crypto provider, so close it */
if (hCryptProv && !(dwFlags & CERT_STORE_NO_CRYPT_RELEASE_FLAG))
CryptReleaseContext(hCryptProv, 0);
}
else
CertCloseStore(memStore, 0);